Przeglądaj źródła

stop if mode before in homechannel givecoin fix

tBKwtWS 7 lat temu
rodzic
commit
6405b06209
3 zmienionych plików z 7 dodań i 3 usunięć
  1. 1 1
      irc/commands/common.py
  2. 1 1
      irc/commands/games.py
  3. 5 1
      irc/events/on_mode.py

+ 1 - 1
irc/commands/common.py

@@ -159,7 +159,7 @@ class GameHelpers():
         xp_spent = userrecord[0]
         level = userrecord[1]
         coin = userrecord[2]
-        total_xp = ((level + joins + (given * received) + messages + (messages_words / 4) + (messages_characters / 10) + ((actions + (actions_words / 4) + (actions_characters / 10)) * 2) + ((notices + (notices_words / 4) + (notices_characters / 10)) / 2)) / 120) - (level / 25)
+        total_xp = ((level + joins + (given * received) + messages + (messages_words / 4) + (messages_characters / 10) + ((actions + (actions_words / 4) + (actions_characters / 10)) * 2) + ((notices + (notices_words / 4) + (notices_characters / 10)) / 2)) / 120) - (level)
         xp = total_xp - xp_spent
         total_messages = messages + actions + notices
         total_words = messages_words + actions_words + notices_words

+ 1 - 1
irc/commands/games.py

@@ -200,7 +200,7 @@ def do_command(self, connection, event):
                 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)
-            if level < 0:
+            if level < 1:
                 connection.privmsg(replyto, "You need to " + blue + self.cmdchar + "levelup " + reset + "to be able to give coin.")
                 return
             elif coin < 1:

+ 5 - 1
irc/events/on_mode.py

@@ -52,7 +52,11 @@ def process_event(self, connection, event):
             do_everything_to.unban(connection, event.target, connection.get_nickname(), mode[2])
             connection.mode(event.target, "-b " + mode[2])
         
-        # Stop if offender is bot or bot owner.
+        # Stop if not present in home channel.
+        if not self.homechannel in self.channels:
+            return
+        
+        # Stop if offender is bot or bot owner
         if event.source.nick == connection.get_nickname() or self.channels[self.homechannel].is_owner(event.source.nick):
             return