tBKwtWS 8 жил өмнө
parent
commit
14dbf946a3

+ 3 - 1
irc/bot.py

@@ -141,7 +141,9 @@ class PyRot(irc.bot.SingleServerIRCBot):
         commands.statistics.do_command(self, connection, event)
         commands.statistics.do_command(self, connection, event)
         commands.games.do_command(self, connection, event)
         commands.games.do_command(self, connection, event)
         try:
         try:
-            if event.source.nick == "NickServ":
+            if event.source.nick == connection.get_nickname():
+                return
+            elif event.source.nick == "NickServ":
                 if event.arguments[0].startswith("This nickname is registered"):
                 if event.arguments[0].startswith("This nickname is registered"):
                     connection.privmsg("NickServ", "identify " + connection.nickname + " " + self.password) # Identify with NickServ.
                     connection.privmsg("NickServ", "identify " + connection.nickname + " " + self.password) # Identify with NickServ.
                 if event.arguments[0] == "You are already identified.":
                 if event.arguments[0] == "You are already identified.":

+ 6 - 3
irc/commands/common.py

@@ -205,12 +205,15 @@ class GameHelpers():
         for record in result:
         for record in result:
             if not record[column] <= threshold:
             if not record[column] <= threshold:
                 level, xp, xpspent, karma, coin, coinspent, coingiven, apspent = GameHelpers.get_info(self, record[0])
                 level, xp, xpspent, karma, coin, coinspent, coingiven, apspent = GameHelpers.get_info(self, record[0])
+                ap = xp + xpspent
+                if ap < 0:
+                    ap = 0
                 if sort == "level":
                 if sort == "level":
-                    message += red + str(record[0]) + reset + " [" + blue + "L " + green + str(level) + reset + ", X " + grey + str(xpspent) + "/" + green + str(int(xp)) + reset + ", A " + str(int(xp - float(apspent))) + ", C " + green + str(coin) + reset + ", K " + green + str(round(karma, 2)) + reset + "], "
+                    message += red + str(record[0]) + reset + " [" + blue + "L " + green + str(level) + reset + ", X " + grey + str(xpspent) + "/" + green + str(int(xp + xpspent)) + reset + ", A " + str(int(ap - float(apspent))) + ", C " + green + str(coin) + reset + ", K " + green + str(round(karma, 2)) + reset + "], "
                 if sort == "xp_spent":
                 if sort == "xp_spent":
-                    message += red + str(record[0]) + reset + " [L " + green + str(level) + reset + ", " + blue + "X " + grey + str(xpspent) + "/" + green + str(int(xp)) + reset + ", A " + str(int(xp - float(apspent))) + ", C " + green + str(coin) + reset + ", K " + green + str(round(karma, 2)) + reset + "], "
+                    message += red + str(record[0]) + reset + " [L " + green + str(level) + reset + ", " + blue + "X " + grey + str(xpspent) + "/" + green + str(int(xp + xpspent)) + reset + ", A " + str(int(ap - float(apspent))) + ", C " + green + str(coin) + reset + ", K " + green + str(round(karma, 2)) + reset + "], "
                 if sort == "coin":
                 if sort == "coin":
-                    message += red + str(record[0]) + reset + " [L " + green + str(level) + reset + ", X " + grey + str(xpspent) + "/" + green + str(int(xp)) + reset + ", " + reset + "A " + str(int(xp - float(apspent))) + ", " + blue + "C " + green + str(coin) + reset + ", K " + green + str(round(karma, 2)) + reset + "], "
+                    message += red + str(record[0]) + reset + " [L " + green + str(level) + reset + ", X " + grey + str(xpspent) + "/" + green + str(int(xp + xpspent)) + reset + ", " + reset + "A " + str(int(ap - float(apspent))) + ", " + blue + "C " + green + str(coin) + reset + ", K " + green + str(round(karma, 2)) + reset + "], "
         return message[:-2]
         return message[:-2]
 
 
 class StatisticsHelpers():
 class StatisticsHelpers():

+ 5 - 2
irc/commands/games.py

@@ -162,7 +162,10 @@ def do_command(self, connection, event):
                 return
                 return
              
              
             level, xp, xpspent, karma, coin, coinspent, coingiven, apspent = GameHelpers.get_info(self, user)
             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)))
+            ap = xp + xpspent
+            if ap < 0:
+                ap = 0
+            connection.privmsg(replyto, message + "Level: " + str(level) + grey + ", " + reset + "XP: " + grey + str(xpspent) + "/" + reset + str(round(xp + xpspent, 4)) + grey + ", " + reset + "AP: " + str(int(ap - 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":
     elif command.split()[0] == "levelup":
         if cmdtype == "help":    #Display help text.
         if cmdtype == "help":    #Display help text.
@@ -266,7 +269,7 @@ def do_command(self, connection, event):
             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.")
             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":
     elif command.split()[0] == "coin":
         if cmdtype == "help":    #Display help text.
         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.")
+            connection.privmsg(replyto, "Coin is earned when certain events occur, for instance when a player expends 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":
     elif command.split()[0] == "karma":
         if cmdtype == "help":    #Display help text.
         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.")
             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.")

+ 2 - 2
irc/commands/public.py

@@ -39,9 +39,9 @@ def do_command(self, connection, event):
             connection.privmsg(replyto, "Displays a list of commands.")
             connection.privmsg(replyto, "Displays a list of commands.")
         elif cmdtype == "cmd":
         elif cmdtype == "cmd":
             if not event.target == connection.get_nickname() and not self.db.one("SELECT join_greeting FROM channels WHERE name='" + event.target + "' AND network='" + self.network + "'"):
             if not event.target == connection.get_nickname() and not self.db.one("SELECT join_greeting FROM channels WHERE name='" + event.target + "' AND network='" + self.network + "'"):
-                connection.privmsg(replyto, grey + "Commands: " + CH.ccc(self, "cmd") + CH.ccc(self, "help") + CH.ccc(self, "away")[:-2] + ".")
+                connection.privmsg(replyto, grey + "Public: " + CH.ccc(self, "cmd") + CH.ccc(self, "help") + CH.ccc(self, "away")[:-2] + ".")
             else:
             else:
-                connection.privmsg(replyto, grey + "Commands: " + CH.ccc(self, "cmd") + CH.ccc(self, "help") + CH.ccc(self, "away") + CH.ccc(self, "stopgreet")[:-2] + ".")
+                connection.privmsg(replyto, grey + "Public: " + CH.ccc(self, "cmd") + CH.ccc(self, "help") + CH.ccc(self, "away") + CH.ccc(self, "stopgreet")[:-2] + ".")
     
     
     elif command == "help":
     elif command == "help":
         if cmdtype == "help":    #Display help text.
         if cmdtype == "help":    #Display help text.

+ 1 - 1
irc/commands/statistics.py

@@ -28,7 +28,7 @@ def do_command(self, connection, event):
 
 
     if command == "cmd" or command == "cmds" or command == "commands":
     if command == "cmd" or command == "cmds" or command == "commands":
         if cmdtype == "cmd":
         if cmdtype == "cmd":
-            connection.privmsg(replyto, grey + "Statistics commands: " + CH.ccc(self, "seen") + CH.ccc(self, "joins") + CH.ccc(self, "kicks") + CH.ccc(self, "messages") + CH.ccc(self, "actions") + CH.ccc(self, "notices")[:-2] + ".")
+            connection.privmsg(replyto, grey + "Statistics: " + CH.ccc(self, "seen") + CH.ccc(self, "joins") + CH.ccc(self, "kicks") + CH.ccc(self, "messages") + CH.ccc(self, "actions") + CH.ccc(self, "notices")[:-2] + ".")
     
     
     
     
     elif command.split()[0] == "joins" or command.split()[0] == "kicks" or command.split()[0] == "messages" or command.split()[0] == "actions" or command.split()[0] == "notices":
     elif command.split()[0] == "joins" or command.split()[0] == "kicks" or command.split()[0] == "messages" or command.split()[0] == "actions" or command.split()[0] == "notices":