Beispiel #1
0
def new_handler(event):
    if not BattleReplay.isPlaying():
        isDown, key, mods, isRepeat = game.convertKeyEvent(event)
        if isDown and mods == 4 and key == Keys.KEY_O:
            global_vars.increment_mode()
            SendGuiMessage(global_vars.active_mode.name)
        elif isDown and mods == 4 and key == Keys.KEY_B:
            if not global_vars.check_running:
                pressed_key()
        elif isDown and mods == 2 and key == Keys.KEY_O:
            global_vars.toggle_extended()
            if not global_vars.extended:
                SendGuiMessage("Disabled extention")
            elif global_vars.extended:
                SendGuiMessage("Enabled extention")
        elif isDown and mods == 4 and key == Keys.KEY_C:
            global_vars.toggle_enable_clear()
            if not global_vars.enable_clear:
                SendGuiMessage("Disabled clearing your blacklist!")
            elif global_vars.enable_clear:
                contactsForTime = ContactsManager()
                all_bl_users = contactsForTime.usersStorage.getList(
                    ItemsFindCriteria(XMPP_ITEM_TYPE.PERSISTENT_BLOCKING_LIST))
                SendGuiMessage(
                    "Enabled clearing your blacklist!\nMake sure you are in the garage!\nClearing everything will take {}!"
                    .format(
                        str(
                            datetime.timedelta(
                                seconds=round(len(all_bl_users) * 1.1)))))
        elif isDown and mods == 4 and key == Keys.KEY_X:
            if global_vars.enable_clear:
                clear_blacklist()
Beispiel #2
0
 def init(self):
     self.__client = ClientDecorator()
     self.__contacts = ContactsManager()
     self.__connection = ConnectionHandler()
     self.__messages = MessagesManager()
     self.__logger = LogHandler()
     self.__nicknameResolver = NicknameResolver()
 def onHotkeyPressed(self, event):
     if not event.isKeyDown() or not self.data['enabled']:
         return
     if checkKeys(self.data['hotkey3']):
         self.toggle_enable_clear()
         if not self.enable_clear:
             SendGuiMessage("Disabled clearing your blacklist!")
         elif self.enable_clear:
             contactsForTime = ContactsManager()
             all_bl_users = contactsForTime.usersStorage.getList(
                 ItemsFindCriteria(XMPP_ITEM_TYPE.PERSISTENT_BLOCKING_LIST))
             SendGuiMessage(
                 "Enabled clearing your blacklist!\nMake sure you are in the garage!\nClearing everything will take {}!"
                 .format(
                     str(
                         datetime.timedelta(
                             seconds=round(len(all_bl_users) * 1.1)))))
     elif checkKeys(self.data['hotkey4']):
         if self.enable_clear:
             self.clear_blacklist()
Beispiel #4
0
def clear_blacklist():
    arena = getattr(BigWorld.player(), 'arena', None)
    if arena is None and not global_vars.check_running:
        global_vars.check_running = True
        blacklisted_contacts = ContactsManager()
        all_users = blacklisted_contacts.usersStorage.getList(
            ItemsFindCriteria(XMPP_ITEM_TYPE.PERSISTENT_BLOCKING_LIST))
        idx = 0
        while idx < len(all_users) and global_vars.enable_clear:
            blacklisted_contacts.removeIgnored(all_users[idx].getID(), False)
            idx += 1
            yield wait(1.1)
            if idx % 500 == 0:
                users_left = len(all_users) - idx
                SendGuiMessage(
                    'There is ' +
                    str(datetime.timedelta(seconds=round(users_left * 1.1))) +
                    ' left!')
        if idx == len(all_users) - 1:
            SendGuiMessage('Cleared your blacklist!')
        global_vars.check_running = False