|
|
@@ -30,7 +30,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, "players") + CH.ccc(self, "levelup") + CH.ccc(self, "givecoin")[:-2] + ".")
|
|
|
- connection.privmsg(replyto, grey + "Game help: " + blue + self.helpchar + "xp" + reset + ".")
|
|
|
+ connection.privmsg(replyto, grey + "Game help: " + blue + self.helpchar + "level" + grey + ", " + blue + self.helpchar + "xp" + grey + ", " + blue + self.helpchar + "ap" + grey + ", " + blue + self.helpchar + "coin" + grey + ", " + blue + self.helpchar + "karma" + grey + ".")
|
|
|
|
|
|
elif command.split()[0] == "8ball":
|
|
|
if cmdtype == "help": #Display help text.
|
|
|
@@ -161,8 +161,8 @@ def do_command(self, connection, event):
|
|
|
connection.privmsg(replyto, "Too many arguments, For help type " + blue + self.helpchar + "players " + reset + ".")
|
|
|
return
|
|
|
|
|
|
- level, xp, xpspent, karma, coin = GameHelpers.get_info(self, user)
|
|
|
- connection.privmsg(replyto, message + "Level: " + str(level) + grey + ", " + reset + "XP: " + str(xp) + grey + ", " + reset + "coin: " + str(coin) + grey + ", " + reset + "karma: " + str(karma))
|
|
|
+ level, xp, xpspent, karma, coin, coinspent, coingiven, apspent = GameHelpers.get_info(self, user)
|
|
|
+ connection.privmsg(replyto, message + "Level: " + str(level) + grey + ", " + reset + "XP: " + grey + str(xpspent) + "/" + reset + str(round(xp, 4)) + grey + ", " + reset + "AP: " + str(int(xp - float(apspent))) + grey + ", " + reset + "coin: " + str(coin) + grey + "[S " + str(coinspent) + ", G " + str(coingiven) + "], " + reset + "karma: " + str(round(karma, 4)))
|
|
|
|
|
|
elif command.split()[0] == "levelup":
|
|
|
if cmdtype == "help": #Display help text.
|
|
|
@@ -170,7 +170,7 @@ def do_command(self, connection, event):
|
|
|
elif cmdtype == "cmd":
|
|
|
|
|
|
user = event.source.nick.lower()
|
|
|
- level, xp, xpspent, karma, coin = GameHelpers.get_info(self, user)
|
|
|
+ level, xp, xpspent, karma, coin, coinspent, coingiven, apspent = GameHelpers.get_info(self, user)
|
|
|
if len(command.split()) == 1:
|
|
|
print("XP < 10: " + str(xp < 10))
|
|
|
if xp < 10:
|
|
|
@@ -210,24 +210,32 @@ def do_command(self, connection, event):
|
|
|
elif command.split()[1] == event.source.nick.lower():
|
|
|
connection.privmsg(replyto, "You already have your own coin. For help type " + blue + self.helpchar + "givecoin" + reset + ".")
|
|
|
return
|
|
|
- level, xp, xpspent, karma, coin = GameHelpers.get_info(self, event.source.nick)
|
|
|
+
|
|
|
+ level, xp, xpspent, karma, coin, coinspent, coingiven, apspent = GameHelpers.get_info(self, event.source.nick)
|
|
|
+ receivingrecord = self.db.one("SELECT level, away FROM users WHERE LOWER(name)=%s AND network=%s", (command.split()[1], self.network, ))
|
|
|
if level < 1:
|
|
|
connection.privmsg(replyto, "You need to " + blue + self.cmdchar + "levelup " + reset + "to be able to give coin.")
|
|
|
return
|
|
|
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=%s", (command.split()[1], self.network, )):
|
|
|
+ elif receivingrecord:
|
|
|
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=%s AND LEVEL>0", (command.split()[1], self.network, )):
|
|
|
+ elif receivingrecord[0] == 0:
|
|
|
connection.privmsg(replyto, red + trigger.split()[1] + reset + " is not playing the game.")
|
|
|
return
|
|
|
+ elif receivingrecord[1] == True:
|
|
|
+ connection.privmsg(replyto, red + trigger.split()[1] + reset + "is not here right now.")
|
|
|
+ return
|
|
|
+ elif apspent >= xp:
|
|
|
+ connection.privmsg(replyto, "You have no action points, go use IRC some more...")
|
|
|
+ return
|
|
|
if len(command.split()) == 2:
|
|
|
- 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, coin_spent=coin_spent+1, coin_given=coin_given+1 ap_spent=ap_spent+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, 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, coin_spent=coint_spent+%s coin_given=coin_given+%s ap_spent=ap_spent+%s WHERE name=%s AND network=%s", (command.split()[2], 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))
|
|
|
|
|
|
elif command.split()[0] == "players":
|
|
|
@@ -247,9 +255,21 @@ def do_command(self, connection, event):
|
|
|
if not toplevel and not topxp and not topcoin:
|
|
|
connection.privmsg(replyto, "Nobody is playing the game.")
|
|
|
|
|
|
+ elif command.split()[0] == "level":
|
|
|
+ if cmdtype == "help": #Display help text.
|
|
|
+ connection.privmsg(replyto, "For 10 XP you can use !levelup to gain a level. As your level increases, things become more difficult, while more capabilities and options are unlocked.")
|
|
|
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.")
|
|
|
+ connection.privmsg(replyto, "XP is earned by using IRC and playing the game, in channels with " + red + connection.get_nickname() + reset + ". Ask any operator in " + red + self.homechannel + reset + " to add a channel. XP is used to level up, advance classes, as a limit and as a multiplier. Once XP is expended it keeps counting towards your total.")
|
|
|
+ elif command.split()[0] == "ap":
|
|
|
+ if cmdtype == "help": #Display help text.
|
|
|
+ connection.privmsg(replyto, "XP is earned by using IRC and playing the game in channels with " + red + connection.get_nickname() + reset + ". Ask any operator in " + red + self.homechannel + reset + " to add a channel. AP is expended for every action you take in the game.")
|
|
|
+ elif command.split()[0] == "coin":
|
|
|
+ if cmdtype == "help": #Display help text.
|
|
|
+ connection.privmsg(replyto, "Coin is earned when certain events occur, for instance when a player expands XP. Coin is used to buy items and classes. To give a player coin use " + blue + self.cmdchar + "givecoin" + reset + ". Coin affects karma.")
|
|
|
+ elif command.split()[0] == "karma":
|
|
|
+ if cmdtype == "help": #Display help text.
|
|
|
+ connection.privmsg(replyto, "Karma is a secret formula, based upon on yuor IRC events and how you play the game. It does not increase like XP. Some events, skills and items are karma based.")
|
|
|
|
|
|
# elif command.split()[0] == "classup":
|
|
|
# if cmdtype == "help": #Display help text.
|