-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSlashCommands.lua
More file actions
76 lines (69 loc) · 2.15 KB
/
Copy pathSlashCommands.lua
File metadata and controls
76 lines (69 loc) · 2.15 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
local _, WE = ...
local presetAliases = {
blizzard = "BLIZZARD_PLUS",
["blizzard+"] = "BLIZZARD_PLUS",
high = "HIGH_CONTRAST",
highcontrast = "HIGH_CONTRAST",
minimal = "MINIMAL",
neon = "NEON",
white = "CLEAN_WHITE",
clean = "CLEAN_WHITE",
}
local function SetEnabled(enabled)
WE.GetDB().enabled = enabled
if enabled then
WE.ApplyAll()
WE.Print("enabled.")
else
WE.RestoreBlizzardLikeStyle()
WE.Print("disabled; Blizzard's native style was restored.")
end
if WE.previewFrame then
WE.UpdatePreview()
end
end
local function PrintHelp()
WE.Print("commands: options, reset, preset blizzard|high|minimal|neon|white, test, on, off, safe")
end
function WE.HandleSlashCommand(message)
local input = string.lower(strtrim(message or ""))
local command, argument = input:match("^(%S+)%s*(.-)$")
if not command or command == "" or command == "options" then
WE.OpenSettings()
return
end
if command == "reset" then
WE.ApplyReset()
WE.Print("all settings reset.")
elseif command == "preset" then
local preset = presetAliases[argument]
if preset and WE.ApplyPreset(preset) then
WE.Print("preset applied: " .. argument .. ".")
else
WE.Print("unknown preset.")
PrintHelp()
end
elseif command == "test" then
WE.Print(WE.TogglePreview() and "preview shown." or "preview hidden.")
elseif command == "on" then
SetEnabled(true)
elseif command == "off" then
SetEnabled(false)
elseif command == "safe" then
local enabled = not WE.GetDB().compatibility.safeMode
WE.SetOption("compatibility.safeMode", enabled, false)
WE.Print("safe mode " .. (enabled and "enabled." or "disabled."))
WE.UpdateCompatibilityPanel()
else
PrintHelp()
end
end
function WE.RegisterSlashCommands()
if WE.slashRegistered then
return
end
WE.slashRegistered = true
SLASH_WAYPOINTENHANCER1 = "/we"
SLASH_WAYPOINTENHANCER2 = "/waypointenhancer"
SlashCmdList.WAYPOINTENHANCER = WE.HandleSlashCommand
end