comparison Hansgar_And_Franzok_Assist.lua @ 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
comparison
equal deleted inserted replaced
13:f635adb94909 14:c4e00fefea9c
346 db.PLAY_SOUND = false 346 db.PLAY_SOUND = false
347 end 347 end
348 if (db.STOP_CAST == nil) then 348 if (db.STOP_CAST == nil) then
349 db.STOP_CAST = true 349 db.STOP_CAST = true
350 end 350 end
351 if (db.NO_VERTICAL == nil) then
352 db.NO_VERTICAL = false
353 end
351 -- 354 --
352 355
353 f:SetLockState (true) 356 f:SetLockState (true)
354 357
355 elseif (event == "ENCOUNTER_START" or event == "ENCOUNTER_END") then 358 elseif (event == "ENCOUNTER_START" or event == "ENCOUNTER_END") then
569 print ("|cFFFFFF00/hansgar resetpos|r: reset the position of all frames.") 572 print ("|cFFFFFF00/hansgar resetpos|r: reset the position of all frames.")
570 print ("|cFFFFFF00/hansgar lock|r: toggle lock and unlock on the frame.") 573 print ("|cFFFFFF00/hansgar lock|r: toggle lock and unlock on the frame.")
571 print ("|cFFFFFF00/hansgar test show hide|r: active the addon on test mode or hide it.") 574 print ("|cFFFFFF00/hansgar test show hide|r: active the addon on test mode or hide it.")
572 print ("|cFFFFFF00/hansgar delay <time>|r: time in seconds until the percentage goes from 0 to 100.") 575 print ("|cFFFFFF00/hansgar delay <time>|r: time in seconds until the percentage goes from 0 to 100.")
573 print ("|cFFFFFF00/hansgar dance|r: toggle dance bar (used to dodge regular stampers and searing plates).") 576 print ("|cFFFFFF00/hansgar dance|r: toggle dance bar (used to dodge regular stampers and searing plates).")
574 print ("|cFFFFFF00/hansgar autofacing|r: toggle if the dance bar auto switch left and right when looking to north or south.")
575 print ("|cFFFFFF00/hansgar facing|r: |cFF00FF001|r = south |cFF00FF002|r = north, use to set the dance bar when auto facing is disabled.")
576 print ("|cFFFFFF00/hansgar users|r: show who is using the addon in the raid.") 577 print ("|cFFFFFF00/hansgar users|r: show who is using the addon in the raid.")
577 print ("|cFFFFFF00/hansgar cooldown|r: show the countdown text for each stamper go back up to the ceiling.") 578 print ("|cFFFFFF00/hansgar cooldown|r: show the countdown text for each stamper go back up to the ceiling.")
578 print ("|cFFFFFF00/hansgar stopcast|r: show the alert to stop casting for Disrupting Roar.") 579 print ("|cFFFFFF00/hansgar stopcast|r: show the alert to stop casting for Disrupting Roar.")
579 end 580 end
580 end 581 end
631 desc = "Enable or disable the dance bar.", 632 desc = "Enable or disable the dance bar.",
632 name = "Dance Bar" 633 name = "Dance Bar"
633 }, 634 },
634 { 635 {
635 type = "toggle", 636 type = "toggle",
637 get = function() return db.NO_VERTICAL end,
638 set = function (self, fixedparam, value)
639 db.NO_VERTICAL = not db.NO_VERTICAL
640 end,
641 desc = "When enabled, dance bar won't switch to vertical position when facing west and east.",
642 name = "No Vertical Dance bar"
643 },
644 {
645 type = "toggle",
636 get = function() return db.CD_NUMBER end, 646 get = function() return db.CD_NUMBER end,
637 set = function (self, fixedparam, value) 647 set = function (self, fixedparam, value)
638 db.CD_NUMBER = not db.CD_NUMBER 648 db.CD_NUMBER = not db.CD_NUMBER
639 f:RefreshCooldownSettings() 649 f:RefreshCooldownSettings()
640 end, 650 end,
721 }, 731 },
722 } 732 }
723 733
724 local build_options_panel = function() 734 local build_options_panel = function()
725 local options_frame = DF:CreateOptionsFrame ("HansgarFranzokAssistOptions", "Hans & Franz Assist", 1) 735 local options_frame = DF:CreateOptionsFrame ("HansgarFranzokAssistOptions", "Hans & Franz Assist", 1)
726 options_frame:SetHeight (180) 736 options_frame:SetHeight (200)
727 DF:BuildMenu (options_frame, options_panel, 15, -60, 180) 737 DF:BuildMenu (options_frame, options_panel, 15, -60, 200)
728 options_frame:SetBackdropColor (0, 0, 0, .9) 738 options_frame:SetBackdropColor (0, 0, 0, .9)
729 end 739 end
730 740
731 f.OpenOptionsPanel = function() 741 f.OpenOptionsPanel = function()
732 if (not HansgarFranzokAssistOptions) then 742 if (not HansgarFranzokAssistOptions) then
1210 1220
1211 local x, _ = GetPlayerMapPosition ("player") 1221 local x, _ = GetPlayerMapPosition ("player")
1212 local block 1222 local block
1213 1223
1214 if (db.AUTO_FACING and x) then 1224 if (db.AUTO_FACING and x) then
1225
1215 local facing = GetPlayerFacing() 1226 local facing = GetPlayerFacing()
1216
1217 -- get 4 directions in radians
1218 local current = self.facing 1227 local current = self.facing
1219 if (facing < 0.7 or facing > 5.6) then --north 1228
1220 --print ("north") 1229 if (db.NO_VERTICAL) then
1221 self.facing = 1 1230 -- get 2 direction in radians
1222 elseif (facing >= 0.7 and facing < 2.45) then --west 1231 if (current ~= 1 and (facing > 5.3 or facing < 1.053)) then --north -> south -- ~30º tolerance
1223 --print ("west") 1232 --print ("south")
1224 self.facing = 3 1233 self.facing = 1
1225 elseif (facing > 2.45 and facing < 3.85) then --south 1234 elseif (current ~= 2 and (facing > 2.3 and facing < 4.3)) then
1226 --print ("south") 1235 --print ("north")
1227 self.facing = 2 1236 self.facing = 2
1228 elseif (facing >= 3.85 and facing <= 5.6) then --east 1237 end
1229 --print ("east") 1238 else
1230 self.facing = 4 1239 -- get 4 directions in radians
1240 if (facing < 0.7 or facing > 5.6) then --north
1241 --print ("north")
1242 self.facing = 1
1243 elseif (facing >= 0.7 and facing < 2.45) then --west
1244 --print ("west")
1245 self.facing = 3
1246 elseif (facing > 2.45 and facing < 3.85) then --south
1247 --print ("south")
1248 self.facing = 2
1249 elseif (facing >= 3.85 and facing <= 5.6) then --east
1250 --print ("east")
1251 self.facing = 4
1252 end
1231 end 1253 end
1232 1254
1233 if (current ~= self.facing) then 1255 if (current ~= self.facing) then
1234 f:ChangeDanceBar (self.facing) 1256 f:ChangeDanceBar (self.facing)
1235 end 1257 end