fix mouseover for all uis

This commit is contained in:
Jrc13245
2026-01-10 11:37:44 -05:00
parent 95e58f6d7d
commit 2058ca1fc9
4 changed files with 60 additions and 246 deletions
+23 -54
View File
@@ -3,8 +3,11 @@
License: MIT License
Dragonflight3 mouseover support.
Attempts to hook into Dragonflight3's unit frames.
The addon uses DF3 namespace and requires SuperWoW 1.5+ and UnitXP SP3.
Hooks into Dragonflight3's custom unit frames.
Dragonflight3 uses the DF global namespace.
Frame naming pattern: DF_<Unit>Frame (e.g., DF_PlayerFrame, DF_TargetFrame)
Each frame has a .unit property containing the unit ID.
]]
local _G = _G or getfenv(0)
local CleveRoids = _G.CleveRoids or {}
@@ -14,88 +17,53 @@ Extension.RegisterEvent("PLAYER_ENTERING_WORLD", "DelayedInit")
local hookedFrames = {}
function Extension.HookFrame(frame, unit)
function Extension.HookFrame(frame)
if not frame or hookedFrames[frame] then return end
local onEnter = frame:GetScript("OnEnter")
local onLeave = frame:GetScript("OnLeave")
local origOnEnter = frame:GetScript("OnEnter")
local origOnLeave = frame:GetScript("OnLeave")
frame:SetScript("OnEnter", function()
local u = unit or this.unit
local u = this.unit
if u then
CleveRoids.SetMouseoverFrom("df3", u)
end
if onEnter then onEnter() end
if origOnEnter then origOnEnter() end
end)
frame:SetScript("OnLeave", function()
CleveRoids.ClearMouseoverFrom("df3")
if onLeave then onLeave() end
if origOnLeave then origOnLeave() end
end)
hookedFrames[frame] = true
end
function Extension.HookAllFrames()
-- Dragonflight3 uses DF3 or Dragonflight3 namespace
local DF = DF3 or Dragonflight3
if not DF then return end
-- Try to find unit frames
local units = { "player", "target", "pet", "targettarget", "focus", "focustarget" }
-- Dragonflight3 frame naming: DF_<Unit>Frame
-- Unit names are capitalized: player -> Player, party1 -> Party1
local units = {
"Player", "Target", "Targettarget", "Pet", "Pettarget"
}
for _, unit in ipairs(units) do
-- Try common frame naming patterns
local frame = DF[unit] or DF["UnitFrame_" .. unit] or _G["DF3_" .. unit] or _G["DF3UnitFrame" .. unit]
local frame = _G["DF_" .. unit .. "Frame"]
if frame then
Extension.HookFrame(frame, unit)
Extension.HookFrame(frame)
end
end
-- Try party frames
-- Party frames: DF_Party1Frame through DF_Party4Frame
for i = 1, 4 do
local frame = DF["party" .. i] or _G["DF3_party" .. i] or _G["DF3PartyFrame" .. i]
local frame = _G["DF_Party" .. i .. "Frame"]
if frame then
Extension.HookFrame(frame, "party" .. i)
end
end
-- Try raid frames
for i = 1, 40 do
local frame = DF["raid" .. i] or _G["DF3_raid" .. i] or _G["DF3RaidFrame" .. i]
if frame then
Extension.HookFrame(frame, "raid" .. i)
end
end
-- If DF has a frames table, iterate through it
if DF.frames then
for unit, frame in pairs(DF.frames) do
Extension.HookFrame(frame, unit)
end
end
-- If DF has a UnitFrames table
if DF.UnitFrames then
for unit, frame in pairs(DF.UnitFrames) do
Extension.HookFrame(frame, unit)
end
end
-- Try mods directory structure (Dragonflight3 uses /mods/)
if DF.mods then
for _, mod in pairs(DF.mods) do
if mod.frames then
for unit, frame in pairs(mod.frames) do
Extension.HookFrame(frame, unit)
end
end
Extension.HookFrame(frame)
end
end
end
function Extension.DelayedInit()
local DF = DF3 or Dragonflight3
-- Check if Dragonflight3 is loaded
if not DF then
return
end
@@ -104,6 +72,7 @@ function Extension.DelayedInit()
end
function Extension.OnLoad()
-- Nothing needed here, we use DelayedInit
end
_G["CleveRoids"] = CleveRoids
+11 -80
View File
@@ -3,93 +3,24 @@
License: MIT License
DragonflightReloaded mouseover support.
Attempts to hook into DragonflightReloaded's unit frames.
NOTE: DragonflightReloaded (DFRL namespace) modifies the default Blizzard
unit frames (PlayerFrame, TargetFrame, etc.) rather than creating its own.
The Blizzard.lua extension already handles these frames with priority 3.
This extension is intentionally minimal - we just register to ensure
the extension system doesn't complain, but we don't need to hook anything.
]]
local _G = _G or getfenv(0)
local CleveRoids = _G.CleveRoids or {}
local Extension = CleveRoids.RegisterExtension("DragonflightReloaded")
Extension.RegisterEvent("PLAYER_ENTERING_WORLD", "DelayedInit")
local hookedFrames = {}
function Extension.HookFrame(frame, unit)
if not frame or hookedFrames[frame] then return end
local onEnter = frame:GetScript("OnEnter")
local onLeave = frame:GetScript("OnLeave")
frame:SetScript("OnEnter", function()
local u = unit or this.unit
if u then
CleveRoids.SetMouseoverFrom("dfr", u)
end
if onEnter then onEnter() end
end)
frame:SetScript("OnLeave", function()
CleveRoids.ClearMouseoverFrom("dfr")
if onLeave then onLeave() end
end)
hookedFrames[frame] = true
end
function Extension.HookAllFrames()
-- DragonflightReloaded uses DFR namespace
if not DFR then return end
-- Try to find unit frames in DFR namespace
local units = { "player", "target", "pet", "targettarget", "focus", "focustarget" }
for _, unit in ipairs(units) do
-- Try common frame naming patterns
local frame = DFR[unit] or DFR["UnitFrame_" .. unit] or _G["DFR_" .. unit] or _G["DFRUnitFrame" .. unit]
if frame then
Extension.HookFrame(frame, unit)
end
end
-- Try party frames
for i = 1, 4 do
local frame = DFR["party" .. i] or _G["DFR_party" .. i] or _G["DFRPartyFrame" .. i]
if frame then
Extension.HookFrame(frame, "party" .. i)
end
end
-- Try raid frames
for i = 1, 40 do
local frame = DFR["raid" .. i] or _G["DFR_raid" .. i] or _G["DFRRaidFrame" .. i]
if frame then
Extension.HookFrame(frame, "raid" .. i)
end
end
-- If DFR has a frames table, iterate through it
if DFR.frames then
for unit, frame in pairs(DFR.frames) do
Extension.HookFrame(frame, unit)
end
end
-- If DFR has a UnitFrames table
if DFR.UnitFrames then
for unit, frame in pairs(DFR.UnitFrames) do
Extension.HookFrame(frame, unit)
end
end
end
function Extension.DelayedInit()
if not DFR then
return
end
Extension.HookAllFrames()
end
function Extension.OnLoad()
-- DragonflightReloaded modifies Blizzard's default unit frames
-- (PlayerFrame, TargetFrame, PetFrame, PartyMemberFrameX)
-- These are already handled by the Blizzard.lua extension
-- No additional hooks needed!
end
_G["CleveRoids"] = CleveRoids
+11 -107
View File
@@ -3,121 +3,25 @@
License: MIT License
LunaUnitFrames mouseover support.
LunaUnitFrames already has SuperWoW integration, but we hook to ensure
our priority system works correctly with other addons.
Frame names: LUFUnit<unitName> for single units, LUFHeader<groupType> for groups
NOTE: LunaUnitFrames already has native SuperWoW integration!
It calls SetMouseoverUnit(this.unit) directly in its OnEnter handler.
This triggers the UPDATE_MOUSEOVER_UNIT event which our system picks up
as the "native" source with priority 2.
This extension is intentionally minimal - we just register to ensure
the extension system doesn't complain, but we don't need to hook anything.
]]
local _G = _G or getfenv(0)
local CleveRoids = _G.CleveRoids or {}
local Extension = CleveRoids.RegisterExtension("LunaUnitFrames")
Extension.RegisterEvent("PLAYER_ENTERING_WORLD", "DelayedInit")
-- Track which frames we've hooked
local hookedFrames = {}
function Extension.HookFrame(frame)
if not frame or hookedFrames[frame] then return end
local onEnter = frame:GetScript("OnEnter")
local onLeave = frame:GetScript("OnLeave")
frame:SetScript("OnEnter", function()
if this.unit then
CleveRoids.SetMouseoverFrom("luna", this.unit)
end
if onEnter then onEnter() end
end)
frame:SetScript("OnLeave", function()
CleveRoids.ClearMouseoverFrom("luna")
if onLeave then onLeave() end
end)
hookedFrames[frame] = true
end
function Extension.HookAllFrames()
-- Hook single unit frames
local singleUnits = { "player", "target", "pet", "pettarget", "targettarget", "targettargettarget", "focus", "focustarget" }
for _, unit in ipairs(singleUnits) do
local frame = _G["LUFUnit" .. unit]
if frame then
Extension.HookFrame(frame)
end
end
-- Hook party frames (LUFHeaderparty children)
local partyHeader = _G["LUFHeaderparty"]
if partyHeader then
for i = 1, 4 do
local frame = _G["LUFHeaderparty" .. i] or (partyHeader["unit" .. i])
if frame then
Extension.HookFrame(frame)
end
end
end
-- Hook party target frames
local partyTargetHeader = _G["LUFHeaderpartytarget"]
if partyTargetHeader then
for i = 1, 4 do
local frame = _G["LUFHeaderpartytarget" .. i]
if frame then
Extension.HookFrame(frame)
end
end
end
-- Hook party pet frames
local partyPetHeader = _G["LUFHeaderpartypet"]
if partyPetHeader then
for i = 1, 4 do
local frame = _G["LUFHeaderpartypet" .. i]
if frame then
Extension.HookFrame(frame)
end
end
end
-- Hook raid frames (LUFHeaderraid1 through LUFHeaderraid9)
for raidGroup = 1, 9 do
local raidHeader = _G["LUFHeaderraid" .. raidGroup]
if raidHeader then
for i = 1, 40 do
local frame = _G["LUFHeaderraid" .. raidGroup .. "UnitButton" .. i]
if frame then
Extension.HookFrame(frame)
end
end
end
end
end
function Extension.DelayedInit()
-- Check if LunaUF is loaded
if not LunaUF then
return
end
-- Initial hook attempt
Extension.HookAllFrames()
-- Re-hook when units are loaded/reloaded
if LunaUF.Units and LunaUF.Units.InitializeFrame then
local origInit = LunaUF.Units.InitializeFrame
LunaUF.Units.InitializeFrame = function(self, unitType)
local result = origInit(self, unitType)
-- Delay slightly to let frame be fully created
Extension.HookAllFrames()
return result
end
end
end
function Extension.OnLoad()
-- Nothing needed here, we use DelayedInit
-- LunaUnitFrames already has native SuperWoW integration
-- It calls SetMouseoverUnit(this.unit) in modules/units.lua lines 186-207
-- This is picked up by our UPDATE_MOUSEOVER_UNIT handler as "native" source
-- No hooks needed!
end
_G["CleveRoids"] = CleveRoids
+15 -5
View File
@@ -4,16 +4,18 @@
X-Perl UnitFrames mouseover support.
Hooks into X-Perl's tooltip functions to track mouseover unit.
X-Perl uses XPerl_PlayerTip(unitid) for OnEnter and XPerl_PlayerTipHide() for OnLeave.
These are global functions defined in XPerl/XPerl.lua.
]]
local _G = _G or getfenv(0)
local CleveRoids = _G.CleveRoids or {}
local Extension = CleveRoids.RegisterExtension("XPerl")
Extension.RegisterEvent("ADDON_LOADED", "OnLoad")
-- Use PLAYER_ENTERING_WORLD instead of ADDON_LOADED for reliable timing
Extension.RegisterEvent("PLAYER_ENTERING_WORLD", "DelayedInit")
-- X-Perl uses XPerl_PlayerTip(unitid) for OnEnter and XPerl_PlayerTipHide() for OnLeave
-- We hook these functions to track mouseover
-- Note: Re-entrancy is handled in Utility.lua's SetMouseoverFrom/ClearMouseoverFrom
local hooked = false
function Extension.OnEnter(unitid)
if unitid and unitid ~= "" then
@@ -25,7 +27,9 @@ function Extension.OnLeave()
CleveRoids.ClearMouseoverFrom("xperl")
end
function Extension.OnLoad()
function Extension.DelayedInit()
if hooked then return end
-- Check if X-Perl is loaded by looking for its global functions
if not XPerl_PlayerTip then
return
@@ -36,6 +40,12 @@ function Extension.OnLoad()
-- Hook the tooltip hide function
Extension.Hook("XPerl_PlayerTipHide", "OnLeave")
hooked = true
end
function Extension.OnLoad()
-- Nothing needed here, we use DelayedInit
end
_G["CleveRoids"] = CleveRoids