Quantcast

Automatically hide the crazy arrow during pet battles

James Whitehead II [10-08-12 - 06:21]
Automatically hide the crazy arrow during pet battles

There is an option to disable this feature, under 'Crazy Arrow'.
Filename
TomTom.lua
TomTom_Config.lua
TomTom_CrazyArrow.lua
diff --git a/TomTom.lua b/TomTom.lua
index 2b51c87..74a0429 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -70,6 +70,7 @@ function TomTom:Initialize(event, addon)
                 setclosest = true,
 				closestusecontinent = false,
                 enablePing = false,
+				hideDuringPetBattles = true,
             },
             minimap = {
                 enable = true,
@@ -145,6 +146,10 @@ function TomTom:Initialize(event, addon)
     self:RegisterEvent("CHAT_MSG_ADDON")
 	RegisterAddonMessagePrefix("TOMTOM3")

+	-- Watch for pet battle start/end so we can hide/show the arrow
+	self:RegisterEvent("PET_BATTLE_OPENING_START", "ShowHideCrazyArrow")
+	self:RegisterEvent("PET_BATTLE_CLOSE", "ShowHideCrazyArrow")
+
     self:ReloadOptions()
     self:ReloadWaypoints()

diff --git a/TomTom_Config.lua b/TomTom_Config.lua
index 2cbde3f..a7fa4e5 100755
--- a/TomTom_Config.lua
+++ b/TomTom_Config.lua
@@ -236,10 +236,18 @@ local function createconfig()
                 width = "double",
                 arg = "arrow.enablePing",
             },
+			hideDuringPetBattles = {
+				order = 13,
+				type = "toggle",
+				name = L["Hide the crazy arrow display during pet battles"],
+				desc = L["When a pet battle begins, the crazy arrow will be hidden from view. When you exit the pet battle, it will be re-shown."],
+				width = "double",
+				arg = "arrow.hideDuringPetBattles",
+			},
 			display = {
 				type = "group",
 				name = L["Arrow display"],
-				order = 13,
+				order = 14,
 				inline = true,
 				args = {
 					help = {
@@ -326,7 +334,7 @@ local function createconfig()
 			color = {
 				type = "group",
 				name = L["Arrow colors"],
-				order = 10,
+				order = 15,
 				inline = true,
 				args = {
 					help = {
diff --git a/TomTom_CrazyArrow.lua b/TomTom_CrazyArrow.lua
index 671264b..3b17834 100755
--- a/TomTom_CrazyArrow.lua
+++ b/TomTom_CrazyArrow.lua
@@ -231,6 +231,11 @@ end

 function TomTom:ShowHideCrazyArrow()
 	if self.profile.arrow.enable then
+		if self.profile.arrow.hideDuringPetBattles and C_PetBattles.IsInBattle() then
+			wayframe:Hide()
+			return
+		end
+
 		wayframe:Show()

 		if self.profile.arrow.noclick then