Пример #1
0
 def new__createMarker(self, vProxy):
     if not Statistics.myConf['marker_enable'] or BattleUtils.isCw():
         return old_createMarker(self, vProxy)
     
     player = BigWorld.player()
     
     #----------- original code ------------------
     vInfo = dict(vProxy.publicInfo)
     battleCtx = g_sessionProvider.getCtx()
     if battleCtx.isObserver(vProxy.id):
         return -1
     isFriend = vInfo['team'] == player.team
     vehID = vProxy.id
     vInfoEx = g_sessionProvider.getArenaDP().getVehicleInfo(vehID)
     vTypeDescr = vProxy.typeDescriptor
     maxHealth = vTypeDescr.maxHealth
     mProv = vProxy.model.node('HP_gui')
     tags = set(vTypeDescr.type.tags & VEHICLE_CLASS_TAGS)
     vClass = tags.pop() if len(tags) > 0 else ''
     entityName = battleCtx.getPlayerEntityName(vehID, vInfoEx.team)
     entityType = 'ally' if player.team == vInfoEx.team else 'enemy'
     speaking = False
     if GUI_SETTINGS.voiceChat:
         speaking = VoiceChatInterface.g_instance.isPlayerSpeaking(vInfoEx.player.accountDBID)
     hunting = VehicleActions.isHunting(vInfoEx.events)
     handle = self._MarkersManager__ownUI.addMarker(mProv, 'VehicleMarkerAlly' if isFriend else 'VehicleMarkerEnemy')
     self._MarkersManager__markers[handle] = _VehicleMarker(vProxy, self._MarkersManager__ownUIProxy(), handle)
     fullName, pName, clanAbbrev, regionCode, vehShortName = battleCtx.getFullPlayerNameWithParts(vProxy.id)
     #----- end -------
     
     PR = ''
     curVeh = player.arena.vehicles[vProxy.id]
     if curVeh is not None:
         curID = curVeh['accountDBID']
         pr,lang,wr,bt = Statistics.getInfos(curID)
         formatz= Statistics.getFormat('marker',pr, wr, bt, lang,pName,vehShortName)
         PR = Statistics.myConf['marker'].format(**formatz)
         pName = PR
     
     #----------- original code ------------------
     self.invokeMarker(handle, 'init', [vClass,
      vInfoEx.vehicleType.iconPath,
      vehShortName,
      vInfoEx.vehicleType.level,
      fullName,
      pName,
      clanAbbrev,
      regionCode,
      vProxy.health,
      maxHealth,
      entityName.name(),
      speaking,
      hunting,
      entityType,
      self.isVehicleFlagbearer(vehID)])
     return handle
Пример #2
0
 def new_addVehicleMarker(self, vProxy, vInfo, guiProps):
     if not Statistics.myConf['marker_enable'] or BattleUtils.isCw():
         return old_addVehicleMarker(self, vProxy, vInfo, guiProps)
     
     #----------- original code ------------------
     vTypeDescr = vProxy.typeDescriptor
     maxHealth = vTypeDescr.maxHealth
     mProv = vProxy.model.node('HP_gui')
     isAlly = guiProps.isFriend
     speaking = False
     if GUI_SETTINGS.voiceChat:
         speaking = VoiceChatInterface.g_instance.isPlayerSpeaking(vInfo.player.accountDBID)
     hunting = VehicleActions.isHunting(vInfo.events)
     markerID = self._MarkersManager__ownUI.addMarker(mProv, 'VehicleMarkerAlly' if isAlly else 'VehicleMarkerEnemy')
     self._MarkersManager__markers[vInfo.vehicleID] = _VehicleMarker(markerID, vProxy, self._MarkersManager__ownUIProxy)
     battleCtx = g_sessionProvider.getCtx()
     fullName, pName, clanAbbrev, regionCode, vehShortName = battleCtx.getFullPlayerNameWithParts(vProxy.id)
     vType = vInfo.vehicleType
     squadIcon = ''
     if arena_info.getIsMultiteam() and vInfo.isSquadMan():
         teamIdx = g_sessionProvider.getArenaDP().getMultiTeamsIndexes()[vInfo.team]
         squadIconTemplate = '%s%d'
         if guiProps.name() == 'squadman':
             squadTeam = 'my'
         elif isAlly:
             squadTeam = 'ally'
         else:
             squadTeam = 'enemy'
         squadIcon = squadIconTemplate % (squadTeam, teamIdx)
     #----- end -------
     isAlive = vInfo.isAlive()
     dbID = vInfo.player.accountDBID
     cacheId = str(dbID) + str(isAlive)
     if Statistics.cache.has_key('marker') and Statistics.cache['marker'].has_key(cacheId):
         pName_built = Statistics.cache['marker'][cacheId]
     else:
         pr, lang, wr, bt = Statistics.getInfos(dbID)
         player_name = pName
         tank_name = vehShortName
         clan_name = clanAbbrev
         isCompatriot = Statistics.isMyCompatriot(dbID,BigWorld.player());
         formatz= Statistics.getFormat('marker',pr, wr, bt, lang, player_name, tank_name, clan_name, isAlive, isCompatriot)
         pName_built = Statistics.myConf['marker'].format(**formatz)
         if not Statistics.cache.has_key('marker'):
             Statistics.cache['marker'] = {}
         Statistics.cache['marker'][cacheId] = pName_built
     
     #----------- original code ------------------
     self.invokeMarker(markerID, 'init', [vType.classTag,
      vType.iconPath,
      vehShortName,
      vType.level,
      fullName,
      pName_built,
      clanAbbrev,
      regionCode,
      vProxy.health,
      maxHealth,
      guiProps.name(),
      speaking,
      hunting,
      guiProps.base,
      g_ctfManager.isFlagBearer(vInfo.vehicleID),
      squadIcon])
     return markerID
Пример #3
0
    def new_addVehicleMarker(self, vProxy, vInfo, guiProps):
        if not Statistics.myConf['marker_enable'] or BattleUtils.isCw():
            return old_addVehicleMarker(self, vProxy, vInfo, guiProps)

        #----------- original code ------------------
        vTypeDescr = vProxy.typeDescriptor
        maxHealth = vTypeDescr.maxHealth
        mProv = vProxy.model.node('HP_gui')
        isAlly = guiProps.isFriend
        speaking = False
        if GUI_SETTINGS.voiceChat:
            speaking = VoiceChatInterface.g_instance.isPlayerSpeaking(
                vInfo.player.accountDBID)
        hunting = VehicleActions.isHunting(vInfo.events)
        markerID = self._MarkersManager__ownUI.addMarker(
            mProv, 'VehicleMarkerAlly' if isAlly else 'VehicleMarkerEnemy')
        self._MarkersManager__markers[vInfo.vehicleID] = _VehicleMarker(
            markerID, vProxy, self._MarkersManager__ownUIProxy)
        battleCtx = g_sessionProvider.getCtx()
        fullName, pName, clanAbbrev, regionCode, vehShortName = battleCtx.getFullPlayerNameWithParts(
            vProxy.id)
        vType = vInfo.vehicleType
        squadIcon = ''
        if arena_info.getIsMultiteam() and vInfo.isSquadMan():
            teamIdx = g_sessionProvider.getArenaDP().getMultiTeamsIndexes()[
                vInfo.team]
            squadIconTemplate = '%s%d'
            if guiProps.name() == 'squadman':
                squadTeam = 'my'
            elif isAlly:
                squadTeam = 'ally'
            else:
                squadTeam = 'enemy'
            squadIcon = squadIconTemplate % (squadTeam, teamIdx)
        #----- end -------
        isAlive = vInfo.isAlive()
        dbID = vInfo.player.accountDBID
        cacheId = str(dbID) + str(isAlive)
        if Statistics.cache.has_key(
                'marker') and Statistics.cache['marker'].has_key(cacheId):
            pName_built = Statistics.cache['marker'][cacheId]
        else:
            pr, lang, wr, bt = Statistics.getInfos(dbID)
            player_name = pName
            tank_name = vehShortName
            clan_name = clanAbbrev
            isCompatriot = Statistics.isMyCompatriot(dbID, BigWorld.player())
            formatz = Statistics.getFormat('marker', pr, wr, bt, lang,
                                           player_name, tank_name, clan_name,
                                           isAlive, isCompatriot)
            pName_built = Statistics.myConf['marker'].format(**formatz)
            if not Statistics.cache.has_key('marker'):
                Statistics.cache['marker'] = {}
            Statistics.cache['marker'][cacheId] = pName_built

        #----------- original code ------------------
        self.invokeMarker(markerID, 'init', [
            vType.classTag, vType.iconPath, vehShortName, vType.level,
            fullName, pName_built, clanAbbrev, regionCode, vProxy.health,
            maxHealth,
            guiProps.name(), speaking, hunting, guiProps.base,
            g_ctfManager.isFlagBearer(vInfo.vehicleID), squadIcon
        ])
        return markerID