This repository was archived by the owner on Nov 5, 2025. It is now read-only.
forked from ManneN1/BigDebuffs-WotLK
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOptions.lua
More file actions
641 lines (634 loc) · 20.3 KB
/
Options.lua
File metadata and controls
641 lines (634 loc) · 20.3 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
local addonName = ...
local BigDebuffs = LibStub("AceAddon-3.0"):GetAddon(addonName)
local L = LibStub("AceLocale-3.0"):GetLocale(addonName)
local order = {
immunities = 1,
immunities_spells = 2,
cc = 3,
buffs_defensive = 4,
buffs_offensive = 5,
buffs_other = 6,
roots = 7,
}
local SpellNames = {}
local SpellIcons = {}
local Spells = {}
for spellID, spell in pairs(BigDebuffs.Spells) do
if not spell.parent then
Spells[spell.type] = Spells[spell.type] or {
name = L[spell.type],
type = "group",
order = order[spell.type],
args = {},
}
local key = "spell"..spellID
local raidFrames = spell.type == "cc" or spell.type == "roots" or spell.type == "special" or spell.type == "interrupts"
Spells[spell.type].args[key] = {
type = "group",
get = function(info)
local name = info[#info]
return BigDebuffs.db.profile.spells[spellID] and BigDebuffs.db.profile.spells[spellID][name]
end,
set = function(info, value)
local name = info[#info]
BigDebuffs.db.profile.spells[spellID] = BigDebuffs.db.profile.spells[spellID] or {}
BigDebuffs.db.profile.spells[spellID][name] = value
BigDebuffs:Refresh()
end,
name = function(info) local name = SpellNames[spellID] or GetSpellInfo(spellID) or spellID SpellNames[spellID] = name return name end,
icon = function() local icon = SpellIcons[spellID] or select(3,GetSpellInfo(spellID)) SpellIcons[spellID] = icon return icon end,
args = {
visibility = {
order = 1,
type = "group",
name = L["Visibility"],
inline = true,
get = function(info)
local name = info[#info]
local value = (BigDebuffs.db.profile.spells[spellID] and BigDebuffs.db.profile.spells[spellID][name]) or
(not BigDebuffs.Spells[spellID]["no"..name] and 1)
return value and value == 1
end,
set = function(info, value)
local name = info[#info]
BigDebuffs.db.profile.spells[spellID] = BigDebuffs.db.profile.spells[spellID] or {}
value = value and 1 or 0
BigDebuffs.db.profile.spells[spellID][name] = value
-- unset if default visibility
local no = BigDebuffs.Spells[spellID]["no"..name]
if (value == 1 and not no) or
(value == 0 and no) then
BigDebuffs.db.profile.spells[spellID][name] = nil
end
BigDebuffs:Refresh()
end,
args = {
unitFrames = {
type = "toggle",
name = L["Unit Frames"],
desc = L["Show this spell on the unit frames"],
width = "full",
order = 2
},
},
},
priority = {
type = "group",
inline = true,
name = L["Priority"],
args = {
customPriority = {
name = L["Custom Priority"],
type = "toggle",
order = 2,
set = function(info, value)
BigDebuffs.db.profile.spells[spellID] = BigDebuffs.db.profile.spells[spellID] or {}
BigDebuffs.db.profile.spells[spellID].customPriority = value
if not value then
BigDebuffs.db.profile.spells[spellID].priority = nil
end
BigDebuffs:Refresh()
end,
},
priority = {
name = L["Priority"],
desc = L["Higher priority spells will take precedence regardless of duration"],
type = "range",
min = 1,
max = 100,
step = 1,
order = 3,
disabled = function() return not BigDebuffs.db.profile.spells[spellID] or not BigDebuffs.db.profile.spells[spellID].customPriority end,
get = function(info)
-- Pull the category priority
return BigDebuffs.db.profile.spells[spellID] and BigDebuffs.db.profile.spells[spellID].priority and
BigDebuffs.db.profile.spells[spellID].priority or
BigDebuffs.db.profile.priority[spell.type]
end,
},
},
},
},
}
end
end
function BigDebuffs:SetupOptions()
self.options = {
name = "BigDebuffs",
descStyle = "inline",
type = "group",
plugins = {},
childGroups = "tab",
args = {
vers = {
order = 1,
type = "description",
name = "|cffffd700"..L["Version"].."|r "..GetAddOnMetadata(addonName, "Version").."\n",
cmdHidden = true
},
desc = {
order = 2,
type = "description",
name = "|cffffd700 "..L["Author"].."|r "..GetAddOnMetadata(addonName, "Author").."\n",
cmdHidden = true
},
test = {
type = "execute",
name = L["Toggle Test Mode"],
order = 3,
func = "Test",
handler = BigDebuffs,
},
unitFrames = {
name = L["Unit Frames"],
type = "group",
order = 20,
disabled = function(info) return info[2] and not self.db.profile[info[1]].enabled end,
childGroups = "tab",
get = function(info) local name = info[#info] return self.db.profile.unitFrames[name] end,
set = function(info, value) local name = info[#info] self.db.profile.unitFrames[name] = value self:Refresh() end,
args = {
general = {
name = "General",
type = "group",
order = 10,
inline = true,
args = {
enabled = {
type = "toggle",
disabled = false,
width = "normal",
name = L["Enabled"],
desc = L["Enable BigDebuffs on unit frames"],
},
cooldownCount = {
type = "toggle",
width = "normal",
name = L["Cooldown Count"],
desc = L["Allow Blizzard and other addons to display countdown text on the icons"],
},
},
},
player = {
type = "group",
disabled = function(info) return not self.db.profile[info[1]].enabled or (info[3] and not self.db.profile.unitFrames[info[2]].enabled) end,
get = function(info) local name = info[#info] return self.db.profile.unitFrames.player[name] end,
set = function(info, value) local name = info[#info] self.db.profile.unitFrames.player[name] = value self:Refresh() self:Refresh() end,
args = {
enabled = {
type = "toggle",
disabled = function(info) return not self.db.profile[info[1]].enabled end,
name = L["Enabled"],
order = 1,
width = "full",
desc = L["Enable BigDebuffs on the player frame"],
},
anchor = {
name = L["Anchor"],
desc = L["Anchor to attach the BigDebuffs frames"],
type = "select",
values = {
["auto"] = L["Automatic"],
["manual"] = L["Manual"],
},
order = 2,
},
size = {
type = "range",
disabled = function(info) local name = info[2] return not self.db.profile.unitFrames[name].enabled or self.db.profile.unitFrames[name].anchor == "auto" end,
name = L["Size"],
desc = L["Set the size of the frame"],
min = 8,
max = 512,
step = 1,
order = 3,
},
cdMod = {
type = "range",
disabled = function(info) local name = info[2] return not self.db.profile.unitFrames[name].enabled or self.db.profile.unitFrames[name].anchor ~= "auto" end,
name = L["Cooldown Size Modifier"],
desc = L["Modifies the size of the cooldown spiral"],
min = 0,
max = 20,
step = 1,
order = 4,
},
},
name = L["Player Frame"],
order = 1,
},
target = {
type = "group",
disabled = function(info) return not self.db.profile[info[1]].enabled or (info[3] and not self.db.profile.unitFrames[info[2]].enabled) end,
get = function(info) local name = info[#info] return self.db.profile.unitFrames.target[name] end,
set = function(info, value) local name = info[#info] self.db.profile.unitFrames.target[name] = value self:Refresh() self:Refresh() end,
args = {
enabled = {
type = "toggle",
disabled = function(info) return not self.db.profile[info[1]].enabled end,
name = L["Enabled"],
order = 1,
width = "full",
desc = L["Enable BigDebuffs on the target frame"],
},
anchor = {
name = L["Anchor"],
desc = L["Anchor to attach the BigDebuffs frames"],
type = "select",
values = {
["auto"] = L["Automatic"],
["manual"] = L["Manual"],
},
order = 2,
},
size = {
type = "range",
disabled = function(info) local name = info[2] return not self.db.profile.unitFrames[name].enabled or self.db.profile.unitFrames[name].anchor == "auto" end,
name = L["Size"],
desc = L["Set the size of the frame"],
min = 8,
max = 512,
step = 1,
order = 3,
},
cdMod = {
type = "range",
disabled = function(info) local name = info[2] return not self.db.profile.unitFrames[name].enabled or self.db.profile.unitFrames[name].anchor ~= "auto" end,
name = L["Cooldown Size Modifier"],
desc = L["Modifies the size of the cooldown spiral"],
min = 0,
max = 20,
step = 1,
order = 4,
},
},
name = L["Target Frame"],
desc = L["Enable BigDebuffs on the target frame"],
order = 2,
},
focus = {
type = "group",
disabled = function(info) return not self.db.profile[info[1]].enabled or (info[3] and not self.db.profile.unitFrames[info[2]].enabled) end,
get = function(info) local name = info[#info] return self.db.profile.unitFrames.focus[name] end,
set = function(info, value) local name = info[#info] self.db.profile.unitFrames.focus[name] = value self:Refresh() self:Refresh() end,
args = {
enabled = {
type = "toggle",
disabled = function(info) return not self.db.profile[info[1]].enabled end,
name = L["Enabled"],
order = 1,
width = "full",
desc = L["Enable BigDebuffs on the focus frame"],
},
anchor = {
name = L["Anchor"],
desc = L["Anchor to attach the BigDebuffs frames"],
type = "select",
values = {
["auto"] = L["Automatic"],
["manual"] = L["Manual"],
},
order = 2,
},
size = {
type = "range",
disabled = function(info) local name = info[2] return not self.db.profile.unitFrames[name].enabled or self.db.profile.unitFrames[name].anchor == "auto" end,
name = L["Size"],
desc = L["Set the size of the frame"],
min = 8,
max = 512,
step = 1,
order = 3,
},
cdMod = {
type = "range",
disabled = function(info) local name = info[2] return not self.db.profile.unitFrames[name].enabled or self.db.profile.unitFrames[name].anchor ~= "auto" end,
name = L["Cooldown Size Modifier"],
desc = L["Modifies the size of the cooldown spiral"],
min = 0,
max = 20,
step = 1,
order = 4,
},
},
name = L["Focus Frame"],
desc = L["Enable BigDebuffs on the focus frame"],
order = 3,
},
pet = {
type = "group",
disabled = function(info) return not self.db.profile[info[1]].enabled or (info[3] and not self.db.profile.unitFrames[info[2]].enabled) end,
get = function(info) local name = info[#info] return self.db.profile.unitFrames.pet[name] end,
set = function(info, value) local name = info[#info] self.db.profile.unitFrames.pet[name] = value self:Refresh() self:Refresh() end,
args = {
enabled = {
type = "toggle",
disabled = function(info) return not self.db.profile[info[1]].enabled end,
name = L["Enabled"],
order = 1,
width = "full",
desc = L["Enable BigDebuffs on the pet frame"],
},
anchor = {
name = L["Anchor"],
desc = L["Anchor to attach the BigDebuffs frames"],
type = "select",
values = {
["auto"] = L["Automatic"],
["manual"] = L["Manual"],
},
order = 2,
},
size = {
type = "range",
disabled = function(info) local name = info[2] return not self.db.profile.unitFrames[name].enabled or self.db.profile.unitFrames[name].anchor == "auto" end,
name = L["Size"],
desc = L["Set the size of the frame"],
min = 8,
max = 512,
step = 1,
order = 3,
},
cdMod = {
type = "range",
disabled = function(info) local name = info[2] return not self.db.profile.unitFrames[name].enabled or self.db.profile.unitFrames[name].anchor ~= "auto" end,
name = L["Cooldown Size Modifier"],
desc = L["Modifies the size of the cooldown spiral"],
min = 0,
max = 20,
step = 1,
order = 4,
},
},
name = L["Pet Frame"],
desc = L["Enable BigDebuffs on the pet frame"],
order = 4,
},
party = {
type = "group",
disabled = function(info) return not self.db.profile[info[1]].enabled or (info[3] and not self.db.profile.unitFrames[info[2]].enabled) end,
get = function(info) local name = info[#info] return self.db.profile.unitFrames.party[name] end,
set = function(info, value) local name = info[#info] self.db.profile.unitFrames.party[name] = value self:Refresh() self:Refresh() end,
args = {
enabled = {
type = "toggle",
disabled = function(info) return not self.db.profile[info[1]].enabled end,
name = L["Enabled"],
order = 1,
width = "full",
desc = L["Enable BigDebuffs on the party frames"],
},
anchor = {
name = L["Anchor"],
desc = L["Anchor to attach the BigDebuffs frames"],
type = "select",
values = {
["auto"] = L["Automatic"],
["manual"] = L["Manual"],
},
order = 2,
},
size = {
type = "range",
disabled = function(info) local name = info[2] return not self.db.profile.unitFrames[name].enabled or self.db.profile.unitFrames[name].anchor == "auto" end,
name = L["Size"],
desc = L["Set the size of the frame"],
min = 8,
max = 512,
step = 1,
order = 3,
},
cdMod = {
type = "range",
disabled = function(info) local name = info[2] return not self.db.profile.unitFrames[name].enabled or self.db.profile.unitFrames[name].anchor ~= "auto" end,
name = L["Cooldown Size Modifier"],
desc = L["Modifies the size of the cooldown spiral"],
min = 0,
max = 20,
step = 1,
order = 4,
},
},
name = L["Party Frames"],
desc = L["Enable BigDebuffs on the party frames"],
order = 5,
},
arena = {
type = "group",
disabled = function(info) return not self.db.profile[info[1]].enabled or (info[3] and not self.db.profile.unitFrames[info[2]].enabled) end,
get = function(info) local name = info[#info] return self.db.profile.unitFrames.arena[name] end,
set = function(info, value) local name = info[#info] self.db.profile.unitFrames.arena[name] = value self:Refresh() self:Refresh() end,
args = {
enabled = {
type = "toggle",
disabled = function(info) return not self.db.profile[info[1]].enabled end,
name = L["Enabled"],
order = 1,
width = "full",
desc = L["Enable BigDebuffs on the arena frames"],
},
anchor = {
name = L["Anchor"],
desc = L["Anchor to attach the BigDebuffs frames"],
type = "select",
values = {
["auto"] = L["Automatic"],
["manual"] = L["Manual"],
},
order = 2,
},
size = {
type = "range",
disabled = function(info) local name = info[2] return not self.db.profile.unitFrames[name].enabled or self.db.profile.unitFrames[name].anchor == "auto" end,
name = L["Size"],
desc = L["Set the size of the frame"],
min = 8,
max = 512,
step = 1,
order = 3,
},
cdMod = {
type = "range",
disabled = function(info) local name = info[2] return not self.db.profile.unitFrames[name].enabled or self.db.profile.unitFrames[name].anchor ~= "auto" end,
name = L["Cooldown Size Modifier"],
desc = L["Modifies the size of the cooldown spiral"],
min = 0,
max = 20,
step = 1,
order = 4,
},
},
name = L["Arena Frames"],
desc = L["Enable BigDebuffs on the arena frames"],
order = 6,
},
spells = {
order = 20,
name = L["Spells"],
type = "group",
inline = true,
args = {
cc = {
type = "toggle",
width = "normal",
name = L["cc"],
desc = L["Show Crowd Control on the unit frames"],
order = 1,
},
immunities = {
type = "toggle",
width = "normal",
name = L["immunities"],
desc = L["Show Immunities on the unit frames"],
order = 2,
},
interrupts = {
type = "toggle",
width = "normal",
name = L["interrupts"],
desc = L["Show Interrupts on the unit frames"],
order = 3,
},
immunities_spells = {
type = "toggle",
width = "normal",
name = L["immunities_spells"],
desc = L["Show Spell Immunities on the unit frames"],
order = 4,
},
buffs_defensive = {
type = "toggle",
width = "normal",
name = L["buffs_defensive"],
desc = L["Show Defensive Buffs on the unit frames"],
order = 5,
},
buffs_offensive = {
type = "toggle",
width = "normal",
name = L["buffs_offensive"],
desc = L["Show Offensive Buffs on the unit frames"],
order = 6,
},
buffs_other = {
type = "toggle",
width = "normal",
name = L["buffs_other"],
desc = L["Show Other Buffs on the unit frames"],
order = 7,
},
roots = {
type = "toggle",
width = "normal",
name = L["roots"],
desc = L["Show Roots on the unit frames"],
order = 8,
},
},
},
}
},
spells = {
name = L["Spells"],
type = "group",
childGroups = "tab",
order = 40,
args = Spells,
},
}
}
self.options.args.priority = {
name = L["Priority"],
type = "group",
get = function(info) local name = info[#info] return self.db.profile.priority[name] end,
set = function(info, value) local name = info[#info] self.db.profile.priority[name] = value self:Refresh() end,
order = 30,
args = {
immunities = {
type = "range",
width = "double",
name = L["immunities"],
desc = L["Higher priority spells will take precedence regardless of duration"],
min = 1,
max = 100,
step = 1,
order = 10,
},
immunities_spells = {
type = "range",
width = "double",
name = L["immunities_spells"],
desc = L["Higher priority spells will take precedence regardless of duration"],
min = 1,
max = 100,
step = 1,
order = 11,
},
cc = {
type = "range",
width = "double",
name = L["cc"],
desc = L["Higher priority spells will take precedence regardless of duration"],
min = 1,
max = 100,
step = 1,
order = 12,
},
interrupts = {
type = "range",
width = "double",
name = L["interrupts"],
desc = L["Higher priority spells will take precedence regardless of duration"],
min = 1,
max = 100,
step = 1,
order = 13,
},
buffs_defensive = {
type = "range",
width = "double",
name = L["buffs_defensive"],
desc = L["Higher priority spells will take precedence regardless of duration"],
min = 1,
max = 100,
step = 1,
order = 14,
},
buffs_offensive = {
type = "range",
width = "double",
name = L["buffs_offensive"],
desc = L["Higher priority spells will take precedence regardless of duration"],
min = 1,
max = 100,
step = 1,
order = 15,
},
buffs_other = {
type = "range",
width = "double",
name = L["buffs_other"],
desc = L["Higher priority spells will take precedence regardless of duration"],
min = 1,
max = 100,
step = 1,
order = 16,
},
roots = {
type = "range",
width = "double",
name = L["roots"],
desc = L["Higher priority spells will take precedence regardless of duration"],
min = 1,
max = 100,
step = 1,
order = 17,
},
},
}
self.options.plugins.profiles = { profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db) }
local LibDualSpec = LibStub('LibDualSpec-1.0')
LibDualSpec:EnhanceDatabase(self.db, addonName.."DB")
LibDualSpec:EnhanceOptions(self.options.plugins.profiles.profiles, self.db)
LibStub("AceConfig-3.0"):RegisterOptionsTable(addonName, self.options)
end