1 /* cmd_neonfun.c - NeonServ v5.6
2 * Copyright (C) 2011-2012 Philipp Kreil (pk910)
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.
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.
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/>.
17 #include "../module.h"
19 #include "cmd_neonfun.h"
20 #include "../../modcmd.h"
21 #include "../../lang.h"
22 #include "../../ConfigParser.h"
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 {"NF_UNO_RANK", "Rank"},
52 {"NF_UNO_NAME", "Name"},
53 {"NF_UNO_WON_GAMES", "Won Games"},
54 {"NF_UNO_TOTAL_WON_GAMES", "Total won Games"},
55 {"NF_UNO_LESS_PLAYERS", "There are not enough players to start the game."},
57 {"NF_4WINS_NOT_YOUR_TURN", "Wait your turn!"},
58 {"NF_4WINS_INVALID_COLUMN", "invalid column!"},
59 {"NF_4WINS_COLUMN_FULL", "This column is full!"},
60 {"NF_4WINS_USER_HURRY_UP", "$b%s$b, it's your turn! To put a stone into a column use: 4stone <colomn>"}, /* {ARGS: "TestUser"} */
61 {"NF_4WINS_USER_WON", "$b%s$b won the game!"}, /* {ARGS: "TestUser"} */
62 {"NF_4WINS_ENTER_OPPONENT", "Please enter the nick of the opponent you want to play against as a parameter of 4wins (eg. $b4wins TestUser$b)"},
63 {"NF_4WINS_OPPONENT_NOT_IN_CHAN", "$b%s$b needs to be in this channel to start a game against him/her."}, /* {ARGS: "TestUser"} */
64 {"NF_4WINS_DRAW", "Nobody has won this game."},
65 {"NF_4WINS_REQUEST", "$b%s$b wants to play a game against you. use $b4wins$b to start the game."}, /* {ARGS: "TestUser"} */
66 {"NF_4WINS_REQUESTED", "waiting for $b%s$b accepting the game..."}, /* {ARGS: "TestUser"} */
67 {"NF_4WINS_START", "%s accepted the challenge! game starts:"}, /* {ARGS: "TestUser"} */
68 {"NF_4WINS_APPEND_PLAYER", "Please append the nick of a player playing the game you want to view. (eg. $b4view TestUser$b)"},
69 {"NF_4WINS_NO_GAME_FOUND", "Couldn't find a game with this user in this channel."},
70 {"NF_4WINS_VIEWING_ANOTHER_GAME", "You are already viewing another game."},
71 {"NF_4WINS_VIEWING_GAME", "You are now viewing the game."},
72 {"NF_4WINS_GAME_CLOSED", "Game aborted."},
73 {"NF_4WINS_TIMEOUT", "Game aborted (timeout)."},
74 {"NF_4WINS_SELF", "You may not play against yourself."},
76 {"NF_BJ_ALREADY_RUNNING", "There is already a BlackJack game running in %s."}, /* {ARGS: "#channel"} */
77 {"NF_BJ_ALREADY_JOINED", "You have already joined this BlackJack game."},
78 {"NF_BJ_USER_JOINED", "$b%s$b has joined the game."}, /* {ARGS: "TestUser"} */
79 {"NF_BJ_CREATED", "$b%s$b started a BlackJack game. Type $b+bj$b to join the game."}, /* {ARGS: "TestUser"} */
80 {"NF_BJ_ERROR", "BlackJack program error. Please contact a bot administrator. (ErrCode: %d)"}, /* {ARGS: 0} */
81 {"NF_BJ_NOT_YOUR_TURN", "Wait your turn!"},
82 {"NF_BJ_START", "GAME START"},
83 {"NF_BJ_USER_HURRY_UP", "$b%s$b, it's your turn! You can take a card with $bbjtake$b or stop playing with $bbjenough$b"}, /* {ARGS: "TestUser"} */
84 {"NF_BJ_TAKE", "You took another card: %s (%d points)."}, /* {ARGS: "[♠A]", 11} */
85 {"NF_BJ_YOUR_CARDS", "You have %d points! Your cards: %s"}, /* {ARGS: 18, "[♠A] [♣7] ..."} */
86 {"NF_BJ_LESS_PLAYERS", "There are not enough players to start the game."},
87 {"NF_BJ_USER_TIMEOUT", "It seems that %s doesn't want another card... (Timeout)"}, /* {ARGS: "TestUser"} */
88 {"NF_BJ_POINTS_EXCEEDED", "You have more than 21 points... please use $bbjenough$b to finish."},
89 {"NF_BJ_GAME_FINISHED", "Game Finished! Showdown:"},
90 {"NF_BJ_RANK", "Rank"},
91 {"NF_BJ_NAME", "Name"},
92 {"NF_BJ_POINTS", "Points"},
93 {"NF_BJ_CARDS", "Cards"},
98 void register_commands() {
100 register_default_language_table(msgtab);
101 register_command_alias(5, "NeonFun");
103 #define USER_COMMAND(NAME,FUNCTION,PARAMCOUNT,PRIVS,FLAGS) register_command(5, NAME, module_id, FUNCTION, PARAMCOUNT, PRIVS, 0, FLAGS)
104 // NAME FUNCTION PARAMS PRIVS FLAGS
105 USER_COMMAND("uno", neonfun_cmd_uno, 0, NULL, CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN);
106 USER_COMMAND("unotake", neonfun_cmd_unotake, 0, NULL, CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN);
107 USER_COMMAND("unoplay", neonfun_cmd_unoplay, 1, NULL, CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN);
109 USER_COMMAND("4wins", neonfun_cmd_4wins, 0, NULL, CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN);
110 USER_COMMAND("4stone", neonfun_cmd_4stone, 1, NULL, CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN);
111 USER_COMMAND("4view", neonfun_cmd_4view, 0, NULL, CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN);
113 USER_COMMAND("blackjack", neonfun_cmd_blackjack,0, NULL, CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN);
114 USER_COMMAND("bjtake", neonfun_cmd_bjtake, 0, NULL, CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN);
115 USER_COMMAND("bjenough", neonfun_cmd_bjenough, 0, NULL, CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN);