Skip to content

Commit

Permalink
Greevir: Instance/Combat hiding are messing each other up.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludovicus-Maior committed Apr 29, 2023
1 parent 04bc23d commit 07cf71f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 42 deletions.
25 changes: 14 additions & 11 deletions WoWPro/WoWPro.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1193,29 +1193,32 @@ function WoWPro.LevelColor(guide)

end

WoWPro.Escondido = false
WoWPro.Escondido = 0
-- why should be one of "INSTANCE" or "COMBAT"
function WoWPro.ShowFrame(enabled, msg, why)
if (not enabled) and (WoWPro.Escondido == 0) then
if (not enabled) then
if WoWProCharDB.AutoHideInsideInstancesNotify and (why == "INSTANCE") then
WoWPro:Print(msg)
WoWPro:Print("WoWPro.ShowFrame(hide):"..msg)
else
WoWPro:print(msg)
WoWPro:print("WoWPro.ShowFrame(hide):"..msg)
end
WoWPro.MainFrame:Hide()
WoWPro.Titlebar:Hide()
WoWPro.Escondido = why
elseif (enabled and WoWPro.Escondido > 0) then
WoWPro.Escondido = WoWPro.Escondido + 1
elseif (enabled and (WoWPro.Escondido > 0)) then
if WoWProCharDB.AutoHideInsideInstancesNotify and (why == "INSTANCE") then
WoWPro:Print(msg)
WoWPro:Print("WoWPro.ShowFrame(show)"..msg)
else
WoWPro:print(msg)
WoWPro:print("WoWPro.ShowFrame(show):"..msg)
end
WoWPro.MainFrame:Show()
WoWPro:TitlebarShow()
WoWPro.Escondido = WoWPro.Escondido - 1
if (WoWPro.Escondido == 0) then
WoWPro.MainFrame:Show()
WoWPro:TitlebarShow()
WoWPro:print("WoWPro.ShowFrame(show): No longer hidden.")
end
else
WoWPro:print("WoWPro.ShowFrame is confused: enabled=%s, Escondido=%s, msg=%s, evengt=%s", tostring(enabled), tostring(WoWPro.Escondido), msg, why)
WoWPro:print("WoWPro.ShowFrame is confused: enabled=%s, Escondido=%s, msg=%s, why=%s", tostring(enabled), tostring(WoWPro.Escondido), msg, why)
WoWPro.Escondido = 0
WoWPro.MainFrame:Show()
WoWPro:TitlebarShow()
Expand Down
1 change: 1 addition & 0 deletions WoWPro/WoWPro_Broker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4121,6 +4121,7 @@ function WoWPro.LockdownHandler(self, elapsed)
WoWPro.LockdownCounter = nil
WoWPro.LockdownTimer = nil
WoWPro.InitLockdown = false
-- Cant do WoWPro.ZONE_CHANGED_NEW_AREA("ZONE_CHANGED_END_LOCKDOWN_TIMER") till guide is loaded
local moduleCount = 0
for name, module in WoWPro:IterateModules() do
moduleCount = moduleCount + 1
Expand Down
48 changes: 17 additions & 31 deletions WoWPro/WoWPro_Events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,7 @@ WoWPro.RegisterEventHandler("PLAYER_ENTERING_WORLD", function(event, ...)
WoWPro.InitLockdown = true
WoWPro.LockdownCounter = 5 -- times until release and give up to wait for other addons
WoWPro.LockdownTimer = 1.5
-- WoWPro.ZONE_CHANGED_NEW_AREA("ZONE_CHANGED_NEW_AREA")
if WoWPro.Hidden == "PLAYER_ENTERING_BATTLEGROUND" then
WoWPro.ShowFrame(true, "|cff33ff33Battleground Exit Auto Show|r: ", event)
end
-- WoWPro.ShowFrame(true, "|cff33ff33Battleground Exit Auto Show|r: "..event, "INSTANCE")
WoWPro:UpdateTradeSkills()
end)

Expand Down Expand Up @@ -583,14 +580,12 @@ WoWPro.RegisterEventHandler("ZONE_CHANGED", function(event, ...)
WoWPro:print("Suppressing Instance Auto Hide.")
return
end
if _G.IsInInstance() and not WoWPro.MaybeCombatLockdown() then
WoWPro.ShowFrame(false, "|cff33ff33Instance Auto Hide|r: " , event)
if _G.IsInInstance() then
WoWPro.ShowFrame(false, "|cff33ff33Instance Auto Hide|r: " .. event, "INSTANCE")
return
elseif WoWPro.Hidden and not WoWPro.MaybeCombatLockdown() then
WoWPro.ShowFrame(true, "|cff33ff33Instance Exit Auto Show|r: " , event)
elseif WoWPro.Hidden or _G.IsInInstance() then
WoWPro.CombatLock = true
end
else
WoWPro.ShowFrame(true, "|cff33ff33Instance Exit Auto Show|r: " .. event, "INSTANCE")
end
end
if WoWPro.Ready(event) then
WoWPro.AutoCompleteZone(...)
Expand Down Expand Up @@ -623,8 +618,8 @@ WoWPro.RegisterModernEventHandler("PET_BATTLE_OPENING_START", function(event, ..
end

WoWPro.LastPetBattleWinner = nil
if (not WoWPro.Hidden) and battleHide then
WoWPro.ShowFrame(false, "|cff33ff33Entering Pet Battle|r: ", event)
if (WoWPro.Escondido == 0) and battleHide then
WoWPro.ShowFrame(false, "|cff33ff33Entering Pet Battle|r: ", "COMBAT")
end
WoWPro.PetBattleActive = true
WoWPro:print("battleHide=%s, Hidden=%s, PetBattleActive=%s", tostring(battleHide), tostring(WoWPro.Hidden), tostring(WoWPro.PetBattleActive))
Expand Down Expand Up @@ -653,8 +648,8 @@ WoWPro.RegisterModernEventHandler("PET_BATTLE_FINAL_ROUND", function(event, ...)
WoWPro.RegisterModernEventHandler("PET_BATTLE_OVER", function(event, ...) return; end)

WoWPro.RegisterModernEventHandler("PET_BATTLE_CLOSE", function(event, ...)
if WoWPro.Hidden then
WoWPro.ShowFrame(true, "|cff33ff33Exiting Pet Battle|r: ", event)
if (WoWPro.Escondido > 0) then
WoWPro.ShowFrame(true, "|cff33ff33Exiting Pet Battle|r: ", "COMBAT")
end

if not _G.C_PetBattles.IsInBattle() then
Expand Down Expand Up @@ -686,32 +681,23 @@ WoWPro.RegisterEventHandler("PLAYER_ENTERING_BATTLEGROUND", function(event, ...)
WoWPro.RegisterEventHandler("PLAYER_REGEN_DISABLED", function(event, ...)
-- Combat lockdown begins after this event
if WoWProCharDB.AutoHideInCombat then
WoWPro.MainFrame:Hide()
WoWPro.Titlebar:Hide()
WoWPro.Hidden = event
WoWPro.ShowFrame(false, "|cff33ff33Combat Enter, AutoHideInCombat|r: " .. event, "COMBAT")
WoWPro.CombatLock = true
end
-- Last ditch update!
if not WoWPro.MaybeCombatLockdown() then
WoWPro:UpdateGuide(event)
end
end)
end)

WoWPro.RegisterEventHandler("PLAYER_REGEN_ENABLED", function(event, ...)
-- Combat lockdown ends before this event fires
if WoWPro.CombatLock then
if _G.IsInInstance() then
WoWPro.ShowFrame(false, "|cff33ff33Punted Instance Auto Hide|r: " .. event)
elseif WoWPro.Hidden == true then
WoWPro.ShowFrame(true, "|cff33ff33Punted Instance Exit Auto Show|r: " .. event)
end
WoWPro.CombatLock = false
elseif WoWPro.Hidden then
WoWPro.MainFrame:Show()
WoWPro:TitlebarShow()
if WoWPro.CombatLock and WoWProCharDB.AutoHideInCombat then
WoWPro.ShowFrame(true, "|cff33ff33Combat Exit, |r: " .. event, "COMBAT")
WoWPro.CombatLock = false
end

WoWPro:UpdateGuide(event)
end)
end)

WoWPro.RegisterEventHandler("UPDATE_BINDINGS", WoWPro.PLAYER_REGEN_ENABLED)
-- WoWPro.RegisterEventHandler("PARTY_MEMBERS_CHANGED", WoWPro.PLAYER_REGEN_ENABLED)
Expand Down

0 comments on commit 07cf71f

Please sign in to comment.