def _goToBootcamp(self): if self.isPlayBootcampMission( ) and self.prbDispatcher is not None and self.linkedSet.isLinkedSetEnabled( ): yield self.prbDispatcher.doSelectAction( PrbAction(PREBATTLE_ACTION_NAME.BOOTCAMP)) return
def __inviteOrCreateSquad(self, referralID): """ Send invite to the target player if squad is already exist or make the new one with invitation """ yield self.prbDispatcher.doSelectAction( PrbAction(PREBATTLE_ACTION_NAME.SQUAD, accountsToInvite=(referralID, )))
def _doSelect(self, dispatcher): currentSeason = self.__mapboxCtrl.getCurrentSeason() if currentSeason is not None: if self.__mapboxCtrl.getCurrentOrNextActiveCycleNumber( currentSeason): yield dispatcher.doSelectAction(PrbAction(self._data)) return
def _doEffect(self, dispatcher): self.__stillRunning = True result = yield dispatcher.doSelectAction( PrbAction(PREBATTLE_ACTION_NAME.BATTLE_TUTORIAL)) self.__stillRunning = False if not result: self._tutorial.refuse()
def onBattleStart(self): mmData = self.__packMMData(self.__mapSelected, self.__levelSelected, self.__spawnSelected) dispatcher = g_prbLoader.getDispatcher() if dispatcher is not None: dispatcher.doAction(PrbAction('', mmData=int(mmData))) self.onWindowClose() return
def __joinToSortie(self): dispatcher = g_prbLoader.getDispatcher() if dispatcher is not None: yield dispatcher.doSelectAction( PrbAction(PREBATTLE_ACTION_NAME.SORTIES_LIST)) else: LOG_ERROR('Prebattle dispatcher is not defined') return
def selectRandomMode(self): dispatcher = self.prbDispatcher if dispatcher is None: return else: yield dispatcher.doSelectAction( PrbAction(PREBATTLE_ACTION_NAME.RANDOM)) return
def fightClick(self, mapID, actionName): navigationPossible = yield self.lobbyContext.isHeaderNavigationPossible( ) if navigationPossible: if self.prbDispatcher: self.prbDispatcher.doAction(PrbAction(actionName, mapID=mapID)) else: LOG_ERROR('Prebattle dispatcher is not defined')
def selectFunRandomBattle(self): dispatcher = self.prbDispatcher if dispatcher is None: _logger.error('Prebattle dispatcher is not defined') return else: yield dispatcher.doSelectAction( PrbAction(PREBATTLE_ACTION_NAME.FUN_RANDOM)) return
def _doSelect(self, dispatcher): if self.__funRandomCtrl.getCurrentSeason( ) is None and self.__funRandomCtrl.getNextSeason() is not None: event_dispatcher.showFunRandomInfoPage() elif self.__funRandomCtrl.isAvailable(): isSuccess = yield dispatcher.doSelectAction(PrbAction(self._data)) if isSuccess: selectorUtils.setBattleTypeAsKnown(self._selectorType) return
def selectMapsTrainingMode(self): dispatcher = self.prbDispatcher if dispatcher is None: return else: isSuccess = yield dispatcher.doSelectAction( PrbAction(PREBATTLE_ACTION_NAME.MAPS_TRAINING)) if isSuccess: self.showMapsTrainingPage() return
def onError(errorData): if restoreOnError: dispatcher.restorePrevious() else: yield dispatcher.doSelectAction(PrbAction(PREBATTLE_ACTION_NAME.STRONGHOLDS_BATTLES_LIST)) try: message = errorData['extra_data']['title'] pushMessage(message, type=SM_TYPE.Error) except (KeyError, TypeError): LOG_CURRENT_EXCEPTION()
def _doSelect(self, dispatcher): if self.__eventProgression.getCurrentSeason( ) is not None or self.__eventProgression.getNextSeason() is not None: isSuccess = yield dispatcher.doSelectAction(PrbAction(self._data)) if isSuccess and self._isNew: selectorUtils.setBattleTypeAsKnown(self._selectorType) else: return self.__eventProgression.openURL() return
def fightClick(self): dispatcher = g_prbLoader.getDispatcher() if not dispatcher: return lobbyContext = dependency.instance(ILobbyContext) navigationPossible = yield lobbyContext.isHeaderNavigationPossible() fightButtonPressPossible = yield lobbyContext.isFightButtonPressPossible( ) if navigationPossible and fightButtonPressPossible: if dispatcher: dispatcher.doAction( PrbAction(PREBATTLE_ACTION_NAME.BATTLE_ROYALE)) else: _logger.error('Prebattle dispatcher is not defined')
def selectMode(self, _): result = False dispatcher = g_prbLoader.getDispatcher() if dispatcher is not None and self.__epicController.isEnabled(): isPrbActive = dispatcher.getFunctionalState().isInPreQueue(QUEUE_TYPE.EPIC) if not isPrbActive: actionName = PREBATTLE_ACTION_NAME.EPIC result = yield dispatcher.doSelectAction(PrbAction(actionName)) else: result = isPrbActive if result: showHangar() yield {'success': result} return
def _doSelect(self, dispatcher): currentSeason = self.__epicController.getCurrentSeason() isEventActive = False if currentSeason is not None: isActiveCycle = self.__epicController.getCurrentCycleInfo()[1] nextCycle = currentSeason.getNextByTimeCycle( time_utils.getCurrentLocalServerTimestamp()) if isActiveCycle or nextCycle: isEventActive = True yield dispatcher.doSelectAction(PrbAction(self._data)) if self._isNew or not isEventActive: self.__epicController.openURL() if self._isNew: selectorUtils.setBattleTypeAsKnown(self._selectorType) return
def __doBootcamp(self, isSkip): dialogType, focusedID = (ExecutionChooserDialogMeta.SKIP, DIALOG_BUTTON_ID.CLOSE) if isSkip else (ExecutionChooserDialogMeta.RETRY, DIALOG_BUTTON_ID.SUBMIT) dialogKey = 'bootcamp/' + dialogType needAwarding = self.bootcamp.needAwarding() if not isSkip and needAwarding: dialogKey = 'bootcamp/' + ExecutionChooserDialogMeta.START result = yield DialogsInterface.showDialog(ExecutionChooserDialogMeta(dialogType, dialogKey, focusedID, not needAwarding and not isSkip)) if result: if isSkip: self.bootcamp.stopBootcamp(False) elif self.prbDispatcher is not None: action = PrbAction(PREBATTLE_ACTION_NAME.BOOTCAMP) yield self.prbDispatcher.doSelectAction(action) self.destroy() return
def _doSelect(self, dispatcher): currentSeason = self.__battleRoyaleController.getCurrentSeason() if currentSeason is not None: isActiveCycle = self.__battleRoyaleController.getCurrentCycleInfo( )[1] nextCycle = currentSeason.getNextByTimeCycle( time_utils.getCurrentLocalServerTimestamp()) if isActiveCycle or nextCycle: self.__battleRoyaleController.setDefaultHangarEntryPoint() isSuccess = yield dispatcher.doSelectAction( PrbAction(self._data)) if isSuccess and self._isNew: selectorUtils.setBattleTypeAsKnown(self._selectorType) else: return self.__battleRoyaleController.openURL() return
def _doSelect(dispatcher): yield dispatcher.doSelectAction(PrbAction(PREBATTLE_ACTION_NAME.STRONGHOLDS_BATTLES_LIST))
def _doSelect(self, prebattleActionName, accountsToInvite=None): action = PrbAction(prebattleActionName, accountsToInvite=accountsToInvite) event = events.PrbActionEvent(action, events.PrbActionEvent.SELECT) g_eventBus.handleEvent(event, EVENT_BUS_SCOPE.LOBBY)
def __doSelect(self, dispatcher): from gui.prb_control.entities.base.ctx import PrbAction from gui.prb_control.settings import PREBATTLE_ACTION_NAME yield dispatcher.doSelectAction(PrbAction( PREBATTLE_ACTION_NAME.RANDOM))
def onLobbyInit(): actions.SelectPrb(PrbAction(self._getPrbActionName())).invoke()
def createBRSquad(self): action = PrbAction(PREBATTLE_ACTION_NAME.BATTLE_ROYALE_SQUAD, accountsToInvite=(self.__playerDBId, )) event = events.PrbActionEvent(action, events.PrbActionEvent.SELECT) g_eventBus.handleEvent(event, EVENT_BUS_SCOPE.LOBBY)
def __continue(self): result = yield self.prbDispatcher.doSelectAction( PrbAction(self._getPrbForcedActionName())) if result: self.__close()
def __doSelect(self, prebattelActionName): yield self.prbDispatcher.doSelectAction(PrbAction(prebattelActionName))
def fightClick(self, mapID, actionName): if self.prbDispatcher: self.prbDispatcher.doAction(PrbAction(actionName, mapID=mapID)) else: LOG_ERROR('Prebattle dispatcher is not defined')
def _doSelect(self, dispatcher): yield dispatcher.doSelectAction(PrbAction(self._data))
def _doEffect(self, dispatcher): self.__stillRunning = True self.__result = yield dispatcher.doSelectAction( PrbAction(PREBATTLE_ACTION_NAME.BATTLE_TUTORIAL)) self.__stillRunning = False
def onLobbyInit(): actions.SelectPrb(PrbAction(PREBATTLE_ACTION_NAME.RANKED)).invoke()
def onMapSelected(self, mapID): dispatcher = g_prbLoader.getDispatcher() if dispatcher is not None: dispatcher.doAction(PrbAction(None, mapID=mapID)) self.onWindowClose() return