View Single Post
05-16-19, 10:02 PM   #1
galvin
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 265
BNGetGameAccountInfo() returning nil

This is a weakaura which has been working fine till recently.
So did a test had a friend whisper me thru bnet.
The IDAccount comes back 132.
BNGetFriendInfoByID(132) returns nil
rest blows up

So do I need change something or did blizzard break something?

Code:
function(Event, ...)
    local Msg = nil
    local Sender = nil
    
    if Event == "CHAT_MSG_WHISPER" then
        Msg = select(1, ...)
        Sender = Ambiguate(select(2, ...), 'none')
        
    elseif Event == "CHAT_MSG_BN_WHISPER" then
        Msg = select(1, ...)
        local IDAccount = select(13, ...)
        local IDGameAccount = select(6, BNGetFriendInfoByID(IDAccount))
        local _, ToonName, Client, RealmName = BNGetGameAccountInfo(IDGameAccount)
        
        if Client == 'WoW' and RealmName == GetRealmName() then
            Sender = ToonName
        end
    end
    
    if Sender then
        local Index = 0
        local Found = false
        local Player = nil
        local MaxMembers = GetNumGroupMembers()
        while Index < MaxMembers do
            Index = Index + 1
            Player = GetRaidRosterInfo(Index)
            if  Player and Player ~= '' and Player == Sender then
                Found = true
                aura_env.MessageText = format('%s\n%s', Sender, Msg)
                break
            end
        end
        return Found
    else
        return false
    end
end
  Reply With Quote