#endif
List<aClient> players;
+
Monster *monsters[LEVELS][MONSTERS]; // Monsters per level. Total = MONSTERS * LEVELS
Monster *masters[LEVELS]; // A master for each level
char *cmd;
cmd = strtok(buf, " ");
- source++; // Get rid of that : at the beginning of a :Nick privmsg Gameserv :text
- cmd++; // Get rid of that : at the beginning of the :text (command)
+ #ifndef P10
+ source++; // Get rid of that : at the beginning of a :Nick privmsg Gameserv :text
+ #endif
+
+ if (cmd[0] == ':')
+ cmd++; // Get rid of that : at the beginning of the :text (command)
#ifdef DEBUGMODE
log("Source: %s Command: %s", source, cmd);
do_tavern(source);
} else if (stricmp(cmd, "LIST") == 0) {
do_list(source);
+ #ifdef DEBUGMODE
+ } else if (stricmp(cmd, "PRINT") == 0) {
+ cout << "Printing the clients list:" << endl;
+ clients.print();
+ cout << "\nPrinting the players list:" << endl;
+ players.print();
+ #endif
} else if (stricmp(cmd, "REGISTER") == 0) {
do_register(source);
} else if (stricmp(cmd, "IDENTIFY") == 0) {
else
{
save_gs_dbase();
- raw("SQUIT %s :leaving", servername);
+ #ifdef P10
+ raw("SQ %s 0 :leaving", servername);
+ #else
+ raw("SQUIT %s :leaving", servername);
+ #endif
}
} else if (stricmp(cmd, "SAVE") == 0) {
aClient *user;
if (dest[0] == ':')
{
dest++;
+
+ #if !defined(P10)
sprintf(input, ":%s NOTICE %s :", source, dest);
+ #else
+ sprintf(input, "%s O %s :", gsnum, dest);
+ #endif
+
dest--;
}
else
+ {
+ #if !defined(P10)
sprintf(input, ":%s NOTICE %s :", source, dest);
+ #else
+ sprintf(input, "%s O %s :", gsnum, dest);
+ #endif
+ }
for (; *t; t++)
{
void do_register(char *u)
{
- char *password;
+ char *password, *name;
aClient *user, *p;
+ name = strtok(NULL, " ");
password = strtok(NULL, " ");
static char saltChars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
salt[1] = saltChars[rand() % strlen(saltChars)];
salt[2] = '\0';
- if (!password)
+ if (!name)
+ {
+ notice(s_GameServ, u, "SYNTAX: /msg %S REGISTER NAME PASSWORD");
+ }
+ else if (!password)
{
- notice(s_GameServ, u, "SYNTAX: /msg %S REGISTER PASSWORD");
+ notice(s_GameServ, u, "SYNTAX: /msg %S REGISTER NAME PASSWORD");
}
else if ((user = find(u)))
{
user->stats = new Player(user);
user->stats->user = user; // Set the backwards pointer
strcpy(user->stats->password, crypt(password, salt));
+ strcpy(user->stats->name, name);
players.insertAtBack(user);
notice(s_GameServ, u, "Player %s registered with password %s.", user->stats->name, password);
notice(s_GameServ, u, "Write this password down. If you lose it, there is no way to retrieve it!");