예제 #1
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
예제 #2
0
 def init(self, clientPrb = None, ctx = None):
     if clientPrb is None:
         clientPrb = prb_getters.getClientPrebattle()
     if clientPrb is not None:
         clientPrb.onSettingsReceived += self.prb_onSettingsReceived
         clientPrb.onRosterReceived += self.prb_onRosterReceived
         if prb_getters.isPrebattleSettingsReceived(prebattle=clientPrb):
             self.prb_onSettingsReceived()
         if prb_getters.getPrebattleRosters(prebattle=clientPrb):
             self.prb_onRosterReceived()
     return FUNCTIONAL_FLAG.UNDEFINED
 def init(self, clientPrb=None, ctx=None):
     result = super(LegacyInitEntity, self).init(clientPrb=clientPrb, ctx=ctx)
     if clientPrb is None:
         clientPrb = prb_getters.getClientPrebattle()
     if clientPrb is not None:
         clientPrb.onSettingsReceived += self.prb_onSettingsReceived
         clientPrb.onRosterReceived += self.prb_onRosterReceived
         if prb_getters.isPrebattleSettingsReceived(prebattle=clientPrb):
             self.prb_onSettingsReceived()
         if prb_getters.getPrebattleRosters(prebattle=clientPrb):
             self.prb_onRosterReceived()
     return result
예제 #4
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)
예제 #5
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)
예제 #6
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