-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Options.lua
701 lines (687 loc) · 30.1 KB
/
Options.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
local appName, JDT = ...
local SharedMedia = LibStub("LibSharedMedia-3.0")
---@type AceConfigOptionsTable
JDT.options = {
name = "Addon Options",
type = "group",
args = {
ExportButton = {
name = "Send to WeakAuras",
type = "execute",
order = 0,
func = function() JDT.exportAuras() end
},
DebugMode = {
name = JDT.getLocalisation("DebugMode"),
desc = JDT.getLocalisation("DebugModeDescription"),
order = 30,
width = "full",
type = "toggle",
set = function(info,val) JDT.db.profile.DebugMode = val end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.DebugMode --Sets value of toggles depending on SavedVariables
end,
confirm = true,
confirmText = JDT.getLocalisation("DebugWarning"),
},
ToggleAnchor = {
name = JDT.getLocalisation("ToggleAnchor"),
desc = JDT.getLocalisation("ToggleAnchorDescription"),
order = 40,
width = "full",
type = "toggle",
set = function(info,val)
JDT.RefreshAnchor(JDT.AnchorRefreshTypes.all)
if val == true then
JDT.Anchor:Show()
JDT.StartDummyCooldown()
else
JDT.Anchor:Hide()
end
JDT.db.profile.ToggleAnchor = val
end,
get = function(info)
return JDT.db.profile.ToggleAnchor --Sets value of toggles depending on SavedVariables
end,
},
ExportOnDungeonEntry = {
name = JDT.getLocalisation("ExportOnDungeonEntry"),
desc = JDT.getLocalisation("ExportOnDungeonEntryDescription"),
order = 50,
width = "full",
type = "toggle",
set = function(info,val)
JDT.db.profile.ExportOnDungeonEntry = val
end,
get = function(info)
return JDT.db.profile.ExportOnDungeonEntry --Sets value of toggles depending on SavedVariables
end,
},
generaloptions={
name = JDT.getLocalisation("GeneralOptions"),
type = "group",
args={
GroupOptionsSeperator={
name = "GroupOptions",
type = "header",
order = 1,
},
AnchorGroupsToAffixes = {
name = JDT.getLocalisation("AnchorGroupsToAffixes"),
desc = JDT.getLocalisation("AnchorGroupsToAffixesDescription"),
order = 30,
width = "full",
type = "toggle",
set = function(info,val) JDT.db.profile.AnchorGroupsToAffixes = val end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.AnchorGroupsToAffixes --Sets value of toggles depending on SavedVariables
end
},
xOffset= {
name = JDT.getLocalisation("xOffset"),
desc = JDT.getLocalisation("xOffsetDescription"),
order = 31,
type = "range",
softMin = math.floor(-GetScreenWidth()/2),
softMax = math.ceil(GetScreenWidth()/2),
bigStep = 1,
set = function(info,val)
JDT.db.profile.xOffset = val
JDT.RefreshAnchor(JDT.AnchorRefreshTypes.xOffset)
end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.xOffset --Sets value of toggles depending on SavedVariables
end
},
yOffset= {
name = JDT.getLocalisation("yOffset"),
desc = JDT.getLocalisation("yOffsetDescription"),
order = 32,
type = "range",
softMin = math.floor(-GetScreenHeight()/2),
softMax = math.ceil(GetScreenHeight()/2),
bigStep = 1,
set = function(info,val)
JDT.db.profile.yOffset = val
JDT.RefreshAnchor(JDT.AnchorRefreshTypes.yOffset)
end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.yOffset --Sets value of toggles depending on SavedVariables
end
},
GroupLimit= {
name = JDT.getLocalisation("GroupLimit"),
desc = JDT.getLocalisation("GroupLimitDescription"),
order = 33,
type = "range",
softMin = 1,
softMax = 20,
min = 0,
max= 20,
step = 1,
bigStep = 1,
set = function(info,val) JDT.db.profile.GroupLimit = val end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.GroupLimit --Sets value of toggles depending on SavedVariables
end
},
GrowOptionsSeperator={
name = "GrowOptions",
type = "header",
order = 34,
},
GroupGrow= {
name = JDT.getLocalisation("GroupGrow"),
desc = JDT.getLocalisation("GroupGrowDescription"),
order = 35,
type = "select",
values = JDT.Templates.GroupGrowTypes,
set = function(info,val) JDT.db.profile.GroupGrow = val end, --Sets value of SavedVariables depending on toggles
get = function(info)
JDT.db.profile.GroupGrow = JDT.db.profile.GroupGrow or "RIGHT"
JDT.options.args.generaloptions.args.SpecificGrowOptions.args = JDT.Templates.GroupGrowOptionsFromType[JDT.db.profile.GroupGrow]
return JDT.db.profile.GroupGrow--Sets value of toggles depending on SavedVariables
end
},
SpecificGrowOptions={
name = JDT.getLocalisation("SpecificGrowOptions"),
type = "group",
order = 36,
inline = true,
args={}
},
AuraOptionsSeperator={
name = "AuraOptions",
type = "header",
order = 50,
},
IconWidth= {
name = JDT.getLocalisation("IconWidth"),
desc = JDT.getLocalisation("IconWidthDescription"),
type = "range",
order = 51,
width = 1.25,
softMin = 1,
softMax = 600,
min = 1,
step = 1,
bigStep = 1,
set = function(info,val)
JDT.db.profile.IconWidth = val
JDT.RefreshAnchor(JDT.AnchorRefreshTypes.IconWidth)
end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.IconWidth --Sets value of toggles depending on SavedVariables
end
},
IconHeight= {
name = JDT.getLocalisation("IconHeight"),
desc = JDT.getLocalisation("IconHeightDescription"),
type = "range",
order = 52,
width = 1.25,
softMin = 1,
softMax = 600,
min = 1,
step = 1,
bigStep = 1,
set = function(info,val)
JDT.db.profile.IconHeight = val
JDT.RefreshAnchor(JDT.AnchorRefreshTypes.IconHeight)
end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.IconHeight --Sets value of toggles depending on SavedVariables
end
},
zoom= {
name = JDT.getLocalisation("zoom"),
desc = JDT.getLocalisation("zoomDescription"),
order = 53,
type = "range",
width = 2.5,
softMin = 0,
softMax = 100,
bigStep = 1,
set = function(info,val)
JDT.db.profile.zoom = val
end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.zoom --Sets value of toggles depending on SavedVariables
end
},
ShowTimer = {
name = JDT.getLocalisation("ShowTimer"),
desc = JDT.getLocalisation("ShowTimerDescription"),
type = "toggle",
order = 54,
width = 2.5/3,
set = function(info,val) JDT.db.profile.ShowTimer = val
JDT.DummyCooldownText() end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.ShowTimer --Sets value of toggles depending on SavedVariables
end
},
HideCooldownText = { -- "text" is misleading here it's the whole cd widget
name = JDT.getLocalisation("HideCooldownText"),
desc = JDT.getLocalisation("HideCooldownTextDescription"),
order = 55,
width = 2.5/3,
type = "toggle",
set = function(info,val) JDT.db.profile.HideCooldownText = val
JDT.RefreshAnchor(JDT.AnchorRefreshTypes.HideCD)end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.HideCooldownText --Sets value of toggles depending on SavedVariables
end
},
CooldownTextFontSize= {
name = JDT.getLocalisation("CooldownTextFontSize"),
desc = JDT.getLocalisation("CooldownTextFontSizeDescription"),
order = 56,
width = 2.5/3,
type = "range",
softMin = 6,
softMax = 72,
min = 1,
step = 1,
bigStep = 1,
set = function(info,val) JDT.db.profile.CooldownTextFontSize = val
JDT.RefreshAnchor(JDT.AnchorRefreshTypes.CooldownTextFontSize)end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.CooldownTextFontSize --Sets value of toggles depending on SavedVariables
end
},
FontOptions= {
name = JDT.getLocalisation("FontOption"),
desc = JDT.getLocalisation("FontOptionDescription"),
order = 57,
type = "select",
width = 1.25,
values = JDT.Sharedmedia.font,
set = function(info,val) JDT.db.profile.FontOptions = val
JDT.RefreshAnchor(JDT.AnchorRefreshTypes.Font) end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.FontOptions --Sets value of toggles depending on SavedVariables
end
},
TextFontSize= {
name = JDT.getLocalisation("TextFontSize"),
desc = JDT.getLocalisation("TextFontSizeDescription"),
type = "range",
order = 58,
width = 1.25,
softMin = 6,
softMax = 72,
min = 1,
step = 1,
bigStep = 1,
set = function(info,val) JDT.db.profile.TextFontSize = val
JDT.RefreshAnchor(JDT.AnchorRefreshTypes.TextFontSize) end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.TextFontSize --Sets value of toggles depending on SavedVariables
end
},
GrowOptionsSeperator={
name = "SoundOptions",
type = "header",
order = 60,
},
PlaySound = {
name = JDT.getLocalisation("PlaySound"),
desc = JDT.getLocalisation("PlaySoundDescription"),
order = 61,
type = "toggle",
set = function(info,val) JDT.db.profile.PlaySound = val end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.PlaySound --Sets value of toggles depending on SavedVariables
end
},
SoundChannel= {
name = JDT.getLocalisation("SoundChannel"),
desc = JDT.getLocalisation("SoundChannelDescription"),
order = 62,
type = "select",
values = JDT.SoundChannels,
set = function(info,val) JDT.db.profile.SoundChannel = val end, --Sets value of SavedVariables depending on toggles
get = function(info)
JDT.db.profile.SoundChannel = JDT.db.profile.SoundChannel
return JDT.db.profile.SoundChannel--Sets value of toggles depending on SavedVariables
end
},
SoundOptions={
name = JDT.getLocalisation("SoundOptions"),
type = "group",
order = 69,
--inline = true,
args={
GroupOptionsSeperator={
name = "SoundOptions",
type = "header",
order = 1,
},
},
},
ComingSoon = {
name = "More options coming soon",
order = -1,
type = "description",
image = "Interface\\AddOns\\DungeonAuraTools\\Files\\DungeonAuraTools.tga",
},
-- more options go here
}
},
spelloptions={
name = JDT.getLocalisation("SpellOptions"),
type = "group",
args={
Seperator={
name = JDT.getLocalisation("ExpansionOptions"),
type = "header",
order = 0,
}
-- more options go here
}
}
}
}
-- generates Sound Options
for SoundKey in pairs (JDT.SoundTypes) do
JDT.options.args.generaloptions.args.SoundOptions.args[SoundKey] = {
name = SoundKey,
type = "group",
inline = true,
args = {
SoundToggle = {
name = JDT.getLocalisation("SoundToggle"),
desc = JDT.getLocalisation("SoundToggleDescription"),
type = "toggle",
set = function(info,val) JDT.db.profile.SoundKey[SoundKey] = val end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.SoundKey[SoundKey] --Sets value of toggles depending on SavedVariables
end
},
SoundOptions= {
name = JDT.getLocalisation("SoundOption"),
desc = JDT.getLocalisation("SoundOptionDescription"),
order = 56,
type = "select",
width = 1.25,
values = JDT.Sharedmedia.sound,
set = function(info,val) JDT.db.profile.SoundOptions[SoundKey] = val
end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.SoundOptions[SoundKey] --Sets value of toggles depending on SavedVariables
end
},
}
}
end
local TypeToggleList = {}
for AuraType in pairs(JDT.Types) do -- generate list of possible Type e.g. AuraIcon, Bar etc
TypeToggleList[AuraType] = AuraType
end
---generates the Group of a Spell
---@param Spellname string
---@param desc string
---@param Spellicon number
---@param SavedVariables table
---@param defaultType string
---@return table
JDT.createAuraGroup = function(Spellname, desc, Spellicon, SavedVariables, defaultType)
local Group = {
name = Spellname,
type = "group",
inline = true,
args = {
description = {
type = "description",
name = desc or " ",
image = Spellicon,
order = 0,
},
toggle = {
name = "Activated",
desc = desc,
type = "toggle",
set = function(info,val) SavedVariables.enabled = val end, --Sets value of SavedVariables depending on toggles
get = function(info)
return SavedVariables.enabled--Sets value of toggles depending on SavedVariables
end
},
AuraType = {
name = JDT.getLocalisation("AuraType"),
desc = JDT.getLocalisation("AuraTypeDescription"),
type = "select",
style = "dropdown",
values = TypeToggleList,
set = function(info,val) SavedVariables.AuraType = val end, --Sets value of SavedVariables depending on toggles
get = function(info)
return SavedVariables.AuraType or defaultType --Sets value of toggles depending on SavedVariables
end
}
}
}
return Group
end
JDT.createOptionsData = function() -- Generates Type Groups depending on SPellData.lua
JDT.options.args.spelloptions.args["ExpansionToggles"] = {
type = "group",
name = "",
inline = true,
args={
}
}
JDT.db.profile.SoundKey = JDT.db.profile.SoundKey or {}
for ExpansionKey,ExpansionValue in pairs(JDT.SpellList) do
if ExpansionKey == "Affixes" then
JDT.options.args.spelloptions.args[ExpansionKey] = {
name = JDT.ExpansionValues[ExpansionKey][3],
type = "group",
order = 0,
args={
}
}
JDT.options.args.spelloptions.args["ExpansionToggles"].args[ExpansionKey] = {
name = ExpansionKey,
desc = JDT.getLocalisation("Toggles all Auras for").." "..ExpansionKey,
type = "toggle",
width = "full",
order = 0,
set = function(info,val) for typekey,typevalue in pairs(ExpansionValue.Auras) do
for k,v in pairs(typevalue) do
JDT.db.profile.data[ExpansionKey].Auras[typekey][k].enabled = val
end
end end,
get = function(info)
local isactive = false
for typekey,typevalue in pairs(ExpansionValue.Auras) do
for k,v in pairs(typevalue) do
if JDT.db.profile.data[ExpansionKey].Auras[typekey][k].enabled == true then
isactive = true
end
end
end return isactive end,
confirm = true,
confirmText = JDT.getLocalisation("Warning will overwrite all currently selected values."),
}
for typekey,typevalue in pairs(ExpansionValue.Auras) do
for k,v in pairs(typevalue) do -- Generates Spell toggles depending on SPellData.lua
if v.affixId then
local name, description, filedataid = C_ChallengeMode.GetAffixInfo(v.affixId)
JDT.options.args.spelloptions.args[ExpansionKey].args[k]= JDT.createAuraGroup(name,description,filedataid, JDT.db.profile.data[ExpansionKey].Auras[typekey][k],JDT.Templates.GroupTypes[typekey].AuraType)
else
local Spellname, Spellrank, Spellicon, SpellcastTime, SpellminRange, SpellmaxRange, SpellID = JDT.GetSpellInfo(v.spellId)
local spell = Spell:CreateFromSpellID(SpellID)
spell:ContinueOnSpellLoad(function()
local desc = spell:GetSpellDescription()
JDT.options.args.spelloptions.args[ExpansionKey].args[k]= JDT.createAuraGroup(Spellname, desc, Spellicon, JDT.db.profile.data[ExpansionKey].Auras[typekey][k],JDT.Templates.GroupTypes[typekey].AuraType)
end)
end
end
end
elseif ExpansionKey == "Seasons"then
JDT.options.args.spelloptions.args.Seasons = {
name = ExpansionKey,
type = "group",
order = 0,
args={
-- more options go here
}
}
for season,seasonValue in pairs(JDT.SpellList.Seasons) do
JDT.options.args.spelloptions.args.Seasons.args[season] = {
name = seasonValue.groupName,
desc = JDT.getLocalisation("SeasonToggleDescription"),
type = "toggle",
set = function(info,val) JDT.db.profile.data.Seasons[season] = val end, --Sets value of SavedVariables depending on toggles
get = function(info)
return JDT.db.profile.data.Seasons[season] --Sets value of toggles depending on SavedVariables
end
}
end
else
JDT.options.args.spelloptions.args[ExpansionKey] = {
name = JDT.ExpansionValues[ExpansionKey][3],
type = "group",
order = (1000-JDT.ExpansionValues[ExpansionKey][2]*10),
args={
-- more options go here
}
}
JDT.options.args.spelloptions.args["ExpansionToggles"].args[ExpansionKey] = {
name = JDT.ExpansionValues[ExpansionKey][3],
desc = JDT.getLocalisation("Toggles all Auras for").." "..ExpansionKey,
type = "toggle",
width = "full",
order = 1000-JDT.ExpansionValues[ExpansionKey][2]*10,
set = function(info,val)
for DungeonKey,DungeonValue in pairs(ExpansionValue.Dungeons) do
for BossNameKey, BossNameValue in pairs(DungeonValue.Bosses) do
for SpellTypeKey,SpellTypeValue in pairs (BossNameValue.Auras) do
for k,v in pairs(JDT.db.profile.data[ExpansionKey].Dungeons[DungeonKey].Bosses[BossNameKey].Auras[SpellTypeKey]) do
JDT.db.profile.data[ExpansionKey].Dungeons[DungeonKey].Bosses[BossNameKey].Auras[SpellTypeKey][k].enabled = val
end
end
end
end
end, --Sets value of SavedVariables depending on toggles
get = function(info)
local isactive = false
for DungeonKey,DungeonValue in pairs(ExpansionValue.Dungeons) do
for BossNameKey, BossNameValue in pairs(DungeonValue.Bosses) do
for SpellTypeKey,SpellTypeValue in pairs (BossNameValue.Auras) do
for k,v in pairs(JDT.db.profile.data[ExpansionKey].Dungeons[DungeonKey].Bosses[BossNameKey].Auras[SpellTypeKey]) do
if JDT.db.profile.data[ExpansionKey].Dungeons[DungeonKey].Bosses[BossNameKey].Auras[SpellTypeKey][k].enabled == true then
isactive = true
end
end
end
end
end
return isactive --Sets value of toggles depending on SavedVariables
end,
confirm = true,
confirmText = JDT.getLocalisation("Warning will overwrite all currently selected values."),
}
JDT.options.args.spelloptions.args[ExpansionKey].args["DungeonToggles"] = {
type = "group",
name = "",
inline = true,
args={
Logo = {
name = "",
type = "description",
image = GetExpansionDisplayInfo(JDT.ExpansionValues[ExpansionKey][2]).logo,
imageWidth = 120,
imageHeight = 50,
order = 0,
}
}
}
for DungeonKey,DungeonValue in pairs(ExpansionValue.Dungeons) do
EJ_SelectInstance(DungeonValue.EncounterJournalID)
local Instancename, Instancedescription,_,InstanceImage,_,_, _,_,_= EJ_GetInstanceInfo()
JDT.options.args.spelloptions.args[ExpansionKey].args[DungeonKey] = {
name = Instancename,
desc = Instancedescription,
type = "group",
args={
-- more options go here
}
}
JDT.options.args.spelloptions.args[ExpansionKey].args["DungeonToggles"].args[DungeonKey]= {
name = Instancename,
desc = JDT.getLocalisation("Toggles all Auras for").." "..Instancename,
type = "toggle",
image = InstanceImage,
width = "full",
order = DungeonValue.EncounterJournalID,
set = function(info,val)
for BossNameKey, BossNameValue in pairs(DungeonValue.Bosses) do
for SpellTypeKey,SpellTypeValue in pairs (BossNameValue.Auras) do
for k,v in pairs(JDT.db.profile.data[ExpansionKey].Dungeons[DungeonKey].Bosses[BossNameKey].Auras[SpellTypeKey]) do
JDT.db.profile.data[ExpansionKey].Dungeons[DungeonKey].Bosses[BossNameKey].Auras[SpellTypeKey][k].enabled = val
end
end
end
end, --Sets value of SavedVariables depending on toggles
get = function(info)
local isactive = false
for BossNameKey, BossNameValue in pairs(DungeonValue.Bosses) do
for SpellTypeKey,SpellTypeValue in pairs (BossNameValue.Auras) do
for k,v in pairs(JDT.db.profile.data[ExpansionKey].Dungeons[DungeonKey].Bosses[BossNameKey].Auras[SpellTypeKey]) do
if JDT.db.profile.data[ExpansionKey].Dungeons[DungeonKey].Bosses[BossNameKey].Auras[SpellTypeKey][k].enabled == true then
isactive = true
end
end
end
end
return isactive --Sets value of toggles depending on SavedVariables
end,
confirm = true,
confirmText = JDT.getLocalisation("Warning will overwrite all currently selected values."),
}
JDT.options.args.spelloptions.args[ExpansionKey].args[DungeonKey].args["BossToggles"] = {
type = "group",
name = "",
inline = true,
args={
}
}
for BossNameKey, BossNameValue in pairs(DungeonValue.Bosses) do
local EncounterName, Encounterdescription, journalEncounterID, rootSectionID, link, journalInstanceID, dungeonEncounterID, instanceID
local id, name, description, displayInfo, iconImage, uiModelSceneID
local OrderNumber = tonumber(strsub(BossNameKey,5))
if BossNameKey ~= "Trash" then
EncounterName, Encounterdescription, journalEncounterID, rootSectionID, link, journalInstanceID, dungeonEncounterID, instanceID = EJ_GetEncounterInfoByIndex(OrderNumber)
id, name, description, displayInfo, iconImage, uiModelSceneID = EJ_GetCreatureInfo(1,journalEncounterID)
else
EncounterName = "Trash"
Encounterdescription = "Trash"
end
local auratogglename = EncounterName or BossNameKey or " "
JDT.options.args.spelloptions.args[ExpansionKey].args[DungeonKey].args[BossNameKey] = {
name = auratogglename,
desc = Encounterdescription,
type = "group",
order = OrderNumber,
args={
emptySpace = {
name = "",
type = "description",
desc = ""
},
-- more options go here
},
}
JDT.options.args.spelloptions.args[ExpansionKey].args[DungeonKey].args["BossToggles"].args[BossNameKey]= {
name = auratogglename,
desc = JDT.getLocalisation("Toggles all Auras for").." "..auratogglename,
type = "toggle",
image = iconImage,
order = OrderNumber,
set = function(info,val)
for SpellTypeKey,SpellTypeValue in pairs (BossNameValue.Auras) do
for k,v in pairs(JDT.db.profile.data[ExpansionKey].Dungeons[DungeonKey].Bosses[BossNameKey].Auras[SpellTypeKey]) do
JDT.db.profile.data[ExpansionKey].Dungeons[DungeonKey].Bosses[BossNameKey].Auras[SpellTypeKey][k].enabled = val
end
end
end, --Sets value of SavedVariables depending on toggles
get = function(info)
local isactive = false
for SpellTypeKey,SpellTypeValue in pairs (BossNameValue.Auras) do
for k,v in pairs(JDT.db.profile.data[ExpansionKey].Dungeons[DungeonKey].Bosses[BossNameKey].Auras[SpellTypeKey]) do
if JDT.db.profile.data[ExpansionKey].Dungeons[DungeonKey].Bosses[BossNameKey].Auras[SpellTypeKey][k].enabled == true then
isactive = true
end
end
end
return isactive --Sets value of toggles depending on SavedVariables
end,
confirm = true,
confirmText = JDT.getLocalisation("Warning will overwrite all currently selected values."),
}
for SpellTypeKey,SpellTypeValue in pairs (BossNameValue.Auras) do
JDT.options.args.spelloptions.args[ExpansionKey].args[DungeonKey].args[BossNameKey].args[SpellTypeKey] = {
name = JDT.getLocalisation(SpellTypeKey),
type = "group",
inline = true,
args={
-- more options go here
}
}
for k,v in pairs(SpellTypeValue) do -- Generates Spell toggles depending on SPellData.lua
local Spellname, Spellrank, Spellicon, SpellcastTime, SpellminRange, SpellmaxRange, SpellID = JDT.GetSpellInfo(v.spellId)
local spell = Spell:CreateFromSpellID(SpellID)
assert(spell, "Spell is nil for:"..ExpansionKey.." , "..DungeonKey.." , "..BossNameKey.." , "..SpellTypeKey.." , "..v.spellId)
spell:ContinueOnSpellLoad(function()
local desc = spell:GetSpellDescription()
assert(Spellname and Spellicon and JDT.db.profile.data[ExpansionKey].Dungeons[DungeonKey].Bosses[BossNameKey].Auras[SpellTypeKey][k] and JDT.Templates.GroupTypes[SpellTypeKey].AuraType, "Spell is missing data for"..ExpansionKey.." , "..DungeonKey.." , "..BossNameKey.." , "..SpellTypeKey.." , "..v.spellId)
JDT.options.args.spelloptions.args[ExpansionKey].args[DungeonKey].args[BossNameKey].args[SpellTypeKey].args[k]= JDT.createAuraGroup(Spellname,desc,Spellicon,JDT.db.profile.data[ExpansionKey].Dungeons[DungeonKey].Bosses[BossNameKey].Auras[SpellTypeKey][k],JDT.Templates.GroupTypes[SpellTypeKey].AuraType)
end)
end
end
end
end
end
end
end