Esempio n. 1
0
 def addVehicleMarker(self, vProxy, vInfo, guiProps):
     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._createVehicleMarker(isAlly, mProv)
     self.__markers[vInfo.vehicleID] = _VehicleMarker(markerID, vProxy, self.__ownUIProxy)
     battleCtx = g_sessionProvider.getCtx()
     result = battleCtx.getPlayerFullNameParts(vProxy.id)
     vType = vInfo.vehicleType
     teamIdx = -1
     if arena_info.isFalloutMultiTeam() and vInfo.isSquadMan():
         teamIdx = g_sessionProvider.getArenaDP().getMultiTeamsIndexes()[vInfo.team]
     self.invokeMarker(markerID, 'init', [vType.classTag,
      vType.iconPath,
      result.vehicleName,
      vType.level,
      result.playerFullName,
      result.playerName,
      result.clanAbbrev,
      result.regionCode,
      vProxy.health,
      maxHealth,
      guiProps.name(),
      speaking,
      hunting,
      guiProps.base,
      g_ctfManager.getVehicleCarriedFlagID(vInfo.vehicleID) is not None,
      teamIdx])
     return markerID
Esempio n. 2
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
def new__addOrUpdateVehicleMarker(self, vProxy, vInfo, guiProps, active = True):
    # Original code
    speaking = self.bwProto.voipController.isPlayerSpeaking(vInfo.player.accountDBID)
    flagBearer = g_ctfManager.getVehicleCarriedFlagID(vInfo.vehicleID) is not None
    if active:
        mProv = vProxy.model.node('HP_gui')
    else:
        mProv = None
    if vInfo.vehicleID in self._VehicleMarkerPlugin__vehiclesMarkers:
        marker = self._VehicleMarkerPlugin__vehiclesMarkers[vInfo.vehicleID]
        if marker.setActive(active):
            self._setMarkerMatrix(marker.getMarkerID(), mProv)
            self._setMarkerActive(marker.getMarkerID(), active)
            self._VehicleMarkerPlugin__updateVehicleStates(marker, speaking, vProxy.health, flagBearer)
            marker.attach(vProxy)
    else:
        hunting = VehicleActions.isHunting(vInfo.events)
        markerID = self._createMarkerWithMatrix(mProv, 'VehicleMarker')
        self._VehicleMarkerPlugin__vehiclesMarkers[vInfo.vehicleID] = VehicleMarker(markerID, vProxy, self._parentObj.getCanvasProxy(), active)
        battleCtx = g_sessionProvider.getCtx()
        result = battleCtx.getPlayerFullNameParts(vProxy.id)
        vType = vInfo.vehicleType
        squadIndex = 0
        if g_sessionProvider.arenaVisitor.gui.isFalloutMultiTeam() and vInfo.squadIndex:
            squadIndex = vInfo.squadIndex
        # My code
        vehicleName = result.vehicleName
        playerName = result.playerName
        playerInfo = stats.playersInfo.get(str(vInfo.player.accountDBID))
        if config('marker/enable') and playerInfo is not None:
            playerName = config('marker/playerName').format(**playerInfo)
            vehicleName = config('marker/vehicleName').format(**playerInfo)
        self._invokeMarker(markerID, 'setVehicleInfo', [vType.classTag,
         vType.iconPath,
         vehicleName,
         vType.level,
         result.playerFullName,
         playerName,
         result.clanAbbrev,
         result.regionCode,
         vType.maxHealth,
         guiProps.name(),
         hunting,
         squadIndex])
        if not vProxy.isAlive():
            self._VehicleMarkerPlugin__updateMarkerState(markerID, 'dead', True)
        if active:
            self._VehicleMarkerPlugin__updateVehicleStates(self._VehicleMarkerPlugin__vehiclesMarkers[vInfo.vehicleID], speaking, vProxy.health, flagBearer)
    return
Esempio n. 4
0
 def addVehicleMarker(self, vProxy, vInfo, guiProps):
     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._createVehicleMarker(isAlly, mProv)
     self.__markers[vInfo.vehicleID] = _VehicleMarker(markerID, vProxy, self.__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)
     self.invokeMarker(markerID, 'init', [vType.classTag,
      vType.iconPath,
      vehShortName,
      vType.level,
      fullName,
      pName,
      clanAbbrev,
      regionCode,
      vProxy.health,
      maxHealth,
      guiProps.name(),
      speaking,
      hunting,
      guiProps.base,
      g_ctfManager.isFlagBearer(vInfo.vehicleID),
      squadIcon])
     return markerID
Esempio n. 5
0
 def createMarker(self, vProxy):
     vInfo = dict(vProxy.publicInfo)
     battleCtx = g_sessionProvider.getCtx()
     if battleCtx.isObserver(vProxy.id):
         return -1
     isFriend = vInfo['team'] == BigWorld.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 BigWorld.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.__ownUI.addMarker(mProv, 'VehicleMarkerAlly' if isFriend else 'VehicleMarkerEnemy')
     self.__markers[handle] = _VehicleMarker(vProxy, self.__ownUIProxy(), handle)
     fullName, pName, clanAbbrev, regionCode, vehShortName = battleCtx.getFullPlayerNameWithParts(vProxy.id)
     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
Esempio n. 6
0
 def addVehicleMarker(self, vProxy, vInfo, guiProps):
     vTypeDescr = vProxy.typeDescriptor
     maxHealth = vTypeDescr.maxHealth
     mProv = vProxy.model.node('HP_gui')
     isAlly = guiProps.isFriend
     speaking = self.bwProto.voipController.isPlayerSpeaking(vInfo.player.accountDBID)
     hunting = VehicleActions.isHunting(vInfo.events)
     markerID = self._createVehicleMarker(isAlly, mProv)
     self.__markers[vInfo.vehicleID] = _VehicleMarker(markerID, vProxy, self.__ownUIProxy)
     battleCtx = g_sessionProvider.getCtx()
     result = battleCtx.getPlayerFullNameParts(vProxy.id)
     vType = vInfo.vehicleType
     squadIcon = ''
     if g_sessionProvider.arenaVisitor.gui.isFalloutMultiTeam() and vInfo.isSquadMan():
         if guiProps == PLAYER_GUI_PROPS.squadman:
             squadTeam = 'my'
         elif isAlly:
             squadTeam = 'ally'
         else:
             squadTeam = 'enemy'
         squadIcon = '%s%d' % (squadTeam, vInfo.squadIndex)
     self.invokeMarker(markerID, 'init', [vType.classTag,
      vType.iconPath,
      result.vehicleName,
      vType.level,
      result.playerFullName,
      result.playerName,
      result.clanAbbrev,
      result.regionCode,
      vProxy.health,
      maxHealth,
      guiProps.name(),
      speaking,
      hunting,
      guiProps.base,
      g_ctfManager.getVehicleCarriedFlagID(vInfo.vehicleID) is not None,
      squadIcon])
     return markerID
Esempio n. 7
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
Esempio n. 8
0
 def getAction(self, vo):
     return VehicleActions.getBitMask(vo.events)
Esempio n. 9
0
 def getAction(self, vo):
     return VehicleActions.getBitMask(vo.events)