From cc5e2e51eb5b60c63efed2fb825fd3ed0ddf50ed Mon Sep 17 00:00:00 2001 From: robin Date: Mon, 24 May 2021 10:34:10 +0200 Subject: [PATCH] Removed realmName and related functions --- core.lua | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/core.lua b/core.lua index b20318c..9ef3d8b 100644 --- a/core.lua +++ b/core.lua @@ -2,7 +2,7 @@ local addonName, addon = ... local childName = addon['childName'] local child = addon[childName] local events = child['events'] -local db, crealm +local db local fmt = "|c0000ff00%i|r/|c0000ffff%i|r|c00ff0000%s|r" local roster,friendroster,bnetroster = {}, {}, {} local GuildRoster = GuildRoster @@ -28,14 +28,12 @@ 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) + local _, _, _, _, characterName, _, client, isOnline = BNGetFriendInfo(friendIndex) + if(characterName and isOnline and client == BNET_CLIENT_WOW) then return { ['gameAccountInfo'] = { ['clientProgram'] = client, - ['realmName'] = charRealm, - ['characterName'] = charName, + ['characterName'] = characterName, ['isOnline'] = isOnline } } @@ -75,7 +73,7 @@ local function checkRoster(self, dummy, event, ...) dontShow = false if(aci) then if(aci['clientProgram'] == BNET_CLIENT_WOW) then - if(aci['realmName'] == crealm and friendroster[aci['characterName']]) then + if(friendroster[aci['characterName']]) then dontShow = true end end @@ -115,11 +113,8 @@ child['specs'] = { } } function events:PLAYER_ENTERING_WORLD(event) - crealm = GetRealmName() - if(crealm) then - child:UnregisterEvent('PLAYER_ENTERING_WORLD') - 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 + child:UnregisterEvent('PLAYER_ENTERING_WORLD') + 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 child:NewAddOn(...) \ No newline at end of file