-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.lua
More file actions
1702 lines (1474 loc) · 62.3 KB
/
Copy pathoptions.lua
File metadata and controls
1702 lines (1474 loc) · 62.3 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 folderName, addon = ...
LibStub("AceAddon-3.0"):NewAddon(addon, folderName)
local L = LibStub("AceLocale-3.0"):GetLocale(folderName, true)
if not L then
L = {}
setmetatable(L, {__index = function(t, k) return k end})
end
-- For the options menu.
local appName = "Ludius Plus"
-- ##############################################################################
-- ### Modules that require dangerous scripts (macro execution)
-- ### Add any future modules that need macros here.
-- ##############################################################################
local MODULES_REQUIRING_SCRIPTS = {
"dismountToggle_enabled",
"flashlight_enabled",
}
-- Track if we've already shown the dangerous scripts warning this session.
local dangerousScriptsWarningShown = false
-- Function to check if any modules requiring scripts are enabled
-- and show warning if dangerous scripts are not allowed
function addon.CheckDangerousScriptsOnStartup()
if dangerousScriptsWarningShown or AreDangerousScriptsAllowed() then
return
end
-- Check if any modules requiring scripts are enabled.
for _, configKey in ipairs(MODULES_REQUIRING_SCRIPTS) do
if LP_config[configKey] then
dangerousScriptsWarningShown = true
C_Timer.After(1, function()
StaticPopup_Show("LUDIUSPLUS_DANGEROUS_SCRIPTS_WARNING")
end)
break
end
end
end
-- A local variable for saved variable LP_config for easier access.
local config
local CONFIG_DEFAULTS = {
dialogSkipper_enabled = false,
dialogSkipper_skipAuction = true,
dialogSkipper_auctionBackButton = true,
dialogSkipper_auctionPriceLimit = 10000000,
dialogSkipper_skipPetCharm = true,
dialogSkipper_skipOrderResources = true,
dialogSkipper_skipDragonIslesSupplies = true,
dialogSkipper_skipCommunityCoupons = true,
dialogSkipper_skipEquipBind = true,
dismountToggle_enabled = false,
dismountToggle_travelFormEnabled = false,
dismountToggle_soarEnabled = false,
dismountToggle_changeActionBarTo = "disabled",
dismountToggle_ignoredMounts = "",
dismountToggle_ignoredMountAutoMount = false,
raceOnLastMount_enabled = false,
persistentCompanion_enabled = false,
persistentCompanion_dismissWhileStealthed = false,
persistentCompanion_dismissInCombat = false,
persistentCompanion_muteSummonSound = false,
persistentUnsheath_autoSheath = false,
persistentUnsheath_autoUnsheath = false,
persistentUnsheath_muteToggleSounds = true,
muteSounds_enabled = false,
muteSounds_soundIds = "598079, 598187",
vendorItemOverlay_enabled = false,
vendorItemOverlay_toys_enabled = false,
vendorItemOverlay_mounts_enabled = false,
vendorItemOverlay_transmog_enabled = false,
vendorItemOverlay_transmog_non_appearance_known = true,
vendorItemOverlay_pets_enabled = false,
vendorItemOverlay_recipes_enabled = false,
spellIconOverlay_showInSpellbook = false,
spellIconOverlay_showOnActionBars = false,
spellIconOverlay_onlyWhenAssistUsed = false,
spellIconOverlay_spellbookPosition = "BOTTOMLEFT",
spellIconOverlay_actionBarPosition = "BOTTOMLEFT",
flashlight_enabled = false,
houseEditorEnhancer_iconResizerSlider = false,
houseEditorEnhancer_iconResizerCtrlWheel = false,
houseEditorEnhancer_iconResizerSize = 1.0,
houseEditorEnhancer_preview = false,
houseEditorEnhancer_previewWidth = 540,
houseEditorEnhancer_chainPlacement = false,
houseEditorEnhancer_recent = false,
-- Saved-variable migration bookkeeping (not a user-facing setting): the config
-- version this user has been migrated up to (see ApplyConfigMigrations). Kept
-- in CONFIG_DEFAULTS so it survives the unknown-key cleanup in OnInitialize.
migrationVersion = 0,
}
local currentlyEditedCommand = nil
local keyPressFrame = CreateFrame("Frame")
local KeyPressedFunction = function(self, key)
if key == "ESCAPE" then
StaticPopup_Hide("LUDIUSPLUS_KEYBIND_PROMPT")
return
end
if key == "LCTRL" or key == "RCTRL" or key == "LALT" or key == "RALT" or key == "LSHIFT" or key == "RSHIFT" then
return
end
if IsShiftKeyDown() then
key = "SHIFT-" .. key
end
if IsControlKeyDown() then
key = "CTRL-" .. key
end
if IsAltKeyDown() then
key = "ALT-" .. key
end
-- Check last key bind.
local lastKey = GetBindingKey(currentlyEditedCommand)
if lastKey and lastKey == key then
StaticPopup_Hide("LUDIUSPLUS_KEYBIND_PROMPT")
return
end
-- Check if key is already taken. GetBindingAction() returns "" if key has no action.
local command = GetBindingAction(key)
if command ~= "" and command ~= currentlyEditedCommand then
local data = {
["lastKey"] = lastKey,
["key"] = key,
["command"] = currentlyEditedCommand
}
StaticPopup_Hide("LUDIUSPLUS_KEYBIND_PROMPT")
StaticPopup_Show("LUDIUSPLUS_KEYBIND_CONFIRM", key .. " is already assigned to \"" .. GetBindingName(command) .. "\". Do you really want to assign it to \"" .. GetBindingName(data.command) .. "\" instead?", _, data)
return
end
-- Assign new binding.
if lastKey then
SetBinding(lastKey)
end
SetBinding(key)
SetBinding(key, currentlyEditedCommand)
StaticPopup_Hide("LUDIUSPLUS_KEYBIND_PROMPT")
LibStub("AceConfigRegistry-3.0"):NotifyChange(appName)
end
-- Cover the remaining options and make them unclickable while our keybind prompt is open.
local coverOptionsFrame = CreateFrame("Frame")
coverOptionsFrame:SetFrameStrata("HIGH")
coverOptionsFrame:SetFrameLevel(10000)
coverOptionsFrame.blackTexture = coverOptionsFrame:CreateTexture(nil, "ARTWORK")
coverOptionsFrame.blackTexture:SetAllPoints()
coverOptionsFrame.blackTexture:SetColorTexture(0, 0, 0, 0.75)
coverOptionsFrame:EnableMouse(true)
local function ShowCoverOptionsFrame()
if SettingsPanel and SettingsPanel:IsShown() then
coverOptionsFrame:ClearAllPoints()
coverOptionsFrame:SetPoint("TOPLEFT", SettingsPanel, "TOPLEFT", 3, -1)
coverOptionsFrame:SetPoint("BOTTOMRIGHT", SettingsPanel, "BOTTOMRIGHT", 0, 1)
coverOptionsFrame:Show()
end
end
StaticPopupDialogs["LUDIUSPLUS_KEYBIND_PROMPT"] = {
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3, -- avoid some UI taint, see https://authors.curseforge.com/forums/world-of-warcraft/general-chat/lua-code-discussion/226040-how-to-reduce-chance-of-ui-taint-from
text = "%s",
OnShow = function (_, data)
currentlyEditedCommand = data.command
-- print(currentlyEditedCommand)
ShowCoverOptionsFrame()
keyPressFrame:SetScript("OnKeyDown", KeyPressedFunction)
end,
OnHide = function()
currentlyEditedCommand = nil
keyPressFrame:SetScript("OnKeyDown", nil)
coverOptionsFrame:Hide()
end,
button1 = "Cancel",
OnButton1 = function() end,
}
StaticPopupDialogs["LUDIUSPLUS_KEYBIND_CONFIRM"] = {
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3, -- avoid some UI taint, see https://authors.curseforge.com/forums/world-of-warcraft/general-chat/lua-code-discussion/226040-how-to-reduce-chance-of-ui-taint-from
text = "%s",
OnShow = function ()
ShowCoverOptionsFrame()
end,
OnHide = function()
coverOptionsFrame:Hide()
end,
-- So that we can have different functions for each button.
selectCallbackByIndex = true,
button1 = "Yes",
OnButton1 = function(_, data)
if data.lastKey then
SetBinding(data.lastKey)
end
SetBinding(data.key)
SetBinding(data.key, data.command)
LibStub("AceConfigRegistry-3.0"):NotifyChange(appName)
end,
button2 = "No",
OnButton2 = function() end,
}
-- Pending callbacks for modules waiting for dangerous scripts to be enabled.
local pendingModuleEnableCallbacks = {}
-- Created lazily only when needed (most users already have scripts allowed).
local dangerousScriptsButton = nil
local dangerousScriptsMonitor = nil
StaticPopupDialogs["LUDIUSPLUS_DANGEROUS_SCRIPTS_WARNING"] = {
text = "",
button1 = CANCEL,
OnShow = function(dialog, data)
local text = _G[dialog:GetName().."Text"]
local textString = L["To use certain features (like Dismount Toggle and Flashlight), LudiusPlus needs your permission to run macros.\n\nPlease click \"Allow Scripts\" below, then \"Yes\" in the game's confirmation pop-up to enable these modules."]
textString = textString .. "\n\n\n\n"
text:SetText(textString)
local cancelButton = _G[dialog:GetName().."Button1"]
-- Create the button lazily (only when this popup is shown).
if not dangerousScriptsButton then
dangerousScriptsButton = CreateFrame("Button", "LudiusPlusDangerousScriptsButton", UIParent, "UIPanelButtonTemplate, SecureActionButtonTemplate")
dangerousScriptsButton:SetSize(200, 22)
dangerousScriptsButton:SetText(L["Allow Scripts"])
dangerousScriptsButton:SetFrameStrata("FULLSCREEN")
dangerousScriptsButton:SetFrameLevel(100)
dangerousScriptsButton:RegisterForClicks("AnyUp", "AnyDown")
dangerousScriptsButton:SetAttribute("useOnKeyDown", false) -- Fire on release, not press
dangerousScriptsButton:SetAttribute("type", "macro")
dangerousScriptsButton:SetAttribute("macrotext", '/run print("Allowing scripts...")')
dangerousScriptsButton:SetScript("PostClick", function(self, button, down)
if not down then
StaticPopup_Hide("LUDIUSPLUS_DANGEROUS_SCRIPTS_WARNING")
end
end)
end
-- Create the monitor lazily.
if not dangerousScriptsMonitor then
dangerousScriptsMonitor = CreateFrame("Frame")
end
-- Position and show the button.
dangerousScriptsButton:ClearAllPoints()
dangerousScriptsButton:SetPoint("TOP", UIParent, "TOP", 0, -360)
dangerousScriptsButton:Show()
-- Position the dialog above the button.
dialog:ClearAllPoints()
dialog:SetPoint("BOTTOM", dangerousScriptsButton, "BOTTOM", 0, - cancelButton:GetHeight() - 25)
-- Start monitoring for when dangerous scripts become allowed.
dangerousScriptsMonitor:SetScript("OnUpdate", function(self)
if AreDangerousScriptsAllowed() and #pendingModuleEnableCallbacks > 0 then
for _, callback in ipairs(pendingModuleEnableCallbacks) do
callback()
end
pendingModuleEnableCallbacks = {}
self:SetScript("OnUpdate", nil)
end
end)
-- Block clicks on the options panel while the popup is open.
ShowCoverOptionsFrame()
end,
OnAccept = function(dialog, data)
if dangerousScriptsButton then dangerousScriptsButton:Hide() end
if dangerousScriptsMonitor then dangerousScriptsMonitor:SetScript("OnUpdate", nil) end
coverOptionsFrame:Hide()
end,
OnCancel = function(dialog, data)
if dangerousScriptsButton then dangerousScriptsButton:Hide() end
if dangerousScriptsMonitor then dangerousScriptsMonitor:SetScript("OnUpdate", nil) end
pendingModuleEnableCallbacks = {}
coverOptionsFrame:Hide()
end,
OnHide = function(dialog, data)
if dangerousScriptsButton then dangerousScriptsButton:Hide() end
coverOptionsFrame:Hide()
end,
timeout = 0,
whileDead = 1,
showAlert = 1,
hideOnEscape = 1,
preferredIndex = 3,
}
-- Helper function to check if dangerous scripts are allowed and show popup if not
-- Stores callback to enable the module once scripts are allowed
-- Returns true if scripts are allowed, false if not
local function CheckDangerousScriptsAllowed(enableCallback)
if AreDangerousScriptsAllowed() then
return true
end
-- Store the callback to execute when dangerous scripts are enabled
if enableCallback then
table.insert(pendingModuleEnableCallbacks, enableCallback)
end
-- Show our custom popup
StaticPopup_Show("LUDIUSPLUS_DANGEROUS_SCRIPTS_WARNING")
return false
end
-- In order to make a keybinding run a macro, I have to call it this in bindings.xml:
local dismountToggleMacroName = "Dismount/Mount Toggle"
local dismountToggleBindingName = "MACRO " .. dismountToggleMacroName
-- If I ever do i18n for this, it would be here.
_G["BINDING_NAME_" .. dismountToggleBindingName] = L["Dismount/Mount Toggle"]
local flashlightBindingName = "MACRO Torch Toggle"
_G["BINDING_NAME_" .. flashlightBindingName] = L["Torch Toggle"]
-- Get the toy name from the API (Cave Spelunker's Torch)
local flashlightItemID = 224552
local _, flashlightToyName = C_ToyBox.GetToyInfo(flashlightItemID)
flashlightToyName = flashlightToyName or "Cave Spelunker's Torch"
-- Module descriptions
-- (Defining these here, as we use them as text and tooltip in the options.
local dialogSkipperDesc = L["Automatically skip confirmation dialogs."]
local vendorItemOverlayDesc = L["Display useful information as overlays for items at vendors."]
local spellIconOverlayDesc = L["Display an |A:UI-RefreshButton:16:16:0:0|a icon overlay on spells in the spellbook or action bars that are included in the single-button combat rotation. So you can identify them at a glance."]
local dismountToggleDesc = L["Assign dismounting and re-mounting to a single key, so you can comfortably switch between both. The addon will remember your last mount and re-mount it when you press the hotkey again."]
local raceOnLastMountDesc = L["When you start a Skyriding race while not mounted, you're automatically placed on the Renewed Proto-Drake with no way to choose your preferred mount. This addon automatically switches to your last active flying mount during the race countdown (after a 2-second delay required by the game).\n\nNote: Cannot automatically switch to Druid Flight Form due to API limitations."]
local persistentCompanionDesc = L["Automatically resummon your last active pet companion after it disappears. For example, after flying or stepping through portals."]
local persistentUnsheathDesc = L["Automatically maintain your desired weapon sheath state."]
local muteSoundsDesc = L["Mute specific sounds by their Sound File IDs.\n\nFind IDs on Wago (https://wago.tools/sounds), Wowhead (https://www.wowhead.com/sounds/) or learn about other methods at https://warcraft.wiki.gg/wiki/API_MuteSoundFile.\n\nExample: 598079, 598187 (Dutiful Squire summon sounds)."]
local flashlightDesc = L["Toggles the \"%s\" toy on and off with a hotkey."]:format(flashlightToyName)
local houseEditorEnhancerDesc = L["Not being able to properly inspect the decor items in the small icons of the House Editor's %s and %s frames is a s#!tshow obviously. Ludius Plus's \"Thoughtfully Augmented Editor\" (TAE) - among other things - adds a slider to change the decor icon size and a preview side-pane (opened with CTRL + LEFTCLICK). This way, TAE gives you a better knowledge of what decor items look like before you place them. And knowledge is power!"]:format(HOUSE_EDITOR_CATALOG_STORAGE_TAB, HOUSE_EDITOR_CATALOG_MARKET_TAB)
-- Module order (from most to least demanded)
local dialogSkipperOrder = 1
local vendorItemOverlayOrder = 2
local houseEditorEnhancerOrder = 3
local spellIconOverlayOrder = 4
local dismountToggleOrder = 5
local raceOnLastMountOrder = 6
local persistentCompanionOrder = 7
local persistentUnsheathOrder = 8
local muteSoundsOrder = 9
local flashlightOrder = 10
-- Dynamic group name functions (return grey text if module disabled)
local function GetModuleGroupName(name, ...)
local conditions = {...}
local allTrue = true
for _, condition in ipairs(conditions) do
if not condition then
allTrue = false
break
end
end
if not allTrue then
return "|cff808080" .. name .. "|r"
end
return name
end
local optionsTable = {
type = "group",
args = {
-- Blank space!
optionsTableBlank00 = {order = 0.0, type = "description", name = " ",},
dismountToggleGroup = {
type = "group",
name = function() return GetModuleGroupName(L["Dismount/Mount Toggle"], config.dismountToggle_enabled) end,
desc = dismountToggleDesc,
order = dismountToggleOrder,
args = {
dismountToggleDescription = {
order = 0,
type = "description",
name = dismountToggleDesc,
width = "full",
},
dismountToggleGroupBlank05 = {order = 0.5, type = "description", name = " ",},
dismountToggleEnabled = {
order = 1,
type = "toggle",
name = L["Enable"],
width = "full",
get = function() return config.dismountToggle_enabled end,
set =
function(_, newValue)
if newValue then
-- Check if dangerous scripts are allowed before enabling
if not CheckDangerousScriptsAllowed(function()
-- This callback will be executed once dangerous scripts are enabled
config.dismountToggle_enabled = true
addon.SetupOrTeardownDismountToggle()
LibStub("AceConfigRegistry-3.0"):NotifyChange(appName)
end) then
-- Popup shown, waiting for user to enable dangerous scripts
return
end
end
-- If disabling or scripts were already allowed, proceed normally
config.dismountToggle_enabled = newValue
addon.SetupOrTeardownDismountToggle()
end,
},
dismountToggleGroupBlank15 = {order = 1.5, type = "description", name = " ",},
dismountToggleKeybindGroup = {
type = "group",
name = "",
order = 2,
inline = true,
width = "full",
args = {
dismountToggleKeybindGroupBlank00 = {order = 0.0, type = "description", name = " ", width = 0.04,},
dismountToggleLabel = {
order = 1,
type = "description",
name =
function()
local key = GetBindingKey(dismountToggleBindingName)
if key then
return L["Assigned Hotkey:"] .. " |cffffd200" .. key .. "|r"
else
return L["Assigned Hotkey:"] .. " |cff808080" .. L["Not Bound"] .. "|r"
end
end,
width = 1,
},
dismountToggleAssignButton = {
order = 2,
type = "execute",
name = L["New Key Bind"],
desc = L["Assign a new hotkey binding."],
width = 0.7,
func =
function()
local data = { ["command"] = dismountToggleBindingName }
StaticPopup_Show("LUDIUSPLUS_KEYBIND_PROMPT", SETTINGS_BIND_KEY_TO_COMMAND_OR_CANCEL:format(GetBindingName(dismountToggleBindingName), GetBindingText("ESCAPE")), _, data)
end,
disabled =
function()
return not config.dismountToggle_enabled
end,
},
dismountToggleKeybindGroupBlank25 = {order = 2.5, type = "description", name = " ", width = 0.05,},
dismountToggleUnassignButton = {
order = 3,
type = "execute",
name = L["Unbind"],
desc = L["Unassign the current binding."],
width = 0.7,
func =
function()
SetBinding(GetBindingKey(dismountToggleBindingName))
end,
disabled =
function()
if GetBindingKey(dismountToggleBindingName) then return false else return true end
end,
},
},
},
dismountToggleGroupBlank25 = {order = 2.5, type = "description", name = " ",},
dismountToggleIgnoredMounts = {
order = 3,
type = "input",
name = L["Mounts to ignore (comma-separated Mount IDs)"],
desc = L["Enter Mount IDs to ignore when storing your last mount. Useful for utility mounts like Yak or Brutosaur that you use temporarily but don't want to summon with your hotkey.\n\nFind Mount IDs at: https://www.wowhead.com/spells/mounts"],
width = "full",
multiline = 3,
get = function() return config.dismountToggle_ignoredMounts end,
set =
function(_, newValue)
config.dismountToggle_ignoredMounts = newValue
-- Update LibMountInfo's ignore list
local LibMountInfo = LibStub("LibMountInfo-1.0")
LibMountInfo:SetIgnoredMounts(newValue)
end,
disabled =
function()
return not config.dismountToggle_enabled
end,
},
dismountToggleFillUtilityMounts = {
order = 3.5,
type = "execute",
name = L["Fill in Utility Mounts"],
desc = function()
local utilityMounts = {
{id = 280, name = nil},
{id = 284, name = nil},
{id = 460, name = nil},
{id = 1039, name = nil},
{id = 2237, name = nil},
{id = 2265, name = nil},
}
-- Fetch mount names
for _, mount in ipairs(utilityMounts) do
local name = C_MountJournal.GetMountInfoByID(mount.id)
mount.name = name or ("Mount ID " .. mount.id)
end
local desc = L["Adds commonly used utility mounts to the ignore list:"] .. "\n"
for _, mount in ipairs(utilityMounts) do
desc = desc .. "\n" .. mount.id .. ": " .. mount.name
end
return desc
end,
width = "full",
func = function()
local utilityMountIDs = {280, 284, 460, 1039, 2237, 2265}
-- Parse existing IDs
local existingIDs = {}
for id in string.gmatch(config.dismountToggle_ignoredMounts, "%d+") do
existingIDs[tonumber(id)] = true
end
-- Add utility mount IDs if not already present
local idsToAdd = {}
for _, id in ipairs(utilityMountIDs) do
if not existingIDs[id] then
table.insert(idsToAdd, id)
end
end
-- Build new string
if #idsToAdd > 0 then
local newIDs = table.concat(idsToAdd, ", ")
if config.dismountToggle_ignoredMounts == "" then
config.dismountToggle_ignoredMounts = newIDs
else
config.dismountToggle_ignoredMounts = config.dismountToggle_ignoredMounts .. ", " .. newIDs
end
-- Update LibMountInfo
local LibMountInfo = LibStub("LibMountInfo-1.0")
LibMountInfo:SetIgnoredMounts(config.dismountToggle_ignoredMounts)
-- Refresh options display
LibStub("AceConfigRegistry-3.0"):NotifyChange(appName)
end
end,
disabled = function()
return not config.dismountToggle_enabled
end,
},
dismountToggleIgnoredMountAutoMount = {
order = 3.7,
type = "toggle",
name = L["Auto-mount last non-ignored mount when on ignored mounts"],
desc = L["While on an ignored mount, the hotkey will dismount and immediately mount the last non-ignored mount. Disable to only dismount."],
width = "full",
get = function() return config.dismountToggle_ignoredMountAutoMount end,
set =
function(_, newValue)
config.dismountToggle_ignoredMountAutoMount = newValue
addon.SetupOrTeardownDismountToggle()
end,
disabled =
function()
return not config.dismountToggle_enabled
end,
},
dismountToggleGroupBlank38 = {order = 3.8, type = "description", name = " ",},
dismountToggleChangeActionBarTo = {
order = 4,
type = "select",
name = L["When mounting, switch automatically to Action Bar:"],
desc = L["Automatically switch to this action bar when you mount up, so you have your flying/mount abilities easily accessible. Set to \"disabled\" to keep your current action bar."],
width = 2,
disabled =
function()
return not config.dismountToggle_enabled
end,
get =
function()
return config.dismountToggle_changeActionBarTo
end,
set =
function(_, newValue)
config.dismountToggle_changeActionBarTo = newValue
addon.SetupOrTeardownDismountToggle()
end,
values = {
[1] = "1",
[2] = "2",
[3] = "3",
[4] = "4",
[5] = "5",
[6] = "6",
["disabled"] = "disabled",
},
},
dismountToggleGroupBlank45 = {order = 4.5, type = "description", name = " ",},
dismountToggleTravelFormEnabled = {
order = 5,
type = "toggle",
name = L["Druid Travel Form instead of mounting"],
desc = L["Druids only: Use Travel Form or Flight Form as \"mounting\", and Humanoid form as \"dismounting\", instead of standard mounts."],
width = "full",
get = function() return config.dismountToggle_travelFormEnabled end,
set =
function(_, newValue)
config.dismountToggle_travelFormEnabled = newValue
addon.SetupOrTeardownDismountToggle()
end,
disabled =
function()
return not config.dismountToggle_enabled
end,
},
dismountToggleSoarEnabled = {
order = 6,
type = "toggle",
name = L["Dracthyr Soar instead of mounting"],
desc = L["Dracthyr only: Use Soar as \"mounting\" and humanoid form as \"dismounting\", instead of standard mounts."],
width = "full",
get = function() return config.dismountToggle_soarEnabled end,
set =
function(_, newValue)
config.dismountToggle_soarEnabled = newValue
addon.SetupOrTeardownDismountToggle()
end,
disabled =
function()
return not config.dismountToggle_enabled
end,
},
},
},
raceOnLastMountGroup = {
type = "group",
name = function() return GetModuleGroupName(L["Race on Last Mount"], config.raceOnLastMount_enabled) end,
desc = raceOnLastMountDesc,
order = raceOnLastMountOrder,
args = {
raceOnLastMountDescription = {
order = 0,
type = "description",
name = raceOnLastMountDesc,
width = "full",
},
raceOnLastMountGroupBlank05 = {order = 0.5, type = "description", name = " ",},
raceOnLastMountEnabled = {
order = 1,
type = "toggle",
name = L["Enable"],
width = "full",
get = function() return config.raceOnLastMount_enabled end,
set =
function(_, newValue)
config.raceOnLastMount_enabled = newValue
addon.SetupOrTeardownRaceOnLastMount()
end,
},
},
},
flashlightGroup = {
type = "group",
name = function() return GetModuleGroupName(L["Flashlight (Torch)"], config.flashlight_enabled) end,
desc = flashlightDesc,
order = flashlightOrder,
args = {
flashlightDescription = {
order = 0,
type = "description",
name = flashlightDesc,
width = "full",
},
flashlightGroupBlank05 = {order = 0.5, type = "description", name = " ",},
flashlightMissingToyWarning = {
order = 0.7,
type = "description",
name = function()
if not addon.HasFlashlightToy() then
return "|cffff0000" .. L["Toy Missing:"] .. "|r " .. L["You don't have the %s!\nGet it from the Illuminated Footlocker:\nhttps://www.wowhead.com/object=437211/illuminated-footlocker"]:format(flashlightToyName)
end
return ""
end,
width = "full",
hidden = function() return addon.HasFlashlightToy() end,
},
flashlightGroupBlank05b = {order = 0.75, type = "description", name = " ", hidden = function() return addon.HasFlashlightToy() end},
flashlightEnabled = {
order = 1,
type = "toggle",
name = L["Enable"],
width = "full",
get = function() return config.flashlight_enabled end,
set =
function(_, newValue)
if newValue then
-- Check if dangerous scripts are allowed before enabling
if not CheckDangerousScriptsAllowed(function()
-- This callback will be executed once dangerous scripts are enabled
config.flashlight_enabled = true
addon.SetupOrTeardownFlashlight()
LibStub("AceConfigRegistry-3.0"):NotifyChange(appName)
end) then
-- Popup shown, waiting for user to enable dangerous scripts
return
end
end
-- If disabling or scripts were already allowed, proceed normally
config.flashlight_enabled = newValue
addon.SetupOrTeardownFlashlight()
end,
disabled = function() return not addon.HasFlashlightToy() end,
},
flashlightGroupBlank15 = {order = 1.5, type = "description", name = " ",},
flashlightKeybindGroup = {
type = "group",
name = "",
order = 2,
inline = true,
width = "full",
args = {
flashlightKeybindGroupBlank00 = {order = 0.0, type = "description", name = " ", width = 0.04,},
flashlightLabel = {
order = 1,
type = "description",
name =
function()
local key = GetBindingKey(flashlightBindingName)
if key then
return L["Assigned Hotkey:"] .. " |cffffd200" .. key .. "|r"
else
return L["Assigned Hotkey:"] .. " |cff808080" .. L["Not Bound"] .. "|r"
end
end,
width = 1,
},
flashlightAssignButton = {
order = 2,
type = "execute",
name = L["New Key Bind"],
desc = L["Assign a new hotkey binding."],
width = 0.7,
func =
function()
local data = { ["command"] = flashlightBindingName }
StaticPopup_Show("LUDIUSPLUS_KEYBIND_PROMPT", SETTINGS_BIND_KEY_TO_COMMAND_OR_CANCEL:format(GetBindingName(flashlightBindingName), GetBindingText("ESCAPE")), _, data)
end,
disabled =
function()
return not config.flashlight_enabled
end,
},
flashlightKeybindGroupBlank25 = {order = 2.5, type = "description", name = " ", width = 0.05,},
flashlightUnassignButton = {
order = 3,
type = "execute",
name = L["Unbind"],
desc = L["Unassign the current binding."],
width = 0.7,
func =
function()
SetBinding(GetBindingKey(flashlightBindingName))
end,
disabled =
function()
if GetBindingKey(flashlightBindingName) then return false else return true end
end,
},
},
},
},
},
muteSoundsGroup = {
type = "group",
name = function() return GetModuleGroupName(L["Mute Sounds"], config.muteSounds_enabled) end,
desc = muteSoundsDesc,
order = muteSoundsOrder,
args = {
muteSoundsDescription = {
order = 0,
type = "description",
name = muteSoundsDesc,
width = "full",
},
muteSoundsGroupBlank05 = {order = 0.5, type = "description", name = " ",},
muteSoundsEnabled = {
order = 1,
type = "toggle",
name = L["Enable"],
width = "full",
get = function() return config.muteSounds_enabled end,
set =
function(_, newValue)
config.muteSounds_enabled = newValue
addon.SetupOrTeardownMuteSounds()
end,
},
muteSoundsSoundIds = {
order = 2,
type = "input",
name = L["Sound IDs to mute (comma-separated)"],
desc = L["Enter Sound File IDs separated by commas."],
width = "full",
multiline = 12,
get = function() return config.muteSounds_soundIds end,
set =
function(_, newValue)
config.muteSounds_soundIds = newValue
addon.SetupOrTeardownMuteSounds()
end,
disabled =
function()
return not config.muteSounds_enabled
end,
},
},
},
dialogSkipperGroup = {
type = "group",
name = function() return GetModuleGroupName(L["Dialog Skipper"], config.dialogSkipper_enabled) end,
desc = dialogSkipperDesc,
order = dialogSkipperOrder,
args = {
dialogSkipperDescription = {
order = 0,
type = "description",
name = dialogSkipperDesc,
width = "full",
},
dialogSkipperGroupBlank05 = {order = 0.5, type = "description", name = " ",},
dialogSkipperEnabled = {
order = 1,
type = "toggle",
name = L["Enable"],
width = "full",
get = function() return config.dialogSkipper_enabled end,
set =
function(_, newValue)
config.dialogSkipper_enabled = newValue
addon.SetupOrTeardownDialogSkipper()
end,
},
dialogSkipperGroupBlank15 = {order = 1.5, type = "description", name = " ",},
dialogSkipperSkipAuction = {
order = 2,
type = "toggle",
name = L["Skip auction house buyout confirmations"],
width = "full",
get = function() return config.dialogSkipper_skipAuction end,
set =
function(_, newValue)
config.dialogSkipper_skipAuction = newValue
addon.SetupOrTeardownDialogSkipper()
end,
disabled =
function()
return not config.dialogSkipper_enabled
end,
},
dialogSkipperAuctionPriceLimit = {
order = 2.5,
type = "input",
name = L["Only skip if price is below (gold)"],
desc = L["Set the maximum price in gold for automatically confirming auctions."],
width = "full",
get = function() return tostring(config.dialogSkipper_auctionPriceLimit / 10000) end,
set =
function(_, newValue)
local num = tonumber(newValue)
if num then
config.dialogSkipper_auctionPriceLimit = math.floor(num * 10000)
addon.SetupOrTeardownDialogSkipper()
end
end,
disabled =
function()
return not config.dialogSkipper_enabled or not config.dialogSkipper_skipAuction
end,
},
dialogSkipperAuctionBackButton = {
order = 3,
type = "toggle",
name = L["Back to previous item list after buyout"],
desc = L["After buying out an item, the addon automatically returns you to the previous item list overview. This is useful when you typically purchase one listing of an item and then want to go back to browse other items."],
width = "full",
get = function() return config.dialogSkipper_auctionBackButton end,
set =
function(_, newValue)
config.dialogSkipper_auctionBackButton = newValue
addon.SetupOrTeardownDialogSkipper()
end,