Skip to content

Commit

Permalink
Merge pull request #7 from kballard/bnet-duplicate-toons
Browse files Browse the repository at this point in the history
Work around Blizzard returning duplicate RealID toons
  • Loading branch information
solocommand committed Jun 1, 2016
2 parents 744d949 + 871fec6 commit 0ed185a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions TitanSocial.lua
Original file line number Diff line number Diff line change
Expand Up @@ -652,18 +652,25 @@ end
local function parseRealID(filterClients)
local numTotal, numOnline = BNGetNumFriends()

-- lately we've been seeing BNGetFriendGameAccountInfo returning duplicate info for a player,
-- making it seem as though they're playing the same toon 3 times simultaneously.
-- Work around that by filtering out duplicates using the bnetIDGameAccount.
local seen = {}

local friends, bnets = {}, {}
for i=1, numOnline do
local presenceID, presenceName, battleTag, isBattleTagPresence, _, _, _, _, _, isAFK, isDND, broadcastText, noteText = BNGetFriendInfo(i)
if not isBattleTagPresence then
battleTag = nil
end

table.wipe(seen)

local toons, focus, bnet
for j=1, BNGetNumFriendGameAccounts(i) do
local hasFocus, toonName, client, realmName, realmID, faction, race, class, _, zoneName, level, gameText = BNGetFriendGameAccountInfo(i, j)
local hasFocus, toonName, client, realmName, realmID, faction, race, class, _, zoneName, level, gameText, _, _, _, bnetIDGameAccount = BNGetFriendGameAccountInfo(i, j)
-- in the past I've seen this return nil data, so use the client as a marker
if client then
if client and seen[bnetIDGameAccount] == nil then
local toon = {
name = toonName,
client = client,
Expand All @@ -676,6 +683,7 @@ local function parseRealID(filterClients)
level = level,
gameText = gameText
}
seen[bnetIDGameAccount] = toon
if client == "App" then
-- assume no more than 1 bnet toon, but check anyway
if bnet == nil then bnet = toon end
Expand Down

0 comments on commit 0ed185a

Please sign in to comment.