|
@@ -164,7 +164,8 @@ def do_command(self, connection, event):
|
|
|
level, xp, xpspent, totalxp, karma, coin, coinspent, coingiven, ap, apspent = GameHelpers.get_info(self, user)
|
|
level, xp, xpspent, totalxp, karma, coin, coinspent, coingiven, ap, apspent = GameHelpers.get_info(self, user)
|
|
|
if ap < 0:
|
|
if ap < 0:
|
|
|
ap = 0
|
|
ap = 0
|
|
|
- connection.privmsg(replyto, message + "Level: " + str(level) + grey + ", " + reset + "XP: " + str(int(xp)) + "/" + grey + str(round(totalxp, 4)) + ", " + reset + "AP: " + str(int(ap)) + grey + ", " + reset + "coin: " + str(coin) + grey + "[S " + str(coinspent) + ", G " + str(coingiven) + "], " + reset + "karma: " + str(round(karma, 4)))
|
|
|
|
|
|
|
+ info = GameHelpers.player_info(self, user)
|
|
|
|
|
+ connection.privmsg(replyto, message + info)
|
|
|
|
|
|
|
|
elif command.split()[0] == "levelup":
|
|
elif command.split()[0] == "levelup":
|
|
|
if cmdtype == "help": #Display help text.
|
|
if cmdtype == "help": #Display help text.
|
|
@@ -175,12 +176,14 @@ def do_command(self, connection, event):
|
|
|
level, xp, xpspent, totalxp, karma, coin, coinspent, coingiven, ap, apspent = GameHelpers.get_info(self, user)
|
|
level, xp, xpspent, totalxp, karma, coin, coinspent, coingiven, ap, apspent = GameHelpers.get_info(self, user)
|
|
|
if len(command.split()) == 1:
|
|
if len(command.split()) == 1:
|
|
|
if xp < int(level * 2.7):
|
|
if xp < int(level * 2.7):
|
|
|
- connection.privmsg(replyto, "Insuficcient XP, you need at least " + str(int(level * 2.7)) + ".")
|
|
|
|
|
|
|
+ connection.privmsg(replyto, "Insufficient XP, you need at least " + str(int(level * 2.7)) + ".")
|
|
|
elif ap < 1:
|
|
elif ap < 1:
|
|
|
- connection.privmsg(replyto, "Insuficcient AP, you need at least 1.")
|
|
|
|
|
|
|
+ connection.privmsg(replyto, "Insufficient AP, you need at least 1.")
|
|
|
else:
|
|
else:
|
|
|
self.db.run("UPDATE users SET level=level+1, xp_spent=xp_spent+%s, ap_spent=ap_spent+1 WHERE LOWER(name)=%s AND network=%s", (int(level * 2.7), user, self.network, ))
|
|
self.db.run("UPDATE users SET level=level+1, xp_spent=xp_spent+%s, ap_spent=ap_spent+1 WHERE LOWER(name)=%s AND network=%s", (int(level * 2.7), user, self.network, ))
|
|
|
self.db.run("UPDATE users SET coin=coin+0.3 WHERE level>0 AND network=%s", (self.network, ))
|
|
self.db.run("UPDATE users SET coin=coin+0.3 WHERE level>0 AND network=%s", (self.network, ))
|
|
|
|
|
+ info = GameHelpers.player_info(self, user)
|
|
|
|
|
+ connection.privmsg(replyto, "Your new statistics: " + info)
|
|
|
elif len(command.split()) == 2:
|
|
elif len(command.split()) == 2:
|
|
|
try:
|
|
try:
|
|
|
levels = int(command.split()[1])
|
|
levels = int(command.split()[1])
|
|
@@ -190,12 +193,14 @@ def do_command(self, connection, event):
|
|
|
if levels < 1:
|
|
if levels < 1:
|
|
|
connection.privmsg(replyto, "Invalid amount.")
|
|
connection.privmsg(replyto, "Invalid amount.")
|
|
|
elif xp < int(level * 2.7):
|
|
elif xp < int(level * 2.7):
|
|
|
- connection.privmsg(replyto, "Insuficcient XP, you need at least " + str(int(level * 2.7)) + ".")
|
|
|
|
|
|
|
+ connection.privmsg(replyto, "Insufficient XP, you need at least " + str(int(level * 2.7)) + ".")
|
|
|
elif ap < levels:
|
|
elif ap < levels:
|
|
|
connection.privmsg(replyto, "Insufficient AP, you need at least 1.")
|
|
connection.privmsg(replyto, "Insufficient AP, you need at least 1.")
|
|
|
else:
|
|
else:
|
|
|
self.db.run("UPDATE users SET level=level+%s, xp_spent=xp_spent+%s, ap_spent=ap_spent+%s WHERE LOWER(name)=LOWER(%s) AND network=%s", (levels, int(level * 2.7), levels, user, self.network, ))
|
|
self.db.run("UPDATE users SET level=level+%s, xp_spent=xp_spent+%s, ap_spent=ap_spent+%s WHERE LOWER(name)=LOWER(%s) AND network=%s", (levels, int(level * 2.7), levels, user, self.network, ))
|
|
|
self.db.run("UPDATE users SET coin=coin+%s WHERE level>0 AND network=%s", (levels * 0.3, self.network, ))
|
|
self.db.run("UPDATE users SET coin=coin+%s WHERE level>0 AND network=%s", (levels * 0.3, self.network, ))
|
|
|
|
|
+ info = GameHelpers.player_info(self, user)
|
|
|
|
|
+ connection.privmsg(replyto, "Your new statistics: " + info)
|
|
|
else:
|
|
else:
|
|
|
connection.privmsg(replyto, "Too many arguments. For help type " + blue + self.helpchar + "levelup " + reset + ".")
|
|
connection.privmsg(replyto, "Too many arguments. For help type " + blue + self.helpchar + "levelup " + reset + ".")
|
|
|
|
|
|
|
@@ -215,14 +220,17 @@ def do_command(self, connection, event):
|
|
|
connection.privmsg(replyto, "You already have your own coin. For help type " + blue + self.helpchar + "givecoin" + reset + ".")
|
|
connection.privmsg(replyto, "You already have your own coin. For help type " + blue + self.helpchar + "givecoin" + reset + ".")
|
|
|
return
|
|
return
|
|
|
elif len(command.split()) == 3:
|
|
elif len(command.split()) == 3:
|
|
|
|
|
+ stop = False
|
|
|
try:
|
|
try:
|
|
|
if int(command.split()[2]) < 0:
|
|
if int(command.split()[2]) < 0:
|
|
|
connection.privmsg(replyto, "You clever abuser! The " + red + self.cmdchar + bold + "give" + bold + "coin" + reset + " command is not designed for robbing. There will be consequences...")
|
|
connection.privmsg(replyto, "You clever abuser! The " + red + self.cmdchar + bold + "give" + bold + "coin" + reset + " command is not designed for robbing. There will be consequences...")
|
|
|
- self.db.run("UPDATE users SET coin=coin-3, karma_correction=karma_correction-0.5 WHERE name=%s", (event.source.nick))
|
|
|
|
|
- return
|
|
|
|
|
|
|
+ self.db.run("UPDATE users SET coin=coin-3, karma_correction=karma_correction-0.5 WHERE name=%s AND network=%s", (event.source.nick, self.network))
|
|
|
|
|
+ stop = True
|
|
|
except TypeError:
|
|
except TypeError:
|
|
|
connection.privmsg(replyto, "Invalid amount. For help type " + blue + self.helpchar + "givecoin" + reset + ".")
|
|
connection.privmsg(replyto, "Invalid amount. For help type " + blue + self.helpchar + "givecoin" + reset + ".")
|
|
|
return
|
|
return
|
|
|
|
|
+ if stop:
|
|
|
|
|
+ return
|
|
|
elif not event.target == connection.get_nickname():
|
|
elif not event.target == connection.get_nickname():
|
|
|
if not command.split()[1] in self.channels[event.target].users():
|
|
if not command.split()[1] in self.channels[event.target].users():
|
|
|
connection.privmsg(replyto, red + trigger.split()[1] + reset + " is not present.")
|
|
connection.privmsg(replyto, red + trigger.split()[1] + reset + " is not present.")
|
|
@@ -254,6 +262,8 @@ def do_command(self, connection, event):
|
|
|
elif len(command.split()) == 3:
|
|
elif len(command.split()) == 3:
|
|
|
self.db.run("UPDATE users SET coin=coin-%s, coin_spent=coin_spent+%s, coin_given=coin_given+%s, ap_spent=ap_spent+1 WHERE name=%s AND network=%s", (command.split()[2], command.split()[2], command.split()[2], event.source.nick, self.network, ))
|
|
self.db.run("UPDATE users SET coin=coin-%s, coin_spent=coin_spent+%s, coin_given=coin_given+%s, ap_spent=ap_spent+1 WHERE name=%s AND network=%s", (command.split()[2], 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))
|
|
self.db.run("UPDATE users SET coin=coin+%s WHERE LOWER(name)=%s AND network=%s", (command.split()[2], command.split()[1], self.network))
|
|
|
|
|
+ info = GameHelpers.player_info(self, user)
|
|
|
|
|
+ connection.notice(event.source.nick, "Your new statistics: " + info)
|
|
|
|
|
|
|
|
elif command.split()[0] == "players":
|
|
elif command.split()[0] == "players":
|
|
|
if cmdtype == "help": #Display help text.
|
|
if cmdtype == "help": #Display help text.
|