Version 1.2.2
+* Made welcomemsg an optional config file option. If commented out
+ or deleted, gameserv will not send the welcome message - kain
* Made the ignoreservers config file option work for Unreal - kain
* Fixed a minor logical problem that was causing players to be mugged
for 0 gold when they were either dead or had no gold on hand and
{
char *buf, *directive, *value;
- #define numdirectives 22
+ #define numdirectives 21
unload_config_file();
directives[12].desc = "WELCOMEDELAY - Delay (in seconds) to wait before welcoming new users to the network";
directives[13].desc = "FORESTFIGHTS - Number of forest fights players get every day";
directives[14].desc = "UPDATEPERIOD - Number of seconds between every player data save";
- directives[15].desc = "WELCOMEMSG - Message to send to new users on the network";
- directives[16].desc = "PIDFILE - Filename to store the gameserv process ID in";
- directives[17].desc = "MAXAFIGHTDISTANCE - The maximum number of levels above you "\
+ directives[15].desc = "PIDFILE - Filename to store the gameserv process ID in";
+ directives[16].desc = "MAXAFIGHTDISTANCE - The maximum number of levels above you "\
"that you can fight player->player";
- directives[18].desc = "MAXBFIGHTDISTANCE - The maximum number of levels below you "\
+ directives[17].desc = "MAXBFIGHTDISTANCE - The maximum number of levels below you "\
"that you can fight player->player";
- directives[19].desc = "MAXIDLETIME - The maximum amount of time (in seconds) "\
+ directives[18].desc = "MAXIDLETIME - The maximum amount of time (in seconds) "\
"that a player can be idle before something happens";
- directives[20].desc = "IDLECHECKPERIOD - The period (in seconds) in which the entire "\
+ directives[19].desc = "IDLECHECKPERIOD - The period (in seconds) in which the entire "\
"players list will be checked for idlers. See also: "\
"MAXIDLETIME";
- directives[21].desc = "LISTENONC_FOREST - True/False as to "\
+ directives[20].desc = "LISTENONC_FOREST - True/False as to "\
"whether or not to listen for forest "\
"commands on the forest channel";
updateperiod = stringtoint(value);
directives[14].done = true;
}
- else if (stricmp(directive, "WELCOMEMSG") == 0)
- {
- value = strtok(NULL, "");
- welcomemsg = new char[strlen(value) + 1];
- strcpy(welcomemsg, value);
- directives[15].done = true;
- }
else if (stricmp(directive, "PIDFILE") == 0)
{
value = strtok(NULL, " ");
pidfile = new char[strlen(value) + 1];
strcpy(pidfile, value);
- directives[16].done = true;
+ directives[15].done = true;
}
else if (stricmp(directive, "MAXAFIGHTDISTANCE") == 0)
{
value = strtok(NULL, " ");
maxafightdistance = stringtoint(value);
- directives[17].done = true;;
+ directives[16].done = true;;
}
else if (stricmp(directive, "MAXBFIGHTDISTANCE") == 0)
{
value = strtok(NULL, " ");
maxbfightdistance = stringtoint(value);
- directives[18].done = true;
+ directives[17].done = true;
}
else if (stricmp(directive, "MAXIDLETIME") == 0)
{
value = strtok(NULL, " ");
maxidletime = stringtoint(value);
- directives[19].done = true;
+ directives[18].done = true;
}
else if (stricmp(directive, "IDLECHECKPERIOD") == 0)
{
value = strtok(NULL, " ");
idlecheckperiod = stringtoint(value);
- directives[20].done = true;
+ directives[19].done = true;
}
else if (stricmp(directive, "LISTENONC_FOREST") == 0)
{
if (stricmp(value, "TRUE") == 0)
setListenOnCF();
- directives[21].done = true;
+ directives[20].done = true;
+ }
+ else if (stricmp(directive, "WELCOMEMSG") == 0)
+ {
+ // This directive is optional
+ value = strtok(NULL, "");
+ welcomemsg = new char[strlen(value) + 1];
+ strcpy(welcomemsg, value);
+ setWelcome();
}
else if (stricmp(directive, "USEPRIVMSG") == 0)
{
*/
// aClient FLAGS ONLY
-#define FLAG_ADMIN 0x0001
-#define FLAG_IGNORE 0x0002
-#define FLAG_PLAYING 0x0004
+#define FLAG_ADMIN 0x00000001
+#define FLAG_IGNORE 0x00000002
+#define FLAG_PLAYING 0x00000004
// PLAYER FLAGS ONLY
-#define FLAG_MASTER 0x0001
-#define FLAG_ALIVE 0x0002
-#define FLAG_YOURTURN 0x0004
-#define FLAG_WONGAME 0x0008
+#define FLAG_MASTER 0x00000001
+#define FLAG_ALIVE 0x00000002
+#define FLAG_YOURTURN 0x00000004
+#define FLAG_WONGAME 0x00000008
// Config File flags
-#define CFLAG_LISTENONCF 0x0001
-#define CFLAG_USEPRIVMSG 0x0002
-#define CFLAG_BOPER 0x0004
+#define CFLAG_LISTENONCF 0x00000001
+#define CFLAG_USEPRIVMSG 0x00000002
+#define CFLAG_BOPER 0x00000004
+#define CFLAG_WELCOME 0x00000008
+
+#define setWelcome() (configflags |= CFLAG_WELCOME)
+#define clearWelcome() (configflags &= ~CFLAG_WELCOME)
+#define isWelcome() (configflags & CFLAG_WELCOME)
#define setListenOnCF() (configflags |= CFLAG_LISTENONCF)
#define clearListenOnCF() (configflags &= ~CFLAG_LISTENONCF)
void do_logout(char *u)
{
aClient *user;
+ char *name = strtok(NULL, " ");
+
if (!(user = find(u)))
{
notice(s_GameServ, u, "Fatal error. Cannot find aClient. "\
"Buf: %s LOGOUT", u);
log("Could not find aClient Buf: %s LOGOUT",
u);
+ return;
}
else if (isIgnore(user))
{
#endif
return;
}
- else if (!is_playing(user))
- {
- notice(s_GameServ, u, "You're not logged in!");
- }
- else if (is_fighting(user))
+
+ if (name)
{
- notice(s_GameServ, u, "You can't logout while fighting!");
+ if (!isAdmin(user))
+ {
+ notice(s_GameServ, u, "You must be a %S admin to use this command!");
+ }
+ else if (!(user = findplayer(name)))
+ {
+ notice(s_GameServ, u, "Couldn't find a player named %s", name);
+ }
+ else
+ {
+ notice(s_GameServ, u, "Logging out %s", user->stats->name);
+ logout(user);
+ }
}
- else
+ else if (!name)
{
- notice(s_GameServ, u, "You have left the fields. You have lived to kill another day!");
- logout(user);
+ if (!is_playing(user))
+ {
+ notice(s_GameServ, u, "You're not logged in!");
+ }
+ else if (is_fighting(user))
+ {
+ notice(s_GameServ, u, "You can't logout while fighting!");
+ }
+ else
+ {
+ notice(s_GameServ, u, "You have left the fields. You have lived to kill another day!");
+ logout(user);
+ }
}
}
welcomedelay 10
# Message that is displayed to new clients that join the IRC Network
-# Welcomemsg is a formatted string. To use it in a function that uses formatting like notice(), you must include a string
-# as an argument. i.e. notice(s_GameServ, u, welcomemsg, nick);
-# This is only true if you include anything like %s etc... if you include more than one %s or %d or anything, you must
-# include the proper type as an argument also.
+# Welcomemsg is a formatted string. You MUST include one %s and only
+# one %s. Do not put any %d %ld or other %s into this string! You will
+# break something, because there will be a leftover argument when it is
+# called in tcpclient.cpp, because that expects one %s and nothing else.
+# Comment this out to disable sending a welcome message
welcomemsg Hello, %s! This network utilizes a services package called GameServ. For info on how to play the game, type /msg %S help.
# This is an optional config file entry that allows you to specify
This command allows players to stop playing without needing to quit the IRC Server.
-SYNTAX: \ 2LOGOUT\ 2
+Only %S admins may logout other players.
+SYNTAX: \ 2LOGOUT\ 2 [\1fname\1f]
Example: /msg %S \ 2LOGOUT\ 2
if (loaded)
- #ifdef P10
- notice(s_GameServ, nick, welcomemsg, realnick);
- #else
- notice(s_GameServ, nick, welcomemsg, nick);
- #endif
+
+ if (isWelcome())
+ {
+ #ifdef P10
+ notice(s_GameServ, nick, welcomemsg, realnick);
+ #else
+ notice(s_GameServ, nick, welcomemsg, nick);
+ #endif
+ }
#ifdef P10
unsigned long hv = sHASH((unsigned char *) nick)
#else