-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKUI_FriendHighlight.lua
More file actions
92 lines (75 loc) · 2.5 KB
/
KUI_FriendHighlight.lua
File metadata and controls
92 lines (75 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
local addon = KuiNameplates
local mod = addon:NewPlugin('FriendHighlight',1005)
local UnitIsPlayer,UnitIsOtherPlayersPet,GetGuildInfo=
UnitIsPlayer,UnitIsOtherPlayersPet,GetGuildInfo
local bnet_friends = {}
local function Frame_UpdateGuildText(f)
f.FriendHighlight_UpdateGuildText(f);
-- Check if unit is a player and--importantly--not you
-- Fix provided by tflo
-- https://github.com/peterwooley/KUI_FriendHighlight/issues/1
if UnitIsPlayer(f.unit) and not UnitIsUnit(f.unit, 'player') then
local friend = C_FriendList.IsFriend(UnitGUID(f.unit))
local bnet_friend = C_BattleNet.GetAccountInfoByGUID(UnitGUID(f.unit))
if friend or bnet_friend then
mod:ShowFriendIcon(f)
return
end
local guild = f.state.guild_text
if not guild then
if f.FriendHighlight ~= nil then f.FriendHighlight:Hide() end
return
end
local myGuild = GetGuildInfo("player")
if not myGuild then
return
end
if guild == myGuild then
--print(f.state.name .. " is not in your guild.")
mod:ShowGuildIcon(f)
else
--print(f.state.name .. " is not in your guild.")
if f.FriendHighlight ~= nil then f.FriendHighlight:Hide() end
end
else
if f.FriendHighlight ~= nil then f.FriendHighlight:Hide() end
end
end
function mod:ShowGuildIcon(f)
local i = f:CreateTexture()
i:SetAtlas("hud-microbutton-communities-icon-notification")
i:SetHeight(17)
i:SetWidth(17)
mod:ShowIcon(f, i)
end
function mod:ShowFriendIcon(f)
local i = f:CreateTexture()
i:SetAtlas("friendslist-favorite", true)
mod:ShowIcon(f, i)
end
function mod:ShowIcon(f, i)
if f.FriendHighlight ~= nil then
f.FriendHighlight:Hide()
f.FriendHighlight = nil
end
i:SetPoint('LEFT',f.NameText,'RIGHT')
f.FriendHighlight = i
end
function mod:Create(f)
-- -- Setup Battle.net friends list for later reference
-- for i=1, BNGetNumFriends() do
-- bnet_friend = C_BattleNet.GetFriendAccountInfo(i)
-- if bnet_friend then
-- bnet_friends[bnet_friend.accountName] = true
-- end
-- end
-- -- Add non-favorites to end of table
-- for i=1,#nf do
-- friends[#friends+1] = nf[i]
-- end
f.FriendHighlight_UpdateGuildText = f.UpdateGuildText
f.UpdateGuildText = Frame_UpdateGuildText
end
function mod:OnEnable()
self:RegisterMessage('Create')
end