def __onModelsRefresh(self, modelState, resourceList): if BattleReplay.isFinished(): return elif modelState != self.__currentDamageState.modelState: self.__requestModelsRefresh() return elif self.__vehicle is None: return else: vehicle = self.__vehicle newCompoundModel = resourceList[self.__typeDesc.name] self.deactivate(False) self.__compoundModel = newCompoundModel self.__isTurretDetached = vehicle.isTurretDetached if self.__currentDamageState.isCurrentModelDamaged: fashions = VehiclePartsTuple(None, None, None, None) self.swingingAnimator = None self.gunRecoil = None self.__setFashions(fashions, self.__isTurretDetached) self.__destroySystems() self.__trackFashionSet = False self.__setupModels() self.setVehicle(vehicle) self.activate() self.__reattachComponents(self.__compoundModel) lodLink = DataLinks.createFloatLink(self.lodCalculator, 'lodDistance') if not self.damageState.isCurrentModelDamaged: model_assembler.assembleRecoil(self, lodLink) model_assembler.setupTurretRotations(self) return
def changeEngineMode(self, mode, forceSwinging = False): self.__engineMode = mode if self.detailedEngineState is not None: self.detailedEngineState.setMode(self.__engineMode[0]) if self.__trackScrollCtl is not None: self.__trackScrollCtl.setMode(self.__engineMode) if BattleReplay.isPlaying() and BattleReplay.g_replayCtrl.isTimeWarpInProgress: return else: isOldPhysicsMode = self.__vehicle.physicsMode == VEHICLE_PHYSICS_MODE.STANDARD if isOldPhysicsMode and forceSwinging: flags = mode[1] prevFlags = self.__swingMoveFlags swingingAnimator = self.__swingingAnimator if swingingAnimator is not None: moveMask = 3 rotMask = 12 if flags & moveMask ^ prevFlags & moveMask: swingPeriod = 2.0 if flags & 1: swingingAnimator.accelSwingingDirection = -1 elif flags & 2: swingingAnimator.accelSwingingDirection = 1 else: swingingAnimator.accelSwingingDirection = 0 elif not flags & moveMask and flags & rotMask ^ prevFlags & rotMask: swingPeriod = 1.0 swingingAnimator.accelSwingingDirection = 0 else: swingPeriod = 0.0 if swingPeriod > swingingAnimator.accelSwingingPeriod: swingingAnimator.accelSwingingPeriod = swingPeriod self.__swingMoveFlags = flags return
def __showChatInitSuccessMessage(self): if GUI_SETTINGS.voiceChat and not BattleReplay.isPlaying(): if self._VoiceChatManager__failedEventRaised and self.ready: self._VoiceChatManager__failedEventRaised = False self._VoiceChatManager__pendingMessage = None if self._VoiceChatManager__enterToLobby: self._VoiceChatManager__showDialog('voiceChatInitSucceded')
def __voiceChatEnable(self, isEnable): if BattleReplay.isPlaying(): return elif isEnable is None: return else: g_settingsCore.applySetting("enableVoIP", isEnable) return
def __showChatInitErrorMessage(self): if GUI_SETTINGS.voiceChat and not BattleReplay.isPlaying(): if not self.__failedEventRaised and not self.ready: self.__failedEventRaised = True if self.__enterToLobby: self.__showDialog('voiceChatInitFailed') else: self.__pendingMessage = 'voiceChatInitFailed'
def receiveShotImpulse(self, dir, impulse): if BattleReplay.isPlaying() and BattleReplay.g_replayCtrl.isTimeWarpInProgress: return else: if not VehicleDamageState.isDamagedModel(self.__currentDamageState.modelState): self.__swingingAnimator.receiveShotImpulse(dir, impulse) if self.__crashedTracksCtrl is not None: self.__crashedTracksCtrl.receiveShotImpulse(dir, impulse) return
def invalidateInitialization(self): """ Raise the event (onVoiceChatInitFailed) only if all conditions are equal: 1) voip is enabled 2) a replay is not playing 3) VOIP manager is not ready (not initialized) """ if self.isVOIPEnabled() and not BattleReplay.isPlaying() and not self.isReady(): g_messengerEvents.voip.onVoiceChatInitFailed()
def _makeHash(self, index, playerFullName, vInfoVO, vStatsVO, viStatsVO, ctx, playerAccountID, inviteSendingProhibited, invitesReceivingProhibited, isEnemy): vehicleID = vInfoVO.vehicleID vTypeVO = vInfoVO.vehicleType playerVO = vInfoVO.player dbID = playerVO.accountDBID user = self._userGetter(dbID) if user: roster = _getRoster(user) isMuted = user.isMuted() isIgnored = user.isIgnored() else: isIgnored = False roster = 0 isMuted = False squadIndex = ctx.getSquadIndex(vInfoVO) himself = ctx.isPlayerSelected(vInfoVO) isActionsDisabled = vInfoVO.isActionsDisabled() isInvitesForbidden = inviteSendingProhibited or himself or playerVO.forbidInBattleInvitations or isIgnored or isActionsDisabled isPlayerInSquad = playerAccountID == dbID and vInfoVO.isSquadMan() squadNoSound = False if isPlayerInSquad and isRandomBattle() and not IS_CHINA and not BattleReplay.isPlaying(): squadNoSound = not g_settingsCore.getSetting(SOUND.VOIP_ENABLE) return {'position': index + 1, 'label': playerFullName, 'userName': playerVO.getPlayerLabel(), 'icon': vTypeVO.iconPath, 'vehicle': vTypeVO.shortName, 'vehicleState': vInfoVO.vehicleStatus, 'frags': vStatsVO.frags, 'squad': squadIndex, 'clanAbbrev': playerVO.clanAbbrev, 'speaking': self._isSpeaking(dbID), 'uid': dbID, 'himself': himself, 'roster': roster, 'muted': isMuted, 'vipKilled': 0, 'VIP': False, 'teamKiller': ctx.isTeamKiller(vInfoVO), 'denunciations': ctx.denunciationsLeft, 'isPostmortemView': ctx.isPostmortemView(vInfoVO), 'level': vTypeVO.level if g_settingsCore.getSetting('ppShowLevels') else 0, 'vehAction': ctx.getAction(vInfoVO), 'team': vInfoVO.team, 'vehId': vehicleID, 'isIGR': playerVO.isIGR(), 'igrType': playerVO.igrType, 'igrLabel': playerVO.getIGRLabel(), 'isEnabledInRoaming': self._isMenuEnabled(dbID), 'region': self._regionGetter(dbID), 'isPrebattleCreator': playerVO.isPrebattleCreator, 'dynamicSquad': self._getDynamicSquadData(dbID, playerAccountID, isInSquad=squadIndex > 0, inviteSendingProhibited=isInvitesForbidden, invitesReceivingProhibited=invitesReceivingProhibited), 'vehicleType': vTypeVO.getClassName(), 'teamColorScheme': 'vm_enemy' if isEnemy else 'vm_ally', 'vLevel': vTypeVO.level, 'contextMenuDisabled': isActionsDisabled or self._isReplayPlaying, 'squadNoSound': squadNoSound}
def hideLobby(self): if BattleReplay.isPlaying(): self.__window.active(False) elif self.__window is not None: self.__window.close() self.__window = None g_windowsStoredData.stop() BattleReplay.g_replayCtrl.onCommonSwfUnloaded() return
def Vehicle_onEnterWorld(self, prereqs): if self.isPlayerVehicle and config.get('damageLog/enabled'): global on_fire, damageLogConfig, autoReloadConfig data.isReplay = BattleReplay.isPlaying() autoReloadConfig = config.get('autoReloadConfig') if not (autoReloadConfig or damageLogConfig): for section in SECTIONS: damageLogConfig[section] = readyConfig(section) on_fire = 0 data.data['oldHealth'] = self.health data.data['maxHealth'] = self.health
def __voiceChatEnable(self, isEnable): if BattleReplay.isPlaying(): return if isEnable is None: return preveVoIP = Settings.g_instance.userPrefs.readBool(Settings.KEY_ENABLE_VOIP) import VOIP if preveVoIP != isEnable: VOIP.getVOIPManager().enable(isEnable) Settings.g_instance.userPrefs.writeBool(Settings.KEY_ENABLE_VOIP, bool(isEnable)) LOG_NOTE('Change state of voip: %s' % str(isEnable))
def showHittingArea(self, equipmentID, pos, dir, time): if _ENABLE_DEBUG_LOG: LOG_DEBUG("===== showHittingArea =====") LOG_DEBUG(equipmentID) LOG_DEBUG(pos, dir, time) correctedCoords = tuple((int(x * 1000.0) for x in pos.tuple())) areaUID = (int(equipmentID), correctedCoords) if areaUID in self.__selectedAreas: return eq = vehicles.g_cache.equipments()[equipmentID] if BattleReplay.isPlaying(): BigWorld.callback(0.0, functools.partial(self.__showMarkerCallback, eq, pos, dir, time, areaUID)) else: self.__showMarkerCallback(eq, pos, dir, time, areaUID)
def __voiceChatEnable(self, isEnable): if BattleReplay.isPlaying(): return if isEnable is None: return preveVoIP = Settings.g_instance.userPrefs.readBool(Settings.KEY_ENABLE_VOIP) import VOIP if preveVoIP != isEnable: VOIP.getVOIPManager().enable(isEnable) Settings.g_instance.userPrefs.writeBool(Settings.KEY_ENABLE_VOIP, bool(isEnable)) from gui.WindowsManager import g_windowsManager if g_windowsManager.battleWindow is not None and not isEnable: g_windowsManager.battleWindow.speakingPlayersReset() LOG_NOTE('Change state of voip: %s' % str(isEnable))
def applySettings(self): if not BattleReplay.isPlaying(): yield self._updateToVersion() self._core.options.refresh() enableDynamicCamera = self._core.options.getSetting(self.GAME.DYNAMIC_CAMERA) enableDynamicCameraValue = enableDynamicCamera.get() enableSniperStabilization = self._core.options.getSetting(self.GAME.SNIPER_MODE_STABILIZATION) enableSniperStabilizationValue = enableSniperStabilization.get() from AvatarInputHandler import AvatarInputHandler AvatarInputHandler.enableDynamicCamera(enableDynamicCameraValue, enableSniperStabilizationValue) from messenger.doc_loaders import user_prefs from messenger import g_settings as messenger_settings user_prefs.loadFromServer(messenger_settings) self._core.storages.get('FOV').apply(False, True)
def getIntroPageData(self): parameters = self.getParameters() autoStart = parameters.get('introAutoStart', False) if BattleReplay.isPlaying(): autoStart = True introPageData = { 'backgroundImage': RES_ICONS.MAPS_ICONS_BOOTCAMP_LOADING_INTROLOADING, 'video': '', 'autoStart': autoStart, 'lessonNumber': self.__lessonId, 'tutorialPages': self.getBattleLoadingPages(), 'showSkipOption': True } return introPageData
def __setMenuButtonsLabels(self): bootcampIcon = RES_ICONS.MAPS_ICONS_BOOTCAMP_MENU_MENUBOOTCAMPICON bootcampIconSource = icons.makeImageTag(bootcampIcon, 33, 27, -8, 0) if self.app.varsManager.isTutorialRunning(GLOBAL_VARS_MGR_CONSTS.BATTLE): quitLabel = MENU.LOBBY_MENU_BUTTONS_REFUSE_TRAINING elif BattleReplay.isPlaying(): quitLabel = MENU.INGAME_MENU_BUTTONS_REPLAYEXIT else: quitLabel = MENU.INGAME_MENU_BUTTONS_LOGOFF if self.bootcampController.isInBootcamp(): bootcampLabel = BOOTCAMP.REQUEST_BOOTCAMP_FINISH elif self.bootcampController.runCount() > 0: bootcampLabel = BOOTCAMP.REQUEST_BOOTCAMP_RETURN else: bootcampLabel = BOOTCAMP.REQUEST_BOOTCAMP_START self.as_setMenuButtonsLabelsS(MENU.INGAME_MENU_BUTTONS_HELP, MENU.INGAME_MENU_BUTTONS_SETTINGS, MENU.INGAME_MENU_BUTTONS_BACK, quitLabel, bootcampLabel, bootcampIconSource)
def showHittingArea(self, equipmentID, pos, dir, time): if _ENABLE_DEBUG_LOG: LOG_DEBUG('===== showHittingArea =====') LOG_DEBUG(equipmentID) LOG_DEBUG(pos, dir, time) correctedCoords = tuple((int(x * 1000.0) for x in pos.tuple())) areaUID = (int(equipmentID), correctedCoords) if areaUID in self.__selectedAreas: return eq = vehicles.g_cache.equipments()[equipmentID] if BattleReplay.isPlaying(): BigWorld.callback( 0.0, functools.partial(self.__showMarkerCallback, eq, pos, dir, time, areaUID)) else: self.__showMarkerCallback(eq, pos, dir, time, areaUID)
def __sendCursor(self): import BattleReplay if BattleReplay.isPlaying(): return if EntityStates.inState(BigWorld.player(), EntityStates.GAME): self.__updateCurrentRadius() direction = self.__cameraStrategy.cursorDirection if not self.__isExtraMode else self.__lastDirection self.__profile.setCamDirection(direction) dataDir, up = self.__prepareMousePackage(direction) self.__lastDirection = direction if dataDir != self.__lastDataDir: self._lastDataDir = dataDir timeSend = GameEnvironment.getInput().inputAxis.serverTime BigWorld.player().cell.sendMouseDirData(timeSend, dataDir) if up != self.__lastUp: self.__lastUp = up BigWorld.player().cell.sendMouseUp(up)
def subscribe(): global savedValue global xmlRead if BattleReplay.isPlaying(): None else: for gui in CFG: if xmlRead.has_key(gui): b_value = xmlRead.readBool(gui) if b_value == False: gotValue = getattr(constants.ARENA_GUI_TYPE,gui) if(savedValue == 1 or savedValue == 2): if(BigWorld.player().arena.guiType == gotValue): BattleReplay.g_replayCtrl.enableAutoRecordingBattles(0) print BigWorld.player().arena.guiType print BattleReplay.g_replayCtrl.isAutoRecordingEnabled print BattleReplay.g_replayCtrl.isRecording
def applySettings(self): import BattleReplay if not BattleReplay.isPlaying(): yield self._updateToVersion() self._core.options.refresh() enableDynamicCamera = self._core.options.getSetting( self.GAME.DYNAMIC_CAMERA) enableDynamicCameraValue = enableDynamicCamera.get() enableSniperStabilization = self._core.options.getSetting( self.GAME.SNIPER_MODE_STABILIZATION) enableSniperStabilizationValue = enableSniperStabilization.get() from AvatarInputHandler import AvatarInputHandler AvatarInputHandler.enableDynamicCamera(enableDynamicCameraValue, enableSniperStabilizationValue) from messenger.doc_loaders import user_prefs from messenger import g_settings as messenger_settings user_prefs.loadFromServer(messenger_settings) self._core.storages.get('FOV').apply(False, True)
def start(self): super(ShotResultIndicatorPluginModified, self).start() ctrl = self.sessionProvider.shared.crosshair if ctrl is not None: ctrl.onGunMarkerStateChanged -= self._ShotResultIndicatorPlugin__onGunMarkerStateChanged ctrl.onGunMarkerStateChanged += self.__onGunMarkerStateChanged ctrlAnmo = self.sessionProvider.shared.ammo if ctrlAnmo is not None: ctrlAnmo.onGunReloadTimeSet += self.__onGunReloadTimeSet if BattleReplay.isPlaying() or avatar_getter.getArena( ).guiType == ARENA_GUI_TYPE.TRAINING: self.indicator = IndicatorPanel() self.indicator.start() try: g_keyEventHandlers.add(self.handleKeyEvent) except: LOG_CURRENT_EXCEPTION() return
def _sendMouseData(self): import BattleReplay if BattleReplay.isPlaying(): if self._inGame and not self._isExtraMode: self._updateCurrentRadius() return MouseInput._sendMouseData(self) if self._inGame and not self._isExtraMode: self._updateCurrentRadius() direction = self._cameraStrategy.cursorDirection dataDir, exAxis = self._prepareMousePackage(direction) self._profile.setCamDirection(direction) if dataDir != self._lastDataDir: self._lastDataDir = dataDir timeSend = GameEnvironment.getInput().inputAxis.serverTime BigWorld.player().cell.sendMouseDirData(timeSend, dataDir) if exAxis != self._lastExSpeed: self._lastExSpeed = exAxis BigWorld.player().cell.sendMouseExtRSpeed(exAxis)
def getIntroVideoData(self): from bootcamp.Bootcamp import g_bootcamp video = '' background = '' if self.__lessonId == 0: if not g_bootcamp.isIntroVideoPlayed(): video = 'video/_tutorialInitial.usm' background = '../maps/bootcamp/loading/introLoading.png' autoStart = False bootcampParameters = g_bootcamp.getParameters() if bootcampParameters.has_key('introAutoStart'): autoStart = bootcampParameters['introAutoStart'] if BattleReplay.isPlaying(): autoStart = True introVideoData = { 'backgroundImage': background, 'video': video, 'autoStart': autoStart, 'lessonNumber': self.__lessonId, 'tutorialPages': g_bootcamp.getBattleLoadingPages() } return introVideoData
def getIntroVideoData(self): from bootcamp.Bootcamp import g_bootcamp video = '' background = '' if self.isVideoPlayingLesson: video = 'video/_tutorialInitial.usm' background = RES_ICONS.MAPS_ICONS_BOOTCAMP_LOADING_INTROLOADING bootcampParameters = g_bootcamp.getParameters() autoStart = bootcampParameters.get('introAutoStart', False) skipOption = g_bootcamp.getContext().get('skipBootcampOption', False) if BattleReplay.isPlaying(): autoStart = True skipOption = False introVideoData = { 'backgroundImage': background, 'video': video, 'autoStart': autoStart, 'lessonNumber': self.__lessonId, 'tutorialPages': g_bootcamp.getBattleLoadingPages(), 'skipOption': skipOption } return introVideoData
def __onModelsRefresh(self, modelState, resourceList): if BattleReplay.isFinished(): return elif self.__vehicle is None: return else: prevTurretYaw = Math.Matrix(self.turretMatrix).yaw prevGunPitch = Math.Matrix(self.gunMatrix).pitch vehicle = self.__vehicle newCompoundModel = resourceList[self.__typeDesc.name] self.deactivate(False) self.shadowManager.reattachCompoundModel(vehicle, self.__compoundModel, newCompoundModel) self.__compoundModel = newCompoundModel self.__isTurretDetached = vehicle.isTurretDetached self.__prepareSystemsForDamagedVehicle(vehicle, self.__isTurretDetached) self.__setupModels() self.setVehicle(vehicle) self.activate() self.__reattachComponents(self.__compoundModel, self.__weaponEnergy) self.__filter.syncGunAngles(prevTurretYaw, prevGunPitch) model_assembler.setupTurretRotations(self) return
def getStats_Async(self, appToken, ids, onAsyncReports=None): if g_UserToken.userToken and ids: requestList = [] replay = BattleReplay.isPlaying() for accountDBID, vehCD in ids.items(): if vehCD != 65281: requestList.append( '%d=%d%s' % (accountDBID, vehCD, '=1' if not replay and accountDBID == g_UserToken.accountDBID else '')) ids = ','.join(requestList) self._StatisticsConsole__prepareRequest(appToken, True, XVM_STATSREPLAY.format(TOKEN=g_UserToken.userToken, DICT=ids) if replay else \ XVM_STATS.format(TOKEN=g_UserToken.userToken, DICT=ids), onAsyncReports) elif onAsyncReports: if isinstance(onAsyncReports, list): for delegate in onAsyncReports: delegate(None) else: onAsyncReports(None) elif appToken in self._StatisticsConsole__onAsyncReports: for delegate in self._StatisticsConsole__onAsyncReports[appToken]: delegate(None)
def teambl_key(): prebID = 0 arena = getattr(BigWorld.player(), 'arena', None) if arena is not None and not BattleReplay.isPlaying(): if arena.bonusType == 1: sessionProvider = dependency.instance(IBattleSessionProvider) setup = repositories.BattleSessionSetup( avatar=BigWorld.player(), sessionProvider=sessionProvider) adding = anonymizer_fakes_ctrl.AnonymizerFakesController(setup) databID = getAvatarDatabaseID() vehID = getattr(BigWorld.player(), 'playerVehicleID', None) if vehID is not None and vehID in arena.vehicles: prebID = arena.vehicles[vehID]['prebattleID'] for (vehicleID, vData) in getArena().vehicles.iteritems(): databaseID = vData['accountDBID'] av_ses_id = vData['avatarSessionID'] _prebattleID = vData['prebattleID'] user = adding.usersStorage.getUser( av_ses_id, scope=UserEntityScope.BATTLE) if user is not None: if databaseID != databID and not (user.isFriend() or user.isIgnored()): if prebID > 0 and prebID != _prebattleID: adding.addBattleIgnored(av_ses_id) yield wait(1.1) elif prebID == 0: adding.addBattleIgnored(av_ses_id) yield wait(1.1) else: if databaseID != databID: if prebID > 0 and prebID != _prebattleID: adding.addBattleIgnored(av_ses_id) yield wait(1.1) elif prebID == 0: adding.addBattleIgnored(av_ses_id) yield wait(1.1)
def __onModelsRefresh(self, modelState, resourceList): if not self.damageState.isCurrentModelDamaged: raise AssertionError return BattleReplay.isFinished() and None elif not modelState == self.__currentDamageState.modelState: raise AssertionError return self.__vehicle is None and None else: prevTurretYaw = Math.Matrix(self.turretMatrix).yaw prevGunPitch = Math.Matrix(self.gunMatrix).pitch vehicle = self.__vehicle newCompoundModel = resourceList[self.__typeDesc.name] self.deactivate(False) self.__compoundModel = newCompoundModel self.__isTurretDetached = vehicle.isTurretDetached self.__prepareSystemsForDamagedVehicle(vehicle, self.__isTurretDetached) self.__setupModels() self.setVehicle(vehicle) self.activate() self.__reattachComponents(self.__compoundModel, self.__weaponEnergy) self.__filter.syncGunAngles(prevTurretYaw, prevGunPitch) model_assembler.setupTurretRotations(self) return None
def __init__(self, settings): super(BCIntroPage, self).__init__() self._videoPlayerVisible = False self._movieFile = None self._backgroundVideo = None self._backgroundVideoBufferTime = None self._backgroundMusicStartEvent = None self._backgroundMusicStopEvent = None self._backgroundMusicPauseEvent = None self._backgroundMusicResumeEvent = None self._lessonNumber = settings.get('lessonNumber', 0) self._tutorialPages = settings.get('tutorialPages', []) self._autoStart = settings.get('autoStart', False) self._showSkipOption = settings.get( 'showSkipOption', True) if not BattleReplay.isPlaying() else False self._isReferralEnabled = settings.get('isReferralEnabled', False) self._isChoice = settings.get('isChoice', False) self._highlightingMask = 0 self._goToBattleEvent = lambda: g_bootcampEvents.onGameplayChoice( WOT_GAMEPLAY.BOOTCAMP, WOT_GAMEPLAY.ON) self._isWindowAccessible = True self._delayedVideoStart = False return
def changeEngineMode(self, mode, forceSwinging=False): self.__engineMode = mode self.detailedEngineState.setMode(self.__engineMode[0]) if self.exhaustEffects: self.__updateExhaust() if self.__trackScrollCtl is not None: self.__trackScrollCtl.setMode(self.__engineMode) if BattleReplay.isPlaying( ) and BattleReplay.g_replayCtrl.isTimeWarpInProgress: return else: isOldPhysicsMode = self.__vehicle.physicsMode == VEHICLE_PHYSICS_MODE.STANDARD if isOldPhysicsMode and forceSwinging: flags = mode[1] prevFlags = self.__swingMoveFlags swingingAnimator = self.__swingingAnimator if swingingAnimator is not None: moveMask = 3 rotMask = 12 if flags & moveMask ^ prevFlags & moveMask: swingPeriod = 2.0 if flags & 1: swingingAnimator.accelSwingingDirection = -1 elif flags & 2: swingingAnimator.accelSwingingDirection = 1 else: swingingAnimator.accelSwingingDirection = 0 elif not flags & moveMask and flags & rotMask ^ prevFlags & rotMask: swingPeriod = 1.0 swingingAnimator.accelSwingingDirection = 0 else: swingPeriod = 0.0 if swingPeriod > swingingAnimator.accelSwingingPeriod: swingingAnimator.accelSwingingPeriod = swingPeriod self.__swingMoveFlags = flags return
def __toggleRadialMenu(self, event): if BattleReplay.isPlaying(): return isDown = event.ctx['isDown'] g_guiEvents.toggleRadialMenu(isDown)
def _dispose(self): self.sessionProvider.removeArenaCtrl(self) if not BattleReplay.isPlaying(): BigWorld.wg_enableGUIBackground(False, True) super(BattleLoading, self)._disposeWithReloading()
def __onMapsTrainingExit(self): if not BattleReplay.isPlaying() and self.__ctx.lastArenaUniqueID is None: self.__ctx.lastArenaUniqueID = self.__arenaVisitor.getArenaUniqueID() self.__ctx.lastArenaBonusType = self.__arenaVisitor.getArenaBonusType() return
def processFailedMessage(self, *args): if not self.__failedEventRaised and not self.ready and GUI_SETTINGS.voiceChat and not BattleReplay.isPlaying(): self.__failedEventRaised = True self.onVoiceChatInitFailed()
def processFailedMessage(self, *args): if not self.__failedEventRaised and not self.ready and GUI_SETTINGS.voiceChat and not BattleReplay.isPlaying( ): self.__failedEventRaised = True self.onVoiceChatInitFailed()
def arenaLoadCompleted(self): if not BattleReplay.isPlaying(): self.destroy() else: BigWorld.wg_enableGUIBackground(False, False)
def _getFromServerStorage(self, defaultFilters): return defaultFilters if BattleReplay.isPlaying( ) else self.settingsCore.serverSettings.getSections( self._serverSections, defaultFilters)
def _saveToServer(self): if not BattleReplay.isPlaying(): self.settingsCore.serverSettings.setSections( self._serverSections, self._filters)
def start(self, lessonNum, isBattleLesson): LOG_DEBUG_DEV_BOOTCAMP('Starting bootcamp', lessonNum, isBattleLesson) if BattleReplay.g_replayCtrl.isPlaying: self.__replayController = BootcampReplayController() self.__replayController.init() g_bootcampEvents.onInterludeVideoStarted += self.onInterludeVideoStarted g_bootcampEvents.onBattleLessonFinished += self.onBattleLessonFinished g_bootcampEvents.onGarageLessonFinished += self.onGarageLessonFinished g_bootcampEvents.onBattleLoaded += self.onBattleLoaded g_bootcampEvents.onResultScreenPopulated += self.onResultScreenPopulated g_bootcampEvents.onResultScreenFinished += self.onResultScreenFinished g_bootcampEvents.onRequestBootcampFinish += self.onRequestBootcampFinish g_bootcampEvents.onBootcampBecomeNonPlayer += self.onBootcampBecomeNonPlayer g_playerEvents.onAvatarBecomeNonPlayer += self.__onAvatarBecomeNonPlayer g_playerEvents.onArenaCreated += self.__onArenaCreated self.connectionMgr.onDisconnected += self.__cm_onDisconnected self.__requestBootcampFinishFromBattle = False ctx = self.getContext() isRelogin = ctx['relogin'] LOG_DEBUG_DEV_BOOTCAMP('IsRelogin', isRelogin) autoStartBattle = isRelogin or BattleReplay.isPlaying() if not autoStartBattle: self.showActionWaitWindow() yield self.settingsCore.serverSettings.settingsCache.update() self.settingsCore.serverSettings.applySettings() isNewbie = False if ctx['isNewbieSettings'] and not ctx['completed']: isNewbie = True self.__setupPreferences(isNewbie) self.hideActionWaitWindow() eula = EULADispatcher() yield eula.processLicense() eula.fini() self.__running = True self.__lessonId = lessonNum self.__lessonType = BOOTCAMP_LESSON.BATTLE if isBattleLesson else BOOTCAMP_LESSON.GARAGE if (lessonNum == 0 or not isBattleLesson) and not autoStartBattle: self.showActionWaitWindow() yield self.itemsCache.update(CACHE_SYNC_REASON.SHOW_GUI) self.__isRecruit = isCurrentUserRecruit() self.hideActionWaitWindow() if self.__currentState is not None: self.__currentState.deactivate() self.__hangarSpace = ctx['hangarSpace'] self.__hangarSpacePremium = ctx['hangarSpacePremium'] self.__bonuses = ctx['bonuses'] showRewards = ctx['needAwarding'] previousLesson = self.getContextIntParameter('lastLessonNum') - 1 if previousLesson >= 0 and previousLesson < len( self.__bonuses['battle']): self.__bonuses['battle'][previousLesson][ 'showRewards'] = showRewards self.__nation = ctx['nation'] self.__nationsData = ctx['nationsData'] self.__p['completed'] = ctx['completed'] self.__p['needAwarding'] = ctx['needAwarding'] weave(self.__weaver) if AccountSettings.isCleanPC(): dropNewSettingsCounters() g_bootcampEvents.onBootcampStarted() if not autoStartBattle: if isBattleLesson: g_prbLoader.createBattleDispatcher() g_prbLoader.setEnabled(True) self.enqueueBattleLesson() else: self.showActionWaitWindow() yield self.nextFrame() self.__currentState = StateInGarage() self.__lobbyReloader.reload() self.hideActionWaitWindow() self.__currentState.activate() else: from states.StateBattlePreparing import StateBattlePreparing self.__currentState = StateBattlePreparing(self.__lessonId, BigWorld.player()) self.__currentState.activate() BigWorld.overloadBorders(True) if self.__chapter is None: self.__chapter = Chapter() if self.__gui is None: self.__gui = BootcampGUI() WWISE.loadSoundPool(self.BOOTCAMP_SOUND_BANKS, 'Bootcamp') self.__combatSoundAssistant = BootcampCombatSoundAssistant() self.sessionProvider.getCtx().setPlayerFullNameFormatter( _BCNameFormatter()) return
def _isReplay(opType = ''): import BattleReplay if BattleReplay.isLoading() or BattleReplay.isPlaying(): LOG_DEBUG('Replay is currently playing. {} requesting operations are forbidden'.format(opType)) return True return False
def load(self, src, pList, settings, forceLoad): src.isActive = BattleReplay.isPlaying()
def init(scriptConfig, engineConfig, userPreferences, loadingScreenGUI=None): global g_replayCtrl global g_onBeforeSendEvent try: log.config.setupFromXML() if constants.IS_DEVELOPMENT: autoFlushPythonLog() from development_features import initDevBonusTypes initDevBonusTypes() import Event g_onBeforeSendEvent = Event.Event() BigWorld.wg_initCustomSettings() Settings.g_instance = Settings.Settings(scriptConfig, engineConfig, userPreferences) CommandMapping.g_instance = CommandMapping.CommandMapping() from helpers import DecalMap DecalMap.g_instance = DecalMap.DecalMap(scriptConfig['decal']) from helpers import EdgeDetectColorController EdgeDetectColorController.g_instance = EdgeDetectColorController.EdgeDetectColorController(scriptConfig['silhouetteColors']) SoundGroups.g_instance = SoundGroups.SoundGroups() import BattleReplay g_replayCtrl = BattleReplay.g_replayCtrl = BattleReplay.BattleReplay() g_replayCtrl.registerWotReplayFileExtension() g_bootcamp.replayCallbackSubscribe() try: from Vibroeffects import VibroManager VibroManager.g_instance = VibroManager.VibroManager() VibroManager.g_instance.connect() except Exception: LOG_CURRENT_EXCEPTION() tutorialLoaderInit() BigWorld.callback(0.1, asyncore_call) import items items.init(True, None if not constants.IS_DEVELOPMENT else {}) import win_points win_points.init() import rage rage.init() import ArenaType ArenaType.init() import dossiers2 dossiers2.init() import personal_missions personal_missions.init() import motivation_quests motivation_quests.init() BigWorld.worldDrawEnabled(False) dependency.configure(services_config.getClientServicesConfig) gui_personality.init(loadingScreenGUI=loadingScreenGUI) EdgeDetectColorController.g_instance.create() g_replayCtrl.subscribe() MessengerEntry.g_instance.init() AreaDestructibles.init() MusicControllerWWISE.create() TriggersManager.init() RSSDownloader.init() items.clearXMLCache() SoundGroups.loadLightSoundsDB() import player_ranks player_ranks.init() import destructible_entities destructible_entities.init() try: from LightFx import LightManager LightManager.g_instance = LightManager.LightManager() import AuxiliaryFx AuxiliaryFx.g_instance = AuxiliaryFx.AuxiliaryFxManager() except Exception: LOG_CURRENT_EXCEPTION() from AvatarInputHandler.cameras import FovExtended FovExtended.instance().resetFov() BigWorld.pauseDRRAutoscaling(True) except Exception: LOG_CURRENT_EXCEPTION() BigWorld.quit() return
def arenaLoadCompleted(self): if not BattleReplay.isPlaying(): self.destroy()
def onDogTagKillerOutPlaySound(self): if not BattleReplay.isPlaying(): WWISE.WW_eventGlobal( backport.sound(R.sounds.dt_pc_destroyed_slide_out()))
def _dispose(self): Waiting.close() g_sessionProvider.removeArenaCtrl(self) if not BattleReplay.isPlaying(): BigWorld.wg_enableGUIBackground(False, True) super(BattleLoading, self)._dispose()
def invalidateInitialization(self): if self.isVOIPEnabled( ) and not BattleReplay.isPlaying() and not self.isReady(): g_messengerEvents.voip.onVoiceChatInitFailed()
def __showChatInitErrorMessage(self): if GUI_SETTINGS.voiceChat and not BattleReplay.isPlaying(): if not self.__failedEventRaised and not self.ready: self.__failedEventRaised = True
def notInReplay(): return not BattleReplay.isPlaying() if IS_CLIENT else True
def init(scriptConfig, engineConfig, userPreferences, loadingScreenGUI=None): global g_replayCtrl try: if constants.IS_DEVELOPMENT: autoFlushPythonLog() BigWorld.wg_initCustomSettings() g_postProcessing.init() Settings.g_instance = Settings.Settings(scriptConfig, engineConfig, userPreferences) CommandMapping.g_instance = CommandMapping.CommandMapping() from helpers import DecalMap DecalMap.g_instance = DecalMap.DecalMap(scriptConfig['decal']) from helpers import EdgeDetectColorController EdgeDetectColorController.g_instance = EdgeDetectColorController.EdgeDetectColorController( scriptConfig['silhouetteColors']) import SoundGroups SoundGroups.g_instance = SoundGroups.SoundGroups() import BattleReplay g_replayCtrl = BattleReplay.g_replayCtrl = BattleReplay.BattleReplay() g_replayCtrl.registerWotReplayFileExtension() try: from Vibroeffects import VibroManager VibroManager.g_instance = VibroManager.VibroManager() VibroManager.g_instance.connect() except: LOG_CURRENT_EXCEPTION() tutorialLoaderInit() BigWorld.callback(0.1, asyncore_call) import items items.init(True, None if not constants.IS_DEVELOPMENT else {}) import win_points win_points.init() import rage rage.init() import ArenaType ArenaType.init() import dossiers2 dossiers2.init() import fortified_regions fortified_regions.init() import clubs_settings clubs_settings.init() import potapov_quests potapov_quests.init() import clubs_quests clubs_quests.init() import motivation_quests motivation_quests.init() BigWorld.worldDrawEnabled(False) import LcdKeyboard LcdKeyboard.enableLcdKeyboardSpecificKeys(True) dependency.configure(services_config.getClientServicesConfig) gui_personality.init(loadingScreenGUI=loadingScreenGUI) EdgeDetectColorController.g_instance.create() g_replayCtrl.subscribe() MessengerEntry.g_instance.init() AreaDestructibles.init() MusicControllerWWISE.create() TriggersManager.init() RSSDownloader.init() SoundGroups.loadLightSoundsDB() try: from LightFx import LightManager LightManager.g_instance = LightManager.LightManager() import AuxiliaryFx AuxiliaryFx.g_instance = AuxiliaryFx.AuxiliaryFxManager() except: LOG_CURRENT_EXCEPTION() from AvatarInputHandler.cameras import FovExtended FovExtended.instance().resetFov() BigWorld.pauseDRRAutoscaling(True) except Exception: LOG_CURRENT_EXCEPTION() BigWorld.quit() return
def isBattleLoadingShowed(): global __bBattleLoadingShowed return __bBattleLoadingShowed if BattleReplay.isPlaying() else False
def start(self, lessonNum, isBattleLesson): LOG_DEBUG_DEV_BOOTCAMP('Starting bootcamp', lessonNum, isBattleLesson) from gui.shared.personality import ServicesLocator if BattleReplay.g_replayCtrl.isPlaying: self.__replayController = BootcampReplayController() self.__replayController.init() g_bootcampEvents.onBattleLessonFinished += self.onBattleLessonFinished g_bootcampEvents.onGarageLessonFinished += self.onGarageLessonFinished g_bootcampEvents.onBattleLoaded += self.onBattleLoaded g_bootcampEvents.onResultScreenFinished += self.onResultScreenFinished g_bootcampEvents.onRequestBootcampFinish += self.onRequestBootcampFinish g_bootcampEvents.onOutroVideoStop += self.onOutroVideoStop g_bootcampEvents.onBootcampBecomeNonPlayer += self.onBootcampBecomeNonPlayer g_playerEvents.onAvatarBecomeNonPlayer += self.__onAvatarBecomeNonPlayer g_playerEvents.onArenaCreated += self.__onArenaCreated self.connectionMgr.onDisconnected += self.__cm_onDisconnected self.__requestBootcampFinishFromBattle = False ctx = self.getContext() isRelogin = ctx['relogin'] LOG_DEBUG_DEV_BOOTCAMP('IsRelogin', isRelogin) if not BattleReplay.isPlaying(): if not isRelogin: self.showActionWaitWindow() yield self.settingsCore.serverSettings.settingsCache.update() self.settingsCore.serverSettings.applySettings() if ctx['isNewbie'] and not ctx['completed'] and ctx[ 'runCount'] == 1: self.__preferences = BootcampPreferences() self.__preferences.setup() self.hideActionWaitWindow() eula = EULADispatcher() yield eula.processLicense() eula.fini() self.__running = True self.__lessonId = lessonNum self.__lessonType = BOOTCAMP_LESSON.BATTLE if isBattleLesson else BOOTCAMP_LESSON.GARAGE if (lessonNum == 0 or not isBattleLesson) and not isRelogin: self.showActionWaitWindow() yield ServicesLocator.itemsCache.update(CACHE_SYNC_REASON.SHOW_GUI) self.hideActionWaitWindow() if self.__currentState is not None: self.__currentState.deactivate() self.__hangarSpace = ctx['hangarSpace'] self.__hangarSpacePremium = ctx['hangarSpacePremium'] self.__bonuses = ctx['bonuses'] showRewards = ctx['needAwarding'] previousLesson = self.getContextIntParameter('lastLessonNum') - 1 if previousLesson >= 0 and previousLesson < len( self.__bonuses['battle']): self.__bonuses['battle'][previousLesson][ 'showRewards'] = showRewards self.__nation = ctx['nation'] self.__nationsData = ctx['nationsData'] self.__p['completed'] = ctx['completed'] self.__p['needAwarding'] = ctx['needAwarding'] from states.StateBattlePreparing import StateBattlePreparing if not BattleReplay.isPlaying(): if isBattleLesson: self.enqueueBattleLesson() else: self.showActionWaitWindow() yield self.nextFrame() self.__currentState = StateInGarage(self.__lessonId, self.__account, self.__checkpoint) ReloadLobbyHelper().reload() self.hideActionWaitWindow() self.__currentState.activate() else: self.__currentState = StateBattlePreparing(self.__lessonId, BigWorld.player()) self.__currentState.activate() BigWorld.overloadBorders(True) if self.__chapter is None: self.__chapter = Chapter() if self.__gui is None: self.__gui = BootcampGUI() for bankName in self.BOOTCAMP_SOUND_BANKS: SoundGroups.g_instance.loadSoundBank(bankName) g_bootcampEvents.onBootcampStarted() from BootcampGarage import g_bootcampGarage g_bootcampGarage.initSubscriptions() return
def __showChatInitSuccessMessage(self): if GUI_SETTINGS.voiceChat and not BattleReplay.isPlaying(): if self.__failedEventRaised and self.ready: self.__failedEventRaised = False