def _makeData(self): arenaDP = g_sessionProvider.getArenaDP() teamIds = arenaDP.getMultiTeamsIndexes() playerVehID = avatar_getter.getPlayerVehicleID() allyTeams = arenaDP.getAllyTeams() isSquadPlayer = arenaDP.isSquadMan(playerVehID) teamScores = {} enemyScore = 0 enemyName = '' allyScore = 0 collection = vos_collections.VehiclesItemsCollection() for vInfoVO, vStatsVO in collection.iterator(arenaDP): points = vStatsVO.winPoints if vInfoVO.team in allyTeams: allyScore += points else: if vInfoVO.team in teamScores: currentScore = teamScores[vInfoVO.team] totalScore = currentScore + points else: totalScore = points teamScores[vInfoVO.team] = totalScore if totalScore > enemyScore: enemyScore = totalScore squadIndex = teamIds[vInfoVO.team] enemyName = i18n.makeString( INGAME_GUI.SCOREPANEL_SQUADLBL, sq_number=squadIndex ) if squadIndex else vInfoVO.player.name if isSquadPlayer: playerName = i18n.makeString(INGAME_GUI.SCOREPANEL_MYSQUADLBL) else: playerName = avatar_getter.getPlayerName() if arenaDP.isTeamKiller(playerVehID): playerName = makeHtmlString('html_templates:battle', 'fallouScorePanelTeamKiller', playerName) self.__allyScore = allyScore self.__enemyScore = enemyScore self.as_setDataS(self._contextType, self._maxScore, 0, allyScore, enemyScore, playerName, enemyName, _TEAM_PROPS) self._score = (allyScore, enemyScore) g_eventBus.handleEvent( events.ScoreEvent(events.ScoreEvent.FRAGS_UPDATED, ctx={ 'ally': allyScore, 'enemy': enemyScore }), EVENT_BUS_SCOPE.BATTLE)
def updateScore(self): if len(self.__teamsDeaths): isTeamEnemy = g_sessionProvider.getArenaDP().isEnemyTeam ally, enemy = (0, 0) for teamIdx, score in self.__teamsDeaths.iteritems(): if isTeamEnemy(teamIdx): ally += score else: enemy += score self.__callFlash('updateFrags', [ally, enemy]) self.__score = (ally, enemy) g_eventBus.handleEvent( events.ScoreEvent(events.ScoreEvent.FRAGS_UPDATED, ctx={ 'ally': ally, 'enemy': enemy }), EVENT_BUS_SCOPE.BATTLE)
def _makeData(self): arenaDP = g_sessionProvider.getArenaDP() playerVehID = getPlayerVehicleID() allyTeams = arenaDP.getAllyTeams() allyScore, enemyScore, playerScore = (0, 0, 0) for vInfoVO, _, viStatsVO in arenaDP.getAllVehiclesIterator(): points = viStatsVO.winPoints if vInfoVO.team in allyTeams: allyScore += points if vInfoVO.vehicleID == playerVehID: playerScore += points else: enemyScore += points self.as_setDataS(self._contextType, self._maxScore, playerScore, allyScore, enemyScore, '', '', {}) self._score = (allyScore, enemyScore) g_eventBus.handleEvent( events.ScoreEvent(events.ScoreEvent.FRAGS_UPDATED, ctx={ 'ally': allyScore, 'enemy': enemyScore }), EVENT_BUS_SCOPE.BATTLE)