-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRaidCheck.lua
More file actions
3340 lines (3122 loc) · 112 KB
/
Copy pathRaidCheck.lua
File metadata and controls
3340 lines (3122 loc) · 112 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
---------------------------------------------------------------------------
-- PugzRaidTools - Raid Check Engine
-- Classic Era roster scanning, ready-check state, chat reports, and
-- durability exchange. UI construction lives in UI/RaidCheck*.lua.
---------------------------------------------------------------------------
local addonName, PRT = ...
local ADDON_PREFIX = "PRTRaidCheck"
local MAX_AURAS = 60
local DURABILITY_CACHE_SECONDS = 120
local DEFAULT_READY_CHECK_DURATION = 35
local RAID_CHECK_ICON_WIDTH = 17
local RAID_CHECK_ICON_COLUMN_WIDTH = 28
local RAID_CHECK_COUNT_WIDTH = 15
local RAID_CHECK_MAX_CATEGORY_ICONS = 6
local raidCheckMemoryDebug = {
enabled = false,
counters = {},
baseline = nil,
}
local function CountRaidCheckDebug(key, amount)
if not raidCheckMemoryDebug.enabled then return end
local counters = raidCheckMemoryDebug.counters
counters[key] = (counters[key] or 0) + (amount or 1)
end
local function ReadRaidCheckLuaHeapKB(forceGC)
if type(collectgarbage) ~= "function" then return nil end
if forceGC then pcall(collectgarbage, "collect") end
local ok, value = pcall(collectgarbage, "count")
return ok and tonumber(value) or nil
end
local function ReadRaidCheckAddonMemoryKB()
if type(UpdateAddOnMemoryUsage) == "function" then
UpdateAddOnMemoryUsage()
end
if type(GetAddOnMemoryUsage) ~= "function" then return nil end
return tonumber(GetAddOnMemoryUsage(addonName or "PugzRaidTools"))
end
local function CaptureRaidCheckMemory(forceGC)
local luaHeapKB = ReadRaidCheckLuaHeapKB(forceGC)
return {
addonKB = ReadRaidCheckAddonMemoryKB(),
luaHeapKB = luaHeapKB,
}
end
function PRT:IsRaidCheckMemoryDebugEnabled()
return raidCheckMemoryDebug.enabled
end
function PRT:CountRaidCheckDebug(key, amount)
CountRaidCheckDebug(key, amount)
end
function PRT:GetRaidCheckMemoryDebugCounters()
return raidCheckMemoryDebug.counters
end
function PRT:SetRaidCheckMemoryDebug(enabled)
enabled = enabled and true or false
if enabled then
raidCheckMemoryDebug.enabled = true
raidCheckMemoryDebug.counters = {}
raidCheckMemoryDebug.baseline = CaptureRaidCheckMemory(false)
PRT.Print(
"Raid Check memory debug enabled. Run Test Preview, close it, "
.. "then use /prt debugui raid [gc].")
return
end
if raidCheckMemoryDebug.enabled then
self:DumpRaidCheckMemoryDebug(false, "final")
end
raidCheckMemoryDebug.enabled = false
raidCheckMemoryDebug.baseline = nil
PRT.Print("Raid Check memory debug disabled.")
end
function PRT:DumpRaidCheckMemoryDebug(forceGC, label)
local snapshot = CaptureRaidCheckMemory(forceGC)
local baseline = raidCheckMemoryDebug.baseline or snapshot
local addonDelta = snapshot.addonKB and baseline.addonKB
and snapshot.addonKB - baseline.addonKB or nil
local luaDelta = snapshot.luaHeapKB and baseline.luaHeapKB
and snapshot.luaHeapKB - baseline.luaHeapKB or nil
local counters = raidCheckMemoryDebug.counters
PRT.Print(("RAID CHECK MEMORY %s%s addon=%s delta=%s "
.. "luaHeap(all addons)=%s delta=%s"):format(
tostring(label or "snapshot"),
forceGC and " after-GC" or "",
snapshot.addonKB
and ("%.1fKB"):format(snapshot.addonKB) or "unavailable",
addonDelta and ("%+.1fKB"):format(addonDelta) or "unavailable",
snapshot.luaHeapKB
and ("%.1fKB"):format(snapshot.luaHeapKB) or "unavailable",
luaDelta and ("%+.1fKB"):format(luaDelta) or "unavailable"))
PRT.Print(("previews=%d members=%d auras=%d refreshes=%d "
.. "rowUpdates=%d cellUpdates=%d tooltipBuilds=%d"):format(
counters.testSnapshotsBuilt or 0,
counters.previewMembersBuilt or 0,
counters.previewAurasBuilt or 0,
counters.windowRefreshes or 0,
counters.rowUpdates or 0,
counters.cellUpdates or 0,
counters.tooltipBuilds or 0))
PRT.Print(("created while tracing windows=%d headers=%d rows=%d "
.. "cells=%d texts=%d overlays=%d iconSlots=%d glows=%d "
.. "iconHits=%d miniMembers=%d")
:format(
counters.windowsCreated or 0,
counters.headerCellsCreated or 0,
counters.rowsCreated or 0,
counters.resultCellsCreated or 0,
counters.cellTextsCreated or 0,
counters.overlaysCreated or 0,
counters.iconSlotsCreated or 0,
counters.iconGlowsCreated or 0,
counters.iconHitsCreated or 0,
counters.miniMembersCreated or 0))
PRT.Print(("shared tooltipTargets=%d bindingsReleased=%d"):format(
counters.tooltipTargetsAttached or 0,
counters.windowBindingsReleased or 0))
local popup = self.raidCheckWindow
if popup and popup.GetRaidCheckDebugSummary then
local summary = popup:GetRaidCheckDebugSummary()
PRT.Print(("current shown=%s previewRetained=%s snapshotRetained=%s "
.. "members=%d columns=%d headers=%d rows=%d cells=%d "
.. "texts=%d overlays=%d iconSlots=%d glows=%d "
.. "iconHits=%d miniMembers=%d")
:format(
tostring(summary.shown),
tostring(summary.previewRetained),
tostring(summary.snapshotRetained),
summary.members or 0,
summary.columns or 0,
summary.headers or 0,
summary.rows or 0,
summary.cells or 0,
summary.texts or 0,
summary.overlays or 0,
summary.iconSlots or 0,
summary.iconGlows or 0,
summary.iconHits or 0,
summary.miniMembers or 0))
end
end
local function ResolveSpellIcon(spellId, fallback)
local icon
if C_Spell and C_Spell.GetSpellTexture then
icon = C_Spell.GetSpellTexture(spellId)
elseif GetSpellTexture then
icon = GetSpellTexture(spellId)
end
return icon or fallback
end
local FOOD_AURAS = {
[18125] = true, [18141] = true, [18192] = true, [18194] = true,
[18222] = true, [22730] = true, [22789] = true, [22790] = true,
[24799] = true, [25661] = true, [25804] = true,
}
-- Only the four persistent raid flasks are shown in the Flask column.
local FLASK_AURAS = {
[17626] = true, -- Flask of the Titans
[17627] = true, -- Flask of Distilled Wisdom
[17628] = true, -- Flask of Supreme Power
[17629] = true, -- Flask of Chromatic Resistance
}
-- Petrification is recorded separately for the future Raid Report subsystem.
-- It deliberately does not satisfy or appear in the live Raid Check.
local PETRIFICATION_AURAS = {
[17624] = true,
}
-- Zanza-category effects are mutually exclusive: a player can have only one
-- of these active at a time. itemId overrides intentionally use the source
-- item's icon where the spell aura icon is not the desired display icon.
local ZANZA_AURA_DEFINITIONS = {
{ spellId = 10668, name = "Spirit of Boar", itemId = 8411 },
{ spellId = 10669, name = "Strike of the Scorpok", itemId = 8412 },
{ spellId = 10693, name = "Spiritual Domination", itemId = 8424 },
{ spellId = 10667, name = "Rage of Ages", itemId = 8410 },
{ spellId = 10692, name = "Infallible Mind", itemId = 8423 },
-- City friendship gifts: Darnassus/Orgrimmar grant 30 Agility.
{ spellId = 27666, name = "Darnassus Gift of Friendship" },
{ spellId = 27669, name = "Orgrimmar Gift of Friendship" },
-- Ironforge/Thunder Bluff grant 30 Stamina.
{ spellId = 27665, name = "Ironforge Gift of Friendship" },
{ spellId = 27670, name = "Thunder Bluff Gift of Friendship" },
-- Stormwind/Undercity grant 30 Intellect.
{ spellId = 27664, name = "Stormwind Gift of Friendship" },
{ spellId = 27671, name = "Undercity Gift of Friendship" },
{ spellId = 24382, name = "Spirit of Zanza" },
{ spellId = 24383, name = "Swiftness of Zanza" },
{ spellId = 24417, name = "Sheen of Zanza" },
}
-- Multiple Consumes can be active together. Array order is display priority.
local CONSUME_AURA_DEFINITIONS = {
{ spellId = 17538, name = "Elixir of the Mongoose" },
{ spellId = 11371, name = "Gift of Arthas", itemId = 9088 },
{ spellId = 16323, name = "Juju Power" },
{ spellId = 16329, name = "Juju Might" },
{ spellId = 17038, name = "Winterfall Firewater" },
{ spellId = 11348, name = "Elixir of Superior Defense" },
{ spellId = 26276, name = "Elixir of Greater Firepower" },
{ spellId = 17539, name = "Greater Arcane Elixir" },
{ spellId = 24363, name = "Mageblood Potion" },
{ spellId = 3593, name = "Elixir of Fortitude" },
{ spellId = 16325, name = "Juju Chill" },
{ spellId = 16326, name = "Juju Ember" },
-- Bogling Root deliberately uses the item 5206 texture rather than its
-- aura texture so the Raid Check matches the consumed item.
{ spellId = 5665, name = "Bogling Root", itemId = 5206 },
{ spellId = 11334, name = "Greater Agility" },
}
-- Normal Zanza and Consume rows use the texture resolved from their exact
-- aura spell. ApplyAuraDefinition still gives an explicit itemId precedence,
-- preserving the requested item-icon exceptions (for example Gift of Arthas,
-- Bogling Root, and the five original Blasted Lands buffs).
for _, definitions in ipairs({
ZANZA_AURA_DEFINITIONS,
CONSUME_AURA_DEFINITIONS,
}) do
for _, definition in ipairs(definitions) do
definition.icon = ResolveSpellIcon(
definition.spellId,
definition.icon)
end
end
-- Multiple protection Potions can be active together. Array order is display
-- priority, with Frozen Rune intentionally last.
local POTION_AURA_DEFINITIONS = {
{
spellId = 17544,
name = "Greater Frost Protection Potion",
itemId = 13456,
},
{
spellId = 17548,
name = "Greater Shadow Protection Potion",
itemId = 13459,
},
{
spellId = 17546,
name = "Greater Nature Protection Potion",
itemId = 13458,
},
{
spellId = 17543,
name = "Greater Fire Protection Potion",
itemId = 13457,
},
{
spellId = 17549,
name = "Greater Arcane Protection Potion",
itemId = 13461,
},
{ spellId = 29432, name = "Frozen Rune", itemId = 22682 },
}
-- Disallowed effects use a red glow whenever detected. The column defaults to
-- "Show if detected" so it does not consume space in clean raids.
local DISALLOWED_AURA_DEFINITIONS = {
{
spellId = 29534,
name = "Traces of Silithyst",
icon = ResolveSpellIcon(29534, 135834),
},
-- Alterac Valley fire-buff effect; any detection should be clearly
-- surfaced because it invalidates the expected raid-log preparation.
{
spellId = 18968,
name = "AV Fire Shield",
icon = ResolveSpellIcon(18968),
},
-- Soul Revival is likewise retained as a Logs! warning aura rather than
-- being treated as a valid raid preparation effect.
{
spellId = 28681,
name = "Soul Revival",
icon = ResolveSpellIcon(28681),
},
}
local CHRONOBOON_ICON = ResolveSpellIcon(349981, 133741)
-- World-buff auras in display-priority order. Most entries are active buffs.
-- Supercharged Chronoboon is the special container aura applied while stored
-- world buffs have their durations frozen; it is displayed but is not counted
-- for any class by default because it does not identify the buffs inside it.
local WORLD_BUFF_DEFINITIONS = {
-- All class-valid Sayge fortunes take display precedence over every
-- other active world buff. Their relative order remains deterministic.
-- A player can only have one Dark Fortune at a time; previewExclusiveGroup
-- preserves that real-game rule in generated test rosters.
{
spellId = 23768,
name = "Sayge's Dark Fortune of Damage",
previewExclusiveGroup = "sayge",
},
{
spellId = 23769,
name = "Sayge's Dark Fortune of Resistance",
previewExclusiveGroup = "sayge",
},
{
spellId = 23737,
name = "Sayge's Dark Fortune of Stamina",
previewExclusiveGroup = "sayge",
},
{
spellId = 23766,
name = "Sayge's Dark Fortune of Intelligence",
previewExclusiveGroup = "sayge",
},
{
spellId = 23736,
name = "Sayge's Dark Fortune of Agility",
previewExclusiveGroup = "sayge",
},
{
spellId = 23738,
name = "Sayge's Dark Fortune of Spirit",
previewExclusiveGroup = "sayge",
},
{
spellId = 23735,
name = "Sayge's Dark Fortune of Strength",
previewExclusiveGroup = "sayge",
},
{
spellId = 23767,
name = "Sayge's Dark Fortune of Armor",
previewExclusiveGroup = "sayge",
},
{ spellId = 22888, name = "Rallying Cry of the Dragonslayer" },
{ spellId = 24425, name = "Spirit of Zandalar" },
-- Preview-only realism rule: Warchief's Blessing and Might of Stormwind
-- are mutually exclusive. The two Might IDs are also alternate IDs for
-- the same effect and can never appear together.
{
spellId = 16609,
name = "Warchief's Blessing",
previewExclusiveGroup = "factionCityBuff",
},
{
spellId = 460940,
name = "Might of Stormwind",
previewExclusiveGroup = "factionCityBuff",
},
{
spellId = 460939,
name = "Might of Stormwind",
previewExclusiveGroup = "factionCityBuff",
},
{ spellId = 15366, name = "Songflower Serenade" },
{ spellId = 22817, name = "Fengus' Ferocity" },
{ spellId = 22818, name = "Mol'dar's Moxie" },
{ spellId = 22820, name = "Slip'kik's Savvy" },
{
spellId = 349981,
name = "Supercharged Chronoboon Displacer",
icon = CHRONOBOON_ICON,
isWorldBuffContainer = true,
},
}
-- Resolve every row icon from its world-buff spell ID. This also ensures that
-- multiple displayed buffs use their own spell textures rather than sharing
-- the generic WBs column icon.
for _, definition in ipairs(WORLD_BUFF_DEFINITIONS) do
definition.icon = ResolveSpellIcon(
definition.spellId,
definition.icon)
end
local function BuildAuraDefinitionMap(definitions)
local result = {}
for priority, definition in ipairs(definitions) do
definition.priority = priority
result[definition.spellId] = definition
end
return result
end
local ZANZA_AURAS = BuildAuraDefinitionMap(ZANZA_AURA_DEFINITIONS)
local CONSUME_AURAS = BuildAuraDefinitionMap(CONSUME_AURA_DEFINITIONS)
local POTION_AURAS = BuildAuraDefinitionMap(POTION_AURA_DEFINITIONS)
local DISALLOWED_AURAS = BuildAuraDefinitionMap(DISALLOWED_AURA_DEFINITIONS)
local WORLD_BUFF_AURAS = BuildAuraDefinitionMap(WORLD_BUFF_DEFINITIONS)
local function SpellSet(...)
local set = {}
for index = 1, select("#", ...) do
set[select(index, ...)] = true
end
return set
end
-- Per-class defaults define which detected world buffs contribute to that
-- player's valid world-buff count. Unlisted detected buffs can still be shown
-- in the tooltip but do not increase the counted total.
local WORLD_BUFF_DEFAULTS = {
WARRIOR = SpellSet(
23768, 22888, 24425, 22817, 22818, 15366, 16609,
460940, 460939),
ROGUE = SpellSet(
23768, 22888, 24425, 22817, 22818, 15366, 16609,
460940, 460939),
HUNTER = SpellSet(
23768, 22888, 24425, 22820, 22817, 22818, 15366, 16609,
460940, 460939, 23769, 23737),
DRUID = SpellSet(
23768, 22888, 24425, 22820, 22817, 22818, 15366, 16609,
460940, 460939, 23769),
MAGE = SpellSet(
23768, 22888, 24425, 22820, 22818, 15366, 16609,
460940, 460939),
WARLOCK = SpellSet(
23768, 22888, 24425, 22820, 22818, 15366, 16609,
460940, 460939),
PALADIN = SpellSet(
23768, 22888, 24425, 22820, 22817, 22818, 15366, 16609,
460940, 460939, 23769, 23766),
PRIEST = SpellSet(
23768, 22888, 24425, 22820, 22818, 15366, 16609,
460940, 460939, 23769, 23737, 23766, 23738),
SHAMAN = SpellSet(
23768, 22888, 24425, 22820, 22817, 22818, 15366, 16609,
460940, 460939, 23769, 23766),
}
local WORLD_BUFF_CLASSES = {
{ classFile = "WARRIOR", label = "Warrior" },
{ classFile = "ROGUE", label = "Rogue" },
{ classFile = "HUNTER", label = "Hunter" },
{ classFile = "DRUID", label = "Druid" },
{ classFile = "MAGE", label = "Mage" },
{ classFile = "WARLOCK", label = "Warlock" },
{ classFile = "PALADIN", label = "Paladin" },
{ classFile = "PRIEST", label = "Priest" },
{ classFile = "SHAMAN", label = "Shaman" },
}
local WORLD_BUFF_DEFAULTS_VERSION = 2
local function MigrateWorldBuffValidityDefaults(cfg)
if tonumber(cfg.worldBuffDefaultsVersion) == WORLD_BUFF_DEFAULTS_VERSION then
return
end
-- Version 2 makes both Might of Stormwind aura IDs valid for every class.
-- Older configuration tables stored every default as an explicit value,
-- so clear these two generated entries to inherit the new defaults.
for classFile, saved in pairs(cfg.worldBuffValidity or {}) do
if type(saved) == "table" then
saved[460940] = nil
saved[460939] = nil
if not next(saved) then
cfg.worldBuffValidity[classFile] = nil
end
end
end
cfg.worldBuffDefaultsVersion = WORLD_BUFF_DEFAULTS_VERSION
end
local BASE_BUFFS = {
{
key = "druid",
label = "Mark / Gift of the Wild",
shortLabel = "GotW",
icon = 136078,
spells = {
[1126] = 1, [5232] = 2, [6756] = 3, [5234] = 4,
[8907] = 5, [9884] = 6, [9885] = 7,
[21849] = 6, [21850] = 7,
},
},
{
key = "intellect",
label = "Arcane Intellect / Brilliance",
shortLabel = "Int",
icon = 135932,
spells = {
[1459] = 1, [1460] = 2, [1461] = 3,
[10156] = 4, [10157] = 5, [23028] = 5,
},
},
{
key = "attackPower",
label = "Diamond Flask Battle Shout",
shortLabel = "DF BS",
icon = 132333,
-- This column intentionally detects only the requested DF Battle
-- Shout aura; ordinary ranked Battle Shout auras do not satisfy it.
spells = { [25101] = 1 },
},
{
key = "spirit",
label = "Divine Spirit / Prayer of Spirit",
shortLabel = "Spirit",
icon = 135946,
spells = {
[14752] = 1, [14818] = 2, [14819] = 3,
[27681] = 4, [27841] = 4,
},
},
{
key = "armor",
label = "Inner Fire",
shortLabel = "Armor",
icon = 135926,
defaultEnabled = false,
spells = {
[588] = 1, [7128] = 2, [602] = 3, [1006] = 4,
[10951] = 5, [10952] = 6,
},
},
{
key = "shadow",
label = "Shadow Protection",
shortLabel = "Shadow",
icon = 136121,
spells = {
[976] = 1, [10957] = 2, [10958] = 3,
[27683] = 3,
},
},
{
key = "stamina",
label = "Power Word: Fortitude",
shortLabel = "Stam",
icon = 135987,
spells = {
[1243] = 1, [1244] = 2, [1245] = 3,
[2791] = 4, [10937] = 5, [10938] = 6,
[21562] = 5, [21564] = 6,
},
},
}
local SALVATION_ICON = ResolveSpellIcon(25895)
local LIGHT_ICON = ResolveSpellIcon(25890)
local ALLIANCE_BUFFS = {
{
key = "might",
label = "Blessing of Might",
shortLabel = "BoM",
icon = 135908,
paladinBlessing = true,
spells = {
[19740] = 1, [19834] = 2, [19835] = 3,
[19836] = 4, [19837] = 5, [19838] = 6,
[25291] = 7, [25782] = 6, [25916] = 7,
},
},
{
key = "wisdom",
label = "Blessing of Wisdom",
shortLabel = "BoW",
icon = 135970,
paladinBlessing = true,
spells = {
[19742] = 1, [19850] = 2, [19852] = 3,
[19853] = 4, [19854] = 5, [25290] = 6,
[25894] = 5, [25918] = 6,
},
},
{
key = "kings",
label = "Blessing of Kings",
shortLabel = "BoK",
icon = 135993,
paladinBlessing = true,
spells = { [20217] = 1, [25898] = 1 },
},
{
key = "salvation",
label = "Blessing of Salvation",
shortLabel = "BoS",
icon = SALVATION_ICON,
iconOverride = SALVATION_ICON,
paladinBlessing = true,
-- Both the greater and single-target auras satisfy Salvation. The
-- greater aura icon is used for either result to keep the column
-- visually consistent.
spells = { [1038] = 1, [25895] = 1 },
},
{
key = "light",
label = "Blessing of Light",
shortLabel = "BoL",
icon = LIGHT_ICON,
iconOverride = LIGHT_ICON,
paladinBlessing = true,
-- Greater Blessing of Light and rank 3 are valid max-rank results.
-- Ranks 1 and 2 remain present but receive the normal low-rank glow.
spells = {
[19977] = 1,
[19978] = 2,
[19979] = 3,
[25890] = 3,
},
},
}
local CORE_COLUMNS = {
{
key = "worldBuffs",
label = "World Buffs",
shortLabel = "WBs",
icon = 134153,
configKey = "checkWorldBuffs",
multiAura = true,
defaultMaxDisplay = 4,
maxDisplayLimit = 7,
defaultShowCount = true,
defaultAlignment = "LEFT",
},
{
key = "food",
label = "Food",
shortLabel = "Food",
icon = 136000,
configKey = "checkFood",
defaultEnabled = false,
width = RAID_CHECK_ICON_COLUMN_WIDTH,
},
{
key = "flask",
label = "Flask",
shortLabel = "Flask",
icon = 134842,
configKey = "checkFlask",
width = RAID_CHECK_ICON_COLUMN_WIDTH,
},
{
key = "zanza",
label = "Zanza",
shortLabel = "Zanza",
icon = 134810,
configKey = "checkZanza",
multiAura = true,
defaultMaxDisplay = 1,
defaultShowCount = false,
supportsCount = false,
},
{
key = "consumes",
label = "Consumes",
shortLabel = "Consumes",
icon = 134812,
configKey = "checkConsumes",
multiAura = true,
defaultMaxDisplay = 3,
defaultShowCount = false,
},
{
key = "potions",
label = "Potions",
shortLabel = "Potions",
icon = 134800,
configKey = "checkPotions",
multiAura = true,
defaultMaxDisplay = 3,
defaultShowCount = false,
},
{
key = "disallowed",
label = "Logs!",
shortLabel = "Logs!",
icon = DISALLOWED_AURA_DEFINITIONS[1].icon,
configKey = "checkDisallowed",
multiAura = true,
defaultMaxDisplay = 1,
defaultShowCount = false,
defaultVisibility = "detected",
alwaysGlow = true,
},
}
local DURABILITY_COLUMN = {
key = "durability",
label = "Durability",
shortLabel = "Dur",
icon = 136241,
configKey = "checkDurability",
width = 38,
}
local PREVIEW_NAMES = {
"Krobian", "Udwarrior", "Ezi", "Drstwo", "Straik", "Maasaki",
"Littlechurch", "Fréakazoide", "Pugzz", "Lilbootay", "Tusqaix",
"Wstn", "Sniffx", "Cidibaa", "Driev", "Mueslii", "Coltyy",
"Freegoo", "Salvxdali", "Panzèrx", "Aluvena", "Sosa", "Dunkix",
"Smokess", "Sertoh", "Skalina", "Preyqq", "Daiku", "Zurzur",
"Clickerxx", "Shadowelitz", "Malepalax", "Benevolent", "Prestelul",
"Scrimslave", "Bokkpriest", "Zixes", "Minicutie", "Jeezppc",
"Calimay",
}
local PREVIEW_CLASSES = {
"WARRIOR", "PALADIN", "HUNTER", "ROGUE", "PRIEST",
"SHAMAN", "MAGE", "WARLOCK", "DRUID",
}
local RAID_CHECK_CLASS_ORDER = {
WARRIOR = 1,
ROGUE = 2,
HUNTER = 3,
MAGE = 4,
WARLOCK = 5,
DRUID = 6,
PALADIN = 7,
PRIEST = 8,
SHAMAN = 9,
}
local function Now()
return GetTime and GetTime() or 0
end
local function IsSecret(value)
return issecretvalue and issecretvalue(value)
end
local function AurasAreSecret()
return C_Secrets and C_Secrets.ShouldAurasBeSecret
and C_Secrets.ShouldAurasBeSecret()
end
local function GetAuraData(unit, index)
if C_UnitAuras and C_UnitAuras.GetAuraDataByIndex then
return C_UnitAuras.GetAuraDataByIndex(unit, index, "HELPFUL")
end
if not UnitAura then return nil end
local name, icon, applications, dispelName, duration, expirationTime,
sourceUnit, isStealable, nameplateShowPersonal, spellId =
UnitAura(unit, index, "HELPFUL")
if not name then return nil end
return {
name = name,
icon = icon,
applications = applications,
dispelName = dispelName,
duration = duration,
expirationTime = expirationTime,
sourceUnit = sourceUnit,
isStealable = isStealable,
nameplateShowPersonal = nameplateShowPersonal,
spellId = spellId,
}
end
local function GetConfiguredItemIcon(itemId)
if not itemId then return nil end
if C_Item and C_Item.GetItemIconByID then
return C_Item.GetItemIconByID(itemId)
end
local getItemInfoInstant = C_Item and C_Item.GetItemInfoInstant
or GetItemInfoInstant
if getItemInfoInstant then
local _, _, _, _, icon = getItemInfoInstant(itemId)
return icon
end
end
local function ApplyAuraDefinition(aura, definition)
if not aura or not definition then return aura end
aura.raidCheckPriority = definition.priority or 999
aura.raidCheckDefinitionName = definition.name
aura.raidCheckItemId = definition.itemId
aura.raidCheckWorldBuffContainer =
definition.isWorldBuffContainer == true
aura.raidCheckDisplayIcon =
GetConfiguredItemIcon(definition.itemId)
or ResolveSpellIcon(definition.spellId, definition.icon)
or aura.icon
return aura
end
local function SortAuraList(auras)
table.sort(auras, function(left, right)
local leftPriority = tonumber(left.raidCheckPriority) or 999
local rightPriority = tonumber(right.raidCheckPriority) or 999
if leftPriority ~= rightPriority then
return leftPriority < rightPriority
end
return (tonumber(left.spellId) or 0) < (tonumber(right.spellId) or 0)
end)
end
local function SortWorldBuffList(auras)
table.sort(auras, function(left, right)
local leftCounted = left.raidCheckCounted == true
local rightCounted = right.raidCheckCounted == true
if leftCounted ~= rightCounted then return leftCounted end
local leftPriority = tonumber(left.raidCheckPriority) or 999
local rightPriority = tonumber(right.raidCheckPriority) or 999
if leftPriority ~= rightPriority then
return leftPriority < rightPriority
end
return (tonumber(left.spellId) or 0)
< (tonumber(right.spellId) or 0)
end)
end
local function CopyBuffDefinitions(destination, source)
for _, definition in ipairs(source) do
if not definition.maxRank then
local maximum = 1
for _, rank in pairs(definition.spells) do
maximum = math.max(maximum, tonumber(rank) or 1)
end
definition.maxRank = maximum
end
destination[#destination + 1] = definition
end
end
local raidCheckBuffDefinitions
function PRT:GetRaidCheckBuffDefinitions()
if raidCheckBuffDefinitions then return raidCheckBuffDefinitions end
local definitions = {}
CopyBuffDefinitions(definitions, BASE_BUFFS)
-- Keep the catalog stable on both factions. Visibility of the five
-- Paladin Blessing columns is handled by the user's faction toggle.
CopyBuffDefinitions(definitions, ALLIANCE_BUFFS)
raidCheckBuffDefinitions = definitions
return raidCheckBuffDefinitions
end
function PRT:GetRaidCheckWorldBuffDefinitions()
return WORLD_BUFF_DEFINITIONS
end
function PRT:GetRaidCheckWorldBuffClasses()
return WORLD_BUFF_CLASSES
end
local function RefreshSnapshotWorldBuffValidity(owner, snapshot)
for _, member in ipairs(snapshot and snapshot.members or {}) do
member.countedWorldBuffs = {}
for _, aura in ipairs(member.worldBuffs or {}) do
aura.raidCheckCounted = owner:IsRaidCheckWorldBuffCounted(
member.classFile, aura.spellId)
if aura.raidCheckCounted then
member.countedWorldBuffs[
#member.countedWorldBuffs + 1] = aura
end
end
SortWorldBuffList(member.worldBuffs)
SortAuraList(member.countedWorldBuffs)
end
end
function PRT:IsRaidCheckWorldBuffCounted(classFile, spellId)
spellId = tonumber(spellId)
local cfg = self:GetDB().raidCheck or {}
MigrateWorldBuffValidityDefaults(cfg)
local saved = cfg.worldBuffValidity
and cfg.worldBuffValidity[classFile] or nil
if saved and saved[spellId] ~= nil then
return saved[spellId] == true
end
local defaults = WORLD_BUFF_DEFAULTS[classFile]
if not defaults then return true end
return defaults[spellId] == true
end
function PRT:SetRaidCheckWorldBuffCounted(classFile, spellId, counted)
if not WORLD_BUFF_DEFAULTS[classFile] then return false end
spellId = tonumber(spellId)
if not WORLD_BUFF_AURAS[spellId] then return false end
local cfg = self:GetDB().raidCheck
cfg.worldBuffValidity = cfg.worldBuffValidity or {}
MigrateWorldBuffValidityDefaults(cfg)
local saved = cfg.worldBuffValidity[classFile]
if type(saved) ~= "table" then
saved = {}
cfg.worldBuffValidity[classFile] = saved
end
local value = counted and true or false
local defaultValue =
WORLD_BUFF_DEFAULTS[classFile][spellId] == true
saved[spellId] = value ~= defaultValue and value or nil
if not next(saved) then
cfg.worldBuffValidity[classFile] = nil
end
if self.raidCheckWindow and self.raidCheckWindow._previewSnapshot then
RefreshSnapshotWorldBuffValidity(
self, self.raidCheckWindow._previewSnapshot)
end
if self.RefreshRaidCheckWindow then self:RefreshRaidCheckWindow() end
return true
end
function PRT:ResetRaidCheckWorldBuffDefaults(classFile)
local cfg = self:GetDB().raidCheck
if cfg.worldBuffValidity then
cfg.worldBuffValidity[classFile] = nil
end
if self.raidCheckWindow and self.raidCheckWindow._previewSnapshot then
RefreshSnapshotWorldBuffValidity(
self, self.raidCheckWindow._previewSnapshot)
end
if self.RefreshRaidCheckWindow then self:RefreshRaidCheckWindow() end
end
function PRT:GetRaidCheckAuraCategoryDefinitions(categoryKey)
if categoryKey == "worldBuffs" then return WORLD_BUFF_DEFINITIONS end
if categoryKey == "zanza" then return ZANZA_AURA_DEFINITIONS end
if categoryKey == "consumes" then return CONSUME_AURA_DEFINITIONS end
if categoryKey == "potions" then return POTION_AURA_DEFINITIONS end
if categoryKey == "disallowed" then
return DISALLOWED_AURA_DEFINITIONS
end
return {}
end
local raidCheckColumnCatalog
function PRT:GetRaidCheckColumnCatalog()
if raidCheckColumnCatalog then return raidCheckColumnCatalog end
local catalog = {}
for _, column in ipairs(CORE_COLUMNS) do
catalog[#catalog + 1] = column
end
for _, definition in ipairs(self:GetRaidCheckBuffDefinitions()) do
catalog[#catalog + 1] = {
key = definition.key,
label = definition.label,
shortLabel = definition.shortLabel,
icon = definition.icon,
configKey = "checkBuffs",
buffKey = definition.key,
paladinBlessing = definition.paladinBlessing == true,
defaultEnabled = definition.defaultEnabled,
width = RAID_CHECK_ICON_COLUMN_WIDTH,
}
end
catalog[#catalog + 1] = DURABILITY_COLUMN
raidCheckColumnCatalog = catalog
return raidCheckColumnCatalog
end
local function FindColumnByKey(catalog, columnKey)
for _, column in ipairs(catalog) do
if column.key == columnKey then return column end
end
end
function PRT:GetRaidCheckColumnSetting(columnOrKey)
local column = type(columnOrKey) == "table" and columnOrKey
or FindColumnByKey(
self:GetRaidCheckColumnCatalog(),
columnOrKey == "potion" and "consumes" or columnOrKey)
if not column then return nil end
local cfg = self:GetDB().raidCheck
cfg.columnSettings = cfg.columnSettings or {}
if column.key == "consumes"
and not cfg.columnSettings.consumes
and cfg.columnSettings.potion then
cfg.columnSettings.consumes = cfg.columnSettings.potion
cfg.columnSettings.potion = nil
end
local setting = cfg.columnSettings[column.key]
if type(setting) ~= "table" then
setting = {}
cfg.columnSettings[column.key] = setting
end
if setting.enabled == nil then
local legacyValue = cfg[column.configKey]
if column.key == "consumes"
and cfg.checkPotion ~= nil then
legacyValue = cfg.checkPotion
cfg.checkPotion = nil
end
if column.defaultEnabled ~= nil then
setting.enabled = column.defaultEnabled == true
else
setting.enabled = legacyValue ~= false
end