mirror of
https://github.com/brues-code/pfUI.git
synced 2026-11-01 00:16:56 +00:00
Replace HookAddonOrVariable with an EventUtil-based HookAddon
The polling lurker frame is gone. HookAddon gates on C_AddOns.DoesAddOnExist, waits for PLAYER_LOGIN with EventUtil.ContinueOnPlayerLogin, then runs on EventUtil.ContinueOnAddOnLoaded. Addons loaded at startup still hook only after every pfUI module and skin exists and after the addon's own VARIABLES_LOADED setup. Load-on-demand addons still hook on their ADDON_LOADED. The "or variable" form is gone. Callers that passed a global now pass the addon that defines it: TheoryCraft, SuperMacro, DPSMate and Turtle_GroupUI. DPSMate names its windows from its settings, so its hook now checks for DPSMate_DPSMate itself, as the variable lookup used to. eqcompare's Guda check uses HookAddon too.
This commit is contained in:
@@ -135,11 +135,9 @@ pfUI:RegisterModule("eqcompare", function ()
|
||||
-- spot. Reading the rect inside the Set* call picks the side against the
|
||||
-- position the tooltip is about to leave, so place the compare a frame later.
|
||||
local deferred
|
||||
if C_AddOns.DoesAddOnExist("Guda") then
|
||||
EventUtil.ContinueOnAddOnLoaded("Guda", function()
|
||||
deferred = true
|
||||
end)
|
||||
end
|
||||
HookAddon("Guda", function()
|
||||
deferred = true
|
||||
end)
|
||||
|
||||
local function makeHook(getter)
|
||||
return function(tooltip, arg1, arg2, arg3)
|
||||
|
||||
+1
-1
@@ -456,7 +456,7 @@ pfUI:RegisterSkin("Friends", function ()
|
||||
end
|
||||
|
||||
-- all RaidFrame buttons are in Blizzard_RaidUI in Turtle WoW
|
||||
HookAddonOrVariable("Blizzard_RaidUI", function()
|
||||
HookAddon("Blizzard_RaidUI", function()
|
||||
if RaidFrameRaidInfoButton then SkinButton(RaidFrameRaidInfoButton) end
|
||||
if RaidFrameConvertToRaidButton then SkinButton(RaidFrameConvertToRaidButton) end
|
||||
if RaidFrameReadyCheckButton then SkinButton(RaidFrameReadyCheckButton) end
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
-- on both the modern (Turtle/Octo) and stock-vanilla macro UIs. The surrounding
|
||||
-- MacroFrame (list + body editor) is Blizzard's, already skinned elsewhere.
|
||||
pfUI:RegisterModule("macroicons", function ()
|
||||
HookAddonOrVariable("Blizzard_MacroUI", function()
|
||||
HookAddon("Blizzard_MacroUI", function()
|
||||
-- ============================================================
|
||||
-- Popup frame
|
||||
-- ============================================================
|
||||
|
||||
@@ -138,7 +138,7 @@ pfUI:RegisterModule("mapcolors", function ()
|
||||
end
|
||||
|
||||
-- BattlefieldMinimap
|
||||
HookAddonOrVariable("Blizzard_BattlefieldMinimap", function()
|
||||
HookAddon("Blizzard_BattlefieldMinimap", function()
|
||||
Initialize('BattlefieldMinimap')
|
||||
|
||||
hooksecurefunc('BattlefieldMinimap_OnUpdate', function()
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ pfUI:RegisterModule("raid", function ()
|
||||
if C.unitframes.disable == "1" then return end
|
||||
|
||||
-- tell RaidFrame.lua pfUI replaces party frames
|
||||
HookAddonOrVariable("Blizzard_RaidUI", function()
|
||||
HookAddon("Blizzard_RaidUI", function()
|
||||
-- must reach _G: RaidFrame.lua reads this global, and pfUI.env has
|
||||
-- __index but no __newindex, so a bare assignment stays in the sandbox
|
||||
_G.GROUP_REPLACE_PARTY = "1"
|
||||
|
||||
@@ -3,7 +3,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
if not pfUI.thirdparty then return end
|
||||
local rawborder, default_border = GetBorderSize()
|
||||
|
||||
HookAddonOrVariable("KLHThreatMeter", function()
|
||||
HookAddon("KLHThreatMeter", function()
|
||||
local ktm_scale = 1
|
||||
local function GetKtmWidthDiff(view, match_size)
|
||||
local default_width = 0
|
||||
@@ -159,7 +159,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
end
|
||||
end)
|
||||
|
||||
HookAddonOrVariable("TWThreat", function()
|
||||
HookAddon("TWThreat", function()
|
||||
local docktable = { "twt", "TODO", "TWTMain",
|
||||
function() -- single
|
||||
TWTMain:ClearAllPoints()
|
||||
@@ -232,7 +232,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
end
|
||||
end)
|
||||
|
||||
HookAddonOrVariable("SW_Stats", function()
|
||||
HookAddon("SW_Stats", function()
|
||||
local docktable = { "swstats", "TODO", "SW_BarFrame1",
|
||||
function() -- single
|
||||
SW_BarFrame1:SetWidth(pfUI.chat.right:GetWidth())
|
||||
@@ -518,7 +518,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
end
|
||||
end)
|
||||
|
||||
HookAddonOrVariable("WIM", function()
|
||||
HookAddon("WIM", function()
|
||||
if C.thirdparty.wim.enable == "0" then return end
|
||||
|
||||
-- use pfUI link handler if available
|
||||
@@ -798,7 +798,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
|
||||
-- SortBags
|
||||
-- Vanilla: https://github.com/shirsig/SortBags-vanilla
|
||||
HookAddonOrVariable("SortBags", function()
|
||||
HookAddon("SortBags", function()
|
||||
if C.thirdparty.sortbags.enable == "0" then return end
|
||||
|
||||
local sort = CreateFrame("Frame", nil)
|
||||
@@ -828,7 +828,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
end)
|
||||
end)
|
||||
|
||||
HookAddonOrVariable("FlightMap", function()
|
||||
HookAddon("FlightMap", function()
|
||||
if C.thirdparty.flightmap.enable == "0" then return end
|
||||
|
||||
FlightMapTimesBorder:Hide()
|
||||
@@ -844,7 +844,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
FlightMapTimesText:SetFont(pfUI.font_default, 12, "OUTLINE")
|
||||
end)
|
||||
|
||||
HookAddonOrVariable("TheoryCraft_SetUpButton", function()
|
||||
HookAddon("TheoryCraft", function()
|
||||
if C.thirdparty.theorycraft.enable == "0" then return end
|
||||
|
||||
-- set pfUI bar font
|
||||
@@ -862,7 +862,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
end
|
||||
end)
|
||||
|
||||
HookAddonOrVariable("SM_GetActionSpell", function()
|
||||
HookAddon("SuperMacro", function()
|
||||
if C.thirdparty.supermacro.enable == "0" then return end
|
||||
if not pfUI.bars then return end
|
||||
|
||||
@@ -908,7 +908,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
|
||||
-- CleverMacro
|
||||
-- https://github.com/DanielAdolfsson/CleverMacro
|
||||
HookAddonOrVariable("CleverMacro", function()
|
||||
HookAddon("CleverMacro", function()
|
||||
if C.thirdparty.clevermacro.enable == "0" then return end
|
||||
|
||||
-- get pfUI actionbar event handler
|
||||
@@ -925,7 +925,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
end)
|
||||
|
||||
-- SuperCleveRoidMacros
|
||||
HookAddonOrVariable("SuperCleveRoidMacros", function()
|
||||
HookAddon("SuperCleveRoidMacros", function()
|
||||
if C.thirdparty.supercleveroidmacros.enable == "0" then return end
|
||||
if not pfUI.bars then return end
|
||||
|
||||
@@ -933,7 +933,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
pfUI.bars.skip_macro = true
|
||||
end)
|
||||
|
||||
HookAddonOrVariable("AtlasLoot", function()
|
||||
HookAddon("AtlasLoot", function()
|
||||
if C.thirdparty.atlasloot.enable == "0" then return end
|
||||
|
||||
CreateBackdrop(AtlasLootTooltip)
|
||||
@@ -948,7 +948,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
end
|
||||
end)
|
||||
|
||||
HookAddonOrVariable("crafty", function()
|
||||
HookAddon("crafty", function()
|
||||
if C.thirdparty.crafty.enable == "0" then return end
|
||||
|
||||
local craftyskin = CreateFrame("Frame", nil, UIParent)
|
||||
@@ -1011,7 +1011,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
end)
|
||||
end)
|
||||
|
||||
HookAddonOrVariable("BetterCharacterStats", function()
|
||||
HookAddon("BetterCharacterStats", function()
|
||||
if C.thirdparty.bcs.enable == "0" then return end
|
||||
StripTextures(BetterCharacterAttributesFrame)
|
||||
|
||||
@@ -1028,7 +1028,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
end
|
||||
end)
|
||||
|
||||
HookAddonOrVariable("MyRolePlay", function()
|
||||
HookAddon("MyRolePlay", function()
|
||||
if C.thirdparty.myroleplay.enable == "0" then return end
|
||||
|
||||
if pfUI.uf.target then
|
||||
@@ -1053,7 +1053,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
end
|
||||
end)
|
||||
|
||||
HookAddonOrVariable("DruidManaBarBackground", function()
|
||||
HookAddon("DruidManaBarBackground", function()
|
||||
if C.thirdparty.druidmana.enable == "0" then return end
|
||||
DruidManaBar:SetParent(UIParent)
|
||||
DruidManaBar.bd:Hide()
|
||||
@@ -1082,7 +1082,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
UpdateMovable(DruidManaBar)
|
||||
end)
|
||||
|
||||
HookAddonOrVariable("NoteIt", function()
|
||||
HookAddon("NoteIt", function()
|
||||
if C.thirdparty.noteit.enable == "0" then return end
|
||||
|
||||
-- Main window
|
||||
@@ -1178,15 +1178,15 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
pfUI.api.libpredict.sender.enabled = nil
|
||||
end
|
||||
end
|
||||
HookAddonOrVariable("HealComm", EnableHealComm)
|
||||
HookAddonOrVariable("LunaUnitFrames", EnableHealComm)
|
||||
HookAddonOrVariable("NotGrid", EnableHealComm)
|
||||
HookAddon("HealComm", EnableHealComm)
|
||||
HookAddon("LunaUnitFrames", EnableHealComm)
|
||||
HookAddon("NotGrid", EnableHealComm)
|
||||
|
||||
HookAddonOrVariable("HardcoreDeath", function()
|
||||
HookAddon("HardcoreDeath", function()
|
||||
GameMenuFrame:SetHeight(GameMenuFrame:GetHeight() + 20)
|
||||
end)
|
||||
|
||||
HookAddonOrVariable("MacroExtender", function()
|
||||
HookAddon("MacroExtender", function()
|
||||
-- Macro Extender moves the character dialog from frame-stata "dialog"
|
||||
-- to "low" and by that moves the frame below backgrounds, quest-trackers,
|
||||
-- and what not... it does this because the buttons it attempts to add, are
|
||||
@@ -1208,7 +1208,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
|
||||
-- UnitXP SP3 compatibility
|
||||
-- https://github.com/allfoxwy/UnitXP_SP3
|
||||
HookAddonOrVariable("UnitXP_SP3_Addon", function()
|
||||
HookAddon("UnitXP_SP3_Addon", function()
|
||||
-- skin UnitXP SP3 window and elements
|
||||
StripTextures(xpsp3Frame)
|
||||
CreateBackdrop(xpsp3Frame)
|
||||
|
||||
@@ -139,7 +139,7 @@ pfUI:RegisterModule("thirdparty", function()
|
||||
-- MrPlow Bag Sorting Addon.
|
||||
-- Vanilla: https://www.wowace.com/projects/mr-plow/files/288059
|
||||
-- TBC: https://www.wowace.com/projects/mr-plow/files/136162
|
||||
HookAddonOrVariable("MrPlow", function()
|
||||
HookAddon("MrPlow", function()
|
||||
if C.thirdparty.mrplow.enable == "0" then return end
|
||||
|
||||
local sort = CreateFrame("Frame", nil)
|
||||
@@ -175,7 +175,7 @@ pfUI:RegisterModule("thirdparty", function()
|
||||
-- ShaguDPS Damage Meter
|
||||
-- Vanilla: https://github.com/shagu/ShaguDPS
|
||||
-- TBC: https://github.com/shagu/ShaguDPS
|
||||
HookAddonOrVariable("ShaguDPS", function()
|
||||
HookAddon("ShaguDPS", function()
|
||||
local docktable = { "shagudps", "ShaguDPS", "ShaguDPSWindow",
|
||||
function() -- single
|
||||
ShaguDPSWindow:ClearAllPoints()
|
||||
@@ -280,7 +280,7 @@ pfUI:RegisterModule("thirdparty", function()
|
||||
-- dock slot; a second window (GreedMeter.UI.frames[2]) takes the "threat"
|
||||
-- slot so the two tile the panel side-by-side. Docking triggers a
|
||||
-- LayoutBars/RefreshFrame so the bars refit the new width.
|
||||
HookAddonOrVariable("GreedMeter", function()
|
||||
HookAddon("GreedMeter", function()
|
||||
local UI = GreedMeter.UI
|
||||
|
||||
local function frameAt(i)
|
||||
@@ -373,7 +373,12 @@ pfUI:RegisterModule("thirdparty", function()
|
||||
-- DPSMate Damage Meter
|
||||
-- Vanilla: https://github.com/Geigerkind/DPSMate
|
||||
-- TBC: https://github.com/Geigerkind/DPSMateTBC
|
||||
HookAddonOrVariable("DPSMate_DPSMate", function()
|
||||
HookAddon("DPSMate", function()
|
||||
-- DPSMate builds its windows on VARIABLES_LOADED, each named after its
|
||||
-- settings entry, so DPSMate_DPSMate exists only while the first window
|
||||
-- keeps the default name "DPSMate"
|
||||
if not DPSMate_DPSMate then return end
|
||||
|
||||
local docktable = { "dpsmate", "DPSMate", "DPSMate_DPSMate",
|
||||
function() -- single
|
||||
DPSMate_DPSMate:ClearAllPoints()
|
||||
|
||||
@@ -61,7 +61,7 @@ pfUI:RegisterModule("turtle-wow", function ()
|
||||
end
|
||||
end
|
||||
|
||||
HookAddonOrVariable("GroupFrame", function()
|
||||
HookAddon("Turtle_GroupUI", function()
|
||||
-- After Turtle's own init, hide frames if pfUI handles them
|
||||
hooksecurefunc("GroupFrame_Toggle", function()
|
||||
if pfUIHandlesGroupOrRaid() then
|
||||
@@ -268,7 +268,7 @@ pfUI:RegisterModule("turtle-wow", function ()
|
||||
if pfUI.skin["Inspect"] and pfUI_config["disabled"]["skin_Inspect"] ~= "1" then
|
||||
local initialized = false
|
||||
|
||||
HookAddonOrVariable("Blizzard_InspectUI", function()
|
||||
HookAddon("Blizzard_InspectUI", function()
|
||||
hooksecurefunc("InspectFrame_Show", function()
|
||||
-- break if theres nothing left to do
|
||||
if initialized then return end
|
||||
@@ -326,7 +326,7 @@ pfUI:RegisterModule("turtle-wow", function ()
|
||||
end
|
||||
|
||||
-- rearrange twow's profession window additions
|
||||
HookAddonOrVariable("Blizzard_TradeSkillUI", function()
|
||||
HookAddon("Blizzard_TradeSkillUI", function()
|
||||
if TradeSkillSkillCheckButton and pfUI.skin["Profession"] and pfUI_config["disabled"]["skin_Profession"] ~= "1" then
|
||||
SkinCheckbox(TradeSkillSkillCheckButton)
|
||||
TradeSkillSkillCheckButton:SetWidth(24)
|
||||
@@ -348,7 +348,7 @@ pfUI:RegisterModule("turtle-wow", function ()
|
||||
end)
|
||||
|
||||
if C.disabled["macroicons"] == "1" then
|
||||
HookAddonOrVariable("Blizzard_MacroUI", function()
|
||||
HookAddon("Blizzard_MacroUI", function()
|
||||
if type(UpdateMacroIconFilenames) ~= "function" then return end
|
||||
function _G.UpdateMacroIconFilenames()
|
||||
wipe(MACRO_ICON_FILENAMES)
|
||||
|
||||
Reference in New Issue
Block a user