Quantcast

Hide coord block as well during pet battles.

Ludovicus [05-03-20 - 18:35]
Hide coord block as well during pet battles.
Filename
TomTom.lua
diff --git a/TomTom.lua b/TomTom.lua
index 1139ddf..eef65c0 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -415,8 +415,14 @@ function TomTom:ShowHideCoordBlock()
             TomTomBlock:SetScript("OnDragStop", Block_OnDragStop)
             TomTomBlock:SetScript("OnDragStart", Block_OnDragStart)
             TomTomBlock:RegisterEvent("PLAYER_ENTERING_WORLD")
+            TomTomBlock:RegisterEvent("PET_BATTLE_OPENING_START")
+            TomTomBlock:RegisterEvent("PET_BATTLE_CLOSE")
             TomTomBlock:SetScript("OnEvent", Block_OnEvent)
         end
+        if self.profile.arrow.hideDuringPetBattles and C_PetBattles and C_PetBattles.IsInBattle() then
+			TomTomBlock:Hide()
+			return
+		end
         -- Show the frame
         TomTomBlock:Show()

@@ -1075,7 +1081,7 @@ do
     end

     function Block_OnEvent(self, event, ...)
-        if (event == "PLAYER_ENTERING_WORLD") then
+        if (event == "PLAYER_ENTERING_WORLD") or (event == "PET_BATTLE_OPENING_START") or (event == "PET_BATTLE_CLOSE") then
             TomTom:ShowHideCoordBlock()
         end
     end