-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAra_Broker_Guild_Friends.lua
More file actions
1620 lines (1460 loc) · 59.3 KB
/
Ara_Broker_Guild_Friends.lua
File metadata and controls
1620 lines (1460 loc) · 59.3 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--[[
ATTRIBUTION:
This module is based on Ara Broker Guild Friends
Original Author: Aranarth (wowinterface.com, last active 2017)
Updated by: MysticalOS (2024)
Further Modified by: Cilraaz for Simple Datatexts
The original addon had no explicit license. This incorporation
follows WoW addon community norms for abandoned addons.
If the original author objects, this module will be removed immediately.
This modified version is licensed under GPL v3 as part of Simple Datatexts.
]]
-- TODO translate zones.
-- TODO? don't recreate guild/friend entries, replace values in the table if char is present, remove disconnected, add connected.
-- TODO make real friend with broadcast a double sized button unless the broadcast has a link (in this case, click broadcast to copy link).
-- TODO? defaultConfig as config metatable / remove old values only (don't add new ones).
-- TODO split column "notes" to "notes" and "officier notes" (change sort columns accordingly and add a button.offNotes).
local _, _, _, wowTOC = GetBuildInfo()
local SDT = SimpleDatatexts
local InCombatLockdown = InCombatLockdown
local BUTTON_HEIGHT, ICON_SIZE, GAP, TEXT_OFFSET, INFO_HEIGHT, FONT_SIZE, MAX_ENTRIES = 15, 13, 10, 5, 25, 12
local f = CreateFrame( "Frame", "AraBrokerGuildFriends", UIParent)
Mixin(f, BackdropTemplateMixin)
f:Hide()
local t = CreateFrame"Frame"
local addonName, _ = ...
local L = SDT.L
local ClassL = {}
local defaultConfig = {
highlightOrder = true,
highlightMode = "gradientAZ",
showGuildTotal = true,
showFriendsTotal = true,
showGuildNotes = true,
showFriendNotes = true,
showGuildName = false,
showGuildTag = false,
showFriendsTag = false,
showGuildXP = true,
showGuildXPTooltip = false,
showOwnBroadcast = true,
sortCols = { [true] = { "class", "name", "name" }, [false] = { "name", "name", "name" } },
sortASC = { [true] = { true, true, true }, [false] = { true, true, true } },
scale = 1,
statusMode = "icon",
realID = "before",
showUngroupedClassIcon = true,
alignName = "LEFT",
alignZone = "CENTER",
alignNote = "CENTER",
alignRank = "RIGHT",
colors = {
background = { .1, .1, .1, .85 },
border = { .3, .3, .3, .9 },
note = { .14, .76, .15 },
officerNote = { 1, .56, .25 },
motd = { 1, .8, 0 },
broadcast = { 1, .1, .1 },
title = { 1, 1, 1 },
rank = { .1, .9, 1 },
realm = { 1, .8, 0 },
status = { .7, .7, .7 },
orderA = { 1, 1, 1, .1 },
contestedZone = { 1, 1, 0 },
friendlyZone = { 0, 1, 0 },
enemyZone = { 1, 0, 0 },
},
useTipTacSkin = true,
hideHints = true,
hWhisp = true,
hInvite = true,
hQuery = true,
hNote = true,
hONote = true,
hOrderA = true,
hOrderB = true,
hOrderC = true,
hResizeTip = true,
hRemoveFriend = true,
showBlockHints = true,
hbOpenPanel = true,
hbConfig = true,
hbToggleNotes = true,
hbAddFriend = true,
enableBnetFriendsBroadcasts = true,
}
local horde, config, isGuild, tip = true
local guildEntries, friendEntries, motd, slider, nbEntries = {}, {}
local sliderValue, hasSlider, UpdateTablet, extraHeight = 0
local RAID_CLASS_COLORS = CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS
local info, buttons, toasts, playerRealm = {}
local totalFriends, onlineFriends, nbRealFriends, realFriendsHeight, nbBroadcast = 0, 0, 0
local clientsTable = {
["BSAp"] = 0,--Battle.net Mobile
["WoW"] = 1,--World of Warcraft
["S2"] = 2,--Starcraft 2
["D3"] = 3,--Diablo 3
["WTCG"] = 4,--Hearthstone
["App"] = 5,--Battle.net Client
["Hero"] = 6,--Heroes of the Storm
["Pro"] = 7,--Overwatch
["CLNT"] = 8,--Battle.net Client alternate (Unused?)
["S1"] = 9,--Starcraft 1
["DST2"] = 10,--Destiny 2
["VIPR"] = 11,--COD
["ODIN"] = 12,--COD MW
["LAZR"] = 13,--COD MW2
["ZEUS"] = 14,--COD BOCW
["W3"] = 15,--Warcraft 3 Reforged
["RTRO"] = 16,--Blizzard Arcane
["WLBY"] = 17,--Crash 4
["OSI"] = 18,--Diablo 2
["Fen"] = 19,--Diablo 4
--["AUKS"] = 20,--COD BO6
}
local clientTextures = {
[0] = "Interface\\FriendsFrame\\Battlenet-Battleneticon",
[1] = "Interface\\FriendsFrame\\Battlenet-WoWicon",
[2] = "Interface\\FriendsFrame\\Battlenet-Sc2icon",
[3] = "Interface\\FriendsFrame\\Battlenet-D3icon",
[4] = "Interface\\FriendsFrame\\Battlenet-WTCGicon",
[5] = "Interface\\FriendsFrame\\Battlenet-Battleneticon",
[6] = "Interface\\FriendsFrame\\Battlenet-HotSicon",
[7] = "Interface\\FriendsFrame\\Battlenet-Overwatchicon",
[8] = "Interface\\FriendsFrame\\Battlenet-Battleneticon",
[9] = "Interface\\FriendsFrame\\Battlenet-SCicon",
[10] = "Interface\\FriendsFrame\\Battlenet-Destiny2icon",
[11] = "Interface\\FriendsFrame\\Battlenet-CallOfDutyBlackOps4icon",
[12] = "Interface\\FriendsFrame\\Battlenet-CallOfDutyMWicon",
[13] = "Interface\\FriendsFrame\\Battlenet-CallOfDutyMW2icon",
[14] = "Interface\\FriendsFrame\\Battlenet-CallOfDutyBlackOpsColdWaricon",
[15] = "Interface\\FriendsFrame\\Battlenet-Warcraft3Reforged",
[16] = "Interface\\FriendsFrame\\Battlenet-BlizzardArcadeCollectionicon",
[17] = "Interface\\FriendsFrame\\Battlenet-CrashBandicoot4icon",
[18] = "Interface\\FriendsFrame\\Battlenet-DiabloIIResurrectedicon",
[19] = "Cache\\TitleIcons\\225231c6bc737ca317db2e94565b1820d8a25a7e6c24f92f0e37fe2fbdb63f54.png",
--[20] = "Interface\\FriendsFrame\\Battlenet-CallOfDutyBlackOps6icon",
}
local configMenu, options, c, cname, SetOption, UpdateColor, ColorPickerChange, ColorPickerCancel, OpenColorPicker, ColorPickerOpacity, colors
local preformatedStatusText, sortIndexes
local backdrop = {
bgFile = "Interface\\Buttons\\WHITE8X8",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
edgeSize=16, tile = false, tileSize=0,
insets = { left=3, right=3, top=3, bottom=3 } }
local wipe, next, GetGuildRosterInfo, GetGuildRosterShowOffline, GetFriendInfo, IsInGuild, GuildRoster, ShowFriends, CLASS_BUTTONS, GetDifficultyColor, Ambiguate =
wipe, next, GetGuildRosterInfo, GetGuildRosterShowOffline, C_FriendList and C_FriendList.GetFriendInfoByIndex or GetFriendInfo, IsInGuild, GuildRoster, ShowFriends, CLASS_ICON_TCOORDS, GetQuestDifficultyColor, Ambiguate
local GetAddOnMetadata = C_AddOns.GetAddOnMetadata
--Not renamed in legion yet but might be
local BNGetNumFriends = BNGetNumFriends
--Begin Compat wrappers for retail and classic to access same functions and expect same returns
--Retail kind of has these for now, but won't forever, and classic is not expected to make same API restructuring, so this ugly mess is probably required forever
local function GetBNGetFriendInfo(friendIndex)
if wowTOC >= 90000 then
local accountInfo = C_BattleNet.GetFriendAccountInfo(friendIndex) or {};
local wowProjectID = accountInfo and accountInfo.gameAccountInfo and accountInfo.gameAccountInfo.wowProjectID or 0;
local clientProgram = accountInfo and accountInfo.gameAccountInfo and accountInfo.gameAccountInfo.clientProgram ~= "" and accountInfo.gameAccountInfo.clientProgram or nil;
local characterName = accountInfo and accountInfo.gameAccountInfo and accountInfo.gameAccountInfo.characterName or "";
local gameAccountID = accountInfo and accountInfo.gameAccountInfo and accountInfo.gameAccountInfo.gameAccountID or 0;
local isOnline = accountInfo and accountInfo.gameAccountInfo and accountInfo.gameAccountInfo.isOnline or false;
local isWowMobile = accountInfo and accountInfo.gameAccountInfo and accountInfo.gameAccountInfo.isWowMobile or false;
return accountInfo.bnetAccountID, accountInfo.accountName, accountInfo.battleTag, accountInfo.isBattleTagFriend,
characterName, gameAccountID, clientProgram,
isOnline, accountInfo.lastOnlineTime, accountInfo.isAFK, accountInfo.isDND, accountInfo.customMessage, accountInfo.note, accountInfo.isFriend,
accountInfo.customMessageTime, wowProjectID, accountInfo.rafLinkType == Enum.RafLinkType.Recruit, false, accountInfo.isFavorite, isWowMobile;
else
return BNGetFriendInfo(friendIndex)
end
end
local function GetBNGetGameAccountInfo(toonId)
if wowTOC >= 90000 then
local gameAccountInfo = _G.C_BattleNet.GetGameAccountInfoByID(toonId) or {}
local wowProjectID = gameAccountInfo.wowProjectID or 0;
local characterName = gameAccountInfo.characterName or "";
local realmName = gameAccountInfo.realmName or "";
local realmID = gameAccountInfo.realmID or 0;
local factionName = gameAccountInfo.factionName or "";
local raceName = gameAccountInfo.raceName or "";
local className = gameAccountInfo.className or "";
local areaName = gameAccountInfo.areaName or "";
local characterLevel = gameAccountInfo.characterLevel or "";
local richPresence = gameAccountInfo.richPresence or "";
local gameAccountID = gameAccountInfo.gameAccountID or 0;
local playerGuid = gameAccountInfo.playerGuid or 0;
local isOnline = gameAccountInfo.isOnline or false;
local isGameAFK = gameAccountInfo.isGameAFK or false;
local isGameBusy = gameAccountInfo.isGameBusy or false;
local isWowMobile = gameAccountInfo.isWowMobile or false;
return gameAccountInfo.hasFocus, characterName, gameAccountInfo.clientProgram,
realmName, realmID, factionName, raceName, className, "", areaName, characterLevel,
richPresence, nil, nil,
isOnline, gameAccountID, nil, isGameAFK, isGameBusy,
playerGuid, wowProjectID, isWowMobile
else
return BNGetGameAccountInfo(toonId)
end
end
--End Compat wrappers for retail and classic to access same functions and expect same returns
local colpairs = { ["class"] = 1, ["name"] = 2, ["level"] = 3, ["zone"] = 4, ["note"] = 5, ["status"] = 6, ["rank"] = 7 }
local new, del
do
local tables = setmetatable( {}, { __mode = "k" } )
new = function(...)
local t = next(tables)
if t then tables[t] = nil else t = {} end
for i=1, select("#",...) do t[i] = select(i,...) end
return t
end
del = function(t)
tables[wipe(t)] = true
end
end
local function UpdateGuildBlockText()
if IsInGuild() then
local guildName = config.showGuildName and GetGuildInfo("player") or ""
if guildName == "" and config.showGuildTag then guildName = L["Guild"] end
if guildName ~= "" then guildName = guildName .. ": " end
f.GuildBlock.text = (config.showGuildTotal and "%s%d/%d" or "%s%d"):format(guildName, #guildEntries, (GetNumGuildMembers()))
else
f.GuildBlock.text = L["No Guild"]
end
SDT:UpdateGuild()
end
local function UpdateFriendBlockText(updatePanel)
local totalRF, onlineRF = BNGetNumFriends()
local friendsTag = config.showFriendsTag and L["Friends"] .. ": " or ""
f.FriendsBlock.text = (config.showFriendsTotal and "%s%d/%d" or "%s%d"):format( friendsTag, onlineFriends + onlineRF, totalFriends + totalRF )
SDT:UpdateFriends()
if updatePanel then f:BN_FRIEND_INFO_CHANGED() end
end
local friendOnline, friendOffline = ERR_FRIEND_ONLINE_SS:gsub("|Hplayer:%%s|h%[%%s%]|h",""), ERR_FRIEND_OFFLINE_S:gsub("%%s","")
function f:CHAT_MSG_SYSTEM( msg )
if InCombatLockdown() or issecretvalue(msg) then return end
if msg:find(friendOnline) or msg:find(friendOffline) then ShowFriends() end
end
function f:FRIENDLIST_UPDATE()
--None bnet friends
for k,v in next,friendEntries do del(v) end
wipe(friendEntries)
onlineFriends = C_FriendList.GetNumOnlineFriends()
for i = 1, onlineFriends do
local name, level, class, zone, connected, status, note
local info = GetFriendInfo(i)
name, level, class, zone, connected, note = info.name, info.level, info.className, info.area, info.isOnline, info.notes
if (info.afk) then
status = CHAT_FLAG_AFK
elseif (info.dnd) then
status = CHAT_FLAG_DND
else
status = ""
end
friendEntries[i] = new( ClassL[class] or "", name or "", level or "", zone or UNKNOWN, note or "|cffffcc00-", status or "", "", "", i )
end
UpdateFriendBlockText()
if not isGuild and f:IsShown() then UpdateTablet() end
end
function f:GUILD_ROSTER_UPDATE()
for k, v in next, guildEntries do del(v) end
wipe(guildEntries)
local r,g,b = unpack(colors.officerNote)
local officerColor = ("\124cff%.2x%.2x%.2x"):format( r*255, g*255, b*255 )
local totalMembers, onlineMembers = GetNumGuildMembers()
local scanTotal = GetGuildRosterShowOffline() and totalMembers or onlineMembers--Attempt CPU saving, if "show offline" is unchecked, we can reliably scan only online members instead of whole roster
for i=1, scanTotal do
local name, rank, rankIndex, level, class, zone, note, offnote, connected, status, engClass, achPoints, achRank, isMobile = GetGuildRosterInfo(i)
if not name then break end
if connected or isMobile then
name = Ambiguate(name, "none")
local notes = note ~= "" and (offnote == "" and note or ("%s |cffffcc00-|r %s%s"):format(note, officerColor, offnote)) or
offnote == "" and "|cffffcc00-" or officerColor..offnote
if status == 0 then status = ""
elseif status == 1 then status = CHAT_FLAG_AFK
elseif status == 2 then status = CHAT_FLAG_DND
end
if(isMobile and not connected) then zone = REMOTE_CHAT; end;--They are mobile only.
guildEntries[#guildEntries+1] = new( ClassL[class] or "", name or "", level or "", zone or UNKNOWN, notes, isMobile and L["<Mobile>"] or status or "", rankIndex or 0, rank or 0, i, isMobile )
end end
UpdateGuildBlockText()
if isGuild and f:IsShown() then UpdateTablet() end
end
function f:PLAYER_GUILD_UPDATE(unit)
if unit and unit ~= "player" then return end
if IsInGuild() then GuildRoster() end
end
local hordeZones = "Orgrimmar,Undercity,Thunder Bluff,Durotar,Tirisfal Glades,Mulgore,Eversong Woods,Northern Barrens,Silverpine Forest,Ghostlands,Lost Isles,Kezan,Azshara,Shrine of Two Moons,Frostfire Ridge,Warspear,Zuldazar,Vol'dun,Nazmir,"
local allianceZones = "Ironforge,Stormwind City,Darnassus,The Exodar,Redridge Mountains,Azuremyst Isle,Bloodmyst Isle,Darkshore,Deeprun Tram,Dun Morogh,Elwynn Forest,Loch Modan,Teldrassil,Westfall,Gilneas City,Gilneas,Shrine of Seven Stars,Shadowmoon Valley,Stormshield,Boralus Harbor,Drustvar,Stormsong Valley,Tiragarde Sound,"
local sanctuaryZones = "Shattrath,Dalaran,Oribos,Valdrakken,Dornogal,Silvermoon City,"
local zoneCache = {}
local function GetZoneColor(zone)
if zoneCache[zone] then
return unpack(colors[zoneCache[zone]])
end
local zoneType
-- Remove me in Midnight
local _, _, _, TOC = GetBuildInfo()
if TOC < 120000 and zone == "Silvermoon City" then
zoneType = horde and "friendlyZone" or "enemyZone"
elseif sanctuaryZones:find(zone..",") then
zoneType = "friendlyZone"
elseif hordeZones:find(zone..",") then
zoneType = horde and "friendlyZone" or "enemyZone"
elseif allianceZones:find(zone..",") then
zoneType = horde and "enemyZone" or "friendlyZone"
else
zoneType = "contestedZone"
end
zoneCache[zone] = zoneType
return unpack(colors[zoneType])
end
local function UpdateBlockHints()
if f.onBlock then
if config.showBlockHints then
tip:SetOwner(f, "ANCHOR_NONE")
tip:SetPoint( f.isTop and "TOP" or "BOTTOM", f, f.isTop and "BOTTOM" or "TOP" )
tip:AddLine(format("%s |cffffffff%s|r", L["Hints"], L["Block"]))
if config.hbOpenPanel then tip:AddLine(format("|cffff8020%s|r %s", L["Click"], L["to open panel."]), 0.2, 1, 0.2) end
if config.hbConfig then tip:AddLine(format("|cffff8020%s|r %s", L["RightClick"], L["to display config menu."]), 0.2, 1, 0.2) end
if not isGuild then
if config.hbAddFriend then
tip:AddLine(format("|cffff8020%s|r %s", L["MiddleClick"], L["to add a friend."]), 0.2, 1, 0.2)
tip:AddLine(format("|cffff8020%s|r %s", L["Modifier+Click"], L["to add a friend."]), 0.2, 1, 0.2)
end
end
if config.hbToggleNotes then tip:AddLine(format("|cffff8020%s|r %s", L["Button4"], L["to toggle notes."]), 0.2, 1, 0.2) end
if tip:NumLines() > 1 then tip:Show() else tip:Hide() end
else
tip:Hide()
end
end
end
local CanEditOfficerNote = CanEditOfficerNote or C_GuildInfo.CanEditOfficerNote
local function ShowHints(btn,config)
if not config.hideHints and btn and btn.unit then
local showBelow = UIParent:GetHeight()/config.scale-f:GetTop() < f:GetBottom()
tip:SetOwner(f, "ANCHOR_NONE")
tip:SetPoint(showBelow and "TOP" or "BOTTOM", f, showBelow and "BOTTOM" or "TOP")
tip:AddLine(L["Hints"])
if config.hWhisp then tip:AddLine(format("|cffff8020%s|r %s", L["Click"], L["to whisper."]), .2,1,.2) end
if config.hInvite and (not btn.presenceID or btn.sameRealm) then tip:AddLine(format("|cffff8020%s|r %s", L["Alt+Click"], L["to invite."]), .2,1,.2) end
if config.hQuery and not btn.presenceID then tip:AddLine(format("|cffff8020%s|r %s", L["Shift+Click"], L["to query information."]), .2, 1, .2) end
if config.hNote and (not isGuild or CanEditPublicNote()) then tip:AddLine(format("|cffff8020%s|r %s", L["Ctrl+Click"], L["to edit note."]), .2, 1, .2) end
if isGuild then
if config.hONote and CanEditOfficerNote() then tip:AddLine(format("|cffff8020%s|r %s", L["Ctrl+RightClick"], L["to edit officer note."]), .2, 1, .2) end
else
if config.hRemoveFriend then tip:AddLine(format("|cffff8020%s|r %s", L["MiddleClick"], L["to remove friend."]), .2, 1, .2) end
end
if not btn.presenceID then
if config.hOrderA then tip:AddLine(format("|cffff8020%s|r %s", L["RightClick"], L["to sort main column."]), .2, 1, .2) end
if config.hOrderB then tip:AddLine(format("|cffff8020%s|r %s", L["Shift+RightClick"], L["to sort second column."]), .2, 1, .2) end
if config.hOrderC then tip:AddLine(format("|cffff8020%s|r %s", L["Alt+RightClick"], L["to sort third column."]), .2, 1, .2) end
end
if config.hResizeTip then tip:AddLine(format("|cffff8020%s|r %s", L["Ctrl+MouseWheel"], L["to resize tooltip."]), .2, 1, .2) end
if tip:NumLines() > 1 then tip:Show() end
end
end
local highlight = f:CreateTexture()
highlight:SetTexture"Interface\\QuestFrame\\UI-QuestTitleHighlight"
highlight:SetBlendMode"ADD"
highlight:SetAlpha(0)
local function Menu_OnEnter(b)
if b and b.index then
if b.index > 0 then
highlight:SetAllPoints(b)
highlight:SetAlpha(1)
ShowHints(b,config)
-- elseif not isGuild and config.showOwnBroadcast or CanEditMOTD() then
-- highlight:ClearAllPoints()
-- highlight:SetPoint("TOPLEFT", b, GAP, 2)
-- highlight:SetSize(b:GetWidth()-GAP, b:GetHeight()-BUTTON_HEIGHT+4)
-- highlight:SetAlpha(1)
end
end
end
local function Menu_OnLeave(b)
highlight:ClearAllPoints()
tip:Hide()
if b then highlight:SetAlpha(0) end
if not f:IsMouseOver() then f:Hide() end
end
local function MOTD_OnClose(edit)
edit:ClearAllPoints()
edit:SetParent(edit.prevParent)
edit:SetPoint(unpack(edit.prevPoint))
end
local function LoadBlizzardAddons()
if IsAddOnLoaded"Blizzard_GuildUI" then return end
LoadAddOn"Blizzard_Calendar"
LoadAddOn"Blizzard_GuildUI"
end
local function EditMOTD()
f:Hide()
LoadBlizzardAddons()
local edit = GuildTextEditFrame
edit.prevPoint = { edit:GetPoint() }
edit.prevParent = edit:GetParent()
edit:ClearAllPoints()
edit:SetParent(UIParent)
edit:SetPoint("CENTER", 0, 180)
GuildTextEditFrame_Show"motd"
edit:HookScript("OnHide", MOTD_OnClose)
end
local function EditBroadcast()
f:Hide()
StaticPopup_Show"SET_BN_BROADCAST"
end
local InviteUnit = InviteUnit or C_PartyInfo.InviteUnit
local function OnGuildmateClick( self, button )
if not( self and self.unit ) then return end
if (isGuild or not self.presenceID) and button == "RightButton" and not IsControlKeyDown() then
local level = IsShiftKeyDown() and 2 or IsAltKeyDown() and 3 or 1
local btn, ofx = buttons[1], GAP*.25
local pos = GetCursorPosition() / self:GetEffectiveScale()
for v, i in next, colpairs do
local b = btn[v]
if b:IsShown() and pos >= b:GetLeft() - ofx and pos <= b:GetRight() + ofx then
local sortCols, sortASC = config.sortCols[isGuild], config.sortASC[isGuild]
if sortCols[level] == v then
sortASC[level] = not sortASC[level]
else
sortCols[level] = v
sortASC[level] = v ~= "level"
end
sortIndexes[isGuild][level] = i
return f:IsShown() and UpdateTablet()
end
end
elseif button == "MiddleButton" and not isGuild then
if self.presenceID then
StaticPopup_Show("CONFIRM_REMOVE_FRIEND", self.realID, nil, self.presenceID)
else
RemoveFriend( self.unit )
end
elseif IsAltKeyDown() then
if self.presenceID and self.unitrealm ~= "" then
local name = self.unit.."-"..self.unitrealm
InviteUnit(name)
else
InviteUnit( self.unit )
end
elseif IsControlKeyDown() then
if not isGuild then
FriendsFrame.NotesID = self.presenceID or self.realIndex
if self.presenceID then
StaticPopup_Show( "SET_BNFRIENDNOTE", self.realID )
else
StaticPopup_Show( "SET_FRIENDNOTE", self.unit )
end
elseif button == "LeftButton" and CanEditPublicNote() or button ~= "LeftButton" and CanEditOfficerNote() then
SetGuildRosterSelection( self.realIndex )
StaticPopup_Show( button == "LeftButton" and "SET_GUILDPLAYERNOTE" or "SET_GUILDOFFICERNOTE" )
end
else
if self.presenceID then
local name = self.realID..":"..self.presenceID
SetItemRef( "BNplayer:"..name, ("|HBNplayer:%1$s|h[%1$s]|h"):format(name), "LeftButton" )
else
SetItemRef( "player:"..self.unit, ("|Hplayer:%1$s|h[%1$s]|h"):format(self.unit), "LeftButton" )
end
end
end
local function Scroll(self, delta)
if IsControlKeyDown() then
config.scale = config.scale - delta * 0.05
UpdateTablet()
-- elseif IsShiftKeyDown() then
-- GAP = GAP - delta
-- UpdateTablet()
else
slider:SetValue( sliderValue - delta * (IsModifierKeyDown() and 10 or 3) )
end
end
local function CreateFS( parent, justify, anchor, offsetX, color )
local fs = parent:CreateFontString( nil, "OVERLAY", "SystemFont_Shadow_Med1" )
if justify then fs:SetJustifyH( justify ) end
if anchor then fs:SetPoint( "LEFT", anchor, "RIGHT", offsetX or GAP, 0 ) end
if color then fs:SetTextColor(unpack(color)) end
return fs
end
local function CreateTex( parent, anchor, offsetX )
local tex = parent:CreateTexture()
tex:SetSize( ICON_SIZE, ICON_SIZE )
tex:SetPoint( "LEFT", anchor or parent, anchor and "RIGHT" or "LEFT", offsetX or 0, 0 )
return tex
end
local sep = f:CreateTexture()
local broadcasts = setmetatable( {}, { __index = function( table, index )
local bc = CreateFrame( "Button", nil, f )
table[index] = bc
bc:SetHeight(BUTTON_HEIGHT)
bc:SetNormalFontObject(GameFontNormal)
-- bc:RegisterForClicks"LeftButtonUp"
-- bc:SetScript("OnClick", FriendBroadcast_OnClick)
bc.icon = CreateTex( bc, nil, ICON_SIZE + TEXT_OFFSET )
bc.icon:SetTexture"Interface\\FriendsFrame\\BroadcastIcon"
bc.icon:SetTexCoord(.1,.9,.1,.9)
bc.text = CreateFS( bc, "LEFT", bc.icon, TEXT_OFFSET, colors.broadcast )
bc.text:SetHeight(BUTTON_HEIGHT)
return bc
end } )
toasts = setmetatable( {}, { __index = function( table, key )
local button = CreateFrame( "Button", nil, f )
table[key] = button
button.index = key
button:SetNormalFontObject(GameFontNormal)
button:RegisterForClicks"AnyUp"
button:SetScript( "OnEnter", Menu_OnEnter )
button:SetScript( "OnLeave", Menu_OnLeave )
button:SetScript( "OnClick", OnGuildmateClick )
button:SetHeight( BUTTON_HEIGHT )
button.class = CreateTex( button )
button.status = CreateTex( button, button.class, TEXT_OFFSET )
button.status:SetTexCoord(.1, .9, .1, .9)
button.name = CreateFS( button, config.alignName, button.status, TEXT_OFFSET )
button.level = CreateFS( button, "CENTER", button.name, GAP )
button.faction = CreateTex( button, button.level, GAP )
button.zone = CreateFS( button, config.alignZone, button.faction, TEXT_OFFSET )
button.note = CreateFS( button, config.alignNote, button.zone, GAP, colors.note )
return button
end } )
buttons = setmetatable( { }, { __index = function( table, key )
local button = CreateFrame( "Button", nil, f )
table[key] = button
button.index = key
button:SetNormalFontObject(GameFontNormal)
button:RegisterForClicks"AnyUp"
button:SetScript( "OnEnter", Menu_OnEnter )
button:SetScript( "OnLeave", Menu_OnLeave )
if key == 0 then
motd = button
motd.name = CreateFS( motd, "LEFT" )
motd:Show()
motd.name:SetJustifyV"TOP"
motd.name:SetPoint( "TOPLEFT", motd, "TOPLEFT" )
sep = motd:CreateTexture()
sep:SetTexture"Interface\\FriendsFrame\\UI-FriendsFrame-OnlineDivider"
sep:SetPoint("TOPLEFT", motd, "BOTTOMLEFT", 0, BUTTON_HEIGHT)
sep:SetPoint("BOTTOMRIGHT", motd, "BOTTOMRIGHT", 0, 0)
else
button:SetHeight( BUTTON_HEIGHT )
button.class = button:CreateTexture()
button.class:SetSize( ICON_SIZE, ICON_SIZE )
button.class:SetPoint( "LEFT", button, "LEFT" )
button.status = CreateTex( button, button.class, TEXT_OFFSET )
button.status:SetTexCoord(.1, .9, .1, .9)
button.name = CreateFS( button, config.alignName )
button.name:SetPoint( "LEFT", button.class, "RIGHT", TEXT_OFFSET, 0 )
button.level = CreateFS( button, "CENTER", button.name )
button.zone = CreateFS( button, config.alignZone, button.level )
button.note = CreateFS( button, config.alignNote, button.zone, GAP, colors.note )
button.rank = CreateFS( button, config.alignRank, button.note, GAP, colors.rank )
end
return button
end } )
local function SetClassOrCheckIcon( tex, inGroup, name, class )
local isGrouped = inGroup and inGroup(name)
if inGroup and (isGrouped or not config.showUngroupedClassIcon) then
tex:SetTexture( isGrouped and "Interface\\Buttons\\UI-CheckBox-Check" or "" )
tex:SetTexCoord( .15, .85, .15, .85 )
else
tex:SetTexture"Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes"
local offset, left, right, bottom, top = 0.025, unpack( CLASS_BUTTONS[class] )
tex:SetTexCoord( left+offset, right-offset, bottom+offset, top-offset )
end
end
local function SetStatusLayout( isMobile, isAFK, isDND, statusTex, fs )
if config.statusMode == "icon" then
if isMobile then
statusTex:SetTexture("Interface\\ChatFrame\\UI-ChatIcon-ArmoryChat")
if isAFK then statusTex:SetVertexColor(1,.6,.1)
elseif isDND then statusTex:SetVertexColor(1,.1,.1)
else statusTex:SetVertexColor(.1,1,.1--[[.4,.4,1]]) end
else
statusTex:SetTexture("Interface\\FriendsFrame\\StatusIcon-"..(isAFK and "Away" or isDND and "DnD" or "Online"))
statusTex:SetVertexColor(1,1,1)
end
statusTex:Show()
fs:SetPoint("LEFT", statusTex, "RIGHT", TEXT_OFFSET, 0)
else
statusTex:Hide()
fs:SetPoint("LEFT", statusTex, "LEFT")
end
end
local function SetButtonData( index, inGroup )
local button = buttons[index]
if index == 0 then
button.name:SetText(inGroup)
return button, button.name:GetStringWidth()
end
local class, name, level, zone, notes, status, _, rank, realIndex, isMobile = unpack( (isGuild and guildEntries or friendEntries)[index] )
button.unit = name
button.realIndex = realIndex
button.name:SetFormattedText( (status and preformatedStatusText or "")..(name or""), status )
if name and class and class ~= "" then
local color = RAID_CLASS_COLORS[class]
if color then--Check if this is nil, in case some mod or user corrupted RAID_CLASS_COLORS or CUSTOM_CLASS_COLORS
button.name:SetTextColor( color.r, color.g, color.b )
SetClassOrCheckIcon( button.class, inGroup, name, class )
-- SetStatusLayout( random() > .5, random() > 2/3, random() > .5, button.status, button.name ) -- DEBUG
SetStatusLayout( isMobile, status == CHAT_FLAG_AFK, status == CHAT_FLAG_DND, button.status, button.name )
color = GetDifficultyColor(level)
button.level:SetTextColor( color.r, color.g, color.b )
button.zone:SetTextColor( GetZoneColor(zone) )
end
end
button.level:SetText( level or "" )
button.zone:SetText( zone or "" )
button.note:SetText( notes or "" )
button.rank:SetText( rank or "" )
return button,
button.name:GetStringWidth(),
button.level:GetStringWidth(),
button.zone:GetStringWidth(),
button.note:GetStringWidth(),
rank and button.rank:GetStringWidth() or -GAP
end
local function SetToastData( index, inGroup )
local presenceID, presenceName, battleTag, isBattleTagPresence, toonName, toonID, client, isOnline, lastOnline, isAFK, isDND, broadcast, notes, _, _, _, _, _, isFavorite = GetBNGetFriendInfo(index)
--toasts[index].isOnline = isOnline
--toasts[index].isFavorite = isFavorite
if not isOnline and not isFavorite then return nil end
local toast, bc, color = toasts[index]
local _, _, game, realm, realmID, faction, race, class, guild, zone, level, gameText, _, _, _, _, _, isGameAFK, isGameBusy, guid, wowProjectID = GetBNGetGameAccountInfo(toonID or 0)
local statusText = config.statusMode ~= "icon" and (isAFK or isDND) and (preformatedStatusText):format(isAFK and CHAT_FLAG_AFK or isDND and CHAT_FLAG_DND) or ""
if (config.enableBnetFriendsBroadcasts) then
if broadcast and broadcast ~= "" then
nbBroadcast = nbBroadcast + 1
bc = broadcasts[nbBroadcast]
bc.text:SetText(broadcast)
toast.bcIndex = nbBroadcast
else
toast.bcIndex = nil
end
else
toast.bcIndex = nil
end
toast.presenceID = presenceID
toast.unit = BNet_GetValidatedCharacterName and BNet_GetValidatedCharacterName(toonName, battleTag, client) or toonName
toast.realID = presenceName
toast.unitrealm = realm
SetStatusLayout( --[[isMobile]]false, isAFK, isDND, toast.status, toast.name )
client = clientsTable[client] or 5--Set client to desktop app if unknown
toast.client = client
if client == 1 then--World of Warcraft
toast.faction:SetTexture"Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Factions"
toast.faction:SetTexCoord( faction == "Alliance" and 0.03 or 0.53, faction == "Alliance" and 0.47 or 0.97, 0.03, 0.97 )
if type(wowProjectID) ~= "boolean" and wowProjectID ~= WOW_PROJECT_ID then--WOW_PROJECT_ID should be the users client, so if it doesn't match users client the zone is in gameText
zone = gameText or UNKNOWN
local zonesplit, realmSplit = strsplit("-", zone)
if zonesplit and realmSplit then--gameText was actuall zone-realm
zone = zonesplit
realm = realmSplit
toast.unitrealm = realmSplit
end
else
zone = not gameText and (not zone or zone == "") and UNKNOWN or gameText or zone
end
toast.zone:SetPoint("TOPLEFT", toast.faction, "TOPRIGHT", TEXT_OFFSET, 0)
toast.zone:SetTextColor( GetZoneColor(zone) )
toast.sameRealm = realm == "" or realm == playerRealm
if not toast.sameRealm then
-- hide faction icon and move zone to level
local r,g,b = unpack(colors.realm)
zone = ("%1$s |cff%3$.2x%4$.2x%5$.2x- %2$s"):format(zone, realm or UNKNOWN, r*255, g*255, b*255)
end
class = ClassL[class]
if class and class~="" then
SetClassOrCheckIcon( toast.class, inGroup, toonName, class )
color = RAID_CLASS_COLORS[class]
toast.name:SetTextColor( color.r, color.g, color.b )
else
toast.class:SetTexture"Interface\\FriendsFrame\\Battlenet-WoWicon"
toast.class:SetTexCoord( .2, .8, .2, .8 )
toast.name:SetTextColor(.8,.8,.8)
end
elseif client == 0 then--Battle.net Mobile
toast.class:SetTexture"Interface\\FriendsFrame\\Battlenet-Battleneticon"
toast.class:SetTexCoord( .2, .8, .2, .8 )
toast.name:SetTextColor( .8, .8, .8 )
toast.faction:SetTexture""
zone = L["Mobile App"]
toast.zone:SetPoint("TOPLEFT", toast.name, "TOPRIGHT", GAP, 0)
toast.zone:SetTextColor( 1, .77, 0 )
elseif client == 5 or client == 8 then--Battle.net Desktop
toast.class:SetTexture"Interface\\FriendsFrame\\Battlenet-Battleneticon"
toast.class:SetTexCoord( .2, .8, .2, .8 )
toast.name:SetTextColor( .8, .8, .8 )
toast.faction:SetTexture""
if isOnline then
zone = L["Desktop App"]
else
zone = L["OFFLINE FAVORITE"]
toast.class:SetTexture"Interface\\FriendsFrame\\StatusIcon-Offline"
end
toast.zone:SetPoint("TOPLEFT", toast.name, "TOPRIGHT", GAP, 0)
toast.zone:SetTextColor( 1, .77, 0 )
else
if clientTextures[client] then
toast.class:SetTexture(clientTextures[client])
end
toast.class:SetTexCoord( .2, .8, .2, .8 )
toast.name:SetTextColor( .8, .8, .8 )
toast.faction:SetTexture""
zone = gameText
toast.zone:SetPoint("TOPLEFT", toast.name, "TOPRIGHT", GAP, 0)
toast.zone:SetTextColor( 1, .77, 0 )
end
if config.realID == "none" then
toast.name:SetText(toast.unit or "")
else
local rid = "|cff00b2f0"..toast.realID.."|r"
if config.realID == "instead" then
toast.name:SetText( statusText.. rid)
else
toast.name:SetFormattedText( statusText..(config.realID=="before" and "%1$s - %2$s" or "%2$s - %1$s"), rid, toast.unit or "")
end
end
if level and level ~= "" and level ~= 0 then
toast.level:SetText(level)
color = GetDifficultyColor(tonumber(level))
toast.level:SetTextColor( color.r, color.g, color.b )
else toast.level:SetText"" end
-- toast.raceIcon:SetTexture"Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Races"
-- toast.raceIcon:SetTexCoord( )
toast.zone:SetText(zone or "")
toast.note:SetText(notes or "")
return toast, client,
toast.name:GetStringWidth(),
client == 1 and toast.level:GetStringWidth() or -GAP,
toast.zone:GetStringWidth(),
toast.note:GetStringWidth()
end
local function UpdateScrollButtons(nbEntries)
for i=1, #buttons do buttons[i]:Hide() end
local baseOffset = -realFriendsHeight
local sliderValue = hasSlider and sliderValue or 0
for i=1, nbEntries do
local button = buttons[sliderValue+i]
button:SetPoint("TOPLEFT", motd, "BOTTOMLEFT", 0, baseOffset - (i-1)*BUTTON_HEIGHT)
button:Show()
end
end
local tiptacBKG = { tile = false, insets = {} }
-- Setup Gradient Tip (from TipTac)
local function SetupGradientTip(tip,cfg)
local g = tip.ttGradient;
if (not cfg.gradientTip) then
if (g) then
g:Hide();
end
return;
elseif (not g) then
g = tip:CreateTexture();
g:SetTexture(1,1,1,1);
tip.ttGradient = g;
end
g:SetGradient("VERTICAL",CreateColor(0,0,0,0),CreateColor(unpack(cfg.gradientColor)));
g:SetPoint("TOPLEFT",cfg.backdropInsets,cfg.backdropInsets * -1);
g:SetPoint("BOTTOMRIGHT",tip,"TOPRIGHT",cfg.backdropInsets * -1,-36);
g:Show();
end
local function AnchorTablet(frame)
CloseDropDownMenus()
-- f:GUILD_ROSTER_UPDATE()
f:Show()
f.isTop, f.onBlock = select(2, frame:GetCenter()) > UIParent:GetHeight() / 2, true
f:ClearAllPoints()
f:SetPoint(f.isTop and "TOP" or "BOTTOM", frame, f.isTop and "BOTTOM" or "TOP")
if config.useTipTacSkin and TipTac then
local playerName = UnitName("player")
local realmName = GetRealmName()
local keyName = playerName .. " - " .. realmName
local TTProfileKey = TipTac_Config.profileKeys[keyName]
local cfg = TipTac_Config.profiles[TTProfileKey]
tiptacBKG.bgFile = cfg.tipBackdropBG
tiptacBKG.edgeFile = cfg.tipBackdropEdge
tiptacBKG.edgeSize = cfg.backdropEdgeSize
tiptacBKG.insets.left = cfg.backdropInsets
tiptacBKG.insets.right = cfg.backdropInsets
tiptacBKG.insets.top = cfg.backdropInsets
tiptacBKG.insets.bottom = cfg.backdropInsets
f:SetBackdrop(tiptacBKG)
f:SetBackdropColor(unpack(cfg.tipColor))
f:SetBackdropBorderColor(unpack(cfg.tipBorderColor))
SetupGradientTip(f,cfg)
elseif Skinner then
Skinner:applySkin(f)
else
f:SetBackdrop(backdrop)
if f.ttGradient then f.ttGradient:Hide() end
f:SetBackdropColor( unpack( colors.background ) )
f:SetBackdropBorderColor( unpack( colors.border ) )
end
UpdateBlockHints()
UpdateTablet()
end
local texOrder1 = f:CreateTexture()
texOrder1:SetTexture"Interface\\Buttons\\WHITE8X8"
texOrder1:SetBlendMode"ADD"
local function SortMates(a,b)
local s = sortIndexes[isGuild]
local si, lv = s[1], 1
if a[si] == b[si] then
si, lv = s[2], 2
if a[si] == b[si] then
si, lv = s[3], 3
end
end
if config.sortASC[isGuild][lv] then
return a[si] < b[si]
else
return a[si] > b[si]
end
end
local function si(value)
if type(value) ~= "number" or value < 1e3 then return tostring(value) end
local l = floor(log10(value))
return ("%%.%if%s"):format(2-l%3, l<6 and"k"or"m"):format( value/10^(floor(l/3)*3) ):gsub('%.?0+([km])$', '%1')
end
local baseFont = GameFontNormal:GetFont()
UpdateTablet = function()
f:SetScale(config.scale)
local totalRF, onlineRF, entries = 0, 0
if isGuild then
entries = guildEntries
nbRealFriends = 0
else
entries = friendEntries
totalRF, onlineRF, numBNetFavorite, numBNetFavoriteOnline = BNGetNumFriends()
local offlineFavorites = 0
if numBNetFavorite and numBNetFavoriteOnline then--Don't exist in classic at this time
offlineFavorites = numBNetFavorite - numBNetFavoriteOnline
end
nbRealFriends = onlineRF + offlineFavorites--Adjust for offline favorites that are stuck taking up entry spaces
end
local nbTotalEntries = #entries + nbRealFriends
local rid_width, button = 0
realFriendsHeight = 0
local nameC, levelC, zoneC, notesC, rankC = 0, 0, 0, 0, -GAP
local nameW, levelW, zoneW, notesW, rankW
local hideNotes = isGuild and not config.showGuildNotes or not (isGuild or config.showFriendNotes)
local inGroup = GetNumGroupMembers()>0 and (IsInRaid() and UnitInRaid or UnitInParty or nil)
local tnC, lC, zC, nC = 0, -GAP, -GAP, 0
local spanZoneC = 0
--Pulls bnet friend toast data
if nbRealFriends > 0 then
nbBroadcast = 0
for i=1, nbRealFriends do
local button, client, tnW, lW, zW, nW, spanZoneW = SetToastData(i,inGroup)
if button then--Rejects offline friends (except for favorates)
if tnW>tnC then tnC=tnW end
if client == 1 then
if lW>lC then lC=lW end
if zW>zC then zC=zW end
else
if zW > spanZoneC then spanZoneC = zW end
end
if nW>nC then nC=nW end
end
end
realFriendsHeight = (nbRealFriends+nbBroadcast) * BUTTON_HEIGHT + (#entries>0 and GAP or 0)
if hideNotes then nC = -GAP end
spanZoneC = max( spanZoneC, lC + GAP + ICON_SIZE + TEXT_OFFSET + zC )
rid_width = ICON_SIZE + TEXT_OFFSET + tnC + spanZoneC + nC + 2*GAP
end
--Handles non bnet friends and guild members
sort(entries,SortMates)
for i = 1, #entries do
button, nameW, levelW, zoneW, notesW, rankW = SetButtonData( i, inGroup )
button:SetScript( "OnClick", OnGuildmateClick )
if nameW > nameC then nameC = nameW end
if levelW and levelW>0 then
if levelW > levelC then levelC = levelW end
if zoneW > zoneC then zoneC = zoneW end
if notesW > notesC then notesC = notesW end
if rankW > rankC then rankC = rankW end
if hideNotes then button.note:Hide() else button.note:Show() end
button.rank:SetPoint( "TOPLEFT", hideNotes and button.zone or button.note, "TOPRIGHT", GAP, 0 )
end
end
if hideNotes then notesC = -GAP end
local maxWidth = max( rid_width, ICON_SIZE + TEXT_OFFSET + nameC + levelC + zoneC + notesC + rankC + GAP * 4 )
if config.statusMode=="icon" then maxWidth = maxWidth + ICON_SIZE + TEXT_OFFSET end
-- guild xp / motd / broadcast
local canEditMOTD = CanEditMOTD()
motd:SetPoint("TOPLEFT", GAP, -GAP)
motd:SetScript("OnClick",nil)
local guildMOTD = isGuild and (not InCombatLockdown() and GetGuildRosterMOTD() or L["MOTD Unavailable due to combat lockdown."])
if isGuild and (nbTotalEntries>0 and guildMOTD or nbTotalEntries==0) or not isGuild and (BNFeaturesEnabled() and totalRF>0 and config.showOwnBroadcast or nbTotalEntries==0) then
motd.name:SetJustifyH"LEFT"
motd.name:SetTextColor( unpack(colors.title) )
local r, g, b = unpack(colors.motd)
local motdText = ("%%s: |cff%.2x%.2x%.2x%%s"):format(r*255, g*255, b*255)
if isGuild then
SetButtonData( 0, nbTotalEntries>0 and motdText:format(L["MOTD"], guildMOTD) or " |cffff2020"..ERR_GUILD_PLAYER_NOT_IN_GUILD )
if nbTotalEntries>0 and canEditMOTD then motd:SetScript( "OnClick", EditMOTD ) end
else
if nbTotalEntries == 0 then
SetButtonData( 0, " |cffff2020"..L["No friends online."] )
elseif not BNConnected() then