def join(self, ctx, callback=None): if self.__requestCtx.isProcessing(): LOG_ERROR('Request is processing', self.__requestCtx) if callback: callback(False) return if isParentControlActivated(): g_eventDispatcher.showParentControlNotification() if callback: callback(False) return if not hasattr(BigWorld.player(), 'enqueueRandom'): if callback: callback(False) LOG_ERROR('Player can not join to random queue') return mapID = ctx.getDemoArenaTypeID() if mapID: LOG_DEBUG('Demonstrator mapID:', ArenaType.g_cache[mapID].geometryName) self.__requestCtx = ctx self.__requestCtx.startProcessing(callback) BigWorld.player().enqueueRandom(ctx.getVehicleInventoryID(), gameplaysMask=ctx.getGamePlayMask(), arenaTypeID=mapID) LOG_DEBUG('Player is joining to random queue', ctx)
def join(self, ctx, callback=None): if self.__requestCtx.isProcessing(): LOG_ERROR('Request is processing', self.__requestCtx) if callback: callback(False) return if isParentControlActivated(): g_eventDispatcher.showParentControlNotification() if callback: callback(False) return if not hasattr(BigWorld.player(), 'enqueueHistorical'): if callback: callback(False) LOG_ERROR('Player can not join to history queue') return self.__requestCtx = ctx self.__requestCtx.startProcessing(callback) invID = ctx.getVehicleInventoryID() histBattleID = ctx.getHistBattleID() isCreditsAmmo = ctx.getIsCreditsAmmo() BigWorld.player().enqueueHistorical(invID, histBattleID=histBattleID, isCreditsAmmo=isCreditsAmmo) LOG_DEBUG('Player is joining to historical queue', ctx)
def gs_onTillBanNotification(self, isPlayTimeBan, timeTillBlock): if isParentControlActivated(): self.__collection.reset() key = '#system_messages:gameSessionControl/korea/{0:>s}' if isPlayTimeBan: SystemMessages.g_instance.pushI18nMessage(key.format('playTimeNotification'), timeTillBlock, type=SystemMessages.SM_TYPE.Warning) else: SystemMessages.g_instance.pushI18nMessage(key.format('midnightNotification'), type=SystemMessages.SM_TYPE.Warning)
def gs_onTillBanNotification(self, isPlayTimeBan, timeTillBlock): if isParentControlActivated(): self.__prbFunctional.reset() self.__unitFunctional.reset() key = '#system_messages:gameSessionControl/korea/{0:>s}' if isPlayTimeBan: SystemMessages.g_instance.pushI18nMessage(key.format('playTimeNotification'), timeTillBlock) else: SystemMessages.g_instance.pushI18nMessage(key.format('midnightNotification'))
def doAction(self, action=None, dispatcher=None): result = False if action is None or action.actionName == PREBATTLE_ACTION_NAME.JOIN_RANDOM_QUEUE or action.actionName == PREBATTLE_ACTION_NAME.UNDEFINED: if isParentControlActivated(): events_dispatcher.showParentControlNotification() else: self.__doJoin(action=action) result = True return result
def doAction(self, action = None, dispatcher = None): result = False if action is None or action.actionName == PREBATTLE_ACTION_NAME.JOIN_RANDOM_QUEUE or action.actionName == PREBATTLE_ACTION_NAME.UNDEFINED: if isParentControlActivated(): events_dispatcher.showParentControlNotification() else: self.__doJoin(action=action) result = True return result
def gs_onTillBanNotification(self, isPlayTimeBan, timeTillBlock): if isParentControlActivated(): self.__collection.reset() key = '#system_messages:gameSessionControl/korea/{0:>s}' if isPlayTimeBan: SystemMessages.g_instance.pushI18nMessage(key.format('playTimeNotification'), timeTillBlock, type=SystemMessages.SM_TYPE.Warning) else: gameSession = game_control.g_instance.gameSession notifyStartTime, blockTime = gameSession.getCurfewBlockTime() formatter = lambda t: time.strftime('%H:%M', time.localtime(t)) SystemMessages.g_instance.pushI18nMessage(key.format('midnightNotification'), type=SystemMessages.SM_TYPE.Warning, preBlockTime=formatter(notifyStartTime), blockTime=formatter(blockTime))
def gs_onTillBanNotification(self, isPlayTimeBan, timeTillBlock): if isParentControlActivated(): self.__prbFunctional.reset() self.__unitFunctional.reset() key = '#system_messages:gameSessionControl/korea/{0:>s}' if isPlayTimeBan: SystemMessages.g_instance.pushI18nMessage( key.format('playTimeNotification'), timeTillBlock) else: SystemMessages.g_instance.pushI18nMessage( key.format('midnightNotification'))
def _setTeamReady(self, ctx, callback = None): if isParentControlActivated(): events_dispatcher.showParentControlNotification() if callback: callback(False) return isValid, notValidReason = self._limits.isTeamValid() if isValid: ctx.startProcessing(callback) BigWorld.player().prb_teamReady(ctx.getTeam(), ctx.isForced(), ctx.getGamePlayMask(), ctx.onResponseReceived) else: LOG_ERROR('Team is invalid', notValidReason) if callback: callback(False) SystemMessages.pushMessage(messages.getInvalidTeamMessage(notValidReason, functional=self), type=SystemMessages.SM_TYPE.Error)
def gs_onTillBanNotification(self, isPlayTimeBan, timeTillBlock): if isParentControlActivated(): self.__collection.reset() key = '#system_messages:gameSessionControl/korea/{0:>s}' if isPlayTimeBan: SystemMessages.g_instance.pushI18nMessage( key.format('playTimeNotification'), timeTillBlock, type=SystemMessages.SM_TYPE.Warning) else: gameSession = game_control.g_instance.gameSession notifyStartTime, blockTime = gameSession.getCurfewBlockTime() formatter = lambda t: time.strftime('%H:%M', time.localtime(t)) SystemMessages.g_instance.pushI18nMessage( key.format('midnightNotification'), type=SystemMessages.SM_TYPE.Warning, preBlockTime=formatter(notifyStartTime), blockTime=formatter(blockTime))
def join(self, ctx, callback = None): if self.__requestCtx.isProcessing(): LOG_ERROR('Request is processing', self.__requestCtx) if callback: callback(False) return if isParentControlActivated(): g_eventDispatcher.showParentControlNotification() if callback: callback(False) return if not hasattr(BigWorld.player(), 'enqueueEventBattles'): if callback: callback(False) LOG_ERROR('Player can not join to event battles queue') return self.__requestCtx = ctx self.__requestCtx.startProcessing(callback) BigWorld.player().enqueueEventBattles(ctx.getVehicleInventoryIDs(), ctx.getBattleType()) LOG_DEBUG('Player is joining to event battles queue', ctx)
def _setPlayerReady(self, ctx, callback = None): if isParentControlActivated(): events_dispatcher.showParentControlNotification() if callback: callback(False) return isValid, notValidReason = self._limits.isVehicleValid() if not isValid: SystemMessages.pushMessage(messages.getInvalidVehicleMessage(notValidReason, self), type=SystemMessages.SM_TYPE.Error) if callback: callback(False) return rosterKey = self.getRosterKey() team, assigned = decodeRoster(rosterKey) if assigned and self.getTeamState(team=team).isInQueue(): LOG_ERROR('Account assigned and team is ready or locked') if callback: callback(False) return ctx.startProcessing(callback) BigWorld.player().prb_ready(ctx.getVehicleInventoryID(), ctx.onResponseReceived)
def _setPlayerReady(self, ctx, callback = None): if isParentControlActivated(): g_eventDispatcher.showParentControlNotification() if callback: callback(False) return if ctx.doVehicleValidation(): isValid, notValidReason = self._limits.isVehicleValid() if not isValid: SystemMessages.pushMessage(messages.getInvalidVehicleMessage(notValidReason, self), type=SystemMessages.SM_TYPE.Error) if callback: callback(False) return rosterKey = self.getRosterKey() team, assigned = decodeRoster(rosterKey) if assigned and self.getTeamState(team=team).isInQueue(): LOG_ERROR('Account assigned and team is ready or locked') if callback: callback(False) return ctx.startProcessing(callback) BigWorld.player().prb_ready(ctx.getVehicleInventoryID(), ctx.onResponseReceived)
def _setTeamReady(self, ctx, callback = None): if isParentControlActivated(): g_eventDispatcher.showParentControlNotification() if callback: callback(False) return isValid, notValidReason = self._limits.isTeamValid() def _requestResponse(code, errStr): msg = messages.getInvalidTeamServerMessage(errStr, functional=self) if msg is not None: SystemMessages.pushMessage(msg, type=SystemMessages.SM_TYPE.Error) ctx.onResponseReceived(code) if isValid: ctx.startProcessing(callback) BigWorld.player().prb_teamReady(ctx.getTeam(), ctx.isForced(), ctx.getGamePlayMask(), _requestResponse) else: LOG_ERROR('Team is invalid', notValidReason) if callback: callback(False) SystemMessages.pushMessage(messages.getInvalidTeamMessage(notValidReason, functional=self), type=SystemMessages.SM_TYPE.Error)
def join(self, ctx, callback = None): if self.__requestCtx.isProcessing(): LOG_ERROR('Request is processing', self.__requestCtx) if callback: callback(False) return if isParentControlActivated(): g_eventDispatcher.showParentControlNotification() if callback: callback(False) return if not hasattr(BigWorld.player(), 'enqueueRandom'): if callback: callback(False) LOG_ERROR('Player can not join to random queue') return mapID = ctx.getDemoArenaTypeID() if mapID: LOG_DEBUG('Demonstrator mapID:', ArenaType.g_cache[mapID].geometryName) self.__requestCtx = ctx self.__requestCtx.startProcessing(callback) BigWorld.player().enqueueRandom(ctx.getVehicleInventoryID(), gameplaysMask=ctx.getGamePlayMask(), arenaTypeID=mapID) LOG_DEBUG('Player is joining to random queue', ctx)
def join(self, ctx, callback = None): if self.__requestCtx.isProcessing(): LOG_ERROR('Request is processing', self.__requestCtx) if callback: callback(False) return if isParentControlActivated(): g_eventDispatcher.showParentControlNotification() if callback: callback(False) return if not hasattr(BigWorld.player(), 'enqueueHistorical'): if callback: callback(False) LOG_ERROR('Player can not join to history queue') return self.__requestCtx = ctx self.__requestCtx.startProcessing(callback) invID = ctx.getVehicleInventoryID() histBattleID = ctx.getHistBattleID() isCreditsAmmo = ctx.getIsCreditsAmmo() BigWorld.player().enqueueHistorical(invID, histBattleID=histBattleID, isCreditsAmmo=isCreditsAmmo) LOG_DEBUG('Player is joining to historical queue', ctx)