mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-28 18:36:01 +00:00
Update turtle-wow.lua
This commit is contained in:
+14
-55
@@ -23,21 +23,16 @@ pfUI:RegisterModule("turtle-wow", "vanilla", function ()
|
||||
-- Set GROUP_REPLACE_PARTY early so Turtle's own init can use it
|
||||
GROUP_REPLACE_PARTY = "1"
|
||||
|
||||
-- Disable Turtle GroupUI cluster frames and member frames so they
|
||||
-- cannot intercept mouse clicks meant for pfUI unit frames or nameplates.
|
||||
-- Hide Turtle GroupUI frames and disable mouse when pfUI handles group/raid.
|
||||
-- When pfUI does NOT handle them, we simply don't interfere - Turtle manages itself.
|
||||
-- Important: Do NOT unregister events - Turtle needs RAID_ROSTER_UPDATE etc.
|
||||
-- to react when group converts to raid (and vice versa).
|
||||
local function DisableTurtleGroupFrames()
|
||||
GROUP_ENABLED = "0"
|
||||
|
||||
-- Stop GroupFrame from firing events that re-show cluster frames
|
||||
GroupFrame:UnregisterAllEvents()
|
||||
GroupFrame:Hide()
|
||||
|
||||
for i = 1, 8 do
|
||||
local f = _G["GroupClusterFrame"..i]
|
||||
if f then
|
||||
f:Hide()
|
||||
f:EnableMouse(false)
|
||||
-- Disable mouse on all child member frames (Buttons with click handlers)
|
||||
for _, child in pairs({f:GetChildren()}) do
|
||||
child:EnableMouse(false)
|
||||
end
|
||||
@@ -49,62 +44,26 @@ pfUI:RegisterModule("turtle-wow", "vanilla", function ()
|
||||
end
|
||||
end
|
||||
|
||||
local function EnableTurtleGroupFrames()
|
||||
GROUP_ENABLED = "1"
|
||||
GROUP_REPLACE_PARTY = "1"
|
||||
|
||||
-- Re-enable mouse on cluster frames and their children
|
||||
for i = 1, 8 do
|
||||
local f = _G["GroupClusterFrame"..i]
|
||||
if f then
|
||||
f:EnableMouse(true)
|
||||
for _, child in pairs({f:GetChildren()}) do
|
||||
child:EnableMouse(true)
|
||||
end
|
||||
end
|
||||
-- Check if pfUI is handling group or raid for the current situation
|
||||
local function pfUIHandlesGroupOrRaid()
|
||||
if GetNumRaidMembers() > 0 then
|
||||
return C.unitframes.raid and C.unitframes.raid.visible == "1"
|
||||
else
|
||||
return C.unitframes.group and C.unitframes.group.visible == "1"
|
||||
end
|
||||
if GroupPetsClusterFrame then
|
||||
GroupPetsClusterFrame:EnableMouse(true)
|
||||
end
|
||||
|
||||
GroupFrame:RegisterEvent("PARTY_MEMBERS_CHANGED")
|
||||
GroupFrame:RegisterEvent("RAID_ROSTER_UPDATE")
|
||||
GroupFrame:RegisterEvent("RAID_TARGET_UPDATE")
|
||||
GroupFrame:RegisterEvent("UNIT_NAME_UPDATE")
|
||||
GroupFrame:RegisterEvent("UNIT_PET")
|
||||
GroupFrame:RegisterEvent("PLAYER_TARGET_CHANGED")
|
||||
GroupFrame:RegisterEvent("CHAT_MSG_ADDON")
|
||||
GroupFrame:Show()
|
||||
GroupFrame_Update()
|
||||
end
|
||||
|
||||
HookAddonOrVariable("GroupFrame", function()
|
||||
-- After Turtle's own init, hide frames if pfUI handles them
|
||||
hooksecurefunc("GroupFrame_Toggle", function()
|
||||
local inRaid = (GetNumRaidMembers() > 0)
|
||||
local pfUIHandles
|
||||
if inRaid then
|
||||
pfUIHandles = C.unitframes.raid and C.unitframes.raid.visible == "1"
|
||||
else
|
||||
pfUIHandles = C.unitframes.group and C.unitframes.group.visible == "1"
|
||||
end
|
||||
|
||||
if pfUIHandles then
|
||||
if pfUIHandlesGroupOrRaid() then
|
||||
DisableTurtleGroupFrames()
|
||||
else
|
||||
EnableTurtleGroupFrames()
|
||||
end
|
||||
end)
|
||||
|
||||
-- After every group/raid update, re-hide if pfUI handles them
|
||||
hooksecurefunc("GroupFrame_Update", function()
|
||||
local inRaid = (GetNumRaidMembers() > 0)
|
||||
local pfUIHandles
|
||||
if inRaid then
|
||||
pfUIHandles = C.unitframes.raid and C.unitframes.raid.visible == "1"
|
||||
else
|
||||
pfUIHandles = C.unitframes.group and C.unitframes.group.visible == "1"
|
||||
end
|
||||
|
||||
if pfUIHandles then
|
||||
if pfUIHandlesGroupOrRaid() then
|
||||
DisableTurtleGroupFrames()
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user