-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatCommands.lua
More file actions
107 lines (95 loc) · 3.19 KB
/
Copy pathChatCommands.lua
File metadata and controls
107 lines (95 loc) · 3.19 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
local ADDON_NAME, ns = ...
local addon = OvershieldsReforged
if not addon then
return
end
StaticPopupDialogs["OVERSHIELDS_REFORGED_RESET"] = {
text = "This will reset all Overshields Reforged settings to default and reload the UI. Proceed?",
button1 = ACCEPT,
button2 = CANCEL,
OnAccept = function()
OvershieldsReforgedDB = nil
ReloadUI()
end,
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3,
}
--- Handles slash commands.
function addon:HandleSlashCommand(input)
local commandLine = strtrim(input or ""):lower()
local command, argument = strsplit(" ", commandLine, 2)
command = command or ""
argument = strtrim(argument or "")
if command == "version" or command == "v" then
self:Print("Version: " .. (C_AddOns.GetAddOnMetadata(ADDON_NAME, "Version") or "unknown"))
return
end
if command == "status" or command == "s" then
local profile = self.db and self.db.profile
if not profile then
self:Print("Status unavailable (database not initialized).")
return
end
self:Print("Party: " .. (ns.IsSettingEnabled(profile.enableParty) and "On" or "Off"))
self:Print("Raid: " .. (ns.IsSettingEnabled(profile.enableRaid) and "On" or "Off"))
self:Print("Pets: " .. (ns.IsSettingEnabled(profile.enablePets) and "On" or "Off"))
local hibernateState = ns.hibernating and "|cffff8800On|r" or "|cff00ff00Off|r"
local hibernateMode
if ns.hibernateOverride == true then
hibernateMode = "manual"
elseif ns.hibernateOverride == false then
hibernateMode = "manual override"
else
hibernateMode = "auto"
end
self:Print(string.format("Hibernate: %s (%s)", hibernateState, hibernateMode))
return
end
if command == "options" or command == "o" then
self:OpenOptions()
return
end
if command == "reset" or command == "r" then
StaticPopup_Show("OVERSHIELDS_REFORGED_RESET")
return
end
if command == "hibernate" or command == "h" then
if argument == "on" then
ns.SetHibernateOverride(true)
elseif argument == "off" then
ns.SetHibernateOverride(false)
elseif argument == "auto" then
ns.SetHibernateOverride(nil)
else
local state = ns.hibernating and "|cffff8800On|r" or "|cff00ff00Off|r"
local mode
if ns.hibernateOverride == true then
mode = "manual"
elseif ns.hibernateOverride == false then
mode = "manual override"
else
mode = "auto"
end
self:Print(string.format("Hibernate: %s (%s)", state, mode))
self:Print("Usage: /osr hibernate [on||off||auto]")
end
return
end
--@alpha@
if command == "debug" or command == "d" then
ns.Debug:Toggle()
return
end
--@end-alpha@
self:Print("Usage:")
self:Print("/osr version (v) - Display the addon version.")
self:Print("/osr status (s) - Show enable and frame-scope settings.")
self:Print("/osr options (o) - Open the addon options.")
self:Print("/osr hibernate (h) [on||off||auto] - View or control hibernate mode.")
self:Print("/osr reset (r) - Reset all settings to default and reload the UI.")
--@alpha@
self:Print("/osr debug (d) - Toggle the debug diagnostics window.")
--@end-alpha@
end