From 306a74fcfc002fc1c9a40db3e99401f7419d3f5c Mon Sep 17 00:00:00 2001 From: Ted Date: Fri, 29 Jul 2016 19:28:22 -0400 Subject: [PATCH] add slash commands (real config gui planned for future) --- Teds_PVP_Spelltimers.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Teds_PVP_Spelltimers.lua b/Teds_PVP_Spelltimers.lua index 80737b1..d8f5e98 100644 --- a/Teds_PVP_Spelltimers.lua +++ b/Teds_PVP_Spelltimers.lua @@ -255,4 +255,28 @@ f:SetScript("OnUpdate", f.Update) f:RegisterEvent("UNIT_AURA") f:RegisterEvent("PLAYER_TARGET_CHANGED") f:RegisterEvent("ADDON_LOADED") +--Define Slash Command Functions +local slash = {} +function slash:move(arg) + f:Mover() +end +function slash:help(arg) + print("TPST>Available commands are: /tpst move, /tpst help") +end +--Register Slash Commands +SLASH_TEDSPVPSPELLTIMERS1 = "/tpst" +local function SlashHandler(msg, editbox) + if msg == "" or msg == nil then + slash:help() + else + local command, arg = msg:match("^(%S*)%s*(.-)$") + command = string.lower(command) + if slash[command] then + slash[command](arg) + else + print("TPST>Not a recognized command! Try /tpst help") + end + end +end +SlashCmdList["TEDSPVPSPELLTIMERS"] = SlashHandler --TODO: Ability to move frame, save position between sessions \ No newline at end of file