示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 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'))
示例#5
0
 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
示例#6
0
 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
示例#7
0
 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))
示例#8
0
 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'))
示例#9
0
 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)
示例#10
0
 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))
示例#11
0
 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)
示例#12
0
 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)
示例#13
0
 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)
示例#14
0
    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)
示例#15
0
 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)
示例#16
0
 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)