Exemple #1
0
 def doRawRequest(self, methodName, *args, **kwargs):
     unitMgr = prb_getters.getClientUnitMgr()
     method = getattr(unitMgr, methodName)
     if callable(method):
         method(*args, **kwargs)
     else:
         LOG_ERROR('Name of method is invalid', methodName)
Exemple #2
0
 def init(self):
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitResponseReceived += self.unitMgr_onUnitResponseReceived
         unitMgr.onUnitErrorReceived += self.unitMgr_onUnitErrorReceived
     else:
         LOG_ERROR('Unit manager is not defined')
Exemple #3
0
 def _createByAccountState(self, ctx):
     unitMrg = prb_getters.getClientUnitMgr()
     if unitMrg is None:
         return self._createNoUnitFunctional(ctx)
     else:
         if unitMrg.id and unitMrg.unitIdx:
             entity = prb_getters.getUnit(unitMrg.unitIdx, safe=True)
             if entity:
                 flags = FUNCTIONAL_FLAG.UNIT
                 if ctx.hasFlags(FUNCTIONAL_FLAG.UNIT_INTRO) and entity.getPrebattleType() == ctx.getEntityType():
                     flags |= FUNCTIONAL_FLAG.SWITCH
                 if entity.isSquad():
                     flags |= FUNCTIONAL_FLAG.SQUAD
                 if entity.isEvent():
                     flags |= FUNCTIONAL_FLAG.EVENT_BATTLES
                 if entity.isFalloutSquad():
                     flags |= FUNCTIONAL_FLAG.FALLOUT_SQUAD
                 ctx.removeFlags(FUNCTIONAL_FLAG.UNIT_BITMASK | FUNCTIONAL_FLAG.ACTIONS_BITMASK)
                 ctx.addFlags(flags)
                 created = self._createUnitFunctional(entity.getPrebattleType(), unit_items.DynamicRosterSettings(entity), flags=flags)
             else:
                 LOG_ERROR('Unit is not found in unit manager', unitMrg.unitIdx, unitMrg.units)
                 unitMrg.leave()
                 created = self._createNoUnitFunctional(ctx)
         else:
             created = self._createByPrbType(ctx)
         return created
 def __stopListening(self):
     """
     Unsubscribe from player events.
     """
     g_eventsCache.companies.onCompanyStateChanged -= self.onCompanyStateChanged
     g_playerEvents.onPrebattleJoined -= self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure -= self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft -= self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle -= self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaJoinFailure -= self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena -= self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged -= self.pe_onPrebattleAutoInvitesChanged
     game_control.g_instance.gameSession.onTimeTillBan -= self.gs_onTillBanNotification
     game_control.g_instance.rentals.onRentChangeNotify -= self.rc_onRentChange
     game_control.g_instance.igr.onIgrTypeChanged -= self.igr_onRoomChange
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined -= self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft -= self.unitMgr_onUnitLeft
         unitMgr.onUnitRestored -= self.unitMgr_onUnitRestored
         unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived
     unitBrowser = prb_getters.getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived -= self.unitBrowser_onErrorReceived
     fortMgr = getClientFortMgr()
     if fortMgr:
         fortMgr.onFortResponseReceived -= self.fortMgr_onFortResponseReceived
         fortMgr.onFortStateChanged -= self.forMgr_onFortStateChanged
     g_prbCtrlEvents.clear()
Exemple #5
0
 def init(self, ctx=None):
     self.__playersMatchingStartedAt = None
     self.__slotVehicleFilters = []
     self.storage.release()
     ret = super(StrongholdEntity, self).init(ctx)
     rev = self._getUnitRevision()
     if rev > 1:
         self.requestUpdateStronghold()
         self.requestSlotVehicleFilters()
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitResponseReceived += self.onUnitResponseReceived
         unitMgr.onUnitNotifyReceived += self.onUnitNotifyReceived
     self.__strongholdSettings.init()
     self.__strongholdUpdateEventsMapping = {'header': self.__onUpdateHeader,
      'timer': self.__onUpdateTimer,
      'state': self.__onUpdateState,
      'reserve': self.__onUpdateReserve}
     playerInfo = self.getPlayerInfo()
     self.__isInSlot = playerInfo.isInSlot
     if self.canShowStrongholdsBattleQueue():
         g_eventDispatcher.showStrongholdsBattleQueue()
     else:
         g_eventDispatcher.loadStrongholds()
     return ret
Exemple #6
0
 def _createByAccountState(self, ctx):
     unitMrg = prb_getters.getClientUnitMgr()
     if unitMrg is None:
         return self._createNoUnitFunctional(ctx)
     else:
         if unitMrg.id and unitMrg.unitIdx:
             entity = prb_getters.getUnit(unitMrg.unitIdx, safe=True)
             if entity:
                 flags = FUNCTIONAL_FLAG.UNIT
                 if ctx.hasFlags(
                         FUNCTIONAL_FLAG.UNIT_INTRO
                 ) and entity.getPrebattleType() == ctx.getEntityType():
                     flags |= FUNCTIONAL_FLAG.SWITCH
                 if entity.isSquad():
                     flags |= FUNCTIONAL_FLAG.SQUAD
                 if entity.isEvent():
                     flags |= FUNCTIONAL_FLAG.EVENT_BATTLES
                 if entity.isFalloutSquad():
                     flags |= FUNCTIONAL_FLAG.FALLOUT_SQUAD
                 ctx.removeFlags(FUNCTIONAL_FLAG.UNIT_BITMASK
                                 | FUNCTIONAL_FLAG.ACTIONS_BITMASK)
                 ctx.addFlags(flags)
                 created = self._createUnitFunctional(
                     entity.getPrebattleType(),
                     unit_items.DynamicRosterSettings(entity),
                     flags=flags)
             else:
                 LOG_ERROR('Unit is not found in unit manager',
                           unitMrg.unitIdx, unitMrg.units)
                 unitMrg.leave()
                 created = self._createNoUnitFunctional(ctx)
         else:
             created = self._createByPrbType(ctx)
         return created
Exemple #7
0
 def __stopListening(self):
     """
     Unsubscribe from player and system events.
     """
     g_playerEvents.onPrebattleJoined -= self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure -= self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft -= self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle -= self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaCreated -= self.pe_onArenaCreated
     g_playerEvents.onArenaJoinFailure -= self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena -= self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged -= self.pe_onPrebattleAutoInvitesChanged
     g_playerEvents.onPrebattleInvitationsError -= self.pe_onPrebattleInviteError
     self.gameSession.onTimeTillBan -= self.gs_onTillBanNotification
     self.rentals.onRentChangeNotify -= self.rc_onRentChange
     self.igrCtrl.onIgrTypeChanged -= self.igr_onRoomChange
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined -= self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft -= self.unitMgr_onUnitLeft
         unitMgr.onUnitRestored -= self.unitMgr_onUnitRestored
         unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived
     unitBrowser = prb_getters.getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived -= self.unitBrowser_onErrorReceived
     g_prbCtrlEvents.clear()
 def __stopListening(self):
     """
     Unsubscribe from player events.
     """
     g_eventsCache.companies.onCompanyStateChanged -= self.onCompanyStateChanged
     g_playerEvents.onPrebattleJoined -= self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure -= self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft -= self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle -= self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaJoinFailure -= self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena -= self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged -= self.pe_onPrebattleAutoInvitesChanged
     game_control.g_instance.gameSession.onTimeTillBan -= self.gs_onTillBanNotification
     game_control.g_instance.rentals.onRentChangeNotify -= self.rc_onRentChange
     game_control.g_instance.igr.onIgrTypeChanged -= self.igr_onRoomChange
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined -= self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft -= self.unitMgr_onUnitLeft
         unitMgr.onUnitRestored -= self.unitMgr_onUnitRestored
         unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived
     unitBrowser = prb_getters.getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived -= self.unitBrowser_onErrorReceived
     fortMgr = getClientFortMgr()
     if fortMgr:
         fortMgr.onFortResponseReceived -= self.fortMgr_onFortResponseReceived
         fortMgr.onFortStateChanged -= self.forMgr_onFortStateChanged
     g_prbCtrlEvents.clear()
Exemple #9
0
 def __stopListening(self):
     g_playerEvents.onPrebattleJoined -= self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure -= self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft -= self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle -= self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaCreated -= self.pe_onArenaCreated
     g_playerEvents.onArenaJoinFailure -= self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena -= self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged -= self.pe_onPrebattleAutoInvitesChanged
     g_playerEvents.onPrebattleInvitationsError -= self.pe_onPrebattleInviteError
     g_playerEvents.onUpdateSpecBattlesWindow -= self.pe_onPrebattleAutoInvitesChanged
     self.gameSession.onTimeTillBan -= self.gs_onTillBanNotification
     self.rentals.onRentChangeNotify -= self.rc_onRentChange
     self.igrCtrl.onIgrTypeChanged -= self.igr_onRoomChange
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined -= self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft -= self.unitMgr_onUnitLeft
         unitMgr.onUnitRestored -= self.unitMgr_onUnitRestored
         unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived
         unitMgr.onUnitNotifyReceived -= self.unitMgr_onUnitNotifyReceived
     unitBrowser = prb_getters.getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived -= self.unitBrowser_onErrorReceived
     g_prbCtrlEvents.clear()
     g_eventBus.removeListener(events.PrbActionEvent.SELECT,
                               self.__onDoSelectAction,
                               scope=EVENT_BUS_SCOPE.LOBBY)
     g_eventBus.removeListener(events.PrbActionEvent.LEAVE,
                               self.__onDoLeaveAction,
                               scope=EVENT_BUS_SCOPE.LOBBY)
Exemple #10
0
 def doRawRequest(self, methodName, *args, **kwargs):
     unitMgr = prb_getters.getClientUnitMgr()
     method = getattr(unitMgr, methodName)
     if callable(method):
         method(*args, **kwargs)
     else:
         LOG_ERROR('Name of method is invalid', methodName)
Exemple #11
0
 def init(self):
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitResponseReceived += self.unitMgr_onUnitResponseReceived
         unitMgr.onUnitErrorReceived += self.unitMgr_onUnitErrorReceived
     else:
         LOG_ERROR('Unit manager is not defined')
Exemple #12
0
 def __removeListeners(self):
     with self.viewModel.transaction() as model:
         model.btnInviteFriends.onClick -= self._onInviteFriends
         model.btnSwitchReady.onClick -= self._onSwitchReady
         model.btnFindPlayers.onClick -= self._onFindPlayers
         model.header.btnMuteAll.onClick -= self._onToggleMuteAll
         model.header.btnLeavePlatoon.onClick -= self._onLeavePlatoon
         model.onClosed -= self._onLeavePlatoon
         model.onMinimized -= self.__onMinimized
         model.onFocusChange -= self.__onFocusChange
     self.__platoonCtrl.onMembersUpdate -= self._updateMembers
     g_messengerEvents.voip.onPlayerSpeaking -= self.__onPlayerSpeaking
     g_messengerEvents.voip.onChannelEntered -= self.__updateVoiceChatToggleState
     g_messengerEvents.voip.onChannelLeft -= self.__updateVoiceChatToggleState
     g_messengerEvents.voip.onChannelAvailable -= self.__updateVoiceChatToggleState
     g_messengerEvents.voip.onChannelLost -= self.__updateVoiceChatToggleState
     g_currentVehicle.onChanged -= self.__updateReadyButton
     usersEvents = g_messengerEvents.users
     usersEvents.onUsersListReceived -= self.__onUsersReceived
     usersEvents.onUserActionReceived -= self.__onUserActionReceived
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr and unitMgr.unit:
         unitMgr.unit.onUnitEstimateInQueueChanged -= self._updateMembers
     g_eventBus.removeListener(events.CoolDownEvent.PREBATTLE, self.__handleSetPrebattleCoolDown, scope=EVENT_BUS_SCOPE.LOBBY)
     g_eventBus.removeListener(events.FightButtonEvent.FIGHT_BUTTON_UPDATE, self.__updateReadyButton, scope=EVENT_BUS_SCOPE.LOBBY)
     g_eventBus.removeListener(events.HideWindowEvent.HIDE_UNIT_WINDOW, self.__onMinimized, scope=EVENT_BUS_SCOPE.LOBBY)
     self.__lobbyContext.getServerSettings().onServerSettingsChange -= self.__onServerSettingsChange
     self.__platoonCtrl.onAvailableTiersForSearchChanged -= self.__onAvailableTiersForSearchChanged
     self.__platoonCtrl.onAutoSearchCooldownChanged -= self._updateFindPlayersButton
 def _populate(self):
     super(CrewOperationsPopOver, self)._populate()
     g_clientUpdateManager.addCallbacks({'inventory': self.onInventoryUpdate})
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitLeft += self.__unitMgrOnUnitLeft
     self.__update()
Exemple #14
0
 def __startProcessingCtx(self, ctx, callback):
     self.__currentCtx = ctx
     self.__currentCtx.startProcessing(callback)
     self.__timeout = BigWorld.callback(_CREATION_TIMEOUT, self.__ctxProcessingTimeout)
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined += self.onUnitJoined
Exemple #15
0
 def __updateEstimatedTime(self):
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr and unitMgr.unit:
         estimatedTime = unitMgr.unit.getEstimatedTimeInQueue()
         if estimatedTime != UNDEFINED_ESTIMATED_TIME:
             with self.viewModel.transaction() as model:
                 model.setEstimatedTime(
                     formatSearchEstimatedTime(estimatedTime))
Exemple #16
0
 def fini(self):
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitResponseReceived -= self.unitMgr_onUnitResponseReceived
         unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived
     self.__requests.clear()
     self.__functional = None
     return
Exemple #17
0
 def __removeListeners(self):
     with self.viewModel.transaction() as model:
         model.btnCancelSearch.onClick -= self.__cancelSearch
         model.onOutsideClick -= self.__onOutsideClick
     g_playerEvents.onQueueInfoReceived -= self.__onQueueInfoReceived
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr and unitMgr.unit:
         unitMgr.unit.onUnitEstimateInQueueChanged -= self.__updateEstimatedTime
Exemple #18
0
 def fini(self):
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitResponseReceived -= self.unitMgr_onUnitResponseReceived
         unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived
     self.__requests.clear()
     self.__functional = None
     return
Exemple #19
0
 def fini(self, ctx = None, woEvents = False):
     self.__cancelMatchmakingTimer()
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitResponseReceived -= self.onUnitResponseReceived
         unitMgr.onUnitNotifyReceived -= self.onUnitNotifyReceived
     self.__strongholdSettings.fini()
     self.__strongholdUpdateEventsMapping = {}
     super(StrongholdEntity, self).fini(ctx, woEvents)
Exemple #20
0
 def init(self):
     """
     Initializes processor and adds required subscriptions
     """
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitResponseReceived += self.unitMgr_onUnitResponseReceived
         unitMgr.onUnitErrorReceived += self.unitMgr_onUnitErrorReceived
     else:
         LOG_ERROR('Unit manager is not defined')
Exemple #21
0
 def fini(self):
     """
     Finalizes processor and removes required subscriptions
     """
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitResponseReceived -= self.unitMgr_onUnitResponseReceived
         unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived
     self.__requests.clear()
     self.__entity = None
     return
Exemple #22
0
 def fini(self, ctx=None, woEvents=False):
     self.__cancelMatchmakingTimer()
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitResponseReceived -= self.onUnitResponseReceived
         unitMgr.onUnitNotifyReceived -= self.onUnitNotifyReceived
     self.__tournamentSettings.fini()
     self.__playersMatchingStartedAt = None
     self.__slotVehicleFilters = []
     self.storage.fini()
     super(TournamentEntity, self).fini(ctx, woEvents)
     return
    def fini(self):
        unitMgr = prb_getters.getClientUnitMgr()
        if unitMgr:
            unitMgr.onUnitResponseReceived -= self.unitMgr_onUnitResponseReceived
            unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived
        for _, (ctx, _) in sorted(self.__requests.items(), key=lambda x: x[0]):
            if ctx is not None:
                ctx.stopProcessing()

        self.__requests.clear()
        self.__entity = None
        return
Exemple #24
0
 def __createByAccountState(self, ctx):
     unitMrg = prb_getters.getClientUnitMgr()
     if unitMrg is None:
         return
     elif unitMrg.id:
         entity = prb_getters.getUnit(safe=True)
         if entity is None:
             LOG_ERROR('Unit is not found in unit manager', unitMrg.id, unitMrg.unit)
             unitMrg.leave()
             return
         return self._createEntityByType(entity.getPrebattleType(), _SUPPORTED_UNIT_BY_TYPE)
     else:
         return self.__createByPrbType(ctx)
Exemple #25
0
 def doRawRequest(self, methodName, *args, **kwargs):
     """
     Sends request directly to unit manager
     Args:
         methodName: method name
         *args: call args
         **kwargs: call kwargs
     """
     unitMgr = prb_getters.getClientUnitMgr()
     method = getattr(unitMgr, methodName)
     if callable(method):
         method(*args, **kwargs)
     else:
         LOG_ERROR('Name of method is invalid', methodName)
Exemple #26
0
 def _sendRequest(self, ctx, methodName, chain, *args, **kwargs):
     unitMgr = prb_getters.getClientUnitMgr()
     result = False
     method = getattr(unitMgr, methodName)
     if callable(method):
         requestID = method(*args, **kwargs)
         if requestID > 0:
             self.__requests[requestID] = (ctx, chain)
             result = True
         else:
             LOG_ERROR('Request ID can not be null')
     else:
         LOG_ERROR('Name of method is invalid', methodName)
     return result
Exemple #27
0
 def _sendRequest(self, ctx, methodName, chain, *args, **kwargs):
     unitMgr = prb_getters.getClientUnitMgr()
     result = False
     method = getattr(unitMgr, methodName)
     if callable(method):
         requestID = method(*args, **kwargs)
         if requestID > 0:
             self.__requests[requestID] = (ctx, chain)
             result = True
         else:
             LOG_ERROR('Request ID can not be null')
     else:
         LOG_ERROR('Name of method is invalid', methodName)
     return result
Exemple #28
0
 def __startListening(self):
     """
     Subscribes to player events.
     """
     g_playerEvents.onPrebattleJoined += self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure += self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft += self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle += self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaJoinFailure += self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena += self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged += self.pe_onPrebattleAutoInvitesChanged
     gameSession = game_control.g_instance.gameSession
     captchaCtrl = game_control.g_instance.captcha
     rentCtr = game_control.g_instance.rentals
     igrCtr = game_control.g_instance.igr
     if gameSession.lastBanMsg is not None:
         self.gs_onTillBanNotification(*gameSession.lastBanMsg)
     gameSession.onTimeTillBan += self.gs_onTillBanNotification
     rentCtr.onRentChangeNotify += self.rc_onRentChange
     captchaCtrl.onCaptchaInputCanceled += self.captcha_onCaptchaInputCanceled
     igrCtr.onIgrTypeChanged += self.igr_onRoomChange
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined += self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft += self.unitMgr_onUnitLeft
         unitMgr.onUnitRestored += self.unitMgr_onUnitRestored
         unitMgr.onUnitErrorReceived += self.unitMgr_onUnitErrorReceived
     else:
         LOG_ERROR('Unit manager is not defined')
     unitBrowser = prb_getters.getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived += self.unitBrowser_onErrorReceived
     else:
         LOG_ERROR('Unit browser is not defined')
     fortMgr = getClientFortMgr()
     if fortMgr:
         fortMgr.onFortStateChanged += self.forMgr_onFortStateChanged
         fortMgr.onFortResponseReceived += self.fortMgr_onFortResponseReceived
     else:
         LOG_ERROR('Fort manager is not defined')
     g_prbCtrlEvents.onPrebattleIntroModeJoined += self.ctrl_onPrebattleIntroModeJoined
     g_prbCtrlEvents.onPrebattleIntroModeLeft += self.ctrl_onPrebattleIntroModeLeft
     g_prbCtrlEvents.onPrebattleInited += self.ctrl_onPrebattleInited
     g_prbCtrlEvents.onUnitIntroModeJoined += self.ctrl_onUnitIntroModeJoined
     g_prbCtrlEvents.onUnitIntroModeLeft += self.ctrl_onUnitIntroModeLeft
     g_prbCtrlEvents.onPreQueueFunctionalCreated += self.ctrl_onPreQueueFunctionalCreated
     g_prbCtrlEvents.onPreQueueFunctionalDestroyed += self.ctrl_onPreQueueFunctionalDestroyed
     g_eventsCache.companies.onCompanyStateChanged += self.onCompanyStateChanged
     return
Exemple #29
0
 def _populate(self):
     LobbySelectableView._populate(self)
     self.__isSpaceReadyForC11n = self.hangarSpace.spaceInited
     self.__isVehicleReadyForC11n = self.hangarSpace.isModelLoaded
     self.__checkVehicleCameraState()
     g_currentVehicle.onChanged += self.__onCurrentVehicleChanged
     self.hangarSpace.onVehicleChangeStarted += self.__onVehicleLoading
     self.hangarSpace.onVehicleChanged += self.__onVehicleLoaded
     self.hangarSpace.onSpaceRefresh += self.__onSpaceRefresh
     self.hangarSpace.onSpaceCreate += self.__onSpaceCreate
     self._festivityController.onStateChanged += self.__updateFestivityState
     self.igrCtrl.onIgrTypeChanged += self.__onIgrTypeChanged
     self.itemsCache.onSyncCompleted += self.onCacheResync
     self.rankedController.onUpdated += self.onRankedUpdate
     self.rankedController.onGameModeStatusTick += self.__updateAlertMessage
     self.__mapboxCtrl.onPrimeTimeStatusUpdated += self.__updateAlertMessage
     self.battleRoyaleController.onUpdated += self.__updateBattleRoyaleComponents
     self.epicController.onUpdated += self.__onEpicBattleUpdated
     self.epicController.onPrimeTimeStatusUpdated += self.__onEpicBattleUpdated
     self.epicController.onGameModeStatusTick += self.__updateAlertMessage
     self._promoController.onNewTeaserReceived += self.__onTeaserReceived
     self.hangarSpace.setVehicleSelectable(True)
     g_prbCtrlEvents.onVehicleClientStateChanged += self.__onVehicleClientStateChanged
     g_playerEvents.onPrebattleInvitationAccepted += self.__onPrebattleInvitationAccepted
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined += self.__onUnitJoined
     g_clientUpdateManager.addCallbacks({'inventory': self.__updateAlertMessage})
     self.lobbyContext.getServerSettings().onServerSettingsChange += self.__onServerSettingChanged
     self._settingsCore.onSettingsChanged += self.__onSettingsChanged
     self.__wotPlusInfo.onRenewableSubscriptionDataChanged += self.__onWotPlusDataChanged
     self.battlePassController.onSeasonStateChange += self.__switchCarousels
     self.startGlobalListening()
     self.__updateAll()
     self.addListener(LobbySimpleEvent.WAITING_SHOWN, self.__onWaitingShown, EVENT_BUS_SCOPE.LOBBY)
     self.addListener(events.FightButtonEvent.FIGHT_BUTTON_UPDATE, self.__handleFightButtonUpdated, scope=EVENT_BUS_SCOPE.LOBBY)
     self.addListener(CameraRelatedEvents.CAMERA_ENTITY_UPDATED, self.__handleSelectedEntityUpdated)
     self.statsCollector.noteHangarLoadingState(HANGAR_LOADING_STATE.HANGAR_UI_READY, showSummaryNow=True)
     lobbyContext = dependency.instance(ILobbyContext)
     isCrewBooksEnabled = lobbyContext.getServerSettings().isCrewBooksEnabled()
     getTutorialGlobalStorage().setValue(GLOBAL_FLAG.CREW_BOOKS_ENABLED, isCrewBooksEnabled)
     self.__timer = CallbackDelayer()
     self.as_setNotificationEnabledS(crewBooksViewedCache().haveNewCrewBooks())
     self._offersBannerController.showBanners()
     self.fireEvent(events.HangarCustomizationEvent(events.HangarCustomizationEvent.RESET_VEHICLE_MODEL_TRANSFORM), scope=EVENT_BUS_SCOPE.LOBBY)
     if g_currentVehicle.isPresent():
         g_currentVehicle.refreshModel()
     if self.bootcampController.isInBootcamp():
         self.as_setDQWidgetLayoutS(DAILY_QUESTS_WIDGET_CONSTANTS.WIDGET_LAYOUT_SINGLE)
 def __startListening(self):
     """
     Subscribes to player events.
     """
     g_playerEvents.onPrebattleJoined += self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure += self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft += self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle += self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaJoinFailure += self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena += self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged += self.pe_onPrebattleAutoInvitesChanged
     gameSession = game_control.g_instance.gameSession
     rentCtr = game_control.g_instance.rentals
     igrCtr = game_control.g_instance.igr
     if gameSession.lastBanMsg is not None:
         self.gs_onTillBanNotification(*gameSession.lastBanMsg)
     gameSession.onTimeTillBan += self.gs_onTillBanNotification
     rentCtr.onRentChangeNotify += self.rc_onRentChange
     igrCtr.onIgrTypeChanged += self.igr_onRoomChange
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined += self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft += self.unitMgr_onUnitLeft
         unitMgr.onUnitRestored += self.unitMgr_onUnitRestored
         unitMgr.onUnitErrorReceived += self.unitMgr_onUnitErrorReceived
     else:
         LOG_ERROR('Unit manager is not defined')
     unitBrowser = prb_getters.getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived += self.unitBrowser_onErrorReceived
     else:
         LOG_ERROR('Unit browser is not defined')
     fortMgr = getClientFortMgr()
     if fortMgr:
         fortMgr.onFortStateChanged += self.forMgr_onFortStateChanged
         fortMgr.onFortResponseReceived += self.fortMgr_onFortResponseReceived
     else:
         LOG_ERROR('Fort manager is not defined')
     g_prbCtrlEvents.onPrebattleIntroModeJoined += self.ctrl_onPrebattleIntroModeJoined
     g_prbCtrlEvents.onPrebattleIntroModeLeft += self.ctrl_onPrebattleIntroModeLeft
     g_prbCtrlEvents.onPrebattleInited += self.ctrl_onPrebattleInited
     g_prbCtrlEvents.onUnitIntroModeJoined += self.ctrl_onUnitIntroModeJoined
     g_prbCtrlEvents.onUnitIntroModeLeft += self.ctrl_onUnitIntroModeLeft
     g_prbCtrlEvents.onPreQueueFunctionalCreated += self.ctrl_onPreQueueFunctionalCreated
     g_prbCtrlEvents.onPreQueueFunctionalDestroyed += self.ctrl_onPreQueueFunctionalDestroyed
     g_eventsCache.companies.onCompanyStateChanged += self.onCompanyStateChanged
     return
Exemple #31
0
 def __startListening(self):
     g_playerEvents.onPrebattleJoined += self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure += self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft += self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle += self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaCreated += self.pe_onArenaCreated
     g_playerEvents.onArenaJoinFailure += self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena += self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged += self.pe_onPrebattleAutoInvitesChanged
     g_playerEvents.onPrebattleInvitationsError += self.pe_onPrebattleInviteError
     g_playerEvents.onUpdateSpecBattlesWindow += self.pe_onPrebattleAutoInvitesChanged
     if self.gameSession.lastBanMsg is not None:
         self.gs_onTillBanNotification(*self.gameSession.lastBanMsg)
     self.gameSession.onTimeTillBan += self.gs_onTillBanNotification
     self.rentals.onRentChangeNotify += self.rc_onRentChange
     self.igrCtrl.onIgrTypeChanged += self.igr_onRoomChange
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined += self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft += self.unitMgr_onUnitLeft
         unitMgr.onUnitRestored += self.unitMgr_onUnitRestored
         unitMgr.onUnitErrorReceived += self.unitMgr_onUnitErrorReceived
         unitMgr.onUnitNotifyReceived += self.unitMgr_onUnitNotifyReceived
     else:
         LOG_ERROR('Unit manager is not defined')
     unitBrowser = prb_getters.getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived += self.unitBrowser_onErrorReceived
     else:
         LOG_ERROR('Unit browser is not defined')
     g_prbCtrlEvents.onLegacyIntroModeJoined += self.ctrl_onLegacyIntroModeJoined
     g_prbCtrlEvents.onLegacyIntroModeLeft += self.ctrl_onLegacyIntroModeLeft
     g_prbCtrlEvents.onLegacyInited += self.ctrl_onLegacyInited
     g_prbCtrlEvents.onUnitIntroModeJoined += self.ctrl_onUnitIntroModeJoined
     g_prbCtrlEvents.onUnitIntroModeLeft += self.ctrl_onUnitIntroModeLeft
     g_prbCtrlEvents.onUnitBrowserModeLeft += self.ctrl_onUnitBrowserModeLeft
     g_prbCtrlEvents.onPreQueueJoined += self.ctrl_onPreQueueJoined
     g_prbCtrlEvents.onPreQueueJoinFailure += self.ctrl_onPreQueueJoinFailure
     g_prbCtrlEvents.onPreQueueLeft += self.ctrl_onPreQueueLeft
     g_eventBus.addListener(events.PrbActionEvent.SELECT,
                            self.__onDoSelectAction,
                            scope=EVENT_BUS_SCOPE.LOBBY)
     g_eventBus.addListener(events.PrbActionEvent.LEAVE,
                            self.__onDoLeaveAction,
                            scope=EVENT_BUS_SCOPE.LOBBY)
     return
 def _dispose(self):
     self.removeListener(LobbySimpleEvent.WAITING_SHOWN,
                         self.__onWaitingShown, EVENT_BUS_SCOPE.LOBBY)
     self.removeListener(events.FightButtonEvent.FIGHT_BUTTON_UPDATE,
                         self.__handleFightButtonUpdated,
                         scope=EVENT_BUS_SCOPE.LOBBY)
     self.removeListener(CameraRelatedEvents.CAMERA_ENTITY_UPDATED,
                         self.__handleSelectedEntityUpdated)
     self.itemsCache.onSyncCompleted -= self.onCacheResync
     g_currentVehicle.onChanged -= self.__onCurrentVehicleChanged
     self.hangarSpace.onVehicleChangeStarted -= self.__onVehicleLoading
     self.hangarSpace.onVehicleChanged -= self.__onVehicleLoaded
     self.hangarSpace.onSpaceRefresh -= self.__onSpaceRefresh
     self.hangarSpace.onSpaceCreate -= self.__onSpaceCreate
     self.igrCtrl.onIgrTypeChanged -= self.__onIgrTypeChanged
     self.rankedController.onUpdated -= self.onRankedUpdate
     self.rankedController.onGameModeStatusTick -= self.__updateAlertMessage
     self.__mapboxCtrl.onPrimeTimeStatusUpdated -= self.__updateAlertMessage
     self.__funRandomController.onGameModeStatusUpdated -= self.__updateAlertMessage
     self.battleRoyaleController.onUpdated -= self.__updateBattleRoyaleComponents
     self.epicController.onUpdated -= self.__onEpicBattleUpdated
     self.epicController.onPrimeTimeStatusUpdated -= self.__onEpicBattleUpdated
     self.epicController.onGameModeStatusTick -= self.__updateAlertMessage
     self._promoController.onNewTeaserReceived -= self.__onTeaserReceived
     if self.__teaser is not None:
         self.__teaser.stop()
         self.__teaser = None
     self.hangarSpace.setVehicleSelectable(False)
     g_prbCtrlEvents.onVehicleClientStateChanged -= self.__onVehicleClientStateChanged
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined -= self.__onUnitJoined
     g_playerEvents.onPrebattleInvitationAccepted -= self.__onPrebattleInvitationAccepted
     g_clientUpdateManager.removeObjectCallbacks(self)
     self._settingsCore.onSettingsChanged -= self.__onSettingsChanged
     self.lobbyContext.getServerSettings(
     ).onServerSettingsChange -= self.__onServerSettingChanged
     self.__wotPlusInfo.onRenewableSubscriptionDataChanged -= self.__onWotPlusDataChanged
     self.battlePassController.onSeasonStateChanged -= self.__switchCarousels
     self.__timer.clearCallbacks()
     self.__timer = None
     self.closeHelpLayout()
     self.stopGlobalListening()
     self._offersBannerController.hideBanners()
     LobbySelectableView._dispose(self)
     return
Exemple #33
0
 def init(self, ctx = None):
     self.storage.release()
     ret = super(StrongholdEntity, self).init(ctx)
     _, unit = self.getUnit()
     if unit._extras.get('rev', 0) > 1:
         self.requestUpdateStronghold()
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitResponseReceived += self.onUnitResponseReceived
         unitMgr.onUnitNotifyReceived += self.onUnitNotifyReceived
     g_eventDispatcher.loadHangar()
     self.__strongholdSettings.init()
     self.__strongholdUpdateEventsMapping = {'header': self.__onUpdateHeader,
      'timer': self.__onUpdateTimer,
      'state': self.__onUpdateState,
      'reserve': self.__onUpdateReserve}
     playerInfo = self.getPlayerInfo()
     self.__isInSlot = playerInfo.isInSlot
     return ret
Exemple #34
0
 def __startListening(self):
     """
     Subscribes to player and system events.
     """
     g_playerEvents.onPrebattleJoined += self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure += self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft += self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle += self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaCreated += self.pe_onArenaCreated
     g_playerEvents.onArenaJoinFailure += self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena += self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged += self.pe_onPrebattleAutoInvitesChanged
     g_playerEvents.onPrebattleInvitationsError += self.pe_onPrebattleInviteError
     if self.gameSession.lastBanMsg is not None:
         self.gs_onTillBanNotification(*self.gameSession.lastBanMsg)
     self.gameSession.onTimeTillBan += self.gs_onTillBanNotification
     self.rentals.onRentChangeNotify += self.rc_onRentChange
     self.igrCtrl.onIgrTypeChanged += self.igr_onRoomChange
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined += self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft += self.unitMgr_onUnitLeft
         unitMgr.onUnitRestored += self.unitMgr_onUnitRestored
         unitMgr.onUnitErrorReceived += self.unitMgr_onUnitErrorReceived
     else:
         LOG_ERROR('Unit manager is not defined')
     unitBrowser = prb_getters.getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived += self.unitBrowser_onErrorReceived
     else:
         LOG_ERROR('Unit browser is not defined')
     g_prbCtrlEvents.onLegacyIntroModeJoined += self.ctrl_onLegacyIntroModeJoined
     g_prbCtrlEvents.onLegacyIntroModeLeft += self.ctrl_onLegacyIntroModeLeft
     g_prbCtrlEvents.onLegacyInited += self.ctrl_onLegacyInited
     g_prbCtrlEvents.onUnitIntroModeJoined += self.ctrl_onUnitIntroModeJoined
     g_prbCtrlEvents.onUnitIntroModeLeft += self.ctrl_onUnitIntroModeLeft
     g_prbCtrlEvents.onUnitBrowserModeLeft += self.ctrl_onUnitBrowserModeLeft
     g_prbCtrlEvents.onPreQueueJoined += self.ctrl_onPreQueueJoined
     g_prbCtrlEvents.onPreQueueJoinFailure += self.ctrl_onPreQueueJoinFailure
     g_prbCtrlEvents.onPreQueueLeft += self.ctrl_onPreQueueLeft
     return
Exemple #35
0
 def init(self, ctx=None):
     self.__playersMatchingStartedAt = None
     self.__slotVehicleFilters = []
     self.storage.release()
     ret = super(TournamentEntity, self).init(ctx)
     rev = self._getUnitRevision()
     if rev > 1:
         self.requestUpdateTournament()
         self.requestSlotVehicleFilters()
     unitMgr = prb_getters.getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitResponseReceived += self.onUnitResponseReceived
         unitMgr.onUnitNotifyReceived += self.onUnitNotifyReceived
     playerInfo = self.getPlayerInfo()
     self.__isInSlot = playerInfo.isInSlot
     if self.canShowTournamentQueue():
         g_eventDispatcher.showTournamentQueue()
     else:
         g_eventDispatcher.loadTournaments()
     self.__tournamentSettings.init()
     return ret
Exemple #36
0
 def __createByAccountState(self, ctx):
     """
     Tries to create entity by current account state.
     Args:
         ctx: creation request context.
     
     Returns:
         new prebattle unit entity
     """
     unitMrg = prb_getters.getClientUnitMgr()
     if unitMrg is None:
         return
     elif unitMrg.id:
         entity = prb_getters.getUnit(safe=True)
         if entity is None:
             LOG_ERROR('Unit is not found in unit manager', unitMrg.id, unitMrg.unit)
             unitMrg.leave()
             return
         return self._createEntityByType(entity.getPrebattleType(), _SUPPORTED_UNIT_BY_TYPE)
     else:
         return self.__createByPrbType(ctx)
Exemple #37
0
 def _sendRequest(self, ctx, methodName, chain, *args, **kwargs):
     """
     Sends request to unit manager with given context to proper method
     Args:
         ctx: request contex
         methodName: routine to invoke
         chain: further opertaion's chain
         *args: routine's args
         **kwargs: routine's kwargs
     """
     unitMgr = prb_getters.getClientUnitMgr()
     result = False
     method = getattr(unitMgr, methodName)
     if callable(method):
         requestID = method(*args, **kwargs)
         if requestID > 0:
             self.__requests[requestID] = (ctx, chain)
             result = True
         else:
             LOG_ERROR('Request ID can not be null')
     else:
         LOG_ERROR('Name of method is invalid', methodName)
     return result