Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blizzard: Properly disable arena frames #619

Merged
merged 3 commits into from Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .luacheckrc
Expand Up @@ -21,6 +21,9 @@ read_globals = {
table = {fields = {'removemulti', 'wipe'}},

-- FrameXML
'ArenaEnemyFramesContainer',
'ArenaEnemyMatchFramesContainer',
'ArenaEnemyPrepFramesContainer',
'ColorMixin',
'ComboFrame',
'CreateColor',
Expand Down
27 changes: 17 additions & 10 deletions blizzard.lua
Expand Up @@ -7,6 +7,7 @@ local MAX_ARENA_ENEMIES = _G.MAX_ARENA_ENEMIES or 5
-- sourced from FrameXML/TargetFrame.lua
local MAX_BOSS_FRAMES = _G.MAX_BOSS_FRAMES or 5

local isArenaHooked = false
local isPartyHooked = false

local hiddenParent = CreateFrame('Frame', nil, UIParent)
Expand Down Expand Up @@ -58,7 +59,7 @@ local function handleFrame(baseName, doNotReparent)
buffFrame:UnregisterAllEvents()
end

local petFrame = frame.PetFrame
local petFrame = frame.petFrame or frame.PetFrame
if(petFrame) then
petFrame:UnregisterAllEvents()
end
Expand Down Expand Up @@ -98,7 +99,7 @@ function oUF:DisableBlizzard(unit)
handleFrame('Boss' .. id .. 'TargetFrame')
else
for i = 1, MAX_BOSS_FRAMES do
handleFrame(string.format('Boss%dTargetFrame', i))
handleFrame('Boss' .. i .. 'TargetFrame')
end
end
elseif(unit:match('party%d?$')) then
Expand All @@ -112,17 +113,23 @@ function oUF:DisableBlizzard(unit)
end
end
elseif(unit:match('arena%d?$')) then
local id = unit:match('arena(%d)')
if(id) then
handleFrame('ArenaEnemyMatchFrame' .. id)
else
if(not isArenaHooked) then
isArenaHooked = true

-- this disables ArenaEnemyFramesContainer
SetCVar('showArenaEnemyFrames', '0')
SetCVar('showArenaEnemyPets', '0')

-- but still UAE all containers
ArenaEnemyFramesContainer:UnregisterAllEvents()
ArenaEnemyPrepFramesContainer:UnregisterAllEvents()
ArenaEnemyMatchFramesContainer:UnregisterAllEvents()

for i = 1, MAX_ARENA_ENEMIES do
handleFrame(string.format('ArenaEnemyMatchFrame%d', i))
handleFrame('ArenaEnemyMatchFrame' .. i)
handleFrame('ArenaEnemyPrepFrame' .. i)
end
end

-- this disables ArenaEnemyFramesContainer
SetCVar('showArenaEnemyFrames', '0')
elseif(unit:match('nameplate%d+$')) then
local frame = C_NamePlate.GetNamePlateForUnit(unit)
if(frame and frame.UnitFrame) then
Expand Down