-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathOptions.lua
1946 lines (1824 loc) · 84.6 KB
/
Options.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
---@class BuffOverlay: AceModule
local BuffOverlay = LibStub("AceAddon-3.0"):GetAddon("BuffOverlay")
local LibDialog = LibStub("LibDialog-1.0")
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
local AceRegistry = LibStub("AceConfigRegistry-3.0")
local AceConfig = LibStub("AceConfig-3.0")
local version = C_AddOns.GetAddOnMetadata("BuffOverlay", "Version")
-- Localization Table
local L = BuffOverlay.L
local GetSpellInfo = BuffOverlay.GetSpellInfo
local GetSpellDescription = GetSpellDescription or C_Spell.GetSpellDescription
local GetCVarBool = GetCVarBool
local SetCVar = SetCVar
local InCombatLockdown = InCombatLockdown
local CopyTable = CopyTable
local format = format
local next = next
local wipe = wipe
local pairs = pairs
local type = type
local tonumber = tonumber
local tostring = tostring
local MAX_CLASSES = MAX_CLASSES
local CLASS_SORT_ORDER = CopyTable(CLASS_SORT_ORDER)
do
table.sort(CLASS_SORT_ORDER)
end
local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE
local isRetail = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
local optionsDisabled = {}
local customSpellDescriptions = {
[362486] = 353114, -- Keeper of the Grove
}
-- Fix for ContinueOnSpellLoad tainting the spellbook and potentially blocking action bars
-- See: https://github.com/Stanzilla/WoWUIBugs/issues/373 for more information
-- Credit to: https://github.com/jordonwow/omnibar/pull/246
local spellDescriptions = CreateFrame("Frame")
spellDescriptions:SetScript("OnEvent", function(self, event, spellId, success)
if success then
local id = customSpellDescriptions[spellId] or spellId
self[spellId] = GetSpellDescription(id)
end
end)
spellDescriptions:RegisterEvent("SPELL_DATA_LOAD_RESULT")
local customSpellNames = {
[228050] = GetSpellInfo(228049),
}
BuffOverlay.customIcons = {
[L["Eating/Drinking"]] = 134062,
["?"] = 134400,
["Cogwheel"] = 136243,
}
BuffOverlay.ignoreParentIcons = {
[L["Eating/Drinking"]] = true,
[197268] = true, -- Ray of Hope
}
local customIcons = BuffOverlay.customIcons
local classIcons = {
["DEATHKNIGHT"] = 135771,
["DEMONHUNTER"] = 1260827,
["DRUID"] = 625999,
["EVOKER"] = 4574311,
["HUNTER"] = 626000,
["MAGE"] = 626001,
["MONK"] = 626002,
["PALADIN"] = 626003,
["PRIEST"] = 626004,
["ROGUE"] = 626005,
["SHAMAN"] = 626006,
["WARLOCK"] = 626007,
["WARRIOR"] = 626008,
}
local deleteSpellDelegate = {
buttons = {
{
text = YES,
on_click = function(self)
local spellId = tonumber(self.data)
if not spellId then return end
if BuffOverlay.db.profile.buffs[spellId].children then
for childId in pairs(BuffOverlay.db.profile.buffs[spellId].children) do
if BuffOverlay.db.global.customBuffs[childId]
and not (BuffOverlay.defaultSpells[childId] and BuffOverlay.defaultSpells[childId].parent == spellId) then
BuffOverlay.db.profile.buffs[childId] = nil
BuffOverlay.db.profile.buffs[spellId].children[childId] = nil
end
end
if next(BuffOverlay.db.profile.buffs[spellId].children) == nil then
BuffOverlay.db.profile.buffs[spellId].children = nil
BuffOverlay.db.profile.buffs[spellId].UpdateChildren = nil
end
end
BuffOverlay.db.global.customBuffs[spellId] = nil
for id, spell in pairs(BuffOverlay.db.global.customBuffs) do
if spell.parent and spell.parent == spellId then
BuffOverlay.db.global.customBuffs[id] = nil
end
end
if BuffOverlay.defaultSpells[spellId] then
for k, v in pairs(BuffOverlay.defaultSpells[spellId]) do
if type(v) == "table" then
BuffOverlay.db.profile.buffs[spellId][k] = CopyTable(v)
else
BuffOverlay.db.profile.buffs[spellId][k] = v
end
end
BuffOverlay.db.profile.buffs[spellId].custom = nil
-- for barName in pairs(BuffOverlay.db.profile.bars) do
-- BuffOverlay.db.profile.buffs[spellId].enabled[barName] = false
-- end
else
BuffOverlay.db.profile.buffs[spellId] = nil
end
customIcons[spellId] = nil
if BuffOverlay.db.profile.buffs[spellId] and BuffOverlay.db.profile.buffs[spellId].children then
BuffOverlay.db.profile.buffs[spellId]:UpdateChildren()
end
BuffOverlay.options.args.customSpells.args[self.data] = nil
if AceConfigDialog.OpenFrames["BuffOverlayDialog"] then
BuffOverlay.priorityListDialog.args[self.data] = nil
AceRegistry:NotifyChange("BuffOverlayDialog")
end
BuffOverlay:UpdateSpellOptionsTable()
BuffOverlay:RefreshOverlays()
AceRegistry:NotifyChange("BuffOverlay")
end,
},
{
text = NO,
},
},
no_close_button = true,
show_while_dead = true,
hide_on_escape = true,
on_show = function(self)
self:SetFrameStrata("FULLSCREEN_DIALOG")
self:Raise()
end,
}
local function IsDifferentDialogBar(barName)
return BuffOverlay.priorityListDialog.args.bar.name ~= barName
end
local deleteBarDelegate = {
buttons = {
{
text = YES,
on_click = function(self)
local barName = self.data
BuffOverlay:DeleteBar(barName)
if AceConfigDialog.OpenFrames["BuffOverlayDialog"] and not IsDifferentDialogBar(barName) then
AceConfigDialog:Close("BuffOverlayDialog")
end
AceRegistry:NotifyChange("BuffOverlay")
end,
},
{
text = NO,
},
},
no_close_button = true,
show_while_dead = true,
hide_on_escape = true,
on_show = function(self)
self:SetFrameStrata("FULLSCREEN_DIALOG")
self:Raise()
end,
}
-- Change the path for the new options menu in 10.0
local path = isRetail and L["Options > Gameplay > Action Bars > Show Numbers for Cooldowns"] or L["Interface > ActionBars > Show Numbers for Cooldowns"]
LibDialog:Register("ConfirmEnableBlizzardCooldownText", {
text = format(L["In order for %s setting to work in BuffOverlay, cooldown text needs to be enabled in Blizzard settings. You can find this setting located at:%s%s%sWould you like BuffOverlay to enable this setting for you?%s"], BuffOverlay:Colorize(L["Show Blizzard Cooldown Text"], "main"), "\n\n", BuffOverlay:Colorize(path), "\n\n", "\n\n"),
buttons = {
{
text = YES,
on_click = function(self)
local bar = self.data
SetCVar("countdownForCooldowns", true)
bar.showCooldownNumbers = true
BuffOverlay:RefreshOverlays(true)
AceRegistry:NotifyChange("BuffOverlay")
end,
},
{
text = NO,
},
},
no_close_button = true,
show_while_dead = true,
hide_on_escape = true,
on_show = function(self)
self:SetFrameStrata("FULLSCREEN_DIALOG")
self:Raise()
end,
})
LibDialog:Register("ShowVersion", {
text = format(L["%s%sCopy this version number and send it to the author if you need help with a bug."], BuffOverlay:Colorize(GAME_VERSION_LABEL, "main"), "\n"),
buttons = {
{
text = OKAY,
},
},
editboxes = {
{
auto_focus = false,
text = format("%s", version),
width = 200,
},
},
no_close_button = true,
show_while_dead = true,
hide_on_escape = true,
on_show = function(self)
self:SetFrameStrata("FULLSCREEN_DIALOG")
self:Raise()
end,
})
function BuffOverlay:ShowVersion()
LibDialog:Spawn("ShowVersion")
end
function BuffOverlay:GetIconString(icon, iconSize)
local size = iconSize or 0
local ltTexel = 0.08 * 256
local rbTexel = 0.92 * 256
if not icon then
icon = customIcons["?"]
end
return format("|T%s:%d:%d:0:0:256:256:%d:%d:%d:%d|t", icon, size, size, ltTexel, rbTexel, ltTexel, rbTexel)
end
local function AddToPriorityDialog(spellIdStr, remove)
local list = BuffOverlay.priorityListDialog.args
local spellId = tonumber(spellIdStr) or spellIdStr
local spell = BuffOverlay.db.profile.buffs[spellId]
local spellName, _, icon = GetSpellInfo(spellId)
if not spell then return end
if customIcons[spellId] then
icon = customIcons[spellId]
end
if customSpellNames[spellId] then
spellName = customSpellNames[spellId]
end
-- local formattedName = (spellName and icon) and format("%s %s", BuffOverlay:GetIconString(icon, 20), spellName) or
-- icon and format("%s %s", BuffOverlay:GetIconString(icon, 20), spellId) or spellIdStr
if remove then
list[spellIdStr] = nil
else
list[spellIdStr] = {
name = BuffOverlay:Colorize(spellName or spellIdStr, spell.class) .. " [" .. spell.prio .. "]",
image = icon,
imageCoords = { 0.08, 0.92, 0.08, 0.92 },
imageWidth = 16,
imageHeight = 16,
type = "description",
order = spell.prio + 1,
}
end
end
local function GetSpells(class, barName)
local spells = {}
local optionsWidth = 0.975
if next(BuffOverlay.db.profile.buffs) ~= nil then
for k, v in pairs(BuffOverlay.db.profile.buffs) do
-- Check if spell is valid for new db structure. If not, likely from old profile. Reset needed.
if type(v) ~= "table" or not v.prio or not v.class then
wipe(BuffOverlay.db.profile.buffs)
BuffOverlay:Print(L["Corrupted buff database found. This is likely due to updating from an older version of Buff Overlay. Resetting buff database to default. Your other settings (including custom buffs) will be preserved."])
return
end
if not v.parent and (v.class == class) then
local spellName, _, icon = GetSpellInfo(k)
local spellIdStr = tostring(k)
if customIcons[k] then
icon = customIcons[k]
end
if not spellName then
optionsDisabled[k] = true
end
if not icon then
icon = customIcons["?"]
end
if customSpellNames[k] then
spellName = customSpellNames[k]
end
local formattedName = (spellName and icon) and format("%s%s", BuffOverlay:GetIconString(icon), spellName)
or icon and format("%s%s", BuffOverlay:GetIconString(icon), k) or spellIdStr
if spellName then
if not spellDescriptions[k] then
C_Spell.RequestLoadSpellData(k)
end
end
spells[spellIdStr] = {
name = "",
type = "group",
inline = true,
order = v.prio,
args = {
toggle = {
name = spellName or (type(k) == "string" and k) or format(L["Invalid Spell: %s"], k),
image = icon,
imageCoords = { 0.08, 0.92, 0.08, 0.92 },
type = "toggle",
order = 0,
width = optionsWidth,
desc = function()
local description = spellDescriptions[k] and spellDescriptions[k] ~= ""
and spellDescriptions[k] .. "\n" or ""
description = description
.. format("\n%s %d", BuffOverlay:Colorize(L["Priority"]), v.prio)
.. (spellName and format("\n%s %d", BuffOverlay:Colorize(L["Spell ID"]), k) or "")
if BuffOverlay.db.profile.buffs[k].children then
description = description .. "\n" .. BuffOverlay:Colorize(L["Child Spell ID(s)"]) .. "\n"
for child in pairs(BuffOverlay.db.profile.buffs[k].children) do
description = description .. child .. "\n"
end
end
return description
end,
get = function(info)
local glowState = BuffOverlay.db.profile.buffs[k].state[barName].glow
info.option.width = (glowState.customColor and glowState.enabled) and (optionsWidth - 0.1) or optionsWidth
return BuffOverlay.db.profile.buffs[k].state[barName].enabled
end,
set = function(_, value)
BuffOverlay.db.profile.buffs[k].state[barName].enabled = value
if BuffOverlay.db.profile.buffs[k].children then
for child in pairs(BuffOverlay.db.profile.buffs[k].children) do
BuffOverlay.db.profile.buffs[child].state[barName].enabled = value
end
end
if AceConfigDialog.OpenFrames["BuffOverlayDialog"] then
if IsDifferentDialogBar(barName) then
BuffOverlay:CreatePriorityDialog(barName)
end
AddToPriorityDialog(spellIdStr, not value)
AceRegistry:NotifyChange("BuffOverlayDialog")
end
BuffOverlay:RefreshOverlays()
end,
},
edit = {
name = "",
image = "Interface\\Buttons\\UI-OptionsButton",
imageWidth = 12,
imageHeight = 12,
type = "execute",
order = 1,
width = 0.1,
func = function()
local key = k .. barName
BuffOverlay[key] = not BuffOverlay[key] or nil
end,
},
glowColor = {
name = "",
type = "color",
order = 2,
width = 0.1,
hasAlpha = true,
hidden = function()
local glowState = BuffOverlay.db.profile.buffs[k].state[barName].glow
return not (glowState.customColor and glowState.enabled)
end,
get = function()
return unpack(BuffOverlay.db.profile.buffs[k].state[barName].glow.color)
end,
set = function(_, r, g, b, a)
local color = BuffOverlay.db.profile.buffs[k].state[barName].glow.color
color[1] = r
color[2] = g
color[3] = b
color[4] = a
if BuffOverlay.db.profile.buffs[k].UpdateChildren then
BuffOverlay.db.profile.buffs[k]:UpdateChildren()
end
BuffOverlay:RefreshOverlays()
end,
},
glow = {
name = L["Glow"],
desc = L["Enable a glow border effect around the icon."],
type = "toggle",
order = 2,
width = 0.4,
get = function()
return BuffOverlay.db.profile.buffs[k].state[barName].glow.enabled
end,
set = function(_, value)
BuffOverlay.db.profile.buffs[k].state[barName].glow.enabled = value
if BuffOverlay.db.profile.buffs[k].UpdateChildren then
BuffOverlay.db.profile.buffs[k]:UpdateChildren()
end
BuffOverlay:RefreshOverlays()
end,
},
own = {
name = L["Own"],
desc = L["Only show the aura if you cast it."],
type = "toggle",
order = 3,
width = 0.4,
get = function()
return BuffOverlay.db.profile.buffs[k].state[barName].ownOnly
end,
set = function(_, value)
BuffOverlay.db.profile.buffs[k].state[barName].ownOnly = value
if BuffOverlay.db.profile.buffs[k].UpdateChildren then
BuffOverlay.db.profile.buffs[k]:UpdateChildren()
end
BuffOverlay:RefreshOverlays()
end,
},
additionalSettings = {
name = " ",
type = "group",
inline = true,
order = 4,
hidden = function()
local key = k .. barName
return BuffOverlay[key] == nil and true or not BuffOverlay[key]
end,
args = {
header = {
name = BuffOverlay:GetIconString(icon, 25) or "",
type = "header",
order = 0,
},
glowType = {
name = L["Glow Type"],
type = "select",
order = 1,
width = 0.75,
values = {
["blizz"] = L["Action Button"],
["pixel"] = L["Pixel"],
["oldBlizz"] = isRetail and L["Legacy Blizzard"] or nil,
},
get = function()
return BuffOverlay.db.profile.buffs[k].state[barName].glow.type
end,
set = function(_, value)
BuffOverlay.db.profile.buffs[k].state[barName].glow.type = value
if BuffOverlay.db.profile.buffs[k].UpdateChildren then
BuffOverlay.db.profile.buffs[k]:UpdateChildren()
end
BuffOverlay:RefreshOverlays(true, barName)
end,
},
space = {
name = " ",
type = "description",
order = 2,
width = 0.05,
hidden = function()
return optionsDisabled[k]
end,
},
space2 = {
name = " ",
type = "description",
order = 2,
width = 1,
hidden = function()
return not optionsDisabled[k]
end,
},
editGlobalSettings = {
name = L["Edit Global Settings"],
type = "execute",
desc = format(L["Add %s to the custom spell list, opening up global settings to edit for this spell."], formattedName),
order = 3,
width = 0.95,
hidden = function()
return optionsDisabled[k]
end,
func = function()
BuffOverlay:AddToCustom(k)
local dialog = AceConfigDialog.OpenFrames["BuffOverlay"]
if dialog and dialog.children then
for cKey, child in pairs(dialog.children) do
if child.tabs then
for tKey, tab in pairs(child.tabs) do
if tab.value == "customSpells" then
C_Timer.After(0, function()
-- Click over to custom spells tab
dialog.children[cKey].tabs[tKey]:Click()
-- Find and select the spell in the list
for _, va in pairs(dialog.children[cKey].children) do
if va.SelectByValue then
for _, vb in pairs(va.lines) do
if vb.value == tostring(k) then
va:SelectByValue(vb.uniquevalue)
return
end
end
end
end
end)
return
end
end
end
end
end
end,
},
testAura = {
name = L["Test Aura"],
type = "execute",
desc = format(L["Show a test overlay for %s"], formattedName),
order = 4,
width = 0.75,
func = function()
if BuffOverlay.test then
if BuffOverlay:GetSingleTestAura() ~= k then
BuffOverlay:Test()
end
end
BuffOverlay:Test(barName, k)
end,
},
space3 = {
name = " ",
type = "description",
order = 5,
width = 0.05,
},
applyToAll = {
name = L["Apply to All"],
type = "execute",
desc = format(L["Apply %s's custom settings (glow, glow color, glow type, own only, etc) to all auras in %s.%sThis does not include any global settings (prio, class, etc)."], formattedName, BuffOverlay:Colorize(BuffOverlay.db.profile.bars[barName].name, "accent"), "\n\n"),
order = 6,
width = 0.95,
func = function()
local current = BuffOverlay.db.profile.buffs[k].state[barName]
for _, spell in pairs(BuffOverlay.db.profile.buffs) do
for key, val in pairs(spell.state[barName]) do
if key ~= "enabled" then
if type(val) == "table" then
spell.state[barName][key] = CopyTable(current[key])
else
spell.state[barName][key] = current[key]
end
end
end
end
BuffOverlay:RefreshOverlays(true, barName)
end,
},
customColor = {
name = L["Custom Glow Color"],
desc = L["Toggle whether or not to use a custom color for glow."],
type = "toggle",
order = 7,
width = 0.75,
get = function()
return BuffOverlay.db.profile.buffs[k].state[barName].glow.customColor
end,
set = function(_, value)
BuffOverlay.db.profile.buffs[k].state[barName].glow.customColor = value
if BuffOverlay.db.profile.buffs[k].UpdateChildren then
BuffOverlay.db.profile.buffs[k]:UpdateChildren()
end
BuffOverlay:RefreshOverlays(true, barName)
end,
},
},
},
},
}
end
end
end
return spells
end
function BuffOverlay:CreatePriorityDialog(barName)
local bar = self.db.profile.bars[barName]
local spells = {
bar = {
name = barName,
type = "description",
hidden = true,
},
desc = {
name = format(L["This informational panel is the full list of spells currently enabled for %s in order of priority. Any aura changes made while this panel is open will be reflected here in real time."], self:Colorize(bar.name, "main")),
type = "description",
order = 0,
},
space = {
name = " ",
type = "description",
order = 0.5,
},
}
for spellIdStr, info in pairs(GetSpells("MISC", barName)) do
local spellId = tonumber(spellIdStr) or spellIdStr
if self.db.profile.buffs[spellId].state[barName].enabled then
spells[spellIdStr] = {
name = self:Colorize(info.args.toggle.name, "MISC") .. " [" .. info.order .. "]",
image = info.args.toggle.image,
imageCoords = info.args.toggle.imageCoords,
imageWidth = 16,
imageHeight = 16,
type = "description",
order = info.order + 1,
}
end
end
for i = 1, MAX_CLASSES do
local className = CLASS_SORT_ORDER[i]
for spellIdStr, info in pairs(GetSpells(className, barName)) do
local spellId = tonumber(spellIdStr) or spellIdStr
if self.db.profile.buffs[spellId].state[barName].enabled then
spells[spellIdStr] = {
name = self:Colorize(info.args.toggle.name, className) .. " [" .. info.order .. "]",
image = info.args.toggle.image,
imageCoords = info.args.toggle.imageCoords,
imageWidth = 16,
imageHeight = 16,
type = "description",
order = info.order + 1,
}
end
end
end
self.priorityListDialog.name = self:Colorize(bar.name, "main") .. " " .. L["Enabled Auras Priority List"]
self.priorityListDialog.args = spells
end
local function GetClasses(barName)
local classes = {}
classes["MISC"] = {
name = format("%s %s", BuffOverlay:GetIconString(customIcons["Cogwheel"], 15), BuffOverlay:Colorize(MISCELLANEOUS, "MISC")),
order = 99,
type = "group",
args = GetSpells("MISC", barName),
}
for i = 1, MAX_CLASSES do
local className = CLASS_SORT_ORDER[i]
classes[className] = {
name = format("%s %s", BuffOverlay:GetIconString(classIcons[className], 15), BuffOverlay:Colorize(LOCALIZED_CLASS_NAMES_MALE[className], className)),
order = i,
type = "group",
args = GetSpells(className, barName),
}
end
return classes
end
function BuffOverlay:UpdateSpellOptionsTable()
if self.options then
for barName in pairs(self.db.profile.bars) do
for k, v in pairs(GetClasses(barName)) do
if self.options.args.bars.args[barName] then
self.options.args.bars.args[barName].args.spells.args[k] = v
end
end
end
end
end
local function HasLessThanTwoBars()
local count = 0
for _ in pairs(BuffOverlay.db.profile.bars) do
count = count + 1
end
return count < 2
end
function BuffOverlay:AddBarToOptions(bar, barName)
self.options.args.bars.args[barName] = {
name = bar.name,
type = "group",
childGroups = "tab",
args = {
name = {
name = L["Set Bar Name"],
type = "input",
order = 0,
width = 1,
set = function(info, val)
bar[info[#info]] = val
self.options.args.bars.args[barName].name = val
if AceConfigDialog.OpenFrames["BuffOverlayDialog"] and not IsDifferentDialogBar(barName) then
self.priorityListDialog.name = self:Colorize(val, "main") .. " " .. L["Enabled Auras Priority List"]
self.priorityListDialog.args.desc.name = format(L["This informational panel is the full list of spells currently enabled for %s in order of priority. Any aura changes made while this panel is open will be reflected here in real time."], self:Colorize((val or barName), "main"))
AceRegistry:NotifyChange("BuffOverlayDialog")
end
if bar.group then
bar.group:SetName(val)
end
self:UpdateSpellOptionsTable()
end,
},
delete = {
name = L["Delete Bar"],
type = "execute",
order = 1,
width = 0.75,
func = function()
local text = format(L["Are you sure you want to delete this bar?%s%s%s"], "\n\n", BuffOverlay:Colorize(bar.name, "main"), "\n\n")
deleteBarDelegate.text = text
LibDialog:Spawn(deleteBarDelegate, barName)
end,
},
test = {
name = L["Test Bar"],
desc = L["Show test overlays for this bar."],
type = "execute",
order = 2,
width = 0.75,
func = function()
if self.test then
if self:GetSingleTestAura() ~= nil then
self:Test()
end
end
self:Test(barName)
end,
},
settings = {
name = SETTINGS,
type = "group",
order = 3,
get = function(info) return bar[info[#info]] end,
set = function(info, val)
bar[info[#info]] = val
self:RefreshOverlays(true, barName)
end,
args = {
copySettings = {
name = L["Copy Settings From"],
desc = L["This copies settings from 'Settings', 'Anchoring', and 'Visibility' tabs."],
type = "select",
order = 0,
width = 1,
values = function()
local values = {}
for k, v in pairs(self.db.profile.bars) do
if k ~= barName then
values[k] = v.name or k
end
end
return values
end,
hidden = HasLessThanTwoBars,
set = function(info, val)
for k, v in pairs(self.db.profile.bars[val]) do
if k ~= "name" then
bar[k] = type(v) == "table" and CopyTable(v) or v
end
end
self:Print(format(L["Copied settings, anchoring, and visibility tabs from %s to %s"], self:Colorize((self.db.profile.bars[val].name), "accent"), self:Colorize(bar.name, "accent")))
self:RefreshOverlays(true, barName)
end,
},
space = {
name = " ",
type = "description",
order = 0.5,
width = "full",
hidden = HasLessThanTwoBars,
},
iconCount = {
order = 1,
name = L["Icon Count"],
type = "range",
width = 1,
desc = L["Number of icons you want to display (per frame)."],
min = 1,
max = 40,
softMax = 10,
step = 1,
},
iconAlpha = {
order = 2,
name = L["Icon Alpha"],
type = "range",
width = 1,
desc = L["Icon transparency."],
min = 0,
max = 1,
step = 0.01,
},
iconScale = {
order = 3,
name = L["Icon Scale"],
type = "range",
width = 1,
desc = L["Scale the size of the icon. Base icon size is proportionate to its parent frame."],
min = 0.01,
max = 99,
softMax = 3,
step = 0.01,
},
stackCountScale = {
order = 3.5,
name = L["Stack Count Scale"],
type = "range",
width = 1,
desc = L["Scale the icon's stack count text size."],
min = 0.01,
max = 10,
softMax = 3,
step = 0.01,
disabled = function() return not bar.showStackCount end,
},
cooldownNumberScale = {
order = 4,
name = L["Cooldown Text Scale"],
type = "range",
width = 1,
desc = L["Scale the icon's cooldown text size."],
min = 0.01,
max = 10,
softMax = 3,
step = 0.01,
disabled = function() return not bar.showCooldownNumbers end,
},
iconSpacing = {
order = 5,
name = L["Icon Spacing"],
type = "range",
width = 1,
desc = L["Spacing between icons. Spacing is scaled based on icon size for uniformity across different icon sizes."],
min = 0,
max = 200,
softMax = 20,
step = 1,
},
iconBorder = {
order = 6,
name = L["Icon Border"],
type = "toggle",
width = 0.75,
desc = L["Adds a pixel border around the icon. This will also zoom the icon in slightly to remove any default borders that may be present."] ..
"\n\n" ..
L["(Note: This will be automatically disabled if Masque is enabled for this bar.)"],
},
iconBorderColor = {
order = 7,
name = L["Icon Border Color"],
type = "color",
width = 0.75,
desc = L["Change the icon border color."],
hasAlpha = true,
disabled = function() return not bar.iconBorder end,
get = function(info)
local t = bar[info[#info]]
return t.r, t.g, t.b, t.a
end,
set = function(info, r, g, b, a)
local t = bar[info[#info]]
t.r, t.g, t.b, t.a = r, g, b, a
self:RefreshOverlays(true, barName)
end,
},
iconBorderSize = {
order = 8,
name = L["Icon Border Size"],
type = "range",
width = 1.5,
desc = L["Change the icon border size (in pixels)."],
min = 1,
max = 10,
softMax = 5,
step = 1,
disabled = function() return not bar.iconBorder end,
},
showStackCount = {
order = 8.1,
name = L["Show Stack Count"],
type = "toggle",
width = "full",
desc = L["Toggle showing of the stack count text on the icon."],
},
debuffIconBorderColorByDispelType = {
order = 8.5,
name = L["Color Debuff Icon Border by Dispel Type"],
type = "toggle",
width = "full",
desc = L["Change the icon border color based on the dispel type of the debuff. This overrides the icon border color."],
disabled = function() return not bar.iconBorder end,
},
buffIconBorderColorByDispelType = {
order = 8.6,
name = L["Color Buff Icon Border by Dispel Type"],
type = "toggle",
width = "full",
desc = L["Change the icon border color based on the dispel type of the buff. This overrides the icon border color."],
disabled = function() return not bar.iconBorder end,
},
showCooldownSpiral = {
order = 9,
name = L["Cooldown Spiral"],
type = "toggle",
width = "full",
desc = L["Toggle showing of the cooldown spiral."],
},
showTooltip = {
order = 10,
name = L["Show Tooltip On Hover"],
type = "toggle",
width = "full",
desc = L["Toggle showing of the tooltip when hovering over an icon."],
},
showCooldownNumbers = {
order = 11,
name = L["Show Blizzard Cooldown Text"],
type = "toggle",
width = "full",
desc = L["Toggle showing of the cooldown text."],
get = function(info)
if not GetCVarBool("countdownForCooldowns") and bar[info[#info]] then
bar[info[#info]] = false
AceRegistry:NotifyChange("BuffOverlay")
end
return bar[info[#info]]
end,
set = function(info, val)
if val and not GetCVarBool("countdownForCooldowns") then
LibDialog:Spawn("ConfirmEnableBlizzardCooldownText", bar)
else
bar[info[#info]] = val
self:RefreshOverlays(true, barName)
end
end,
},
},
},
anchoring = {
name = L["Anchoring"],
order = 4,
type = "group",
get = function(info) return bar[info[#info]] end,
set = function(info, val)