Ejemplo n.º 1
0
 def unit_onUnitFlagsChanged(self, prevFlags, nextFlags):
     _, unit = self.getUnit(safe=False)
     isReady = unit.arePlayersReady(ignored=[settings.CREATOR_SLOT_INDEX])
     flags = unit_items.UnitFlags(nextFlags, prevFlags, isReady)
     isInQueue = flags.isInQueue()
     if isInQueue:
         matchmakerNextTick = self.__doClockworkLogic(returnMatchmakerNextTick=True)
         if matchmakerNextTick is not None:
             unit.setModalTimestamp(matchmakerNextTick)
     if flags.isInQueueChanged() and self.isCommander() and not isInQueue:
         self.requestSlotVehicleFilters()
     regularBattleEnd = flags.isArenaFinishedChanged() and flags.isArenaFinished() and flags.isExternalLocked()
     wgshBattleEnd = flags.isExternalLockedStateChanged() and not flags.isExternalLocked()
     if regularBattleEnd or wgshBattleEnd:
         LOG_DEBUG('force wgsh request on end of battle (r,x):', regularBattleEnd, wgshBattleEnd)
         self.__strongholdSettings.forceCleanData()
         self.requestUpdateStronghold()
         self.requestSlotVehicleFilters()
     if flags.isExternalLegionariesMatchingChanged():
         self.__onExternalLegionariesMatchingToggle(flags.isInExternalLegionariesMatching())
     super(StrongholdEntity, self).unit_onUnitFlagsChanged(prevFlags, nextFlags)
     self.__doClockworkLogic(invokeListeners=True, forceUpdateBuildings=True)
     if not self.hasLockedState():
         self.resetCoolDown(settings.REQUEST_TYPE.BATTLE_QUEUE)
         self.resetCoolDown(settings.REQUEST_TYPE.DECLINE_SEARCH)
         self.resetCoolDown(settings.REQUEST_TYPE.AUTO_SEARCH)
     if isInQueue:
         self._invokeListeners('onCommanderIsReady', True)
     elif prevFlags != nextFlags and nextFlags == 0:
         self._invokeListeners('onCommanderIsReady', False)
     if self.canShowStrongholdsBattleQueue():
         g_eventDispatcher.showStrongholdsBattleQueue()
     return
Ejemplo n.º 2
0
 def unit_onUnitFlagsChanged(self, prevFlags, nextFlags):
     unitIdx, unit = self.getUnit()
     isReady = unit.arePlayersReady(ignored=[settings.CREATOR_SLOT_INDEX])
     flags = unit_items.UnitFlags(nextFlags, prevFlags, isReady)
     isInQueue = flags.isInQueue()
     if isInQueue:
         matchmakerNextTick = self.__doClockworkLogic(self.CWL_RETURN_MATCHMAKER_NEXT_TICK)
         if matchmakerNextTick is not None:
             unit.setModalTimestamp(matchmakerNextTick)
     regularBattleEnd = flags.isArenaFinishedChanged() and flags.isArenaFinished() and flags.isExternalLocked()
     wgshBattleEnd = flags.isExternalLockedStateChanged() and not flags.isExternalLocked()
     if regularBattleEnd or wgshBattleEnd:
         LOG_DEBUG('force wgsh request on end of battle (r,x):', regularBattleEnd, wgshBattleEnd)
         self.__strongholdSettings.forceCleanData()
         self.requestUpdateStronghold()
     super(StrongholdEntity, self).unit_onUnitFlagsChanged(prevFlags, nextFlags)
     self.__doClockworkLogic(self.CWL_INVOKE_LISTENERS | self.CWL_FORCE_UPDATE_BUILDINGS)
     if not self.hasLockedState():
         self.resetCoolDown(settings.REQUEST_TYPE.BATTLE_QUEUE)
         self.resetCoolDown(settings.REQUEST_TYPE.DECLINE_SEARCH)
         self.resetCoolDown(settings.REQUEST_TYPE.AUTO_SEARCH)
     if isInQueue:
         self._invokeListeners('onCommanderIsReady', True)
     elif prevFlags != nextFlags and nextFlags == 0:
         self._invokeListeners('onCommanderIsReady', False)
     return
Ejemplo n.º 3
0
 def unit_onUnitFlagsChanged(self, prevFlags, nextFlags):
     _, unit = self.getUnit(safe=False)
     isReady = unit.arePlayersReady(ignored=[settings.CREATOR_SLOT_INDEX])
     flags = unit_items.UnitFlags(nextFlags, prevFlags, isReady)
     isInQueue = flags.isInQueue()
     if flags.isInQueueChanged() and self.isCommander() and not isInQueue:
         self.requestSlotVehicleFilters()
     regularBattleEnd = flags.isArenaFinishedChanged(
     ) and flags.isArenaFinished() and flags.isExternalLocked()
     wgshBattleEnd = flags.isExternalLockedStateChanged(
     ) and not flags.isExternalLocked()
     if regularBattleEnd or wgshBattleEnd:
         _logger.debug('force wgsh request on end of battle (r,x): %s, %s',
                       str(regularBattleEnd), str(wgshBattleEnd))
         self.requestUpdateTournament()
         self.requestSlotVehicleFilters()
     if flags.isExternalLegionariesMatchingChanged():
         self.__onExternalLegionariesMatchingToggle(
             flags.isInExternalLegionariesMatching())
     super(TournamentEntity,
           self).unit_onUnitFlagsChanged(prevFlags, nextFlags)
     if not self.hasLockedState():
         self.resetCoolDown(settings.REQUEST_TYPE.BATTLE_QUEUE)
         self.resetCoolDown(settings.REQUEST_TYPE.DECLINE_SEARCH)
         self.resetCoolDown(settings.REQUEST_TYPE.AUTO_SEARCH)
     if isInQueue:
         self._invokeListeners('onCommanderIsReady', True)
     elif prevFlags != nextFlags and nextFlags == 0:
         self._invokeListeners('onCommanderIsReady', False)
Ejemplo n.º 4
0
 def getFlags(self, unitIdx=None):
     return unit_items.UnitFlags(0)