C_BattleNet.GetGameAccountInfoByID

From Wowpedia
Jump to: navigation, search

Returns information on the game the Battle.net friend is playing.

gameAccountInfo = C_BattleNet.GetGameAccountInfoByID(id)
                = C_BattleNet.GetGameAccountInfoByGUID(guid)
                = C_BattleNet.GetFriendGameAccountInfo(friendIndex, accountIndex)

Arguments

GetGameAccountInfoByID

id 
number - gameAccountInfo.gameAccountID from C_BattleNet.GetAccountInfoByID()

GetGameAccountInfoByGUID

guid 
string : UnitGUID

GetFriendGameAccountInfo

friendIndex 
number - Index ranging from 1 to BNGetNumFriends()
accountIndex 
number - Index ranging from 1 to C_BattleNet.GetFriendNumGameAccounts()

Returns

/spew output
gameAccountInfo 
BNetGameAccountInfo?
Key Type Description
gameAccountID number? Unique numeric identifier for the friend's Battle.net game account
clientProgram string globalstring BNET_CLIENT
isOnline boolean
isGameBusy boolean
isGameAFK boolean
wowProjectID number?
characterName string? The name of the logged in toon/character
realmName string? The name of the logged in realm
realmDisplayName string?
realmID number? The ID for the logged in realm
factionName string? The englishFaction name (i.e., "Alliance" or "Horde")
raceName string? The localized race name (e.g., "Blood Elf")
className string? The localized class name (e.g., "Death Knight")
areaName string? The localized zone name (e.g., "The Undercity")
characterLevel number? The current level (e.g., "90")
richPresence string? For WoW, returns "zoneName - realmName". For StarCraft 2 and Diablo 3, returns the location or activity the player is currently engaged in.
playerGuid string? A unique numeric identifier for the friend's character during this session.
isWowMobile boolean
canSummon boolean
hasFocus boolean Whether or not this toon is the one currently being displayed in Blizzard's FriendFrame
BNET_CLIENT
GlobalString Value Description
BNET_CLIENT_WOW WoW World of Warcraft
BNET_CLIENT_SC2 S2 StarCraft 2
BNET_CLIENT_D3 D3 Diablo 3
BNET_CLIENT_WTCG WTCG Hearthstone
BNET_CLIENT_APP App Battle.net Desktop App
BSAp Battle.net Mobile App
BNET_CLIENT_HEROES Hero Heroes of the Storm
BNET_CLIENT_OVERWATCH Pro Overwatch
BNET_CLIENT_CLNT CLNT
BNET_CLIENT_SC S1 StarCraft: Remastered
BNET_CLIENT_DESTINY2 DST2 Destiny 2
BNET_CLIENT_COD VIPR Call of Duty: Black Ops 4
BNET_CLIENT_COD_MW ODIN Call of Duty: Modern Warfare
BNET_CLIENT_COD_MW2 LAZR Call of Duty: Modern Warfare 2
BNET_CLIENT_COD_BOCW ZEUS Call of Duty: Black Ops Cold War
BNET_CLIENT_WC3 W3 Warcraft III: Reforged

Example

  • Shows your Battle.net friends' game information. Tested with one friend online in the mobile app, and one friend offline.
for i = 1, BNGetNumFriends() do
	for j = 1, C_BattleNet.GetFriendNumGameAccounts(i) do
		local game = C_BattleNet.GetFriendGameAccountInfo(i, j)
		print(game.gameAccountID, game.isOnline, game.clientProgram)
	end
end
-- 5, true, "BSAp"
for i = 1, BNGetNumFriends() do
	local game = C_BattleNet.GetFriendAccountInfo(i).gameAccountInfo
	print(game.gameAccountID, game.isOnline, game.clientProgram)
end
-- 5, true, "BSAp"
-- nil, false, ""

Patch changes

External links

GetGameAccountInfoByID GetGameAccountInfoByGUID GetFriendGameAccountInfo