diff --git a/core.lua b/core.lua index 1434d5c..b20318c 100644 --- a/core.lua +++ b/core.lua @@ -24,13 +24,31 @@ local function count(v) end return c end +local function getBNFI(friendIndex) + if(C_BattleNet and C_BattleNet.GetFriendAccountInfo) then + return C_BattleNet.GetFriendAccountInfo(friendIndex) + else + local bnetIDAccount, accountName, battleTag, isBattleTagPresence, characterName, bnetIDGameAccount, client, isOnline, lastOnline, isAFK, isDND, messageText, noteText, isRIDFriend, messageTime, canSoR, isReferAFriend, canSummonFriend = BNGetFriendInfo(friendIndex) + if(characterName) then + local charName, charRealm = strsplit('-', characterName, 2) + return { + ['gameAccountInfo'] = { + ['clientProgram'] = client, + ['realmName'] = charRealm, + ['characterName'] = charName, + ['isOnline'] = isOnline + } + } + end + end +end local function checkRoster(self, dummy, event, ...) local newroster = {} local rostername, online, _ local dontShow = false if(event == "GUILD_ROSTER_UPDATE") then - for i=1,GetNumGuildMembers() do + for i = 1, GetNumGuildMembers() do rostername, _, _, _, _, _, _, _, online = GetGuildRosterInfo(i) if(online and rostername) then newroster[rostername]=true @@ -51,7 +69,7 @@ local function checkRoster(self, dummy, event, ...) local _, numOnline = BNGetNumFriends() local presenceID, isFriend,client,accid for i = 1, numOnline do - local res = C_BattleNet.GetFriendAccountInfo(i) + local res = getBNFI(i) if(res) then local aci = res['gameAccountInfo'] dontShow = false