From 0cd45584ff39c86c42eda8728a5638748d64f191 Mon Sep 17 00:00:00 2001 From: Dusk-92 Date: Tue, 1 Sep 2026 10:46:07 +0200 Subject: [PATCH] Keep reagent counts visible after action updates --- mods/actionbar-reagents.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mods/actionbar-reagents.lua b/mods/actionbar-reagents.lua index 9ec8c79..743dfdf 100644 --- a/mods/actionbar-reagents.lua +++ b/mods/actionbar-reagents.lua @@ -107,4 +107,21 @@ module.enable = function(self) reagent_slots[slot] = reagent.itemID reagent_counts[reagent.itemID] = reagent_counts[reagent.itemID] or 0 end + + -- The stock UI clears the Count fontstring on non-consumable actions whenever + -- ActionButton_UpdateCount() runs. Re-apply our reagent value afterwards so + -- login/reload refreshes cannot erase it a moment later. + ShaguTweaks.hooksecurefunc("ActionButton_UpdateCount", function() + local button = this + if not button or not button.GetName then return end + + local slot = ActionButton_GetPagedID(button) + local itemID = slot and reagent_slots[slot] + if not itemID then return end + + local text = _G[button:GetName().."Count"] + if text then + text:SetText(reagent_counts[itemID] or 0) + end + end) end