changeset 14:c4e00fefea9c

- Added option to not use the vertical dance bar.
author Tercio
date Thu, 30 Apr 2015 14:05:43 -0300
parents f635adb94909
children 211038c8d073
files Hansgar_And_Franzok_Assist.lua
diffstat 1 files changed, 40 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/Hansgar_And_Franzok_Assist.lua	Tue Apr 28 11:21:50 2015 -0300
+++ b/Hansgar_And_Franzok_Assist.lua	Thu Apr 30 14:05:43 2015 -0300
@@ -348,6 +348,9 @@
 		if (db.STOP_CAST == nil) then
 			db.STOP_CAST = true
 		end
+		if (db.NO_VERTICAL == nil) then
+			db.NO_VERTICAL = false
+		end
 		--
 		
 		f:SetLockState (true)
@@ -571,8 +574,6 @@
 		print ("|cFFFFFF00/hansgar test show hide|r: active the addon on test mode or hide it.")
 		print ("|cFFFFFF00/hansgar delay <time>|r: time in seconds until the percentage goes from 0 to 100.")
 		print ("|cFFFFFF00/hansgar dance|r: toggle dance bar (used to dodge regular stampers and searing plates).")
-		print ("|cFFFFFF00/hansgar autofacing|r: toggle if the dance bar auto switch left and right when looking to north or south.")
-		print ("|cFFFFFF00/hansgar facing|r: |cFF00FF001|r = south |cFF00FF002|r = north, use to set the dance bar when auto facing is disabled.")
 		print ("|cFFFFFF00/hansgar users|r: show who is using the addon in the raid.")
 		print ("|cFFFFFF00/hansgar cooldown|r: show the countdown text for each stamper go back up to the ceiling.")
 		print ("|cFFFFFF00/hansgar stopcast|r: show the alert to stop casting for Disrupting Roar.")
@@ -633,6 +634,15 @@
 	},
 	{
 		type = "toggle",
+		get = function() return db.NO_VERTICAL end,
+		set = function (self, fixedparam, value) 
+			db.NO_VERTICAL = not db.NO_VERTICAL
+		end,
+		desc = "When enabled, dance bar won't switch to vertical position when facing west and east.",
+		name = "No Vertical Dance bar"
+	},
+	{
+		type = "toggle",
 		get = function() return db.CD_NUMBER end,
 		set = function (self, fixedparam, value) 
 			db.CD_NUMBER = not db.CD_NUMBER
@@ -723,8 +733,8 @@
 
 local build_options_panel = function()
 	local options_frame = DF:CreateOptionsFrame ("HansgarFranzokAssistOptions", "Hans & Franz Assist", 1)
-	options_frame:SetHeight (180)
-	DF:BuildMenu (options_frame, options_panel, 15, -60, 180)
+	options_frame:SetHeight (200)
+	DF:BuildMenu (options_frame, options_panel, 15, -60, 200)
 	options_frame:SetBackdropColor (0, 0, 0, .9)
 end
 
@@ -1212,22 +1222,34 @@
 	local block
 	
 	if (db.AUTO_FACING and x) then
+	
 		local facing = GetPlayerFacing()
+		local current = self.facing
 		
-		-- get 4 directions in radians
-		local current = self.facing
-		if (facing < 0.7 or facing > 5.6) then --north
-			--print ("north")
-			self.facing = 1
-		elseif (facing >= 0.7 and facing < 2.45) then --west
-			--print ("west")
-			self.facing = 3
-		elseif (facing > 2.45 and facing < 3.85) then --south
-			--print ("south")
-			self.facing = 2
-		elseif (facing >= 3.85 and facing <= 5.6) then --east
-			--print ("east")
-			self.facing = 4
+		if (db.NO_VERTICAL) then
+			-- get 2 direction in radians
+			if (current ~= 1 and (facing > 5.3 or facing < 1.053)) then --north -> south -- ~30º tolerance
+				--print ("south")
+				self.facing = 1
+			elseif (current ~= 2 and (facing > 2.3 and facing < 4.3)) then
+				--print ("north")
+				self.facing = 2
+			end
+		else
+			-- get 4 directions in radians
+			if (facing < 0.7 or facing > 5.6) then --north
+				--print ("north")
+				self.facing = 1
+			elseif (facing >= 0.7 and facing < 2.45) then --west
+				--print ("west")
+				self.facing = 3
+			elseif (facing > 2.45 and facing < 3.85) then --south
+				--print ("south")
+				self.facing = 2
+			elseif (facing >= 3.85 and facing <= 5.6) then --east
+				--print ("east")
+				self.facing = 4
+			end
 		end
 		
 		if (current ~= self.facing) then