Repository navigation
Expand file tree
/
Copy pathParty.lua
More file actions
2534 lines (2402 loc) · 109 KB
/
Copy pathParty.lua
File metadata and controls
2534 lines (2402 loc) · 109 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
-- Webby Frames: party frames
-- Two styles, one set of "party" options (the Party page's Style):
-- * Portrait frames: four small frames (party1 - party4). Slot 1 is frames.party and sits where it was
-- put; slots 2 - 4 stack under it, partyGap apart. The frames themselves are the small frames
-- WebbyFrames.lua builds (createSmallFrame); this file is what's party only: placing the slots, role
-- order, each member's pet, the role / leader / ready check / status icons, the threat glow and fading
-- out of range.
-- * Raid style: flat tiles (see "Raid style" below).
-- Loads after WebbyFrames.lua (see the .toc), which shares its helpers through ns.
local _, ns = ...
local Party = ns.Party
local getSetting, frameOn, applyUnit, updateAll, threatColor = ns.getSetting, ns.frameOn, ns.applyUnit, ns.updateAll, ns.threatColor
local AuraKit, ART, BAR_FILE, POWER_FILE, CIRCLE_FALLBACK = ns.AuraKit, ns.ART, ns.BAR_FILE, ns.POWER_FILE, ns.CIRCLE_FALLBACK
local hasAtlas, newBar, setArt, setFileMask, resolveFont = ns.hasAtlas, ns.newBar, ns.setArt, ns.setFileMask, ns.resolveFont
local resolveTexture, defaultTip, unitData = ns.resolveTexture, ns.defaultTip, ns.unitData
local isSecret, plain = ns.isSecret, ns.plain
-- Showing and hiding by unit: the game's unit watch (shown while the unit exists). For every frame
-- (applyShown, Edit Mode).
function Party.watch(f) RegisterUnitWatch(f) end
function Party.unwatch(f) UnregisterUnitWatch(f) end
-- Slot 2 - 5: under the slot before it, or to its right (Layout: Side by side). Side by side leaves room
-- for buffs and debuffs to the right of each frame.
function Party.place(f)
local prev = Party.members[f.partyIndex - 1]
if not prev then return end
local gap = tonumber(getSetting("party", "partyGap")) or 6
f:ClearAllPoints()
if getSetting("party", "partyLayout") == "horizontal" then
f:SetPoint("TOPLEFT", prev, "TOPRIGHT", gap + Party.sideRoom(), 0)
else
f:SetPoint("TOPLEFT", prev, "BOTTOMLEFT", 0, -(gap + Party.belowRoom(prev)))
end
end
-- Room taken beside a party frame (side-by-side layout) and under it (stacked): its buffs and debuffs
-- when they sit beside it, its pet's mini frame.
function Party.sideRoom()
local w = 0
if getSetting("party", "auraPos") == "side" and (getSetting("party", "auraBuffs") or getSetting("party", "auraDebuffs")) then
local size, gap = getSetting("party", "auraSize") or 16, getSetting("party", "auraGap") or 2
w = w + (getSetting("party", "auraPerRow") or 6) * (size + gap)
end
return w
end
-- (under a member: room for their pet's bar only while they have a pet out)
function Party.belowRoom(prev)
if not getSetting("party", "partyPets") then return 0 end
local has = prev.partySample and prev.partySample.pet and true or false
if not prev.partySample then
pcall(function() has = UnitExists(Party.petOf(prev.homeUnit or prev.wfUnit)) and true or false end)
end
-- (the pet's height, less what tucks under the frame and its art's own transparent bottom edge)
return has and math.floor(49 * Party.PET_SCALE - Party.PET_TUCK - 4 * Party.PET_SCALE + 0.5) or 0
end
-- partyN -> partypetN
function Party.petOf(unit)
return (tostring(unit):gsub("^party", "partypet"))
end
-- Every slot back in place (a pet came or went): out of combat only, else once it ends.
function Party.reflow()
if InCombatLockdown() then Party.pendingReflow = true; return end
Party.pendingReflow = nil
for i = 2, Party.SLOTS do
local f = Party.members[i]
if f then pcall(Party.place, f) end
end
end
-- Each member's pet: a small copy of the party frame itself (the same border art, round portrait,
-- health and power bars with their shaped ends, the name), at PET_SCALE of it, hung under the member's
-- frame (part of it, so it moves, scales and fades with it), clickable to target. One per party slot,
-- made at login (secure buttons can't be made in combat); shown while the pet exists (the game's unit
-- watch). Health, power and the name come from the pet's unit events. The portrait is a rendered
-- model, refreshed about every two seconds. Values only go to setters.
Party.PET_SCALE = 0.6
Party.PET_INDENT, Party.PET_TUCK = 24, 2 -- in from the member frame's portrait side; up under its bottom edge
Party.PET_EVENTS = { "UNIT_HEALTH", "UNIT_MAXHEALTH", "UNIT_POWER_UPDATE", "UNIT_MAXPOWER", "UNIT_DISPLAYPOWER", "UNIT_NAME_UPDATE" }
-- Listen to `unit`, or to nothing. A hidden pet is not listening. Same unit twice does nothing.
function Party.petListen(m, unit)
if m.petUnit == unit then return end
for _, e in ipairs(Party.PET_EVENTS) do pcall(m.UnregisterEvent, m, e) end
m.petUnit = unit
if not unit then return end
for _, e in ipairs(Party.PET_EVENTS) do pcall(m.RegisterUnitEvent, m, e, unit) end
end
function Party.makePet(f)
local m = CreateFrame("Button", "WebbyFrames_partypet" .. f.partyIndex, f, "SecureUnitButtonTemplate")
m:SetSize(120, 49)
m:SetScale(Party.PET_SCALE)
m:SetFrameLevel(f:GetFrameLevel() + 3)
m:SetHitRectInsets(0, 6, 4, 4)
m:RegisterForClicks("AnyUp")
m:SetAttribute("type1", "target")
m:SetAttribute("type2", "togglemenu")
m.kind = "partypet"
m.portrait = m:CreateTexture(nil, "BACKGROUND", nil, 1)
m.portrait:SetSize(37, 37)
m.pmask = m:CreateMaskTexture()
if hasAtlas("CircleMask") then m.pmask:SetAtlas("CircleMask") else
m.pmask:SetTexture(CIRCLE_FALLBACK, "CLAMPTOBLACKADDITIVE", "CLAMPTOBLACKADDITIVE")
end
m.pmask:SetAllPoints(m.portrait)
m.portrait:AddMaskTexture(m.pmask)
local pbg = m:CreateTexture(nil, "BACKGROUND", nil, 0)
pbg:SetColorTexture(0.05, 0.05, 0.05, 1)
pbg:SetAllPoints(m.portrait)
pbg:AddMaskTexture(m.pmask)
m.border = m:CreateTexture(nil, "BACKGROUND", nil, 3)
m.border:SetTexelSnappingBias(0)
m.border:SetSnapToPixelGrid(false)
m.hp, m.hpMask = newBar(m)
m.mp, m.mpMask = newBar(m)
local ov = CreateFrame("Frame", nil, m)
ov:SetAllPoints()
ov:SetFrameLevel(m:GetFrameLevel() + 5)
m.name = ov:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
m.name:SetSize(68, 14)
m.name:SetJustifyH("LEFT"); m.name:SetWordWrap(false)
m:SetScript("OnEnter", function(self)
pcall(function()
ns.defaultTip(self)
if GameTooltip:SetUnit(self:GetAttribute("unit")) ~= false then GameTooltip:Show() end
end)
end)
m:SetScript("OnLeave", function() GameTooltip:Hide() end)
m:SetScript("OnEvent", function(self)
if self:IsShown() then pcall(Party.paintPet, self, true) end
end)
m:HookScript("OnShow", function(self)
local u = self:GetAttribute("unit")
if u then Party.petListen(self, u) end
pcall(Party.paintPet, self)
end)
m:HookScript("OnHide", function(self) Party.petListen(self, nil) end)
m:Hide()
return m
end
-- The pet's art for the side its member's portrait is on (as applySmallLayout lays out the frame).
function Party.layoutPet(m, left)
if m.left == left then return end
m.left = left
m.portrait:ClearAllPoints()
m.portrait:SetPoint(left and "TOPLEFT" or "TOPRIGHT", m, left and "TOPLEFT" or "TOPRIGHT", left and 5 or -5, -5)
m.border:ClearAllPoints()
setArt(m.border, ART.smallBorder, not left)
m.border:SetPoint("CENTER", m, "CENTER", 0, 0)
m.hp:ClearAllPoints(); m.mp:ClearAllPoints()
m.hp:SetSize(70, 10.5)
m.hp:SetPoint("TOPLEFT", m, "TOPLEFT", left and 44 or 6, -16.5)
m.mp:SetSize(74, 7.5)
m.mp:SetPoint("TOPLEFT", m, "TOPLEFT", left and 40 or 6, -27.5)
m.hpTex, m.mpTex = nil, nil
m.name:ClearAllPoints()
if left then m.name:SetPoint("BOTTOMLEFT", m.hp, "TOPLEFT", 0, 1) else m.name:SetPoint("BOTTOMLEFT", m.hp, "TOPLEFT", 2, 1) end
m:SetHitRectInsets(left and 0 or 6, left and 6 or 0, 4, 4)
end
-- `barsOnly`: health, power and the name. The portrait and the font stay for a full paint.
function Party.paintPet(m, barsOnly)
local u = m:GetAttribute("unit")
if not (u and UnitExists(u)) then return end
local f = m:GetParent()
Party.layoutPet(m, f.layoutLeft ~= false)
-- border in the member frame's colour (Frame colour), as drawn otherwise
local c = f.tintColor
pcall(m.border.SetDesaturated, m.border, c and true or false)
if c then m.border:SetVertexColor(c[1], c[2], c[3]) else m.border:SetVertexColor(1, 1, 1) end
-- health: the party's chosen texture, or the frame's own green fill
local hpTex = f.customTex or (BAR_FILE.small .. "Health")
if m.hpTex ~= hpTex then
m.hpTex = hpTex
m.hp:SetStatusBarTexture(hpTex)
setFileMask(m.hp, m.hpMask, "uipartyframeportraitonhealthmask", 128, 16.5, -29, 3, not m.left)
if f.customTex then m.hp:SetStatusBarColor(0.1, 0.8, 0.1) else m.hp:SetStatusBarColor(1, 1, 1) end
end
-- power: the frame's fill for the pet's power type
local _, token = UnitPowerType(u)
if isSecret(token) then token = nil end
local mpTex = f.powerTex or (BAR_FILE.small .. (POWER_FILE[token or ""] or "Mana"))
if m.mpTex ~= mpTex then
m.mpTex = mpTex
m.mp:SetStatusBarTexture(mpTex)
setFileMask(m.mp, m.mpMask, "uipartyframeportraitonmanamask", 128, 16.5, -27, 4, not m.left)
end
-- (setters take hidden values as they are)
m.hp:SetMinMaxValues(0, UnitHealthMax(u)); m.hp:SetValue(UnitHealth(u))
m.mp:SetMinMaxValues(0, UnitPowerMax(u)); m.mp:SetValue(UnitPower(u))
m.name:SetText(UnitName(u))
if not barsOnly then
pcall(SetPortraitTexture, m.portrait, u)
local font = resolveFont(getSetting("party", "font"))
if m.font ~= font then
m.font = font
-- (its own font remembered, so Default goes back to it; other alphabets kept: ns.setFont)
if not m.name.wfFontOrig then m.name.wfFontOrig = { m.name:GetFont() } end
local o = m.name.wfFontOrig
pcall(ns.setFont, m.name, font or o[1], o[2], o[3])
end
end
if m.sampleName then m.name:SetText(m.sampleName) end -- (a sample member's pet)
end
-- A slot's pet: its unit (from the slot's unit), where it sits, on or off. Its unit and showing only
-- change out of combat; a change in combat waits (Party.arrange after it).
function Party.minis(f)
if not f.partyIndex then return end
if InCombatLockdown() then Party.pendingArrange = true; return end
local m = f.miniPet or Party.makePet(f)
f.miniPet = m
-- under the frame, in from its portrait side (offsets in the pet's own, smaller scale: its art's
-- transparent top edge tucks under the frame)
m:ClearAllPoints()
local s = Party.PET_SCALE
if f.layoutLeft == false then
m:SetPoint("TOPRIGHT", f, "BOTTOMRIGHT", -Party.PET_INDENT / s, Party.PET_TUCK / s)
else
m:SetPoint("TOPLEFT", f, "BOTTOMLEFT", Party.PET_INDENT / s, Party.PET_TUCK / s)
end
local s = f.partySample
m.sampleName = s and s.pet or nil
if s then
UnregisterUnitWatch(m)
m:SetAttribute("unit", "player")
m:SetShown((s.pet and getSetting("party", "partyPets")) and true or false)
else
m:SetAttribute("unit", Party.petOf(f.homeUnit or f.wfUnit))
if Party.portraitsOn() and getSetting("party", "partyPets") then RegisterUnitWatch(m) else UnregisterUnitWatch(m); m:Hide() end
end
Party.petListen(m, m:IsShown() and m:GetAttribute("unit") or nil)
pcall(Party.paintPet, m)
end
-- Portrait pets off: no unit watch and no pet events. Out of combat only (the watch is secure).
function Party.hidePets()
if InCombatLockdown() then return end
for i = 1, Party.SLOTS do
local m = Party.members[i] and Party.members[i].miniPet
if m then
UnregisterUnitWatch(m)
m:Hide()
Party.petListen(m, nil)
end
end
end
-- Which unit each slot shows: party1 - 4, as Blizzard orders them or by role (tank, healer, damage).
-- A slot's unit can only change out of combat; a change while in one waits for it to end.
local ROLE_RANK = { TANK = 1, HEALER = 2, DAMAGER = 3 }
function Party.arrange()
if InCombatLockdown() then Party.pendingArrange = true; return end
-- Portrait frames not in use (party off, or raid style): no role sort, no repaint of hidden slots.
if not Party.portraitsOn() then
Party.pendingArrange = nil
Party.hidePets()
return
end
if Party.testing then return end -- (the sample party keeps the slots; stopping it arranges)
Party.pendingArrange = nil
local list = {}
for i = 1, 4 do list[#list + 1] = "party" .. i end
if getSetting("party", "partySort") == "role" then
local rank = {}
for i, u in ipairs(list) do
local r = 9
pcall(function()
if UnitExists(u) then r = ROLE_RANK[UnitGroupRolesAssigned(u)] or 4 end
end)
rank[u] = r * 10 + i
end
table.sort(list, function(a, b) return rank[a] < rank[b] end)
end
for slot = 1, Party.SLOTS do
local f = Party.members[slot]
if f then
Party.setUnit(f, list[slot] or ("party" .. slot))
pcall(Party.minis, f)
end
end
-- (click casting again: a resurrect binding names each frame's unit)
if ns.Click and ns.Click.header then pcall(ns.Click.apply) end
end
-- Portrait frames sit hidden while the raid style is on. Drop their unit events until they are
-- shown again (applyShown). Other frames keep theirs.
-- Frame events (not unit events) a party slot also has. Silence drops them; listen puts them back.
Party.FRAME_EVENTS = { "GROUP_ROSTER_UPDATE", "PLAYER_ENTERING_WORLD" }
function Party.silence(f)
if not f or f.baseUnit ~= "party" then return end
for _, e in ipairs(Party.UNIT_EVENTS) do pcall(f.UnregisterEvent, f, e) end
for _, e in ipairs(Party.FRAME_EVENTS) do pcall(f.UnregisterEvent, f, e) end
end
function Party.listen(f)
if not f or f.baseUnit ~= "party" or f.wfOff then return end
local unit = f.homeUnit or f:GetAttribute("unit") or f.wfUnit
if not unit then return end
for _, e in ipairs(Party.UNIT_EVENTS) do
pcall(f.UnregisterEvent, f, e)
pcall(f.RegisterUnitEvent, f, e, unit)
end
for _, e in ipairs(Party.FRAME_EVENTS) do pcall(f.RegisterEvent, f, e) end
end
-- Gives a party slot another unit: its secure unit, its unit events, how it shows and hides, and a
-- repaint. (In Edit Mode it keeps showing you as the stand-in until Edit Mode closes.)
-- While the portrait frames are off, the events stay unregistered.
function Party.setUnit(f, unit)
if f.homeUnit == unit then return end
f.homeUnit = unit
f:SetAttribute("unit", unit)
if f.wfOff then Party.silence(f) else Party.listen(f) end
if not AuraKit.editing then
f.wfUnit = unit
if not f.wfOff then Party.watch(f) end
end
f.lastGUID = nil
pcall(updateAll, f)
if Party.minis then pcall(Party.minis, f) end
end
local ROLE_ATLAS = { TANK = "roleicon-tiny-tank", HEALER = "roleicon-tiny-healer", DAMAGER = "roleicon-tiny-dps" }
local READY_TEX = { ready = "READY_CHECK_READY_TEXTURE", notready = "READY_CHECK_NOT_READY_TEXTURE", waiting = "READY_CHECK_WAITING_TEXTURE" }
-- The role, leader and ready check icons on a party frame's portrait, made on first use.
function Party.icons(f)
if f.partyIcons then return f.partyIcons end
local p, ov = f.portrait, f.ov
local icons = {}
icons.role = ov:CreateTexture(nil, "OVERLAY", nil, 6)
icons.role:SetSize(14, 14)
icons.role:SetPoint("BOTTOMLEFT", p, "BOTTOMLEFT", -3, -3)
icons.leader = ov:CreateTexture(nil, "OVERLAY", nil, 6)
icons.leader:SetSize(13, 13)
icons.leader:SetPoint("BOTTOM", p, "TOP", -10, -5)
icons.leader:SetTexture("Interface\\GroupFrame\\UI-Group-LeaderIcon")
icons.ready = ov:CreateTexture(nil, "OVERLAY", nil, 7)
icons.ready:SetSize(22, 22)
icons.ready:SetPoint("CENTER", p, "CENTER")
-- aggro: a red copy of the frame's border art, glowing (added light)
icons.aggro = ov:CreateTexture(nil, "OVERLAY", nil, 5)
icons.aggro:SetPoint("TOPLEFT", f.border, "TOPLEFT")
icons.aggro:SetPoint("BOTTOMRIGHT", f.border, "BOTTOMRIGHT")
icons.aggro:SetBlendMode("ADD")
for _, t in pairs(icons) do t:Hide() end
f.partyIcons = icons
return icons
end
-- What's in the middle of a member's portrait, most pressing first: the ready check, then a summon
-- (pending, accepted, declined), an incoming resurrection, or being in another phase.
local SUMMON_ATLAS = { [1] = "Raid-Icon-SummonPending", [2] = "Raid-Icon-SummonAccepted", [3] = "Raid-Icon-SummonDeclined" }
function Party.centerIcon(u)
if Party.readyCheck or Party.readyLinger then
local status = plain(GetReadyCheckStatus, u)
local tex = status and READY_TEX[status] and _G[READY_TEX[status]]
if tex then return "file", tex end
end
local IS = C_IncomingSummon
local summon = IS and plain(IS.HasIncomingSummon, u) and plain(IS.IncomingSummonStatus, u)
if summon and SUMMON_ATLAS[summon] then return "atlas", SUMMON_ATLAS[summon] end
if plain(UnitHasIncomingResurrection, u) then return "file", "Interface\\RaidFrame\\Raid-Icon-Rez" end
local phased
if UnitPhaseReason then
local ok, why = pcall(UnitPhaseReason, u)
phased = ok and not isSecret(why) and why ~= nil
elseif UnitInPhase then
phased = plain(UnitInPhase, u) == false
end
if phased then return "file", "Interface\\TargetingFrame\\UI-PhasingIcon" end
end
-- Role, leader and ready check for one party frame (only while it shows a real party member).
function Party.updateIcons(f)
local icons = Party.icons(f)
local u = f.wfUnit
local real = not AuraKit.editing and not f.partySample and UnitExists(u) -- (not the stand-ins)
-- role
local role = real and plain(UnitGroupRolesAssigned, u) or nil
local atlas = role and ROLE_ATLAS[role]
if atlas and pcall(icons.role.SetAtlas, icons.role, atlas) then icons.role:Show() else icons.role:Hide() end
-- leader
icons.leader:SetShown((real and plain(UnitIsGroupLeader, u)) and true or false)
-- the middle of the portrait: ready check (it stays a few seconds after the check ends, as
-- Blizzard's does), summon, resurrection, another phase
local kind, what
if real then kind, what = Party.centerIcon(u) end
if kind == "atlas" and pcall(icons.ready.SetAtlas, icons.ready, what) then icons.ready:Show()
elseif kind == "file" then icons.ready:SetTexture(what); icons.ready:SetTexCoord(0, 1, 0, 1); icons.ready:Show()
else icons.ready:Hide() end
-- threat glow, as the target frame's threat options say (a glow, in its colours): when the member
-- is about to pull (1), has aggro (2) or holds it securely (3)
local status
local mode = getSetting("target", "threatShow")
if real and (mode == "both" or mode == "glow") then
local s = plain(UnitThreatSituation, u)
if s and s >= 1 then status = s end
end
if status then
icons.aggro:SetTexture(f.border:GetTexture())
icons.aggro:SetTexCoord(f.border:GetTexCoord())
-- (the gradient needs a %: about to pull is most of the way, having it is all the way)
local r, g, b = threatColor("target", status, status == 1 and 80 or 100)
icons.aggro:SetVertexColor(r, g, b, 1)
end
icons.aggro:SetShown(status ~= nil)
end
-- Party slots 2 - 4 after the party's options were reset or copied (slot 1 is done as frames.party).
function Party.applyRest()
for i = 2, Party.SLOTS do
local f = Party.members[i]
if f then
f.layoutLeft = nil
pcall(applyUnit, f)
pcall(updateAll, f)
end
end
end
function Party.updateAllIcons()
if not Party.portraitsLive() then return end
for i = 1, Party.SLOTS do
local f = Party.members[i]
if f then pcall(Party.updateIcons, f) end
end
end
-- Out of range: the frame fades (to "Out of range" on the Party page). UnitInRange's answer can be
-- hidden from addons in instances, so it goes straight to SetAlphaFromBoolean, which takes a hidden
-- answer too.
function Party.updateRange(f)
local RANGE_OUT = tonumber(getSetting("party", "rangeAlpha")) or 0.45
local u = f.wfUnit
if f.partySample then f:SetAlpha((f.partySample.far and getSetting("party", "rangeFade")) and RANGE_OUT or 1); return end
if u == "player" or not getSetting("party", "rangeFade") or not UnitExists(u) then f:SetAlpha(1); return end
local ok, inRange, checked = pcall(UnitInRange, u)
-- (not checked: the game can't tell, e.g. in another zone; then it stays fully shown)
if not ok or (not isSecret(checked) and checked == false) or (not isSecret(inRange) and inRange == nil) then f:SetAlpha(1); return end
if f.SetAlphaFromBoolean and pcall(f.SetAlphaFromBoolean, f, inRange, 1, RANGE_OUT) then return end
if isSecret(inRange) then f:SetAlpha(1); return end
f:SetAlpha(inRange and 1 or RANGE_OUT)
end
---------------------------------------------------------------------------
-- Sample party (portrait frames): made-up members on the four frames, to see the options without a
-- group: names, health, class portraits and frame colours, and a hunter's pet. From the Party page's
-- Preview button or /webby party (the raid style has its own, RP.toggleTest). Out of combat only;
-- combat ends it. The frames show you underneath (a harmless real unit), painted over.
---------------------------------------------------------------------------
Party.SAMPLES = {
{ name = "Brakka", class = "WARRIOR", hp = 0.64, mp = 0.3 },
{ name = "Lyssandra", class = "PRIEST", hp = 0.81, mp = 0.55, missing = 1243 },
{ name = "Thornek", class = "HUNTER", hp = 0.47, mp = 0.7, pet = "Fang" },
{ name = "Fenwick", class = "MAGE", hp = 0.12, mp = 0.9, far = true },
}
-- One frame painted as its sample member (after its normal paint, which shows you).
function Party.paintSample(f)
local s = f.partySample
if not s then return end
f.name:SetText(s.name)
pcall(function()
f.hp:SetMinMaxValues(0, 100); f.hp:SetValue(s.hp * 100)
f.mp:SetMinMaxValues(0, 100); f.mp:SetValue(s.mp * 100)
end)
pcall(function() if f.hpText:IsShown() then f.hpText:SetFormattedText("%d%%", s.hp * 100) end end)
pcall(function() if f.mpText:IsShown() then f.mpText:SetFormattedText("%d%%", s.mp * 100) end end)
-- Other players stay their class colour. The frame underneath is you, so paint the sample's class
-- over your own. Health colour and the fade to red do not apply.
local c = (RAID_CLASS_COLORS or {})[s.class]
local r, g, b
if c then r, g, b = c.r, c.g, c.b end
if r then
local tex = f.hp:GetStatusBarTexture()
f.hp:SetStatusBarColor(r, g, b, 1)
if tex then tex:SetAlpha(tonumber(getSetting("party", "hpAlpha")) or 1) end
end
-- their class icon for a portrait
local coords = CLASS_ICON_TCOORDS and CLASS_ICON_TCOORDS[s.class]
if coords then
f.portrait:SetTexture("Interface\\TargetingFrame\\UI-Classes-Circles")
f.portrait:SetTexCoord(coords[1], coords[2], coords[3], coords[4])
end
-- the frame art in their class colour (Frame colour: Their class colour)
local c = getSetting("party", "frameTint") == "theirclass" and (RAID_CLASS_COLORS or {})[s.class]
if c and f.border then
pcall(f.border.SetDesaturated, f.border, true)
f.border:SetVertexColor(c.r, c.g, c.b)
end
pcall(Party.updateIcons, f)
pcall(Party.updateRange, f)
end
function Party.paintSamples()
if not Party.testing then return end
if not Party.portraitsOn() then return Party.stopSamples() end -- (switched to the raid style, or off)
for i = 1, Party.SLOTS do
local f = Party.members[i]
if f and f.partySample then pcall(updateAll, f); Party.paintSample(f); pcall(Party.minis, f) end
end
pcall(Party.reflow)
end
function Party.startSamples()
if InCombatLockdown() then
print("|cff33ccffWebby Frames:|r the sample party can't be shown in combat.")
return
end
if not Party.portraitsOn() then return end
Party.testing = true
for i = 1, Party.SLOTS do
local f = Party.members[i]
if f then
Party.unwatch(f)
f.wfUnit = "player"
f.partySample = Party.SAMPLES[i]
f:Show()
if f.auraContainer then pcall(f.auraContainer.SetEditModePreviewEnabled, f.auraContainer, true) end
end
end
Party.paintSamples()
end
-- The secure half of stopping the sample party (unit watch, real units). Combat defers it.
function Party.finishSampleStop()
if InCombatLockdown() then Party.sampleStop = true; return end
Party.sampleStop = nil
for i = 1, Party.SLOTS do
local f = Party.members[i]
if f then
f.wfUnit = f.homeUnit or f.baseUnit
if Party.portraitsOn() then Party.watch(f) else f:Hide() end
f:SetAlpha(1)
pcall(applyUnit, f)
pcall(updateAll, f)
end
end
pcall(Party.arrange)
for i = 1, Party.SLOTS do if Party.members[i] then pcall(Party.minis, Party.members[i]) end end
pcall(Party.reflow)
end
function Party.stopSamples()
if not Party.testing then return end
Party.testing = nil
for i = 1, Party.SLOTS do
local f = Party.members[i]
if f then
f.partySample = nil
if f.miniPet then f.miniPet.sampleName = nil end
f.portrait:SetTexCoord(0, 1, 0, 1)
f:SetAlpha(1)
if f.auraContainer then pcall(f.auraContainer.SetEditModePreviewEnabled, f.auraContainer, false) end
end
end
if InCombatLockdown() then Party.sampleStop = true; Party.pendingArrange = true; return end
Party.finishSampleStop()
end
-- The Party page's Preview button and /webby party: the sample party for the style in use.
function Party.toggleSamples()
if getSetting("party", "partyStyle") == "raid" then
if ns.RaidParty then ns.RaidParty.toggleTest() end
elseif Party.testing then
Party.stopSamples()
else
Party.startSamples()
end
end
Party.GROUP = { "player", "party1", "party2", "party3", "party4" }
Party.GROUP_UNIT = { player = true, party1 = true, party2 = true, party3 = true, party4 = true }
Party.UNIT_ONLY = { UNIT_PHASE = true, UNIT_THREAT_SITUATION_UPDATE = true, UNIT_FLAGS = true, UNIT_CONNECTION = true, UNIT_PET = true }
Party.EVENTS = { "GROUP_ROSTER_UPDATE", "PARTY_LEADER_CHANGED", "PLAYER_ROLES_ASSIGNED", "PLAYER_ENTERING_WORLD",
"READY_CHECK", "READY_CHECK_CONFIRM", "READY_CHECK_FINISHED", "PLAYER_REGEN_ENABLED",
"INCOMING_RESURRECT_CHANGED", "INCOMING_SUMMON_CHANGED", "UNIT_PHASE", "UNIT_THREAT_SITUATION_UPDATE",
"UNIT_FLAGS", "UNIT_CONNECTION", "UNIT_PET", "PLAYER_REGEN_DISABLED" }
-- Portrait frames are up, or still on screen because combat has not let them hide yet.
function Party.portraitsLive()
if Party.portraitsOn() then return true end
for i = 1, Party.SLOTS do
local f = Party.members[i]
if f and not f.wfOff then return true end
end
end
function Party.onEvent(_, event, unit)
-- (the unit events come for every unit about, nameplates included: only the group's matter)
if Party.UNIT_ONLY[event] and not Party.GROUP_UNIT[unit] then return end
if event == "PLAYER_REGEN_ENABLED" then
-- a sample stop, a role sort or a pet reflow that had to wait out combat
if Party.sampleStop then pcall(Party.finishSampleStop) end
if Party.pendingArrange then pcall(Party.arrange) end
if Party.pendingReflow then pcall(Party.reflow) end
if not Party.portraitsLive() then
Party.syncEvents()
Party.syncTicker()
return
end
end
-- (portrait frames not in use: raid style, or the party frames off and already hidden)
if not Party.portraitsLive() then
if event == "PLAYER_REGEN_DISABLED" and Party.testing then Party.stopSamples() end
return
end
if event == "PLAYER_REGEN_DISABLED" then
-- combat ends the sample party (the last moment its frames can still be changed)
if Party.testing then Party.stopSamples() end
return
end
-- who goes in which slot (role order): again when the group or its roles change
if event == "GROUP_ROSTER_UPDATE" or event == "PLAYER_ROLES_ASSIGNED" or event == "PLAYER_ENTERING_WORLD" then
pcall(Party.arrange)
end
-- a pet came or went (or the group changed): pet room under each member
if event == "UNIT_PET" or event == "GROUP_ROSTER_UPDATE" then
pcall(Party.reflow)
end
if event == "READY_CHECK" then
Party.readyCheck, Party.readyLinger = true, nil
elseif event == "READY_CHECK_FINISHED" then
Party.readyCheck, Party.readyLinger = nil, true
C_Timer.After(6, function() Party.readyLinger = nil; Party.updateAllIcons() end)
end
Party.updateAllIcons()
-- range / pet-portrait tickers follow who is shown; healer mana follows the group
Party.syncTicker()
if event == "GROUP_ROSTER_UPDATE" or event == "PLAYER_ENTERING_WORLD" then
Party.watchMana()
end
end
-- Range fade is on and at least one non-player party slot (or the sample party) is up.
function Party.needsRangeTick()
if not Party.portraitsLive() then return false end
if not getSetting("party", "rangeFade") then return false end
if Party.testing then return true end
for i = 1, Party.SLOTS do
local f = Party.members[i]
if f and f:IsShown() and f.wfUnit and f.wfUnit ~= "player" then return true end
end
return false
end
-- A shown pet whose portrait still needs the slow refresh.
function Party.needsPetPortraitTick()
if not Party.portraitsLive() then return false end
for i = 1, Party.SLOTS do
local f = Party.members[i]
local m = f and f.miniPet
if m and m:IsShown() then return true end
end
end
function Party.clearRangeFade()
for i = 1, Party.SLOTS do
local f = Party.members[i]
if f then f:SetAlpha(1) end
end
end
-- Pet portraits about every two seconds (when range is not already ticking).
function Party.onPetPortraitTick()
if not Party.portraitsLive() then return end
for i = 1, Party.SLOTS do
local f = Party.members[i]
local m = f and f.miniPet
if m and m:IsShown() then
local u = m:GetAttribute("unit")
if u then pcall(SetPortraitTexture, m.portrait, u) end
end
end
end
-- Range, five times a second, only while fade is on and someone else is shown. Pet bars come from
-- unit events; a shown pet's portrait is refreshed about every two seconds (here, or on the pet ticker).
function Party.onTick()
if not Party.portraitsLive() then return end
local fade = getSetting("party", "rangeFade")
for i = 1, Party.SLOTS do
local f = Party.members[i]
if fade and f and f:IsShown() then pcall(Party.updateRange, f) end
local m = f and f.miniPet
if m and m:IsShown() then
m.portraitTick = ((m.portraitTick or 0) + 1) % 10
if m.portraitTick == 1 then
local u = m:GetAttribute("unit")
if u then pcall(SetPortraitTexture, m.portrait, u) end
end
end
end
end
-- The portrait event frame listens only while those frames are in use. A combat-deferred sort keeps
-- the two regen events until it has run.
function Party.syncEvents()
local ev = Party.ev
if not ev then return end
if Party.portraitsLive() then
if Party.evMode ~= "all" then
ev:UnregisterAllEvents()
for _, e in ipairs(Party.EVENTS) do pcall(ev.RegisterEvent, ev, e) end
Party.evMode = "all"
end
elseif Party.pendingArrange or Party.pendingReflow or Party.sampleStop or Party.testing then
if Party.evMode ~= "regen" then
ev:UnregisterAllEvents()
ev:RegisterEvent("PLAYER_REGEN_ENABLED")
ev:RegisterEvent("PLAYER_REGEN_DISABLED")
Party.evMode = "regen"
end
elseif Party.evMode then
ev:UnregisterAllEvents()
Party.evMode = nil
end
end
function Party.syncTicker()
local wantRange = Party.needsRangeTick()
local wantPet = Party.needsPetPortraitTick()
if wantRange then
if Party.petTicker then Party.petTicker:Cancel(); Party.petTicker = nil end
if not Party.rangeTicker then Party.rangeTicker = C_Timer.NewTicker(0.2, Party.onTick) end
else
if Party.rangeTicker then
Party.rangeTicker:Cancel()
Party.rangeTicker = nil
Party.clearRangeFade()
end
if wantPet then
if not Party.petTicker then Party.petTicker = C_Timer.NewTicker(2, Party.onPetPortraitTick) end
elseif Party.petTicker then
Party.petTicker:Cancel()
Party.petTicker = nil
end
end
end
function Party.init()
Party.ev = CreateFrame("Frame")
Party.ev:SetScript("OnEvent", Party.onEvent)
-- (listeners and the range ticker start from Party.sync, once applyAll has shown or hidden them)
if ns.RaidParty then pcall(ns.RaidParty.init) end -- (the raid-style tiles, made now so click casting gets them)
if ns.Click then pcall(ns.Click.init) end -- (click casting on the frames, now they're made)
end
---------------------------------------------------------------------------
-- Party extras, both styles: missing buffs, the healer mana list, tooltips
---------------------------------------------------------------------------
-- Tooltips on the party frames: always, out of combat only, or never (Party page).
function Party.tipAllowed()
local mode = getSetting("party", "partyTooltip")
if mode == "never" then return false end
if mode == "ooc" then return not InCombatLockdown() end
return true
end
-- Missing buffs: on each member, the icons of the buffs they lack that you can cast (any rank, or the
-- group version, counts as having it). One paladin blessing per member, by their role. By spell ID, so
-- any language works: you know a spell if you know any of its ranks; a member has a buff if they have
-- it under the spell's name in your language. Worked out when a member's buffs change (UNIT_AURA), the
-- group changes or you learn a spell, at most twice a second, and out of combat (buffing is); in combat
-- the icons stay as they were.
-- { cast: every rank you could know (group versions first), has: the buffs that count }
Party.BUFFS = {
{ cast = { 21562, 21564, 25392, 48162, 1243, 1244, 1245, 2791, 10937, 10938, 25389, 48161 }, has = { 1243, 21562 } }, -- Fortitude
{ cast = { 27681, 32999, 48074, 14752, 14818, 14819, 27841, 25312, 48073 }, has = { 14752, 27681 } }, -- Spirit
{ cast = { 21849, 21850, 26991, 48470, 1126, 5232, 6756, 5234, 8907, 9884, 9885, 26990, 48469 }, has = { 1126, 21849 } }, -- Mark of the Wild
{ cast = { 23028, 27127, 43002, 1459, 1460, 1461, 10156, 10157, 27126, 42995 }, has = { 1459, 23028 }, mana = true }, -- Arcane Intellect
{ cast = { 467, 782, 1075, 8914, 9756, 9910, 26992, 53307 }, has = { 467 }, role = "TANK" }, -- Thorns
}
-- paladin blessings: { cast (greater first), has }, by role
Party.BLESSING = {
Kings = { cast = { 25898, 20217 }, has = { 20217, 25898 } },
Sanctuary = { cast = { 25899, 20911, 20912, 20913, 20914, 27168 }, has = { 20911, 25899 } },
Might = { cast = { 25782, 25916, 27141, 48933, 48934, 19740, 19834, 19835, 19836, 19837, 19838, 25291, 27140, 48931, 48932 }, has = { 19740, 25782 } },
Wisdom = { cast = { 25894, 25918, 27143, 48937, 48938, 19742, 19850, 19852, 19853, 19854, 25290, 27142, 48935, 48936 }, has = { 19742, 25894 } },
}
Party.BLESSINGS = {
TANK = { "Kings", "Sanctuary", "Might" },
HEALER = { "Wisdom", "Kings" },
MANA = { "Wisdom", "Kings" }, -- damage dealers with mana
DAMAGER = { "Might", "Kings" },
}
local function spellName(id)
local n
if C_Spell and C_Spell.GetSpellName then n = plain(C_Spell.GetSpellName, id) end
if not n and GetSpellInfo then n = plain(GetSpellInfo, id) end
return n
end
local function spellIcon(spell)
local tex
if C_Spell and C_Spell.GetSpellTexture then tex = plain(C_Spell.GetSpellTexture, spell) end
if not tex and GetSpellTexture then tex = plain(GetSpellTexture, spell) end
return tex
end
local function knows(id)
if C_SpellBook and C_SpellBook.IsSpellKnown then
local k = plain(C_SpellBook.IsSpellKnown, id)
if k then return true end
end
return IsSpellKnown and plain(IsSpellKnown, id) or false
end
-- The first rank of `ids` you know (nil: none). Cached until you learn a spell.
Party.knownCache = {}
local function firstKnown(ids)
local key = ids[1]
local hit = Party.knownCache[key]
if hit == nil then
hit = false
for _, id in ipairs(ids) do if knows(id) then hit = id; break end end
Party.knownCache[key] = hit
end
return hit or nil
end
-- Whether `u` has any of the buffs `ids` (by name, in your language); nil when the game won't say.
local function hasAny(u, ids)
for _, id in ipairs(ids) do
local name = spellName(id)
if name then
local ok, aura = pcall(C_UnitAuras.GetAuraDataBySpellName, u, name, "HELPFUL")
if not ok or isSecret(aura) then return nil end
if aura then return true end
end
end
return false
end
-- Up to `max` icons of buffs `u` lacks that you can cast ({} when none; nil when unknown).
function Party.missing(u, max)
if not (C_UnitAuras and C_UnitAuras.GetAuraDataBySpellName) then return nil end
local role = plain(UnitGroupRolesAssigned, u)
local mana = plain(UnitPowerType, u) == 0
local out = {}
local unknown = false
local function check(entry)
local id = firstKnown(entry.cast)
if not id then return end
local has = hasAny(u, entry.has)
if has == nil then unknown = true elseif not has then out[#out + 1] = spellIcon(id) end
end
for _, b in ipairs(Party.BUFFS) do
if (not b.role or b.role == role) and (not b.mana or mana) then check(b) end
end
local list = Party.BLESSINGS[(role == "TANK" or role == "HEALER") and role or (mana and "MANA" or "DAMAGER")]
for _, kind in ipairs(list) do
local b = Party.BLESSING[kind]
if firstKnown(b.cast) then check(b); break end
end
if unknown and #out == 0 then return nil end
while #out > max do table.remove(out) end
return out
end
-- The icons on a frame: small textures made on first use, in a row from `point` on `rel`.
function Party.paintMissing(f, list, point, rel, x, y, size)
if not f.missIcons then
f.missIcons = {}
for i = 1, 3 do
local tex = (f.ov or f):CreateTexture(nil, "OVERLAY", nil, 3)
tex:SetTexCoord(0.08, 0.92, 0.08, 0.92)
tex:Hide()
f.missIcons[i] = tex
end
end
for i, tex in ipairs(f.missIcons) do
tex:SetSize(size, size)
tex:ClearAllPoints()
if i == 1 then tex:SetPoint(point, rel, point, x, y)
else tex:SetPoint("RIGHT", f.missIcons[i - 1], "LEFT", -1, 0) end
local icon = list and list[i]
if icon then tex:SetTexture(icon); tex:Show() else tex:Hide() end
end
end
-- Each unit's missing icons, worked out when its buffs change (Party.missDirty) and kept for painting.
Party.missFor = {}
Party.missDirty = {}
function Party.markMissing(u)
if u then Party.missDirty[u] = true
else for _, x in ipairs(Party.GROUP) do Party.missDirty[x] = true end end
end
-- Paints every party frame's missing buffs from what was last worked out (or the samples').
function Party.updateMissing()
-- (the party frames off: nothing to work out or paint)
local on = getSetting("party", "missingBuffs") and frameOn("party")
if not InCombatLockdown() then
for u in pairs(Party.missDirty) do
Party.missDirty[u] = nil
local list = on and Party.missing(u, 2) or nil
if list ~= nil or not on then Party.missFor[u] = list end
end
end
for i = 1, Party.SLOTS do
local f = Party.members[i]
if f and f:IsVisible() then
local list
if on then
if f.partySample then list = f.partySample.missing and { spellIcon(f.partySample.missing) }
elseif not AuraKit.editing then list = Party.missFor[f.wfUnit] end
end
Party.paintMissing(f, list, "BOTTOMRIGHT", f.hp, -1, 13, 13)
end
end
local RP = ns.RaidParty
if RP and RP.box and RP.box:IsVisible() then
for _, t in ipairs(RP.tiles) do
if t:IsVisible() and t.wfUnit then
local list
if on then
if t.sample then list = t.sample.missing and { spellIcon(t.sample.missing) } else list = Party.missFor[t.wfUnit] end
end
Party.paintMissing(t, list, "TOPRIGHT", t.hp, -15, -2, 12)
end
end
end
end
-- The events that make it look again: buffs changing on you or a member, the group, a spell learned.
-- Only while missing buffs is on and the party frames are on. Off, nothing is registered and the
-- ticker is not running. The frames are made the first time they're needed.
function Party.syncMissing()
local on = getSetting("party", "missingBuffs") and frameOn("party")
if not on then
if Party.missTicker then Party.missTicker:Cancel(); Party.missTicker = nil end
if Party.missEv then
for _, ev in ipairs(Party.missEv) do ev:UnregisterAllEvents() end
end
if Party.missOn then
Party.missOn = nil
wipe(Party.missDirty)
pcall(Party.updateMissing) -- (icons that were up come off)
end
return
end
if not Party.missEv then
local function onAura(_, _, u) Party.markMissing(u) end
local ev, ev2, ev3 = CreateFrame("Frame"), CreateFrame("Frame"), CreateFrame("Frame")
ev:SetScript("OnEvent", onAura)
ev2:SetScript("OnEvent", onAura)
ev3:SetScript("OnEvent", onAura)
local g = CreateFrame("Frame")
g:SetScript("OnEvent", function(_, event)
if event == "SPELLS_CHANGED" then wipe(Party.knownCache) end
Party.markMissing()
end)
Party.missEv = { ev, ev2, ev3, g }
end
if not Party.missOn then
local ev, ev2, ev3, g = Party.missEv[1], Party.missEv[2], Party.missEv[3], Party.missEv[4]
pcall(ev.RegisterUnitEvent, ev, "UNIT_AURA", "player", "party1")
pcall(ev2.RegisterUnitEvent, ev2, "UNIT_AURA", "party2", "party3")
pcall(ev3.RegisterUnitEvent, ev3, "UNIT_AURA", "party4")
for _, e in ipairs({ "GROUP_ROSTER_UPDATE", "PLAYER_ROLES_ASSIGNED", "PLAYER_ENTERING_WORLD", "PLAYER_REGEN_ENABLED", "SPELLS_CHANGED" }) do
pcall(g.RegisterEvent, g, e)
end
Party.missOn = true
Party.markMissing()
end
if not Party.missTicker then
Party.missTicker = C_Timer.NewTicker(0.5, function()
if next(Party.missDirty) then pcall(Party.updateMissing) end
end)
end
end
-- Healer mana: a small block of text, one line per healer in the group (role Healer, or with no roles
-- set a priest, druid, paladin or shaman), class-coloured name and mana. Placed in Edit Mode.
Party.HEALER_CLASS = { PRIEST = true, DRUID = true, PALADIN = true, SHAMAN = true }
Party.MANA_POS = { point = "TOPLEFT", x = 20, y = -470 }
Party.MANA_SAMPLES = { { name = "Lyssandra", class = "PRIEST", pct = 72 }, { name = "Bramblewood", class = "DRUID", pct = 38 } }
function Party.makeManaBox()
local m = CreateFrame("Frame", "WebbyFrames_HealerMana", UIParent)
m:SetSize(120, 14)
m:SetFrameStrata("LOW")
m:SetClampedToScreen(true)
m.lines = {}
for i = 1, 5 do
local fs = m:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
fs:SetPoint("TOPLEFT", m, "TOPLEFT", 0, -(i - 1) * 13)
fs:SetJustifyH("LEFT")