From a0789f26df088257f30c0619e368bb14d7306d40 Mon Sep 17 00:00:00 2001 From: shagu Date: Mon, 26 Feb 2024 16:48:13 +0100 Subject: [PATCH] unusable: trigger directly from bags module --- modules/bags.lua | 5 +++++ modules/unusable.lua | 13 ++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/bags.lua b/modules/bags.lua index ebb9a9e7..b6afdd6e 100644 --- a/modules/bags.lua +++ b/modules/bags.lua @@ -492,6 +492,11 @@ pfUI:RegisterModule("bags", "vanilla:tbc", function () end end + -- update red color on unusable items + if pfUI.unusable then + pfUI.unusable:UpdateSlot(bag, slot) + end + pfUI.bags[bag].slots[slot].frame:Show() end diff --git a/modules/unusable.lua b/modules/unusable.lua index bf532076..764476db 100644 --- a/modules/unusable.lua +++ b/modules/unusable.lua @@ -67,18 +67,13 @@ pfUI:RegisterModule("unusable", "vanilla:tbc", function () end pfUI.unusable:SetScript("OnEvent", function() + -- update all caches if event == "PLAYERBANKSLOTS_CHANGED" or event == "BANKFRAME_OPENED" then - QueueFunction(this.UpdateCache,this) -- BankFrameItemButton_OnUpdate fires after UpdateSlot overriding changes + -- BankFrameItemButton_OnUpdate fires after UpdateSlot overriding changes + QueueFunction(this.UpdateCache,this) else + -- regular update this:UpdateCache() end end) - - -- manual post hook update slot, hooksecurefunc won't work; _G[] doesn't like keys with periods. - local bagUpdateSlot = pfUI.bag.UpdateSlot - pfUI.bag.UpdateSlot = function(_, bag, slot) - bagUpdateSlot(pfUI.bag, bag, slot) - pfUI.unusable:UpdateSlot(bag, slot) - end - end)