GetBattlefieldScore

From Wowpedia
Jump to: navigation, search

Returns information about a player's score in battlegrounds.

name, killingBlows, honorableKills, deaths, honorGained, faction, race, class, classToken, damageDone, healingDone, bgRating, ratingChange, preMatchMMR, mmrChange, talentSpec = GetBattlefieldScore(index)

Arguments

index 
Number - The characters index in battlegrounds, going from 1 to GetNumBattlefieldScores().

Returns

name 
String - The player's name, with their server name attached if from a different server to the player.
killingBlows 
Number - Number of killing blows.
honorableKills
Number - Number of honorable kills.
deaths 
Number - The number of deaths.
honorGained 
Number - The amount of honour gained so far (Bonus Honour).
faction 
Number - (Battlegrounds: Horde = 0, Alliance = 1 / Arenas: Green Team = 0, Yellow Team = 1).
race 
String - The players race (Orc, Undead, Human, etc).
class 
String - The players class (Mage, Hunter, Warrior, etc).
classToken
String - The player's class name in english given in all capitals (MAGE , HUNTER, WARRIOR, etc)
damageDone
Number - The amount of damage done.
healingDone
Number - The amount of healing done.
talentSpec
String - Localized name of player build

Example

How to count the number of players in each faction.

local numScores = GetNumBattlefieldScores()
local numHorde = 0
local numAlliance = 0
for i=1, numScores do
	name, killingBlows, honorableKills, deaths, honorGained, faction = GetBattlefieldScore(i);
	if ( faction ) then
		if ( faction == 0 ) then
			numHorde = numHorde + 1
		else
			numAlliance = numAlliance + 1
		end
	end
end