7.12: Prep for compact raid frames

This commit is contained in:
andrew6180
2024-02-18 09:17:46 -07:00
parent 5d0254d759
commit 4522f12641
4 changed files with 59 additions and 1 deletions
+52
View File
@@ -1034,6 +1034,10 @@ function UF:UpdateAllHeaders(event)
ElvUF:DisableBlizzard("party")
end
if E.private.unitframe.disabledBlizzardFrames.raid then
ElvUF:DisableBlizzard("raid")
end
self:RegisterRaidDebuffIndicator()
local smartRaidFilterEnabled = self.db.smartRaidFilter
@@ -1055,6 +1059,33 @@ function UF:UpdateAllHeaders(event)
end
end
local SetFrameUp = {}
local SetFrameUnit = {}
local AllowedFuncs = {}
if _G.DefaultCompactUnitFrameSetup then
AllowedFuncs[_G.DefaultCompactUnitFrameSetup] = true
end
function UF:DisableBlizzard_SetUpFrame(func)
if not AllowedFuncs[func] then return end
local name = (not self.IsForbidden or not self:IsForbidden()) and self:GetName()
if not name then return end
for _, pattern in next, SetFrameUp do
if strmatch(name, pattern) then
SetFrameUnit[self] = name
end
end
end
function UF:DisableBlizzard_SetUnit(token)
if SetFrameUnit[self] and token ~= nil then
self:SetScript('OnEvent', nil)
self:SetScript('OnUpdate', nil)
end
end
local hiddenParent = CreateFrame("Frame")
hiddenParent:SetAllPoints()
hiddenParent:Hide()
@@ -1090,6 +1121,13 @@ local HandleFrame = function(baseName)
end
end
local HandleCompactUnitFrame = function(frame, pattern)
if SetFrameUp[frame] ~= pattern then
SetFrameUp[frame] = pattern
end
HandleFrame(frame)
end
function ElvUF:DisableBlizzard(unit)
if (not unit) or InCombatLockdown() then return end
@@ -1125,6 +1163,7 @@ function ElvUF:DisableBlizzard(unit)
end
elseif (unit:match"(party)%d?$" == "party") and E.private.unitframe.disabledBlizzardFrames.party then
local id = unit:match"party(%d)"
HandleCompactUnitFrame("CompactPartyFrame", '^CompactPartyFrameMember%d+$')
if id then
HandleFrame("PartyMemberFrame"..id)
@@ -1146,6 +1185,14 @@ function ElvUF:DisableBlizzard(unit)
HandleFrame(format("ArenaEnemyFrame%dPetFrame", i))
end
end
elseif (unit:match("(raid)%d?$") == "raid") and E.private.unitframe.disabledBlizzardFrames.raid then
HandleCompactUnitFrame("CompactPartyFrame", '^CompactRaidGroup%d+Member%d+$')
if CompactRaidFrameManager then
CompactRaidFrameManager:UnregisterAllEvents()
CompactRaidFrameManager:SetParent(E.HiddenFrame)
CompactRaidFrameManager:SetSetting('IsShown', '0')
end
end
end
@@ -1377,6 +1424,11 @@ function UF:Initialize()
end
end
if CompactUnitMixin then
hooksecurefunc(CompactUnitMixin, "SetUpFrame", UF.DisableBlizzard_SetUpFrame)
hooksecurefunc(CompactUnitMixin, "SetUnit", UF.DisableBlizzard_SetUnit)
end
if E.private.unitframe.disabledBlizzardFrames.arena and E.private.unitframe.disabledBlizzardFrames.focus and E.private.unitframe.disabledBlizzardFrames.party then
InterfaceOptionsFrameCategoriesButton10:SetScale(0.0001)
end