Пример #1
0
 def hasLockMode(self):
     isBS = prb_getters.isBattleSession()
     if isBS:
         isBSVehicleLockMode = bool(prb_getters.getPrebattleSettings()[PREBATTLE_SETTING_NAME.VEHICLE_LOCK_MODE])
         if isBSVehicleLockMode and self.clanLock > 0:
             return True
     return False
Пример #2
0
 def _createByAccountState(self, ctx):
     created = None
     clientPrb = prb_getters.getClientPrebattle()
     if clientPrb is not None:
         if prb_getters.isPrebattleSettingsReceived(prebattle=clientPrb):
             prbSettings = prb_getters.getPrebattleSettings(
                 prebattle=clientPrb)
             prbType = prb_getters.getPrebattleType(settings=prbSettings)
             clazz = None
             if prbType in _SUPPORTED_FUNCTIONAL:
                 clazz = _SUPPORTED_FUNCTIONAL[prbType]
             ctx.removeFlags(FUNCTIONAL_FLAG.PREBATTLE_BITMASK)
             ctx.addFlags(FUNCTIONAL_FLAG.PREBATTLE)
             if clazz:
                 created = clazz(prbSettings)
             else:
                 LOG_ERROR('Prebattle with given type is not supported',
                           prbType)
                 created = not_supported.NotSupportedFunctional()
         elif not ctx.hasFlags(FUNCTIONAL_FLAG.PREBATTLE_INIT):
             ctx.removeFlags(FUNCTIONAL_FLAG.PREBATTLE_BITMASK)
             ctx.addFlags(FUNCTIONAL_FLAG.PREBATTLE_INIT)
             created = default.PrbInitFunctional()
     else:
         created = self._createByPrbType(ctx)
     return created
Пример #3
0
 def hasLockMode(self):
     isBS = prb_getters.isBattleSession()
     if isBS:
         isBSVehicleLockMode = bool(prb_getters.getPrebattleSettings()[PREBATTLE_SETTING_NAME.VEHICLE_LOCK_MODE])
         if isBSVehicleLockMode and self.clanLock > 0:
             return True
     return False
Пример #4
0
 def _canAddPlayers(self):
     clientPrb = prb_getters.getClientPrebattle()
     result = False
     if clientPrb is not None:
         settings = prb_getters.getPrebattleSettings(prebattle=clientPrb)
         rosters = prb_getters.getPrebattleRosters(prebattle=clientPrb)
         result, _ = limits.MaxCount().check(rosters, 1, settings.getTeamLimits(1))
     return result
Пример #5
0
 def _canAddPlayers(self):
     clientPrb = prb_getters.getClientPrebattle()
     result = False
     if clientPrb is not None:
         settings = prb_getters.getPrebattleSettings(prebattle=clientPrb)
         rosters = prb_getters.getPrebattleRosters(prebattle=clientPrb)
         result, _ = MaxCount().check(rosters, 1, settings.getTeamLimits(1))
     return result
Пример #6
0
 def _canAddPlayers(self):
     """
     Can new player be added to team according to max limit
     """
     clientPrb = prb_getters.getClientPrebattle()
     result = False
     if clientPrb is not None:
         settings = prb_getters.getPrebattleSettings(prebattle=clientPrb)
         rosters = prb_getters.getPrebattleRosters(prebattle=clientPrb)
         result, _ = MaxCount().check(rosters, 1, settings.getTeamLimits(1))
     return result
Пример #7
0
 def canAssignToTeam(self, team = 1):
     result = super(BattleSessionPrbPermissions, self).canAssignToTeam(team)
     if not result:
         return False
     else:
         clientPrb = prb_getters.getClientPrebattle()
         result = False
         if clientPrb is not None:
             settings = prb_getters.getPrebattleSettings(prebattle=clientPrb)
             rosters = prb_getters.getPrebattleRosters(prebattle=clientPrb)
             prbType = prb_getters.getPrebattleType(clientPrb, settings)
             result, _ = limits.TeamNoPlayersInBattle(prbType).check(rosters, team, settings.getTeamLimits(team))
         return result
Пример #8
0
 def canAssignToTeam(self, team = 1):
     result = super(BattleSessionPermissions, self).canAssignToTeam(team)
     if not result:
         return False
     else:
         clientPrb = prb_getters.getClientPrebattle()
         result = False
         if clientPrb is not None:
             settings = prb_getters.getPrebattleSettings(prebattle=clientPrb)
             rosters = prb_getters.getPrebattleRosters(prebattle=clientPrb)
             prbType = prb_getters.getPrebattleType(clientPrb, settings)
             result, _ = TeamNoPlayersInBattle(prbType).check(rosters, team, settings.getTeamLimits(team))
         return result
Пример #9
0
 def __createByAccountState(self, ctx):
     clientPrb = prb_getters.getClientPrebattle()
     if clientPrb is not None:
         if prb_getters.isPrebattleSettingsReceived(prebattle=clientPrb):
             prbSettings = prb_getters.getPrebattleSettings(
                 prebattle=clientPrb)
             prbType = prb_getters.getPrebattleType(settings=prbSettings)
             clazz = None
             clazz = collectLegacyEntity(prbType)
             if clazz:
                 return clazz(prbSettings)
         else:
             return LegacyInitEntity()
     return self.__createByPrbType(ctx)
Пример #10
0
 def __createByAccountState(self, ctx):
     """
     Tries to create entity by current account state.
     Args:
         ctx: creation request context.
     
     Returns:
         new prebattle legacy entity
     """
     clientPrb = prb_getters.getClientPrebattle()
     if clientPrb is not None:
         if prb_getters.isPrebattleSettingsReceived(prebattle=clientPrb):
             prbSettings = prb_getters.getPrebattleSettings(prebattle=clientPrb)
             prbType = prb_getters.getPrebattleType(settings=prbSettings)
             clazz = None
             if prbType in _SUPPORTED_ENTITY:
                 clazz = _SUPPORTED_ENTITY[prbType]
             if clazz:
                 return clazz(prbSettings)
         else:
             return LegacyInitEntity()
     return self.__createByPrbType(ctx)
Пример #11
0
 def _createByAccountState(self, ctx):
     created = None
     clientPrb = prb_getters.getClientPrebattle()
     if clientPrb is not None:
         if prb_getters.isPrebattleSettingsReceived(prebattle=clientPrb):
             prbSettings = prb_getters.getPrebattleSettings(prebattle=clientPrb)
             prbType = prb_getters.getPrebattleType(settings=prbSettings)
             clazz = None
             if prbType in _SUPPORTED_FUNCTIONAL:
                 clazz = _SUPPORTED_FUNCTIONAL[prbType]
             ctx.removeFlags(FUNCTIONAL_FLAG.PREBATTLE_BITMASK)
             ctx.addFlags(FUNCTIONAL_FLAG.PREBATTLE)
             if clazz:
                 created = clazz(prbSettings)
             else:
                 LOG_ERROR('Prebattle with given type is not supported', prbType)
                 created = not_supported.NotSupportedFunctional()
         elif not ctx.hasFlags(FUNCTIONAL_FLAG.PREBATTLE_INIT):
             ctx.removeFlags(FUNCTIONAL_FLAG.PREBATTLE_BITMASK)
             ctx.addFlags(FUNCTIONAL_FLAG.PREBATTLE_INIT)
             created = default.PrbInitFunctional()
     else:
         created = self._createByPrbType(ctx)
     return created
Пример #12
0
 def getTeamLimits(self):
     return prb_getters.getPrebattleSettings().getTeamLimits(self.getPlayerTeam())
Пример #13
0
 def getTeamLimits(self):
     return prb_getters.getPrebattleSettings().getTeamLimits(
         self.getPlayerTeam())