From 4522f1264156acb3274eabf163da0cde07d8b951 Mon Sep 17 00:00:00 2001 From: andrew6180 <16847730+andrew6180@users.noreply.github.com> Date: Sun, 18 Feb 2024 09:17:46 -0700 Subject: [PATCH] 7.12: Prep for compact raid frames --- ElvUI/ElvUI.toc | 2 +- ElvUI/Modules/UnitFrames/UnitFrames.lua | 52 +++++++++++++++++++++++++ ElvUI/Settings/Private.lua | 1 + ElvUI_OptionsUI/UnitFrames.lua | 5 +++ 4 files changed, 59 insertions(+), 1 deletion(-) diff --git a/ElvUI/ElvUI.toc b/ElvUI/ElvUI.toc index 929e3f2..dacbfb5 100644 --- a/ElvUI/ElvUI.toc +++ b/ElvUI/ElvUI.toc @@ -1,6 +1,6 @@ ## Interface: 30300 ## Author: Elv, Bunny -## Version: 7.11 +## Version: 7.12 ## Title: |cff1784d1E|r|cffe5e3e3lvUI|r ## Notes: User Interface replacement AddOn for World of Warcraft. ## SavedVariables: ElvDB, ElvPrivateDB diff --git a/ElvUI/Modules/UnitFrames/UnitFrames.lua b/ElvUI/Modules/UnitFrames/UnitFrames.lua index eb4c10c..dd18a8d 100644 --- a/ElvUI/Modules/UnitFrames/UnitFrames.lua +++ b/ElvUI/Modules/UnitFrames/UnitFrames.lua @@ -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 diff --git a/ElvUI/Settings/Private.lua b/ElvUI/Settings/Private.lua index c91a9ee..77e3590 100644 --- a/ElvUI/Settings/Private.lua +++ b/ElvUI/Settings/Private.lua @@ -129,6 +129,7 @@ V.unitframe = { boss = true, arena = true, party = true, + raid = true, } } diff --git a/ElvUI_OptionsUI/UnitFrames.lua b/ElvUI_OptionsUI/UnitFrames.lua index a40c757..00c73ad 100644 --- a/ElvUI_OptionsUI/UnitFrames.lua +++ b/ElvUI_OptionsUI/UnitFrames.lua @@ -4026,6 +4026,11 @@ E.Options.args.unitframe = { order = 7, type = "toggle", name = L["PARTY"] + }, + raid = { + order = 8, + type = "toggle", + name = L["RAID"] } } },