added NeonFun Bot with UNO Game
[NeonServV5.git] / src / modules / NeonFun.mod / cmd_neonfun.c
diff --git a/src/modules/NeonFun.mod/cmd_neonfun.c b/src/modules/NeonFun.mod/cmd_neonfun.c
new file mode 100644 (file)
index 0000000..4f659c9
--- /dev/null
@@ -0,0 +1,69 @@
+/* cmd_neonfun.c - NeonServ v5.4
+ * Copyright (C) 2011-2012  Philipp Kreil (pk910)
+ * 
+ * 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 3 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, see <http://www.gnu.org/licenses/>. 
+ */
+#include "../module.h"
+
+#include "cmd_neonfun.h"
+#include "../../modcmd.h"
+#include "../../lang.h"
+#include "../../ConfigParser.h"
+
+static const struct default_language_entry msgtab[] = {
+    {"NF_UNO_ALREADY_RUNNING", "There is already a UNO game running in %s."}, /* {ARGS: "#channel"} */
+    {"NF_UNO_ALREADY_JOINED", "You have already joined this UNO game."},
+    {"NF_UNO_USER_JOINED", "$b%s$b has joined the game."}, /* {ARGS: "TestUser"} */
+    {"NF_UNO_CREATED", "$b%s$b started an UNO game. Type $b+uno$b to join the game."}, /* {ARGS: "TestUser"} */
+    {"NF_UNO_ERROR", "UNO program error. Please contact a bot administrator. (ErrCode: %d)"}, /* {ARGS: 0} */
+    {"NF_UNO_START", "GAME START"},
+    {"NF_UNO_USER_HURRY_UP", "$b%s$b, it's your turn!"}, /* {ARGS: "TestUser"} */
+    {"NF_UNO_USER_TOOK_CARD", "$b%s$b took another card."}, /* {ARGS: "TestUser"} */
+    {"NF_UNO_USER_TOOK_CARDS", "$b%s$b took $b%d$b cards."}, /* {ARGS: "TestUser", 4} */
+    {"NF_UNO_YOUR_CARDS", "Your cards: %s"}, /* {ARGS: "[+2] [+4] [R5] ..."} */
+    {"NF_UNO_TOP_CARD", "upper card: %s"}, /* {ARGS: "[+4]"} */
+    {"NF_UNO_NOT_YOUR_TURN", "Wait your turn!"},
+    {"NF_UNO_UNKNOWN_CARD", "Unknown card [%s]."}, /* {ARGS: "xy"} */
+    {"NF_UNO_CARD_NOT_IN_DECK", "You don't have this card."},
+    {"NF_UNO_CARD_YELLOW", "yellow"},
+    {"NF_UNO_CARD_BLUE", "blue"},
+    {"NF_UNO_CARD_RED", "red"},
+    {"NF_UNO_CARD_GREEN", "green"},
+    {"NF_UNO_DEFINE_COLOR", "Please define the color you want to set as a parameter to the command (eg. $b+unoplay +4 RED$b)"},
+    {"NF_UNO_CARD_NOT_POSSIBLE", "You can't play this card."},
+    {"NF_UNO_ONE_CARD", "$b%s$b has only one card! $k4U$k$k9N$k$k12O$k"}, /* {ARGS: "TestUser"} */
+    {"NF_UNO_USER_WIN", "$b%s$b has 0 cards! $k4U$k$k9N$k$k12O$k $k4U$k$k9N$k$k12O$k!!!"}, /* {ARGS: "TestUser"} */
+    {"NF_UNO_TIMEOUT", "game stopped (no more active players)."},
+    {"NF_UNO_USER_SKIP", "skipped $b%s$b."}, /* {ARGS: "TestUser"} */
+    {"NF_UNO_GAME_FINISHED", "The UNO Game has been finished!"},
+    {"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...?"},
+    {NULL, NULL}
+};
+
+void register_commands() {
+    //NeonFun Commands
+    register_default_language_table(msgtab);
+    register_command_alias(5, "NeonFun");
+    
+    #define USER_COMMAND(NAME,FUNCTION,PARAMCOUNT,PRIVS,FLAGS) register_command(5, NAME, module_id, FUNCTION, PARAMCOUNT, PRIVS, 0, FLAGS)
+    //           NAME            FUNCTION              PARAMS  PRIVS     FLAGS
+    USER_COMMAND("uno",          neonfun_cmd_uno,      0,      NULL,     CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN);
+    USER_COMMAND("unotake",      neonfun_cmd_unotake,  0,      NULL,     CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN);
+    USER_COMMAND("unoplay",      neonfun_cmd_unoplay,  1,      NULL,     CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN);
+    
+    #undef USER_COMMAND
+    
+}
+
+