Files
BulwarkFrame/main.lua
T

52 lines
1.7 KiB
Lua

-- BulwarkFrame - main.lua
-- Load order tail: wires the slash commands and starts the UI once the player is in the world.
-- WoW-API file (parse-checked only).
BulwarkFrame = BulwarkFrame or {}
local BF = BulwarkFrame
local function msg(s) DEFAULT_CHAT_FRAME:AddMessage("|cff66bbffBulwarkFrame|r " .. s) end
local loader = CreateFrame("Frame", "BulwarkFrameLoader")
loader:RegisterEvent("PLAYER_LOGIN")
loader:SetScript("OnEvent", function()
BF.ensureDefaults()
BF.InitUI()
BF.UpdateMinimapButton()
if not BF.envOk then
msg(BulwarkFrameEnv.MESSAGE)
end
end)
SLASH_BULWARKFRAME1 = "/bulwark"
SLASH_BULWARKFRAME2 = "/bf"
SlashCmdList["BULWARKFRAME"] = function(input)
local cmd = string.lower(input or "")
-- No string.match / no ':' string methods -- Lua 5.0.
if cmd == "" or cmd == "options" or cmd == "config" then
BF.ToggleOptions()
elseif cmd == "demo" then
local on = BF.ToggleDemo()
msg("demo " .. (on and "on" or "off"))
elseif cmd == "probe" then
BF.RunProbe()
elseif cmd == "lock" then
BulwarkFrameDB.locked = not BulwarkFrameDB.locked
BF.ApplyLayout()
msg(BulwarkFrameDB.locked and "frame locked" or "frame unlocked")
elseif cmd == "reset" then
BF.resetConfig()
BF.ApplyLayout()
BF.RequestUpdate()
BF.UpdateMinimapButton()
msg("settings reset to defaults")
elseif cmd == "show" then
BulwarkFrameDB.hideWhenInactive = false
BulwarkFrameDB.hideOutOfCombat = false
BF.RequestUpdate()
msg("frame pinned visible (hide-when-idle and combat-only turned off)")
else
msg("commands: options | demo | probe | lock | show | reset")
end
end