Files
ShaguTweaks-ClassicAPI/mods/actionbar-grid.lua
T

28 lines
1.1 KiB
Lua

-- Extend the native extra-bar preference to main/bonus action buttons.
-- Own exactly one grid reference; drag-and-drop owns its separate reference.
local _G = ShaguTweaks.GetGlobalEnv()
local function UpdateGrid()
if not ShaguTweaks.API.IsSupportedRuntime() then return end
local show = _G.ALWAYS_SHOW_MULTIBARS == 1 or _G.ALWAYS_SHOW_MULTIBARS == "1"
for _, prefix in ipairs({"ActionButton", "BonusActionButton"}) do
for i = 1, 12 do
local button = _G[prefix .. i]
if button then
if show and not button.stAlwaysShowGrid then
button.stAlwaysShowGrid = true
ActionButton_ShowGrid(button)
elseif not show and button.stAlwaysShowGrid then
button.stAlwaysShowGrid = nil
ActionButton_HideGrid(button)
end
end
end
end
end
ShaguTweaks.hooksecurefunc("MultiActionBar_UpdateGridVisibility", UpdateGrid)
local events = CreateFrame("Frame")
events:RegisterEvent("PLAYER_ENTERING_WORLD")
events:SetScript("OnEvent", function()
if ShaguTweaks.API.IsSupportedRuntime() then UpdateGrid() end
end)