Example #1
0
 def __onLoadResourceIndicator(self, _):
     self.__resourceIndicator = _ResourceIndicator(self)
     self.__resourceIndicator.init()
     for pointID, point in g_ctfManager.getResourcePoints():
         if point['isPlayerCapture']:
             self.__resourceIndicator.show(pointID)
             break
Example #2
0
    def _makeData(self):
        result = []
        arenaDP = g_sessionProvider.getArenaDP()
        for pointID, point in g_ctfManager.getResourcePoints():
            pointState = point['state']
            timeLeft = ''
            amount = point['amount']
            progress = float(amount) / point['totalAmount'] * 100
            if pointState == RESOURCE_POINT_STATE.FREE:
                state = _POINTS_STATE.READY
            elif pointState == RESOURCE_POINT_STATE.COOLDOWN:
                self.__plugin.setUpdateRequired(True)
                state = _POINTS_STATE.COOLDOWN
                timeDelta = max(0, point['cooldownTime'] - BigWorld.serverTime())
                timeLeft = time_utils.getTimeLeftFormat(timeDelta)
            elif pointState == RESOURCE_POINT_STATE.CAPTURED:
                state = _CAPTURE_STATE_BY_TEAMS[arenaDP.isAllyTeam(point['team'])]
            elif pointState == RESOURCE_POINT_STATE.CAPTURED_LOCKED:
                state = _CAPTURE_FROZEN_STATE_BY_TEAMS[arenaDP.isAllyTeam(point['team'])]
            elif pointState == RESOURCE_POINT_STATE.BLOCKED:
                state = _POINTS_STATE.CONFLICT
            else:
                state = _POINTS_STATE.FREEZE
            result.append(self._makeItem(progress, state, amount, timeLeft))

        return result
Example #3
0
    def _makeData(self):
        result = []
        arenaDP = g_sessionProvider.getArenaDP()
        for pointID, point in g_ctfManager.getResourcePoints():
            pointState = point['state']
            timeLeft = ''
            amount = point['amount']
            progress = float(amount) / point['totalAmount'] * 100
            if pointState == RESOURCE_POINT_STATE.FREE:
                state = _POINTS_STATE.READY
            elif pointState == RESOURCE_POINT_STATE.COOLDOWN:
                self.__plugin.setUpdateRequired(True)
                state = _POINTS_STATE.COOLDOWN
                timeDelta = max(0, point['cooldownTime'] - BigWorld.serverTime())
                timeLeft = time_utils.getTimeLeftFormat(timeDelta)
            elif pointState == RESOURCE_POINT_STATE.CAPTURED:
                state = _CAPTURE_STATE_BY_TEAMS[arenaDP.isAllyTeam(point['team'])]
            elif pointState == RESOURCE_POINT_STATE.CAPTURED_LOCKED:
                state = _CAPTURE_FROZEN_STATE_BY_TEAMS[arenaDP.isAllyTeam(point['team'])]
            elif pointState == RESOURCE_POINT_STATE.BLOCKED:
                state = _POINTS_STATE.CONFLICT
            else:
                state = _POINTS_STATE.FREEZE
            result.append(self._makeItem(progress, state, amount, timeLeft))

        return result
Example #4
0
    def start(self):
        super(_ResourceMarkerPlugin, self).start()
        arenaDP = g_sessionProvider.getArenaDP()
        for pointID, point in g_ctfManager.getResourcePoints():
            resourcePos = point['minimapPos']
            amount = point['amount']
            pointState = point['state']
            progress = float(amount) / point['totalAmount'] * 100
            if pointState == constants.RESOURCE_POINT_STATE.FREE:
                state = _RESOURCE_STATE.READY
            elif pointState == constants.RESOURCE_POINT_STATE.COOLDOWN:
                state = _RESOURCE_STATE.COOLDOWN
            elif pointState == constants.RESOURCE_POINT_STATE.CAPTURED:
                state = _CAPTURE_STATE_BY_TEAMS[arenaDP.isAllyTeam(
                    point['team'])]
            elif pointState == constants.RESOURCE_POINT_STATE.CAPTURED_LOCKED:
                state = _CAPTURE_FROZEN_STATE_BY_TEAMS[arenaDP.isAllyTeam(
                    point['team'])]
            elif pointState == constants.RESOURCE_POINT_STATE.BLOCKED:
                state = _RESOURCE_STATE.CONFLICT
            else:
                state = _RESOURCE_STATE.FREEZE
            _, handle = self._parentObj.createStaticMarker(
                resourcePos + _MARKER_POSITION_ADJUSTMENT,
                _RESOURCE_MARKER_TYPE)
            self._parentObj.invokeMarker(handle, 'as_init',
                                         [pointID, state, progress])
            self.__markers[pointID] = (handle, None, resourcePos, state)

        return
Example #5
0
 def __onLoadResourceIndicator(self, _):
     self.__resourceIndicator = _ResourceIndicator(self)
     self.__resourceIndicator.init()
     for pointID, point in g_ctfManager.getResourcePoints():
         if point['isPlayerCapture']:
             self.__resourceIndicator.show(pointID)
             break
Example #6
0
    def start(self):
        super(ResourceMarkerPlugin, self).start()
        arenaDP = g_sessionProvider.getArenaDP()
        for pointID, point in g_ctfManager.getResourcePoints():
            resourcePos = point['minimapPos']
            amount = point['amount']
            pointState = point['state']
            progress = float(amount) / point['totalAmount'] * 100
            if pointState == constants.RESOURCE_POINT_STATE.FREE:
                state = settings.RESOURCE_STATE.READY
            elif pointState == constants.RESOURCE_POINT_STATE.COOLDOWN:
                state = settings.RESOURCE_STATE.COOLDOWN
            elif pointState == constants.RESOURCE_POINT_STATE.CAPTURED:
                state = settings.CAPTURE_STATE_BY_TEAMS[arenaDP.isAllyTeam(point['team'])]
            elif pointState == constants.RESOURCE_POINT_STATE.CAPTURED_LOCKED:
                state = settings.CAPTURE_FROZEN_STATE_BY_TEAMS[arenaDP.isAllyTeam(point['team'])]
            elif pointState == constants.RESOURCE_POINT_STATE.BLOCKED:
                state = settings.RESOURCE_STATE.CONFLICT
            else:
                state = settings.RESOURCE_STATE.FREEZE
            handle = self._createMarker(resourcePos + settings.MARKER_POSITION_ADJUSTMENT, settings.RESOURCE_MARKER_TYPE)
            self._invokeMarker(handle, 'as_init', [pointID, state, progress])
            self.__markers[pointID] = (handle,
             None,
             resourcePos,
             state)

        return
Example #7
0
    def start(self):
        super(ResourceMarkerPlugin, self).start()
        arenaDP = self.sessionProvider.getArenaDP()
        for pointID, point in g_ctfManager.getResourcePoints():
            resourcePos = point['minimapPos']
            amount = point['amount']
            pointState = point['state']
            progress = float(amount) / point['totalAmount'] * 100
            if pointState == constants.RESOURCE_POINT_STATE.FREE:
                state = settings.RESOURCE_STATE.READY
            elif pointState == constants.RESOURCE_POINT_STATE.COOLDOWN:
                state = settings.RESOURCE_STATE.COOLDOWN
            elif pointState == constants.RESOURCE_POINT_STATE.CAPTURED:
                state = settings.CAPTURE_STATE_BY_TEAMS[arenaDP.isAllyTeam(
                    point['team'])]
            elif pointState == constants.RESOURCE_POINT_STATE.CAPTURED_LOCKED:
                state = settings.CAPTURE_FROZEN_STATE_BY_TEAMS[
                    arenaDP.isAllyTeam(point['team'])]
            elif pointState == constants.RESOURCE_POINT_STATE.BLOCKED:
                state = settings.RESOURCE_STATE.CONFLICT
            else:
                state = settings.RESOURCE_STATE.FREEZE
            handle = self._createMarkerWithPosition(
                settings.MARKER_SYMBOL_NAME.RESOURCE_MARKER,
                resourcePos + settings.MARKER_POSITION_ADJUSTMENT)
            self._invokeMarker(handle, 'as_init', pointID, state, progress)
            self.__markers[pointID] = (handle, None, resourcePos, state)

        return
Example #8
0
 def start(self):
     super(ResourcePointsPlugin, self).start()
     g_ctfManager.onResPointIsFree += self.__onResPointIsFree
     g_ctfManager.onResPointCooldown += self.__onResPointCooldown
     g_ctfManager.onResPointCaptured += self.__onResPointCaptured
     g_ctfManager.onResPointCapturedLocked += self.__onResPointCapturedLocked
     g_ctfManager.onResPointBlocked += self.__onResPointBlocked
     for pointID, point in g_ctfManager.getResourcePoints():
         pointState = point['state']
         if pointState == RESOURCE_POINT_STATE.FREE:
             state = _R_STATES.READY
         elif pointState == RESOURCE_POINT_STATE.COOLDOWN:
             state = _R_STATES.COOLDOWN
         elif pointState == RESOURCE_POINT_STATE.CAPTURED:
             state = _R_STATES.OWN_MINING if self._arenaDP.isAllyTeam(point['team']) else _R_STATES.ENEMY_MINING
         else:
             state = _R_STATES.CONFLICT
         self.__addResourcePointMarker(pointID, point['minimapPos'], state)
Example #9
0
 def start(self):
     super(ResourcePointsPlugin, self).start()
     g_ctfManager.onResPointIsFree += self.__onResPointIsFree
     g_ctfManager.onResPointCooldown += self.__onResPointCooldown
     g_ctfManager.onResPointCaptured += self.__onResPointCaptured
     g_ctfManager.onResPointCapturedLocked += self.__onResPointCapturedLocked
     g_ctfManager.onResPointBlocked += self.__onResPointBlocked
     for pointID, point in g_ctfManager.getResourcePoints():
         pointState = point['state']
         if pointState == RESOURCE_POINT_STATE.FREE:
             state = _R_STATES.READY
         elif pointState == RESOURCE_POINT_STATE.COOLDOWN:
             state = _R_STATES.COOLDOWN
         elif pointState == RESOURCE_POINT_STATE.CAPTURED:
             state = _R_STATES.OWN_MINING if self._arenaDP.isAllyTeam(point['team']) else _R_STATES.ENEMY_MINING
         else:
             state = _R_STATES.CONFLICT
         self.__addResourcePointMarker(pointID, point['minimapPos'], state)