mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
2ce4d11698
Replace hand-rolled ADDON_LOADED/PLAYER_LOGIN handlers with
EventUtil.ContinueOnAddOnLoaded / ContinueOnPlayerLogin, which fire
immediately if the event already happened -- removing the "we loaded before
the target addon and missed its ADDON_LOADED" workarounds.
- pfUI compat: ContinueOnAddOnLoaded("pfUI") + ContinueOnPlayerLogin; drops
the missed-event fallback (login path still re-runs SetupCompatibility).
- MacroErrorUI / MacroLengthWarn: ContinueOnAddOnLoaded("Blizzard_MacroUI"),
folding their manual "already loaded" checks.
- 9 Mouseover extensions (ag_UnitFrames, CT_RaidAssist, CT_UnitFrames,
DiscordUnitFrames, Grid, NotGrid, Cursive, sRaidFrames, PerfectRaid):
ContinueOnAddOnLoaded("<AddonName>", OnLoad). Since immediate-fire passes no
event args, the old `arg1 == "X"` checks are replaced by the addon-name gate
(global guards kept where present); also removes the buggy
UnregisterEvent("ADDON_LOADED", "Onload") no-ops that never fired.
Addon names match file names; drops support for renamed folders (e.g. -master).
83 lines
2.1 KiB
Lua
83 lines
2.1 KiB
Lua
--[[
|
|
Cursive mouseover support.
|
|
Hooks into Cursive's bar OnEnter/OnLeave to track mouseover unit by GUID.
|
|
Enables [@mouseover] macros when hovering over Cursive DoT timer bars.
|
|
]]
|
|
local _G = _G or getfenv(0)
|
|
local CleveRoids = _G.CleveRoids or {}
|
|
|
|
CleveRoids.Hooks = CleveRoids.Hooks or {}
|
|
|
|
local Extension = CleveRoids.RegisterExtension("CursiveMouseover")
|
|
|
|
local hooked = false
|
|
|
|
function Extension.OnEnter(guid)
|
|
if guid and guid ~= 0 then
|
|
-- SuperWoW's SetMouseoverUnit supports GUIDs directly
|
|
CleveRoids.SetMouseoverFrom("cursive", guid)
|
|
end
|
|
end
|
|
|
|
function Extension.OnLeave()
|
|
CleveRoids.ClearMouseoverFrom("cursive")
|
|
end
|
|
|
|
local function HookCursiveUI()
|
|
-- Check if Cursive and its UI module exist
|
|
if not Cursive or not Cursive.ui then
|
|
return false
|
|
end
|
|
|
|
-- Already hooked
|
|
if hooked then
|
|
return true
|
|
end
|
|
|
|
local ui = Cursive.ui
|
|
|
|
-- Hook BarEnter if it exists
|
|
if ui.BarEnter then
|
|
CleveRoids.Hooks.CursiveBarEnter = ui.BarEnter
|
|
ui.BarEnter = function()
|
|
-- Call original
|
|
CleveRoids.Hooks.CursiveBarEnter()
|
|
-- Set mouseover from the bar's parent guid
|
|
if this and this.parent and this.parent.guid then
|
|
Extension.OnEnter(this.parent.guid)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Hook BarLeave if it exists
|
|
if ui.BarLeave then
|
|
CleveRoids.Hooks.CursiveBarLeave = ui.BarLeave
|
|
ui.BarLeave = function()
|
|
-- Clear mouseover first
|
|
Extension.OnLeave()
|
|
-- Call original
|
|
CleveRoids.Hooks.CursiveBarLeave()
|
|
end
|
|
end
|
|
|
|
hooked = true
|
|
return true
|
|
end
|
|
|
|
function Extension.OnLoad()
|
|
-- Delay slightly to ensure Cursive.ui is initialized
|
|
local frame = CreateFrame("Frame")
|
|
frame:SetScript("OnUpdate", function()
|
|
if HookCursiveUI() then
|
|
this:Hide()
|
|
end
|
|
end)
|
|
end
|
|
|
|
-- Also try to hook immediately in case Cursive is already loaded
|
|
if Cursive and Cursive.ui then
|
|
HookCursiveUI()
|
|
end
|
|
|
|
EventUtil.ContinueOnAddOnLoaded("Cursive", Extension.OnLoad)
|