-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSlashCommands.lua
More file actions
executable file
·39 lines (34 loc) · 1.15 KB
/
Copy pathSlashCommands.lua
File metadata and controls
executable file
·39 lines (34 loc) · 1.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
---@class DisenchantBuddy
local DisenchantBuddy = select(2, ...)
local L = DisenchantBuddy.L
SLASH_DisenchantBuddy1 = "/disenchantbuddy"
---@param msg string
function DisenchantBuddy.ProcessCommand(msg)
local _, _, cmd, args = string.find(msg, "%s?(%w+)%s?(.*)")
if cmd then
cmd = cmd:lower()
end
if cmd == "modifier" then
local args_upper = args:upper()
if (args_upper == "SHIFT" or args_upper == "ALT" or args_upper == "CONTROL") then
DisenchantBuddy_Profile.Modifier = args_upper
else
DisenchantBuddy_Profile.Modifier = "OFF"
end
print(string.format(L["Modifier is now: %s"], DisenchantBuddy_Profile.Modifier))
else
print(L["Syntax:"] .. " " .. SLASH_DisenchantBuddy1 .. " modifier ( shift | alt | control | off )")
end
end
---@param mod string
function DisenchantBuddy.IsModifierDown(mod)
if mod == "SHIFT" then
return IsShiftKeyDown()
elseif mod == "ALT" then
return IsAltKeyDown()
elseif mod == "CONTROL" then
return IsControlKeyDown()
end
return true
end
SlashCmdList["DisenchantBuddy"] = DisenchantBuddy.ProcessCommand