def onHotkeyPressed(self, event): if not hasattr(BigWorld.player(), 'databaseID'): return if self.data['enabled']: if event.isKeyDown() and checkKeys(self.data['togglekey'], event.key): self.data['UIVisible'] = not self.data['UIVisible'] toggleHangarUI(self.data['UIVisible']) if not self.data['UIVisible'] and self.cameraPos and self.data[ 'currentCamPos'] < len(self.cameraPos): setCameraLocation( self.cameraPos[self.data['currentCamPos']]) elif event.isKeyDown() and checkKeys( self.data['camkey'], event.key ) and not self.data['UIVisible'] and self.cameraPos: self.data['currentCamPos'] += 1 if self.data['currentCamPos'] == len( self.cameraPos ) and self.data['addUnlockMode'] and self.data['lockCamera']: SystemMessages.pushMessage( 'temp_SM' + self.i18n['UI_message_cameraUnlocked'], SystemMessages.SM_TYPE.Warning) else: if self.data['currentCamPos'] >= len( self.cameraPos) + (self.data['addUnlockMode'] and self.data['lockCamera']): self.data['currentCamPos'] = 0 setCameraLocation( self.cameraPos[self.data['currentCamPos']]) elif not self.data['UIVisible']: self.data['currentCamPos'] = 0 self.data['UIVisible'] = True toggleHangarUI(True)
def onHotkeyPressed(self, event): if (not hasattr(BigWorld.player(), 'databaseID') or not self.data['enabled'] or not event.isKeyDown() or self.isMSAOpen or not self.skinsData['models']): return if checkKeys(self.data['ChangeViewHotkey'], event.key): try: from gui.mods.mod_remodenabler import g_config as re_config except ImportError: re_config = None if re_config is None: newModeNum = (self.teams.index(self.currentTeam) + 1) % len( self.teams) self.currentTeam = self.teams[newModeNum] if self.data['isDebug']: print self.ID + ': changing display mode to', self.currentTeam SystemMessages.pushMessage( 'temp_SM%s<b>%s</b>' % (self.i18n['UI_mode'], self.i18n['UI_mode_' + self.currentTeam]), SystemMessages.SM_TYPE.Warning) refreshCurrentVehicle() if checkKeys(self.data['DynamicSkinHotkey'], event.key): enabled = self.dynamicSkinEnabled self.dynamicSkinEnabled = not enabled SystemMessages.pushMessage( 'temp_SM' + self.i18n['UI_%sableDynamicSkin' % ('en' if not enabled else 'dis')], SystemMessages.SM_TYPE.CustomizationForGold) refreshCurrentVehicle()
def inj_hkKeyEvent(event): LobbyApp = g_appLoader.getDefLobbyApp() if not LobbyApp: return try: if config.data['enabled']: if event.isKeyDown() and checkKeys(config.data['togglekey']): config.data['UIVisible'] = not config.data['UIVisible'] toggleHangarUI(config.data['UIVisible']) if not config.data['UIVisible'] and config.cameraPos and config.data['currentCamPos'] < len(config.cameraPos): setCameraLocation(config.cameraPos[config.data['currentCamPos']]) elif event.isKeyDown() and checkKeys(config.data['camkey']) and not config.data['UIVisible'] and config.cameraPos: config.data['currentCamPos'] += 1 if config.data['currentCamPos'] == len(config.cameraPos) and config.data[ 'addUnlockMode'] and config.data['lockCamera']: SystemMessages.pushMessage( 'temp_SM' + config.i18n['UI_message_cameraUnlocked'], SystemMessages.SM_TYPE.Warning) else: if config.data['currentCamPos'] >= len(config.cameraPos) + (config.data[ 'addUnlockMode'] and config.data['lockCamera']): config.data['currentCamPos'] = 0 setCameraLocation(config.cameraPos[config.data['currentCamPos']]) elif not config.data['UIVisible']: config.data['currentCamPos'] = 0 config.data['UIVisible'] = True toggleHangarUI(True) except StandardError: print config.ID + ': ERROR at inj_hkKeyEvent' traceback.print_exc()
def onHotkeyPressed(self, event): if not hasattr(BigWorld.player(), 'arena') or not self.data['enabled'] or not self.data['mode']: return if self.data['mode'] == 1 and checkKeys(self.data['toggle_key'], event.key) and event.isKeyDown(): self.displayed = not self.displayed elif self.data['mode'] == 2: self.displayed = checkKeys(self.data['toggle_key']) for vehicleID in self.__hpCache: self.setHPField(vehicleID)
def battleKeyControl(self, event): if not self.data['mode']: return if self.data['mode'] == 1 and checkKeys( self.data['toggle_key']) and event.isKeyDown(): self.displayed = not self.displayed elif self.data['mode'] == 2: self.displayed = checkKeys(self.data['toggle_key']) for vehicleID in self.__hpCache: self.setHPField(vehicleID)
def onHotkeyPressed(self, event): if not event.isKeyDown() or not self.data['enabled']: return if checkKeys(config0.getData()['hotkey1']): if self.data['currentNumber'] > 0: self.data['currentNumber'] = 0 else: self.data['currentNumber'] += 1 self.data['activeMode'] = self.data['currentNumber'] == self.data[ 'modeNumber'] self.writeDataJson() if self.data['activeMode']: SendGuiMessage(self.data['name']) elif self.data['activeMode'] and checkKeys( config0.getData()['hotkey2']): if not config0.check_running: self.pressed_key()
def battleKeyControl(event): global isSunControlled if checkKeys(_config.data['hotkey']) and event.isKeyDown(): isSunControlled = not isSunControlled sun_controller(isSunControlled) if isSunControlled: sendMessage(_config.i18n['UI_activSunMod']) else: sendMessage(_config.i18n['UI_deactivSunMod'], 'Red')
def onHotkeyPressed(self, event): if (not hasattr(BigWorld.player(), 'arena') or not self.data['enabled'] or not checkKeys(self.data['hotkey'], event.key) or not event.isKeyDown()): return self.isSunControlled = not self.isSunControlled sun_controller(self.isSunControlled) if self.isSunControlled: sendMessage(self.i18n['UI_activSunMod']) else: sendMessage(self.i18n['UI_deactivSunMod'], 'Red')
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()
def new_SniperControlMode_handleKeyEvent(base, self, isDown, key, mods, event=None): if config.data['enabled'] and isDown and checkKeys(config.data['hotkey']): config.data['isEnabled'] = not config.data['isEnabled'] hide_hull(config.data['isEnabled']) addValues(self._cam._SniperCamera__cfg['zooms'], self._cam._SniperCamera__dynamicCfg['zoomExposure']) base(self, isDown, key, mods, event)
def lobbyKeyControl(event): if not event.isKeyDown() or g_config.isMSAWindowOpen or not g_config.skinsData['models']: return if checkKeys(g_config.data['ChangeViewHotkey']): try: from gui.mods.mod_remodenabler import g_config as re_config except ImportError: re_config = None if re_config is None: newModeNum = (g_config.teams.index(g_config.currentTeam) + 1) % len(g_config.teams) g_config.currentTeam = g_config.teams[newModeNum] if g_config.data['isDebug']: print g_config.ID + ': changing display mode to', g_config.currentTeam SystemMessages.pushMessage( 'temp_SM%s<b>%s</b>' % (g_config.i18n['UI_mode'], g_config.i18n['UI_mode_' + g_config.currentTeam]), SystemMessages.SM_TYPE.Warning) refreshCurrentVehicle() if checkKeys(g_config.data['DynamicSkinHotkey']): enabled = g_config.dynamicSkinEnabled g_config.dynamicSkinEnabled = not enabled SystemMessages.pushMessage( 'temp_SM' + g_config.i18n['UI_%sableDynamicSkin' % ('en' if not enabled else 'dis')], SystemMessages.SM_TYPE.CustomizationForGold) refreshCurrentVehicle()
def battleKeyControl(event): if checkKeys(_config.data['hotkey']) and event.isKeyDown(): _config.isLampsVisible = not _config.isLampsVisible if _config.isLampsVisible: _config.readCurrentSettings(not _config.data['Debug']) for vehicleID in BigWorld.player().arena.vehicles: curVehicle = BigWorld.entity(vehicleID) if curVehicle is not None and curVehicle.isAlive(): lightsCreate(vehicleID, 'keyPress') sendMessage(_config.i18n['UI_activLamps']) else: for vehicleID in lightDBDict.keys(): lightsDestroy(vehicleID, 'keyPress') sendMessage(_config.i18n['UI_deactivLamps'], 'Red')
def inj_hkKeyEvent(event): BattleApp = g_appLoader.getDefBattleApp() try: if BattleApp and _config.data['enabled'] and not ( len(_config.data['hotkey']) == 1 and BigWorld.player().getForcedGuiControlModeFlags()): if avatar_getter.isVehicleAlive() and event.isKeyDown( ) and checkKeys(_config.data['hotkey']): SoundLoop(True) if _config.data['chatEnable']: calltext() else: SoundLoop(False) except StandardError: print 'Horns: ERROR at inj_hkKeyEvent' traceback.print_exc()
def onHotkeyPressed(self, event): if (not hasattr(BigWorld.player(), 'arena') or not self.data['enabled'] or not checkKeys(self.data['hotkey'], event.key) or not event.isKeyDown()): return self.isLampsVisible = not self.isLampsVisible if self.isLampsVisible: self.readCurrentSettings(not self.data['Debug']) for vehicleID in BigWorld.player().arena.vehicles: curVehicle = BigWorld.entity(vehicleID) if curVehicle is not None and curVehicle.isAlive(): lightsCreate(vehicleID, 'keyPress') sendMessage(self.i18n['UI_activLamps']) else: for vehicleID in lightDBDict.keys(): lightsDestroy(vehicleID, 'keyPress') sendMessage(self.i18n['UI_deactivLamps'], 'Red')
def onHotkeyPressed(self, event): if not isPlayerAvatar() or not self.data['enabled']: return isDown = checkKeys(self.data['mapMenu_key']) if isDown != self.altMenuActive: self.altMenuActive = isDown self.updateMenu() if not event.isKeyDown(): return target = BigWorld.target() player = BigWorld.player() state = getCrosshairType(player, target) commandsList = self.selectedCommands.get('hotkeyOnly', [])[:] menuConf, _ = self.findBestFitConf() if menuConf is not None: commandsList.extend(menuConf.get(state, [])) for command in commandsList: if command and command.handleKeys(command.hotKeys, event.key): command.onCustomAction( target.id if target is not None else None, True)
def onHotkeyPressed(self, event): if (not hasattr(BigWorld.player(), 'databaseID') or not self.data['enabled'] or not event.isKeyDown() or self.isMSAOpen): return if self.modelsData['models'] and not self.previewRemod: if checkKeys(self.data['ChangeViewHotkey'], event.key): newModeNum = (self.teams.index(self.currentTeam) + 1) % len( self.teams) self.currentTeam = self.teams[newModeNum] try: from gui.mods.mod_skinner import g_config as _ _.currentTeam = self.currentTeam except ImportError: _ = None if self.data['isDebug']: print self.ID + ': changing display mode to', self.currentTeam SystemMessages.pushMessage( 'temp_SM%s<b>%s</b>' % (self.i18n['UI_mode'], self.i18n['UI_mode_' + self.currentTeam]), SystemMessages.SM_TYPE.Warning) refreshCurrentVehicle() if checkKeys(self.data['SwitchRemodHotkey'], event.key): curTankType = self.currentTeam snameList = sorted(self.modelsData['models'].keys()) + [''] selected = self.modelsData['selected'][curTankType] vehName = RemodEnablerUI.py_getCurrentVehicleName() if vehName not in selected: return snameIdx = (snameList.index(selected[vehName]) + 1) % len(snameList) for Idx in xrange(snameIdx, len(snameList) - 1): curPRecord = self.modelsData['models'][snameList[Idx]] if vehName not in curPRecord['whitelist']: continue selected[vehName] = curPRecord['name'] break else: selected[vehName] = '' loadJson(self.ID, 'remodsCache', self.modelsData['selected'], self.configPath, True, quiet=not self.data['isDebug']) refreshCurrentVehicle() if checkKeys(self.data['CollisionHotkey'], event.key): SystemMessages.pushMessage( 'temp_SM' + self.i18n['UI_collision_unavailable'], SystemMessages.SM_TYPE.CustomizationForGold) return # noinspection PyUnreachableCode self.collisionMode += 1 self.collisionMode %= 3 if self.collisionMode == 0: if self.data['isDebug']: print self.ID + ': disabling collision displaying' SystemMessages.pushMessage( 'temp_SM' + self.i18n['UI_collision_compare_disable'], SystemMessages.SM_TYPE.CustomizationForGold) elif self.collisionMode == 2: if self.data['isDebug']: print self.ID + ': enabling collision display comparison mode' SystemMessages.pushMessage( 'temp_SM' + self.i18n['UI_collision_compare_enable'], SystemMessages.SM_TYPE.CustomizationForGold) else: if self.data['isDebug']: print self.ID + ': enabling collision display' SystemMessages.pushMessage( 'temp_SM' + self.i18n['UI_collision_enable'], SystemMessages.SM_TYPE.CustomizationForGold) refreshCurrentVehicle()
def handleKeys(self, keys, key): return not (len(self.hotKeys) == 1 and BigWorld.player(). getForcedGuiControlModeFlags()) and checkKeys(keys, key)
def new_SniperControlMode_handleKeyEvent(base, self, isDown, key, mods, event=None): if config.data['enabled'] and isDown and checkKeys(config.data['hotkey'], key): config.vehicleVisible = not config.vehicleVisible self._cam._SniperCamera__showVehicle(config.vehicleVisible, True) return base(self, isDown, key, mods, event)
def lobbyKeyControl(event): if not event.isKeyDown() or g_config.isMSAWindowOpen: return if (g_config.modelsData['enabled'] or g_config.skinsData['enabled']) and checkKeys(g_config.data['ChangeViewHotkey']): while True: newModeNum = (g_config.possibleModes.index(g_config.currentMode) + 1) % len(g_config.possibleModes) g_config.currentMode = g_config.possibleModes[newModeNum] if g_config.data.get(g_config.currentMode, True): break if g_config.data['isDebug']: print g_config.ID + ': changing display mode to', g_config.currentMode SystemMessages.pushMessage( 'temp_SM%s<b>%s</b>' % (g_config.i18n['UI_mode'], g_config.i18n['UI_mode_' + g_config.currentMode]), SystemMessages.SM_TYPE.Warning) refreshCurrentVehicle() if checkKeys(g_config.data['CollisionHotkey']): if g_config.collisionComparisonEnabled: g_config.collisionComparisonEnabled = False if g_config.data['isDebug']: print g_config.ID + ': disabling collision displaying' SystemMessages.pushMessage('temp_SM' + g_config.i18n['UI_disableCollisionComparison'], SystemMessages.SM_TYPE.CustomizationForGold) elif g_config.collisionEnabled: g_config.collisionEnabled = False g_config.collisionComparisonEnabled = True if g_config.data['isDebug']: print g_config.ID + ': enabling collision display comparison mode' SystemMessages.pushMessage('temp_SM' + g_config.i18n['UI_enableCollisionComparison'], SystemMessages.SM_TYPE.CustomizationForGold) else: g_config.collisionEnabled = True if g_config.data['isDebug']: print g_config.ID + ': enabling collision display' SystemMessages.pushMessage('temp_SM' + g_config.i18n['UI_enableCollision'], SystemMessages.SM_TYPE.CustomizationForGold) refreshCurrentVehicle() if checkKeys(g_config.data['DynamicSkinHotkey']): enabled = g_config.dynamicSkinEnabled g_config.dynamicSkinEnabled = not enabled SystemMessages.pushMessage( 'temp_SM' + g_config.i18n['UI_%sableDynamicSkin' % ('en' if not enabled else 'dis')], SystemMessages.SM_TYPE.CustomizationForGold) refreshCurrentVehicle() if g_config.modelsData['enabled'] and checkKeys(g_config.data['SwitchRemodHotkey']): if g_config.currentMode != 'remod': curTankType = g_config.currentMode snameList = sorted(g_config.modelsData['models'].keys()) + [''] selected = g_config.modelsData['selected'][curTankType] vehName = RemodEnablerUI.py_getCurrentVehicleName() if selected.get(vehName) not in snameList: snameIdx = 0 else: snameIdx = snameList.index(selected[vehName]) + 1 if snameIdx == len(snameList): snameIdx = 0 for Idx in xrange(snameIdx, len(snameList)): curPRecord = g_config.modelsData['models'].get(snameList[Idx]) if snameList[Idx] and vehName not in curPRecord.whitelists[curTankType]: continue if vehName in selected: selected[vehName] = getattr(curPRecord, 'name', '') loadJson(g_config.ID, 'remodsCache', g_config.modelsData['selected'], g_config.configPath, True, quiet=not g_config.data['isDebug']) break else: snameList = sorted(g_config.modelsData['models'].keys()) if g_config.modelsData['selected']['remod'] not in snameList: snameIdx = 0 else: snameIdx = snameList.index(g_config.modelsData['selected']['remod']) + 1 if snameIdx == len(snameList): snameIdx = 0 sname = snameList[snameIdx] g_config.modelsData['selected']['remod'] = sname loadJson(g_config.ID, 'remodsCache', g_config.modelsData['selected'], g_config.configPath, True, quiet=not g_config.data['isDebug']) refreshCurrentVehicle()