-
Notifications
You must be signed in to change notification settings - Fork 87
/
BigDebuffs.lua
2449 lines (2200 loc) · 89.5 KB
/
BigDebuffs.lua
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
-- BigDebuffs by Jordon
local addonName, addon = ...
BigDebuffs = LibStub("AceAddon-3.0"):NewAddon(addonName, "AceEvent-3.0", "AceHook-3.0")
local LibSharedMedia = LibStub("LibSharedMedia-3.0")
local LibClassicDurations = WOW_PROJECT_ID == WOW_PROJECT_CLASSIC and LibStub("LibClassicDurations")
if LibClassicDurations then LibClassicDurations:Register(addonName) end
-- Adding in Masque support, preparing groups if it is available
local Masque = LibStub("Masque", true)
if Masque ~= nil then
BigDebuffs.MasqueGroup = {}
BigDebuffs.MasqueGroup.UnitFrame = Masque:Group("BigDebuffs", "UnitFrame")
BigDebuffs.MasqueGroup.NamePlate = Masque:Group("BigDebuffs", "NamePlate")
end
local UnitDebuff, UnitBuff = C_UnitAuras.GetDebuffDataByIndex, C_UnitAuras.GetBuffDataByIndex
local GetSpellTexture = C_Spell and C_Spell.GetSpellTexture or GetSpellTexture
local GetSpellInfo = C_Spell and C_Spell.GetSpellInfo or GetSpellInfo
local function GetSpellName(id)
if C_Spell and C_Spell.GetSpellName then
return C_Spell.GetSpellName(id)
else
return GetSpellInfo(id)
end
end
-- Defaults
local defaults = {
profile = {
raidFrames = {
maxDebuffs = 1,
anchor = "INNER",
enabled = true,
cooldownCount = true,
cooldownFontSize = 10,
cooldownFontEffect = "OUTLINE",
cooldownFont = "Friz Quadrata TT",
showAllClassBuffs = true,
hideBliz = true,
redirectBliz = false,
increaseBuffs = false,
cc = 50,
dispellable = {
cc = 60,
roots = 50,
},
interrupts = 55,
buffs = 25,
roots = 40,
warning = 40,
debuffs_offensive = 35,
default = 30,
special = 30,
pve = 50,
warningList = {
[212183] = true, -- Smoke Bomb
[81261] = true, -- Solar Beam
[316099] = true, -- Unstable Affliction
[342938] = true, -- Unstable Affliction
[34914] = true, -- Vampiric Touch
[383005] = true, -- Chrono Loop
[375901] = true, -- Mindgames
},
inRaid = {
hide = false,
size = 5
}
},
unitFrames = {
enabled = true,
cooldownCount = true,
cooldownFontSize = 16,
cooldownFontEffect = "OUTLINE",
cooldownFont = "Friz Quadrata TT",
tooltips = true,
player = {
enabled = true,
anchor = "auto",
anchorPoint = "auto",
relativePoint = "auto",
x = 0,
y = 0,
matchFrameHeight = true,
size = 50,
},
target = {
enabled = true,
anchor = "auto",
anchorPoint = "auto",
relativePoint = "auto",
x = 0,
y = 0,
matchFrameHeight = true,
size = 50,
},
pet = {
enabled = true,
anchor = "auto",
anchorPoint = "auto",
relativePoint = "auto",
x = 0,
y = 0,
matchFrameHeight = true,
size = 50,
},
party = {
enabled = true,
anchor = "auto",
anchorPoint = "auto",
relativePoint = "auto",
x = 0,
y = 0,
matchFrameHeight = true,
size = 50,
},
cc = true,
interrupts = true,
immunities = true,
immunities_spells = true,
buffs_defensive = true,
buffs_offensive = true,
buffs_other = true,
debuffs_offensive = true,
roots = true,
buffs_speed_boost = true,
},
nameplates = {
enabled = true,
cooldownCount = true,
cooldownFontSize = 16,
cooldownFontEffect = "OUTLINE",
cooldownFont = "Friz Quadrata TT",
tooltips = true,
enemy = true,
friendly = true,
npc = true,
enemyAnchor = {
anchor = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE and "RIGHT" or "TOP",
size = 40,
x = 0,
y = 0,
},
friendlyAnchor = {
friendlyAnchorEnabled = false,
anchor = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE and "RIGHT" or "TOP",
size = 40,
x = 0,
y = 0,
},
cc = true,
interrupts = true,
immunities = true,
immunities_spells = true,
buffs_defensive = true,
buffs_offensive = true,
buffs_other = true,
debuffs_offensive = true,
roots = true,
buffs_speed_boost = true,
},
priority = {
immunities = 80,
immunities_spells = 70,
cc = 60,
interrupts = 55,
buffs_defensive = 50,
buffs_offensive = 40,
debuffs_offensive = 35,
buffs_other = 30,
roots = 20,
special = 19,
buffs_speed_boost = 10,
},
spells = {},
}
}
BigDebuffs.WarningDebuffs = addon.WarningDebuffs or {}
BigDebuffs.Spells = addon.Spells
BigDebuffs.HiddenDebuffs = addon.HiddenDebuffs or {}
local tContains = tContains
-- create a lookup table since CombatLogGetCurrentEventInfo() returns 0 for spellId
local spellIdByName
if WOW_PROJECT_ID == WOW_PROJECT_CLASSIC then
spellIdByName = {}
for id, value in pairs(BigDebuffs.Spells) do
local spellName = GetSpellName(id)
if spellName and (not value.parent) then spellIdByName[spellName] = id end
end
else
defaults.profile.unitFrames.focus = {
enabled = true,
anchor = "auto",
anchorPoint = "auto",
relativePoint = "auto",
x = 0,
y = 0,
matchFrameHeight = true,
size = 50,
}
defaults.profile.unitFrames.arena = {
enabled = true,
anchor = "auto",
anchorPoint = "auto",
relativePoint = "auto",
x = 0,
y = 0,
matchFrameHeight = true,
size = 50,
}
end
if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then
BigDebuffs.specDispelTypes = {
[62] = { -- Arcane Mage
Curse = true,
},
[63] = { -- Fire Mage
Curse = true,
},
[64] = { -- Frost Mage
Curse = true,
},
[65] = { -- Holy Paladin
Magic = true,
Poison = true,
Disease = true,
},
[66] = { -- Protection Paladin
Poison = true,
Disease = true,
},
[70] = { -- Retribution Paladin
Poison = true,
Disease = true,
},
[102] = { -- Balance Druid
Curse = true,
Poison = true,
},
[103] = { -- Feral Druid
Curse = true,
Poison = true,
},
[104] = { -- Guardian Druid
Curse = true,
Poison = true,
},
[105] = { -- Restoration Druid
Magic = true,
Curse = true,
Poison = true,
},
[256] = { -- Discipline Priest
Magic = true,
Disease = true,
},
[257] = { -- Holy Priest
Magic = true,
Disease = true,
},
[258] = { -- Shadow Priest
Magic = true,
Disease = true,
},
[262] = { -- Elemental Shaman
Curse = true,
},
[263] = { -- Enhancement Shaman
Curse = true,
},
[264] = { -- Restoration Shaman
Magic = true,
Curse = true,
},
[268] = { -- Brewmaster Monk
Poison = true,
Disease = true,
},
[269] = { -- Windwalker Monk
Poison = true,
Disease = true,
},
[270] = { -- Mistweaver Monk
Magic = true,
Poison = true,
Disease = true,
},
[1467] = { -- Devastation Evoker
Poison = true,
Disease = function() return IsPlayerSpell(374251) end,
Curse = function() return IsPlayerSpell(374251) end,
},
[1468] = { -- Preservation Evoker
Magic = true,
Poison = true,
Disease = function() return IsPlayerSpell(374251) end,
Curse = function() return IsPlayerSpell(374251) end,
},
[1473] = { -- Augmentation Evoker
Poison = true,
Disease = function() return IsPlayerSpell(374251) end,
Curse = function() return IsPlayerSpell(374251) end,
},
[577] = {
Magic = function() return IsPlayerSpell(205604) end, -- Reverse Magic
},
[581] = {
Magic = function() return IsPlayerSpell(205604) end, -- Reverse Magic
},
}
else
local classDispel = {
PRIEST = {
Magic = true,
Disease = true,
},
MAGE = {
Curse = true,
},
PALADIN = {
Magic = true,
Poison = true,
Disease = true,
},
DRUID = {
Curse = true,
Poison = true,
},
SHAMAN = {
Disease = true,
Poison = true,
-- Shamans 'Cleanse Spirit' restoration talent
Curse = function() return IsPlayerSpell(51886) end
},
WARLOCK = {
-- Felhunter's Devour Magic or Doomguard's Dispel Magic
Magic = function() return IsPlayerSpell(19736) or IsPlayerSpell(19476) end,
},
EVOKER = {
Bleed = function() return IsPlayerSpell(374251) end,
Poison = true,
Disease = function() return IsPlayerSpell(374251) end,
Curse = function() return IsPlayerSpell(374251) end,
},
}
if WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC then
classDispel.DRUID = {
Magic = function() return IsPlayerSpell(88423) end,
Curse = true,
Poison = true,
}
classDispel.SHAMAN = {
Magic = function() return IsPlayerSpell(77130) end,
Curse = true,
}
classDispel.PALADIN = {
Magic = function() return IsPlayerSpell(53551) end,
Poison = true,
Disease = true,
}
end
local _, class = UnitClass("player")
BigDebuffs.dispelTypes = classDispel[class]
end
BigDebuffs.PriorityDebuffs = addon.PriorityDebuffs
-- Store interrupt spellId and start time
BigDebuffs.units = {}
local units = addon.Units
local unitsWithRaid = {}
for i = 1, #units do
table.insert(unitsWithRaid, units[i])
end
for i = 1, 40 do
table.insert(unitsWithRaid, "raid" .. i)
end
local GetAnchor = {
ElvUIFrames = function(anchor)
local anchors, unit = BigDebuffs.anchors
for u, configAnchor in pairs(anchors.ElvUI.units) do
if anchor == configAnchor then
unit = u
break
end
end
if unit and unit:match("player") then
local unitGUID = UnitGUID(unit)
local elvUIFrame = _G["ElvUF_Player"]
if elvUIFrame and elvUIFrame:IsVisible() and elvUIFrame.unit then
if unitGUID == UnitGUID(elvUIFrame.unit) then
return elvUIFrame
end
end
end
if unit and unit:match("party") then
local unitGUID = UnitGUID(unit)
for i = 1, 5, 1 do
local elvUIFrame = _G["ElvUF_PartyGroup1UnitButton" .. i]
if elvUIFrame and elvUIFrame:IsVisible() and elvUIFrame.unit then
if unitGUID == UnitGUID(elvUIFrame.unit) then
return elvUIFrame
end
end
end
return
end
if unit and (unit:match("arena") or unit:match("arena")) then
local unitGUID = UnitGUID(unit)
for i = 1, 5, 1 do
local elvUIFrame = _G["ElvUF_Arena" .. i]
if elvUIFrame and elvUIFrame:IsVisible() and elvUIFrame.unit then
if unitGUID == UnitGUID(elvUIFrame.unit) then
return elvUIFrame
end
end
end
return
end
return _G[anchor]
end,
NDuiFrames = function(anchor)
local anchors, unit = BigDebuffs.anchors
for u, configAnchor in pairs(anchors.NDui.units) do
if anchor == configAnchor then
unit = u
break
end
end
if unit and (unit:match("party") or unit:match("player")) then
local unitGUID = UnitGUID(unit)
for i = 1, 5, 1 do
local oUFFrame = _G["oUF_PartyGroup1UnitButton" .. i]
if oUFFrame and oUFFrame:IsVisible() and oUFFrame.unit then
if unitGUID == UnitGUID(oUFFrame.unit) then
return oUFFrame
end
end
end
return
end
if unit and (unit:match("arena") or unit:match("arena")) then
local unitGUID = UnitGUID(unit)
for i = 1, 5, 1 do
local oUFFrame = _G["oUF_Arena" .. i]
if oUFFrame and oUFFrame:IsVisible() and oUFFrame.unit then
if unitGUID == UnitGUID(oUFFrame.unit) then
return oUFFrame
end
end
end
return
end
return _G[anchor]
end,
ShadowedUnitFrames = function(anchor)
local frame = _G[anchor]
if not frame then return end
if frame.portrait and frame.portrait:IsShown() then
return frame.portrait, frame
else
return frame, frame, true
end
end,
ZPerl = function(anchor)
local frame = _G[anchor]
if not frame then return end
if frame:IsShown() then
return frame, frame
else
frame = frame:GetParent()
return frame, frame, true
end
end,
sArena = function(anchor)
local frame = _G[anchor]
if not frame then return end
if frame.ClassIcon then
return frame.ClassIcon, frame
else
return frame, frame, true
end
end,
PitBull = function(anchor)
local frame = _G[anchor]
if not frame then return end
if frame.Portrait and frame.Portrait:IsShown() then
return frame.Portrait, frame
else
return frame, frame, true
end
end,
Cell = function(anchor)
local anchors, unit = BigDebuffs.anchors
for u, configAnchor in pairs(anchors.Cell.units) do
if anchor == configAnchor then
unit = u
break
end
end
if unit and (unit:match("party") or unit:match("player")) then
if Cell then
local guid = UnitGUID(unit)
local frame = Cell.funcs:GetUnitButtonByGUID(guid)
if frame then
return frame, frame, true
end
end
return
end
end,
}
local GetNameplateAnchor = {
ElvUINameplates = function(frame)
if frame.unitFrame and frame.unitFrame.Health and frame.unitFrame.Health:IsShown() then
return frame.unitFrame.Health, frame.unitFrame
elseif frame.unitFrame then
return frame.unitFrame, frame.unitFrame
end
end,
KuiNameplate = function(frame)
if frame.kui and frame.kui.HealthBar and frame.kui.HealthBar:IsShown() then
return frame.kui.HealthBar, frame.kui
elseif frame.kui and frame.kui.NameText and frame.kui.NameText:IsShown() then
return frame.kui.NameText, frame.kui
elseif frame.kui then
return frame.kui, frame.kui
end
end,
Plater = function(frame)
if frame.unitFrame and frame.unitFrame.healthBar and frame.unitFrame.healthBar:IsShown() then
return frame.unitFrame.healthBar, frame.unitFrame
elseif frame.unitFrame and frame.unitFrame.ActorNameSpecial and frame.unitFrame.ActorNameSpecial:IsShown() then
return frame.unitFrame.ActorNameSpecial, frame.unitFrame
elseif frame.unitFrame then
return frame.unitFrame, frame.unitFrame
end
end,
NeatPlates = function(frame)
if frame.carrier and frame.extended and frame.extended.bars and frame.carrier:IsShown() then
return frame.extended.bars.healthbar, frame.extended
end
end,
ThreatPlates = function(frame)
if frame.TPFrame.GetAnchor then
return frame.TPFrame:GetAnchor()
elseif frame.UnitFrame:IsShown() then
return frame.UnitFrame, frame.UnitFrame
else
-- Fallback solution if TP was not yet updated and GetAnchor is not available.
return frame.TPFrame, frame.TPFrame
end
end,
TidyPlates = function(frame)
if frame.carrier and frame.extended and frame.extended.bars and frame.carrier:IsShown() then
return frame.extended.bars.healthbar, frame.extended
end
end,
oUF = function(frame)
return frame.unitFrame.Health, frame.unitFrame
end,
Blizzard = function(frame)
if WOW_PROJECT_ID == WOW_PROJECT_CLASSIC then
return frame.UnitFrame, frame.UnitFrame
end
if frame.UnitFrame and frame.UnitFrame.healthBar and frame.UnitFrame.healthBar:IsShown() then
return frame.UnitFrame.healthBar, frame.UnitFrame
elseif frame.UnitFrame and frame.UnitFrame.name and frame.UnitFrame.name:IsShown() then
return frame.UnitFrame.name, frame.UnitFrame
elseif frame.UnitFrame then
return frame.UnitFrame, frame.UnitFrame
end
end,
}
local nameplatesAnchors = {
[1] = {
used = function()
return ElvUI and ElvUI[1].NamePlates and ElvUI[1].NamePlates.Initialized
end,
func = GetNameplateAnchor.ElvUINameplates,
},
[2] = {
used = function()
return NDui and NDui[2].db.Nameplate.Enable
end,
func = GetNameplateAnchor.ElvUINameplates, -- all by oUF
},
[3] = {
used = function()
return KuiNameplates ~= nil
end,
func = GetNameplateAnchor.KuiNameplate,
},
[4] = {
used = function()
return Plater ~= nil
end,
func = GetNameplateAnchor.Plater,
},
[5] = {
used = function()
return NeatPlates ~= nil
end,
func = GetNameplateAnchor.NeatPlates,
},
[6] = {
used = function(frame)
-- IsAddOnLoaded("TidyPlates_ThreatPlates") should be better
return TidyPlatesThreat ~= nil
end,
func = GetNameplateAnchor.ThreatPlates,
},
[7] = {
used = function()
return TidyPlates ~= nil
end,
func = GetNameplateAnchor.TidyPlates,
},
[8] = {
used = function()
return _G.oUF_NamePlateDriver
end,
func = GetNameplateAnchor.oUF,
},
[9] = {
used = function(frame) return frame.UnitFrame ~= nil end,
func = GetNameplateAnchor.Blizzard,
},
}
local anchors = {
["ElvUI"] = {
func = GetAnchor.ElvUIFrames,
noPortait = true,
units = {
player = "ElvUF_Player",
pet = "ElvUF_Pet",
target = "ElvUF_Target",
focus = "ElvUF_Focus",
party1 = "ElvUF_PartyGroup1UnitButton2",
party2 = "ElvUF_PartyGroup1UnitButton3",
party3 = "ElvUF_PartyGroup1UnitButton4",
party4 = "ElvUF_PartyGroup1UnitButton5",
arena1 = "ElvUF_Arena1",
arena2 = "ElvUF_Arena2",
arena3 = "ElvUF_Arena3",
arena4 = "ElvUF_Arena4",
arena5 = "ElvUF_Arena5",
},
},
["NDui"] = {
func = GetAnchor.NDuiFrames,
noPortait = true,
units = {
player = "oUF_Player",
pet = "oUF_Pet",
target = "oUF_Target",
focus = "oUF_Focus",
party1 = "oUF_PartyGroup1UnitButton2",
party2 = "oUF_PartyGroup1UnitButton3",
party3 = "oUF_PartyGroup1UnitButton4",
party4 = "oUF_PartyGroup1UnitButton5",
arena1 = "oUF_Arena1",
arena2 = "oUF_Arena2",
arena3 = "oUF_Arena3",
arena4 = "oUF_Arena4",
arena5 = "oUF_Arena5",
},
},
["bUnitFrames"] = {
noPortait = true,
alignLeft = true,
units = {
player = "bplayerUnitFrame",
pet = "bpetUnitFrame",
target = "btargetUnitFrame",
focus = "bfocusUnitFrame",
arena1 = "barena1UnitFrame",
arena2 = "barena2UnitFrame",
arena3 = "barena3UnitFrame",
arena4 = "barena4UnitFrame",
},
},
["Shadowed Unit Frames"] = {
func = GetAnchor.ShadowedUnitFrames,
units = {
player = "SUFUnitplayer",
pet = "SUFUnitpet",
target = "SUFUnittarget",
focus = "SUFUnitfocus",
party1 = "SUFHeaderpartyUnitButton1",
party2 = "SUFHeaderpartyUnitButton2",
party3 = "SUFHeaderpartyUnitButton3",
party4 = "SUFHeaderpartyUnitButton4",
},
},
["ZPerl"] = {
func = GetAnchor.ZPerl,
units = {
player = "XPerl_PlayerportraitFrame",
pet = "XPerl_Player_PetportraitFrame",
target = "XPerl_TargetportraitFrame",
focus = "XPerl_FocusportraitFrame",
party1 = "XPerl_party1portraitFrame",
party2 = "XPerl_party2portraitFrame",
party3 = "XPerl_party3portraitFrame",
party4 = "XPerl_party4portraitFrame",
},
},
["sArena"] = {
func = GetAnchor.sArena,
units = {
arena1 = "sArenaEnemyFrame1",
arena2 = "sArenaEnemyFrame2",
arena3 = "sArenaEnemyFrame3",
arena4 = "sArenaEnemyFrame4",
arena5 = "sArenaEnemyFrame5",
},
},
["Pitbull"] = {
func = GetAnchor.PitBull,
units = {
player = "PitBull4_Frames_Player",
pet = "PitBull4_Frames_Player's pet",
target = "PitBull4_Frames_Target",
focus = "PitBull4_Frames_Focus",
party1 = "PitBull4_Groups_PartyUnitButton1",
party2 = "PitBull4_Groups_PartyUnitButton2",
party3 = "PitBull4_Groups_PartyUnitButton3",
party4 = "PitBull4_Groups_PartyUnitButton4",
},
},
["Cell"] = {
noPortait = true,
alignLeft = true,
func = GetAnchor.Cell,
units = {
player = "CellPartyFrameMember1",
party1 = "CellPartyFrameMember2",
party2 = "CellPartyFrameMember3",
party3 = "CellPartyFrameMember4",
party4 = "CellPartyFrameMember5",
},
},
["Blizzard"] = {
units = {
player = "PlayerPortrait",
pet = "PetPortrait",
target = "TargetFramePortrait",
focus = "FocusFramePortrait",
party1 = "PartyMemberFrame1Portrait",
party2 = "PartyMemberFrame2Portrait",
party3 = "PartyMemberFrame3Portrait",
party4 = "PartyMemberFrame4Portrait",
arena1 = "ArenaEnemyFrame1ClassPortrait",
arena2 = "ArenaEnemyFrame2ClassPortrait",
arena3 = "ArenaEnemyFrame3ClassPortrait",
arena4 = "ArenaEnemyFrame4ClassPortrait",
arena5 = "ArenaEnemyFrame5ClassPortrait",
},
},
}
if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then
anchors.Blizzard.units = {
player = "PlayerFrame",
pet = "PetPortrait",
target = "TargetFrame",
focus = "FocusFrame",
arena1 = "ArenaEnemyMatchFrame1ClassPortrait",
arena2 = "ArenaEnemyMatchFrame2ClassPortrait",
arena3 = "ArenaEnemyMatchFrame3ClassPortrait",
arena4 = "ArenaEnemyMatchFrame4ClassPortrait",
arena5 = "ArenaEnemyMatchFrame5ClassPortrait",
}
for memberFrame in _G.PartyFrame.PartyMemberFramePool:EnumerateActive() do
anchors.Blizzard.units[memberFrame.unit] = memberFrame
end
end
BigDebuffs.anchors = anchors
function BigDebuffs:OnInitialize()
self.db = LibStub("AceDB-3.0"):New("BigDebuffsDB", defaults, true)
-- Upgrade old database
if type(self.db.profile.raidFrames.dispellable) == "number" then
self.db.profile.raidFrames.dispellable = {
cc = self.db.profile.raidFrames.dispellable,
roots = self.db.profile.raidFrames.roots
}
end
for i = 1, #units do
local key = units[i]:gsub("%d", "")
if type(self.db.profile.unitFrames[key]) == "boolean" then
self.db.profile.unitFrames[key] = {
enabled = self.db.profile.unitFrames[key],
anchor = "auto",
anchorPoint = "auto",
relativePoint = "auto",
x = 0,
y = 0,
matchFrameHeight = true,
size = 50
}
else
if type(self.db.profile.unitFrames[key].anchorPoint) ~= "string" then
self.db.profile.unitFrames[key].anchorPoint = "auto"
end
if type(self.db.profile.unitFrames[key].relativePoint) ~= "string" then
self.db.profile.unitFrames[key].relativePoint = "auto"
end
if type(self.db.profile.unitFrames[key].x) ~= "number" then
self.db.profile.unitFrames[key].x = 0
end
if type(self.db.profile.unitFrames[key].y) ~= "number" then
self.db.profile.unitFrames[key].y = 0
end
if type(self.db.profile.unitFrames[key].matchFrameHeight) ~= "boolean" then
self.db.profile.unitFrames[key].matchFrameHeight = true
end
end
end
if self.db.profile.raidFrames.showAllClassBuffs == nil then
self.db.profile.raidFrames.showAllClassBuffs = true
end
self.db.RegisterCallback(self, "OnProfileChanged", "Refresh")
self.db.RegisterCallback(self, "OnProfileCopied", "Refresh")
self.db.RegisterCallback(self, "OnProfileReset", "Refresh")
self.frames = {}
self.UnitFrames = {}
self.Nameplates = {}
self:SetupOptions()
end
local function HideBigDebuffs(frame)
if not frame.BigDebuffs then return end
for i = 1, #frame.BigDebuffs do
frame.BigDebuffs[i]:Hide()
end
end
function BigDebuffs:Refresh()
for frame, _ in pairs(self.frames) do
if frame:IsVisible() then CompactUnitFrame_UpdateAuras(frame) end
if frame and frame.BigDebuffs then self:AddBigDebuffs(frame) end
end
for unit, frame in pairs(self.UnitFrames) do
frame:Hide()
frame.current = nil
if self.db.profile.unitFrames.cooldownCount then
local text = frame.cooldown:GetRegions()
if text then
text:SetFont(LibSharedMedia:Fetch("font", BigDebuffs.db.profile.unitFrames.cooldownFont),
self.db.profile.unitFrames.cooldownFontSize, self.db.profile.unitFrames.cooldownFontEffect)
end
end
frame.cooldown:SetHideCountdownNumbers(not self.db.profile.unitFrames.cooldownCount)
frame.cooldown.noCooldownCount = not self.db.profile.unitFrames.cooldownCount
self:UNIT_AURA(unit)
end
for unit, frame in pairs(self.Nameplates) do
frame:Hide()
frame.current = nil
if self.db.profile.unitFrames.cooldownCount then
local text = frame.cooldown:GetRegions()
if text then
text:SetFont(LibSharedMedia:Fetch("font", BigDebuffs.db.profile.unitFrames.cooldownFont),
self.db.profile.unitFrames.cooldownFontSize, self.db.profile.unitFrames.cooldownFontEffect)
end
end
frame.cooldown:SetHideCountdownNumbers(not self.db.profile.unitFrames.cooldownCount)
frame.cooldown.noCooldownCount = not self.db.profile.unitFrames.cooldownCount
self:UNIT_AURA_NAMEPLATE(unit)
end
end
function BigDebuffs:AttachUnitFrame(unit)
if InCombatLockdown() then return end
local frame = self.UnitFrames[unit]
local frameName = addonName .. unit .. "UnitFrame"
if not frame then
frame = CreateFrame("Frame", frameName, UIParent, "BigDebuffsUnitFrameTemplate")
self.UnitFrames[unit] = frame
frame:SetScript("OnEvent", function() self:UNIT_AURA(unit) end)
if self.db.profile.unitFrames.cooldownCount then
local text = frame.cooldown:GetRegions()
if text then
text:SetFont(LibSharedMedia:Fetch("font", BigDebuffs.db.profile.unitFrames.cooldownFont),
self.db.profile.unitFrames.cooldownFontSize, self.db.profile.unitFrames.cooldownFontEffect)
end
end
frame.cooldown:SetHideCountdownNumbers(not self.db.profile.unitFrames.cooldownCount)
frame.cooldown.noCooldownCount = not self.db.profile.unitFrames.cooldownCount
--frame.icon:SetDrawLayer("BORDER")
frame:RegisterUnitEvent("UNIT_AURA", unit)
frame:RegisterForDrag("LeftButton")
frame:SetMovable(true)
frame.unit = unit
end
frame:EnableMouse(self.test)
if self.test and not frame.anchor and unit then
_G[frameName .. "Name"]:SetText(unit)
end
frame.anchor = nil
frame.blizzard = nil
local config = self.db.profile.unitFrames[unit:gsub("%d", "")]
if config.anchor == "auto" then
-- Find a frame to attach to
for k, v in pairs(anchors) do
local anchor, parent, noPortait
if v.units[unit] then
if v.func then
anchor, parent, noPortait = v.func(v.units[unit])
else
if k == "Blizzard" and type(v.units[unit]) == "table" then
anchor = v.units[unit]
else
anchor = _G[v.units[unit]]
end
end
if anchor then
frame.anchor, frame.parent, frame.noPortait = anchor, parent, noPortait
if v.noPortait then frame.noPortait = true end
frame.alignLeft = v.alignLeft
frame.blizzard = (k == "Blizzard" or k == "sArena")
if not frame.blizzard then break end
end
end
end
end
if frame.anchor then
if frame.blizzard then
local parent = frame.anchor.portrait and frame.anchor.portrait:GetParent() or frame.anchor:GetParent()
frame:SetParent(parent)
frame:SetFrameLevel(parent:GetFrameLevel())
if frame.anchor.portrait then
local portraitParent = frame.anchor.portrait:GetParent()
if portraitParent and portraitParent.FrameTexture then
portraitParent.FrameTexture:SetDrawLayer("ARTWORK", 1)
end
frame.anchor.portrait:SetDrawLayer("BACKGROUND", 0)
elseif frame.anchor.SetDrawLayer then
frame.anchor:SetDrawLayer("BACKGROUND", 0)
end
frame.cooldown:SetSwipeTexture("Interface\\CHARACTERFRAME\\TempPortraitAlphaMaskSmall")
else
frame:SetParent(frame.parent and frame.parent or frame.anchor)
frame:SetFrameLevel(99)
end
frame:ClearAllPoints()
if config.anchorPoint ~= "auto" or frame.noPortait then
if config.anchorPoint == "auto" then
-- No portrait, so attach to the side
if frame.alignLeft then
frame:SetPoint("TOPRIGHT", frame.anchor, "TOPLEFT")
else
if frame.blizzard and frame.anchor.portrait then