Beispiel #1
0
    def _updateTeamData(self, isEnemy, team, arenaDP, isFragsUpdate=True):
        pNamesList, fragsList, vNamesList, additionalDataList = ([], [], [],
                                                                 [])
        valuesHashes = []
        teamsList, teamScoreList = [], []
        playerIdx = -1
        playerTeamID = avatar_getter.getPlayerTeam()
        teamScores = defaultdict(list)
        teamIds = arenaDP.getMultiTeamsIndexes()
        camraVehicleID = self._battleUI.getCameraVehicleID()
        playerNameLength = int(self._battleUI.getPlayerNameLength(isEnemy))
        vehicleNameLength = int(self._battleUI.getVehicleNameLength(isEnemy))
        if self._arenaVisitor.hasRespawns():
            sortKey = vos_collections.WinPointsAndRespawnSortKey
        else:
            sortKey = vos_collections.WinPointsAndVehicleInfoSortKey
        collection = vos_collections.FalloutMultiTeamItemsCollection(
            sortKey=sortKey)
        for index, (vInfoVO,
                    vStatsVO) in enumerate(collection.iterator(arenaDP)):
            team = vInfoVO.team
            isEnemy = arenaDP.isEnemyTeam(team)
            ctx = makeTeamCtx(team, isEnemy, arenaDP, playerNameLength,
                              vehicleNameLength, camraVehicleID)
            if ctx.playerVehicleID == vInfoVO.vehicleID:
                playerIdx = index
            playerFullName = self._battleCtx.getPlayerFullName(
                vID=vInfoVO.vehicleID, showVehShortName=False)
            if not playerFullName:
                playerFullName = vInfoVO.player.getPlayerLabel()
            pName, frags, vName, additionalData, _ = self._battleUI.statsForm.getFormattedStrings(
                vInfoVO, vStatsVO, ctx, playerFullName)
            pNamesList.append(pName)
            fragsList.append(frags)
            vNamesList.append(vName)
            additionalDataList.append(additionalData)
            valuesHashes.append({
                'vehicleState':
                0 if vStatsVO.stopRespawn else VEHICLE_STATUS.IS_ALIVE,
                'vehicleType':
                vInfoVO.vehicleType.getClassName(),
                'teamColorScheme':
                'vm_enemy' if isEnemy else 'vm_ally'
            })
            teamIdx = teamIds[team]
            if (team, teamIdx) not in teamsList:
                teamsList.append((team, teamIdx))
            format = self._battleUI.statsForm.getTeamScoreFormat()
            teamScores[team].append((vStatsVO.interactive.winPoints, format))

        for team, _ in teamsList:
            teamScore = teamScores[team]
            totalScore = sum([score for score, _ in teamScore])
            scoreIndexForTable = len(teamScore) / 2
            for index, (score, format) in enumerate(teamScore):
                teamScoreStr = format % ' '
                if index == scoreIndexForTable:
                    teamScoreStr = format % BigWorld.wg_getNiceNumberFormat(
                        totalScore)
                teamScoreList.append(teamScoreStr)

        self._battleUI.setMultiteamValues(
            self._makeMultiTeamValues(playerTeamID, playerIdx, pNamesList,
                                      fragsList, vNamesList, teamsList,
                                      teamScoreList,
                                      additionalDataList, valuesHashes,
                                      arenaDP.getMultiTeamsType()))
 def addSortIDs(self, isEnemy, arenaDP):
     self._items = vos_collections.FalloutMultiTeamItemsCollection(sortKey=self._sortKey).ids(arenaDP)
 def _getInfoCollection(self, isEnemy):
     if self._arenaVisitor.hasRespawns():
         sortKey = vos_collections.WinPointsAndRespawnSortKey
     else:
         sortKey = vos_collections.WinPointsAndVehicleInfoSortKey
     return vos_collections.FalloutMultiTeamItemsCollection(sortKey=sortKey)