forked from happenslol/WarpDeplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Options.lua
807 lines (714 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
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
local Util = WarpDeplete.Util
local L = WarpDeplete.L
local function font(name, profileVar, updateFn, extraOptions)
local result = {
type = "select",
dialogControl = "LSM30_Font",
name = name,
values = WarpDeplete.LSM:HashTable("font"),
get = function(info) return WarpDeplete.db.profile[profileVar] end,
set = function(info, value)
WarpDeplete.db.profile[profileVar] = value
WarpDeplete[updateFn](WarpDeplete)
end
}
if extraOptions and type(extraOptions) == "table" then
for k, v in pairs(extraOptions) do
result[k] = v
end
end
return result
end
local function range(name, profileVar, updateFn, extraOptions)
local result = {
type = "range",
name = name,
min = 8,
max = 40,
step = 1,
get = function(info) return WarpDeplete.db.profile[profileVar] end,
set = function(info, value)
WarpDeplete.db.profile[profileVar] = value
WarpDeplete[updateFn](WarpDeplete)
end
}
if extraOptions and type(extraOptions) == "table" then
for k, v in pairs(extraOptions) do
result[k] = v
end
end
return result
end
local function toggle(name, profileVar, updateFn, extraOptions)
local result = {
type = "toggle",
name = name,
get = function(info) return WarpDeplete.db.profile[profileVar] end,
set = function(info, value)
WarpDeplete.db.profile[profileVar] = value
WarpDeplete[updateFn](WarpDeplete)
end
}
if extraOptions and type(extraOptions) == "table" then
for k, v in pairs(extraOptions) do
result[k] = v
end
end
return result
end
local function fontFlags(name, profileVar, updateFn, extraOptions)
local result = {
type = "select",
name = name,
desc = L["Default:"] .. " " .. L["OUTLINE"],
values = {
["OUTLINE"] = L["OUTLINE"],
["THICKOUTLINE"] = L["THICKOUTLINE"],
["MONOCHROME"] = L["MONOCHROME"],
["NONE"] = L["NONE"]
},
get = function(info) return WarpDeplete.db.profile[profileVar] end,
set = function(info, value)
WarpDeplete.db.profile[profileVar] = value
WarpDeplete[updateFn](WarpDeplete)
end
}
if extraOptions and type(extraOptions) == "table" then
for k, v in pairs(extraOptions) do
result[k] = v
end
end
return result
end
local function lineBreak(hidden, width)
local result = {
type = "description",
name = "\n",
hidden = hidden or false,
}
if width then result.width = width end
return result
end
local function color(name, profileVar, updateFn, extraOptions)
local result = {
type = "color",
name = name,
get = function(info)
local r, g, b, a = Util.hexToRGB(WarpDeplete.db.profile[profileVar])
return r, g, b, a or 1
end,
set = function(info, r, g, b, a)
WarpDeplete.db.profile[profileVar] = Util.rgbToHex(r, g, b, a)
WarpDeplete[updateFn](WarpDeplete)
end
}
if extraOptions and type(extraOptions) == "table" then
for k, v in pairs(extraOptions) do
result[k] = v
end
end
return result
end
local function barTexture(name, profileVar, updateFn, extraOptions)
local result = {
name = name,
type = "select",
dialogControl = 'LSM30_Statusbar',
values = WarpDeplete.LSM:HashTable("statusbar"),
get = function(info) return WarpDeplete.db.profile[profileVar] end,
set = function(info, value)
WarpDeplete.db.profile[profileVar] = value
WarpDeplete[updateFn](WarpDeplete)
end
}
if extraOptions and type(extraOptions) == "table" then
for k, v in pairs(extraOptions) do
result[k] = v
end
end
return result
end
local function group(name, inline, args, extraOptions)
local order = 1
local result = {
name = name,
inline = inline,
type = "group",
args = {}
}
for _, arg in pairs(args) do
arg.order = order
result.args[arg.type .. order] = arg
order = order + 1
end
if extraOptions and type(extraOptions) == "table" then
for k, v in pairs(extraOptions) do
result[k] = v
end
end
return result
end
function WarpDeplete:InitOptions()
self.isUnlocked = false
local options = {
name = "WarpDeplete",
handler = self,
type = "group",
childGroups = "tab",
args = {
unlocked = {
order = 1,
type = "toggle",
name = L["Unlocked"],
desc = L["Unlocks the timer window and allows it to be moved around"],
get = function(info) return WarpDeplete.isUnlocked end,
set = WarpDeplete.SetUnlocked
},
demo = {
order = 2,
type = "toggle",
name = L["Demo Mode"],
desc = L["Enables the demo mode, used for configuring the timer"],
get = function(info) return WarpDeplete.challengeState.demoModeActive end,
set = function(info, value)
if value then WarpDeplete:EnableDemoMode()
else WarpDeplete:DisableDemoMode() end
end
},
general = group(L["General"], false, {
lineBreak(),
toggle(L["Insert keystone automatically"], "insertKeystoneAutomatically", "UpdateLayout"),
toggle(L["Show millisecond precision after dungeon completion"], "showMillisecondsWhenDungeonCompleted", "UpdateLayout"),
lineBreak(),
group(L["Forces Display"], true, {
{
type = "select",
name = L["Forces text format"],
desc = L["Choose how your forces progress will be displayed"],
sorting = {
":percent:",
":percentafterpull:",
":count:/:totalcount:",
":count:/:totalcount: - :percent:",
":custom:"
},
values = {
[":percent:"] = "82.52%",
[":percentafterpull:"] = "87.84%",
[":count:/:totalcount:"] = "198/240",
[":count:/:totalcount: - :percent:"] = "198/240 - 82.52%",
[":custom:"] = L["Custom"],
},
get = function(info) return WarpDeplete.db.profile.forcesFormat end,
set = function(info, value)
WarpDeplete.db.profile.forcesFormat = value
WarpDeplete:UpdateLayout()
end
},
lineBreak(function() return WarpDeplete.db.profile.forcesFormat == ":custom:" end, 2),
{
type = "input",
name = L["Custom forces text format"],
desc = L["Use the following tags to set your custom format"] .. ":"
.. "\n- :percent: " .. L["Shows the current forces percentage (e.g. 82.52%)"]
.. "\n- :count: " .. L["Shows the current forces count (e.g. 198)"]
.. "\n- :totalcount: " .. L["Shows the total forces count (e.g. 240)"]
.. "\n- :remainingcount: " .. L["Shows the remaining amount of forces needed to complete"]
.. "\n- :countafterpull: " .. L["Shows the current forces count inluding current pull (e.g. 205)"]
.. "\n- :remainingcountafterpull: " .. L["Shows the remaining amount of forces needed to complete after current pull"]
.. "\n- :remainingpercent: " .. L["Shows the remaining percentage of forces to achieve 100%"]
.. "\n- :percentafterpull: " .. L["Shows the current forces percentage including current pull (e.g. 87.84%)"]
.. "\n- :remainingpercentafterpull: " .. L["Shows the remaining percentage of forces to achieve 100% after current pull"],
multiline = false,
width = 2,
hidden = function() return WarpDeplete.db.profile.forcesFormat ~= ":custom:" end,
get = function(info) return WarpDeplete.db.profile.customForcesFormat end,
set = function(info, value)
WarpDeplete.db.profile.customForcesFormat = value
WarpDeplete:UpdateLayout()
end,
},
{
type = "select",
name = L["Current pull text format"],
desc = L["Choose how your current pull count will be displayed"],
sorting = {
"(+:percent:)",
"(+:count:)",
"(+:count: - :percent:)",
":custom:"
},
values = {
["(+:percent:)"] = "(+5.32%)",
["(+:count:)"] = "(+14)",
["(+:count: - :percent:)"] = "(+14 / 5.32%)",
[":custom:"] = L["Custom"],
},
get = function(info) return WarpDeplete.db.profile.currentPullFormat end,
set = function(info, value)
WarpDeplete.db.profile.currentPullFormat = value
WarpDeplete:UpdateLayout()
end
},
lineBreak(function() return WarpDeplete.db.profile.currentPullFormat == ":custom:" end, 2),
{
type = "input",
name = L["Custom current pull text format"],
desc = L["Use the following tags to set your custom format"] .. ":"
.. "\n- :percent: " .. L["Shows the current pull percentage (e.g. 82.52%)"]
.. "\n- :count: " .. L["Shows the current pull count (e.g. 198)"]
.. "\n- :countafterpull: " .. L["Shows the current forces count inluding current pull (e.g. 205)"]
.. "\n- :remainingcountafterpull: " .. L["Shows the remaining amount of forces needed to complete after current pull"]
.. "\n- :percentafterpull: " .. L["Shows the current forces percentage including current pull (e.g. 87.84%)"]
.. "\n- :remainingpercentafterpull: " .. L["Shows the remaining percentage of forces to achieve 100% after current pull"]
.. "\n"
.. "\n" .. L["NOTE: Some of the tags available here overlap with the tags in the forces text."]
.. "\n" .. L["However, this field will be hidden when there is no current pull."],
multiline = false,
width = 2,
hidden = function() return WarpDeplete.db.profile.currentPullFormat ~= ":custom:" end,
get = function(info) return WarpDeplete.db.profile.customCurrentPullFormat end,
set = function(info, value)
WarpDeplete.db.profile.customCurrentPullFormat = value
WarpDeplete:UpdateLayout()
end,
},
{
type = "toggle",
name = L["Show forces percent above 100%"],
desc = L["Show forces percentages exceeding 100% for the above format options"],
get = function(info) return WarpDeplete.db.profile.unclampForcesPercent end,
set = function(info, value)
WarpDeplete.db.profile.unclampForcesPercent = value
WarpDeplete:UpdateDemoModeForces()
end,
width = 3 / 2,
},
}),
group(L["Forces count in tooltip"], true, {
toggle(L["Show forces count in tooltip"], "showTooltipCount", "UpdateLayout", {
desc = L["Add a line to the tooltip, showing how much count a mob will award upon death"]
}),
lineBreak(function() return not WarpDeplete.db.profile.showTooltipCount end, 3),
{
type = "select",
name = L["Tooltip forces text format"],
desc = L["Choose how count will be displayed in the tooltip"],
sorting = {
"+:count: / :percent:",
"+:count:",
"+:percent:",
":custom:"
},
values = {
["+:percent:"] = "+5.32%",
["+:count:"] = "+14",
["+:count: / :percent:"] = "+14 / 5.32%",
[":custom:"] = L["Custom"],
},
hidden = function() return not WarpDeplete.db.profile.showTooltipCount end,
get = function(info) return WarpDeplete.db.profile.tooltipCountFormat end,
set = function(info, value)
WarpDeplete.db.profile.tooltipCountFormat = value
WarpDeplete:UpdateLayout()
end
},
{
type = "input",
name = L["Custom tooltip forces count format"],
desc = L["Use the following tags to set your custom format"] .. ":"
.. "\n- :percent: ".. L["Shows the forces percentage the enemy will award (e.g. 1.4%)"]
.. "\n- :count: ".. L["Shows the count the enemy will award (e.g. 4)"],
multiline = false,
width = 2,
hidden = function()
return WarpDeplete.db.profile.tooltipCountFormat ~= ":custom:" or
not WarpDeplete.db.profile.showTooltipCount
end,
get = function(info) return WarpDeplete.db.profile.customTooltipCountFormat end,
set = function(info, value)
WarpDeplete.db.profile.customTooltipCountFormat = value
WarpDeplete:UpdateLayout()
end,
},
}),
group(L["Forces Glow"], true, {
{
type = "toggle",
name = L["Show Forces Glow"],
desc = L["Show a glow around the forces action bar if the current pull will bring it to 100%"],
get = function(info) return WarpDeplete.db.profile.showForcesGlow end,
set = function(info, value)
WarpDeplete.db.profile.showForcesGlow = value
WarpDeplete:UpdateDemoModeForces()
WarpDeplete:UpdateLayout()
end
},
{
type = "toggle",
name = L["Show in Demo Mode"],
desc = L["Show the forces glow in demo mode"],
hidden = function() return not WarpDeplete.db.profile.showForcesGlow end,
get = function(info) return WarpDeplete.db.profile.demoForcesGlow end,
set = function(info, value)
WarpDeplete.db.profile.demoForcesGlow = value
WarpDeplete:UpdateDemoModeForces()
WarpDeplete:UpdateLayout()
end
},
lineBreak(function() return not WarpDeplete.db.profile.showForcesGlow end, 3),
color(L["Color"], "forcesGlowColor", "UpdateGlowAppearance", {
hidden = function() return not WarpDeplete.db.profile.showForcesGlow end,
width = 1 / 2,
}),
lineBreak(function() return not WarpDeplete.db.profile.showForcesGlow end, 3),
range(L["Line Count"], "forcesGlowLineCount", "UpdateGlowAppearance", {
hidden = function() return not WarpDeplete.db.profile.showForcesGlow end,
min = 1, max = 30, step = 1, width = 5 / 6,
}),
range(L["Line Length"], "forcesGlowLength", "UpdateGlowAppearance", {
hidden = function() return not WarpDeplete.db.profile.showForcesGlow end,
min = 1, max = 10, step = 1, width = 5 / 6,
}),
range(L["Line Thickness"], "forcesGlowThickness", "UpdateGlowAppearance", {
hidden = function() return not WarpDeplete.db.profile.showForcesGlow end,
min = 1, max = 5, step = 0.1, width = 5 / 6,
}),
range(L["Frequency"], "forcesGlowFrequency", "UpdateGlowAppearance", {
hidden = function() return not WarpDeplete.db.profile.showForcesGlow end,
min = 0.05, max = 0.5, step = 0.01, width = 5 / 6,
}),
}),
group(L["Death log tooltip"], true, {
{
type = "toggle",
name = L["Show death log when hovering deaths text"],
desc = L["NOTE: This will only record deaths that happen while you're online. If you disconnect and/or reconnect, this will not show deaths that happened previously."],
get = function(info) return WarpDeplete.db.profile.showDeathsTooltip end,
set = function(info, value) WarpDeplete.db.profile.showDeathsTooltip = value end,
width = 3 / 2,
},
{
type = "select",
name = L["Death log style"],
desc = L["Choose how players deaths will be displayed in the tooltip. Hover the deaths text while in demo mode for a preview."],
sorting = {
"count",
"time"
},
values = {
["count"] = L["Overall amount of deaths by player"],
["time"] = L["Recent deaths with timestamps"]
},
hidden = function() return not WarpDeplete.db.profile.showDeathsTooltip end,
get = function(info) return WarpDeplete.db.profile.deathLogStyle end,
set = function(info, value) WarpDeplete.db.profile.deathLogStyle = value end,
width = 3 / 2
}
}),
-- TODO: Re-enable this when the feature has been re-implemented
-- group(L["Timings"], true, {
-- {
-- type = "toggle",
-- name = L["Enable timings"],
-- desc = L["Enable recording of timestamps at which bosses have been killed"],
-- get = function(info) return WarpDeplete.db.profile.timingsEnabled end,
-- set = function(info, value)
-- WarpDeplete.db.profile.timingsEnabled = value
-- self:UpdateLayout()
-- end,
-- width = 1
-- },
-- {
-- type = "toggle",
-- name = L["Only record completed runs"],
-- desc = L["When active, timestamps are only recorded once the key has been finished"],
-- get = function(info) return WarpDeplete.db.profile.timingsOnlyCompleted end,
-- set = function(info, value) WarpDeplete.db.profile.timingsOnlyCompleted = value end,
-- width = 2
-- }
-- })
}, { order = 3 }),
texts = group(L["Display"], false, {
group(L["General"], true, {
{
type = "select",
name = L["Text Alignment"],
desc = L["Choose the alignment for all texts in the timer window"],
sorting = { "right", "left" },
values = {
["left"] = L["Left"],
["right"] = L["Right"],
},
get = function(info) return WarpDeplete.db.profile.alignTexts end,
set = function(info, value)
WarpDeplete.db.profile.alignTexts = value
WarpDeplete:UpdateLayout()
end
},
{
type = "select",
name = L["Bar Text Alignment"],
desc = L["Choose the alignment for the captions on the timer and forces bars"],
sorting = { "right", "left" },
values = {
["left"] = L["Left"],
["right"] = L["Right"],
},
get = function(info) return WarpDeplete.db.profile.alignBarTexts end,
set = function(info, value)
WarpDeplete.db.profile.alignBarTexts = value
WarpDeplete:UpdateLayout()
end
},
{
type = "select",
name = L["Boss Clear Time Position"],
desc = L["Choose where the clear times for bosses will be displayed"],
sorting = { "start", "end" },
values = {
["start"] = L["Start"],
["end"] = L["End"],
},
get = function(info) return WarpDeplete.db.profile.alignBossClear end,
set = function(info, value)
WarpDeplete.db.profile.alignBossClear = value
WarpDeplete:UpdateObjectivesDisplay()
end
},
lineBreak(),
range(L["Element Padding"], "verticalOffset", "UpdateLayout",
{ min = 0, max = 100, step = 0.01 }),
range(L["Boss Name Padding"], "objectivesOffset", "UpdateLayout",
{ min = 0, max = 100, step = 0.01 }),
range(L["Bar Padding"], "barPadding", "UpdateLayout",
{ min = 0, max = 100, step = 0.01 }),
}),
group(L["Timer Colors"], true, {
color(L["Timer color"], "timerRunningColor", "UpdateLayout"),
color(L["Timer success color"], "timerSuccessColor", "UpdateLayout"),
color(L["Timer expired color"], "timerExpiredColor", "UpdateLayout"),
}, { desc = L["These colors are used for both the main timer, as well as the bar texts."] }),
group(L["Main Timer"], true, {
font(L["Timer font"], "timerFont", "UpdateLayout"),
range(L["Timer font size"], "timerFontSize", "UpdateLayout", { max = 80 }),
fontFlags(L["Timer font flags"], "timerFontFlags", "UpdateLayout"),
}),
group(L["Deaths"], true, {
font(L["Deaths font"], "deathsFont", "UpdateLayout"),
range(L["Deaths font size"], "deathsFontSize", "UpdateLayout"),
fontFlags(L["Deaths font flags"], "deathsFontFlags", "UpdateLayout"),
color(L["Deaths color"], "deathsColor", "UpdateLayout"),
}),
group(L["Key Details"], true, {
font(L["Key font"], "keyFont", "UpdateLayout"),
range(L["Key font size"], "keyFontSize", "UpdateLayout"),
fontFlags(L["Key font flags"], "keyFontFlags", "UpdateLayout"),
color(L["Key color"], "keyColor", "UpdateLayout"),
lineBreak(),
font(L["Key details font"], "keyDetailsFont", "UpdateLayout"),
range(L["Key details font size"], "keyDetailsFontSize", "UpdateLayout"),
fontFlags(L["Key details font flags"], "keyDetailsFontFlags", "UpdateLayout"),
color(L["Key details color"], "keyDetailsColor", "UpdateLayout"),
}),
group(L["Bars"], true, {
range(L["Bar width"], "barWidth", "UpdateLayout",
{ width = "full", min = 10, max = 600 }),
range(L["Bar height"], "barHeight", "UpdateLayout",
{ width = "full", min = 4, max = 50 })
}),
group(L["+1 Timer"], true, {
font(L["+1 Timer font"], "bar1Font", "UpdateLayout"),
range(L["+1 Timer font size"], "bar1FontSize", "UpdateLayout"),
fontFlags(L["+1 Timer font flags"], "bar1FontFlags", "UpdateLayout"),
barTexture(L["+1 Timer bar texture"], "bar1Texture", "UpdateLayout", { width = "double" }),
color(L["+1 Timer bar color"], "bar1TextureColor", "UpdateLayout"),
}),
group(L["+2 Timer"], true, {
font(L["+2 Timer font"], "bar2Font", "UpdateLayout"),
range(L["+2 Timer font size"], "bar2FontSize", "UpdateLayout"),
fontFlags(L["+2 Timer font flags"], "bar2FontFlags", "UpdateLayout"),
barTexture(L["+2 Timer bar texture"], "bar2Texture", "UpdateLayout", { width = "double" }),
color(L["+2 Timer bar color"], "bar2TextureColor", "UpdateLayout") ,
}),
group(L["+3 Timer"], true, {
font(L["+3 Timer font"], "bar3Font", "UpdateLayout"),
range(L["+3 Timer font size"], "bar3FontSize", "UpdateLayout"),
fontFlags(L["+3 Timer font flags"], "bar3FontFlags", "UpdateLayout"),
barTexture(L["+3 Timer bar texture"], "bar3Texture", "UpdateLayout", { width = "double" }),
color(L["+3 Timer bar color"], "bar3TextureColor", "UpdateLayout"),
}),
group(L["Forces"], true, {
font(L["Forces font"], "forcesFont", "UpdateLayout"),
range(L["Forces font size"], "forcesFontSize", "UpdateLayout"),
fontFlags(L["Forces font flags"], "forcesFontFlags", "UpdateLayout"),
color(L["Forces color"], "forcesColor", "UpdateLayout"),
color(L["Completed forces color"], "completedForcesColor", "UpdateLayout"),
lineBreak(),
barTexture(L["Forces bar texture"], "forcesTexture", "UpdateLayout", { width = "double" }),
color(L["Forces bar color"], "forcesTextureColor", "UpdateLayout"),
lineBreak(),
barTexture(L["Current pull bar texture"], "forcesOverlayTexture", "UpdateLayout", { width = "double" }),
color(L["Current pull bar color"], "forcesOverlayTextureColor", "UpdateLayout"),
}),
group(L["Objectives"], true, {
font(L["Objectives font"], "objectivesFont", "UpdateLayout", { width = 3 / 2 }),
fontFlags(L["Objectives font flags"], "objectivesFontFlags", "UpdateLayout", { width = 3 / 2 }),
range(L["Objectives font size"], "objectivesFontSize", "UpdateLayout", { width = 3 / 2 }),
{
type = "select",
name = L["Objectives time difference"],
desc = L["How to display timing differences in the objective display"],
sorting = {
"hidden",
"bestDiff",
"lastDiff"
},
values = {
["hidden"] = L["Hidden"],
["bestDiff"] = L["Difference to best kill time"],
["lastDiff"] = L["Difference to last kill time"]
},
hidden = function() return not WarpDeplete.db.profile.timingsEnabled end,
get = function(info) return WarpDeplete.db.profile.timingsDisplayStyle end,
set = function(info, value)
WarpDeplete.db.profile.timingsDisplayStyle = value
self:UpdateLayout()
end,
width = 3 / 2
},
color(L["Objectives color"], "objectivesColor", "UpdateLayout"),
color(L["Completed objective color"], "completedObjectivesColor", "UpdateLayout"),
color(L["New best objective clear time"], "timingsImprovedTimeColor", "UpdateLayout", {
desc = L["The color to use when you've set a new best objective clear time"]
}),
color(L["Slower objective clear time"], "timingsWorseTimeColor", "UpdateLayout", {
desc = L["The color to use for objective clear times slower than your best time"]
}),
}),
}, { order = 4 }),
}
}
local debugOptions = group("Debug", false, {
{
type = "range",
name = L["Timer limit (Minutes)"],
min = 1,
max = 100,
step = 1,
get = function(info) return math.floor(WarpDeplete.timerState.limit / 60) end,
set = function(info, value) WarpDeplete:SetTimerLimit(value * 60) end
},
{
type = "range",
name = L["Timer current (Minutes)"],
min = -50,
max = 100,
step = 1,
get = function(info) return math.floor(WarpDeplete.timerState.remaining / 60) end,
set = function(info, value) WarpDeplete:SetTimerRemaining(value * 60) end
},
-- {
-- type = "range",
-- name = L["Forces total"],
-- min = 1,
-- max = 500,
-- step = 1,
-- get = function(info) return WarpDeplete.forcesState.totalCount end,
-- set = function(info, value) WarpDeplete:SetForcesTotal(value) end
-- },
{
type = "range",
name = L["Forces pull"],
min = 1,
max = 500,
step = 1,
get = function(info) return WarpDeplete.forcesState.pullCount end,
set = function(info, value) WarpDeplete:SetForcesPull(value) end
},
-- {
-- type = "range",
-- name = L["Forces current"],
-- min = 1,
-- max = 500,
-- step = 1,
-- get = function(info) return WarpDeplete.forcesState.currentCount end,
-- set = function(info, value) WarpDeplete:SetForcesCurrent(value) end
-- }
})
options.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
if self.db.global.DEBUG then options.args.debug = debugOptions end
self.db.RegisterCallback(self, "OnProfileChanged", "OnProfileChanged")
self.db.RegisterCallback(self, "OnProfileCopied", "OnProfileChanged")
self.db.RegisterCallback(self, "OnProfileReset", "OnProfileChanged")
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
LibStub("AceConfig-3.0"):RegisterOptionsTable("WarpDeplete", options)
self.optionsGeneralFrame = AceConfigDialog:AddToBlizOptions("WarpDeplete", "WarpDeplete")
self.configDialog = AceConfigDialog
end
function WarpDeplete:InitChatCommands()
self:RegisterChatCommand("wdp", "HandleChatCommand")
self:RegisterChatCommand("warp", "HandleChatCommand")
self:RegisterChatCommand("warpdeplete", "HandleChatCommand")
self:RegisterChatCommand("WarpDeplete", "HandleChatCommand")
end
function WarpDeplete:HandleChatCommand(input)
local cmd = string.lower(input)
if cmd == "timerstatus" then
self:PrintDebug("Offset: " .. self.timerState.startOffset .. ", " .. WarpDeplete.Util.formatTime(self.timerState.startOffset))
self:PrintDebug("Start time: " .. self.timerState.startTime)
self:PrintDebug("Deaths: " .. self.timerState.deaths)
local deathPenalty = self.timerState.deaths * 5
local current = GetTime() - self.timerState.startTime
local currentWithOffset = current + self.timerState.startOffset
self:PrintDebug("Current: " .. current .. ", " .. WarpDeplete.Util.formatTime(current))
self:PrintDebug("Current With Offset: " .. currentWithOffset .. ", " .. WarpDeplete.Util.formatTime(currentWithOffset))
local blizzardCurrent = select(2, GetWorldElapsedTime(1))
self:PrintDebug("Blizzard Current: " .. blizzardCurrent .. ", " .. WarpDeplete.Util.formatTime(blizzardCurrent))
local blizzardCurrentWODeaths = blizzardCurrent - deathPenalty
self:PrintDebug("Blizzard Current w/o deaths: " .. blizzardCurrentWODeaths .. ", " .. WarpDeplete.Util.formatTime(blizzardCurrentWODeaths))
self:PrintDebug("isBlizzardTimer: " .. tostring(self.timerState.isBlizzardTimer))
return
end
if cmd == "toggle" then
self:SetUnlocked(not self.isUnlocked)
return
end
if cmd == "unlock" then
self:SetUnlocked(true)
return
end
if cmd == "lock" then
self:SetUnlocked(false)
return
end
if cmd == "demo" then
if self.challengeState.demoModeActive then self:DisableDemoMode()
else self:EnableDemoMode() end
return
end
if cmd == "debug" then
self.db.global.DEBUG = not self.db.global.DEBUG
if self.db.global.DEBUG then
self:Print("|cFF479AEDDEBUG|r Debug mode enabled")
else
self:Print("|cFF479AEDDEBUG|r Debug mode disabled")
end
return
end
Settings.OpenToCategory("WarpDeplete")
end
function WarpDeplete.SetUnlocked(info, value)
local self = WarpDeplete
if value == self.isUnlocked then return end
self.isUnlocked = value
self.frames.root.texture:SetColorTexture(0, 0, 0, self.isUnlocked and 0.3 or 0)
self.frames.root:SetMovable(self.isUnlocked)
self.frames.root:EnableMouse(self.isUnlocked)
end
function WarpDeplete:OnProfileChanged()
self:UpdateLayout()
self:UpdateForcesDisplay()
self:UpdateTimerDisplay()
self:UpdateObjectivesDisplay()
end