|
|
@@ -29,7 +29,8 @@ def do_command(self, connection, event):
|
|
|
|
|
|
if command == "cmd" or command == "cmds" or command == "commands":
|
|
|
if cmdtype == "cmd":
|
|
|
- connection.privmsg(replyto, grey + "Games: " + CH.ccc(self, "8ball") + CH.ccc(self, "dice") + CH.ccc(self, "player") + CH.ccc(self, "levelup") + CH.ccc(self, "givecoin")[:-2] + ".")
|
|
|
+ connection.privmsg(replyto, grey + "Games: " + CH.ccc(self, "8ball") + CH.ccc(self, "dice") + CH.ccc(self, "player") + CH.ccc(self, "players") + CH.ccc(self, "levelup") + CH.ccc(self, "givecoin")[:-2] + ".")
|
|
|
+ connection.privmsg(replyto, grey + "Game help: " + blue + self.helpchar + "xp" + reset + ".")
|
|
|
|
|
|
elif command.split()[0] == "8ball":
|
|
|
if cmdtype == "help": #Display help text.
|
|
|
@@ -216,18 +217,39 @@ def do_command(self, connection, event):
|
|
|
elif coin < 1:
|
|
|
connection.privmsg(replyto, "You have no coin to give.")
|
|
|
return
|
|
|
- elif not self.db.one("SELECT id FROM users WHERE LOWER(name)=%s AND network='" + self.network + "'", (command.split()[1], )):
|
|
|
+ elif not self.db.one("SELECT id FROM users WHERE LOWER(name)=%s AND network=%s", (command.split()[1], self.network, )):
|
|
|
connection.action(replyto, "does not know of any \"" + red + trigger.split()[1] + reset + "\".")
|
|
|
return
|
|
|
- elif not self.db.one("SELECT id FROM users WHERE LOWER(name)=%s AND network='" + self.network + "' AND LEVEL>0", (command.split()[1], )):
|
|
|
+ elif not self.db.one("SELECT id FROM users WHERE LOWER(name)=%s AND network=%s AND LEVEL>0", (command.split()[1], self.network, )):
|
|
|
connection.privmsg(replyto, red + trigger.split()[1] + reset + " is not playing the game.")
|
|
|
return
|
|
|
if len(command.split()) == 2:
|
|
|
- self.db.run("UPDATE users SET coin=coin-1 WHERE name=%s AND network='" + self.network + "'", (event.source.nick, ))
|
|
|
- self.db.run("UPDATE users SET coin=coin+1 WHERE LOWER(name)=%s AND network='" + self.network + "'", (command.split()[1], ))
|
|
|
+ self.db.run("UPDATE users SET coin=coin-1, coin_given=coin_given+1 WHERE name=%s AND network=%s", (event.source.nick, self.network, ))
|
|
|
+ self.db.run("UPDATE users SET coin=coin+1 WHERE LOWER(name)=%s AND network=%s", (command.split()[1], self.network, ))
|
|
|
elif len(command.split()) == 3:
|
|
|
- self.db.run("UPDATE users SET coin=coin-%s WHERE name=%s AND network='" + self.network + "'", (command.split()[2], event.source.nick, ))
|
|
|
- self.db.run("UPDATE users SET coin=coin+%s WHERE LOWER(name)=%s AND network='" + self.network + "'", (command.split()[2], command.split()[1], ))
|
|
|
+ self.db.run("UPDATE users SET coin=coin-%s, coin_given=coin_given+%s WHERE name=%s AND network=%s", (command.split()[2], command.split()[2], event.source.nick, self.network, ))
|
|
|
+ self.db.run("UPDATE users SET coin=coin+%s WHERE LOWER(name)=%s AND network=%s", (command.split()[2], command.split()[1], self.network))
|
|
|
+
|
|
|
+ elif command.split()[0] == "players":
|
|
|
+ if cmdtype == "help": #Display help text.
|
|
|
+ connection.privmsg(replyto, "Display top player rankings.")
|
|
|
+ elif cmdtype == "cmd":
|
|
|
+
|
|
|
+ toplevel = GameHelpers.list_top_players(self, "level")
|
|
|
+ if toplevel:
|
|
|
+ connection.notice(event.source.nick, "Ranking level: " + toplevel)
|
|
|
+ topxp = GameHelpers.list_top_players(self, "xp_spent")
|
|
|
+ if topxp:
|
|
|
+ connection.notice(event.source.nick, "Ranking experience: " + topxp)
|
|
|
+ topcoin = GameHelpers.list_top_players(self, "coin")
|
|
|
+ if topcoin:
|
|
|
+ connection.notice(event.source.nick, "Ranking wealth: " + topcoin)
|
|
|
+ if not toplevel and not topxp and not topcoin:
|
|
|
+ connection.privmsg(replyto, "Nobody is playing the game.")
|
|
|
+
|
|
|
+ elif command.split()[0] == "xp":
|
|
|
+ if cmdtype == "help": #Display help text.
|
|
|
+ connection.privmsg(replyto, "XP is earned by using IRC and playing the game. XP is onlt recorded in channels where the bot is present. Ask any operator in " + red + self.homechannel + reset + " to have the bot join a channel.")
|
|
|
|
|
|
# elif command.split()[0] == "classup":
|
|
|
# if cmdtype == "help": #Display help text.
|