forked from brittyazel/EnhancedRaidFrames
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndicatorConfigPanel.lua
651 lines (642 loc) · 19.6 KB
/
IndicatorConfigPanel.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
--Enhanced Raid Frames, a World of Warcraft® user interface addon.
--This file is part of Enhanced Raid Frames.
--
--Enhanced Raid Frame is free software: you can redistribute it and/or modify
--it under the terms of the GNU General Public License as published by
--the Free Software Foundation, either version 3 of the License, or
--(at your option) any later version.
--
--Enhanced Raid Frame is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--GNU General Public License for more details.
--
--You should have received a copy of the GNU General Public License
--along with this add-on. If not, see <https://www.gnu.org/licenses/>.
--
--Copyright for Enhanced Raid Frames is held by Britt Yazel (aka Soyier), 2017-2020.
local _, addonTable = ...
local EnhancedRaidFrames = addonTable.EnhancedRaidFrames
local POSITIONS = { [1] = "Top Left", [2] = "Top Center", [3] = "Top Right" ,
[4] = "Middle Left", [5] = "Middle Center", [6] = "Middle Right",
[7] = "Bottom Left", [8] = "Bottom Center", [9] = "Bottom Right"}
local yellowCode = "|cFFFFF569<text>|r"
local redCode = "|cFFC41F3B<text>|r"
local greenCode = "|cFFA9D271<text>|r"
local purpleCode = "|cFFA330C9<text>|r"
local blueCode = "|cFF0070DEMagic|r"
local brownCode = "|cFFC79C6E<text>|r"
-------------------------------------------------------------------------
-------------------------------------------------------------------------
function EnhancedRaidFrames:CreateIndicatorOptions()
local THIRD_WIDTH = 1.1
local indicatorOptions = {
type = "group",
childGroups = "select",
name = "Indicator Options",
args = {
instructions = {
type = "description",
name = "Please select an indicator position from the dropdown menu below"..":",
fontSize = "medium",
order = 1,
},
}
}
--- Add options for each indicator
for i,v in ipairs(POSITIONS) do
indicatorOptions.args[v] = {}
indicatorOptions.args[v].type = "group"
indicatorOptions.args[v].childGroups = "tab"
indicatorOptions.args[v].name = i..": "..v
indicatorOptions.args[v].order = i+1
indicatorOptions.args[v].args = {
--------------------------------------------
instructions = {
type = "description",
name = "The box to the right contains the list of auras to watch at the position"..": "..gsub(yellowCode,"<text>", v:lower()).."\n"..
"\n"..
"Type the names or spellIDs of each aura to track, each on a separate line".."\n",
fontSize = "medium",
width = THIRD_WIDTH,
order = 1,
},
auras = {
type = "input",
name = "Aura Watch List",
desc = "The list of buffs, debuffs, and/or wildcards to watch in this position",
usage = "\n"..
"\n"..
"Any valid aura name or spellID found in the game, spelled correctly, should work"..". ".."Example"..":\n"..
"\n"..
"Rejuvenation".."\n"..
"PvP".."\n"..
"Curse".."\n"..
"155777".."\n"..
"Magic".."\n"..
"\n"..
"Wildcards"..":\n"..
gsub(greenCode, "<text>", "Poison")..": ".."any poison effects".."\n"..
gsub(purpleCode, "<text>", "Curse")..": ".."any curse effects".."\n"..
gsub(brownCode, "<text>", "Disease")..": ".."any disease effects".."\n"..
gsub(blueCode, "<text>", "Magic")..": ".."any magic effects".."\n"..
gsub(redCode, "<text>", "PvP")..": ".."if the unit is PvP flagged".."\n"..
gsub(redCode, "<text>", "ToT")..": ".."if the unit is the target of target".."\n",
multiline = 5,
get = function() return self.db.profile[i].auras end,
set = function(_, value)
self.db.profile[i].auras = value
self:RefreshConfig()
end,
width = THIRD_WIDTH*1.7,
order = 2,
},
--------------------------------------------
visibilityOptions = {
type = "group",
name = "Visibility and Behavior",
order = 3,
args = {
generalOptions = {
type = "header",
name = "General",
order = 1,
},
mineOnly = {
type = "toggle",
name = "Mine Only",
desc = "Only show buffs and debuffs cast by me",
descStyle = "inline",
get = function()
return self.db.profile[i].mineOnly
end,
set = function(_, value)
self.db.profile[i].mineOnly = value
self:RefreshConfig()
end,
width = THIRD_WIDTH,
order = 2,
},
meOnly = {
type = "toggle",
name = "Show On Me Only",
desc = "Only only show this indicator on myself",
descStyle = "inline",
get = function()
return self.db.profile[i].meOnly
end,
set = function(_, value)
self.db.profile[i].meOnly = value
self:RefreshConfig()
end,
width = THIRD_WIDTH,
order = 3,
},
missingOnly = {
type = "toggle",
name = "Show Only if Missing",
desc = "Show only when the buff or debuff is missing",
descStyle = "inline",
get = function()
return self.db.profile[i].missingOnly
end,
set = function(_, value)
self.db.profile[i].missingOnly = value
self:RefreshConfig()
end,
width = THIRD_WIDTH,
order = 4,
},
-------------------------------------------------
tooltipOptions = {
type = "header",
name = "Tooltips",
order = 10,
},
showTooltip = {
type = "toggle",
name = "Show Tooltip",
desc = "Show the tooltip on mouseover",
get = function()
return self.db.profile[i].showTooltip
end,
set = function(_, value)
self.db.profile[i].showTooltip = value
self:RefreshConfig()
end,
width = THIRD_WIDTH,
order = 11,
},
tooltipLocation = {
type = "select",
name = "Tooltip Location",
desc = "The specified location where the tooltip should appear",
style = "dropdown",
values = {["ANCHOR_CURSOR"] = "Attached to Cursor", ["ANCHOR_PRESERVE"] = "Blizzard Default"},
sorting = {[1] = "ANCHOR_CURSOR", [2] = "ANCHOR_PRESERVE"},
get = function()
return self.db.profile[i].tooltipLocation
end,
set = function(_, value)
self.db.profile[i].tooltipLocation = value
self:RefreshConfig()
end,
disabled = function() return not self.db.profile[i].showTooltip end,
width = THIRD_WIDTH,
order = 12,
},
},
},
-------------------------------------------------
iconOptions = {
type = "group",
name = "Icon and Visuals",
order = 4,
args = {
-------------------------------------------------
generalHeader = {
type = "header",
name = "General",
order = 1,
},
indicatorSize = {
type = "range",
name = "Indicator Size",
desc = "The size of the indicator in pixels",
min = 1,
max = 30,
step = 1,
get = function()
return self.db.profile[i].indicatorSize
end,
set = function(_, value)
self.db.profile[i].indicatorSize = value
self:RefreshConfig()
end,
width = THIRD_WIDTH,
order = 2,
},
indicatorVerticalOffset = {
type = "range",
name = "Vertical Offset",
desc = "Vertical offset percentage of the indicator relative to its starting position",
min = -1,
max = 1,
step = .01,
get = function() return self.db.profile[i].indicatorVerticalOffset end,
set = function(_, value)
self.db.profile[i].indicatorVerticalOffset = value
self:RefreshConfig()
end,
width = THIRD_WIDTH,
order = 3,
},
indicatorHorizontalOffset = {
type = "range",
name = "Horizontal Offset",
desc = "Horizontal offset percentage of the indicator relative to its starting position",
min = -1,
max = 1,
step = .01,
get = function() return self.db.profile[i].indicatorHorizontalOffset end,
set = function(_, value)
self.db.profile[i].indicatorHorizontalOffset = value
self:RefreshConfig()
end,
width = THIRD_WIDTH,
order = 4,
},
-------------------------------------------------
iconHeader = {
type = "header",
name = "Icon",
order = 10,
},
showIcon = {
type = "toggle",
name = "Show Icon",
desc = "Show an icon if the buff or debuff is currently on the unit".."\n"..
"(if unchecked, a solid indicator color will be used)",
get = function()
return self.db.profile[i].showIcon
end,
set = function(_, value)
self.db.profile[i].showIcon = value
self:RefreshConfig()
end,
width = THIRD_WIDTH,
order = 11,
},
indicatorAlpha = {
type = "range",
name = "Icon Opacity",
desc = "The opacity percentage of the indicator icon",
min = 0,
max = 1,
step = 0.05,
get = function()
return self.db.profile[i].indicatorAlpha
end,
set = function(_, value)
self.db.profile[i].indicatorAlpha = value
self:RefreshConfig()
end,
disabled = function()
return not self.db.profile[i].showIcon
end,
width = THIRD_WIDTH,
order = 12,
},
-------------------------------------------------
colorHeader = {
type = "header",
name = "Color",
order = 20,
},
indicatorColor = {
type = "color",
name = "Indicator Color",
desc = "The solid color used for the indicator when not showing the buff or debuff icon (unless augmented by other color options)",
hasAlpha = true,
get = function()
return self.db.profile[i].indicatorColor.r, self.db.profile[i].indicatorColor.g, self.db.profile[i].indicatorColor.b, self.db.profile[i].indicatorColor.a
end,
set = function(_, r, g, b, a)
self.db.profile[i].indicatorColor.r, self.db.profile[i].indicatorColor.g, self.db.profile[i].indicatorColor.b, self.db.profile[i].indicatorColor.a = r, g, b, a
self:RefreshConfig()
end,
disabled = function()
return self.db.profile[i].showIcon
end,
width = THIRD_WIDTH,
order = 21,
},
colorIndicatorByDebuff = {
type = "toggle",
name = "Color By Debuff Type",
desc = "Color the indicator depending on the debuff type".."\n"..
"(this will override the normal coloring)".."\n"..
"\n"..
gsub(greenCode, "<text>", "Poison").."\n"..
gsub(purpleCode, "<text>", "Curse").."\n"..
gsub(brownCode, "<text>", "Disease").."\n"..
gsub(blueCode, "<text>", "Magic").."\n",
get = function()
return self.db.profile[i].colorIndicatorByDebuff
end,
set = function(_, value)
self.db.profile[i].colorIndicatorByDebuff = value
self:RefreshConfig()
end,
disabled = function()
return self.db.profile[i].showIcon
end,
width = THIRD_WIDTH,
order = 22,
},
colorIndicatorByTime = {
type = "toggle",
name = "Color By Remaining Time",
desc = "Color the indicator based on remaining time".."\n"..
"(this will override the normal coloring)".."\n"..
"\n"..
gsub(redCode, "<text>", "Time #1").."\n"..
gsub(yellowCode, "<text>", "Time #2"),
get = function()
return self.db.profile[i].colorIndicatorByTime
end,
set = function(_, value)
self.db.profile[i].colorIndicatorByTime = value
self:RefreshConfig()
end,
disabled = function()
return self.db.profile[i].showIcon
end,
width = THIRD_WIDTH,
order = 23,
},
colorIndicatorByTime_low = {
type = "range",
name = "Time #1",
desc = "The time (in seconds) for the lower boundary".."\n"..
"('0' means ignored)",
min = 0,
max = 10,
step = 1,
get = function()
return self.db.profile[i].colorIndicatorByTime_low
end,
set = function(_, value)
self.db.profile[i].colorIndicatorByTime_low = value
self:RefreshConfig()
end,
disabled = function()
return self.db.profile[i].showIcon or not self.db.profile[i].colorIndicatorByTime
end,
width = THIRD_WIDTH,
order = 24,
},
colorIndicatorByTime_high = {
type = "range",
name = "Time #2",
desc = "The time (in seconds) for the upper boundary".."\n"..
"('0' means ignored)",
min = 0,
max = 10,
step = 1,
get = function()
return self.db.profile[i].colorIndicatorByTime_high
end,
set = function(_, value)
self.db.profile[i].colorIndicatorByTime_high = value
self:RefreshConfig()
end,
disabled = function()
return self.db.profile[i].showIcon or not self.db.profile[i].colorIndicatorByTime
end,
width = THIRD_WIDTH,
order = 25,
},
},
},
--------------------------------------------
textOptions = {
type = "group",
name = "Text",
order = 5,
args = {
-------------------------------------------------
generalHeader = {
type = "header",
name = "General",
order = 1,
},
showText = {
type = "select",
name = "Show Text",
desc = "The text to show on the indicator frame",
style = "dropdown",
values = {["stack"] = "Stack Size", ["countdown"] = "Countdown", ["stack+countdown"] = "Stack Size + Countdown", ["none"] = "None"},
sorting = {[1] = "stack", [2] = "countdown", [3] = "stack+countdown", [4] = "none"},
get = function()
return self.db.profile[i].showText
end,
set = function(_, value)
self.db.profile[i].showText = value
self:RefreshConfig()
end,
width = THIRD_WIDTH,
order = 2,
},
textSize = {
type = "range",
name = "Text Size",
desc = "The size of the indicator (in pixels)",
min = 1,
max = 30,
step = 1,
get = function()
return self.db.profile[i].textSize
end,
set = function(_, value)
self.db.profile[i].textSize = value
self:RefreshConfig()
end,
disabled = function()
if self.db.profile[i].showText == "none" then
return true
end
end,
width = THIRD_WIDTH,
order = 3,
},
-------------------------------------------------
colorHeader = {
type = "header",
name = "Color",
order = 10,
},
textColor = {
type = "color",
name = "Text Color",
desc = "The color used for the indicator text".."\n"..
"(unless augmented by other text color options)",
hasAlpha = true,
get = function()
return self.db.profile[i].textColor.r, self.db.profile[i].textColor.g, self.db.profile[i].textColor.b, self.db.profile[i].textColor.a
end,
set = function(_, r, g, b, a)
self.db.profile[i].textColor.r, self.db.profile[i].textColor.g, self.db.profile[i].textColor.b, self.db.profile[i].textColor.a = r, g, b, a
self:RefreshConfig()
end,
disabled = function()
if self.db.profile[i].showText == "none" then
return true
end
end,
width = THIRD_WIDTH,
order = 11,
},
colorTextByDebuff = {
type = "toggle",
name = "Color By Debuff Type",
desc = "Color the indicator text depending on the debuff type".."\n"..
"(this will override the normal coloring)".."\n"..
"\n"..
gsub(greenCode, "<text>", "Poison").."\n"..
gsub(purpleCode, "<text>", "Curse").."\n"..
gsub(brownCode, "<text>", "Disease").."\n"..
gsub(blueCode, "<text>", "Magic").."\n",
get = function()
return self.db.profile[i].colorTextByDebuff
end,
set = function(_, value)
self.db.profile[i].colorTextByDebuff = value
self:RefreshConfig()
end,
disabled = function()
if self.db.profile[i].showText == "none" then
return true
end
end,
width = THIRD_WIDTH,
order = 12,
},
colorTextByTime = {
type = "toggle",
name = "Color By Remaining Time",
desc = "Color the indicator text based on remaining time".."\n"..
"(this will override the normal coloring)".."\n"..
"\n"..
gsub(redCode, "<text>", "Time #1").."\n"..
gsub(yellowCode, "<text>", "Time #2"),
get = function()
return self.db.profile[i].colorTextByTime
end,
set = function(_, value)
self.db.profile[i].colorTextByTime = value
self:RefreshConfig()
end,
disabled = function()
if self.db.profile[i].showText == "none" then
return true
end
end,
width = THIRD_WIDTH,
order = 13,
},
colorTextByTime_low = {
type = "range",
name = "Time #1",
desc = "The time (in seconds) for the lower boundary".."\n"..
"('0' means ignored)",
min = 0,
max = 10,
step = 1,
get = function()
return self.db.profile[i].colorTextByTime_low
end,
set = function(_, value)
self.db.profile[i].colorTextByTime_low = value
self:RefreshConfig()
end,
disabled = function()
if self.db.profile[i].showText == "none" or not self.db.profile[i].colorTextByTime then
return true
end
end,
width = THIRD_WIDTH,
order = 14,
},
colorTextByTime_high = {
type = "range",
name = "Time #2",
desc = "The time (in seconds) for the upper boundary".."\n"..
"('0' means ignored)",
min = 0,
max = 10,
step = 1,
get = function()
return self.db.profile[i].colorTextByTime_high
end,
set = function(_, value)
self.db.profile[i].colorTextByTime_high = value
self:RefreshConfig()
end,
disabled = function()
if self.db.profile[i].showText == "none" or not self.db.profile[i].colorTextByTime then
return true
end
end,
width = THIRD_WIDTH,
order = 15,
},
},
},
--------------------------------------------
animationOptions = {
type = "group",
name = "Animations",
order = 6,
args = {
-------------------------------------------------
generalOptions = {
type = "header",
name = "General",
order = 1,
},
showCountdownSwipe = {
type = "toggle",
name = "Show Countdown Swipe",
desc = "Show the clockwise swipe animation specifying the time left on the buff or debuff",
get = function()
return self.db.profile[i].showCountdownSwipe
end,
set = function(_, value)
self.db.profile[i].showCountdownSwipe = value
self:RefreshConfig()
end,
width = THIRD_WIDTH,
order = 2,
},
indicatorGlow = {
type = "toggle",
name = "Indicator Glow Effect",
desc = "Display a glow animation effect on the indicator to make it easier to spot",
get = function()
return self.db.profile[i].indicatorGlow
end,
set = function(_, value)
self.db.profile[i].indicatorGlow = value
self:RefreshConfig()
end,
width = THIRD_WIDTH,
order = 3,
},
glowRemainingSecs = {
type = "range",
name = "Glow At Countdown Time",
desc = "The amount of time (in seconds) remaining on the buff or debuff countdown before the glowing starts".."\n"..
"('0' means it will always glow)",
min = 0,
max = 10,
step = 1,
get = function()
return self.db.profile[i].glowRemainingSecs
end,
set = function(_, value)
self.db.profile[i].glowRemainingSecs = value
self:RefreshConfig()
end,
disabled = function()
return not self.db.profile[i].indicatorGlow
end,
width = THIRD_WIDTH,
order = 4,
},
},
},
}
end
return indicatorOptions
end