mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-22 15:46:56 +00:00
modernize monkey-patched hooks to hooksecurefunc
sellvalue.lua: SetItemRef hook follows the same pattern questitem.lua got earlier — replaces the local-Hook + _G.SetItemRef monkey-patch with hooksecurefunc, drops the string.find link-parser, and reads itemID directly from ItemRefTooltip:GetItem after the original populates the tooltip. The OnShow path also moves from libtooltip:GetItemLink/GetItemID to GameTooltip:HasItem/GetItem (libtooltip:GetItemCount stays — it's populated by libtooltip's own SetBagItem hook and carries the stack count, which GetItem doesn't return). unusable.lua: the two post-hooks (pfUI.bag.UpdateSlot and BankFrameItemButton_UpdateLock) are textbook hooksecurefunc cases — both ran the original then did extra work, no conditional skip or return-value tampering. The table form of hooksecurefunc handles pfUI.bag.UpdateSlot cleanly.
This commit is contained in:
@@ -41,16 +41,12 @@ pfUI:RegisterModule("unusable", "vanilla:tbc", function ()
|
||||
end
|
||||
|
||||
-- update on regular pfUI button updates
|
||||
local HookUpdateSlot = pfUI.bag.UpdateSlot
|
||||
pfUI.bag.UpdateSlot = function(self, bag, slot)
|
||||
HookUpdateSlot(self, bag, slot)
|
||||
hooksecurefunc(pfUI.bag, "UpdateSlot", function(self, bag, slot)
|
||||
pfUI.unusable:UpdateSlot(bag, slot)
|
||||
end
|
||||
end)
|
||||
|
||||
-- update on bank frame itemlock updates
|
||||
local HookBankFrameItemButton_UpdateLock = BankFrameItemButton_UpdateLock
|
||||
_G.BankFrameItemButton_UpdateLock = function()
|
||||
HookBankFrameItemButton_UpdateLock()
|
||||
hooksecurefunc("BankFrameItemButton_UpdateLock", function()
|
||||
pfUI.unusable:UpdateSlot(-1, this:GetID())
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user