Quantcast

- Fix for pet battles not hiding top bar(s) - where did those events go? :)

urnati [04-11-23 - 15:12]
- Fix for pet battles not hiding top bar(s) - where did those events go? :)
Filename
Titan/TitanPanel.lua
diff --git a/Titan/TitanPanel.lua b/Titan/TitanPanel.lua
index 317406a..e364fb2 100644
--- a/Titan/TitanPanel.lua
+++ b/Titan/TitanPanel.lua
@@ -444,16 +444,21 @@ function TitanPanelBarButton:ADDON_LOADED(addon)
 			_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_ENTERING_WORLD");
 			_G[TITAN_PANEL_CONTROL]:RegisterEvent("CVAR_UPDATE");
 			_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_LOGOUT");
-			_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_LOGOUT");
-			_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_LOGOUT");
+
 			-- For the pet battle - for now we'll hide the Titan bars...
-			-- Cannot seem to move the 'top' part of the frame.
+			-- Cannot seem to move the 'top' part of the pet battle frame.
+			_G[TITAN_PANEL_CONTROL]:RegisterEvent("PET_BATTLE_OPENING_START");
+			_G[TITAN_PANEL_CONTROL]:RegisterEvent("PET_BATTLE_CLOSE");
+
+			-- Hide Titan bars in combat (global or per bar); may be useful when using Short bars
 			_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_REGEN_ENABLED");
 			_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_REGEN_DISABLED");
+
+			-- User request to hide Top bar(s) in BG or arena; more areas later?
 			_G[TITAN_PANEL_CONTROL]:RegisterEvent("ZONE_CHANGED");
-	_G[TITAN_PANEL_CONTROL]:RegisterEvent("ZONE_CHANGED_INDOORS");
-	_G[TITAN_PANEL_CONTROL]:RegisterEvent("ZONE_CHANGED_NEW_AREA");
-		else
+			_G[TITAN_PANEL_CONTROL]:RegisterEvent("ZONE_CHANGED_INDOORS");
+			_G[TITAN_PANEL_CONTROL]:RegisterEvent("ZONE_CHANGED_NEW_AREA");
+				else
 			-- User loaded wrong Titan version; tried to use retail on Classic or Classic Era
 			-- Could save the user grief; Titan could mangle the saved vars on a version mismatch.
 			TitanPrint("Titan did not initialize!!!!"
@@ -544,12 +549,14 @@ function TitanPanelBarButton:ZONE_CHANGED_NEW_AREA()
 end

 function TitanPanelBarButton:PET_BATTLE_OPENING_START()
+--print("PET_BATTLE_OPENING_START")
 	TitanPanelBarButton_DisplayBarsWanted("PET_BATTLE_OPENING_START")
 	-- Hide all bars and hiders
 --	TitanPanelBarButton_HideAllBars()
 end

 function TitanPanelBarButton:PET_BATTLE_CLOSE()
+--print("PET_BATTLE_CLOSE")
 	TitanPanelBarButton_DisplayBarsWanted("PET_BATTLE_CLOSE")
 end

@@ -1110,7 +1117,7 @@ end

 --------------------------------------------------------------
 --
--- Titan features
+-- Titan Bar

 --[[ Titan
 NAME: TitanPanelBarButton_ForceLDBLaunchersRight
@@ -1296,6 +1303,7 @@ local function showBar(frame_str)
 	end
 --[[
 print("showBar"
+--.." "..tostring(C_PetBattles.IsInBattle())..""
 .." > "..tostring(flag)..""
 )
 --]]