Ejemplo n.º 1
0
    def updateMarker(self, vID, targets):
        #trace('updateMarker: {0} {1}'.format(targets, vID))

        if self.vmmFlashObject is None:
            return

        player = BigWorld.player()
        arena = player.arena
        arenaVehicle = arena.vehicles.get(vID, None)
        if arenaVehicle is None:
            return

        stat = arena.statistics.get(vID, None)
        if stat is None:
            return

        vehicle = BigWorld.entity(vID)
        if vehicle is None or not hasattr(vehicle, 'marker'):
            return

        isAlive = arenaVehicle['isAlive']
        isAvatarReady = arenaVehicle['isAvatarReady']
        status = VEHICLE_STATUS.NOT_AVAILABLE
        if isAlive is not None and isAvatarReady is not None:
            if isAlive:
                status |= VEHICLE_STATUS.IS_ALIVE
            if isAvatarReady:
                status |= VEHICLE_STATUS.IS_READY

        frags = stat['frags']

        my_frags = 0
        stat = arena.statistics.get(player.playerVehicleID, None)
        if stat is not None:
            my_frags = stat['frags']

        vInfo = utils.getVehicleInfo(vID)
        squadIndex = vInfo.squadIndex
        arenaDP = g_sessionProvider.getCtx().getArenaDP()
        squadIndex = vInfo.squadIndex
        if arenaDP.isSquadMan(vID):
            squadIndex += 10

        #debug('updateMarker: {0} st={1} fr={2} sq={3}'.format(vID, status, frags, squadIndex))
        self.vmmFlashObject.invokeMarker(vehicle.marker, 'setMarkerStateXvm', [targets, status, frags, my_frags, squadIndex])
Ejemplo n.º 2
0
 def extendVehicleMarkerArgs(self, handle, function, args):
     try:
         if function == 'init':
             if len(args) > 5:
                 #debug('extendVehicleMarkerArgs: %i %s' % (handle, function))
                 v = utils.getVehicleByName(args[5])
                 if hasattr(v, 'publicInfo'):
                     vInfo = utils.getVehicleInfo(v.id)
                     vStats = utils.getVehicleStats(v.id)
                     args.extend([
                         vInfo.player.accountDBID,
                         vInfo.vehicleType.compactDescr,
                         v.publicInfo.marksOnGun,
                         vInfo.vehicleStatus,
                         vStats.frags,
                         vInfo.squadIndex,
                     ])
         elif function not in ['showExInfo']:
             # debug('extendVehicleMarkerArgs: %i %s %s' % (handle, function, str(args)))
             pass
     except Exception, ex:
         err('extendVehicleMarkerArgs(): ' + traceback.format_exc())