|
|
@@ -168,19 +168,18 @@ def do_command(self, connection, event):
|
|
|
|
|
|
elif command.split()[0] == "levelup":
|
|
|
if cmdtype == "help": #Display help text.
|
|
|
- connection.privmsg(replyto, "Spend 10 XP per level gained. Gain multiple levels by specifying the amount.")
|
|
|
+ connection.privmsg(replyto, "Spend XP to gain a level. Gain multiple levels by specifying the amount.")
|
|
|
elif cmdtype == "cmd":
|
|
|
|
|
|
user = event.source.nick.lower()
|
|
|
level, xp, xpspent, totalxp, karma, coin, coinspent, coingiven, ap, apspent = GameHelpers.get_info(self, user)
|
|
|
if len(command.split()) == 1:
|
|
|
- print("XP < 10: " + str(xp < 10))
|
|
|
- if xp < 10:
|
|
|
- connection.privmsg(replyto, "Insuficcient XP, you need at least 10.")
|
|
|
+ if xp < int(level * 2.7):
|
|
|
+ connection.privmsg(replyto, "Insuficcient XP, you need at least " + str(int(level * 2.7)) + ".")
|
|
|
elif ap < 1:
|
|
|
connection.privmsg(replyto, "Insuficcient AP, you need at least 1.")
|
|
|
else:
|
|
|
- self.db.run("UPDATE users SET level=level+1, xp_spent=xp_spent+10, ap_spent=ap_spent+1 WHERE LOWER(name)=%s AND network=%s", (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, ))
|
|
|
elif len(command.split()) == 2:
|
|
|
try:
|
|
|
@@ -188,15 +187,14 @@ def do_command(self, connection, event):
|
|
|
except:
|
|
|
connection.privmsg(replyto, "Invalid amount.")
|
|
|
return
|
|
|
- print("XP < level * 10: " + str(xp < levels * 10))
|
|
|
if levels < 1:
|
|
|
connection.privmsg(replyto, "Invalid amount.")
|
|
|
- elif xp < levels * 10:
|
|
|
- connection.privmsg(replyto, "Insuficcient XP, you need at least " + str(levels * 10) + ".")
|
|
|
+ elif xp < int(level * 2.7):
|
|
|
+ connection.privmsg(replyto, "Insuficcient XP, you need at least " + str(int(level * 2.7)) + ".")
|
|
|
elif ap < levels:
|
|
|
connection.privmsg(replyto, "Insufficient AP, you need at least 1.")
|
|
|
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, levels * 10, 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, ))
|
|
|
else:
|
|
|
connection.privmsg(replyto, "Too many arguments. For help type " + blue + self.helpchar + "levelup " + reset + ".")
|
|
|
@@ -224,6 +222,7 @@ def do_command(self, connection, event):
|
|
|
return
|
|
|
except TypeError:
|
|
|
connection.privmsg(replyto, "Invalid amount. For help type " + blue + self.helpchar + "givecoin" + reset + ".")
|
|
|
+ return
|
|
|
elif not event.target == connection.get_nickname():
|
|
|
if not command.split()[1] in self.channels[event.target].users():
|
|
|
connection.privmsg(replyto, red + trigger.split()[1] + reset + " is not present.")
|