def execute(self, customData): pInfo = self._functional.getPlayerInfo() if pInfo.isCreator(): stats = self._functional.getStats() _, unit = self._functional.getUnit() if not unit.isRated( ) and stats.freeSlotsCount > self._functional.getRosterSettings( ).getMaxEmptySlots(): if self._functional.isParentControlActivated(): return if self._functional.getFlags().isDevMode(): DialogsInterface.showDialog( rally_dialog_meta.UnitConfirmDialogMeta( PREBATTLE_TYPE.UNIT, 'startBattle'), lambda result: (self._functional.doBattleQueue( unit_ctx.BattleQueueUnitCtx( 'prebattle/battle_queue')) if result else None)) else: ctx = unit_ctx.AutoSearchUnitCtx('prebattle/auto_search') LOG_DEBUG('Unit request', ctx) self._functional.doAutoSearch(ctx) else: self._sendBattleQueueRequest() else: self._functional.togglePlayerReadyAction()
def autoSearchCancel(self, value): self.currentState = value if value == CYBER_SPORT_ALIASES.AUTO_SEARCH_COMMANDS_STATE or value == CYBER_SPORT_ALIASES.AUTO_SEARCH_ERROR_STATE or value == CYBER_SPORT_ALIASES.AUTO_SEARCH_WAITING_PLAYERS_STATE: self.unitFunctional.request(unit_ctx.AutoSearchUnitCtx(action=0)) elif value == CYBER_SPORT_ALIASES.AUTO_SEARCH_CONFIRMATION_STATE: self.unitFunctional.request(unit_ctx.DeclineSearchUnitCtx()) elif value == CYBER_SPORT_ALIASES.AUTO_SEARCH_ENEMY_STATE: self.unitFunctional.request(unit_ctx.BattleQueueUnitCtx(action=0))
def autoSearchApply(self, value): if value == CYBER_SPORT_ALIASES.AUTO_SEARCH_CONFIRMATION_STATE: self.unitFunctional.request(unit_ctx.AcceptSearchUnitCtx()) elif value == CYBER_SPORT_ALIASES.AUTO_SEARCH_ERROR_STATE: self.currentState = CYBER_SPORT_ALIASES.AUTO_SEARCH_COMMANDS_STATE self.unitFunctional.request(unit_ctx.AutoSearchUnitCtx())
def onAutoMatch(self, value, vehTypes): if value == CYBER_SPORT_ALIASES.INTRO_VIEW_UI: self.unitFunctional.request( unit_ctx.AutoSearchUnitCtx(vehTypes=vehTypes))