Removed realmName and related functions

This commit is contained in:
robin 2021-05-24 10:34:10 +02:00
parent 3d1e5ba5c5
commit cc5e2e51eb
1 changed files with 8 additions and 13 deletions

View File

@ -2,7 +2,7 @@ local addonName, addon = ...
local childName = addon['childName'] local childName = addon['childName']
local child = addon[childName] local child = addon[childName]
local events = child['events'] local events = child['events']
local db, crealm local db
local fmt = "|c0000ff00%i|r/|c0000ffff%i|r|c00ff0000%s|r" local fmt = "|c0000ff00%i|r/|c0000ffff%i|r|c00ff0000%s|r"
local roster,friendroster,bnetroster = {}, {}, {} local roster,friendroster,bnetroster = {}, {}, {}
local GuildRoster = GuildRoster local GuildRoster = GuildRoster
@ -28,14 +28,12 @@ local function getBNFI(friendIndex)
if(C_BattleNet and C_BattleNet.GetFriendAccountInfo) then if(C_BattleNet and C_BattleNet.GetFriendAccountInfo) then
return C_BattleNet.GetFriendAccountInfo(friendIndex) return C_BattleNet.GetFriendAccountInfo(friendIndex)
else else
local bnetIDAccount, accountName, battleTag, isBattleTagPresence, characterName, bnetIDGameAccount, client, isOnline, lastOnline, isAFK, isDND, messageText, noteText, isRIDFriend, messageTime, canSoR, isReferAFriend, canSummonFriend = BNGetFriendInfo(friendIndex) local _, _, _, _, characterName, _, client, isOnline = BNGetFriendInfo(friendIndex)
if(characterName) then if(characterName and isOnline and client == BNET_CLIENT_WOW) then
local charName, charRealm = strsplit('-', characterName, 2)
return { return {
['gameAccountInfo'] = { ['gameAccountInfo'] = {
['clientProgram'] = client, ['clientProgram'] = client,
['realmName'] = charRealm, ['characterName'] = characterName,
['characterName'] = charName,
['isOnline'] = isOnline ['isOnline'] = isOnline
} }
} }
@ -75,7 +73,7 @@ local function checkRoster(self, dummy, event, ...)
dontShow = false dontShow = false
if(aci) then if(aci) then
if(aci['clientProgram'] == BNET_CLIENT_WOW) then if(aci['clientProgram'] == BNET_CLIENT_WOW) then
if(aci['realmName'] == crealm and friendroster[aci['characterName']]) then if(friendroster[aci['characterName']]) then
dontShow = true dontShow = true
end end
end end
@ -115,11 +113,8 @@ child['specs'] = {
} }
} }
function events:PLAYER_ENTERING_WORLD(event) function events:PLAYER_ENTERING_WORLD(event)
crealm = GetRealmName() child:UnregisterEvent('PLAYER_ENTERING_WORLD')
if(crealm) then child:RegisterEvent({"GUILD_ROSTER_UPDATE","FRIENDLIST_UPDATE","CHAT_MSG_CHANNEL_JOIN","CHAT_MSG_CHANNEL_LEAVE","PLAYER_FLAGS_CHANGED","UNIT_FLAGS","BN_FRIEND_INFO_CHANGED"}, checkRoster)
child:UnregisterEvent('PLAYER_ENTERING_WORLD') OnUpdate()
child:RegisterEvent({"GUILD_ROSTER_UPDATE","FRIENDLIST_UPDATE","CHAT_MSG_CHANNEL_JOIN","CHAT_MSG_CHANNEL_LEAVE","PLAYER_FLAGS_CHANGED","UNIT_FLAGS","BN_FRIEND_INFO_CHANGED"}, checkRoster)
OnUpdate()
end
end end
child:NewAddOn(...) child:NewAddOn(...)