예제 #1
0
 def _getFortBattleTimer(self):
     if self.fortState.getStateID() == CLIENT_FORT_STATE.HAS_FORT:
         fortBattle = self.fortCtrl.getFort().getBattle(
             prb_getters.getBattleID())
         if fortBattle is not None:
             return fortBattle.getRoundStartTimeLeft()
     return 0
예제 #2
0
 def __initData(self):
     fort = self.fortCtrl.getFort()
     self.__battleID = prb_getters.getBattleID()
     self.__battle = fort.getBattle(self.__battleID)
     if self.__battleID is None:
         LOG_ERROR('Initialization Error! battle ID must not be None!')
     self.__allBuildings = self.__battle.getAllBuildList()
     if self.__allBuildings:
         self.__prevBuilding = self.__allBuildings[self.__battle.getPrevBuildNum()]
         self.__currentBuilding = self.__allBuildings[self.__battle.getCurrentBuildNum()]
     return
예제 #3
0
 def __initData(self):
     fort = self.fortCtrl.getFort()
     self.__battleID = prb_getters.getBattleID()
     self.__battle = fort.getBattle(self.__battleID)
     if self.__battleID is None:
         LOG_ERROR('Initialization Error! battle ID must not be None!')
     self.__allBuildings = self.__battle.getAllBuildList()
     if self.__allBuildings:
         self.__prevBuilding = self.__allBuildings[self.__battle.getPrevBuildNum()]
         self.__currentBuilding = self.__allBuildings[self.__battle.getCurrentBuildNum()]
     self.__makeData()
     return
 def requestToJoin(self, battleID):
     currentBattleID = getBattleID()
     if currentBattleID == battleID and self.prbDispatcher.getUnitFunctional().hasEntity():
         fort_events.showFortBattleRoomWindow()
     else:
         battle = self.fortCtrl.getFort().getBattle(battleID)
         if battle is not None:
             fort_helpers.tryToConnectFortBattle(battleID, battle.getPeripheryID())
         else:
             SystemMessages.pushI18nMessage(SYSTEM_MESSAGES.FORTIFICATION_ERRORS_BATTLE_DOES_NOT_EXIST, type=SystemMessages.SM_TYPE.Error)
     self.destroy()
     return
 def requestToJoin(self, battleID):
     currentBattleID = getBattleID()
     if currentBattleID == battleID and self.prbDispatcher.getFunctionalState(
     ).isInUnit(PREBATTLE_TYPE.FORT_BATTLE):
         fort_events.showFortBattleRoomWindow()
     else:
         battle = self.fortCtrl.getFort().getBattle(battleID)
         if battle is not None:
             fort_helpers.tryToConnectFortBattle(battleID,
                                                 battle.getPeripheryID())
         else:
             SystemMessages.pushI18nMessage(
                 SYSTEM_MESSAGES.FORTIFICATION_ERRORS_BATTLE_DOES_NOT_EXIST,
                 type=SystemMessages.SM_TYPE.Error)
     self.destroy()
     return
예제 #6
0
 def handleAction(self, model, entityID, action):
     super(AcceptPrbFortInviteHandler, self).handleAction(model, entityID, action)
     notification = model.collection.getItem(NOTIFICATION_TYPE.MESSAGE, entityID)
     if not notification:
         LOG_ERROR('Notification not found', NOTIFICATION_TYPE.MESSAGE, entityID)
         return
     else:
         customData = notification.getSavedData()
         battleID = customData.get('battleID')
         peripheryID = customData.get('peripheryID')
         if battleID is not None and peripheryID is not None:
             if battleID == getBattleID():
                 fort_events.showFortBattleRoomWindow()
             else:
                 fort_helpers.tryToConnectFortBattle(battleID, peripheryID)
         else:
             LOG_ERROR('Invalid fort battle data', battleID, peripheryID)
         return
예제 #7
0
 def handleAction(self, model, entityID, action):
     super(AcceptPrbFortInviteHandler, self).handleAction(model, entityID, action)
     notification = model.collection.getItem(NOTIFICATION_TYPE.MESSAGE, entityID)
     if not notification:
         LOG_ERROR('Notification not found', NOTIFICATION_TYPE.MESSAGE, entityID)
         return
     else:
         customData = notification.getSavedData()
         battleID = customData.get('battleID')
         peripheryID = customData.get('peripheryID')
         if battleID is not None and peripheryID is not None:
             if battleID == getBattleID():
                 fort_events.showFortBattleRoomWindow()
             else:
                 fort_helpers.tryToConnectFortBattle(battleID, peripheryID)
         else:
             LOG_ERROR('Invalid fort battle data', battleID, peripheryID)
         return
예제 #8
0
 def onFortBattleChanged(self, cache, item, battleItem):
     if prb_getters.getBattleID() == battleItem.getID():
         self.startNotification()
예제 #9
0
 def _getFortBattleTimer(self):
     if self.fortState.getStateID() == CLIENT_FORT_STATE.HAS_FORT:
         fortBattle = self.fortCtrl.getFort().getBattle(prb_getters.getBattleID())
         if fortBattle is not None:
             return fortBattle.getRoundStartTimeLeft()
     return 0
예제 #10
0
 def onFortBattleChanged(self, cache, item, battleItem):
     if prb_getters.getBattleID() == battleItem.getID():
         self.startNotification()