def _setPlayerReady(self, ctx, callback = None): """ Sets player state to ready. Args: ctx: set player state request context callback: operation callback """ if prb_getters.isParentControlActivated(): g_eventDispatcher.showParentControlNotification() if callback: callback(False) return if g_currentVehicle.isObserver(): if not self._processValidationResult(ctx, ValidationResult(False, PREBATTLE_RESTRICTION.VEHICLE_NOT_SUPPORTED)): if callback: callback(False) return if ctx.doVehicleValidation(): result = self._limits.isVehicleValid() if not self._processValidationResult(ctx, result): 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 prb_getters.isParentControlActivated(): g_eventDispatcher.showParentControlNotification() if callback: callback(False) return else: result = self._limits.isTeamValid() def _requestResponse(code, errStr): msg = messages.getInvalidTeamServerMessage(errStr, entity=self) if msg is not None: SystemMessages.pushMessage(msg, type=SystemMessages.SM_TYPE.Error) ctx.onResponseReceived(code) return if result is None or result.isValid: ctx.startProcessing(callback) BigWorld.player().prb_teamReady(ctx.getTeam(), ctx.isForced(), ctx.getGamePlayMask(), _requestResponse) else: notValidReason = result.restriction LOG_ERROR('Team is invalid', notValidReason) if callback: callback(False) SystemMessages.pushMessage(messages.getInvalidTeamMessage(notValidReason, entity=self), type=SystemMessages.SM_TYPE.Error) return
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 _setTeamReady(self, ctx, callback=None): if prb_getters.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) return 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 _setPlayerReady(self, ctx, callback=None): if prb_getters.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 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 _validateParentControl(self): """ Validates parent control restrictions. Returns: has pre queue any restrictions """ result = prb_getters.isParentControlActivated() if result: g_eventDispatcher.showParentControlNotification() return result
def _setPlayerReady(self, ctx, callback=None): """ Sets player state to ready. Args: ctx: set player state request context callback: operation callback """ if prb_getters.isParentControlActivated(): g_eventDispatcher.showParentControlNotification() if callback: callback(False) return elif self._cooldown.validate(REQUEST_TYPE.SET_PLAYER_STATE, REQUEST_COOLDOWN.PREBATTLE_NOT_READY): if callback: callback(False) return else: if ctx.doVehicleValidation(): result = self._limits.isVehicleValid() if result is not None and not result.isValid: if not ctx.isInitial(): SystemMessages.pushMessage( messages.getInvalidVehicleMessage( result.restriction, 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) self._cooldown.process( REQUEST_TYPE.SET_PLAYER_STATE, coolDown=REQUEST_COOLDOWN.PREBATTLE_NOT_READY) return
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 prb_getters.isParentControlActivated(): g_eventDispatcher.showParentControlNotification() if callback: callback(False) return if ctx.doVehicleValidation(): result = self._limits.isVehicleValid() if not self._processValidationResult(ctx, result): 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 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 _validateParentControl(self): result = prb_getters.isParentControlActivated() if result: g_eventDispatcher.showParentControlNotification() return result
def _validateParentControl(self): result = prb_getters.isParentControlActivated() if result: g_eventDispatcher.showParentControlNotification() return result