change file formats from windows to *nix
This commit is contained in:
parent
1fdb3bc27d
commit
865cb57358
8 changed files with 752 additions and 752 deletions
130
README.GamesServ
130
README.GamesServ
|
@ -1,65 +1,65 @@
|
|||
|
||||
GamesServ Manual
|
||||
_________________________________________________________________
|
||||
|
||||
1. Prerequisites and Installation.
|
||||
|
||||
1.1. Compiling and Installation
|
||||
|
||||
Welcome to the GamesServ Manual. This document will aid you in
|
||||
setting up and running GamesServ on your IRC network.
|
||||
|
||||
GamesServ is a Game Service, for multiple small games.
|
||||
|
||||
1. Prerequisites and Installation.
|
||||
|
||||
GamesServ is designed to run on Top of NeoStats 3.0
|
||||
Please refer to the NeoStats website for more
|
||||
information on the requirements for NeoStats.
|
||||
|
||||
GamesServ requires the following:
|
||||
* NeoStats 3.0 or Higher correctly installed and Running
|
||||
* The time to read this entire document.
|
||||
|
||||
|
||||
1.1. Compiling and Installation
|
||||
|
||||
As long as you have successfully setup NeoStats, and installed it
|
||||
correctly, Compiling GamesServ is very simple and straight forward. First
|
||||
you must extract the files from the download package. This is as
|
||||
simple as:
|
||||
bash$ tar -xzf GamesServ-<ver>.tar.gz
|
||||
|
||||
This should then create a directory called GamesServ-<version>
|
||||
where <version> is the Version of GamesServ. Then Proceed to Change
|
||||
into the GamesServ directory, and run Configure as follows:
|
||||
bash$./configure [--with-neostats=<dir>]
|
||||
|
||||
--with-neostats=<dir> should be used if your neostats directory is not
|
||||
in a standard location (~/NeoStats3.0/). Replace <dir> with the full path
|
||||
to your NeoStats installation directory (NOT SOURCE DIRECTORY)
|
||||
|
||||
If the configuration did not produce a error, you may then move onto
|
||||
Compiling GamesServ. Compiling is simply just issuing the "make" command
|
||||
(or "gmake" if you are running BSD):
|
||||
|
||||
Again, check for Error messages. As long as there are not error messages,
|
||||
"make install" (or "gmake install" if you are running BSD) will install GamesServ,
|
||||
this README file, and any auxiluary files needed into your NeoStats directory:
|
||||
|
||||
Once Installation is complete, you can either configure NeoStats to
|
||||
load GamesServ when it starts, or load GamesServ via IRC.
|
||||
|
||||
To Configure NeoStats to automatically load GamesServ when it boots, add
|
||||
the following line to your "neostats.conf" file in the NeoStats
|
||||
directory:
|
||||
|
||||
LOAD_MODULE GamesServ
|
||||
|
||||
To load GamesServ via IRC, you must make sure you have the appropriate
|
||||
permissions and issue the following command:
|
||||
|
||||
/msg neostats load GamesServ
|
||||
|
||||
Thats it. GamesServ is now loaded and ready for use.
|
||||
/msg GamesServ help
|
||||
|
||||
GamesServ Manual
|
||||
_________________________________________________________________
|
||||
|
||||
1. Prerequisites and Installation.
|
||||
|
||||
1.1. Compiling and Installation
|
||||
|
||||
Welcome to the GamesServ Manual. This document will aid you in
|
||||
setting up and running GamesServ on your IRC network.
|
||||
|
||||
GamesServ is a Game Service, for multiple small games.
|
||||
|
||||
1. Prerequisites and Installation.
|
||||
|
||||
GamesServ is designed to run on Top of NeoStats 3.0
|
||||
Please refer to the NeoStats website for more
|
||||
information on the requirements for NeoStats.
|
||||
|
||||
GamesServ requires the following:
|
||||
* NeoStats 3.0 or Higher correctly installed and Running
|
||||
* The time to read this entire document.
|
||||
|
||||
|
||||
1.1. Compiling and Installation
|
||||
|
||||
As long as you have successfully setup NeoStats, and installed it
|
||||
correctly, Compiling GamesServ is very simple and straight forward. First
|
||||
you must extract the files from the download package. This is as
|
||||
simple as:
|
||||
bash$ tar -xzf GamesServ-<ver>.tar.gz
|
||||
|
||||
This should then create a directory called GamesServ-<version>
|
||||
where <version> is the Version of GamesServ. Then Proceed to Change
|
||||
into the GamesServ directory, and run Configure as follows:
|
||||
bash$./configure [--with-neostats=<dir>]
|
||||
|
||||
--with-neostats=<dir> should be used if your neostats directory is not
|
||||
in a standard location (~/NeoStats3.0/). Replace <dir> with the full path
|
||||
to your NeoStats installation directory (NOT SOURCE DIRECTORY)
|
||||
|
||||
If the configuration did not produce a error, you may then move onto
|
||||
Compiling GamesServ. Compiling is simply just issuing the "make" command
|
||||
(or "gmake" if you are running BSD):
|
||||
|
||||
Again, check for Error messages. As long as there are not error messages,
|
||||
"make install" (or "gmake install" if you are running BSD) will install GamesServ,
|
||||
this README file, and any auxiluary files needed into your NeoStats directory:
|
||||
|
||||
Once Installation is complete, you can either configure NeoStats to
|
||||
load GamesServ when it starts, or load GamesServ via IRC.
|
||||
|
||||
To Configure NeoStats to automatically load GamesServ when it boots, add
|
||||
the following line to your "neostats.conf" file in the NeoStats
|
||||
directory:
|
||||
|
||||
LOAD_MODULE GamesServ
|
||||
|
||||
To load GamesServ via IRC, you must make sure you have the appropriate
|
||||
permissions and issue the following command:
|
||||
|
||||
/msg neostats load GamesServ
|
||||
|
||||
Thats it. GamesServ is now loaded and ready for use.
|
||||
/msg GamesServ help
|
||||
|
|
270
bomb.c
270
bomb.c
|
@ -1,135 +1,135 @@
|
|||
/* GamesServ - Small Games Service - NeoStats Addon Module
|
||||
** Copyright (c) 2004 DeadNotBuried
|
||||
** Portions Copyright (c) 1999-2005, NeoStats",
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
** GamesServ CVS Identification
|
||||
** $Id$
|
||||
*/
|
||||
|
||||
#include "neostats.h" /* Required for bot support */
|
||||
#include "gamesserv.h"
|
||||
|
||||
/*
|
||||
* Start Bomb Game
|
||||
*/
|
||||
int startbomb(CmdParams* cmdparams) {
|
||||
Channel *c;
|
||||
|
||||
if (gamestatus[GS_GAME_BOMB] == GS_GAME_STOPPED) {
|
||||
c = FindChannel(cmdparams->av[0]);
|
||||
if (!c) {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "You must be in the Channel you wish to start the game in.");
|
||||
} else {
|
||||
if (IsChannelMember(c, cmdparams->source)) {
|
||||
if ( kickgameschanoponly && !IsChanOp(c->name, cmdparams->source->name) ) {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "You must be a Channel Operator to start the game.");
|
||||
} else {
|
||||
countdowntime[GS_GAME_BOMB] = 60;
|
||||
strlcpy (gameroom[GS_GAME_BOMB], cmdparams->av[0], MAXCHANLEN);
|
||||
strlcpy (gameplayernick[GS_GAME_BOMB], cmdparams->source->name, MAXNICK);
|
||||
gamestatus[GS_GAME_BOMB] = GS_GAME_PLAYING;
|
||||
irc_join (gs_bot, gameroom[GS_GAME_BOMB], "+o");
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037A Bomb has been brought into the channel by %s. Don''t be the last one with it.", cmdparams->source->name);
|
||||
AddTimer (TIMER_TYPE_COUNTDOWN, timerupstopbomb, "bombcountdown", countdowntime[GS_GAME_BOMB]);
|
||||
}
|
||||
} else {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "You must be in the Channel you wish to start the game in.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "The Game is already active in %s , Try Again Later.", gameroom[GS_GAME_BOMB]);
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Throw Bomb
|
||||
*/
|
||||
int throwbomb(CmdParams* cmdparams) {
|
||||
Client *u;
|
||||
Channel *c;
|
||||
int ttto;
|
||||
|
||||
if ( !ircstrcasecmp (cmdparams->source->name, gameplayernick[GS_GAME_BOMB]) && ( gamestatus[GS_GAME_BOMB] == GS_GAME_PLAYING ) ) {
|
||||
u = FindUser (cmdparams->av[0]);
|
||||
if (!u) {
|
||||
stopbomb(cmdparams->av[0], "noton");
|
||||
} else {
|
||||
c = FindChannel(gameroom[GS_GAME_BOMB]);
|
||||
if (IsChannelMember(c, u)) {
|
||||
ttto = ( ( rand() % 5 ) + 1 );
|
||||
if ( ttto < countdowntime[GS_GAME_BOMB] ) {
|
||||
countdowntime[GS_GAME_BOMB] -= ttto;
|
||||
}
|
||||
switch (ttto) {
|
||||
case 1:
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037%s places the bomb in %s's pocket.", gameplayernick[GS_GAME_BOMB], u->name);
|
||||
break;
|
||||
case 2:
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037%s sneaks the bomb next to %s.", gameplayernick[GS_GAME_BOMB], u->name);
|
||||
break;
|
||||
case 3:
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037%s throws the bomb at %s, who now has a large bruise.", gameplayernick[GS_GAME_BOMB], u->name);
|
||||
break;
|
||||
default:
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037%s passes the Bomb to %s.", gameplayernick[GS_GAME_BOMB], u->name);
|
||||
break;
|
||||
}
|
||||
if ( IsExcluded(u) || IsMe(u) || IsBot(u) || IsAway(u) ) {
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037the Bomb Bounces off an invisible Force Field, and returns to %s.", gameplayernick[GS_GAME_BOMB]);
|
||||
} else {
|
||||
strlcpy (gameplayernick[GS_GAME_BOMB], u->name, MAXNICK);
|
||||
}
|
||||
SetTimerInterval("bombcountdown", countdowntime[GS_GAME_BOMB]);
|
||||
} else {
|
||||
stopbomb(cmdparams->av[0], "notin");
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Stop Bomb Game
|
||||
*/
|
||||
void stopbomb(char *nic, char *reason) {
|
||||
|
||||
if (!ircstrcasecmp (reason, "noton")) {
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037%s must be blind there is no %s on the network.", gameplayernick[GS_GAME_BOMB], nic);
|
||||
DelTimer ("bombcountdown");
|
||||
} else {
|
||||
if (!ircstrcasecmp (reason, "notin")) {
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037%s must be blind, %s isn''t in the channel.", gameplayernick[GS_GAME_BOMB], nic);
|
||||
DelTimer ("bombcountdown");
|
||||
}
|
||||
}
|
||||
irc_kick(gs_bot, gameroom[GS_GAME_BOMB], gameplayernick[GS_GAME_BOMB], "\0034BOOOOOM !!!!!!");
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037GAME OVER");
|
||||
irc_part (gs_bot, gameroom[GS_GAME_BOMB], NULL);
|
||||
gameroom[GS_GAME_BOMB][0] = '\0';
|
||||
gameplayernick[GS_GAME_BOMB][0] = '\0';
|
||||
gamestatus[GS_GAME_BOMB] = GS_GAME_STOPPED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Bomb Timer Finished
|
||||
*/
|
||||
int timerupstopbomb(void) {
|
||||
stopbomb( "", "");
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
/* GamesServ - Small Games Service - NeoStats Addon Module
|
||||
** Copyright (c) 2004 DeadNotBuried
|
||||
** Portions Copyright (c) 1999-2005, NeoStats",
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
** GamesServ CVS Identification
|
||||
** $Id$
|
||||
*/
|
||||
|
||||
#include "neostats.h" /* Required for bot support */
|
||||
#include "gamesserv.h"
|
||||
|
||||
/*
|
||||
* Start Bomb Game
|
||||
*/
|
||||
int startbomb(CmdParams* cmdparams) {
|
||||
Channel *c;
|
||||
|
||||
if (gamestatus[GS_GAME_BOMB] == GS_GAME_STOPPED) {
|
||||
c = FindChannel(cmdparams->av[0]);
|
||||
if (!c) {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "You must be in the Channel you wish to start the game in.");
|
||||
} else {
|
||||
if (IsChannelMember(c, cmdparams->source)) {
|
||||
if ( kickgameschanoponly && !IsChanOp(c->name, cmdparams->source->name) ) {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "You must be a Channel Operator to start the game.");
|
||||
} else {
|
||||
countdowntime[GS_GAME_BOMB] = 60;
|
||||
strlcpy (gameroom[GS_GAME_BOMB], cmdparams->av[0], MAXCHANLEN);
|
||||
strlcpy (gameplayernick[GS_GAME_BOMB], cmdparams->source->name, MAXNICK);
|
||||
gamestatus[GS_GAME_BOMB] = GS_GAME_PLAYING;
|
||||
irc_join (gs_bot, gameroom[GS_GAME_BOMB], "+o");
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037A Bomb has been brought into the channel by %s. Don''t be the last one with it.", cmdparams->source->name);
|
||||
AddTimer (TIMER_TYPE_COUNTDOWN, timerupstopbomb, "bombcountdown", countdowntime[GS_GAME_BOMB]);
|
||||
}
|
||||
} else {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "You must be in the Channel you wish to start the game in.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "The Game is already active in %s , Try Again Later.", gameroom[GS_GAME_BOMB]);
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Throw Bomb
|
||||
*/
|
||||
int throwbomb(CmdParams* cmdparams) {
|
||||
Client *u;
|
||||
Channel *c;
|
||||
int ttto;
|
||||
|
||||
if ( !ircstrcasecmp (cmdparams->source->name, gameplayernick[GS_GAME_BOMB]) && ( gamestatus[GS_GAME_BOMB] == GS_GAME_PLAYING ) ) {
|
||||
u = FindUser (cmdparams->av[0]);
|
||||
if (!u) {
|
||||
stopbomb(cmdparams->av[0], "noton");
|
||||
} else {
|
||||
c = FindChannel(gameroom[GS_GAME_BOMB]);
|
||||
if (IsChannelMember(c, u)) {
|
||||
ttto = ( ( rand() % 5 ) + 1 );
|
||||
if ( ttto < countdowntime[GS_GAME_BOMB] ) {
|
||||
countdowntime[GS_GAME_BOMB] -= ttto;
|
||||
}
|
||||
switch (ttto) {
|
||||
case 1:
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037%s places the bomb in %s's pocket.", gameplayernick[GS_GAME_BOMB], u->name);
|
||||
break;
|
||||
case 2:
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037%s sneaks the bomb next to %s.", gameplayernick[GS_GAME_BOMB], u->name);
|
||||
break;
|
||||
case 3:
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037%s throws the bomb at %s, who now has a large bruise.", gameplayernick[GS_GAME_BOMB], u->name);
|
||||
break;
|
||||
default:
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037%s passes the Bomb to %s.", gameplayernick[GS_GAME_BOMB], u->name);
|
||||
break;
|
||||
}
|
||||
if ( IsExcluded(u) || IsMe(u) || IsBot(u) || IsAway(u) ) {
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037the Bomb Bounces off an invisible Force Field, and returns to %s.", gameplayernick[GS_GAME_BOMB]);
|
||||
} else {
|
||||
strlcpy (gameplayernick[GS_GAME_BOMB], u->name, MAXNICK);
|
||||
}
|
||||
SetTimerInterval("bombcountdown", countdowntime[GS_GAME_BOMB]);
|
||||
} else {
|
||||
stopbomb(cmdparams->av[0], "notin");
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Stop Bomb Game
|
||||
*/
|
||||
void stopbomb(char *nic, char *reason) {
|
||||
|
||||
if (!ircstrcasecmp (reason, "noton")) {
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037%s must be blind there is no %s on the network.", gameplayernick[GS_GAME_BOMB], nic);
|
||||
DelTimer ("bombcountdown");
|
||||
} else {
|
||||
if (!ircstrcasecmp (reason, "notin")) {
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037%s must be blind, %s isn''t in the channel.", gameplayernick[GS_GAME_BOMB], nic);
|
||||
DelTimer ("bombcountdown");
|
||||
}
|
||||
}
|
||||
irc_kick(gs_bot, gameroom[GS_GAME_BOMB], gameplayernick[GS_GAME_BOMB], "\0034BOOOOOM !!!!!!");
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_BOMB], "\0037GAME OVER");
|
||||
irc_part (gs_bot, gameroom[GS_GAME_BOMB], NULL);
|
||||
gameroom[GS_GAME_BOMB][0] = '\0';
|
||||
gameplayernick[GS_GAME_BOMB][0] = '\0';
|
||||
gamestatus[GS_GAME_BOMB] = GS_GAME_STOPPED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Bomb Timer Finished
|
||||
*/
|
||||
int timerupstopbomb(void) {
|
||||
stopbomb( "", "");
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
|
100
bomb_help.c
100
bomb_help.c
|
@ -1,52 +1,52 @@
|
|||
/* GamesServ - Small Games Service - NeoStats Addon Module
|
||||
** Copyright (c) 2004 DeadNotBuried
|
||||
** Portions Copyright (c) 1999-2005, NeoStats",
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
/* GamesServ - Small Games Service - NeoStats Addon Module
|
||||
** Copyright (c) 2004 DeadNotBuried
|
||||
** Portions Copyright (c) 1999-2005, NeoStats",
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
** GamesServ CVS Identification
|
||||
** $Id$
|
||||
*/
|
||||
|
||||
#include "neostats.h" /* Required for bot support */
|
||||
#include "gamesserv.h"
|
||||
|
||||
/*
|
||||
* Help Text
|
||||
*/
|
||||
const char gs_help_bomb_oneline[] = "Start a Bomb Game in a Channel";
|
||||
const char gs_help_throw_oneline[] = "Pass the Bomb to another Nick in the Channel";
|
||||
|
||||
const char *gs_help_bomb[] = {
|
||||
"Syntax: \2BOMB <#Channel>\2",
|
||||
"",
|
||||
"This command starts the Bomb Game in the specified Channel.",
|
||||
"",
|
||||
"The Channel Must Exist, and you must be in the Channel",
|
||||
"",
|
||||
"The person holding the Bomb when it explodes is kicked from the Channel",
|
||||
"",
|
||||
"Each player in turn gets less time to pass the Bomb to another Nick",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *gs_help_throw[] = {
|
||||
"Syntax: \2throw <nickname>\2",
|
||||
"",
|
||||
"This option will pass the bomb to the specified Nickname",
|
||||
"The Nickname Must be in the channel at the time, or you lose.",
|
||||
NULL
|
||||
};
|
||||
*/
|
||||
|
||||
#include "neostats.h" /* Required for bot support */
|
||||
#include "gamesserv.h"
|
||||
|
||||
/*
|
||||
* Help Text
|
||||
*/
|
||||
const char gs_help_bomb_oneline[] = "Start a Bomb Game in a Channel";
|
||||
const char gs_help_throw_oneline[] = "Pass the Bomb to another Nick in the Channel";
|
||||
|
||||
const char *gs_help_bomb[] = {
|
||||
"Syntax: \2BOMB <#Channel>\2",
|
||||
"",
|
||||
"This command starts the Bomb Game in the specified Channel.",
|
||||
"",
|
||||
"The Channel Must Exist, and you must be in the Channel",
|
||||
"",
|
||||
"The person holding the Bomb when it explodes is kicked from the Channel",
|
||||
"",
|
||||
"Each player in turn gets less time to pass the Bomb to another Nick",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *gs_help_throw[] = {
|
||||
"Syntax: \2throw <nickname>\2",
|
||||
"",
|
||||
"This option will pass the bomb to the specified Nickname",
|
||||
"The Nickname Must be in the channel at the time, or you lose.",
|
||||
NULL
|
||||
};
|
||||
|
|
354
gamesserv.c
354
gamesserv.c
|
@ -1,177 +1,177 @@
|
|||
/* GamesServ - Small Games Service - NeoStats Addon Module
|
||||
** Copyright (c) 2004 DeadNotBuried
|
||||
** Portions Copyright (c) 1999-2005, NeoStats",
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
** GamesServ CVS Identification
|
||||
** $Id$
|
||||
*/
|
||||
|
||||
#include "neostats.h" /* Required for bot support */
|
||||
#include "gamesserv.h"
|
||||
|
||||
/*
|
||||
* Module Variables
|
||||
*/
|
||||
int kickgameschanoponly;
|
||||
|
||||
/*
|
||||
* Game Variables
|
||||
*/
|
||||
char gameroom[GS_GAME_TOTAL][MAXCHANLEN];
|
||||
int gamestatus[GS_GAME_TOTAL];
|
||||
char gameplayernick[GS_GAME_TOTAL][MAXNICK];
|
||||
int countdowntime[GS_GAME_TOTAL];
|
||||
|
||||
/*
|
||||
* Copyright info and About
|
||||
*/
|
||||
const char *gs_copyright[] = {
|
||||
"Copyright (c) 2005 DeadNotBuried",
|
||||
"Portions Copyright (c) 1999-2005, NeoStats",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *gs_about[] = {
|
||||
"\2Small IRC Games Service\2",
|
||||
"",
|
||||
"This Service is intended as a fun only.",
|
||||
"",
|
||||
"If you take any of these games seriously",
|
||||
"you should turn off your computer, drop",
|
||||
"it off a cliff, and find a life outside",
|
||||
"of IRC.",
|
||||
NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* Module Info definition
|
||||
*/
|
||||
ModuleInfo module_info = {
|
||||
"GamesServ",
|
||||
"Small Games Module For NeoStats",
|
||||
gs_copyright,
|
||||
gs_about,
|
||||
NEOSTATS_VERSION,
|
||||
"3.0",
|
||||
__DATE__,
|
||||
__TIME__,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
/*
|
||||
* Module event list
|
||||
*/
|
||||
ModuleEvent module_events[] = {
|
||||
{EVENT_NICK, PlayerNickChange},
|
||||
{EVENT_NULL, NULL}
|
||||
};
|
||||
|
||||
/*
|
||||
* Nick Change Check
|
||||
*/
|
||||
int PlayerNickChange (CmdParams* cmdparams)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < GS_GAME_TOTAL; i++) {
|
||||
if (!ircstrcasecmp (gameplayernick[i], cmdparams->param)) {
|
||||
strlcpy (gameplayernick[i], cmdparams->source->name, MAXNICK);
|
||||
}
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Commands and Settings
|
||||
*/
|
||||
static bot_cmd gs_commands[]=
|
||||
{
|
||||
{"BOMB", startbomb, 1, 0, gs_help_bomb, gs_help_bomb_oneline},
|
||||
{"THROW", throwbomb, 1, 0, gs_help_throw, gs_help_throw_oneline},
|
||||
{"RUSSIAN", startruss, 1, 0, gs_help_russ, gs_help_russ_oneline},
|
||||
{"SHOOT", shootruss, 1, 0, gs_help_shoot, gs_help_shoot_oneline},
|
||||
{NULL, NULL, 0, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
static bot_setting gs_settings[]=
|
||||
{
|
||||
{"KICKGAMESCHANOPONLY", &kickgameschanoponly, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "KickGamesStartByChanOpsOnly", NULL, gs_help_set_kickchanoponly, NULL, (void *)0 },
|
||||
{NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
/*
|
||||
* BotInfo
|
||||
*/
|
||||
static BotInfo gs_botinfo =
|
||||
{
|
||||
"GamesServ",
|
||||
"GamesServ1",
|
||||
"GamesServ",
|
||||
BOT_COMMON_HOST,
|
||||
"Small Game Service",
|
||||
BOT_FLAG_SERVICEBOT,
|
||||
gs_commands,
|
||||
gs_settings,
|
||||
};
|
||||
|
||||
/*
|
||||
* Online event processing
|
||||
*/
|
||||
int ModSynch (void)
|
||||
{
|
||||
/* Introduce a bot onto the network */
|
||||
gs_bot = AddBot (&gs_botinfo);
|
||||
if (!gs_bot) {
|
||||
return NS_FAILURE;
|
||||
}
|
||||
srand((unsigned int)me.now);
|
||||
return NS_SUCCESS;
|
||||
};
|
||||
|
||||
/*
|
||||
* Init module
|
||||
*/
|
||||
int ModInit( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
/* clear Game variables */
|
||||
for (i = 0; i < GS_GAME_TOTAL; i++) {
|
||||
gameroom[i][0] = '\0';
|
||||
gameplayernick[i][0] = '\0';
|
||||
gamestatus[i] = GS_GAME_STOPPED;
|
||||
countdowntime[i] = 60;
|
||||
}
|
||||
ModuleConfig (gs_settings);
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Exit module
|
||||
*/
|
||||
int ModFini( void )
|
||||
{
|
||||
if ( gamestatus[GS_GAME_BOMB] == GS_GAME_PLAYING ) {
|
||||
DelTimer ("bombcountdown");
|
||||
}
|
||||
if ( gamestatus[GS_GAME_RUSS] == GS_GAME_PLAYING ) {
|
||||
DelTimer ("russcountdown");
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
/* GamesServ - Small Games Service - NeoStats Addon Module
|
||||
** Copyright (c) 2004 DeadNotBuried
|
||||
** Portions Copyright (c) 1999-2005, NeoStats",
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
** GamesServ CVS Identification
|
||||
** $Id$
|
||||
*/
|
||||
|
||||
#include "neostats.h" /* Required for bot support */
|
||||
#include "gamesserv.h"
|
||||
|
||||
/*
|
||||
* Module Variables
|
||||
*/
|
||||
int kickgameschanoponly;
|
||||
|
||||
/*
|
||||
* Game Variables
|
||||
*/
|
||||
char gameroom[GS_GAME_TOTAL][MAXCHANLEN];
|
||||
int gamestatus[GS_GAME_TOTAL];
|
||||
char gameplayernick[GS_GAME_TOTAL][MAXNICK];
|
||||
int countdowntime[GS_GAME_TOTAL];
|
||||
|
||||
/*
|
||||
* Copyright info and About
|
||||
*/
|
||||
const char *gs_copyright[] = {
|
||||
"Copyright (c) 2005 DeadNotBuried",
|
||||
"Portions Copyright (c) 1999-2005, NeoStats",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *gs_about[] = {
|
||||
"\2Small IRC Games Service\2",
|
||||
"",
|
||||
"This Service is intended as a fun only.",
|
||||
"",
|
||||
"If you take any of these games seriously",
|
||||
"you should turn off your computer, drop",
|
||||
"it off a cliff, and find a life outside",
|
||||
"of IRC.",
|
||||
NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* Module Info definition
|
||||
*/
|
||||
ModuleInfo module_info = {
|
||||
"GamesServ",
|
||||
"Small Games Module For NeoStats",
|
||||
gs_copyright,
|
||||
gs_about,
|
||||
NEOSTATS_VERSION,
|
||||
"3.0",
|
||||
__DATE__,
|
||||
__TIME__,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
/*
|
||||
* Module event list
|
||||
*/
|
||||
ModuleEvent module_events[] = {
|
||||
{EVENT_NICK, PlayerNickChange},
|
||||
{EVENT_NULL, NULL}
|
||||
};
|
||||
|
||||
/*
|
||||
* Nick Change Check
|
||||
*/
|
||||
int PlayerNickChange (CmdParams* cmdparams)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < GS_GAME_TOTAL; i++) {
|
||||
if (!ircstrcasecmp (gameplayernick[i], cmdparams->param)) {
|
||||
strlcpy (gameplayernick[i], cmdparams->source->name, MAXNICK);
|
||||
}
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Commands and Settings
|
||||
*/
|
||||
static bot_cmd gs_commands[]=
|
||||
{
|
||||
{"BOMB", startbomb, 1, 0, gs_help_bomb, gs_help_bomb_oneline},
|
||||
{"THROW", throwbomb, 1, 0, gs_help_throw, gs_help_throw_oneline},
|
||||
{"RUSSIAN", startruss, 1, 0, gs_help_russ, gs_help_russ_oneline},
|
||||
{"SHOOT", shootruss, 1, 0, gs_help_shoot, gs_help_shoot_oneline},
|
||||
{NULL, NULL, 0, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
static bot_setting gs_settings[]=
|
||||
{
|
||||
{"KICKGAMESCHANOPONLY", &kickgameschanoponly, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "KickGamesStartByChanOpsOnly", NULL, gs_help_set_kickchanoponly, NULL, (void *)0 },
|
||||
{NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
/*
|
||||
* BotInfo
|
||||
*/
|
||||
static BotInfo gs_botinfo =
|
||||
{
|
||||
"GamesServ",
|
||||
"GamesServ1",
|
||||
"GamesServ",
|
||||
BOT_COMMON_HOST,
|
||||
"Small Game Service",
|
||||
BOT_FLAG_SERVICEBOT,
|
||||
gs_commands,
|
||||
gs_settings,
|
||||
};
|
||||
|
||||
/*
|
||||
* Online event processing
|
||||
*/
|
||||
int ModSynch (void)
|
||||
{
|
||||
/* Introduce a bot onto the network */
|
||||
gs_bot = AddBot (&gs_botinfo);
|
||||
if (!gs_bot) {
|
||||
return NS_FAILURE;
|
||||
}
|
||||
srand((unsigned int)me.now);
|
||||
return NS_SUCCESS;
|
||||
};
|
||||
|
||||
/*
|
||||
* Init module
|
||||
*/
|
||||
int ModInit( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
/* clear Game variables */
|
||||
for (i = 0; i < GS_GAME_TOTAL; i++) {
|
||||
gameroom[i][0] = '\0';
|
||||
gameplayernick[i][0] = '\0';
|
||||
gamestatus[i] = GS_GAME_STOPPED;
|
||||
countdowntime[i] = 60;
|
||||
}
|
||||
ModuleConfig (gs_settings);
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Exit module
|
||||
*/
|
||||
int ModFini( void )
|
||||
{
|
||||
if ( gamestatus[GS_GAME_BOMB] == GS_GAME_PLAYING ) {
|
||||
DelTimer ("bombcountdown");
|
||||
}
|
||||
if ( gamestatus[GS_GAME_RUSS] == GS_GAME_PLAYING ) {
|
||||
DelTimer ("russcountdown");
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
|
188
gamesserv.h
188
gamesserv.h
|
@ -1,94 +1,94 @@
|
|||
/* GamesServ - Small Games Service - NeoStats Addon Module
|
||||
** Copyright (c) 2005 DeadNotBuried
|
||||
** Portions Copyright (c) 1999-2005, NeoStats,
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
** GamesServ CVS Identification
|
||||
** $Id$
|
||||
*/
|
||||
|
||||
Bot *gs_bot;
|
||||
|
||||
/*
|
||||
* Bomb Game Help
|
||||
*/
|
||||
extern const char gs_help_bomb_oneline[];
|
||||
extern const char gs_help_throw_oneline[];
|
||||
extern const char *gs_help_bomb[];
|
||||
extern const char *gs_help_throw[];
|
||||
|
||||
/*
|
||||
* Bomb Game Procedures
|
||||
*/
|
||||
int startbomb (CmdParams* cmdparams);
|
||||
int throwbomb (CmdParams* cmdparams);
|
||||
void stopbomb(char *nic, char *reason);
|
||||
int timerupstopbomb(void);
|
||||
|
||||
|
||||
/*
|
||||
* Russian Roulette Game Help
|
||||
*/
|
||||
extern const char gs_help_russ_oneline[];
|
||||
extern const char gs_help_shoot_oneline[];
|
||||
extern const char *gs_help_russ[];
|
||||
extern const char *gs_help_shoot[];
|
||||
|
||||
/*
|
||||
* Russian Roulette Game Procedures
|
||||
*/
|
||||
int startruss (CmdParams* cmdparams);
|
||||
int shootruss (CmdParams* cmdparams);
|
||||
void stopruss(char *nic, char *reason);
|
||||
int timerupstopruss(void);
|
||||
|
||||
|
||||
/*
|
||||
* Defines
|
||||
*/
|
||||
#define GS_GAME_TOTAL 0x00000002 /* Number Of Games */
|
||||
|
||||
#define GS_GAME_BOMB 0x00000000 /* Bomb Game */
|
||||
#define GS_GAME_RUSS 0x00000001 /* Russian Roulette Game */
|
||||
|
||||
#define GS_GAME_STOPPED 0x00000001 /* Game Not Running */
|
||||
#define GS_GAME_STARTING 0x00000002 /* Game Starting */
|
||||
#define GS_GAME_PLAYING 0x00000003 /* Game Running */
|
||||
#define GS_GAME_STOPPING 0x00000004 /* Game Stopping */
|
||||
|
||||
/*
|
||||
* Game Variables
|
||||
*/
|
||||
extern char gameroom[GS_GAME_TOTAL][MAXCHANLEN];
|
||||
extern int gamestatus[GS_GAME_TOTAL];
|
||||
extern char gameplayernick[GS_GAME_TOTAL][MAXNICK];
|
||||
extern int countdowntime[GS_GAME_TOTAL];
|
||||
|
||||
/*
|
||||
* Common Variables
|
||||
*/
|
||||
extern int kickgameschanoponly;
|
||||
|
||||
/*
|
||||
* Common Help
|
||||
*/
|
||||
extern const char *gs_help_set_kickchanoponly[];
|
||||
|
||||
/*
|
||||
* Common Procedures
|
||||
*/
|
||||
int PlayerNickChange (CmdParams* cmdparams);
|
||||
/* GamesServ - Small Games Service - NeoStats Addon Module
|
||||
** Copyright (c) 2005 DeadNotBuried
|
||||
** Portions Copyright (c) 1999-2005, NeoStats,
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
** GamesServ CVS Identification
|
||||
** $Id$
|
||||
*/
|
||||
|
||||
Bot *gs_bot;
|
||||
|
||||
/*
|
||||
* Bomb Game Help
|
||||
*/
|
||||
extern const char gs_help_bomb_oneline[];
|
||||
extern const char gs_help_throw_oneline[];
|
||||
extern const char *gs_help_bomb[];
|
||||
extern const char *gs_help_throw[];
|
||||
|
||||
/*
|
||||
* Bomb Game Procedures
|
||||
*/
|
||||
int startbomb (CmdParams* cmdparams);
|
||||
int throwbomb (CmdParams* cmdparams);
|
||||
void stopbomb(char *nic, char *reason);
|
||||
int timerupstopbomb(void);
|
||||
|
||||
|
||||
/*
|
||||
* Russian Roulette Game Help
|
||||
*/
|
||||
extern const char gs_help_russ_oneline[];
|
||||
extern const char gs_help_shoot_oneline[];
|
||||
extern const char *gs_help_russ[];
|
||||
extern const char *gs_help_shoot[];
|
||||
|
||||
/*
|
||||
* Russian Roulette Game Procedures
|
||||
*/
|
||||
int startruss (CmdParams* cmdparams);
|
||||
int shootruss (CmdParams* cmdparams);
|
||||
void stopruss(char *nic, char *reason);
|
||||
int timerupstopruss(void);
|
||||
|
||||
|
||||
/*
|
||||
* Defines
|
||||
*/
|
||||
#define GS_GAME_TOTAL 0x00000002 /* Number Of Games */
|
||||
|
||||
#define GS_GAME_BOMB 0x00000000 /* Bomb Game */
|
||||
#define GS_GAME_RUSS 0x00000001 /* Russian Roulette Game */
|
||||
|
||||
#define GS_GAME_STOPPED 0x00000001 /* Game Not Running */
|
||||
#define GS_GAME_STARTING 0x00000002 /* Game Starting */
|
||||
#define GS_GAME_PLAYING 0x00000003 /* Game Running */
|
||||
#define GS_GAME_STOPPING 0x00000004 /* Game Stopping */
|
||||
|
||||
/*
|
||||
* Game Variables
|
||||
*/
|
||||
extern char gameroom[GS_GAME_TOTAL][MAXCHANLEN];
|
||||
extern int gamestatus[GS_GAME_TOTAL];
|
||||
extern char gameplayernick[GS_GAME_TOTAL][MAXNICK];
|
||||
extern int countdowntime[GS_GAME_TOTAL];
|
||||
|
||||
/*
|
||||
* Common Variables
|
||||
*/
|
||||
extern int kickgameschanoponly;
|
||||
|
||||
/*
|
||||
* Common Help
|
||||
*/
|
||||
extern const char *gs_help_set_kickchanoponly[];
|
||||
|
||||
/*
|
||||
* Common Procedures
|
||||
*/
|
||||
int PlayerNickChange (CmdParams* cmdparams);
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
/* GamesServ - Small Games Service - NeoStats Addon Module
|
||||
** Copyright (c) 2004 DeadNotBuried
|
||||
** Portions Copyright (c) 1999-2005, NeoStats",
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
** GamesServ CVS Identification
|
||||
** $Id$
|
||||
*/
|
||||
|
||||
#include "neostats.h" /* Required for bot support */
|
||||
#include "gamesserv.h"
|
||||
|
||||
const char *gs_help_set_kickchanoponly[] = {
|
||||
"\2KICKGAMESCHANOPONLY <on/off>\2 - Allow only Channel Ops to start games that Kick Users from the Channel",
|
||||
NULL
|
||||
};
|
||||
/* GamesServ - Small Games Service - NeoStats Addon Module
|
||||
** Copyright (c) 2004 DeadNotBuried
|
||||
** Portions Copyright (c) 1999-2005, NeoStats",
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
** GamesServ CVS Identification
|
||||
** $Id$
|
||||
*/
|
||||
|
||||
#include "neostats.h" /* Required for bot support */
|
||||
#include "gamesserv.h"
|
||||
|
||||
const char *gs_help_set_kickchanoponly[] = {
|
||||
"\2KICKGAMESCHANOPONLY <on/off>\2 - Allow only Channel Ops to start games that Kick Users from the Channel",
|
||||
NULL
|
||||
};
|
||||
|
|
298
russian.c
298
russian.c
|
@ -1,149 +1,149 @@
|
|||
/* GamesServ - Small Games Service - NeoStats Addon Module
|
||||
** Copyright (c) 2004 DeadNotBuried
|
||||
** Portions Copyright (c) 1999-2005, NeoStats",
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
** GamesServ CVS Identification
|
||||
** $Id$
|
||||
*/
|
||||
|
||||
#include "neostats.h" /* Required for bot support */
|
||||
#include "gamesserv.h"
|
||||
|
||||
/*
|
||||
* Start Russian Roulette Game
|
||||
*/
|
||||
int startruss(CmdParams* cmdparams) {
|
||||
Channel *c;
|
||||
|
||||
if ( gamestatus[GS_GAME_RUSS] == GS_GAME_STOPPED ) {
|
||||
c = FindChannel(cmdparams->av[0]);
|
||||
if (!c) {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "You must be in the Channel you wish to start the game in.");
|
||||
} else {
|
||||
if (IsChannelMember(c, cmdparams->source)) {
|
||||
if ( kickgameschanoponly && !IsChanOp(c->name, cmdparams->source->name) ) {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "You must be a Channel Operator to start the game.");
|
||||
} else {
|
||||
countdowntime[GS_GAME_RUSS] = 60;
|
||||
strlcpy (gameroom[GS_GAME_RUSS], cmdparams->av[0], MAXCHANLEN);
|
||||
strlcpy (gameplayernick[GS_GAME_RUSS], cmdparams->source->name, MAXNICK);
|
||||
gamestatus[GS_GAME_RUSS] = GS_GAME_PLAYING;
|
||||
irc_join (gs_bot, gameroom[GS_GAME_RUSS], "+o");
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0037Russian Roulette has been started by %s. Who will die this time?", cmdparams->source->name);
|
||||
AddTimer (TIMER_TYPE_COUNTDOWN, timerupstopruss, "russcountdown", countdowntime[GS_GAME_RUSS]);
|
||||
}
|
||||
} else {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "You must be in the Channel you wish to start the game in.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "The Game is already active in %s , Try Again Later.", gameroom[GS_GAME_RUSS]);
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Shoot Russian Roulette
|
||||
*/
|
||||
int shootruss(CmdParams* cmdparams) {
|
||||
Client *u;
|
||||
Channel *c;
|
||||
int ttto;
|
||||
int rt;
|
||||
|
||||
if ( !ircstrcasecmp (cmdparams->source->name, gameplayernick[GS_GAME_RUSS]) && ( gamestatus[GS_GAME_RUSS] == GS_GAME_PLAYING ) ) {
|
||||
u = FindUser (cmdparams->av[0]);
|
||||
if (!u) {
|
||||
stopruss(cmdparams->av[0], "noton");
|
||||
} else {
|
||||
if ( IsExcluded(u) || IsMe(u) || IsBot(u) || IsAway(u) ) {
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0037%s Refuses to play this game %s, try someone else.", u->name, gameplayernick[GS_GAME_RUSS]);
|
||||
} else {
|
||||
c = FindChannel(gameroom[GS_GAME_RUSS]);
|
||||
if (IsChannelMember(c, u)) {
|
||||
ttto = ( ( rand() % 5 ) + 1 );
|
||||
if ( ttto < countdowntime[GS_GAME_RUSS] ) {
|
||||
countdowntime[GS_GAME_RUSS] -= ttto;
|
||||
}
|
||||
switch (ttto) {
|
||||
case 1:
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0037%s places the gun against %s's temple, and pulls the trigger.", gameplayernick[GS_GAME_RUSS], u->name);
|
||||
break;
|
||||
case 2:
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0037%s points the gun between %s's eyes.", gameplayernick[GS_GAME_RUSS], u->name);
|
||||
break;
|
||||
default:
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0037%s points the gun at %s and fires.", gameplayernick[GS_GAME_RUSS], u->name);
|
||||
break;
|
||||
}
|
||||
rt = ( rand() % 9 );
|
||||
if ( rt == 7 ) {
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0034\2BANG!\2, Nice one %s.", gameplayernick[GS_GAME_RUSS]);
|
||||
strlcpy (gameplayernick[GS_GAME_RUSS], u->name, MAXNICK);
|
||||
stopruss(cmdparams->av[0],"Shot");
|
||||
} else {
|
||||
strlcpy (gameplayernick[GS_GAME_RUSS], u->name, MAXNICK);
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0034click!, you now have the gun %s, select someone to shoot.", gameplayernick[GS_GAME_RUSS]);
|
||||
SetTimerInterval("russcountdown", countdowntime[GS_GAME_RUSS]);
|
||||
}
|
||||
} else {
|
||||
stopruss(cmdparams->av[0], "notin");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Stop Russian Roulette Game
|
||||
*/
|
||||
void stopruss(char *nic, char *reason) {
|
||||
char *russdiereason;
|
||||
|
||||
if (!ircstrcasecmp (reason, "noton")) {
|
||||
russdiereason = "\0034Pick someone thats on the Network next time.";
|
||||
DelTimer ("russcountdown");
|
||||
} else {
|
||||
if (!ircstrcasecmp (reason, "notin")) {
|
||||
russdiereason = "\0034Pick someone thats in the Channel next time.";
|
||||
DelTimer ("russcountdown");
|
||||
} else {
|
||||
if (!ircstrcasecmp (reason, "")) {
|
||||
russdiereason = "\0034Use The Gun Luke!";
|
||||
} else {
|
||||
russdiereason = "\0034Ducking might me an idea, You would have less holes in the head then.";
|
||||
DelTimer ("russcountdown");
|
||||
}
|
||||
}
|
||||
}
|
||||
irc_kick(gs_bot, gameroom[GS_GAME_RUSS], gameplayernick[GS_GAME_RUSS], russdiereason);
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0037GAME OVER");
|
||||
irc_part (gs_bot, gameroom[GS_GAME_RUSS], NULL);
|
||||
gameroom[GS_GAME_RUSS][0] = '\0';
|
||||
gameplayernick[GS_GAME_RUSS][0] = '\0';
|
||||
gamestatus[GS_GAME_RUSS] = GS_GAME_STOPPED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Russian Roulette Timer Finished
|
||||
*/
|
||||
int timerupstopruss(void) {
|
||||
stopruss( "", "");
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
/* GamesServ - Small Games Service - NeoStats Addon Module
|
||||
** Copyright (c) 2004 DeadNotBuried
|
||||
** Portions Copyright (c) 1999-2005, NeoStats",
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
** GamesServ CVS Identification
|
||||
** $Id$
|
||||
*/
|
||||
|
||||
#include "neostats.h" /* Required for bot support */
|
||||
#include "gamesserv.h"
|
||||
|
||||
/*
|
||||
* Start Russian Roulette Game
|
||||
*/
|
||||
int startruss(CmdParams* cmdparams) {
|
||||
Channel *c;
|
||||
|
||||
if ( gamestatus[GS_GAME_RUSS] == GS_GAME_STOPPED ) {
|
||||
c = FindChannel(cmdparams->av[0]);
|
||||
if (!c) {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "You must be in the Channel you wish to start the game in.");
|
||||
} else {
|
||||
if (IsChannelMember(c, cmdparams->source)) {
|
||||
if ( kickgameschanoponly && !IsChanOp(c->name, cmdparams->source->name) ) {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "You must be a Channel Operator to start the game.");
|
||||
} else {
|
||||
countdowntime[GS_GAME_RUSS] = 60;
|
||||
strlcpy (gameroom[GS_GAME_RUSS], cmdparams->av[0], MAXCHANLEN);
|
||||
strlcpy (gameplayernick[GS_GAME_RUSS], cmdparams->source->name, MAXNICK);
|
||||
gamestatus[GS_GAME_RUSS] = GS_GAME_PLAYING;
|
||||
irc_join (gs_bot, gameroom[GS_GAME_RUSS], "+o");
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0037Russian Roulette has been started by %s. Who will die this time?", cmdparams->source->name);
|
||||
AddTimer (TIMER_TYPE_COUNTDOWN, timerupstopruss, "russcountdown", countdowntime[GS_GAME_RUSS]);
|
||||
}
|
||||
} else {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "You must be in the Channel you wish to start the game in.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
irc_prefmsg (gs_bot, cmdparams->source, "The Game is already active in %s , Try Again Later.", gameroom[GS_GAME_RUSS]);
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Shoot Russian Roulette
|
||||
*/
|
||||
int shootruss(CmdParams* cmdparams) {
|
||||
Client *u;
|
||||
Channel *c;
|
||||
int ttto;
|
||||
int rt;
|
||||
|
||||
if ( !ircstrcasecmp (cmdparams->source->name, gameplayernick[GS_GAME_RUSS]) && ( gamestatus[GS_GAME_RUSS] == GS_GAME_PLAYING ) ) {
|
||||
u = FindUser (cmdparams->av[0]);
|
||||
if (!u) {
|
||||
stopruss(cmdparams->av[0], "noton");
|
||||
} else {
|
||||
if ( IsExcluded(u) || IsMe(u) || IsBot(u) || IsAway(u) ) {
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0037%s Refuses to play this game %s, try someone else.", u->name, gameplayernick[GS_GAME_RUSS]);
|
||||
} else {
|
||||
c = FindChannel(gameroom[GS_GAME_RUSS]);
|
||||
if (IsChannelMember(c, u)) {
|
||||
ttto = ( ( rand() % 5 ) + 1 );
|
||||
if ( ttto < countdowntime[GS_GAME_RUSS] ) {
|
||||
countdowntime[GS_GAME_RUSS] -= ttto;
|
||||
}
|
||||
switch (ttto) {
|
||||
case 1:
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0037%s places the gun against %s's temple, and pulls the trigger.", gameplayernick[GS_GAME_RUSS], u->name);
|
||||
break;
|
||||
case 2:
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0037%s points the gun between %s's eyes.", gameplayernick[GS_GAME_RUSS], u->name);
|
||||
break;
|
||||
default:
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0037%s points the gun at %s and fires.", gameplayernick[GS_GAME_RUSS], u->name);
|
||||
break;
|
||||
}
|
||||
rt = ( rand() % 9 );
|
||||
if ( rt == 7 ) {
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0034\2BANG!\2, Nice one %s.", gameplayernick[GS_GAME_RUSS]);
|
||||
strlcpy (gameplayernick[GS_GAME_RUSS], u->name, MAXNICK);
|
||||
stopruss(cmdparams->av[0],"Shot");
|
||||
} else {
|
||||
strlcpy (gameplayernick[GS_GAME_RUSS], u->name, MAXNICK);
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0034click!, you now have the gun %s, select someone to shoot.", gameplayernick[GS_GAME_RUSS]);
|
||||
SetTimerInterval("russcountdown", countdowntime[GS_GAME_RUSS]);
|
||||
}
|
||||
} else {
|
||||
stopruss(cmdparams->av[0], "notin");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Stop Russian Roulette Game
|
||||
*/
|
||||
void stopruss(char *nic, char *reason) {
|
||||
char *russdiereason;
|
||||
|
||||
if (!ircstrcasecmp (reason, "noton")) {
|
||||
russdiereason = "\0034Pick someone thats on the Network next time.";
|
||||
DelTimer ("russcountdown");
|
||||
} else {
|
||||
if (!ircstrcasecmp (reason, "notin")) {
|
||||
russdiereason = "\0034Pick someone thats in the Channel next time.";
|
||||
DelTimer ("russcountdown");
|
||||
} else {
|
||||
if (!ircstrcasecmp (reason, "")) {
|
||||
russdiereason = "\0034Use The Gun Luke!";
|
||||
} else {
|
||||
russdiereason = "\0034Ducking might me an idea, You would have less holes in the head then.";
|
||||
DelTimer ("russcountdown");
|
||||
}
|
||||
}
|
||||
}
|
||||
irc_kick(gs_bot, gameroom[GS_GAME_RUSS], gameplayernick[GS_GAME_RUSS], russdiereason);
|
||||
irc_chanprivmsg (gs_bot, gameroom[GS_GAME_RUSS], "\0037GAME OVER");
|
||||
irc_part (gs_bot, gameroom[GS_GAME_RUSS], NULL);
|
||||
gameroom[GS_GAME_RUSS][0] = '\0';
|
||||
gameplayernick[GS_GAME_RUSS][0] = '\0';
|
||||
gamestatus[GS_GAME_RUSS] = GS_GAME_STOPPED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Russian Roulette Timer Finished
|
||||
*/
|
||||
int timerupstopruss(void) {
|
||||
stopruss( "", "");
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
|
104
russian_help.c
104
russian_help.c
|
@ -1,54 +1,54 @@
|
|||
/* GamesServ - Small Games Service - NeoStats Addon Module
|
||||
** Copyright (c) 2004 DeadNotBuried
|
||||
** Portions Copyright (c) 1999-2005, NeoStats",
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
/* GamesServ - Small Games Service - NeoStats Addon Module
|
||||
** Copyright (c) 2004 DeadNotBuried
|
||||
** Portions Copyright (c) 1999-2005, NeoStats",
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
** GamesServ CVS Identification
|
||||
** $Id$
|
||||
*/
|
||||
|
||||
#include "neostats.h" /* Required for bot support */
|
||||
#include "gamesserv.h"
|
||||
|
||||
/*
|
||||
* Help Text
|
||||
*/
|
||||
const char gs_help_russ_oneline[] = "Start Russian Roulette in a Channel";
|
||||
const char gs_help_shoot_oneline[] = "Shoots the Nick Specified in the Channel";
|
||||
|
||||
const char *gs_help_russ[] = {
|
||||
"Syntax: \2RUSSIAN <#Channel>\2",
|
||||
"",
|
||||
"This command starts Russian Roulette in the specified Channel.",
|
||||
"",
|
||||
"The Channel Must Exist, and you must be in the Channel",
|
||||
"",
|
||||
"The person holding the Gun selects a Nick to Shoot",
|
||||
"if the chamber is empty, that nick then receives the Gun.",
|
||||
"if the chamber was full, then the Nick is kicked from the Channel.",
|
||||
"",
|
||||
"Each player in turn gets less time to Shoot another Nick",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *gs_help_shoot[] = {
|
||||
"Syntax: \2SHOOT <nickname>\2",
|
||||
"",
|
||||
"This option will attempt to shoot the specified Nick",
|
||||
"The Nickname Must be in the channel at the time, or you lose.",
|
||||
NULL
|
||||
};
|
||||
*/
|
||||
|
||||
#include "neostats.h" /* Required for bot support */
|
||||
#include "gamesserv.h"
|
||||
|
||||
/*
|
||||
* Help Text
|
||||
*/
|
||||
const char gs_help_russ_oneline[] = "Start Russian Roulette in a Channel";
|
||||
const char gs_help_shoot_oneline[] = "Shoots the Nick Specified in the Channel";
|
||||
|
||||
const char *gs_help_russ[] = {
|
||||
"Syntax: \2RUSSIAN <#Channel>\2",
|
||||
"",
|
||||
"This command starts Russian Roulette in the specified Channel.",
|
||||
"",
|
||||
"The Channel Must Exist, and you must be in the Channel",
|
||||
"",
|
||||
"The person holding the Gun selects a Nick to Shoot",
|
||||
"if the chamber is empty, that nick then receives the Gun.",
|
||||
"if the chamber was full, then the Nick is kicked from the Channel.",
|
||||
"",
|
||||
"Each player in turn gets less time to Shoot another Nick",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *gs_help_shoot[] = {
|
||||
"Syntax: \2SHOOT <nickname>\2",
|
||||
"",
|
||||
"This option will attempt to shoot the specified Nick",
|
||||
"The Nickname Must be in the channel at the time, or you lose.",
|
||||
NULL
|
||||
};
|
||||
|
|
Reference in a new issue