Esempio n. 1
0
    def updateBattle(self, vID, targets):
        #trace('updateBattle: {0} {1}'.format(targets, vID))

        if self.battleFlashObject is None:
            return

        player = BigWorld.player()
        if player is None or not hasattr(player, 'arena') or player.arena is None:
            return

        state = vehstate.getVehicleStateData(vID)
        if state is None:
            return

        movie = self.battleFlashObject.movie
        if movie is None:
            return

        #debug('updateBattle: {0} {1}'.format(vID, set(state.iteritems())))
        movie.invoke((AS2RESPOND.BATTLE_STATE,
                      targets,
                      state['playerName'],
                      state['playerId'],
                      state['vId'],
                      state['dead'],
                      state['curHealth'],
                      state['maxHealth'],
                      state['marksOnGun'],
                      state['spotted'],
        ))
Esempio n. 2
0
 def updateBattleState(self, vehicle):
     #log(vehicle)
     # TODO: enable/disable in config for performance?
     if self.battleFlashObject is not None:
         try:
             movie = self.battleFlashObject.movie
             if movie is not None:
                 movie.invoke((RESPOND_BATTLESTATE, [json.dumps(getVehicleStateData(vehicle))]))
         except Exception, ex:
             err('updateBattleState(): ' + traceback.format_exc())