예제 #1
0
 def updateData(self):
     player = BigWorld.player()
     self.data['dmg-ratio'] = self.data['dmg'] * 100 // self.maxHealth
     if self.data['attackerID'] != 0:
         attacker = player.arena.vehicles.get(self.data['attackerID'])
         entity = BigWorld.entity(self.data['attackerID'])
         statXVM = _stat.players.get(self.data['attackerID'])
         self.data['team-dmg'] = 'do_not_know'
         if attacker['team'] != player.team:
             self.data['team-dmg'] = 'enemy-dmg'
         elif attacker['name'] == player.name:
             self.data['team-dmg'] = 'player'
         else:
             self.data['team-dmg'] = 'ally-dmg'
         self.data['typeDescriptor'] = attacker['vehicleType']
         self.data['vehCD'] = attacker['vehicleType'].type.compactDescr
         self.data['attackerVehicleType'] = list(
             attacker['vehicleType'].type.tags.intersection(
                 VEHICLE_CLASSES))[0].lower()
         self.data['shortUserString'] = self.data[
             'typeDescriptor'].type.shortUserString
         self.data['name'] = attacker['name']
         self.data['clanAbbrev'] = attacker['clanAbbrev']
         self.data['level'] = self.data['typeDescriptor'].level
         self.data['clanicon'] = _stat.getClanIcon(self.data['attackerID'])
         if (statXVM is not None) and (statXVM.squadnum > 0):
             self.data['squadnum'] = statXVM.squadnum
         else:
             self.data['squadnum'] = ''
         if entity is not None:
             self.data['marksOnGun'] = '_' + str(
                 entity.publicInfo['marksOnGun'])
         else:
             self.data['marksOnGun'] = ''
     else:
         self.data['team-dmg'] = 'do_not_know'
         self.data['typeDescriptor'] = None
         self.data['vehCD'] = None
         self.data['attackerVehicleType'] = ''
         self.data['shortUserString'] = ''
         self.data['name'] = ''
         self.data['clanAbbrev'] = ''
         self.data['level'] = ''
         self.data['clanicon'] = ''
         self.data['squadnum'] = ''
         self.data['marksOnGun'] = ''
     self.updateMacros()
예제 #2
0
 def updateData(self):
     maxHealth = self.vehHealth[
         self.
         vehicleID]['maxHealth'] if self.vehicleID in self.vehHealth else 0
     self.data['dmgRatio'] = self.data[
         'damage'] * 100 // maxHealth if maxHealth != 0 else 0
     if self.vehicleID:
         attacked = self.player.arena.vehicles.get(self.vehicleID)
         if attacked is not None:
             vehicleType = attacked['vehicleType']
             self.data['name'] = attacked['name']
             self.data['clanAbbrev'] = attacked['clanAbbrev']
             if vehicleType:
                 _type = vehicleType.type
                 self.data['attackedVehicleType'] = list(
                     _type.tags.intersection(VEHICLE_CLASSES))[0]
                 self.data[
                     'attackerVehicleName'] = vehicleType.name.replace(
                         ':', '-', 1) if vehicleType.name else ''
                 self.data['shortUserString'] = _type.shortUserString
                 self.data['level'] = vehicleType.level
                 self.data['nation'] = nations.NAMES[
                     _type.customizationNationID]
                 if self.data['attackReasonID'] == 2:
                     self.data['diff-masses'] = (
                         self.player.vehicleTypeDescriptor.physics['weight']
                         - vehicleType.physics['weight']) / 1000.0
             self.setRatings()
         elif not self.isVehicle:
             self.data['shortUserString'] = l10n(PILLBOX).format(
                 self.entityNumber)
             self.compName = None
             self.criticalHit = None
         self.data['clanicon'] = _stat.getClanIcon(self.vehicleID)
         arenaDP = self.guiSessionProvider.getArenaDP()
         if arenaDP is not None:
             vInfo = arenaDP.getVehicleInfo(vID=self.vehicleID)
             self.data[
                 'squadnum'] = vInfo.squadIndex if vInfo.squadIndex != 0 else None
             self.data['teamDmg'] = self.getTeamDmg(vInfo)
     self.data['splashHit'] = self.splashHit
     self.data['criticalHit'] = self.criticalHit
     self.data['compName'] = self.compName
     self.data['battletype-key'] = self.battletypeKey
     self.updateLabels()
예제 #3
0
 def updateData(self):
     player = BigWorld.player()
     self.data['dmgRatio'] = self.data['damage'] * 100 // self.data['maxHealth']
     if self.data['attackerID']:
         attacker = player.arena.vehicles.get(self.data['attackerID'])
         entity = BigWorld.entity(self.data['attackerID'])
         statXVM = _stat.players.get(self.data['attackerID'], None)
         self.data['teamDmg'] = 'unknown'
         if attacker is not None:
             if attacker['team'] != player.team:
                 self.data['teamDmg'] = 'enemy-dmg'
             elif attacker['name'] == player.name:
                 self.data['teamDmg'] = 'player'
             else:
                 self.data['teamDmg'] = 'ally-dmg'
             if attacker['vehicleType']:
                 self.data['attackerVehicleType'] = list(attacker['vehicleType'].type.tags.intersection(VEHICLE_CLASSES))[0].lower()
                 self.data['shortUserString'] = attacker['vehicleType'].type.shortUserString
                 self.data['level'] = attacker['vehicleType'].level
             else:
                 self.data['attackerVehicleType'] = ''
                 self.data['shortUserString'] = ''
                 self.data['level'] = ''
             self.data['name'] = attacker['name']
             self.data['clanAbbrev'] = attacker['clanAbbrev']
         self.data['clanicon'] = _stat.getClanIcon(self.data['attackerID'])
         if statXVM is not None:
             self.data['squadnum'] = statXVM.squadnum
         self.data['marksOnGun'] = '_' + str(entity.publicInfo['marksOnGun']) if entity is not None else ''
     else:
         self.data['teamDmg'] = 'unknown'
         self.data['attackerVehicleType'] = ''
         self.data['shortUserString'] = ''
         self.data['name'] = ''
         self.data['clanAbbrev'] = ''
         self.data['level'] = ''
         self.data['clanicon'] = ''
         self.data['squadnum'] = ''
         self.data['marksOnGun'] = ''
예제 #4
0
 def updateData(self):
     if self.bootcampController.isInBootcamp():
         return
     player = BigWorld.player()
     self.data['dmgRatio'] = self.data['damage'] * 100 // self.data['maxHealth']
     attackerID = self.data['attackerID']
     minutes, seconds = divmod(int(self.sessionProvider.shared.arenaPeriod.getEndTime() - BigWorld.serverTime()), 60)
     self.data['hitTime'] = '{:02d}:{:02d}'.format(minutes, seconds)
     if attackerID:
         self.data['teamDmg'] = 'unknown'
         attacker = player.arena.vehicles.get(attackerID)
         if attacker is not None:
             if attacker['team'] != player.team:
                 self.data['teamDmg'] = 'enemy-dmg'
             elif attacker['name'] == player.name:
                 self.data['teamDmg'] = 'player'
             else:
                 self.data['teamDmg'] = 'ally-dmg'
             vehicleType = attacker['vehicleType']
             if vehicleType:
                 _type = vehicleType.type
                 self.data['attackerVehicleType'] = list(_type.tags.intersection(VEHICLE_CLASSES))[0].lower()
                 self.data['shortUserString'] = _type.shortUserString
                 self.data['level'] = vehicleType.level
                 self.data['nation'] = nations.NAMES[_type.customizationNationID]
                 if self.data['attackReasonID'] == 2:
                     self.data['diff-masses'] = (player.vehicleTypeDescriptor.physics['weight'] - vehicleType.physics['weight']) / 1000.0
                 elif self.data['diff-masses'] is not None:
                     self.data['diff-masses'] = None
             else:
                 self.data['attackerVehicleType'] = 'not_vehicle'
                 self.data['shortUserString'] = None
                 self.data['level'] = None
                 self.data['nation'] = None
                 self.data['diff-masses'] = None
             self.data['name'] = attacker['name']
             if (_stat.resp is not None) and (attacker['name'] in _stat.resp['players']):
                 stats = _stat.resp['players'][attacker['name']]
                 self.data['wn8'] = stats.get('wn8', None)
                 self.data['xwn8'] = stats.get('xwn8', None)
                 self.data['wtr'] = stats.get('wtr', None)
                 self.data['xwtr'] = stats.get('xwtr', None)
                 self.data['eff'] = stats.get('eff', None)
                 self.data['xeff'] = stats.get('xeff', None)
                 self.data['wgr'] = stats.get('wgr', None)
                 self.data['xwgr'] = stats.get('xwgr', None)
                 self.data['xte'] = stats.get('v').get('xte', None)
             else:
                 self.data['wn8'] = None
                 self.data['xwn8'] = None
                 self.data['wtr'] = None
                 self.data['xwtr'] = None
                 self.data['eff'] = None
                 self.data['xeff'] = None
                 self.data['wgr'] = None
                 self.data['xwgr'] = None
                 self.data['xte'] = None
             self.data['clanAbbrev'] = attacker['clanAbbrev']
         self.data['clanicon'] = _stat.getClanIcon(attackerID)
         self.data['squadnum'] = None
         arenaDP = self.sessionProvider.getArenaDP()
         if arenaDP is not None:
             vInfo = arenaDP.getVehicleInfo(vID=attackerID)
             self.data['squadnum'] = vInfo.squadIndex if vInfo.squadIndex != 0 else None
     else:
         self.data['teamDmg'] = 'unknown'
         self.data['attackerVehicleType'] = 'not_vehicle'
         self.data['shortUserString'] = ''
         self.data['name'] = ''
         self.data['clanAbbrev'] = ''
         self.data['level'] = None
         self.data['clanicon'] = None
         self.data['squadnum'] = None
     self.updateLabels()
예제 #5
0
 def updateData(self):
     player = BigWorld.player()
     self.data['dmgRatio'] = self.data['damage'] * 100 // self.data['maxHealth']
     attackerID = self.data['attackerID']
     if attackerID:
         entity = BigWorld.entity(attackerID)
         self.data['marksOnGun'] = '_' + str(entity.publicInfo['marksOnGun']) if (entity is not None) else None
         self.data['teamDmg'] = 'unknown'
         attacker = player.arena.vehicles.get(attackerID)
         if attacker is not None:
             if attacker['team'] != player.team:
                 self.data['teamDmg'] = 'enemy-dmg'
             elif attacker['name'] == player.name:
                 self.data['teamDmg'] = 'player'
             else:
                 self.data['teamDmg'] = 'ally-dmg'
             vehicleType = attacker['vehicleType']
             if vehicleType:
                 _type = vehicleType.type
                 self.data['attackerVehicleType'] = list(_type.tags.intersection(VEHICLE_CLASSES))[0].lower()
                 self.data['shortUserString'] = _type.shortUserString
                 self.data['level'] = vehicleType.level
                 self.data['nation'] = nations.NAMES[_type.customizationNationID]
                 if self.data['attackReasonID'] == 2:
                     self.data['diff-masses'] = (player.vehicleTypeDescriptor.physics['weight'] - vehicleType.physics['weight']) / 1000.0
                 elif self.data['diff-masses'] is not None:
                     self.data['diff-masses'] = None
             else:
                 self.data['attackerVehicleType'] = 'not_vehicle'
                 self.data['shortUserString'] = None
                 self.data['level'] = None
                 self.data['nation'] = None
                 self.data['diff-masses'] = None
             self.data['name'] = attacker['name']
             if (_stat.resp is not None) and (attacker['name'] in _stat.resp['players']):
                 stats = _stat.resp['players'][attacker['name']]
                 self.data['wn8'] = stats.get('wn8', None)
                 self.data['xwn8'] = stats.get('xwn8', None)
                 self.data['wn6'] = stats.get('wn6', None)
                 self.data['xwn6'] = stats.get('xwn6', None)
                 self.data['eff'] = stats.get('e', None)
                 self.data['xeff'] = stats.get('xeff', None)
                 self.data['wgr'] = stats.get('wgr', None)
                 self.data['xwgr'] = stats.get('xwgr', None)
                 self.data['xte'] = stats.get('v').get('xte', None)
             else:
                 self.data['wn8'] = None
                 self.data['xwn8'] = None
                 self.data['wn6'] = None
                 self.data['xwn6'] = None
                 self.data['eff'] = None
                 self.data['xeff'] = None
                 self.data['wgr'] = None
                 self.data['xwgr'] = None
                 self.data['xte'] = None
             self.data['clanAbbrev'] = attacker['clanAbbrev']
         self.data['clanicon'] = _stat.getClanIcon(attackerID)
         statXVM = _stat.players.get(attackerID, None)
         self.data['squadnum'] = statXVM.squadnum if statXVM is not None else None
     else:
         self.data['teamDmg'] = 'unknown'
         self.data['attackerVehicleType'] = 'not_vehicle'
         self.data['shortUserString'] = ''
         self.data['name'] = ''
         self.data['clanAbbrev'] = ''
         self.data['level'] = None
         self.data['clanicon'] = None
         self.data['squadnum'] = None
         self.data['marksOnGun'] = None
     self.updateLabels()
    def updateData(self):
        # player = BigWorld.player()
        vehicleID = self.vehId
        self.data['vehicleID'] = vehicleID
        self.data['assistType'] = self.ribbonType
        curVehicle = self.vehicles[vehicleID]
        pl = _stat.players.get(vehicleID, None)
        self.data['assist'] = curVehicle[self.ribbonType]['value']
        # self.data['sumAssist'] = curVehicle[self.ribbonType]['sum']
        # for assistType in curVehicle:
        #     log('assistType = %s' % assistType)
        listDamage = [assistType.get('sum', 0) for assistType in curVehicle.itervalues()]
        self.data['sumAssist'] = reduce(lambda x, y: x + y, listDamage, 0)
        self.data['count'] = curVehicle[self.ribbonType]['count']
        listCount = [assistType.get('count', 0) for assistType in curVehicle.itervalues()]
        self.data['sumCount'] = reduce(lambda x, y: x + y, listCount, 0)
        self.data['totalCount'] += self.data['sumCount']
        # pl = ('vehicleID', 'accountDBID', 'name', 'clan', 'clanInfo', 'badgeId', 'team', 'vehCD', 'vLevel', 'maxHealth', 'vIcon', 'vn', 'vType', 'alive', 'ready', 'x_emblem', 'x_emblem_loading', 'clanicon')

        if pl is not None:
            self.data['assistRatio'] = self.data['assist'] * 100 // pl.maxHealth if pl.maxHealth > 0 else 0
            self.data['sumAssistRatio'] = self.data['sumAssist'] * 100 // pl.maxHealth if pl.maxHealth > 0 else 0
        else:
            self.data['assistRatio'] = 0
            self.data['sumAssistRatio'] = 0

        if ASSIST_TRACK in curVehicle:
            self.data['assistTrack'] = curVehicle[ASSIST_TRACK]['value']
            self.data['sumAssistTrack'] = curVehicle[ASSIST_TRACK]['sum']
            self.data['countTrack'] = curVehicle[ASSIST_TRACK]['count']
            if pl is not None:
                self.data['assistTrackRatio'] = self.data['assistTrack'] * 100 // pl.maxHealth if pl.maxHealth > 0 else 0
                self.data['sumAssistTrackRatio'] = self.data['sumAssistTrack'] * 100 // pl.maxHealth if pl.maxHealth > 0 else 0
            else:
                self.data['assistTrackRatio'] = 0
                self.data['sumAssistTrackRatio'] = 0
        else:
            self.data['assistTrack'] = 0
            self.data['sumAssistTrack'] = 0
            self.data['countTrack'] = 0
            self.data['assistTrackRatio'] = 0
            self.data['sumAssistTrackRatio'] = 0

        if ASSIST_SPOT in curVehicle:
            self.data['assistSpot'] = curVehicle[ASSIST_SPOT]['value']
            self.data['sumAssistSpot'] = curVehicle[ASSIST_SPOT]['sum']
            self.data['countSpot'] = curVehicle[ASSIST_SPOT]['count']
            if pl is not None:
                self.data['assistSpotRatio'] = self.data['assistSpot'] * 100 // pl.maxHealth if pl.maxHealth > 0 else 0
                self.data['sumAssistSpotRatio'] = self.data['sumAssistSpot'] * 100 // pl.maxHealth if pl.maxHealth > 0 else 0
            else:
                self.data['assistSpotRatio'] = 0
                self.data['sumAssistSpotRatio'] = 0
        else:
            self.data['assistSpot'] = 0
            self.data['sumAssistSpot'] = 0
            self.data['countSpot'] = 0
            self.data['assistSpotRatio'] = 0
            self.data['sumAssistSpotRatio'] = 0

        if STUN in curVehicle:
            self.data['assistStun'] = curVehicle[STUN]['value']
            self.data['sumAssistStun'] = curVehicle[STUN]['sum']
            self.data['countStun'] = curVehicle[STUN]['count']
            if pl is not None:
                self.data['assistStunRatio'] = self.data['assistStun'] * 100 // pl.maxHealth if pl.maxHealth > 0 else 0
                self.data['sumAssistStunRatio'] = self.data['sumAssistStun'] * 100 // pl.maxHealth if pl.maxHealth > 0 else 0
            else:
                self.data['assistStunRatio'] = 0
                self.data['sumAssistStunRatio'] = 0
        else:
            self.data['assistStun'] = 0
            self.data['sumAssistStun'] = 0
            self.data['countStun'] = 0
            self.data['assistStunRatio'] = 0
            self.data['sumAssistStunRatio'] = 0

        if vehicleID:
            # entity = BigWorld.entity(vehicleID)
            # self.data['marksOnGun'] = '_' + str(entity.publicInfo['marksOnGun']) if (entity is not None) else None
            attacked = self.player.arena.vehicles.get(vehicleID)
            # attacked = {'forbidInBattleInvitations': False, 'vehicleType': <items.vehicles.VehicleDescriptor object at 0x2F88D430>, 'isAlive': True, 'name': 'DeFo1', 'igrType': 0, 'prebattleID': 0, 'potapovQuestIDs': [], 'accountDBID': 1356443, 'isPrebattleCreator': False, 'clanAbbrev': 'M3X1C', 'ranked': ((0, 0), []), 'isAvatarReady': True, 'team': 2, 'clanDBID': 222563, 'events': {}, 'isTeamKiller': False, 'crewGroup': 0}
            if attacked is not None:
                vehicleType = attacked['vehicleType']
                self.data['isAlive'] = attacked['isAlive']
                # vehicleType = ['_VehicleDescriptor__activeGunShotIdx', '_VehicleDescriptor__activeTurretPos', '_VehicleDescriptor__computeWeight', '_VehicleDescriptor__getChassisEffectNames', '_VehicleDescriptor__getIsHullAimingAvailable', '_VehicleDescriptor__get_boundingRadius', '_VehicleDescriptor__haveIncompatibleOptionalDevices', '_VehicleDescriptor__hornID', '_VehicleDescriptor__initFromCompactDescr', '_VehicleDescriptor__installGun', '_VehicleDescriptor__selectBestHull', '_VehicleDescriptor__selectTurretForGun', '_VehicleDescriptor__setHullAndCall', '_VehicleDescriptor__set_activeGunShotIndex', '_VehicleDescriptor__set_activeTurretPos', '_VehicleDescriptor__set_hornID', '_VehicleDescriptor__updateAttributes', 'activeGunShotIndex', 'activeTurretPosition', 'boundingRadius', 'camouflages', 'chassis', 'computeBaseInvisibility', 'engine', 'extras', 'extrasDict', 'fuelTank', 'getComponentsByType', 'getCost', 'getDevices', 'getHitTesters', 'getMaxRepairCost', 'gun', 'hasSiegeMode', 'hornID', 'hull', 'installComponent', 'installOptionalDevice', 'installTurret', 'isHullAimingAvailable', 'isPitchHullAimingAvailable', 'isYawHullAimingAvailable', 'keepPrereqs', 'level', 'makeCompactDescr', 'maxHealth', 'mayInstallComponent', 'mayInstallOptionalDevice', 'mayInstallTurret', 'mayRemoveOptionalDevice', 'miscAttrs', 'name', 'onSiegeStateChanged', 'optionalDevices', 'physics', 'playerEmblems', 'playerInscriptions', 'prerequisites', 'radio', 'removeOptionalDevice', 'setCamouflage', 'setPlayerEmblem', 'setPlayerInscription', 'shot', 'turret', 'turrets', 'type']
                if vehicleType:
                    _type = vehicleType.type
                    self.data['attackedVehicleType'] = list(_type.tags.intersection(VEHICLE_CLASSES))[0].lower()
                    self.data['shortUserString'] = _type.shortUserString
                    self.data['level'] = vehicleType.level
                    self.data['nation'] = nations.NAMES[_type.customizationNationID]
                else:
                    self.data['attackedVehicleType'] = None
                    self.data['shortUserString'] = None
                    self.data['level'] = None
                    self.data['nation'] = None
                self.data['name'] = attacked['name']
                if (_stat.resp is not None) and (attacked['name'] in _stat.resp['players']):
                    stats = _stat.resp['players'][attacked['name']]
                    self.data['wn8'] = stats.get('wn8', None)
                    self.data['xwn8'] = stats.get('xwn8', None)
                    self.data['wtr'] = stats.get('wtr', None)
                    self.data['xwtr'] = stats.get('xwtr', None)
                    self.data['eff'] = stats.get('e', None)
                    self.data['xeff'] = stats.get('xeff', None)
                    self.data['wgr'] = stats.get('wgr', None)
                    self.data['xwgr'] = stats.get('xwgr', None)
                    self.data['xte'] = stats.get('v').get('xte', None)
                else:
                    self.data['wn8'] = None
                    self.data['xwn8'] = None
                    self.data['wtr'] = None
                    self.data['xwtr'] = None
                    self.data['eff'] = None
                    self.data['xeff'] = None
                    self.data['wgr'] = None
                    self.data['xwgr'] = None
                    self.data['xte'] = None
                self.data['clanAbbrev'] = attacked['clanAbbrev']
            else:
                self.data['isAlive'] = False
            self.data['clanicon'] = _stat.getClanIcon(vehicleID)

            arenaDP = self.guiSessionProvider.getArenaDP()
            if arenaDP is not None:
                vInfo = arenaDP.getVehicleInfo(vID=vehicleID)
                self.data['squadnum'] = vInfo.squadIndex if vInfo.squadIndex != 0 else None
            else:
                self.data['squadnum'] = None
        else:
            self.data['attackedVehicleType'] = 'not_vehicle'
            self.data['shortUserString'] = ''
            self.data['name'] = ''
            self.data['clanAbbrev'] = ''
            self.data['level'] = None
            self.data['clanicon'] = None
            self.data['squadnum'] = None
        self.updateLabels()
예제 #7
0
 def updateData(self):
     if self.bootcampController.isInBootcamp():
         return
     player = BigWorld.player()
     self.data['dmgRatio'] = self.data['damage'] * 100 // self.data['maxHealth']
     attackerID = self.data['attackerID']
     minutes, seconds = divmod(int(self.sessionProvider.shared.arenaPeriod.getEndTime() - BigWorld.serverTime()), 60)
     self.data['hitTime'] = '{:02d}:{:02d}'.format(minutes, seconds)
     if attackerID:
         self.data['teamDmg'] = 'unknown'
         attacker = player.arena.vehicles.get(attackerID)
         if attacker is not None:
             if attacker['team'] != player.team:
                 self.data['teamDmg'] = 'enemy-dmg'
             elif attacker['name'] == player.name:
                 self.data['teamDmg'] = 'player'
             else:
                 self.data['teamDmg'] = 'ally-dmg'
             vehicleType = attacker['vehicleType']
             if vehicleType:
                 _type = vehicleType.type
                 self.data['attackerVehicleName'] = vehicleType.name.replace(':', '-', 1) if vehicleType.name else ''
                 self.data['attackerVehicleType'] = list(_type.tags.intersection(VEHICLE_CLASSES))[0]
                 self.data['shortUserString'] = _type.shortUserString
                 self.data['level'] = vehicleType.level
                 self.data['nation'] = nations.NAMES[_type.customizationNationID]
                 if self.data['attackReasonID'] == 2:
                     self.data['diff-masses'] = (player.vehicleTypeDescriptor.physics['weight'] - vehicleType.physics['weight']) / 1000.0
                 elif self.data['diff-masses'] is not None:
                     self.data['diff-masses'] = None
             else:
                 self.data['attackerVehicleType'] = 'not_vehicle'
                 self.data['attackerVehicleName'] = ''
                 self.data['shortUserString'] = None
                 self.data['level'] = None
                 self.data['nation'] = None
                 self.data['diff-masses'] = None
             self.data['name'] = attacker['name']
             if (_stat.resp is not None) and (attacker['name'] in _stat.resp['players']):
                 stats = _stat.resp['players'][attacker['name']]
                 self.data['wn8'] = stats.get('wn8', None)
                 self.data['xwn8'] = stats.get('xwn8', None)
                 self.data['wtr'] = stats.get('wtr', None)
                 self.data['xwtr'] = stats.get('xwtr', None)
                 self.data['eff'] = stats.get('eff', None)
                 self.data['xeff'] = stats.get('xeff', None)
                 self.data['wgr'] = stats.get('wgr', None)
                 self.data['xwgr'] = stats.get('xwgr', None)
                 self.data['xte'] = stats.get('v').get('xte', None)
             else:
                 self.data['wn8'] = None
                 self.data['xwn8'] = None
                 self.data['wtr'] = None
                 self.data['xwtr'] = None
                 self.data['eff'] = None
                 self.data['xeff'] = None
                 self.data['wgr'] = None
                 self.data['xwgr'] = None
                 self.data['xte'] = None
             self.data['clanAbbrev'] = attacker['clanAbbrev']
         self.data['clanicon'] = _stat.getClanIcon(attackerID)
         self.data['squadnum'] = None
         arenaDP = self.sessionProvider.getArenaDP()
         if arenaDP is not None:
             vInfo = arenaDP.getVehicleInfo(vID=attackerID)
             self.data['squadnum'] = vInfo.squadIndex if vInfo.squadIndex != 0 else None
     else:
         self.data['teamDmg'] = 'unknown'
         self.data['attackerVehicleType'] = 'not_vehicle'
         self.data['attackerVehicleName'] = ''
         self.data['shortUserString'] = ''
         self.data['name'] = ''
         self.data['clanAbbrev'] = ''
         self.data['level'] = None
         self.data['clanicon'] = None
         self.data['squadnum'] = None
     self.updateLabels()
예제 #8
0
    def updateData(self):
        self.data['teamDmg'] = self.getTeamDmg(self.vehicleID)
        maxHealth = self.vehHealth[
            self.
            vehicleID]['maxHealth'] if self.vehicleID in self.vehHealth else 0
        self.data['dmgRatio'] = self.data[
            'damage'] * 100 // maxHealth if maxHealth != 0 else 0
        if self.vehicleID:
            attacked = self.player.arena.vehicles.get(self.vehicleID)
            if attacked is not None:
                vehicleType = attacked['vehicleType']
                self.data['name'] = attacked['name']
                self.data['clanAbbrev'] = attacked['clanAbbrev']
                if vehicleType:
                    _type = vehicleType.type
                    self.data['attackedVehicleType'] = list(
                        _type.tags.intersection(VEHICLE_CLASSES))[0]
                    self.data[
                        'attackerVehicleName'] = vehicleType.name.replace(
                            ':', '-', 1) if vehicleType.name else ''
                    self.data['shortUserString'] = _type.shortUserString
                    self.data['level'] = vehicleType.level
                    self.data['nation'] = nations.NAMES[
                        _type.customizationNationID]
                    self.data['diff-masses'] = (
                        self.player.vehicleTypeDescriptor.physics['weight'] -
                        vehicleType.physics['weight']
                    ) / 1000.0 if self.data['attackReasonID'] == 2 else None
                else:
                    self.resetDataVehInfo()
                if (_stat.resp is not None) and (attacked['name']
                                                 in _stat.resp['players']):
                    stats = _stat.resp['players'][attacked['name']]
                    self.data['wn8'] = stats.get('wn8', None)
                    self.data['xwn8'] = stats.get('xwn8', None)
                    self.data['wtr'] = stats.get('wtr', None)
                    self.data['xwtr'] = stats.get('xwtr', None)
                    self.data['eff'] = stats.get('e', None)
                    self.data['xeff'] = stats.get('xeff', None)
                    self.data['wgr'] = stats.get('wgr', None)
                    self.data['xwgr'] = stats.get('xwgr', None)
                    self.data['xte'] = stats.get('v').get('xte', None)
                else:
                    self.resetDataStats()
            elif not self.isVehicle:
                self.resetDataStats()
                self.resetDataVehInfo()
                self.data['shortUserString'] = l10n(PILLBOX).format(
                    self.entityNumber)
                self.data['name'] = ''
                self.data['clanAbbrev'] = ''
                self.data['clanicon'] = None
                self.data['squadnum'] = None
                self.data['compName'] = None
                self.data['criticalHit'] = None
            else:
                self.data['name'] = ''
                self.data['clanAbbrev'] = ''
                self.resetDataStats()
                self.resetDataVehInfo()
            self.data['clanicon'] = _stat.getClanIcon(self.vehicleID)

            arenaDP = self.guiSessionProvider.getArenaDP()
            if arenaDP is not None:
                vInfo = arenaDP.getVehicleInfo(vID=self.vehicleID)
                self.data[
                    'squadnum'] = vInfo.squadIndex if vInfo.squadIndex != 0 else None
            else:
                self.data['squadnum'] = None
        else:
            self.resetDataVehInfo()
            self.resetDataStats()
            self.data['name'] = ''
            self.data['clanAbbrev'] = ''
            self.data['clanicon'] = None
            self.data['squadnum'] = None
        self.updateLabels()
예제 #9
0
    def updateData(self):
        self.data['teamDmg'] = self.getTeamDmg(self.vehicleID)
        maxHealth = self.vehHealth[self.vehicleID]['maxHealth'] if self.vehicleID in self.vehHealth else 0
        self.data['dmgRatio'] = self.data['damage'] * 100 // maxHealth if maxHealth != 0 else 0
        if self.vehicleID:
            attacked = self.player.arena.vehicles.get(self.vehicleID)
            if attacked is not None:
                vehicleType = attacked['vehicleType']
                self.data['name'] = attacked['name']
                self.data['clanAbbrev'] = attacked['clanAbbrev']
                if vehicleType:
                    _type = vehicleType.type
                    self.data['attackedVehicleType'] = list(_type.tags.intersection(VEHICLE_CLASSES))[0]
                    self.data['attackerVehicleName'] = vehicleType.name.replace(':', '-', 1) if vehicleType.name else ''
                    self.data['shortUserString'] = _type.shortUserString
                    self.data['level'] = vehicleType.level
                    self.data['nation'] = nations.NAMES[_type.customizationNationID]
                    self.data['diff-masses'] = (self.player.vehicleTypeDescriptor.physics['weight'] - vehicleType.physics['weight']) / 1000.0 if self.data['attackReasonID'] == 2 else None
                else:
                    self.resetDataVehInfo()
                if (_stat.resp is not None) and (attacked['name'] in _stat.resp['players']):
                    stats = _stat.resp['players'][attacked['name']]
                    self.data['wn8'] = stats.get('wn8', None)
                    self.data['xwn8'] = stats.get('xwn8', None)
                    self.data['wtr'] = stats.get('wtr', None)
                    self.data['xwtr'] = stats.get('xwtr', None)
                    self.data['eff'] = stats.get('e', None)
                    self.data['xeff'] = stats.get('xeff', None)
                    self.data['wgr'] = stats.get('wgr', None)
                    self.data['xwgr'] = stats.get('xwgr', None)
                    self.data['xte'] = stats.get('v').get('xte', None)
                else:
                    self.resetDataStats()
            elif not self.isVehicle:
                self.resetDataStats()
                self.resetDataVehInfo()
                self.data['shortUserString'] = l10n(PILLBOX).format(self.entityNumber)
                self.data['name'] = ''
                self.data['clanAbbrev'] = ''
                self.data['clanicon'] = None
                self.data['squadnum'] = None
                self.data['compName'] = None
                self.data['criticalHit'] = None
            else:
                self.data['name'] = ''
                self.data['clanAbbrev'] = ''
                self.resetDataStats()
                self.resetDataVehInfo()
            self.data['clanicon'] = _stat.getClanIcon(self.vehicleID)

            arenaDP = self.guiSessionProvider.getArenaDP()
            if arenaDP is not None:
                vInfo = arenaDP.getVehicleInfo(vID=self.vehicleID)
                self.data['squadnum'] = vInfo.squadIndex if vInfo.squadIndex != 0 else None
            else:
                self.data['squadnum'] = None
        else:
            self.resetDataVehInfo()
            self.resetDataStats()
            self.data['name'] = ''
            self.data['clanAbbrev'] = ''
            self.data['clanicon'] = None
            self.data['squadnum'] = None
        self.updateLabels()
예제 #10
0
 def updateData(self):
     player = BigWorld.player()
     self.data['dmgRatio'] = self.data['damage'] * 100 // self.data['maxHealth']
     if self.data['attackerID']:
         entity = BigWorld.entity(self.data['attackerID'])
         self.data['marksOnGun'] = '_' + str(entity.publicInfo['marksOnGun']) if (entity is not None) else None
         self.data['teamDmg'] = 'unknown'
         attacker = player.arena.vehicles.get(self.data['attackerID'])
         if attacker is not None:
             if attacker['team'] != player.team:
                 self.data['teamDmg'] = 'enemy-dmg'
             elif attacker['name'] == player.name:
                 self.data['teamDmg'] = 'player'
             else:
                 self.data['teamDmg'] = 'ally-dmg'
             if attacker['vehicleType']:
                 self.data['attackerVehicleType'] = list(attacker['vehicleType'].type.tags.intersection(VEHICLE_CLASSES))[0].lower()
                 self.data['shortUserString'] = attacker['vehicleType'].type.shortUserString
                 self.data['level'] = attacker['vehicleType'].level
                 self.data['nation'] = nations.NAMES[attacker['vehicleType'].type.customizationNationID]
                 if self.data['attackReasonID'] == 2:
                     self.data['diff-masses'] = (player.vehicleTypeDescriptor.physics['weight'] - attacker['vehicleType'].physics['weight']) / 1000.0
                 elif self.data['diff-masses'] is not None:
                     self.data['diff-masses'] = None
             else:
                 self.data['attackerVehicleType'] = None
                 self.data['shortUserString'] = None
                 self.data['level'] = None
                 self.data['nation'] = None
                 self.data['diff-masses'] = None
             self.data['name'] = attacker['name']
             if attacker['name'] in _stat.resp['players']:
                 stats = _stat.resp['players'][attacker['name']]
                 self.data['wn8'] = stats.get('wn8', None)
                 self.data['xwn8'] = stats.get('xwn8', None)
                 self.data['eff'] = stats.get('e', None)
                 self.data['xeff'] = stats.get('xeff', None)
                 self.data['wgr'] = stats.get('wgr', None)
                 self.data['xwgr'] = stats.get('xwgr', None)
                 self.data['xte'] = stats.get('v').get('xte', None)
             else:
                 self.data['wn8'] = None
                 self.data['xwn8'] = None
                 self.data['eff'] = None
                 self.data['xeff'] = None
                 self.data['wgr'] = None
                 self.data['xwgr'] = None
                 self.data['xte'] = None
             self.data['clanAbbrev'] = attacker['clanAbbrev']
         self.data['clanicon'] = _stat.getClanIcon(self.data['attackerID'])
         statXVM = _stat.players.get(self.data['attackerID'], None)
         self.data['squadnum'] = statXVM.squadnum if statXVM is not None else None
     else:
         self.data['teamDmg'] = 'unknown'
         self.data['attackerVehicleType'] = None
         self.data['shortUserString'] = None
         self.data['name'] = None
         self.data['clanAbbrev'] = None
         self.data['level'] = None
         self.data['clanicon'] = None
         self.data['squadnum'] = None
         self.data['marksOnGun'] = None