BulwarkFrame v0.2.0

This commit is contained in:
2026-08-17 15:19:45 +02:00
parent 7cd508e2a3
commit 2b6de41d9a
8 changed files with 253 additions and 35 deletions
+31 -2
View File
@@ -23,29 +23,58 @@ SLASH_BULWARKFRAME2 = "/bf"
SlashCmdList["BULWARKFRAME"] = function(input)
local cmd = string.lower(input or "")
-- No string.match / no ':' string methods -- Lua 5.0.
--
-- Set by every branch that writes BulwarkFrameDB. The options panel is built once and its
-- widgets then hold their own state, so a slash command that changes a setting behind an open
-- panel left every checkbox, slider and cycle button showing the pre-command values -- and the
-- first nudge of a stale slider writes the discarded value straight back over the change. The
-- panel's own Reset button already calls BF.RefreshOptions for exactly this reason; collecting
-- it here gives the slash side the same treatment, and keeps a future command from silently
-- drifting out of sync again.
local dirty = false
if cmd == "" or cmd == "options" or cmd == "config" then
BF.ToggleOptions()
elseif cmd == "demo" then
-- Read before the toggle: BF.ToggleDemo clears the manual hide so the frame it promises
-- actually appears, and that is worth saying rather than leaving the user to wonder why
-- an unrelated setting moved.
local wasHidden = BulwarkFrameDB.hidden and true or false
local on = BF.ToggleDemo()
msg("demo " .. (on and "on" or "off"))
if on and wasHidden then
msg("demo on (manual hide cleared)")
else
msg("demo " .. (on and "on" or "off"))
end
dirty = true
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")
dirty = true
elseif cmd == "reset" then
BF.resetConfig()
BF.ApplyLayout()
BF.RequestUpdate()
BF.UpdateMinimapButton()
msg("settings reset to defaults")
dirty = true
elseif cmd == "show" then
-- All THREE suppressors, not just the two automatic ones. The manual hide (minimap
-- right-click) is a SavedVariable and overrides both of them in RequestUpdate, so leaving
-- it set meant '/bulwark show' reported success while the frame stayed off screen -- and
-- no other command except a full reset could clear it.
BulwarkFrameDB.hidden = false
BulwarkFrameDB.hideWhenInactive = false
BulwarkFrameDB.hideOutOfCombat = false
BF.RequestUpdate()
msg("frame pinned visible (hide-when-idle and combat-only turned off)")
msg("frame pinned visible (manual hide, hide-when-idle and combat-only turned off)")
dirty = true
else
msg("commands: options | demo | probe | lock | show | reset")
end
-- Safe unconditionally: the refresher list is empty until the panel has been built, so this is
-- a no-op for anyone who never opened it.
if dirty and BF.RefreshOptions then BF.RefreshOptions() end
end