forked from EllesmereGaming/EllesmereUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEllesmereUI_BlizzardParty.lua
More file actions
69 lines (63 loc) · 2.6 KB
/
Copy pathEllesmereUI_BlizzardParty.lua
File metadata and controls
69 lines (63 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
-------------------------------------------------------------------------------
-- EllesmereUI_BlizzardParty.lua
-- Shared "Hide Blizzard Party Panel" feature.
--
-- Hides the Blizzard CompactRaidFrameManager -- the collapsed sidebar panel on
-- the left of the screen (ready check, role poll, raid world markers, etc.).
-- Lives in the parent so the QoL and Raid Frames modules drive the EXACT same
-- implementation and the same saved setting (EllesmereUIDB.hideBlizzardPartyFrame),
-- with no behaviour differing between the two toggles.
--
-- Default: whatever the user has saved; unset = shown (off).
--
-- Mechanism: reparent the manager to a hidden frame (SetParent is blocked in
-- combat, so a PLAYER_REGEN_ENABLED watcher re-asserts it after combat). When
-- the setting is off, the manager is reparented back to its original parent.
-------------------------------------------------------------------------------
local hookedMgr = false
local _partyHiddenParent
local _partyOrigParent
local function ApplyHideBlizzardPartyFrame()
local shouldHide = EllesmereUIDB and EllesmereUIDB.hideBlizzardPartyFrame
local mgr = CompactRaidFrameManager or _G["CompactRaidFrameManager"]
if not mgr then return end
if shouldHide then
if not _partyHiddenParent then
_partyHiddenParent = CreateFrame("Frame")
_partyHiddenParent:Hide()
end
if not _partyOrigParent then
_partyOrigParent = mgr:GetParent()
end
if not InCombatLockdown() then
mgr:SetParent(_partyHiddenParent)
end
if not hookedMgr then
hookedMgr = true
local regenFrame = CreateFrame("Frame")
regenFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
regenFrame:SetScript("OnEvent", function()
if EllesmereUIDB and EllesmereUIDB.hideBlizzardPartyFrame then
if mgr:GetParent() ~= _partyHiddenParent then
mgr:SetParent(_partyHiddenParent)
end
end
end)
end
else
if _partyOrigParent and not InCombatLockdown() then
mgr:SetParent(_partyOrigParent)
mgr:Show()
end
end
end
EllesmereUI._applyHideBlizzardPartyFrame = ApplyHideBlizzardPartyFrame
local initFrame = CreateFrame("Frame")
initFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
initFrame:RegisterEvent("GROUP_ROSTER_UPDATE")
initFrame:SetScript("OnEvent", function(self, event)
if event == "PLAYER_ENTERING_WORLD" then
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
end
ApplyHideBlizzardPartyFrame()
end)