/gladdy test1-5 now possible

This commit is contained in:
Sumsebrum 2021-05-19 19:33:13 +02:00
parent c05fab9454
commit a84178edbf

View File

@ -1,4 +1,4 @@
local type, pairs, tinsert, tsort, tostring = type, pairs, table.insert, table.sort, tostring local type, pairs, tinsert, tsort, tostring, str_match, tonumber = type, pairs, table.insert, table.sort, tostring, string.match, tonumber
local InterfaceOptionsFrame_OpenToFrame = InterfaceOptionsFrame_OpenToFrame local InterfaceOptionsFrame_OpenToFrame = InterfaceOptionsFrame_OpenToFrame
local GetSpellInfo = GetSpellInfo local GetSpellInfo = GetSpellInfo
@ -26,15 +26,13 @@ Gladdy.defaults = {
SLASH_GLADDY1 = "/gladdy" SLASH_GLADDY1 = "/gladdy"
SlashCmdList["GLADDY"] = function(msg) SlashCmdList["GLADDY"] = function(msg)
if (msg == "test2") then if (str_match(msg, "test[1-5]")) then
Gladdy:ToggleFrame(2) local _, num = str_match(msg, "(test)([1-5])")
elseif (msg == "test5") then Gladdy:ToggleFrame(tonumber(num))
Gladdy:ToggleFrame(5) elseif (msg == "test") then
elseif (msg:find("test")) then
Gladdy:ToggleFrame(3) Gladdy:ToggleFrame(3)
elseif (msg == "ui" or msg == "options" or msg == "config") then elseif (msg == "ui" or msg == "options" or msg == "config") then
LibStub("AceConfigDialog-3.0"):Open("Gladdy") LibStub("AceConfigDialog-3.0"):Open("Gladdy")
--Gladdy:ShowOptions()
elseif (msg == "reset") then elseif (msg == "reset") then
Gladdy.dbi:ResetProfile() Gladdy.dbi:ResetProfile()
elseif (msg == "hide") then elseif (msg == "hide") then
@ -43,7 +41,8 @@ SlashCmdList["GLADDY"] = function(msg)
else else
Gladdy:Print(L["Valid slash commands are:"]) Gladdy:Print(L["Valid slash commands are:"])
Gladdy:Print("/gladdy ui") Gladdy:Print("/gladdy ui")
Gladdy:Print("/gladdy test2-5") Gladdy:Print("/gladdy test")
Gladdy:Print("/gladdy test1-5")
Gladdy:Print("/gladdy hide") Gladdy:Print("/gladdy hide")
Gladdy:Print("/gladdy reset") Gladdy:Print("/gladdy reset")
end end