From 3fe072c5946dd1012848b5775ce57f8482c1a398 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Sun, 5 Jul 2026 14:58:19 -0500 Subject: [PATCH] Route hooksecurefunc callers through pfUI.hooksecurefunc; global belongs to ClassicAPI pfUI's Lua hooksecurefunc lived in pfUI.env and shadowed ClassicAPI's C global for all pfUI code. Replace it with a thin pfUI.hooksecurefunc shim that keeps the missing-target no-op our call sites rely on (ClassicAPI errors on a nil target) and delegates the actual hook to _G.hooksecurefunc. Migrated all 70 internal call sites (modules/libs/skins) to pfUI.hooksecurefunc; bare hooksecurefunc now resolves to ClassicAPI's C version everywhere. Dropped the unused prepend path and the orphaned pfUI.hooks table. --- compat/vanilla.lua | 36 +++++++------------------- libs/libpredict.lua | 6 ++--- libs/libtooltip.lua | 2 +- libs/libtotem.lua | 6 ++--- modules/castbar.lua | 2 +- modules/chat.lua | 4 +-- modules/cooldown.lua | 2 +- modules/eqcompare.lua | 2 +- modules/friends.lua | 4 +-- modules/gm.lua | 2 +- modules/itemcount.lua | 2 +- modules/loot.lua | 4 +-- modules/mapcolors.lua | 8 +++--- modules/minimap.lua | 2 +- modules/player.lua | 2 +- modules/questitem.lua | 2 +- modules/raid.lua | 2 +- modules/sellvalue.lua | 2 +- modules/skin.lua | 4 +-- modules/socialmod.lua | 6 ++--- modules/thirdparty-vanilla.lua | 10 +++---- modules/turtle-wow.lua | 6 ++--- modules/unusable.lua | 4 +-- pfUI.lua | 1 - skins/blizzard/auction.lua | 10 +++---- skins/blizzard/battlefield_minimap.lua | 2 +- skins/blizzard/character.lua | 8 +++--- skins/blizzard/friends.lua | 4 +-- skins/blizzard/gossipquest.lua | 4 +-- skins/blizzard/mail.lua | 4 +-- skins/blizzard/merchant.lua | 4 +-- skins/blizzard/options-new.lua | 2 +- skins/blizzard/options-video.lua | 2 +- skins/blizzard/professions.lua | 2 +- skins/blizzard/questlog.lua | 6 ++--- skins/blizzard/readycheck.lua | 4 +-- skins/blizzard/survey.lua | 2 +- skins/blizzard/trade.lua | 2 +- skins/blizzard/trainer.lua | 2 +- 39 files changed, 81 insertions(+), 98 deletions(-) diff --git a/compat/vanilla.lua b/compat/vanilla.lua index 3c964eaa..001812ec 100644 --- a/compat/vanilla.lua +++ b/compat/vanilla.lua @@ -28,32 +28,16 @@ ACTIONBAR_SECURE_TEMPLATE_BUTTON = nil UNITFRAME_SECURE_TEMPLATE = nil --[[ Vanilla API Extensions ]]-- -function hooksecurefunc(tbl, name, func, prepend) - if type(tbl) == "string" then - prepend, func, name, tbl = func, name, tbl, _G - end - - if not tbl or not tbl[name] then return end - - pfUI.hooks[tostring(func)] = {} - pfUI.hooks[tostring(func)]["old"] = tbl[name] - pfUI.hooks[tostring(func)]["new"] = func - - if prepend then - pfUI.hooks[tostring(func)]["function"] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) - pfUI.hooks[tostring(func)]["new"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) - return pfUI.hooks[tostring(func)]["old"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) - end - else - pfUI.hooks[tostring(func)]["function"] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) - local ok, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16 = pcall(pfUI.hooks[tostring(func)]["old"], a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) - if not ok then return end - pfUI.hooks[tostring(func)]["new"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) - return r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16 - end - end - - tbl[name] = pfUI.hooks[tostring(func)]["function"] +-- Safe post-hook helper. The global `hooksecurefunc` belongs to ClassicAPI +-- (its C implementation); this wrapper only adds pfUI's missing-target guard: +-- ClassicAPI errors when target[name] isn't a function, whereas a lot of our +-- call sites hook optional/late-loaded frames and rely on a silent no-op. +-- Normalizes the string form, skips when the target is absent, then delegates +-- to the C version (uncapped args, callback-pcall, taint parity). +function pfUI.hooksecurefunc(tbl, name, func) + if type(tbl) == "string" then tbl, name, func = _G, tbl, name end + if not tbl or type(tbl[name]) ~= "function" then return end + return _G.hooksecurefunc(tbl, name, func) end do -- GetItemInfo diff --git a/libs/libpredict.lua b/libs/libpredict.lua index aca70770..57397882 100644 --- a/libs/libpredict.lua +++ b/libs/libpredict.lua @@ -899,7 +899,7 @@ local INSTANT_HOT_COOLDOWN = 1.0 -- 1 Sekunde Cooldown (GCD ist 1.5s) local pendingHots = {} -- Gather Data by User Actions -hooksecurefunc("CastSpell", function(id, bookType) +pfUI.hooksecurefunc("CastSpell", function(id, bookType) if not libpredict.sender.enabled then return end local effect, rank = libspell.GetSpellInfo(id, bookType) if not effect then return end @@ -952,7 +952,7 @@ hooksecurefunc("CastSpell", function(id, bookType) end end) -hooksecurefunc("CastSpellByName", function(effect, target) +pfUI.hooksecurefunc("CastSpellByName", function(effect, target) if not libpredict.sender.enabled then return end local effect, rank = libspell.GetSpellInfo(effect) if not effect then return end @@ -1016,7 +1016,7 @@ hooksecurefunc("CastSpellByName", function(effect, target) end end) -hooksecurefunc("UseAction", function(slot, target, selfcast) +pfUI.hooksecurefunc("UseAction", function(slot, target, selfcast) if not libpredict.sender.enabled then return end if not IsCurrentAction(slot) then return end local kind, id = GetActionInfo(slot) diff --git a/libs/libtooltip.lua b/libs/libtooltip.lua index 86dec833..9ca41fbe 100644 --- a/libs/libtooltip.lua +++ b/libs/libtooltip.lua @@ -54,6 +54,6 @@ end pfUI.api.libtooltip = libtooltip -hooksecurefunc(GameTooltip, "SetBagItem", function(self, container, slot) +pfUI.hooksecurefunc(GameTooltip, "SetBagItem", function(self, container, slot) _, libtooltip.itemCount = GetContainerItemInfo(container, slot) end) diff --git a/libs/libtotem.lua b/libs/libtotem.lua index 4652e40e..edad79e5 100644 --- a/libs/libtotem.lua +++ b/libs/libtotem.lua @@ -241,14 +241,14 @@ pfUI.libdebuff_spell_go_hooks["libtotem"] = function(spellId) end -- Hook CastSpellByName to store pending name/icon per slot -hooksecurefunc("CastSpellByName", function(effect, target) +pfUI.hooksecurefunc("CastSpellByName", function(effect, target) local name, rank, icon, _, _, _, spellId = libspell.GetSpellInfo(effect) if not name then return end libtotem:CheckAddQueue(name, rank, icon, spellId) end) -- Hook CastSpell to store pending name/icon per slot -hooksecurefunc("CastSpell", function(id, bookType) +pfUI.hooksecurefunc("CastSpell", function(id, bookType) if not id or not bookType then return end if bookType ~= BOOKTYPE_SPELL and bookType ~= BOOKTYPE_PET then return end local name, rank, icon, _, _, _, spellId = libspell.GetSpellInfo(id, bookType) @@ -259,7 +259,7 @@ end) -- Hook UseAction. GetActionInfo + GetMacroSpell give us the spellID -- directly for both spell-action and macro-action slots, so the -- tooltip-scan fallback (and the "no spellId available" caveat) goes away. -hooksecurefunc("UseAction", function(slot, target, selfcast) +pfUI.hooksecurefunc("UseAction", function(slot, target, selfcast) if not IsCurrentAction(slot) then return end local kind, id = GetActionInfo(slot) local name, rank, spellID diff --git a/modules/castbar.lua b/modules/castbar.lua index d46e64d5..c2c920da 100644 --- a/modules/castbar.lua +++ b/modules/castbar.lua @@ -487,7 +487,7 @@ pfUI:RegisterModule("castbar", function () -- (the config knob is read at event time so toggling takes effect on the -- next craft without a /reload). DoTradeSkill is synchronous; the server -- roundtrip to SPELLCAST_START gives us plenty of time after this hook. - hooksecurefunc("DoTradeSkill", function(index, num) + pfUI.hooksecurefunc("DoTradeSkill", function(index, num) if pfUI.castbar.player then pfUI.castbar.player.pendingTradeskillCount = tonumber(num) or 1 end diff --git a/modules/chat.lua b/modules/chat.lua index 3987ef8f..a493ac0b 100644 --- a/modules/chat.lua +++ b/modules/chat.lua @@ -24,7 +24,7 @@ pfUI:RegisterModule("chat", function () end end - hooksecurefunc("UnitPopup_OnClick", function(self) + pfUI.hooksecurefunc("UnitPopup_OnClick", function(self) if this.value == "IGNORE_PLAYER" then AddIgnore(_G[UIDROPDOWNMENU_INIT_MENU].name) end @@ -449,7 +449,7 @@ pfUI:RegisterModule("chat", function () end end - hooksecurefunc("FCF_SaveDock", pfUI.chat.RefreshChat) + pfUI.hooksecurefunc("FCF_SaveDock", pfUI.chat.RefreshChat) if C.chat.global.tabmouse == "1" then pfUI.chat.mouseovertab = CreateFrame("Frame") diff --git a/modules/cooldown.lua b/modules/cooldown.lua index 063beba3..8796d4c6 100644 --- a/modules/cooldown.lua +++ b/modules/cooldown.lua @@ -136,5 +136,5 @@ pfUI:RegisterModule("cooldown", function () -- vanilla does not have a cooldown frame type, so we hook the -- regular SetTimer function that each one is calling. - hooksecurefunc("CooldownFrame_SetTimer", SetCooldown) + pfUI.hooksecurefunc("CooldownFrame_SetTimer", SetCooldown) end) \ No newline at end of file diff --git a/modules/eqcompare.lua b/modules/eqcompare.lua index b8577c1b..d1e6cf13 100644 --- a/modules/eqcompare.lua +++ b/modules/eqcompare.lua @@ -139,7 +139,7 @@ pfUI:RegisterModule("eqcompare", function () local function HookTooltip(tooltip) for setter, getter in pairs(TooltipHooks) do - _G['hooksecurefunc'](tooltip, setter, makeHook(getter)) + pfUI.hooksecurefunc(tooltip, setter, makeHook(getter)) end end diff --git a/modules/friends.lua b/modules/friends.lua index 3a131904..55d0cd53 100644 --- a/modules/friends.lua +++ b/modules/friends.lua @@ -150,7 +150,7 @@ pfUI:RegisterSkin("Friends", function () end -- set positions - hooksecurefunc("WhoList_Update", function() + pfUI.hooksecurefunc("WhoList_Update", function() for i = 1, WHOS_TO_DISPLAY do local level = _G["WhoFrameButton"..i.."Level"] level:ClearAllPoints() @@ -231,7 +231,7 @@ pfUI:RegisterSkin("Friends", function () end -- set positions - hooksecurefunc("GuildStatus_Update", function() + pfUI.hooksecurefunc("GuildStatus_Update", function() for i = 1, GUILDMEMBERS_TO_DISPLAY do local level = _G["GuildFrameButton"..i.."Level"] level:ClearAllPoints() diff --git a/modules/gm.lua b/modules/gm.lua index 71b23e35..1a3db036 100644 --- a/modules/gm.lua +++ b/modules/gm.lua @@ -86,7 +86,7 @@ pfUI:RegisterModule("gm", function () -- pet dropdown -- table.insert(UnitPopupMenus["PET"], "GM_HEADER") - hooksecurefunc("UnitPopup_OnClick", function() + pfUI.hooksecurefunc("UnitPopup_OnClick", function() local dropdownFrame = _G[UIDROPDOWNMENU_INIT_MENU] local button = this.value local unit = dropdownFrame.unit diff --git a/modules/itemcount.lua b/modules/itemcount.lua index 35534978..b8b55776 100644 --- a/modules/itemcount.lua +++ b/modules/itemcount.lua @@ -41,7 +41,7 @@ pfUI:RegisterModule("itemcount", function () end end) - hooksecurefunc("SetItemRef", function() + pfUI.hooksecurefunc("SetItemRef", function() if ItemRefTooltip:HasItem() then local _, _, id = ItemRefTooltip:GetItem() if id then AddCounts(ItemRefTooltip, id) end diff --git a/modules/loot.lua b/modules/loot.lua index 93a88dc6..60337c11 100644 --- a/modules/loot.lua +++ b/modules/loot.lua @@ -392,7 +392,7 @@ pfUI:RegisterModule("loot", function () end pfUI.loot:RemoveMasterlootMenus() -- remove then add to ensure no duplicate menus pfUI.loot:AddMasterLootMenus() - hooksecurefunc("UnitPopup_OnClick",function() + pfUI.hooksecurefunc("UnitPopup_OnClick",function() local dropdownFrame = _G[UIDROPDOWNMENU_INIT_MENU] if not dropdownFrame then return end local button = this.value @@ -405,7 +405,7 @@ pfUI:RegisterModule("loot", function () end end end) - hooksecurefunc("UnitPopup_HideButtons",function() + pfUI.hooksecurefunc("UnitPopup_HideButtons",function() local dropdownFrame = _G[UIDROPDOWNMENU_INIT_MENU] local unit = dropdownFrame.unit local name = dropdownFrame.name diff --git a/modules/mapcolors.lua b/modules/mapcolors.lua index f85eab87..0163c8a0 100644 --- a/modules/mapcolors.lua +++ b/modules/mapcolors.lua @@ -125,13 +125,13 @@ pfUI:RegisterModule("mapcolors", function () -- WorldMap Initialize('WorldMap') - hooksecurefunc('WorldMapButton_OnUpdate', function() + pfUI.hooksecurefunc('WorldMapButton_OnUpdate', function() if ( this.tick or .5) > GetTime() then return else this.tick = GetTime() + .5 end UpdateUnitFrames('WorldMap') end) if C.appearance.worldmap.colornames == "1" then - hooksecurefunc('WorldMapUnit_OnEnter', function() + pfUI.hooksecurefunc('WorldMapUnit_OnEnter', function() if ( this.tick or .5) > GetTime() then return else this.tick = GetTime() + .5 end UpdateUnitColors('WorldMap', WorldMapTooltip) end) @@ -141,13 +141,13 @@ pfUI:RegisterModule("mapcolors", function () HookAddonOrVariable("Blizzard_BattlefieldMinimap", function() Initialize('BattlefieldMinimap') - hooksecurefunc('BattlefieldMinimap_OnUpdate', function() + pfUI.hooksecurefunc('BattlefieldMinimap_OnUpdate', function() if ( this.tick or .5) > GetTime() then return else this.tick = GetTime() + .5 end UpdateUnitFrames('BattlefieldMinimap') end) if C.appearance.worldmap.colornames == "1" then - hooksecurefunc('BattlefieldMinimapUnit_OnEnter', function() + pfUI.hooksecurefunc('BattlefieldMinimapUnit_OnEnter', function() if ( this.tick or .5) > GetTime() then return else this.tick = GetTime() + .5 end UpdateUnitColors('BattlefieldMinimap', GameTooltip) end) diff --git a/modules/minimap.lua b/modules/minimap.lua index ead0c510..ce9acd6d 100644 --- a/modules/minimap.lua +++ b/modules/minimap.lua @@ -58,7 +58,7 @@ pfUI:RegisterModule("minimap", function () pfUI.minimap:UpdateConfig() - hooksecurefunc("ToggleMinimap", function() + pfUI.hooksecurefunc("ToggleMinimap", function() if pfUI.farmmap and pfUI.farmmap:IsShown() then Minimap:Hide() return diff --git a/modules/player.lua b/modules/player.lua index d52f5c9c..6aa25980 100644 --- a/modules/player.lua +++ b/modules/player.lua @@ -141,7 +141,7 @@ pfUI:RegisterModule("player", function () end end - hooksecurefunc("UnitPopup_OnClick", function() + pfUI.hooksecurefunc("UnitPopup_OnClick", function() local button = this.value if button == "RESET_INSTANCES_FIX" then StaticPopup_Show("CONFIRM_RESET_INSTANCES") diff --git a/modules/questitem.lua b/modules/questitem.lua index 874ce0a4..63a398ef 100644 --- a/modules/questitem.lua +++ b/modules/questitem.lua @@ -95,7 +95,7 @@ pfUI:RegisterModule("questitem", function () -- itemref tooltip (chat link clicks): hooksecurefunc runs after SetItemRef -- populates ItemRefTooltip, so we just read the item back out of the tooltip -- instead of re-parsing the "item:NNN" out of the link string. - hooksecurefunc("SetItemRef", function() + pfUI.hooksecurefunc("SetItemRef", function() if IsModifierKeyDown() then return end if ItemRefTooltip:HasItem() then local _, _, id = ItemRefTooltip:GetItem() diff --git a/modules/raid.lua b/modules/raid.lua index 0f52381f..1057578c 100644 --- a/modules/raid.lua +++ b/modules/raid.lua @@ -164,7 +164,7 @@ pfUI:RegisterModule("raid", function () end end - hooksecurefunc("UnitPopup_OnClick", function() + pfUI.hooksecurefunc("UnitPopup_OnClick", function() local dropdownFrame = UIDROPDOWNMENU_INIT_MENU and _G[UIDROPDOWNMENU_INIT_MENU] if not dropdownFrame then return end local button = this.value diff --git a/modules/sellvalue.lua b/modules/sellvalue.lua index a24f8b37..a51968ad 100644 --- a/modules/sellvalue.lua +++ b/modules/sellvalue.lua @@ -40,7 +40,7 @@ pfUI:RegisterModule("sellvalue", function () end end) - hooksecurefunc("SetItemRef", function() + pfUI.hooksecurefunc("SetItemRef", function() if IsModifierKeyDown() then return end if ItemRefTooltip:HasItem() then local _, _, id = ItemRefTooltip:GetItem() diff --git a/modules/skin.lua b/modules/skin.lua index 867d4c0d..67ad4d50 100644 --- a/modules/skin.lua +++ b/modules/skin.lua @@ -51,12 +51,12 @@ pfUI:RegisterModule("skin", function () DurabilityFrame.SetPoint = function() return end if C.appearance.cd.blizzard == "1" then - hooksecurefunc("PaperDollItemSlotButton_Update", function() + pfUI.hooksecurefunc("PaperDollItemSlotButton_Update", function() local cooldown = _G[this:GetName().."Cooldown"] if cooldown then cooldown.pfCooldownType = "BLIZZARD" end end) - hooksecurefunc("SpellButton_UpdateButton", function() + pfUI.hooksecurefunc("SpellButton_UpdateButton", function() local cooldown = _G[this:GetName().."Cooldown"] if cooldown then cooldown.pfCooldownType = "BLIZZARD" end end) diff --git a/modules/socialmod.lua b/modules/socialmod.lua index 4cf14cf3..ac601099 100644 --- a/modules/socialmod.lua +++ b/modules/socialmod.lua @@ -10,7 +10,7 @@ pfUI:RegisterModule("socialmod", function () end end) do -- add colors to guild list - hooksecurefunc("GuildStatus_Update", function() + pfUI.hooksecurefunc("GuildStatus_Update", function() local playerzone = GetRealZoneText() local off = FauxScrollFrame_GetOffset(GuildListScrollFrame) for i=1, GUILDMEMBERS_TO_DISPLAY, 1 do @@ -70,7 +70,7 @@ pfUI:RegisterModule("socialmod", function () end do -- add colors to friend list - hooksecurefunc("FriendsList_Update", function() + pfUI.hooksecurefunc("FriendsList_Update", function() if GetNumFriends() == 0 then return end local playerzone = GetRealZoneText() @@ -123,7 +123,7 @@ pfUI:RegisterModule("socialmod", function () end do -- add colors to who list - hooksecurefunc("WhoList_Update", function() + pfUI.hooksecurefunc("WhoList_Update", function() local num, max = GetNumWhoResults() local off = FauxScrollFrame_GetOffset(WhoListScrollFrame) diff --git a/modules/thirdparty-vanilla.lua b/modules/thirdparty-vanilla.lua index 135d5567..45d702c7 100644 --- a/modules/thirdparty-vanilla.lua +++ b/modules/thirdparty-vanilla.lua @@ -530,7 +530,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function() end -- replace wim class colors with pfUI ones - hooksecurefunc("WIM_InitClassProps", function() + pfUI.hooksecurefunc("WIM_InitClassProps", function() for class in pairs(PFUI_CLASS_COLORS) do local wimclass = _G[format("WIM_LOCALIZED_%s",class)] local colorstr = "|c" .. PFUI_CLASS_COLORS[class].colorStr @@ -547,7 +547,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function() btnClose:SetWidth(13) btnClose:SetHeight(13) end - hooksecurefunc("WIM_Icon_DropDown_Update", function() + pfUI.hooksecurefunc("WIM_Icon_DropDown_Update", function() for i=1,_G.WIM_MaxMenuCount do local btn = _G["WIM_ConversationMenuTellButton"..i] if i==1 and btn:IsEnabled() == 0 then return end @@ -729,7 +729,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function() SkinScrollbar(WIM_HelpScrollFrameScrollBar) end - hooksecurefunc("WIM_WindowOnShow", function() + pfUI.hooksecurefunc("WIM_WindowOnShow", function() if this.backdrop then return end -- already skinned local windowname = this:GetName() @@ -904,7 +904,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function() end -- trigger the event whenever SuperMacro got an update - hooksecurefunc("SM_UpdateActionSpell", function() + pfUI.hooksecurefunc("SM_UpdateActionSpell", function() for slot=1,120 do pfUI.bars.update[slot] = true end end) end) @@ -922,7 +922,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function() pfUI.bars.skip_macro = true -- send clevermacro events to pfUI actionbars - hooksecurefunc("ActionButton_OnEvent", function(event) + pfUI.hooksecurefunc("ActionButton_OnEvent", function(event) events(this, event) end) end) diff --git a/modules/turtle-wow.lua b/modules/turtle-wow.lua index 69935a39..e123a5f2 100644 --- a/modules/turtle-wow.lua +++ b/modules/turtle-wow.lua @@ -65,14 +65,14 @@ pfUI:RegisterModule("turtle-wow", function () HookAddonOrVariable("GroupFrame", function() -- After Turtle's own init, hide frames if pfUI handles them - hooksecurefunc("GroupFrame_Toggle", function() + pfUI.hooksecurefunc("GroupFrame_Toggle", function() if pfUIHandlesGroupOrRaid() then DisableTurtleGroupFrames() end end) -- After every group/raid update, re-hide if pfUI handles them - hooksecurefunc("GroupFrame_Update", function() + pfUI.hooksecurefunc("GroupFrame_Update", function() if pfUIHandlesGroupOrRaid() then DisableTurtleGroupFrames() end @@ -353,7 +353,7 @@ pfUI:RegisterModule("turtle-wow", function () local initialized = false HookAddonOrVariable("Blizzard_InspectUI", function() - hooksecurefunc("InspectFrame_Show", function() + pfUI.hooksecurefunc("InspectFrame_Show", function() -- break if theres nothing left to do if initialized then return end diff --git a/modules/unusable.lua b/modules/unusable.lua index 5d39631e..6fe7e13f 100644 --- a/modules/unusable.lua +++ b/modules/unusable.lua @@ -41,12 +41,12 @@ pfUI:RegisterModule("unusable", function () end -- update on regular pfUI button updates - hooksecurefunc(pfUI.bag, "UpdateSlot", function(self, bag, slot) + pfUI.hooksecurefunc(pfUI.bag, "UpdateSlot", function(self, bag, slot) pfUI.unusable:UpdateSlot(bag, slot) end) -- update on bank frame itemlock updates - hooksecurefunc("BankFrameItemButton_UpdateLock", function() + pfUI.hooksecurefunc("BankFrameItemButton_UpdateLock", function() pfUI.unusable:UpdateSlot(-1, this:GetID()) end) end) diff --git a/pfUI.lua b/pfUI.lua index 1d774ccd..06d2d7d8 100644 --- a/pfUI.lua +++ b/pfUI.lua @@ -99,7 +99,6 @@ pfUI.skins = {} pfUI.environment = {} pfUI.movables = {} pfUI.version = {} -pfUI.hooks = {} pfUI.env = {} pfUI.events = Mixin({}, CallbackRegistryMixin) diff --git a/skins/blizzard/auction.lua b/skins/blizzard/auction.lua index d1bb2711..7b052dfe 100644 --- a/skins/blizzard/auction.lua +++ b/skins/blizzard/auction.lua @@ -12,7 +12,7 @@ pfUI:RegisterSkin("Auctionhouse", function () SkinArrowButton(AuctionsNextPageButton, "right", 18) end - hooksecurefunc("AuctionFrame_OnShow", function() + pfUI.hooksecurefunc("AuctionFrame_OnShow", function() AuctionFrame:ClearAllPoints() AuctionFrame:SetPoint("TOPLEFT", 10, -104) end) @@ -76,7 +76,7 @@ pfUI:RegisterSkin("Auctionhouse", function () item:SetPoint("LEFT", 2, 0) end end - hooksecurefunc("AuctionFrameBrowse_Update", function() + pfUI.hooksecurefunc("AuctionFrameBrowse_Update", function() for i = 1, NUM_BROWSE_TO_DISPLAY do HandleIcon(_G["BrowseButton"..i.."Item"], _G["BrowseButton"..i.."ItemIconTexture"]) end @@ -145,7 +145,7 @@ pfUI:RegisterSkin("Auctionhouse", function () item:ClearAllPoints() item:SetPoint("LEFT", 2, 0) end - hooksecurefunc("AuctionFrameBid_Update", function() + pfUI.hooksecurefunc("AuctionFrameBid_Update", function() for i = 1, NUM_BIDS_TO_DISPLAY do HandleIcon(_G["BidButton"..i.."Item"], _G["BidButton"..i.."ItemIconTexture"]) end @@ -191,14 +191,14 @@ pfUI:RegisterSkin("Auctionhouse", function () item:ClearAllPoints() item:SetPoint("LEFT", 2, 0) end - hooksecurefunc("AuctionFrameAuctions_Update", function() + pfUI.hooksecurefunc("AuctionFrameAuctions_Update", function() for i = 1, NUM_AUCTIONS_TO_DISPLAY do HandleIcon(_G["AuctionsButton"..i.."Item"], _G["AuctionsButton"..i.."ItemIconTexture"]) end end) SkinButton(AuctionsItemButton) - hooksecurefunc("AuctionSellItemButton_OnEvent", function() + pfUI.hooksecurefunc("AuctionSellItemButton_OnEvent", function() if event ~= "NEW_AUCTION_UPDATE" then return end HandleIcon(AuctionsItemButton, AuctionsItemButton:GetNormalTexture()) end) diff --git a/skins/blizzard/battlefield_minimap.lua b/skins/blizzard/battlefield_minimap.lua index 403cc5c5..2c4cf869 100644 --- a/skins/blizzard/battlefield_minimap.lua +++ b/skins/blizzard/battlefield_minimap.lua @@ -19,7 +19,7 @@ pfUI:RegisterSkin("Battlefield Minimap", function () BattlefieldMinimapTab:Hide() end) - hooksecurefunc("BattlefieldMinimap_ShowOpacity", function() + pfUI.hooksecurefunc("BattlefieldMinimap_ShowOpacity", function() OpacityFrame:ClearAllPoints() OpacityFrame:SetPoint("TOPRIGHT", "BattlefieldMinimap", "TOPLEFT", -2*border, 0) end) diff --git a/skins/blizzard/character.lua b/skins/blizzard/character.lua index cb509e13..d10f7b81 100644 --- a/skins/blizzard/character.lua +++ b/skins/blizzard/character.lua @@ -136,18 +136,18 @@ pfUI:RegisterSkin("Character", function () end end - hooksecurefunc("CharacterFrame_OnShow", function() + pfUI.hooksecurefunc("CharacterFrame_OnShow", function() RefreshCharacterSlots() RefreshPetPosition() end) - hooksecurefunc("PaperDollItemSlotButton_Update", function() + pfUI.hooksecurefunc("PaperDollItemSlotButton_Update", function() if this:GetParent() == PaperDollFrame then RefreshCharacterSlot(this) end end) - hooksecurefunc("PetTab_Update", RefreshPetPosition) + pfUI.hooksecurefunc("PetTab_Update", RefreshPetPosition) StripTextures(PaperDollFrame) StripTextures(CharacterAttributesFrame) @@ -270,7 +270,7 @@ pfUI:RegisterSkin("Character", function () -- the FactionStanding text from `bar.standingText` on mouseout, so we -- stash our augmented text there too — otherwise hovering a bar strips -- the "(N)" suffix off. - hooksecurefunc("ReputationFrame_Update", function() + pfUI.hooksecurefunc("ReputationFrame_Update", function() if C.character.reputation.repRequired ~= "1" then return end local offset = FauxScrollFrame_GetOffset(ReputationListScrollFrame) for i = 1, NUM_FACTIONS_DISPLAYED do diff --git a/skins/blizzard/friends.lua b/skins/blizzard/friends.lua index 53973c6a..2f649f42 100644 --- a/skins/blizzard/friends.lua +++ b/skins/blizzard/friends.lua @@ -150,7 +150,7 @@ pfUI:RegisterSkin("Friends", function () end -- set positions - hooksecurefunc("WhoList_Update", function() + pfUI.hooksecurefunc("WhoList_Update", function() for i = 1, WHOS_TO_DISPLAY do local level = _G["WhoFrameButton"..i.."Level"] level:ClearAllPoints() @@ -231,7 +231,7 @@ pfUI:RegisterSkin("Friends", function () end -- set positions - hooksecurefunc("GuildStatus_Update", function() + pfUI.hooksecurefunc("GuildStatus_Update", function() for i = 1, GUILDMEMBERS_TO_DISPLAY do local level = _G["GuildFrameButton"..i.."Level"] level:ClearAllPoints() diff --git a/skins/blizzard/gossipquest.lua b/skins/blizzard/gossipquest.lua index 98be46c9..369cd989 100644 --- a/skins/blizzard/gossipquest.lua +++ b/skins/blizzard/gossipquest.lua @@ -24,11 +24,11 @@ pfUI:RegisterSkin("Gossip and Quest", function () QuestRewardItemHighlightBG:SetTexture(1,1,1,.2) QuestRewardItemHighlightBG:SetAllPoints() - hooksecurefunc("QuestFrameItems_Update", function() + pfUI.hooksecurefunc("QuestFrameItems_Update", function() QuestRewardItemHighlight:Hide() end) - hooksecurefunc("QuestRewardItem_OnClick", function() + pfUI.hooksecurefunc("QuestRewardItem_OnClick", function() if this.type == "choice" then QuestRewardItemHighlight:SetAllPoints(this.backdrop) QuestRewardItemHighlight:Show() diff --git a/skins/blizzard/mail.lua b/skins/blizzard/mail.lua index d4d00856..0442fd49 100644 --- a/skins/blizzard/mail.lua +++ b/skins/blizzard/mail.lua @@ -12,7 +12,7 @@ pfUI:RegisterSkin("Mailbox", function () StripTextures(SendMailPackageButton) SkinButton(SendMailPackageButton, nil, nil, nil, nil, true) - hooksecurefunc("SendMailFrame_Update", function() + pfUI.hooksecurefunc("SendMailFrame_Update", function() HandleIcon(SendMailPackageButton, SendMailPackageButton:GetNormalTexture()) local _, itemID = GetSendMailItemLink() @@ -62,7 +62,7 @@ pfUI:RegisterSkin("Mailbox", function () do -- OpenMailFrame SkinButton(OpenMailPackageButton, nil, nil, nil, OpenMailPackageButtonIconTexture) - hooksecurefunc("InboxFrame_OnClick", function(index) + pfUI.hooksecurefunc("InboxFrame_OnClick", function(index) local _, itemID = GetInboxItemLink(index) if itemID then local quality = C_Item.GetItemQualityByID(itemID) diff --git a/skins/blizzard/merchant.lua b/skins/blizzard/merchant.lua index eed86a3f..e220da3b 100644 --- a/skins/blizzard/merchant.lua +++ b/skins/blizzard/merchant.lua @@ -6,7 +6,7 @@ pfUI:RegisterSkin("Merchant", function () if MerchantGuildBankRepairButton then -- tbc SkinButton(MerchantGuildBankRepairButton, nil, nil, nil, MerchantGuildBankRepairButtonIcon) MerchantGuildBankRepairButtonIcon:SetTexCoord(.59, .82, .06, .54) - hooksecurefunc("MerchantFrame_UpdateRepairButtons", function() + pfUI.hooksecurefunc("MerchantFrame_UpdateRepairButtons", function() MerchantGuildBankRepairButton:ClearAllPoints() MerchantGuildBankRepairButton:SetPoint("RIGHT", MerchantBuyBackItemItemButton, "LEFT", -14, 0) MerchantRepairAllButton:ClearAllPoints() @@ -56,7 +56,7 @@ pfUI:RegisterSkin("Merchant", function () moneyFrame:SetPoint("BOTTOMLEFT", itemButton, "BOTTOMRIGHT", 5, 1) end - hooksecurefunc("MerchantFrame_UpdateMerchantInfo", function() + pfUI.hooksecurefunc("MerchantFrame_UpdateMerchantInfo", function() if MerchantFrame.selectedTab == 1 then for i = 3, 11, 2 do _G["MerchantItem"..i]:ClearAllPoints() diff --git a/skins/blizzard/options-new.lua b/skins/blizzard/options-new.lua index 6cacba80..67928230 100644 --- a/skins/blizzard/options-new.lua +++ b/skins/blizzard/options-new.lua @@ -184,7 +184,7 @@ pfUI:RegisterSkin("Options - New", function () end -- hook after category selection: UpdateOptions is local so we hook its caller - hooksecurefunc("OptionsListButton_OnClick", SkinControls) + pfUI.hooksecurefunc("OptionsListButton_OnClick", SkinControls) -- also cover initial load HookScript(OptionsFrame, "OnShow", SkinControls) end) \ No newline at end of file diff --git a/skins/blizzard/options-video.lua b/skins/blizzard/options-video.lua index 99e03a9d..b91e6ec0 100644 --- a/skins/blizzard/options-video.lua +++ b/skins/blizzard/options-video.lua @@ -19,7 +19,7 @@ pfUI:RegisterSkin("Options - Video", function () slider:SetPoint(point, anchor, anchorPoint, x, y - shift) end - hooksecurefunc("OptionsFrame_Load", function() + pfUI.hooksecurefunc("OptionsFrame_Load", function() OptionsFramePixelShaders:SetWidth(230) OptionsFrameMiscellaneous:ClearAllPoints() OptionsFrameMiscellaneous:SetPoint("LEFT", OptionsFramePixelShaders, "RIGHT", 6, 0) diff --git a/skins/blizzard/professions.lua b/skins/blizzard/professions.lua index 5608ac14..6ca9f4ae 100644 --- a/skins/blizzard/professions.lua +++ b/skins/blizzard/professions.lua @@ -192,7 +192,7 @@ pfUI:RegisterSkin("Profession", function () reagentlabel:SetTextColor(1,1,1,1) local scanner = libtipscan:GetScanner(name) - hooksecurefunc(SetSelection, function(id) + pfUI.hooksecurefunc(SetSelection, function(id) if id and id ~= 0 then detailscroll:Show() HandleIcon(icon, icon:GetNormalTexture()) diff --git a/skins/blizzard/questlog.lua b/skins/blizzard/questlog.lua index ba9037fc..c4756ed0 100644 --- a/skins/blizzard/questlog.lua +++ b/skins/blizzard/questlog.lua @@ -13,7 +13,7 @@ pfUI:RegisterSkin("Quest Log", function () StripTextures(QUEST_COUNT) QUEST_COUNT:ClearAllPoints() - hooksecurefunc("QuestLogUpdateQuestCount", function(numQuests) + pfUI.hooksecurefunc("QuestLogUpdateQuestCount", function(numQuests) QUEST_COUNT:ClearAllPoints() QUEST_COUNT:SetPoint("BOTTOMRIGHT", QuestLogFrame, "TOPRIGHT", 0, -50) end) @@ -24,7 +24,7 @@ pfUI:RegisterSkin("Quest Log", function () QUEST_COUNT:SetPoint("TOPRIGHT", -10, -30) end - hooksecurefunc("QuestLog_OnShow", function() + pfUI.hooksecurefunc("QuestLog_OnShow", function() QuestLogFrame:ClearAllPoints() QuestLogFrame:SetPoint("TOPLEFT", 10, -104) end) @@ -163,7 +163,7 @@ pfUI:RegisterSkin("Quest Log", function () QuestLogListScrollFrame:SetPoint("TOPLEFT", 10, -54) QuestLogListScrollFrame:SetHeight(350) - hooksecurefunc("QuestLog_Update", function() + pfUI.hooksecurefunc("QuestLog_Update", function() local numEntries = GetNumQuestLogEntries() local questIndex, text, level, questTag, isHeader diff --git a/skins/blizzard/readycheck.lua b/skins/blizzard/readycheck.lua index 30212ce3..2340774d 100644 --- a/skins/blizzard/readycheck.lua +++ b/skins/blizzard/readycheck.lua @@ -38,12 +38,12 @@ pfUI:RegisterSkin("Readycheck", function () frame.bar.text:SetPoint("CENTER", 0, 0) local max - hooksecurefunc("ShowReadyCheck", function() + pfUI.hooksecurefunc("ShowReadyCheck", function() max = ReadyCheckFrame.timer frame.bar:SetMinMaxValues(0, max) end) - hooksecurefunc(update_func, function() + pfUI.hooksecurefunc(update_func, function() if not ReadyCheckFrame.timer then return end local perc = ReadyCheckFrame.timer/max diff --git a/skins/blizzard/survey.lua b/skins/blizzard/survey.lua index cc36aca3..c0a39400 100644 --- a/skins/blizzard/survey.lua +++ b/skins/blizzard/survey.lua @@ -32,7 +32,7 @@ pfUI:RegisterSkin("GM Survey", function () CreateBackdrop(GMSurveyCommentFrame, nil, true, .75) SkinScrollbar(GMSurveyCommentScrollFrameScrollBar) GMSurveyFrameComment:SetMaxLetters(2000) - hooksecurefunc("GMSurveyFrame_Update", function() + pfUI.hooksecurefunc("GMSurveyFrame_Update", function() GMSurveyFrameComment:SetWidth(505) end) end) diff --git a/skins/blizzard/trade.lua b/skins/blizzard/trade.lua index 7fdbc8d7..03f92889 100644 --- a/skins/blizzard/trade.lua +++ b/skins/blizzard/trade.lua @@ -41,7 +41,7 @@ pfUI:RegisterSkin("Trade", function () RecipientButtonBG:SetAllPoints() end - hooksecurefunc("TradeFrame_UpdateTargetItem", function(id) + pfUI.hooksecurefunc("TradeFrame_UpdateTargetItem", function(id) HandleIcon(_G["TradeRecipientItem"..id.."ItemButton"], _G["TradeRecipientItem"..id..'IconTexture']) end) diff --git a/skins/blizzard/trainer.lua b/skins/blizzard/trainer.lua index aebc9028..467da1b9 100644 --- a/skins/blizzard/trainer.lua +++ b/skins/blizzard/trainer.lua @@ -36,7 +36,7 @@ pfUI:RegisterSkin("Trainer", function () StripTextures(ClassTrainerSkillIcon) SkinButton(ClassTrainerSkillIcon, nil, nil, nil, nil, true) - hooksecurefunc("ClassTrainer_SetSelection", function() + pfUI.hooksecurefunc("ClassTrainer_SetSelection", function() HandleIcon(ClassTrainerSkillIcon, ClassTrainerSkillIcon:GetNormalTexture()) end)