Skip to content

Commit

Permalink
fix: Implement a better solution for ObjectiveTrackerFrame hiding (#79)
Browse files Browse the repository at this point in the history
* More aggresively hide ObjectiveTrackerFrame

* Remove previous workaround

* Clean up objective tracker hiding and remove unnecessary calls in events

---------

Co-authored-by: Hilmar Wiegand <me@hwgnd.de>
  • Loading branch information
Numynum and happenslol authored Aug 8, 2024
1 parent ae1e8b9 commit 746bbdd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
13 changes: 9 additions & 4 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ function WarpDeplete:OnInitialize()
frames.bars = CreateFrame("Frame", "WarpDepleteBars", frames.root)
frames.deathsTooltip = CreateFrame("Frame", "WarpDepleteDeathsTooltip", frames.root)

-- We use an empty frame to which we parent the blizzard objective tracker.
-- This can then be hidden and not be affected by blizzard unhiding the
-- objective tracker itself.
frames.hiddenObjectiveTrackerParent = CreateFrame("frame")
frames.hiddenObjectiveTrackerParent:Hide()

self.frames = frames
end

Expand Down Expand Up @@ -203,13 +209,12 @@ function WarpDeplete:ShowBlizzardObjectiveTracker()
return
end

ObjectiveTrackerFrame:Show()
ObjectiveTrackerFrame:SetParent(self.originalObjectiveTrackerParent or UIParent)
end

function WarpDeplete:HideBlizzardObjectiveTracker()
if ObjectiveTrackerFrame:IsVisible() then
ObjectiveTrackerFrame:Hide()
end
self.originalObjectiveTrackerParent = ObjectiveTrackerFrame:GetParent()
ObjectiveTrackerFrame:SetParent(self.frames.hiddenObjectiveTrackerParent)
end

function WarpDeplete:ShowExternals()
Expand Down
13 changes: 0 additions & 13 deletions Events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -450,14 +450,6 @@ function WarpDeplete:OnTimerTick(elapsed)
local current = GetTime() + self.timerState.startOffset - self.timerState.startTime + deathPenalty

self:SetTimerCurrent(current)

-- FIXME(happens): Blizzard seems to randomly re-show the objective tracker on
-- a lot of events, and even re-hiding it on CLEU events doesn't seem to cover
-- all cases.
-- The best solution would be to somehow hook into the actual function that
-- shows the objective tracker or some event that fires when it's unhidden, but
-- that currently doesn't seem to be possible.
self:HideBlizzardObjectiveTracker()
end

function WarpDeplete:OnCheckChallengeMode(ev)
Expand Down Expand Up @@ -487,10 +479,6 @@ function WarpDeplete:OnPlayerDead(ev)
-- good method for deduping though.
-- self:BroadcastDeath()
self:ResetCurrentPull()

-- Blizzard re-shows the objective tracker every time the player
-- dies, so we need to re-hide it
self:HideBlizzardObjectiveTracker()
end

function WarpDeplete:OnChallengeModeReset(ev)
Expand Down Expand Up @@ -559,7 +547,6 @@ end
function WarpDeplete:OnResetCurrentPull(ev)
self:PrintDebugEvent(ev)
self:ResetCurrentPull()
self:HideBlizzardObjectiveTracker()
end

function WarpDeplete:OnThreatListUpdate(ev, unit)
Expand Down

0 comments on commit 746bbdd

Please sign in to comment.