Skip to content

Commit

Permalink
Core: Updated BNet support for classic to support restoring names in …
Browse files Browse the repository at this point in the history
…from history
  • Loading branch information
sylvanaar committed Jun 3, 2020
1 parent a1367bf commit 2d8c2f0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
14 changes: 10 additions & 4 deletions modules/Scrollback.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,19 @@ Prat:AddModuleExtension(function()
return message.extraData and message.extraData.n == #message.extraData
end

local function getBattlettagLookupTable()
function getBattlettagLookupTable()
local lookup = {}
local numBNet = BNGetNumFriends();
for i = 1, numBNet do
local accountInfo = C_BattleNet.GetFriendAccountInfo(i);
if accountInfo then
lookup[accountInfo.battleTag] = accountInfo
if C_BattleNet and C_BattleNet.GetFriendAccountInfo then
local accountInfo = C_BattleNet.GetFriendAccountInfo(i);
if accountInfo then
lookup[accountInfo.battleTag] = accountInfo
end
else
local bnetAccountID, accountName, battleTag = BNGetFriendInfo(i)
local accountInfo = { bnetAccountID = bnetAccountID, accountName = accountName }
lookup[battleTag] = accountInfo
end
end

Expand Down
10 changes: 8 additions & 2 deletions services/chatsections.lua
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,16 @@ function SplitChatMessage(frame, event, ...)
-- end
else
if (type ~= "BN_WHISPER" and type ~= "BN_WHISPER_INFORM" and type ~= "BN_CONVERSATION") or arg2 == _G.UnitName("player") --[[or presenceID]] then
s.PLAYERLINKDATA = ":" .. safestr(arg11) .. ":" .. chatGroup .. (chatTarget and ":" .. chatTarget or "")
s.PLAYERLINKDATA = ":" .. safestr(arg11) .. ":" .. chatGroup .. (chatTarget and (":" .. chatTarget) or "")
else
s.lL = "|HBNplayer:"
s.PLAYERLINKDATA = ":" .. safestr(arg13) .. ":" .. safestr(arg11) .. ":" .. chatGroup .. ":" .. chatTarget .. ":" .. _G.C_BattleNet.GetAccountInfoByID(arg13).battleTag
local battleTag, _
if _G.C_BattleNet and _G.C_BattleNet.GetAccountInfoByID then
battleTag = _G.C_BattleNet.GetAccountInfoByID(arg13).battleTag
else
_, _, battleTag = _G. BNGetFriendInfoByID(arg13)
end
s.PLAYERLINKDATA = ":" .. safestr(arg13) .. ":" .. safestr(arg11) .. ":" .. chatGroup .. ":" .. chatTarget .. (battleTag and (":" .. battleTag) or "")
s.PRESENCE_ID = arg13
end
end
Expand Down

0 comments on commit 2d8c2f0

Please sign in to comment.