-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathUnitFrames.lua
More file actions
9174 lines (9049 loc) · 281 KB
/
Copy pathUnitFrames.lua
File metadata and controls
9174 lines (9049 loc) · 281 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
local E, _, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local C, L = unpack(select(2, ...))
local UF = E:GetModule("UnitFrames")
local _G = _G
local select, pairs, ipairs = select, pairs, ipairs
local tremove, tinsert, tconcat, twipe = table.remove, table.insert, table.concat, table.wipe
local format, strmatch, gsub, strsplit = string.format, strmatch, string.gsub, strsplit
local GetScreenWidth = GetScreenWidth
local IsAddOnLoaded = IsAddOnLoaded
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local ACD = E.Libs.AceConfigDialog
local positionValues = {
TOPLEFT = "TOPLEFT",
LEFT = "LEFT",
BOTTOMLEFT = "BOTTOMLEFT",
RIGHT = "RIGHT",
TOPRIGHT = "TOPRIGHT",
BOTTOMRIGHT = "BOTTOMRIGHT",
CENTER = "CENTER",
TOP = "TOP",
BOTTOM = "BOTTOM"
}
local orientationValues = {
--["AUTOMATIC"] = L["Automatic"], not sure if i will use this yet
["LEFT"] = L["Left"],
["MIDDLE"] = L["Middle"],
["RIGHT"] = L["Right"]
}
local threatValues = {
["GLOW"] = L["Glow"],
["BORDERS"] = L["Borders"],
["HEALTHBORDER"] = L["Health Border"],
["INFOPANELBORDER"] = L["InfoPanel Border"],
["ICONTOPLEFT"] = L["Icon: TOPLEFT"],
["ICONTOPRIGHT"] = L["Icon: TOPRIGHT"],
["ICONBOTTOMLEFT"] = L["Icon: BOTTOMLEFT"],
["ICONBOTTOMRIGHT"] = L["Icon: BOTTOMRIGHT"],
["ICONLEFT"] = L["Icon: LEFT"],
["ICONRIGHT"] = L["Icon: RIGHT"],
["ICONTOP"] = L["Icon: TOP"],
["ICONBOTTOM"] = L["Icon: BOTTOM"],
["NONE"] = L["NONE"]
}
local petAnchors = {
TOPLEFT = "TOPLEFT",
LEFT = "LEFT",
BOTTOMLEFT = "BOTTOMLEFT",
RIGHT = "RIGHT",
TOPRIGHT = "TOPRIGHT",
BOTTOMRIGHT = "BOTTOMRIGHT",
TOP = "TOP",
BOTTOM = "BOTTOM"
}
local attachToValues = {
["Health"] = L["HEALTH"],
["Power"] = L["Power"],
["InfoPanel"] = L["Information Panel"],
["Frame"] = L["Frame"]
}
local growthDirectionValues = {
DOWN_RIGHT = format(L["%s and then %s"], L["Down"], L["Right"]),
DOWN_LEFT = format(L["%s and then %s"], L["Down"], L["Left"]),
UP_RIGHT = format(L["%s and then %s"], L["Up"], L["Right"]),
UP_LEFT = format(L["%s and then %s"], L["Up"], L["Left"]),
RIGHT_DOWN = format(L["%s and then %s"], L["Right"], L["Down"]),
RIGHT_UP = format(L["%s and then %s"], L["Right"], L["Up"]),
LEFT_DOWN = format(L["%s and then %s"], L["Left"], L["Down"]),
LEFT_UP = format(L["%s and then %s"], L["Left"], L["Up"])
}
local smartAuraPositionValues = {
["DISABLED"] = L["DISABLE"],
["BUFFS_ON_DEBUFFS"] = L["Position Buffs on Debuffs"],
["DEBUFFS_ON_BUFFS"] = L["Position Debuffs on Buffs"],
["FLUID_BUFFS_ON_DEBUFFS"] = L["Fluid Position Buffs on Debuffs"],
["FLUID_DEBUFFS_ON_BUFFS"] = L["Fluid Position Debuffs on Buffs"]
}
local colorOverrideValues = {
["USE_DEFAULT"] = L["Use Default"],
["FORCE_ON"] = L["Force On"],
["FORCE_OFF"] = L["Force Off"]
}
local blendModeValues = {
["DISABLE"] = L["DISABLE"],
["BLEND"] = L["Blend"],
["ADD"] = L["Additive Blend"],
["MOD"] = L["Modulating Blend"],
["ALPHAKEY"] = L["Alpha Key"],
}
local CUSTOMTEXT_CONFIGS = {}
local carryFilterFrom, carryFilterTo
local function filterMatch(s,v)
local m1, m2, m3, m4 = "^"..v.."$", "^"..v..",", ","..v.."$", ","..v..","
return (strmatch(s, m1) and m1) or (strmatch(s, m2) and m2) or (strmatch(s, m3) and m3) or (strmatch(s, m4) and v..",")
end
local function filterPriority(auraType, groupName, value, remove, movehere, friendState)
if not auraType or not value then return end
local filter = E.db.unitframe.units[groupName] and E.db.unitframe.units[groupName][auraType] and E.db.unitframe.units[groupName][auraType].priority
if not filter then return end
local found = filterMatch(filter, E:EscapeString(value))
if found and movehere then
local tbl, sv, sm = {strsplit(",",filter)}
for i in ipairs(tbl) do
if tbl[i] == value then sv = i elseif tbl[i] == movehere then sm = i end
if sv and sm then break end
end
tremove(tbl, sm)
tinsert(tbl, sv, movehere)
E.db.unitframe.units[groupName][auraType].priority = tconcat(tbl,",")
elseif found and friendState then
local realValue = strmatch(value, "^Friendly:([^,]*)") or strmatch(value, "^Enemy:([^,]*)") or value
local friend = filterMatch(filter, E:EscapeString("Friendly:"..realValue))
local enemy = filterMatch(filter, E:EscapeString("Enemy:"..realValue))
local default = filterMatch(filter, E:EscapeString(realValue))
local state =
(friend and (not enemy) and format("%s%s","Enemy:",realValue)) --[x] friend [ ] enemy: > enemy
or ((not enemy and not friend) and format("%s%s","Friendly:",realValue)) --[ ] friend [ ] enemy: > friendly
or (enemy and (not friend) and default and format("%s%s","Friendly:",realValue)) --[ ] friend [x] enemy: (default exists) > friendly
or (enemy and (not friend) and strmatch(value, "^Enemy:") and realValue) --[ ] friend [x] enemy: (no default) > realvalue
or (friend and enemy and realValue) --[x] friend [x] enemy: > default
if state then
local stateFound = filterMatch(filter, E:EscapeString(state))
if not stateFound then
local tbl, sv = {strsplit(",",filter)}
for i in ipairs(tbl) do
if tbl[i] == value then
sv = i
break
end
end
tinsert(tbl, sv, state)
tremove(tbl, sv + 1)
E.db.unitframe.units[groupName][auraType].priority = tconcat(tbl,",")
end
end
elseif found and remove then
E.db.unitframe.units[groupName][auraType].priority = gsub(filter, found, "")
elseif not found and not remove then
E.db.unitframe.units[groupName][auraType].priority = (filter == "" and value) or (filter..","..value)
end
end
-----------------------------------------------------------------------
-- OPTIONS TABLES
-----------------------------------------------------------------------
local function GetOptionsTable_AuraBars(updateFunc, groupName)
local config = {
order = 800,
type = "group",
name = L["Aura Bars"],
get = function(info) return E.db.unitframe.units[groupName].aurabar[info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName].aurabar[info[#info]] = value updateFunc(UF, groupName) end,
args = {
header = {
order = 1,
type = "header",
name = L["Aura Bars"]
},
enable = {
order = 2,
type = "toggle",
name = L["Enable"]
},
configureButton1 = {
order = 3,
type = "execute",
name = L["Coloring"],
desc = L["This opens the UnitFrames Color settings. These settings affect all unitframes."],
func = function() ACD:SelectGroup("ElvUI", "unitframe", "generalOptionsGroup", "allColorsGroup", "auraBars") end,
},
configureButton2 = {
order = 4,
type = "execute",
name = L["Coloring (Specific)"],
func = function() E:SetToFilterConfig("AuraBar Colors") end
},
anchorPoint = {
order = 5,
type = "select",
name = L["Anchor Point"],
desc = L["What point to anchor to the frame you set to attach to."],
values = {
["ABOVE"] = L["Above"],
["BELOW"] = L["Below"]
}
},
attachTo = {
order = 6,
type = "select",
name = L["Attach To"],
desc = L["The object you want to attach to."],
values = {
["FRAME"] = L["Frame"],
["DEBUFFS"] = L["Debuffs"],
["BUFFS"] = L["Buffs"]
}
},
height = {
order = 7,
type = "range",
name = L["Height"],
min = 6, max = 40, step = 1
},
maxBars = {
order = 8,
type = "range",
name = L["Max Bars"],
min = 1, max = 40, step = 1
},
sort = {
order = 9,
type = "select",
name = L["Sort Method"],
values = {
["TIME_REMAINING"] = L["Time Remaining"],
["TIME_REMAINING_REVERSE"] = L["Time Remaining Reverse"],
["TIME_DURATION"] = L["Duration"],
["TIME_DURATION_REVERSE"] = L["Duration Reverse"],
["NAME"] = L["NAME"],
["NONE"] = L["NONE"]
}
},
friendlyAuraType = {
order = 16,
type = "select",
name = L["Friendly Aura Type"],
desc = L["Set the type of auras to show when a unit is friendly."],
values = {
["HARMFUL"] = L["Debuffs"],
["HELPFUL"] = L["Buffs"]
}
},
enemyAuraType = {
order = 17,
type = "select",
name = L["Enemy Aura Type"],
desc = L["Set the type of auras to show when a unit is a foe."],
values = {
["HARMFUL"] = L["Debuffs"],
["HELPFUL"] = L["Buffs"]
}
},
uniformThreshold = {
order = 18,
type = "range",
name = L["Uniform Threshold"],
desc = L["Seconds remaining on the aura duration before the bar starts moving. Set to 0 to disable."],
min = 0, max = 3600, step = 1
},
yOffset = {
order = 19,
type = "range",
name = L["Y-Offset"],
min = -1000, max = 1000, step = 1,
},
spacing = {
order = 20,
type = "range",
name = L["Spacing"],
min = 0, softMax = 20, step = 1,
},
filters = {
order = 500,
type = "group",
name = L["FILTERS"],
guiInline = true,
args = {}
}
}
}
if groupName == "target" then
config.args.attachTo.values.PLAYER_AURABARS = L["Player Frame Aura Bars"]
end
config.args.filters.args.minDuration = {
order = 16,
type = "range",
name = L["Minimum Duration"],
desc = L["Don't display auras that are shorter than this duration (in seconds). Set to zero to disable."],
min = 0, max = 10800, step = 1,
}
config.args.filters.args.maxDuration = {
order = 17,
type = "range",
name = L["Maximum Duration"],
desc = L["Don't display auras that are longer than this duration (in seconds). Set to zero to disable."],
min = 0, max = 10800, step = 1,
}
config.args.filters.args.jumpToFilter = {
order = 18,
type = "execute",
name = L["Filters Page"],
desc = L["Shortcut to 'Filters' section of the config."],
func = function() ACD:SelectGroup("ElvUI", "filters") end
}
config.args.filters.args.specialPriority = {
order = 19,
type = "select",
sortByValue = true,
name = L["Add Special Filter"],
desc = L["These filters don't use a list of spells like the regular filters. Instead they use the WoW API and some code logic to determine if an aura should be allowed or blocked."],
values = function()
local filters = {}
local list = E.global.unitframe.specialFilters
if not list then return end
for filter in pairs(list) do
filters[filter] = L[filter]
end
return filters
end,
set = function(info, value)
filterPriority("aurabar", groupName, value)
updateFunc(UF, groupName)
end
}
config.args.filters.args.priority = {
order = 20,
type = "select",
name = L["Add Regular Filter"],
desc = L["These filters use a list of spells to determine if an aura should be allowed or blocked. The content of these filters can be modified in the 'Filters' section of the config."],
values = function()
local filters = {}
local list = E.global.unitframe.aurafilters
if not list then return end
for filter in pairs(list) do
filters[filter] = filter
end
return filters
end,
set = function(info, value)
filterPriority("aurabar", groupName, value)
updateFunc(UF, groupName)
end
}
config.args.filters.args.resetPriority = {
order = 21,
type = "execute",
name = L["Reset Priority"],
desc = L["Reset filter priority to the default state."],
func = function()
E.db.unitframe.units[groupName].aurabar.priority = P.unitframe.units[groupName].aurabar.priority
updateFunc(UF, groupName)
end
}
config.args.filters.args.filterPriority = {
order = 22,
type = "multiselect",
dragdrop = true,
name = L["Filter Priority"],
dragOnLeave = E.noop, --keep this here
dragOnEnter = function(info)
carryFilterTo = info.obj.value
end,
dragOnMouseDown = function(info)
carryFilterFrom, carryFilterTo = info.obj.value, nil
end,
dragOnMouseUp = function(info)
filterPriority("aurabar", groupName, carryFilterTo, nil, carryFilterFrom) --add it in the new spot
carryFilterFrom, carryFilterTo = nil, nil
end,
dragOnClick = function(info)
filterPriority("aurabar", groupName, carryFilterFrom, true)
end,
stateSwitchGetText = function(_, TEXT)
local friend, enemy = strmatch(TEXT, "^Friendly:([^,]*)"), strmatch(TEXT, "^Enemy:([^,]*)")
local text = friend or enemy or TEXT
local SF, localized = E.global.unitframe.specialFilters[text], L[text]
local blockText = SF and localized and text:match("^block") and localized:gsub("^%[.-]%s?", "")
local filterText = (blockText and format("|cFF999999%s|r %s", L["BLOCK"], blockText)) or localized or text
return (friend and format("|cFF33FF33%s|r %s", L["FRIEND"], filterText)) or (enemy and format("|cFFFF3333%s|r %s", L["ENEMY"], filterText)) or filterText
end,
stateSwitchOnClick = function(info)
filterPriority("aurabar", groupName, carryFilterFrom, nil, nil, true)
end,
values = function()
local str = E.db.unitframe.units[groupName].aurabar.priority
if str == "" then return nil end
return {strsplit(",",str)}
end,
get = function(info, value)
local str = E.db.unitframe.units[groupName].aurabar.priority
if str == "" then return nil end
local tbl = {strsplit(",",str)}
return tbl[value]
end,
set = function(info)
E.db.unitframe.units[groupName].aurabar[info[#info]] = nil -- this was being set when drag and drop was first added, setting it to nil to clear tester profiles of this variable
updateFunc(UF, groupName)
end
}
config.args.filters.args.spacer1 = {
order = 23,
type = "description",
name = L["Use drag and drop to rearrange filter priority or right click to remove a filter."].."\n"..L["Use Shift+LeftClick to toggle between friendly or enemy or normal state. Normal state will allow the filter to be checked on all units. Friendly state is for friendly units only and enemy state is for enemy units."],
}
return config
end
local function GetOptionsTable_Auras(auraType, updateFunc, groupName, numUnits)
local config = {
order = auraType == "buffs" and 500 or 600,
type = "group",
name = auraType == "buffs" and L["Buffs"] or L["Debuffs"],
get = function(info) return E.db.unitframe.units[groupName][auraType][info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName][auraType][info[#info]] = value updateFunc(UF, groupName, numUnits) end,
args = {
header = {
order = 1,
type = "header",
name = auraType == "buffs" and L["Buffs"] or L["Debuffs"]
},
enable = {
order = 2,
type = "toggle",
name = L["Enable"]
},
perrow = {
order = 3,
type = "range",
name = L["Per Row"],
min = 1, max = 20, step = 1,
},
numrows = {
order = 4,
type = "range",
name = L["Num Rows"],
min = 1, max = 10, step = 1
},
sizeOverride = {
order = 5,
type = "range",
name = L["Size Override"],
desc = L["If not set to 0 then override the size of the aura icon to this."],
min = 0, max = 60, step = 1
},
xOffset = {
order = 6,
type = "range",
name = L["X-Offset"],
min = -300, max = 300, step = 1
},
yOffset = {
order = 7,
type = "range",
name = L["Y-Offset"],
min = -300, max = 300, step = 1
},
anchorPoint = {
order = 8,
type = "select",
name = L["Anchor Point"],
desc = L["What point to anchor to the frame you set to attach to."],
values = positionValues
},
clickThrough = {
order = 9,
type = "toggle",
name = L["Click Through"],
desc = L["Ignore mouse events."]
},
sortMethod = {
order = 10,
type = "select",
name = L["Sort By"],
desc = L["Method to sort by."],
values = {
["TIME_REMAINING"] = L["Time Remaining"],
["DURATION"] = L["Duration"],
["NAME"] = L["NAME"],
["INDEX"] = L["Index"],
["PLAYER"] = L["PLAYER"]
}
},
sortDirection = {
order = 11,
type = "select",
name = L["Sort Direction"],
desc = L["Ascending or Descending order."],
values = {
["ASCENDING"] = L["Ascending"],
["DESCENDING"] = L["Descending"]
}
},
stacks = {
order = 12,
type = "group",
name = L["Stack Counter"],
guiInline = true,
get = function(info, value) return E.db.unitframe.units[groupName][auraType][info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName][auraType][info[#info]] = value updateFunc(UF, groupName, numUnits) end,
args = {
countFont = {
order = 1,
type = "select", dialogControl = "LSM30_Font",
name = L["Font"],
values = _G.AceGUIWidgetLSMlists.font
},
countFontSize = {
order = 2,
type = "range",
name = L["FONT_SIZE"],
min = 4, max = 20, step = 1, -- max 20 cause otherwise it looks weird
},
countFontOutline = {
order = 3,
type = "select",
name = L["Font Outline"],
desc = L["Set the font outline."],
values = C.Values.FontFlags
}
}
},
duration = {
order = 13,
type = "group",
name = L["Duration"],
guiInline = true,
get = function(info) return E.db.unitframe.units[groupName][auraType][info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName][auraType][info[#info]] = value updateFunc(UF, groupName, numUnits) end,
args = {
cooldownShortcut = {
order = 1,
type = "execute",
name = L["Cooldowns"],
func = function() ACD:SelectGroup("ElvUI", "cooldown", "unitframe") end,
},
durationPosition = {
order = 2,
type = "select",
name = L["Position"],
values = {
["TOP"] = "TOP",
["LEFT"] = "LEFT",
["BOTTOM"] = "BOTTOM",
["CENTER"] = "CENTER",
["TOPLEFT"] = "TOPLEFT",
["BOTTOMLEFT"] = "BOTTOMLEFT",
["TOPRIGHT"] = "TOPRIGHT"
}
}
}
},
filters = {
order = 100,
type = "group",
name = L["FILTERS"],
guiInline = true,
args = {}
}
}
}
if auraType == "buffs" then
config.args.attachTo = {
order = 7,
type = "select",
name = L["Attach To"],
desc = L["What to attach the buff anchor frame to."],
values = {
["FRAME"] = L["Frame"],
["DEBUFFS"] = L["Debuffs"],
["HEALTH"] = L["HEALTH"],
["POWER"] = L["Power"]
},
disabled = function()
local smartAuraPosition = E.db.unitframe.units[groupName].smartAuraPosition
return (smartAuraPosition and (smartAuraPosition == "BUFFS_ON_DEBUFFS" or smartAuraPosition == "FLUID_BUFFS_ON_DEBUFFS"))
end
}
else
config.args.attachTo = {
order = 7,
type = "select",
name = L["Attach To"],
desc = L["What to attach the debuff anchor frame to."],
values = {
["FRAME"] = L["Frame"],
["BUFFS"] = L["Buffs"],
["HEALTH"] = L["HEALTH"],
["POWER"] = L["Power"]
},
disabled = function()
local smartAuraPosition = E.db.unitframe.units[groupName].smartAuraPosition
return (smartAuraPosition and (smartAuraPosition == "DEBUFFS_ON_BUFFS" or smartAuraPosition == "FLUID_DEBUFFS_ON_BUFFS"))
end
}
end
config.args.filters.args.minDuration = {
order = 16,
type = "range",
name = L["Minimum Duration"],
desc = L["Don't display auras that are shorter than this duration (in seconds). Set to zero to disable."],
min = 0, max = 10800, step = 1
}
config.args.filters.args.maxDuration = {
order = 17,
type = "range",
name = L["Maximum Duration"],
desc = L["Don't display auras that are longer than this duration (in seconds). Set to zero to disable."],
min = 0, max = 10800, step = 1
}
config.args.filters.args.jumpToFilter = {
order = 18,
type = "execute",
name = L["Filters Page"],
desc = L["Shortcut to 'Filters' section of the config."],
func = function() ACD:SelectGroup("ElvUI", "filters") end
}
config.args.filters.args.specialPriority = {
order = 19,
type = "select",
sortByValue = true,
name = L["Add Special Filter"],
desc = L["These filters don't use a list of spells like the regular filters. Instead they use the WoW API and some code logic to determine if an aura should be allowed or blocked."],
values = function()
local filters = {}
local list = E.global.unitframe.specialFilters
if not list then return end
for filter in pairs(list) do
filters[filter] = L[filter]
end
return filters
end,
set = function(info, value)
filterPriority(auraType, groupName, value)
updateFunc(UF, groupName, numUnits)
end
}
config.args.filters.args.priority = {
order = 20,
type = "select",
name = L["Add Regular Filter"],
desc = L["These filters use a list of spells to determine if an aura should be allowed or blocked. The content of these filters can be modified in the 'Filters' section of the config."],
values = function()
local filters = {}
local list = E.global.unitframe.aurafilters
if not list then return end
for filter in pairs(list) do
filters[filter] = filter
end
return filters
end,
set = function(info, value)
filterPriority(auraType, groupName, value)
updateFunc(UF, groupName, numUnits)
end
}
config.args.filters.args.resetPriority = {
order = 21,
type = "execute",
name = L["Reset Priority"],
desc = L["Reset filter priority to the default state."],
func = function()
E.db.unitframe.units[groupName][auraType].priority = P.unitframe.units[groupName][auraType].priority
updateFunc(UF, groupName, numUnits)
end
}
config.args.filters.args.filterPriority = {
order = 22,
type = "multiselect",
dragdrop = true,
name = L["Filter Priority"],
dragOnLeave = E.noop, --keep this here
dragOnEnter = function(info)
carryFilterTo = info.obj.value
end,
dragOnMouseDown = function(info)
carryFilterFrom, carryFilterTo = info.obj.value, nil
end,
dragOnMouseUp = function(info)
filterPriority(auraType, groupName, carryFilterTo, nil, carryFilterFrom) --add it in the new spot
carryFilterFrom, carryFilterTo = nil, nil
end,
dragOnClick = function(info)
filterPriority(auraType, groupName, carryFilterFrom, true)
end,
stateSwitchGetText = function(_, TEXT)
local friend, enemy = strmatch(TEXT, "^Friendly:([^,]*)"), strmatch(TEXT, "^Enemy:([^,]*)")
local text = friend or enemy or TEXT
local SF, localized = E.global.unitframe.specialFilters[text], L[text]
local blockText = SF and localized and text:match("^block") and localized:gsub("^%[.-]%s?", "")
local filterText = (blockText and format("|cFF999999%s|r %s", L["BLOCK"], blockText)) or localized or text
return (friend and format("|cFF33FF33%s|r %s", L["FRIEND"], filterText)) or (enemy and format("|cFFFF3333%s|r %s", L["ENEMY"], filterText)) or filterText
end,
stateSwitchOnClick = function(info)
filterPriority(auraType, groupName, carryFilterFrom, nil, nil, true)
end,
values = function()
local str = E.db.unitframe.units[groupName][auraType].priority
if str == "" then return nil end
return {strsplit(",",str)}
end,
get = function(info, value)
local str = E.db.unitframe.units[groupName][auraType].priority
if str == "" then return nil end
local tbl = {strsplit(",",str)}
return tbl[value]
end,
set = function(info)
E.db.unitframe.units[groupName][auraType][info[#info]] = nil -- this was being set when drag and drop was first added, setting it to nil to clear tester profiles of this variable
updateFunc(UF, groupName, numUnits)
end
}
config.args.filters.args.spacer1 = {
order = 23,
type = "description",
name = L["Use drag and drop to rearrange filter priority or right click to remove a filter."].."\n"..L["Use Shift+LeftClick to toggle between friendly or enemy or normal state. Normal state will allow the filter to be checked on all units. Friendly state is for friendly units only and enemy state is for enemy units."],
}
return config
end
local function GetOptionsTable_InformationPanel(updateFunc, groupName, numUnits)
local config = {
order = 4000,
type = "group",
name = L["Information Panel"],
get = function(info) return E.db.unitframe.units[groupName].infoPanel[info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName].infoPanel[info[#info]] = value updateFunc(UF, groupName, numUnits) end,
args = {
header = {
order = 1,
type = "header",
name = L["Information Panel"]
},
enable = {
order = 2,
type = "toggle",
name = L["Enable"]
},
transparent = {
order = 3,
type = "toggle",
name = L["Transparent"]
},
height = {
order = 4,
type = "range",
name = L["Height"],
min = 4, max = 30, step = 1
}
}
}
return config
end
local function GetOptionsTable_Health(isGroupFrame, updateFunc, groupName, numUnits)
local config = {
order = 100,
type = "group",
name = L["HEALTH"],
get = function(info) return E.db.unitframe.units[groupName].health[info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName].health[info[#info]] = value updateFunc(UF, groupName, numUnits) end,
args = {
header = {
order = 1,
type = "header",
name = L["HEALTH"]
},
position = {
order = 2,
type = "select",
name = L["Text Position"],
values = positionValues
},
xOffset = {
order = 3,
type = "range",
name = L["Text xOffset"],
desc = L["Offset position for text."],
min = -300, max = 300, step = 1
},
yOffset = {
order = 4,
type = "range",
name = L["Text yOffset"],
desc = L["Offset position for text."],
min = -300, max = 300, step = 1
},
attachTextTo = {
order = 5,
type = "select",
name = L["Attach Text To"],
values = attachToValues
},
colorOverride = {
order = 6,
type = "select",
name = L["Class Color Override"],
desc = L["Override the default class color setting."],
values = colorOverrideValues,
get = function(info) return E.db.unitframe.units[groupName][info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName][info[#info]] = value; updateFunc(UF, groupName, numUnits) end,
},
configureButton = {
order = 7,
type = "execute",
name = L["Coloring"],
desc = L["This opens the UnitFrames Color settings. These settings affect all unitframes."],
func = function() ACD:SelectGroup("ElvUI", "unitframe", "generalOptionsGroup", "allColorsGroup", "healthGroup") end
},
text_format = {
order = 10,
type = "input",
name = L["Text Format"],
desc = L["TEXT_FORMAT_DESC"],
width = "full"
}
}
}
if isGroupFrame then
config.args.frequentUpdates = {
order = 8,
type = "toggle",
name = L["Frequent Updates"],
desc = L["Rapidly update the health, uses more memory and cpu. Only recommended for healing."]
}
config.args.orientation = {
order = 9,
type = "select",
name = L["Statusbar Fill Orientation"],
desc = L["Direction the health bar moves when gaining/losing health."],
values = {
["HORIZONTAL"] = L["Horizontal"],
["VERTICAL"] = L["Vertical"]
}
}
end
return config
end
local function GetOptionsTable_Power(hasDetatchOption, updateFunc, groupName, numUnits, hasStrataLevel)
local config = {
order = 200,
type = "group",
name = L["Power"],
get = function(info) return E.db.unitframe.units[groupName].power[info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName].power[info[#info]] = value updateFunc(UF, groupName, numUnits) end,
args = {
header = {
order = 1,
type = "header",
name = L["Power"]
},
enable = {
order = 2,
type = "toggle",
name = L["Enable"]
},
width = {
order = 3,
type = "select",
name = L["Style"],
values = {
["fill"] = L["Filled"],
["spaced"] = L["Spaced"],
["inset"] = L["Inset"]
},
set = function(info, value)
E.db.unitframe.units[groupName].power[info[#info]] = value
local frameName = E:StringTitle(groupName)
frameName = "ElvUF_"..frameName
frameName = frameName:gsub("t(arget)", "T%1")
if numUnits then
for i = 1, numUnits do
if _G[frameName..i] then
local min, max = _G[frameName..i].Power:GetMinMaxValues()
_G[frameName..i].Power:SetMinMaxValues(min, max + 500)
_G[frameName..i].Power:SetValue(1)
_G[frameName..i].Power:SetValue(0)
end
end
else
if _G[frameName] and _G[frameName].Power then
local min, max = _G[frameName].Power:GetMinMaxValues()
_G[frameName].Power:SetMinMaxValues(min, max + 500)
_G[frameName].Power:SetValue(1)
_G[frameName].Power:SetValue(0)
else
for i = 1, _G[frameName]:GetNumChildren() do
local child = select(i, _G[frameName]:GetChildren())
if child and child.Power then
local min, max = child.Power:GetMinMaxValues()
child.Power:SetMinMaxValues(min, max + 500)
child.Power:SetValue(1)
child.Power:SetValue(0)
end
end
end
end
updateFunc(UF, groupName, numUnits)
end
},
height = {
order = 4,
type = "range",
name = L["Height"],
min = ((E.db.unitframe.thinBorders or E.PixelMode) and 3 or 7), max = 50, step = 1
},
offset = {
order = 5,
type = "range",
name = L["Offset"],
desc = L["Offset of the powerbar to the healthbar, set to 0 to disable."],
min = 0, max = 20, step = 1
},
configureButton = {
order = 6,
type = "execute",
name = L["Coloring"],
desc = L["This opens the UnitFrames Color settings. These settings affect all unitframes."],
func = function() ACD:SelectGroup("ElvUI", "unitframe", "general", "allColorsGroup", "powerGroup") end,
},
position = {
order = 7,
type = "select",
name = L["Text Position"],
values = positionValues
},
xOffset = {
order = 8,
type = "range",
name = L["Text xOffset"],
desc = L["Offset position for text."],
min = -300, max = 300, step = 1
},
yOffset = {
order = 9,
type = "range",
name = L["Text yOffset"],
desc = L["Offset position for text."],
min = -300, max = 300, step = 1
},
attachTextTo = {
order = 10,
type = "select",
name = L["Attach Text To"],
values = attachToValues
},
text_format = {
order = 100,
type = "input",
name = L["Text Format"],
width = "full",
desc = L["TEXT_FORMAT_DESC"]
}
}
}
if hasDetatchOption then
config.args.detachFromFrame = {
order = 11,
type = "toggle",
name = L["Detach From Frame"]
}
config.args.detachedWidth = {
order = 12,
type = "range",
name = L["Detached Width"],
disabled = function() return not E.db.unitframe.units[groupName].power.detachFromFrame end,
min = 15, max = 1000, step = 1
}
config.args.parent = {
order = 13,
type = "select",
name = L["Parent"],
desc = L["Choose UIPARENT to prevent it from hiding with the unitframe."],
disabled = function() return not E.db.unitframe.units[groupName].power.detachFromFrame end,
values = {
["FRAME"] = "FRAME",
["UIPARENT"] = "UIPARENT"
}
}
end