-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathOptions.lua
4657 lines (4074 loc) · 170 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
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
---------------
-- LIBRARIES --
---------------
local LibCamera = LibStub("LibCamera-1.0")
local L = LibStub("AceLocale-3.0"):GetLocale("DynamicCam")
-------------
-- GLOBALS --
-------------
assert(DynamicCam)
DynamicCam.Options = DynamicCam:NewModule("Options", "AceEvent-3.0")
DynamicCam.cameraDistanceMaxZoomFactor_max = 39
if WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE then
DynamicCam.cameraDistanceMaxZoomFactor_max = 50
end
------------
-- LOCALS --
------------
local function Round(num, numDecimalPlaces)
local mult = 10^(numDecimalPlaces or 0)
return math.floor(num * mult + 0.5) / mult
end
local Options = DynamicCam.Options
local _
-- To store the currently selected situation and situation ID.
local S, SID, lastSelectedSID
local copiedSituationID
local exportName, exportAuthor
-- Checking if "situation controls" settings deviate from the stock settings.
function DynamicCam:ScriptEqual(customScript, defaultScript)
if (customScript == "" and defaultScript == nil) or customScript == defaultScript then return true end
end
function DynamicCam:EventsEqual(customEvents, defaultEvents)
local customEventsCheck = {}
local defaultEventsCheck = {}
for k, v in pairs(customEvents) do
customEventsCheck[v] = true
end
for k, v in pairs(defaultEvents) do
if not customEventsCheck[v] then
return false
end
defaultEventsCheck[v] = true
end
for k, v in pairs(customEvents) do
if not defaultEventsCheck[v] then
return false
end
end
return true
end
local function EventsIsDefault(situationID)
if not DynamicCam.defaults.profile.situations[situationID] then return true end
return DynamicCam:EventsEqual(DynamicCam.db.profile.situations[situationID].events, DynamicCam.defaults.profile.situations[situationID].events)
end
local function ScriptIsDefault(situationID, scriptName)
if not DynamicCam.defaults.profile.situations[situationID] then return true end
return DynamicCam:ScriptEqual(DynamicCam.db.profile.situations[situationID][scriptName], DynamicCam.defaults.profile.situations[situationID][scriptName])
end
local function ValueIsDefault(situationID, valueName)
if not DynamicCam.defaults.profile.situations[situationID] then return true end
return DynamicCam.db.profile.situations[situationID][valueName] == DynamicCam.defaults.profile.situations[situationID][valueName]
end
local function SituationControlsAreDefault(situationID)
if ValueIsDefault(situationID, "priority") and
EventsIsDefault(situationID) and
ScriptIsDefault(situationID, "executeOnInit") and
ScriptIsDefault(situationID, "condition") and
ScriptIsDefault(situationID, "executeOnEnter") and
ScriptIsDefault(situationID, "executeOnExit") and
ValueIsDefault(situationID, "delay") then
return true
else
return false
end
end
local function SituationControlsToDefault(situationID)
local targetSituation = DynamicCam.db.profile.situations[situationID]
local defaultSituation = DynamicCam.defaults.profile.situations[situationID]
targetSituation.priority = defaultSituation.priority
targetSituation.events = defaultSituation.events
targetSituation.executeOnInit = defaultSituation.executeOnInit
targetSituation.condition = defaultSituation.condition
targetSituation.executeOnEnter = defaultSituation.executeOnEnter
targetSituation.executeOnExit = defaultSituation.executeOnExit
targetSituation.delay = defaultSituation.delay
DynamicCam:UpdateSituation(situationID)
end
local function ColourTextErrorOrModified(text, dataType, dataId)
-- Do we have an error at all, and is it an error for this script.
-- (dataId is left empty to colour the "Situation Controls" tab text.)
if S.errorEncountered and (not dataId or dataId == S.errorEncountered) then
return "|cFFEE0000".. text .. "|r"
-- Check if the given data is default. Different checking methods based on dataType.
else
if (not dataId and not SituationControlsAreDefault(SID))
or (dataType == "value" and not ValueIsDefault(SID, dataId))
or (dataType == "events" and not EventsIsDefault(SID))
or (dataType == "script" and not ScriptIsDefault(SID, dataId)) then
return "|cFFFF6600" .. text .. "|r"
else
return text
end
end
end
-- A function to get all views used by all situations.
local function GetUsedViews()
local usedViews = {}
local usedDefaultViews = {}
-- Go through all situations.
for id, situation in pairs(DynamicCam.db.profile.situations) do
if situation.enabled and not situation.errorEncountered then
-- Shortcut variable.
local sc = situation.viewZoom
if sc.enabled and sc.viewZoomType == "view" then
if not usedViews[sc.viewNumber] then
usedViews[sc.viewNumber] = {}
end
-- Store the id of the situation using this view.
usedViews[sc.viewNumber][id] = true
if not usedDefaultViews[sc.def] then
usedDefaultViews[sc.restoreDefaultViewNumber] = {}
end
-- Store the id of the situation using this view.
usedDefaultViews[sc.restoreDefaultViewNumber][id] = true
end
end
end
return usedViews, usedDefaultViews
end
-- We want to use the same CreateSettingsTab() function for the
-- standard settings and situation settings. Hence we need this function
-- to return the appropriate table.
function DynamicCam:GetSettingsTable(situationId)
if situationId then
return self.db.profile.situations[situationId].situationSettings
else
return self.db.profile.standardSettings
end
end
-- For the get functions of the options: if a situation has no setting,
-- we want to show the standard value.
function DynamicCam:GetSettingsValue(situationId, index1, index2)
-- Is this a request for a standard or situation setting?
local settingsTable = self:GetSettingsTable(situationId)
-- Is this a request for the cvars sub table?
if index1 == "cvars" and index2 then
-- Is there a user setting?
if settingsTable.cvars[index2] ~= nil then
return settingsTable.cvars[index2]
-- If there is none, this must have been an unset situation setting,
-- so we are returning the standard setting.
else
return self.db.profile.standardSettings.cvars[index2]
end
else
if settingsTable[index1] ~= nil then
return settingsTable[index1]
else
return self.db.profile.standardSettings[index1]
end
end
end
function DynamicCam:GetSettingsDefault(index1, index2)
-- Is this a request for the cvars sub table?
if index1 == "cvars" and index2 then
return self.defaults.profile.standardSettings.cvars[index2]
else
return self.defaults.profile.standardSettings[index1]
end
end
function DynamicCam:SetSettingsValue(newValue, situationId, index1, index2)
-- Is this a request for a standard or situation setting?
local settingsTable = self:GetSettingsTable(situationId)
-- Is this a request for the cvars sub table?
if index1 == "cvars" and index2 then
settingsTable.cvars[index2] = newValue
else
settingsTable[index1] = newValue
end
self:ApplySettings()
end
function DynamicCam:SetSettingsDefault(situationId, index1, index2)
-- Is this a request for a standard or situation setting?
local settingsTable = self:GetSettingsTable(situationId)
-- Is this a request for the cvars sub table?
if index1 == "cvars" and index2 then
settingsTable.cvars[index2] = self.defaults.profile.standardSettings.cvars[index2]
else
settingsTable[index1] = self.defaults.profile.standardSettings[index1]
end
self:ApplySettings()
end
function DynamicCam:SettingsPanelSetIgnoreParentAlpha(ignoreParentAlpha)
GameMenuFrame:SetIgnoreParentAlpha(ignoreParentAlpha)
SettingsPanel:SetIgnoreParentAlpha(ignoreParentAlpha)
for i = 1, LibStub("AceGUI-3.0"):GetNextWidgetNum("Dropdown-Pullout") do
if _G["AceGUI30Pullout" .. i] then _G["AceGUI30Pullout" .. i]:SetIgnoreParentAlpha(ignoreParentAlpha) end
end
end
-- We need this to disable a reset button when its parent group is disabled.
-- Thanks to vrul!
-- https://www.wowinterface.com/forums/showthread.php?p=338116#post338116
local function GetInheritedDisabledStatus(info)
local option, options = info.options, { }
local disabled = option.disabled
for index = 1, #info - 1 do
option = option.args[info[index]]
options[index] = option
end
for index = #options, 1, -1 do
if options[index].disabled ~= nil then
disabled = options[index].disabled
break
end
end
if type(disabled) == "function" then
disabled = disabled()
end
return disabled
end
local resetButtonImageCoords = {0.58203125, 0.64453125, 0.30078125, 0.36328125}
if WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE then
resetButtonImageCoords = {0.533203125, 0.58203125, 0.248046875, 0.294921875}
end
local function CreateSliderResetButton(order, forSituations, index1, index2, tooltipDefaultValue)
-- We allow to pass the tooltipDefaultValue as an extra argument, because for some
-- settings the slider value is a transformation of the cvar.
if tooltipDefaultValue == nil then
tooltipDefaultValue = DynamicCam:GetSettingsDefault(index1, index2)
end
return {
type = "execute",
-- -- You could also take the icon in the name, but this is not clickable.
-- name = CreateAtlasMarkup("transmog-icon-revert-small", 20, 20),
name = L["Reset"],
image = "Interface\\Transmogrify\\Transmogrify",
imageCoords = resetButtonImageCoords,
imageWidth = 25/1.5,
imageHeight = 24/1.5,
desc = L["Reset to global default:"] .. " " .. tooltipDefaultValue .. "\n" .. L["(To restore the settings of a specific profile, restore the profile in the \"Profiles\" tab.)"],
order = order,
width = 0.25,
func =
function()
DynamicCam:SetSettingsDefault(forSituations and SID, index1, index2)
end,
disabled =
function(info)
return GetInheritedDisabledStatus(info) or (DynamicCam:GetSettingsValue(forSituations and SID, index1, index2) == DynamicCam:GetSettingsDefault(index1, index2))
end,
}
end
local zoomGroupVars = {
{"cvars", "cameraDistanceMaxZoomFactor"},
{"cvars", "cameraZoomSpeed"},
{"reactiveZoomAddIncrementsAlways"},
{"reactiveZoomEnabled"},
{"reactiveZoomAddIncrements"},
{"reactiveZoomIncAddDifference"},
{"reactiveZoomMaxZoomTime"},
}
local mouseLookGroupVars = {
{"cvars", "cameraYawMoveSpeed"},
{"cvars", "cameraPitchMoveSpeed"},
}
local shoulderOffsetGroupVars = {
{"cvars", "test_cameraOverShoulder"},
{"shoulderOffsetZoomEnabled"},
{"shoulderOffsetZoomLowerBound"},
{"shoulderOffsetZoomUpperBound"},
}
local pitchGroupVars = {
{"cvars", "test_cameraDynamicPitch"},
{"cvars", "test_cameraDynamicPitchBaseFovPad"},
{"cvars", "test_cameraDynamicPitchBaseFovPadFlying"},
{"cvars", "test_cameraDynamicPitchBaseFovPadDownScale"},
{"cvars", "test_cameraDynamicPitchSmartPivotCutoffDist"},
}
local targetFocusGroupVars = {
{"cvars", "test_cameraTargetFocusEnemyEnable"},
{"cvars", "test_cameraTargetFocusEnemyStrengthYaw"},
{"cvars", "test_cameraTargetFocusEnemyStrengthPitch"},
{"cvars", "test_cameraTargetFocusInteractEnable"},
{"cvars", "test_cameraTargetFocusInteractStrengthYaw"},
{"cvars", "test_cameraTargetFocusInteractStrengthPitch"},
}
local headTrackingGroupVars = {
{"cvars", "test_cameraHeadMovementStrength"},
{"cvars", "test_cameraHeadMovementStandingStrength"},
{"cvars", "test_cameraHeadMovementStandingDampRate"},
{"cvars", "test_cameraHeadMovementMovingStrength"},
{"cvars", "test_cameraHeadMovementMovingDampRate"},
{"cvars", "test_cameraHeadMovementFirstPersonDampRate"},
{"cvars", "test_cameraHeadMovementRangeScale"},
{"cvars", "test_cameraHeadMovementDeadZone"},
}
-- Check if any of the group variables are set.
local function CheckGroupVars(groupVarsTable, situationId)
if not situationId then
situationId = SID
end
for k, v in pairs(groupVarsTable) do
local index1, index2 = unpack(v)
local situationSettingsTable = DynamicCam.db.profile.situations[situationId].situationSettings
if index1 == "cvars" and index2 then
-- Is there a user setting?
if situationSettingsTable.cvars[index2] ~= nil then
return true
end
else
if situationSettingsTable[index1] ~= nil then
return true
end
end
end
return false
end
-- Clear all group variables.
local function SetGroupVars(groupVarsTable, override)
for k, v in pairs(groupVarsTable) do
local index1, index2 = unpack(v)
local situationSettingsTable = DynamicCam.db.profile.situations[SID].situationSettings
local standardSettingsTable = DynamicCam.db.profile.standardSettings
if index1 == "cvars" and index2 then
if override then
situationSettingsTable.cvars[index2] = standardSettingsTable.cvars[index2]
else
situationSettingsTable.cvars[index2] = nil
end
else
if override then
situationSettingsTable[index1] = standardSettingsTable[index1]
else
situationSettingsTable[index1] = nil
end
end
end
DynamicCam:ApplySettings()
end
local function GreyWhenInactive(name, enabled)
if not enabled then
return "|cff909090"..name.."|r"
end
return name
end
local function ColoredNames(name, groupVarsTable, forSituations)
if not forSituations then
if DynamicCam.currentSituationID and CheckGroupVars(groupVarsTable, DynamicCam.currentSituationID) then
return "|cFF00FF00"..name.."|r"
end
else
if not CheckGroupVars(groupVarsTable) then
return "|cff909090"..name.."|r"
end
end
return name
end
local function CreateOverriddenText(groupVarsTable, forSituations)
return {
type = "description",
name =
function()
if DynamicCam.currentSituationID and CheckGroupVars(groupVarsTable, DynamicCam.currentSituationID) then
return "|cFF00FF00" .. L["Currently overridden by the active situation \""] .. DynamicCam.db.profile.situations[DynamicCam.currentSituationID].name .. "\".|r\n"
end
end,
order = 0,
hidden =
function()
return forSituations
end,
}
end
local function CreateOverrideStandardToggle(groupVarsTable, forSituations)
return {
type = "toggle",
name = L["Override Standard Settings"],
desc = L["<overrideStandardToggle_desc>"],
order = 0,
width = "full",
hidden =
function()
return not forSituations
end,
get =
function()
return CheckGroupVars(groupVarsTable)
end,
set =
function(_, newValue)
SetGroupVars(groupVarsTable, newValue)
end,
}
end
local function ApplyContinuousRotation()
if SID == DynamicCam.currentSituationID then
LibCamera:StopRotating()
if S.rotation.enabled and S.rotation.rotationType == "continuous" then
LibCamera:BeginContinuousYaw(S.rotation.rotationSpeed, 0)
end
end
end
local function ApplyUIFade()
if SID == DynamicCam.currentSituationID then
DynamicCam:FadeInUI(0)
if S.hideUI.enabled then
DynamicCam:FadeOutUI(0, S.hideUI)
end
end
end
local function GetSituationList()
local situationList = {}
for id, situation in pairs(DynamicCam.db.profile.situations) do
if not situation.name or not situation.priority then
DynamicCam.db.profile.situations[id] = nil
-- print("Purging situation", id)
else
local prefix = ""
local suffix = ""
local customPrefix = ""
local modifiedSuffix = ""
if situation.errorEncountered then
prefix = "|cFFEE0000"
suffix = "|r"
elseif DynamicCam.currentSituationID == id then
prefix = "|cFF00FF00"
suffix = "|r"
elseif not situation.enabled then
prefix = "|cFF808A87"
suffix = "|r"
elseif DynamicCam.conditionExecutionCache[id] then
prefix = "|cFF63B8FF"
suffix = "|r"
end
if string.find(id, "custom") then
customPrefix = L["Custom:"] .. " "
end
if not SituationControlsAreDefault(id) then
modifiedSuffix = "|cFFFF6600 " .. L["(modified)"] .. "|r"
end
-- print(id, situation.name)
situationList[id] = prefix .. customPrefix .. situation.name .. " [" .. L["Priority:"] .. " " .. situation.priority .. "]" .. suffix .. modifiedSuffix
end
end
return situationList
end
local function CreateSettingsTab(tabOrder, forSituations)
-- For the situation settings the area is a little smaller.
local sliderWidth = 1.9
if forSituations then
sliderWidth = 1.75
end
return {
type = "group",
name =
function()
if not forSituations then return L["Standard Settings"]
else return L["Situation Settings"] end
end,
order = tabOrder,
args = {
help = {
type = "description",
name =
function()
local text = ""
if not forSituations then
text = L["<standardSettings_desc>"]
if DynamicCam.currentSituationID then
text = text .. " |cFF00FF00" .. L["<standardSettingsOverridden_desc>"] .. "|r"
end
else
text = L["These Situation Settings can override the Standard Settings when the respective situation is active."]
end
return text .. "\n\n"
end,
order = 0,
},
zoomGroup = {
type = "group",
name =
function()
return ColoredNames(L["Mouse Zoom"], zoomGroupVars, forSituations)
end,
order = 1,
args = {
overriddenText = CreateOverriddenText(zoomGroupVars, forSituations),
overrideStandardToggle = CreateOverrideStandardToggle(zoomGroupVars, forSituations),
blank0 = {type = "description", name = " ", order = 0.1, hidden = function() return not forSituations end, },
zoomSubGroup = {
type = "group",
name = "",
order = 1,
inline = true,
disabled =
function()
return forSituations and not CheckGroupVars(zoomGroupVars)
end,
args = {
cameraDistanceMaxFactor = {
type = "range",
name = L["Maximum Camera Distance"],
desc = L["How many yards the camera can zoom away from your character."] .. "\n|cff909090cvar: cameraDistanceMaxZoomFactor|r",
order = 1,
width = sliderWidth,
min = 15,
max = DynamicCam.cameraDistanceMaxZoomFactor_max,
step = 0.5,
get =
function()
return DynamicCam:GetSettingsValue(forSituations and SID, "cvars", "cameraDistanceMaxZoomFactor") * 15
end,
set =
function(_, newValue)
DynamicCam:SetSettingsValue(newValue/15, forSituations and SID, "cvars", "cameraDistanceMaxZoomFactor")
end,
},
cameraDistanceMaxFactorReset =
CreateSliderResetButton(1.1, forSituations, "cvars", "cameraDistanceMaxZoomFactor",
DynamicCam:GetSettingsDefault("cvars", "cameraDistanceMaxZoomFactor") * 15),
blank1 = {type = "description", name = " ", order = 1.2, },
cameraZoomSpeed = {
type = "range",
name = L["Camera Zoom Speed"],
desc = L["How fast the camera can zoom."] .. "\n|cff909090cvar: cameraZoomSpeed|r",
order = 2,
width = sliderWidth,
min = 1,
max = 50,
step = 0.5,
get =
function()
return DynamicCam:GetSettingsValue(forSituations and SID, "cvars", "cameraZoomSpeed")
end,
set =
function(_, newValue)
DynamicCam:SetSettingsValue(newValue, forSituations and SID, "cvars", "cameraZoomSpeed")
end,
},
cameraZoomSpeedReset =
CreateSliderResetButton(2.1, forSituations, "cvars", "cameraZoomSpeed"),
blank2 = {type = "description", name = " ", order = 2.2, },
addIncrementsAlways = {
type = "range",
name = L["Zoom Increments"],
desc = L["How many yards the camera should travel for each \"tick\" of the mouse wheel."],
order = 3,
width = sliderWidth,
min = 0.05,
max = 10,
step = 0.05,
get =
function()
return DynamicCam:GetSettingsValue(forSituations and SID, "reactiveZoomAddIncrementsAlways") + 1
end,
set =
function(_, newValue)
DynamicCam:SetSettingsValue(newValue - 1, forSituations and SID, "reactiveZoomAddIncrementsAlways")
end,
},
addIncrementsAlwaysReset =
CreateSliderResetButton(3.1, forSituations, "reactiveZoomAddIncrementsAlways", nil,
DynamicCam:GetSettingsDefault("reactiveZoomAddIncrementsAlways") + 1),
blank3 = {type = "description", name = "\n\n", order = 3.2, },
reactiveZoomToggle = {
type = "toggle",
name = L["Use Reactive Zoom"],
order = 4,
get =
function()
return DynamicCam:GetSettingsValue(forSituations and SID, "reactiveZoomEnabled")
end,
set =
function(_, newValue)
DynamicCam:SetSettingsValue(newValue, forSituations and SID, "reactiveZoomEnabled")
end,
},
reactiveZoomGroup = {
type = "group",
name = "",
disabled =
function()
return not DynamicCam:GetSettingsValue(forSituations and SID, "reactiveZoomEnabled")
or (forSituations and not CheckGroupVars(zoomGroupVars))
end,
order = 5,
args = {
addIncrements = {
type = "range",
name = L["Quick-Zoom Additional Increments"],
desc = L["How many yards per mouse wheel tick should be added when quick-zooming."],
order = 1,
width = sliderWidth,
min = 0,
max = 10,
step = 0.1,
get =
function()
return DynamicCam:GetSettingsValue(forSituations and SID, "reactiveZoomAddIncrements")
end,
set =
function(_, newValue)
DynamicCam:SetSettingsValue(newValue, forSituations and SID, "reactiveZoomAddIncrements")
end,
},
addIncrementsReset =
CreateSliderResetButton(1.1, forSituations, "reactiveZoomAddIncrements"),
blank1 = {type = "description", name = " ", order = 1.2, },
incAddDifference = {
type = "range",
name = L["Quick-Zoom Enter Threshold"],
desc = L["How many yards the \"Reactive Zoom Target\" and the \"Actual Zoom Value\" have to be apart to enter quick-zooming."],
order = 2,
width = sliderWidth,
min = 0.1,
max = 5,
step = 0.1,
get =
function()
return DynamicCam:GetSettingsValue(forSituations and SID, "reactiveZoomIncAddDifference")
end,
set =
function(_, newValue)
DynamicCam:SetSettingsValue(newValue, forSituations and SID, "reactiveZoomIncAddDifference")
end,
},
incAddDifferenceReset =
CreateSliderResetButton(2.1, forSituations, "reactiveZoomIncAddDifference"),
blank2 = {type = "description", name = " ", order = 2.2, },
maxZoomTime = {
type = "range",
name = L["Maximum Zoom Time"],
desc = L["The maximum time the camera should take to make \"Actual Zoom Value\" equal to \"Reactive Zoom Target\"."],
order = 3,
width = sliderWidth,
min = 0.1,
max = 5,
step = 0.05,
get =
function()
return DynamicCam:GetSettingsValue(forSituations and SID, "reactiveZoomMaxZoomTime")
end,
set =
function(_, newValue)
DynamicCam:SetSettingsValue(newValue, forSituations and SID, "reactiveZoomMaxZoomTime")
end,
},
maxZoomTimeReset = CreateSliderResetButton(3.1, forSituations, "reactiveZoomMaxZoomTime"),
blank3 = {type = "description", name = "\n\n", order = 3.2, },
},
},
},
},
reactiveZoomDescriptionGroup = {
type = "group",
name = L["Help"],
order = 6,
inline = true,
args = {
toggleVisualAid = {
type = "execute",
name = L["Toggle Visual Aid"],
func = function() DynamicCam:ToggleRZVA() end,
order = 1,
width = "full",
},
blank1 = {type = "description", name = " ", order = 1.1, },
reactiveZoomDescription = {
type = "description",
name = L["<reactiveZoom_desc>"],
order = 2,
},
blank2 = {type = "description", name = "\n\n", order = 2.1, },
enhancedMinZoom = {
type = "toggle",
name = L["Enhanced minimal zoom-in"],
desc = L["<enhancedMinZoom_desc>"],
order = 3,
width = "full",
get =
function()
return DynamicCam.db.profile.reactiveZoomEnhancedMinZoom
end,
set =
function(_, newValue)
DynamicCam.db.profile.reactiveZoomEnhancedMinZoom = newValue
end,
},
reloadMessage = {
type = "description",
name = "|cFFFF0000" .. L["/reload of the UI required!"] .. "|r",
hidden =
function()
return DynamicCam.modelFrame and DynamicCam.db.profile.reactiveZoomEnhancedMinZoom or not DynamicCam.modelFrame and not DynamicCam.db.profile.reactiveZoomEnhancedMinZoom
end,
order = 4,
},
blank4 = {
type = "description",
name = " ",
hidden =
function()
return not DynamicCam.modelFrame and DynamicCam.db.profile.reactiveZoomEnhancedMinZoom or DynamicCam.modelFrame and not DynamicCam.db.profile.reactiveZoomEnhancedMinZoom
end,
order = 4, },
},
},
},
}, -- /zoomGroup
mouseLookGroup = {
type = "group",
name =
function()
return ColoredNames(L["Mouse Look"], mouseLookGroupVars, forSituations)
end,
order = 2,
args = {
overriddenText = CreateOverriddenText(mouseLookGroupVars, forSituations),
overrideStandardToggle = CreateOverrideStandardToggle(mouseLookGroupVars, forSituations),
blank0 = {type = "description", name = " ", order = 0.1, hidden = function() return not forSituations end, },
mouseLookSubGroup = {
type = "group",
name = "",
order = 1,
inline = true,
disabled =
function()
return forSituations and not CheckGroupVars(mouseLookGroupVars)
end,
args = {
cameraYawMoveSpeed = {
type = "range",
name = L["Horizontal Speed"],
desc = L["How much the camera yaws horizontally when in mouse look mode."] .. "\n|cff909090cvar: cameraYawMoveSpeed|r",
order = 1,
width = sliderWidth + 0.1,
min = 1,
max = 360,
step = 1,
get =
function()
return DynamicCam:GetSettingsValue(forSituations and SID, "cvars", "cameraYawMoveSpeed")
end,
set =
function(_, newValue)
DynamicCam:SetSettingsValue(newValue, forSituations and SID, "cvars", "cameraYawMoveSpeed")
end,
},
cameraYawMoveSpeedReset =
CreateSliderResetButton(1.1, forSituations, "cvars", "cameraYawMoveSpeed"),
blank1 = {type = "description", name = " ", order = 1.2, },
cameraPitchMoveSpeed = {
type = "range",
name = L["Vertical Speed"],
desc = L["How much the camera pitches vertically when in mouse look mode."] .. "\n|cff909090cvar: cameraPitchMoveSpeed|r",
order = 2,
width = sliderWidth + 0.1,
min = 1,
max = 360,
step = 1,
get =
function()
return DynamicCam:GetSettingsValue(forSituations and SID, "cvars", "cameraPitchMoveSpeed")
end,
set =
function(_, newValue)
DynamicCam:SetSettingsValue(newValue, forSituations and SID, "cvars", "cameraPitchMoveSpeed")
end,
},
cameraPitchMoveSpeedReset =
CreateSliderResetButton(2.1, forSituations, "cvars", "cameraPitchMoveSpeed"),
blank2 = {type = "description", name = "\n\n", order = 2.2, },
mouseLookDescriptionGroup = {
type = "group",
name = L["Help"],
order = 3,
args = {
mouseLookDescription = {
type = "description",
name = L["<mouseLook_desc>"],
},
},
},
},
},
},
}, -- /mouseLookGroup
shoulderOffsetGroup = {
type = "group",
name =
function()
return ColoredNames(L["Horizontal Offset"], shoulderOffsetGroupVars, forSituations)
end,
order = 3,
args = {
overriddenText = CreateOverriddenText(shoulderOffsetGroupVars, forSituations),
overrideStandardToggle = CreateOverrideStandardToggle(shoulderOffsetGroupVars, forSituations),
blank0 = {type = "description", name = " ", order = 0.1, hidden = function() return not forSituations end, },
shoulderOffsetSubGroup = {
type = "group",
name = "",
order = 1,
inline = true,
disabled =
function()
return forSituations and not CheckGroupVars(shoulderOffsetGroupVars)
end,
args = {
cameraOverShoulderGroup = {
type = "group",
name = L["Camera Over Shoulder Offset"],
order = 1,
args = {
cameraOverShoulderDescription = {
type = "description",
name = L["Positions the camera left or right from your character."] .. "\n|cff909090cvar: test_cameraOverShoulder|r\n\n" .. L["<cameraOverShoulder_desc>"],
order = 0,
},
cameraOverShoulder = {
type = "range",
name = "",
order = 1,
width = sliderWidth - 0.15,
min = -15,
max = 15,
step = 0.1,
get =
function()
return DynamicCam:GetSettingsValue(forSituations and SID, "cvars", "test_cameraOverShoulder")
end,
set =
function(_, newValue)
DynamicCam:SetSettingsValue(newValue, forSituations and SID, "cvars", "test_cameraOverShoulder")