|
|
@@ -20,7 +20,7 @@ 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")[:-2] + ".")
|
|
|
+ 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] + ".")
|
|
|
|
|
|
elif command.split()[0] == "8ball":
|
|
|
if cmdtype == "help": #Display help text.
|
|
|
@@ -134,7 +134,7 @@ def do_command(self, connection, event):
|
|
|
|
|
|
if len(command.split()) == 1:
|
|
|
user = event.source.nick.lower()
|
|
|
- message = "Your info. "
|
|
|
+ message = grey + "Your info. " + reset
|
|
|
elif len(command.split()) == 2:
|
|
|
user = command.split()[1]
|
|
|
if not self.db.one("SELECT id FROM users WHERE LOWER(name)=%s AND network='" + self.network + "'", (user, )):
|
|
|
@@ -144,15 +144,15 @@ def do_command(self, connection, event):
|
|
|
connection.privmsg(replyto, "The game does not play the master.")
|
|
|
return
|
|
|
if user == event.source.nick.lower():
|
|
|
- message = "Your info. "
|
|
|
+ message = grey + "Your info. " + reset
|
|
|
else:
|
|
|
- message = "Info for " + red + trigger.split()[1] + reset + ". "
|
|
|
+ message = grey + "Info for " + red + trigger.split()[1] + reset + ". "
|
|
|
else:
|
|
|
connection.privmsg(replyto, "Too many arguments, For help type " + blue + self.helpchar + "players " + reset + ".")
|
|
|
return
|
|
|
|
|
|
- level, xp, xpspent, karma = GameHelpers.get_info(self, user)
|
|
|
- connection.privmsg(replyto, message + "Level: " + str(level) + ", XP: " + str(xp) + ", karma: " + str(karma))
|
|
|
+ level, xp, xpspent, karma, coin = GameHelpers.get_info(self, user)
|
|
|
+ connection.privmsg(replyto, message + "Level: " + str(level) + ", XP: " + str(xp) + ", coin: " + str(coin) + ", karma: " + str(karma))
|
|
|
|
|
|
elif command.split()[0] == "levelup":
|
|
|
if cmdtype == "help": #Display help text.
|
|
|
@@ -160,12 +160,13 @@ def do_command(self, connection, event):
|
|
|
elif cmdtype == "cmd":
|
|
|
|
|
|
user = event.source.nick.lower()
|
|
|
- level, xp, xpspent, karma = GameHelpers.get_info(self, user)
|
|
|
+ level, xp, xpspent, karma, coin = GameHelpers.get_info(self, user)
|
|
|
if len(command.split()) == 1:
|
|
|
if xp < 10:
|
|
|
connection.privmsg(replyto, "Insuficcient XP, you need at least 10.")
|
|
|
else:
|
|
|
self.db.run("UPDATE users SET level=level+1, xp_spent=xp_spent+10 WHERE LOWER(name)='" + user + "' AND network='" + self.network + "'")
|
|
|
+ self.sd.run("UPDATE users SET coin=coin+0.3 WHERE level>0")
|
|
|
elif len(command.split()) == 2:
|
|
|
try:
|
|
|
levels = int(command.split()[1])
|
|
|
@@ -179,9 +180,39 @@ def do_command(self, connection, event):
|
|
|
else:
|
|
|
print("UPDATE users SET level=level+" + str(levels) + ", xp_spent=xp_spent+" + str(levels * 10) + " WHERE LOWER(name)='" + user + "' AND network='" + self.network + "'")
|
|
|
self.db.run("UPDATE users SET level=level+" + str(levels) + ", xp_spent=xp_spent+" + str(levels * 10) + " WHERE LOWER(name)='" + user + "' AND network='" + self.network + "'")
|
|
|
+ self.sd.run("UPDATE users SET coin=coin+" + str(0.3 * levels) + " WHERE level>0")
|
|
|
else:
|
|
|
connection.privmsg(replyto, "Too many arguments. For help type " + blue + self.helpchar + "levelup " + reset + ".")
|
|
|
|
|
|
+ elif command.split()[0] == "givecoin":
|
|
|
+ if cmdtype == "help": #Display help text.
|
|
|
+ connection.privmsg(replyto, "Give coins to another player. Amount optional.")
|
|
|
+ connection.privmsg(replyto, grey + "Usage: " + blue + self.cmdchar + "givecoin " + reset + italic + "user amount")
|
|
|
+ elif cmdtype == "cmd":
|
|
|
+
|
|
|
+ if len(command.split()) == 1:
|
|
|
+ connection.privmsg(replyto, "Insufficient arguments. For help type " + blue + self.helpchar + "givecoin" + reset + ".")
|
|
|
+ return
|
|
|
+ elif len(command.split()) > 3:
|
|
|
+ connection.privmsg(replyto, "Too many arguments. For help type " + blue + self.helpchar + "givecoin" + reset + ".")
|
|
|
+ return
|
|
|
+ level, xp, xpspent, karma, coin = GameHelpers.get_info(self, event.source.nick)
|
|
|
+ if 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], )):
|
|
|
+ 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], )):
|
|
|
+ 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], ))
|
|
|
+ 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], ))
|
|
|
+
|
|
|
# elif command.split()[0] == "classup":
|
|
|
# if cmdtype == "help": #Display help text.
|
|
|
# connection.privmsg(replyto, "Spend 10 XP to gain a class in your current level. List available classes with " + blue + self.helpchar + "classup available " + reset + ".")
|