From c08b39aa5c272bc6d4e404b53f46d1ff8386e087 Mon Sep 17 00:00:00 2001 From: d87 Date: Fri, 11 Nov 2022 11:42:00 +0700 Subject: [PATCH] Fixed removal of blizzard standard frames in Dragonflight --- .luacheckrc | 9 +++++ Aptechka.lua | 33 +---------------- helpers.lua | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+), 31 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 07ddcae..c547148 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -242,4 +242,13 @@ globals = { -- Wrath dual spec "GetActiveTalentGroup", "GetTalentGroupRole", + + -- Disarm Blizz raid + "PartyFrame", + "UnregisterUnitWatch", + "CompactPartyFrame", + "CompactRaidFrameContainer", + "CompactRaidFrameManager_GetSetting", + "CompactRaidFrameManager_SetSetting", + "CompactRaidFrameContainer", } diff --git a/Aptechka.lua b/Aptechka.lua index 9148aa8..fed00b2 100644 --- a/Aptechka.lua +++ b/Aptechka.lua @@ -347,40 +347,11 @@ function Aptechka.PLAYER_LOGIN(self,event,arg1) if AptechkaDB.global.disableBlizzardPlayer then Aptechka:SafeCallDirect(helpers.DisableBlizzPlayerFrame) end - if apiLevel < 10 and AptechkaDB.global.disableBlizzardParty then + if AptechkaDB.global.disableBlizzardParty then helpers.DisableBlizzParty() end if AptechkaDB.global.hideBlizzardRaid then - -- disable Blizzard party & raid frame if our Raid Frames are loaded - -- InterfaceOptionsFrameCategoriesButton11:SetScale(0.00001) - -- InterfaceOptionsFrameCategoriesButton11:SetAlpha(0) - -- raid - local hider = CreateFrame("Frame") - hider:Hide() - if CompactRaidFrameManager and CompactUnitFrameProfiles then - CompactRaidFrameManager:SetParent(hider) - -- CompactRaidFrameManager:UnregisterAllEvents() - CompactUnitFrameProfiles:UnregisterAllEvents() - - local disableCompactRaidFrameUnitButton = function(self) - if self:IsForbidden() then return end - -- for some reason CompactUnitFrame_OnLoad also gets called for nameplates, so ignoring that - local frameName = self:GetName() - if not frameName then return end - if string.sub(frameName, 1, 16) == "CompactRaidFrame" then - -- print(frameName) - self:UnregisterAllEvents() - end - end - - for i=1,60 do - local crf = _G["CompactRaidFrame"..i] - if not crf then break end - disableCompactRaidFrameUnitButton(crf) - end - hooksecurefunc("CompactUnitFrame_OnLoad", disableCompactRaidFrameUnitButton) - hooksecurefunc("CompactUnitFrame_UpdateUnitEvents", disableCompactRaidFrameUnitButton) - end + helpers.DisableBlizzRaid() end if config.enableIncomingHeals then diff --git a/helpers.lua b/helpers.lua index dfbdff6..eecb5b6 100644 --- a/helpers.lua +++ b/helpers.lua @@ -411,6 +411,107 @@ function helpers.DisableBlizzParty(self) end end +function helpers.DisableBlizzRaid() + -- disable Blizzard party & raid frame if our Raid Frames are loaded + -- InterfaceOptionsFrameCategoriesButton11:SetScale(0.00001) + -- InterfaceOptionsFrameCategoriesButton11:SetAlpha(0) + -- raid + local hider = CreateFrame("Frame") + hider:Hide() + if CompactRaidFrameManager and CompactUnitFrameProfiles then + CompactRaidFrameManager:SetParent(hider) + -- CompactRaidFrameManager:UnregisterAllEvents() + CompactUnitFrameProfiles:UnregisterAllEvents() + + local disableCompactRaidFrameUnitButton = function(self) + if self:IsForbidden() then return end + -- for some reason CompactUnitFrame_OnLoad also gets called for nameplates, so ignoring that + local frameName = self:GetName() + if not frameName then return end + if string.sub(frameName, 1, 16) == "CompactRaidFrame" then + -- print(frameName) + self:UnregisterAllEvents() + end + end + + for i=1,60 do + local crf = _G["CompactRaidFrame"..i] + if not crf then break end + disableCompactRaidFrameUnitButton(crf) + end + hooksecurefunc("CompactUnitFrame_OnLoad", disableCompactRaidFrameUnitButton) + hooksecurefunc("CompactUnitFrame_UpdateUnitEvents", disableCompactRaidFrameUnitButton) + end +end + + +if APILevel >= 10 then + + local hiddenFrame + + local function rehide(self) + if not InCombatLockdown() then self:Hide() end + end + + local function unregister(f) + if f then f:UnregisterAllEvents() end + end + + local function hideFrame(frame) + if frame then + UnregisterUnitWatch(frame) + frame:Hide() + frame:UnregisterAllEvents() + frame:SetParent(hiddenFrame) + frame:HookScript("OnShow", rehide) + unregister(frame.healthbar) + unregister(frame.manabar) + unregister(frame.powerBarAlt) + unregister(frame.spellbar) + end + end + + -- party frames + function helpers.DisableBlizzParty() + hiddenFrame = hiddenFrame or CreateFrame('Frame') + hiddenFrame:Hide() + if PartyFrame then + hideFrame(PartyFrame) + for frame in PartyFrame.PartyMemberFramePool:EnumerateActive() do + hideFrame(frame) + hideFrame(frame.HealthBar) + hideFrame(frame.ManaBar) + end + PartyFrame.PartyMemberFramePool:ReleaseAll() + end + hideFrame(CompactPartyFrame) + UIParent:UnregisterEvent("GROUP_ROSTER_UPDATE") -- used by compact party frame + end + + -- raid frames + function helpers.DisableBlizzRaid() + if not CompactRaidFrameManager then return end + local function HideFrames() + CompactRaidFrameManager:UnregisterAllEvents() + CompactRaidFrameContainer:UnregisterAllEvents() + if not InCombatLockdown() then + CompactRaidFrameManager:Hide() + local shown = CompactRaidFrameManager_GetSetting('IsShown') + if shown and shown ~= '0' then + CompactRaidFrameManager_SetSetting('IsShown', '0') + end + end + end + hiddenFrame = hiddenFrame or CreateFrame('Frame') + hiddenFrame:Hide() + hooksecurefunc('CompactRaidFrameManager_UpdateShown', HideFrames) + CompactRaidFrameManager:HookScript('OnShow', HideFrames) + CompactRaidFrameContainer:HookScript('OnShow', HideFrames) + HideFrames() + end +end + + local MIRROR_POINTS = { ["TOPLEFT"] = "BOTTOMRIGHT", ["LEFT"] = "RIGHT",