Repository navigation
Expand file tree
/
Copy pathConfig.lua
More file actions
1765 lines (1713 loc) · 80 KB
/
Copy pathConfig.lua
File metadata and controls
1765 lines (1713 loc) · 80 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
---@diagnostic disable
local addonName, addon = ...
local AceConfig = LibStub("AceConfig-3.0")
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
local AceDB = LibStub("AceDB-3.0")
local AceDBOptions = LibStub("AceDBOptions-3.0")
local AceSerializer = LibStub("AceSerializer-3.0")
local LibDeflate = LibStub("LibDeflate")
local LSM = LibStub("LibSharedMedia-3.0")
-- ─── Register custom sounds with LibSharedMedia ──────────────────────────────
local SOUND_PATH = "Interface\\AddOns\\ProcGlows\\Media\\Sounds\\"
local customSounds = {"AcousticGuitar", "Adds", "AirHorn", "Applause", "BananaPeelSlip", "BatmanPunch", "BikeHorn", "Blast", "Bleat", "Boss",
"BoxingArenaSound", "Brass", "CartoonVoiceBaritone", "CartoonWalking", "CatMeow2", "ChickenAlarm", "Circle", "CowMooing",
"Cross", "Diamond", "DontRelease", "DoubleWhoosh", "Drums", "Empowered", "ErrorBeep", "Focus", "Glass", "GoatBleating",
"HeartbeatSingle", "Idiot", "KittenMeow", "Left", "Moon", "Next", "OhNo", "Portal", "Protected", "Release", "Right",
"RingingPhone", "RoaringLion", "RobotBlip", "RoosterChickenCalls", "RunAway", "SharpPunch", "SheepBleat", "Shotgun", "Skull",
"Spread", "Square", "SqueakyToyShort", "SquishFart", "Stack", "Star", "Switch", "SynthChord", "TadaFanfare", "Taunt",
"TempleBellHuge", "Torch", "Triangle", "WarningSiren", "WaterDrop", "Xylophone"}
for _, name in ipairs(customSounds) do
local ext = (name == "Brass" or name == "Glass") and ".mp3" or ".ogg"
LSM:Register(LSM.MediaType.SOUND, "PG: " .. name, SOUND_PATH .. name .. ext)
end
-- ─── Defaults ────────────────────────────────────────────────────────────────
local defaults = {
profile = {
auras = {
-- keyed by string spellID of the buff/proc
-- each entry: { anchorSpellID, color = {r,g,b}, shouldShow, glowIcon }
},
items = {
-- keyed by string itemID
-- each entry: { color = {r,g,b} }
},
spells = {
-- keyed by string spellID
-- each entry: { color = {r,g,b} }
},
combatOnly = false,
glowType = "Proc Glow",
replaceBlizzardProc = false,
blizzardProcGlowType = "Proc Glow",
hideAnimations = {
castbar = true
}
}
}
-- ─── Helpers ─────────────────────────────────────────────────────────────────
local function SpellName(id)
if not id or id == 0 then
return ""
end
local info = C_Spell.GetSpellInfo(id)
return info and info.name or tostring(id)
end
local function ItemName(id)
if not id or id == 0 then
return ""
end
local name = C_Item.GetItemNameByID(id)
if not name then
-- Request item data so it's available on next call
C_Item.RequestLoadItemDataByID(id)
local itemInfo = C_Item.GetItemInfo(id)
name = itemInfo and itemInfo.itemName
end
return name or tostring(id)
end
-- ─── Class info ──────────────────────────────────────────────────────────────
local CLASS_INFO = {{
token = "DEATHKNIGHT",
name = "Death Knight",
color = "C41E3A"
}, {
token = "DEMONHUNTER",
name = "Demon Hunter",
color = "A330C9"
}, {
token = "DRUID",
name = "Druid",
color = "FF7C0A"
}, {
token = "EVOKER",
name = "Evoker",
color = "33937F"
}, {
token = "HUNTER",
name = "Hunter",
color = "AAD372"
}, {
token = "MAGE",
name = "Mage",
color = "3FC7EB"
}, {
token = "MONK",
name = "Monk",
color = "00FF98"
}, {
token = "PALADIN",
name = "Paladin",
color = "F48CBA"
}, {
token = "PRIEST",
name = "Priest",
color = "FFFFFF"
}, {
token = "ROGUE",
name = "Rogue",
color = "FFF468"
}, {
token = "SHAMAN",
name = "Shaman",
color = "0070DD"
}, {
token = "WARLOCK",
name = "Warlock",
color = "8788EE"
}, {
token = "WARRIOR",
name = "Warrior",
color = "C69B6D"
}}
local function ClassDisplayName(token)
for _, info in ipairs(CLASS_INFO) do
if info.token == token then
return "|cff" .. info.color .. info.name .. "|r"
end
end
return token
end
local function ClassOrder(token)
for i, info in ipairs(CLASS_INFO) do
if info.token == token then
return i
end
end
return 99
end
-- Rebuild the runtime tables that Core.lua reads
function addon:RebuildTables()
-- Auras (nested by class)
self.Auras = {}
if self.db then
for classToken, classAuras in pairs(self.db.profile.auras) do
if type(classAuras) == "table" then
for key, entry in pairs(classAuras) do
-- Support both old (key=buffID) and new (key=buffID_anchorID) formats
local spellID = entry.buffSpellID or tonumber(key)
if spellID and entry.color then
if not self.Auras[spellID] then
self.Auras[spellID] = {}
end
self.Auras[spellID][#self.Auras[spellID] + 1] = {
anchorSpellID = entry.anchorSpellID,
color = {
r = entry.color.r,
g = entry.color.g,
b = entry.color.b
},
shouldShow = entry.shouldShow,
glowIcon = entry.glowIcon,
useDefaultColor = entry.useDefaultColor,
procSound = entry.procSound,
glowCooldownManager = entry.glowCooldownManager,
showStacks = entry.showStacks,
glowType = entry.glowType
}
end
end
end
end
end
-- Items (flat)
self.Items = {}
if self.db then
for key, entry in pairs(self.db.profile.items) do
local itemID = tonumber(key)
if itemID then
self.Items[key] = {
itemID = itemID,
color = {
r = entry.color.r,
g = entry.color.g,
b = entry.color.b
},
useDefaultColor = entry.useDefaultColor,
procSound = entry.procSound,
glowType = entry.glowType
}
end
end
end
-- Spells (nested by class)
self.Spells = {}
if self.db then
for classToken, classSpells in pairs(self.db.profile.spells) do
if type(classSpells) == "table" then
for key, entry in pairs(classSpells) do
local spellID = tonumber(key)
if spellID and entry.color then
self.Spells[spellID] = {
color = {
r = entry.color.r,
g = entry.color.g,
b = entry.color.b
},
useDefaultColor = entry.useDefaultColor,
procSound = entry.procSound,
glowCooldownManager = entry.glowCooldownManager,
glowType = entry.glowType
}
end
end
end
end
end
-- Rebuild button caches so they reflect the updated tables
if self.RebuildAuraAnchorCache then
self:RebuildAuraAnchorCache()
end
if self.RebuildSpellButtonCache then
self:RebuildSpellButtonCache()
end
if self.RebuildItemButtonCache then
self:RebuildItemButtonCache()
end
-- Drop active glows so the next check tick reapplies them with current colors/types
if self.HideAllGlows then
self:HideAllGlows()
end
end
-- ─── Import / Export helpers ─────────────────────────────────────────────────
local EXPORT_PREFIX = "!PG1!" -- versioned prefix so we can detect the format
local importExportState = {
exportString = "",
importString = ""
}
local function ExportProfile()
local data = {
auras = addon.db.profile.auras,
items = addon.db.profile.items,
spells = addon.db.profile.spells,
combatOnly = addon.db.profile.combatOnly,
glowType = addon.db.profile.glowType,
hideAnimations = addon.db.profile.hideAnimations
}
local serialized = AceSerializer:Serialize(data)
local compressed = LibDeflate:CompressDeflate(serialized, {
level = 9
})
local encoded = LibDeflate:EncodeForPrint(compressed)
return EXPORT_PREFIX .. encoded
end
local function ImportProfile(str)
str = strtrim(str)
if str == "" then
return false, "Import string is empty."
end
if str:sub(1, #EXPORT_PREFIX) ~= EXPORT_PREFIX then
return false, "Invalid import string (unrecognised format)."
end
local encoded = str:sub(#EXPORT_PREFIX + 1)
local compressed = LibDeflate:DecodeForPrint(encoded)
if not compressed then
return false, "Failed to decode import string."
end
local serialized = LibDeflate:DecompressDeflate(compressed)
if not serialized then
return false, "Failed to decompress import string."
end
local ok, data = AceSerializer:Deserialize(serialized)
if not ok then
return false, "Failed to deserialize import data."
end
if type(data) ~= "table" then
return false, "Import data is not a valid profile."
end
-- Apply imported data
if data.auras and type(data.auras) == "table" then
wipe(addon.db.profile.auras)
-- Detect old flat format vs new nested-by-class format
local isFlat = false
for _, v in pairs(data.auras) do
if type(v) == "table" and v.anchorSpellID ~= nil then
isFlat = true
end
break
end
if isFlat then
addon.db.profile.auras[addon.Class] = {}
for k, v in pairs(data.auras) do
addon.db.profile.auras[addon.Class][k] = v
end
else
for k, v in pairs(data.auras) do
addon.db.profile.auras[k] = v
end
end
end
if data.items and type(data.items) == "table" then
wipe(addon.db.profile.items)
for k, v in pairs(data.items) do
addon.db.profile.items[k] = v
end
end
if data.spells and type(data.spells) == "table" then
wipe(addon.db.profile.spells)
-- Detect old flat format vs new nested-by-class format
local isFlat = false
for _, v in pairs(data.spells) do
if type(v) == "table" and v.color ~= nil and v.color.r ~= nil then
isFlat = true
end
break
end
if isFlat then
addon.db.profile.spells[addon.Class] = {}
for k, v in pairs(data.spells) do
addon.db.profile.spells[addon.Class][k] = v
end
else
for k, v in pairs(data.spells) do
addon.db.profile.spells[k] = v
end
end
end
if data.combatOnly ~= nil then
addon.db.profile.combatOnly = data.combatOnly and true or false
end
if data.glowType then
addon.db.profile.glowType = data.glowType
end
if data.hideAnimations and type(data.hideAnimations) == "table" then
addon.db.profile.hideAnimations.castbar = data.hideAnimations.castbar and true or false
addon.hideAnimConfig.castbar = addon.db.profile.hideAnimations.castbar
end
addon:RebuildTables()
return true
end
-- ─── Shared glow type dropdown values ────────────────────────────────────────
local GLOW_TYPE_VALUES = {
["Default"] = "Default (use global)",
["Proc Glow"] = "Proc Glow",
["Pixel Glow"] = "Pixel Glow",
["Autocast Shine"] = "Autocast Shine",
["Action Button Glow"] = "Action Button Glow",
["Glow Texture"] = "Glow Texture"
}
-- ─── New-entry scratch state ─────────────────────────────────────────────────
local newAura = {
buffSpellID = "",
anchorSpellID = "",
r = 1,
g = 1,
b = 0,
shouldShow = true,
glowIcon = false,
useDefaultColor = true,
procSound = "None",
glowCooldownManager = false,
showStacks = false,
glowType = "Default"
}
-- Scan BuffIconCooldownViewer for available buff/proc spell IDs
local function GetCDMBuffValues()
local values = {}
if BuffIconCooldownViewer and BuffIconCooldownViewer.itemFramePool then
for aura in BuffIconCooldownViewer.itemFramePool:EnumerateActive() do
if aura and aura.GetBaseSpellID then
local spellID = aura:GetBaseSpellID()
if spellID and spellID ~= 0 then
local name = SpellName(spellID)
local icon = C_Spell.GetSpellTexture(spellID)
local prefix = icon and ("|T" .. icon .. ":16:16:0:0|t ") or ""
values[tostring(spellID)] = prefix .. name .. " (" .. spellID .. ")"
end
end
end
end
if not next(values) then
values[""] = "|cff888888No CDM buffs active|r"
end
return values
end
local newItem = {
itemID = "",
r = 0.5,
g = 0.5,
b = 1,
useDefaultColor = true,
procSound = "None",
glowType = "Default"
}
local newSpell = {
spellID = "",
r = 0,
g = 1,
b = 0,
useDefaultColor = true,
procSound = "None",
glowCooldownManager = false,
glowType = "Default"
}
-- ─── Options table ───────────────────────────────────────────────────────────
local function GetOptions()
local options = {
type = "group",
name = "|cff009cffmuleyo's|r |cffffd100ProcGlows|r",
childGroups = "tab",
args = {
-- ── Auras tab ────────────────────────────────────────────────
auras = {
type = "group",
name = "Auras",
order = 1,
childGroups = "tree",
args = {
description = {
type = "description",
name = "Configure buff/proc auras. Each aura watches for a buff spell ID and highlights the action button that holds the target spell.\n\n|cffff8800Note:|r Only buffs tracked by the CooldownManager can be monitored.\n",
order = 0,
fontSize = "medium"
},
-- ── Add new aura group ──
addNew = {
type = "group",
name = "|cff00ff00+ Add New Aura|r",
order = 1,
inline = true,
args = {
buffSpellID = {
type = "select",
name = "Buff / Proc",
desc = "Select a buff or proc currently tracked by the CooldownManager.",
order = 1,
width = "double",
values = function()
return GetCDMBuffValues()
end,
get = function()
return newAura.buffSpellID
end,
set = function(_, v)
newAura.buffSpellID = v
end
},
anchorSpellID = {
type = "input",
name = "Target Spell ID",
desc = "The spell ID on your action bar that should glow.",
order = 2,
width = "normal",
get = function()
return newAura.anchorSpellID
end,
set = function(_, v)
newAura.anchorSpellID = v
end
},
color = {
type = "color",
name = "Glow Color",
order = 3,
hasAlpha = false,
disabled = function()
return newAura.useDefaultColor
end,
get = function()
return newAura.r, newAura.g, newAura.b
end,
set = function(_, r, g, b)
newAura.r = r
newAura.g = g
newAura.b = b
end
},
useDefaultColor = {
type = "toggle",
name = "Use Default Color",
desc = "Use the default proc glow color instead of a custom one.",
order = 3.5,
get = function()
return newAura.useDefaultColor
end,
set = function(_, v)
newAura.useDefaultColor = v
end
},
shouldShow = {
type = "toggle",
name = "Show Aura Icon in CDM",
desc = "Whether to keep the aura icon visible. If unchecked, the icon will be hidden and only the glow is shown.",
order = 4,
get = function()
return newAura.shouldShow
end,
set = function(_, v)
newAura.shouldShow = v
end
},
glowIcon = {
type = "toggle",
name = "Glow CDM Aura Icon",
desc = "Show a proc glow on the aura icon itself in the CooldownManager.",
order = 5,
get = function()
return newAura.glowIcon
end,
set = function(_, v)
newAura.glowIcon = v
end
},
procSound = {
type = "select",
name = "Proc Sound",
desc = "Sound to play when this aura procs. 'None' uses the default from Settings.",
order = 5.5,
width = "double",
dialogControl = "LSM30_Sound",
values = LSM:HashTable(LSM.MediaType.SOUND),
get = function()
return newAura.procSound
end,
set = function(_, v)
newAura.procSound = v
end
},
glowCooldownManager = {
type = "toggle",
name = "Glow CDM Spell Icon",
desc = "Also glow the matching spell icon in the CooldownManager when this aura is active.",
order = 5.6,
get = function()
return newAura.glowCooldownManager
end,
set = function(_, v)
newAura.glowCooldownManager = v
end
},
showStacks = {
type = "toggle",
name = "Show Stacks",
desc = "Display the buff stack count on action buttons and CDM spell icons.",
order = 5.7,
get = function()
return newAura.showStacks
end,
set = function(_, v)
newAura.showStacks = v
end
},
glowType = {
type = "select",
name = "Glow Type",
desc = "Override the glow effect for this entry. 'Default' uses the global setting.",
order = 5.8,
width = "normal",
values = GLOW_TYPE_VALUES,
get = function()
return newAura.glowType
end,
set = function(_, v)
newAura.glowType = v
end
},
add = {
type = "execute",
name = "Add Aura",
order = 6,
width = "normal",
func = function()
local buffID = tonumber(newAura.buffSpellID)
local anchorID = tonumber(newAura.anchorSpellID)
if not buffID or buffID == 0 then
print("|cffff0000[ProcGlows]|r Invalid buff spell ID.")
return
end
if not anchorID or anchorID == 0 then
print("|cffff0000[ProcGlows]|r Invalid target spell ID.")
return
end
local key = tostring(buffID) .. "_" .. tostring(anchorID)
addon.db.profile.auras[addon.Class] = addon.db.profile.auras[addon.Class] or {}
addon.db.profile.auras[addon.Class][key] = {
buffSpellID = buffID,
anchorSpellID = anchorID,
color = {
r = newAura.r,
g = newAura.g,
b = newAura.b
},
shouldShow = newAura.shouldShow,
glowIcon = newAura.glowIcon,
useDefaultColor = newAura.useDefaultColor,
procSound = newAura.procSound,
glowCooldownManager = newAura.glowCooldownManager,
showStacks = newAura.showStacks,
glowType = newAura.glowType
}
addon:RebuildTables()
-- reset
newAura.buffSpellID = ""
newAura.anchorSpellID = ""
newAura.r = 1
newAura.g = 1
newAura.b = 0
newAura.shouldShow = false
newAura.glowIcon = false
newAura.useDefaultColor = true
newAura.procSound = "None"
newAura.glowCooldownManager = false
newAura.showStacks = false
newAura.glowType = "Default"
print("|cff00ff00[ProcGlows]|r Aura added: " .. SpellName(buffID) .. " (" .. buffID .. ")")
end
}
}
}
}
},
-- ── Items tab ────────────────────────────────────────────────
items = {
type = "group",
name = "Items",
order = 2,
childGroups = "tree",
args = {
description = {
type = "description",
name = "Configure usable-item highlights. When an item becomes usable, its action button will glow.\n",
order = 0,
fontSize = "medium"
},
addNew = {
type = "group",
name = "|cff00ff00+ Add New Item|r",
order = 1,
inline = true,
args = {
itemID = {
type = "input",
name = "Item ID",
desc = "The item ID to watch.",
order = 1,
width = "normal",
get = function()
return newItem.itemID
end,
set = function(_, v)
newItem.itemID = v
end
},
color = {
type = "color",
name = "Glow Color",
order = 2,
hasAlpha = false,
disabled = function()
return newItem.useDefaultColor
end,
get = function()
return newItem.r, newItem.g, newItem.b
end,
set = function(_, r, g, b)
newItem.r = r
newItem.g = g
newItem.b = b
end
},
useDefaultColor = {
type = "toggle",
name = "Use Default Color",
desc = "Use the default proc glow color instead of a custom one.",
order = 2.5,
get = function()
return newItem.useDefaultColor
end,
set = function(_, v)
newItem.useDefaultColor = v
end
},
procSound = {
type = "select",
name = "Proc Sound",
desc = "Sound to play when this item becomes usable. 'None' uses the default from Settings.",
order = 2.7,
width = "double",
dialogControl = "LSM30_Sound",
values = LSM:HashTable(LSM.MediaType.SOUND),
get = function()
return newItem.procSound
end,
set = function(_, v)
newItem.procSound = v
end
},
glowType = {
type = "select",
name = "Glow Type",
desc = "Override the glow effect for this entry. 'Default' uses the global setting.",
order = 2.8,
width = "normal",
values = GLOW_TYPE_VALUES,
get = function()
return newItem.glowType
end,
set = function(_, v)
newItem.glowType = v
end
},
add = {
type = "execute",
name = "Add Item",
order = 3,
width = "normal",
func = function()
local id = tonumber(newItem.itemID)
if not id or id == 0 then
print("|cffff0000[ProcGlows]|r Invalid item ID.")
return
end
local key = tostring(id)
addon.db.profile.items[key] = {
color = {
r = newItem.r,
g = newItem.g,
b = newItem.b
},
useDefaultColor = newItem.useDefaultColor,
procSound = newItem.procSound,
glowType = newItem.glowType
}
addon:RebuildTables()
newItem.itemID = ""
newItem.r = 0.5;
newItem.g = 0.5;
newItem.b = 1
newItem.useDefaultColor = true
newItem.procSound = "None"
newItem.glowType = "Default"
print("|cff00ff00[ProcGlows]|r Item added: " .. ItemName(id) .. " (" .. id .. ")")
end
}
}
}
}
},
-- ── Spells tab ───────────────────────────────────────────────
spells = {
type = "group",
name = "Spells",
order = 3,
childGroups = "tree",
args = {
description = {
type = "description",
name = "Configure spell cooldown highlights. When a spell is off cooldown and usable, its action button will glow.\n",
order = 0,
fontSize = "medium"
},
addNew = {
type = "group",
name = "|cff00ff00+ Add New Spell|r",
order = 1,
inline = true,
args = {
spellID = {
type = "input",
name = "Spell ID",
desc = "The spell ID to watch. The button holding this spell will glow when it is off cooldown.",
order = 1,
width = "normal",
get = function()
return newSpell.spellID
end,
set = function(_, v)
newSpell.spellID = v
end
},
color = {
type = "color",
name = "Glow Color",
order = 2,
hasAlpha = false,
disabled = function()
return newSpell.useDefaultColor
end,
get = function()
return newSpell.r, newSpell.g, newSpell.b
end,
set = function(_, r, g, b)
newSpell.r = r
newSpell.g = g
newSpell.b = b
end
},
useDefaultColor = {
type = "toggle",
name = "Use Default Color",
desc = "Use the default proc glow color instead of a custom one.",
order = 2.5,
get = function()
return newSpell.useDefaultColor
end,
set = function(_, v)
newSpell.useDefaultColor = v
end
},
procSound = {
type = "select",
name = "Proc Sound",
desc = "Sound to play when this spell becomes usable. 'None' uses the default from Settings.",
order = 2.7,
width = "double",
dialogControl = "LSM30_Sound",
values = LSM:HashTable(LSM.MediaType.SOUND),
get = function()
return newSpell.procSound
end,
set = function(_, v)
newSpell.procSound = v
end
},
glowCooldownManager = {
type = "toggle",
name = "Glow CDM Spell Icon",
desc = "Also glow the spell icon in the CooldownManager when it is off cooldown and usable.",
order = 2.8,
get = function()
return newSpell.glowCooldownManager
end,
set = function(_, v)
newSpell.glowCooldownManager = v
end
},
glowType = {
type = "select",
name = "Glow Type",
desc = "Override the glow effect for this entry. 'Default' uses the global setting.",
order = 2.9,
width = "normal",
values = GLOW_TYPE_VALUES,
get = function()
return newSpell.glowType
end,
set = function(_, v)
newSpell.glowType = v
end
},
add = {
type = "execute",
name = "Add Spell",
order = 3,
width = "normal",
func = function()
local id = tonumber(newSpell.spellID)
if not id or id == 0 then
print("|cffff0000[ProcGlows]|r Invalid spell ID.")
return
end
local key = tostring(id)
addon.db.profile.spells[addon.Class] = addon.db.profile.spells[addon.Class] or {}
addon.db.profile.spells[addon.Class][key] = {
color = {
r = newSpell.r,
g = newSpell.g,
b = newSpell.b
},
useDefaultColor = newSpell.useDefaultColor,
procSound = newSpell.procSound,
glowCooldownManager = newSpell.glowCooldownManager,
glowType = newSpell.glowType
}
addon:RebuildTables()
newSpell.spellID = ""
newSpell.r = 0;
newSpell.g = 1;
newSpell.b = 0
newSpell.useDefaultColor = true
newSpell.procSound = "None"
newSpell.glowCooldownManager = false
newSpell.glowType = "Default"
print("|cff00ff00[ProcGlows]|r Spell added: " .. SpellName(id) .. " (" .. id .. ")")
end
}
}
}
}
},
-- ── Import / Export tab ─────────────────────────────────────
importExport = {
type = "group",
name = "Import / Export",
order = 5,
args = {
descExport = {
type = "description",
name = "Copy the string below to share your settings with others, or paste an import string and click Import to load settings.\n",
order = 0,
fontSize = "medium"
},
generateExport = {
type = "execute",
name = "Generate Export String",
order = 1,
width = "normal",
func = function()
importExportState.exportString = ExportProfile()
-- refresh UI
local AceConfigReg = LibStub("AceConfigRegistry-3.0")
AceConfigReg:NotifyChange(addonName)
-- Scroll the export editbox back to the top after the UI rebuilds
C_Timer.After(0, function()
local openDialog = AceConfigDialog.OpenFrames[addonName] or AceConfigDialog.BlizOptions and
AceConfigDialog.BlizOptions[addonName]
if openDialog then
local status = openDialog:GetUserData("status") or openDialog.status
-- Walk child widgets to find the export MultiLineEditBox
if openDialog.children then
for _, child in ipairs(openDialog.children) do
if child.children then
for _, w in ipairs(child.children) do
if w.type == "MultiLineEditBox" and w.editBox then
local eb = w.editBox
eb:SetCursorPosition(0)
eb:HighlightText(0, -1)
break
end
end
end
end
end
end
end)
print("|cff00ff00[ProcGlows]|r Export string generated — copy it from the text box.")
end
},
exportBox = {
type = "input",
name = "Export String",
order = 2,
multiline = 6,
width = "full",
get = function()
return importExportState.exportString
end,
set = function()
end -- read-only
},
spacer = {
type = "description",
name = "\n",
order = 3,
width = "full"
},
importBox = {
type = "input",
name = "Import String",
order = 4,
multiline = 6,
width = "full",
get = function()
return importExportState.importString
end,
set = function(_, v)
importExportState.importString = v
end
},
importBtn = {
type = "execute",
name = "Import",
order = 5,
width = "normal",
confirm = true,
confirmText = "Importing will overwrite your current auras, items, spells, and animation settings. Continue?",
func = function()
local ok, err = ImportProfile(importExportState.importString)