Returns information on the game the Battle.net friend is playing.
gameAccountInfo = C_BattleNet.GetFriendGameAccountInfo(friendIndex, accountIndex)
= C_BattleNet.GetGameAccountInfoByID(id)
= C_BattleNet.GetGameAccountInfoByGUID(guid)
Arguments
GetFriendGameAccountInfo
- friendIndex
- number - Index ranging from 1 to BNGetNumFriends()
- accountIndex
- number - Index ranging from 1 to C_BattleNet.GetFriendNumGameAccounts()
GetGameAccountInfoByID
- id
- number :
gameAccountInfo.gameAccountID
GetGameAccountInfoByGUID
- guid
- string : UnitGUID
Returns
- gameAccountInfo
- BNetGameAccountInfo?
Field |
Type |
Description
|
gameAccountID |
number? |
A temporary ID for the friend's battle.net game account during this session.
|
clientProgram |
string |
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
|
regionID |
number |
Added in 9.1.0
|
isInCurrentRegion |
boolean |
Added in 9.1.0
|
Details
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"
C_BattleNet.GetFriendAccountInfo()
returns the same information in gameAccountInfo
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
Patch 8.2.5 (2019-09-24): Changed to C_BattleNet.GetFriendGameAccountInfo
and C_BattleNet.GetGameAccountInfoByID()
.[1]
Patch 6.2.4 (2016-03-22): Changed to BNGetFriendGameAccountInfo() and BNGetGameAccountInfo().
Patch 3.3.5 (2010-06-22): Added as BNGetFriendToonInfo()
and BNGetToonInfo()
.