Fix stale UI state and wrapper ordering

This commit is contained in:
2026-08-30 10:26:24 +02:00
parent 48fa6cd025
commit dbb7cd3f69
4 changed files with 41 additions and 17 deletions
+3 -2
View File
@@ -29,7 +29,7 @@ module.enable = function(self)
MainMenuBar:SetPoint("BOTTOM", 0, 8)
-- align actionbutton textures and add border
for _, prefix in pairs(actionbars) do
for _, prefix in ipairs(actionbars) do
for i = 1, NUM_ACTIONBAR_BUTTONS do
local button = _G[prefix .. "Button" .. i]
local texture = _G[prefix.."Button"..i.."NormalTexture"]
@@ -60,6 +60,7 @@ module.enable = function(self)
-- keep the custom reputation position without replacing Blizzard's updater
local function UpdateReputationPosition()
ReputationWatchBar:ClearAllPoints()
if MainMenuExpBar:IsShown() then
ReputationWatchBar:SetPoint("BOTTOM", MainMenuBar, "TOP", 0, -7)
else
@@ -74,7 +75,7 @@ module.enable = function(self)
MainMenuBarMaxLevelBar:SetAlpha(0)
-- remove textures
for _, texture in pairs(texture_removals) do
for _, texture in ipairs(texture_removals) do
if texture then
texture:SetTexture()
texture:Hide()
+10 -3
View File
@@ -45,6 +45,9 @@ module.enable = function(self)
-- Tooltip scans are only required when the action layout changed.
if this.rescan then
-- Rebuild the active reagent set so items no longer referenced by any
-- action slot stop being counted after actionbar changes.
reagent_counts = {}
for slot = 1, 120 do
reagentcounter.ScanSlot(slot)
end
@@ -56,7 +59,7 @@ module.enable = function(self)
end
-- update all actionbar buttons
for _, prefix in pairs(bars) do
for _, prefix in ipairs(bars) do
for i = 1, NUM_ACTIONBAR_BUTTONS do
local button = _G[prefix .. "Button" .. i]
if button then
@@ -92,10 +95,14 @@ module.enable = function(self)
-- remove reagent counts if existing
reagents = reagents and string.gsub(reagents, " %((.+)%)", "")
-- update on reagent requirement changes
if reagents and reagent_slots[slot] ~= reagents then
if reagents then
reagent_counts[reagents] = reagent_counts[reagents] or 0
reagent_slots[slot] = reagents
else
-- The slot can stay occupied while changing from a reagent spell to a
-- normal action; clear the previous reagent instead of leaving a stale
-- counter on the button.
reagent_slots[slot] = nil
end
end
end
+22 -9
View File
@@ -28,17 +28,30 @@ module.enable = function(self)
local format = clock == 24 and "%H:%M:%S" or "%I:%M:%S %p"
local color = rgbhex({ rgb.r, rgb.g, rgb.b, rgb.a })
-- add hooks to each frame
for i=1,NUM_CHAT_WINDOWS do
local frame = _G["ChatFrame"..i]
if frame and not frame.ShaguTweaksExtrasTimestampAddMessage then
frame.ShaguTweaksExtrasTimestampAddMessage = frame.AddMessage
frame.AddMessage = function(self, msg, a1, a2, a3, a4, a5)
if not msg then return end
local function InstallTimestampHooks()
for i = 1, NUM_CHAT_WINDOWS do
local frame = _G["ChatFrame"..i]
if frame and not frame.ShaguTweaksExtrasTimestampAddMessage then
frame.ShaguTweaksExtrasTimestampAddMessage = frame.AddMessage
frame.AddMessage = function(self, msg, a1, a2, a3, a4, a5)
if not msg then return end
msg = color .. left .. date(format) .. right .. "|r " .. msg
self:ShaguTweaksExtrasTimestampAddMessage(msg, a1, a2, a3, a4, a5)
msg = color .. left .. date(format) .. right .. "|r " .. msg
self:ShaguTweaksExtrasTimestampAddMessage(msg, a1, a2, a3, a4, a5)
end
end
end
end
-- Install after the normal ShaguTweaks module pass. Chat Tweaks in the
-- main fork also wraps AddMessage, and its module order is intentionally
-- unordered. Waiting for PLAYER_ENTERING_WORLD makes timestamps the outer
-- wrapper every time, so history consistently stores the displayed time.
local installer = CreateFrame("Frame", nil, UIParent)
installer:RegisterEvent("PLAYER_ENTERING_WORLD")
installer:SetScript("OnEvent", function()
InstallTimestampHooks()
this:UnregisterAllEvents()
this:Hide()
end)
end
+6 -3
View File
@@ -137,9 +137,7 @@ module.enable = function(self)
end
end)
_G.SLASH_EQUIP1 = "/equip"
_G.SLASH_EQUIP2 = "/use"
_G.SlashCmdList.EQUIP = function(msg)
local function EquipOrUse(msg)
if not msg or msg == "" then return end
local bag, slot
@@ -164,4 +162,9 @@ module.enable = function(self)
UseInventoryItem(slot)
end
end
-- Keep the original Macro Tweaks conveniences, but do not steal /equip or
-- /use from another addon that already registered either command.
RegisterSlashAlias("SHAGUTWEAKS_EQUIP", "/equip", EquipOrUse)
RegisterSlashAlias("SHAGUTWEAKS_USE", "/use", EquipOrUse)
end