added NeonFun Bot with UNO Game
[NeonServV5.git] / src / modules / NeonFun.mod / cmd_neonfun.c
1 /* cmd_neonfun.c - NeonServ v5.4
2  * Copyright (C) 2011-2012  Philipp Kreil (pk910)
3  * 
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License 
15  * along with this program. If not, see <http://www.gnu.org/licenses/>. 
16  */
17 #include "../module.h"
18
19 #include "cmd_neonfun.h"
20 #include "../../modcmd.h"
21 #include "../../lang.h"
22 #include "../../ConfigParser.h"
23
24 static const struct default_language_entry msgtab[] = {
25     {"NF_UNO_ALREADY_RUNNING", "There is already a UNO game running in %s."}, /* {ARGS: "#channel"} */
26     {"NF_UNO_ALREADY_JOINED", "You have already joined this UNO game."},
27     {"NF_UNO_USER_JOINED", "$b%s$b has joined the game."}, /* {ARGS: "TestUser"} */
28     {"NF_UNO_CREATED", "$b%s$b started an UNO game. Type $b+uno$b to join the game."}, /* {ARGS: "TestUser"} */
29     {"NF_UNO_ERROR", "UNO program error. Please contact a bot administrator. (ErrCode: %d)"}, /* {ARGS: 0} */
30     {"NF_UNO_START", "GAME START"},
31     {"NF_UNO_USER_HURRY_UP", "$b%s$b, it's your turn!"}, /* {ARGS: "TestUser"} */
32     {"NF_UNO_USER_TOOK_CARD", "$b%s$b took another card."}, /* {ARGS: "TestUser"} */
33     {"NF_UNO_USER_TOOK_CARDS", "$b%s$b took $b%d$b cards."}, /* {ARGS: "TestUser", 4} */
34     {"NF_UNO_YOUR_CARDS", "Your cards: %s"}, /* {ARGS: "[+2] [+4] [R5] ..."} */
35     {"NF_UNO_TOP_CARD", "upper card: %s"}, /* {ARGS: "[+4]"} */
36     {"NF_UNO_NOT_YOUR_TURN", "Wait your turn!"},
37     {"NF_UNO_UNKNOWN_CARD", "Unknown card [%s]."}, /* {ARGS: "xy"} */
38     {"NF_UNO_CARD_NOT_IN_DECK", "You don't have this card."},
39     {"NF_UNO_CARD_YELLOW", "yellow"},
40     {"NF_UNO_CARD_BLUE", "blue"},
41     {"NF_UNO_CARD_RED", "red"},
42     {"NF_UNO_CARD_GREEN", "green"},
43     {"NF_UNO_DEFINE_COLOR", "Please define the color you want to set as a parameter to the command (eg. $b+unoplay +4 RED$b)"},
44     {"NF_UNO_CARD_NOT_POSSIBLE", "You can't play this card."},
45     {"NF_UNO_ONE_CARD", "$b%s$b has only one card! $k4U$k$k9N$k$k12O$k"}, /* {ARGS: "TestUser"} */
46     {"NF_UNO_USER_WIN", "$b%s$b has 0 cards! $k4U$k$k9N$k$k12O$k $k4U$k$k9N$k$k12O$k!!!"}, /* {ARGS: "TestUser"} */
47     {"NF_UNO_TIMEOUT", "game stopped (no more active players)."},
48     {"NF_UNO_USER_SKIP", "skipped $b%s$b."}, /* {ARGS: "TestUser"} */
49     {"NF_UNO_GAME_FINISHED", "The UNO Game has been finished!"},
50     {"NF_UNO_ADD_CARD", "$b%s$b has to take up %d cards. There is still the possibility that he/she has another card of this type...?"},
51     {NULL, NULL}
52 };
53
54 void register_commands() {
55     //NeonFun Commands
56     register_default_language_table(msgtab);
57     register_command_alias(5, "NeonFun");
58     
59     #define USER_COMMAND(NAME,FUNCTION,PARAMCOUNT,PRIVS,FLAGS) register_command(5, NAME, module_id, FUNCTION, PARAMCOUNT, PRIVS, 0, FLAGS)
60     //           NAME            FUNCTION              PARAMS  PRIVS     FLAGS
61     USER_COMMAND("uno",          neonfun_cmd_uno,      0,      NULL,     CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN);
62     USER_COMMAND("unotake",      neonfun_cmd_unotake,  0,      NULL,     CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN);
63     USER_COMMAND("unoplay",      neonfun_cmd_unoplay,  1,      NULL,     CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN);
64     
65     #undef USER_COMMAND
66     
67 }
68
69