changeset 9:070347df4822

- Added stop casting alert for Disrupting Roar. - Added slash command /hansgar resetpos. - Unlocking the frames now make all they be shown in the screen.
author Tercio
date Sun, 22 Mar 2015 15:59:46 -0300
parents 3a6b062ecaac
children f1e32be6773e
files Hansgar_And_Franzok_Assist.lua
diffstat 1 files changed, 124 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/Hansgar_And_Franzok_Assist.lua	Sun Mar 15 16:38:07 2015 -0300
+++ b/Hansgar_And_Franzok_Assist.lua	Sun Mar 22 15:59:46 2015 -0300
@@ -9,7 +9,7 @@
 
 local f = CreateFrame ("frame", "Hansgar_And_Franzok_Assist", UIParent)
 f:SetFrameStrata ("DIALOG")
-f.version = "v0.9"
+f.version = "v0.10"
 
 local tframe = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_PTrack", UIParent)
 
@@ -42,7 +42,7 @@
 --player_bar:SetPoint ("topright", f, "bottomright", 0, -3)
 
 player_bar:SetPoint ("center", UIParent, "center", 0, 300)
-player_bar:SetSize (280, 22)
+player_bar:SetSize (280, 16)
 
 player_bar:SetMovable (true)
 player_bar:EnableMouse (true)
@@ -120,8 +120,8 @@
 player_pos_frame:SetPoint ("center", UIParent, "center", 0, -75)
 
 player_pos_frame:SetSize (155, 6)
-player_pos_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16})
-player_pos_frame:SetBackdropColor (0, 0, 0, 0.4)
+player_pos_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1}})
+player_pos_frame:SetBackdropColor (0, 0, 0, 1)
 player_pos_frame:SetMovable (true)
 player_pos_frame:EnableMouse (true)
 player_pos_frame:SetScript ("OnMouseDown", function (self)
@@ -278,6 +278,9 @@
 		if (db.PLAY_SOUND == nil) then
 			db.PLAY_SOUND = false
 		end
+		if (db.STOP_CAST == nil) then
+			db.STOP_CAST = true
+		end
 		--
 		
 		f:SetLockState (true)
@@ -287,10 +290,17 @@
 		local encounterID, encounterName, difficultyID, raidSize = select (1, ...)
 		
 		if (encounterID == 1693) then
+			if (f.unlocked_frame) then
+				f.unlocked_frame = false
+			end
+		
 			if (event == "ENCOUNTER_START") then
 				f.on_encounter = true
+				f:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
+				
 			elseif (event == "ENCOUNTER_END") then
 				f.on_encounter = false
+				f:UnregisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
 			end
 		end
 		
@@ -306,17 +316,13 @@
 		if (encounterID == 1693 and difficultyID == 16) then
 		
 			if (event == "ENCOUNTER_START") then
-			
 				print ("|cFFFFAA00Hansgar and Franzok Assist|r: addon enabled, good look!")
 			
 				if (f.StampersPhase) then
 					f:StopTracking()
 				end
-				f:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
 				
 			elseif (event == "ENCOUNTER_END") then
-				f:UnregisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
-				
 				if (f.StampersPhase) then
 					f:StopTracking()
 				end
@@ -345,6 +351,43 @@
 			print ("|cFFFFAA00Hansgar and Franzok Assist|r you aren't in a raid group.")
 		end
 	
+	elseif (command == "stopcast") then
+		db.STOP_CAST = not db.STOP_CAST
+		
+		if (db.STOP_CAST) then
+			print ("|cFFFFAA00Hansgar and Franzok Assist|r stop cast alert enabled.")
+			Hansgar_And_Franzok_AssistStopCasting:Show(); Hansgar_And_Franzok_Assist:ScheduleTimer ("HideStopSpellAlert", 1)
+		else
+			print ("|cFFFFAA00Hansgar and Franzok Assist|r stop cast alert disabled.")
+		end
+	
+	elseif (command == "resetpos") then
+		f:ClearAllPoints()
+		f:SetPoint ("center", UIParent, "center")
+		
+		player_bar:ClearAllPoints()
+		player_bar:SetPoint ("center", UIParent, "center")
+		
+		player_pos_frame:ClearAllPoints()
+		player_pos_frame:SetPoint ("center", UIParent, "center")
+		
+		if (f.StampersPhase) then
+			f:EndTrackPlayerPosition()
+			f:StopTracking()
+		end
+		
+		db.FRAME_LOCK = true
+		f:SetLockState()
+		
+		f.unlocked_frame = true
+		
+		f:StartTracking()
+		f:StartTrackPlayerPosition()
+		
+		print ("|cFFFFAA00Hansgar and Franzok Assist|r: position reseted.")
+		print ("|cFFFFAA00Hansgar and Franzok Assist|r: move between the tracks to show the other frames.")
+		print ("|cFFFFAA00Hansgar and Franzok Assist|r: type '/hansgar lock' to lock the frames.")
+	
 	elseif (command == "delay") then
 		local t = tonumber (rest)
 		if (t) then
@@ -373,14 +416,24 @@
 		db.FRAME_LOCK = true
 		f:SetLockState()
 		print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.")
+		
+		f.unlocked_frame = true
+		player_pos_frame:Show()
+		player_bar:Show()
 
 	elseif (command == "lock") then
 		f:SetLockState()
 		
 		if (db.FRAME_LOCK) then
 			print ("|cFFFFAA00Hansgar and Franzok Assist|r frame locked.")
+			f.unlocked_frame = false
 		else
 			print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.")
+			
+			f.unlocked_frame = true
+			player_pos_frame:Show()
+			player_bar:Show()
+			
 		end
 	
 	elseif (command == "facing") then
@@ -429,6 +482,7 @@
 		
 	else
 		print ("|cFFFFAA00Hansgar and Franzok Assist|r |cFF00FF00" .. f.version .. "|r Commands:")
+		print ("|cFFFFFF00/hansgar resetpos|r: reset the position of all frames.")
 		print ("|cFFFFFF00/hansgar lock|r: toggle lock and unlock on the frame.")
 		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.")
@@ -437,13 +491,45 @@
 		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.")
 	end
 end
 
 --
---f:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
 
-f:SetScript ("OnEvent", function (self, event, time, token, _, who_serial, who_name, who_flags, _, target_serial, target_name, target_flags, _, spellid, spellname, spellschool, buff_type, ...)
+local stop_casting_frame = CreateFrame ("frame", "Hansgar_And_Franzok_AssistStopCasting", UIParent, "ActionBarButtonSpellActivationAlert")
+stop_casting_frame:SetSize (200, 30)
+stop_casting_frame:SetPoint ("center", UIParent, "center", 0, 75)
+stop_casting_frame:SetFrameStrata ("FULLSCREEN")
+stop_casting_frame:Hide()
+stop_casting_frame:SetScript ("OnShow", function (self)
+	self.animOut:Stop()
+	self.animIn:Play()
+end)
+stop_casting_frame:SetScript ("OnHide", function (self)
+	self.animIn:Stop()
+	self.animOut:Play()
+end)
+
+local text = stop_casting_frame:CreateFontString (nil, "overlay", "GameFontNormal")
+text:SetText ("STOP CASTING!")
+text:SetPoint ("center", stop_casting_frame, "center")
+
+stop_casting_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16})
+stop_casting_frame:SetBackdropColor (0, 0, 0, 0)
+
+function f:HideStopSpellAlert()
+	stop_casting_frame.animIn:Stop()
+	stop_casting_frame.animOut:Play()
+	f:ScheduleTimer ("HideStopSpellAlert2", 0.9)
+end
+function f:HideStopSpellAlert2()
+	stop_casting_frame:Hide()
+end
+
+--3/22 13:44:48.995  SPELL_INTERRUPT,Vehicle-0-3132-1205-24243-76974-00000EF077,"Franzok",0x10a48,0x0,Player-00-063,"Grubdruid",0x514,0x0,160838,"Disrupting Roar",0x1,5185,"Healing Touch",8
+
+f:SetScript ("OnEvent", function (self, event, time, token, _, who_serial, who_name, who_flags, _, target_serial, target_name, target_flags, _, spellid, spellname, spellschool, buff_type, buff_name)
 
 	if (token == "SPELL_AURA_APPLIED" and spellid == 162124 and not f.StampersPhase) then
 		f:StartTracking()
@@ -455,10 +541,25 @@
 			f:StartTrackPlayerPosition()
 		end
 		
+	elseif (token == "SPELL_CAST_START" and spellid == 160838 and db.STOP_CAST) then --Disrupting Roar
+		stop_casting_frame:Show()
+		f:ScheduleTimer ("HideStopSpellAlert", 0.9)
 	end
+	
+	if (token == "SPELL_INTERRUPT" and spellid == 160838 and db.STOP_CAST) then
+		local link = GetSpellLink (buff_type)
+		print ("Stop Cast Fail:", target_name, link)
+	end
+	
+	--if (spellid == 160838) then
+	--	print ("event:", token, 160838, db.STOP_CAST)
+	--end
 
 end)
 
+--Hansgar_And_Franzok_AssistStopCasting:Show(); Hansgar_And_Franzok_Assist:ScheduleTimer ("HideStopSpellAlert", 1)
+--Hansgar_And_Franzok_Assist:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
+
 local frame_tracker = CreateFrame ("frame", "Hansgar_And_Franzok_AssistTracker", UIParent)
 local on_update_tracker = function (self, elapsed)
 	
@@ -498,8 +599,14 @@
 		f.player_loc_box:Show()
 
 	else
-		f.player_loc_box:Hide()
-		f.player_bar:Hide()
+		if (f.unlocked_frame) then
+			f.player_loc_box:Show()
+			f.player_bar:Show()
+			f.player_bar:SetValue (100)
+		else
+			f.player_loc_box:Hide()
+			f.player_bar:Hide()
+		end
 	end
 end
 
@@ -777,10 +884,6 @@
 
 -- true north -> south
 -- false south -> north
-function f:ChangePlayerTrackerFace()
-	
-end
-
 local track_function = function (self, elapsed)
 
 	local x, _ = GetPlayerMapPosition ("player")
@@ -854,7 +957,11 @@
 		--div:SetPoint ("left", player_pos_frame, "left", self.width_pixel * at, 0)
 
 	else
-		player_pos_frame:Hide()
+		if (f.unlocked_frame) then
+			player_pos_frame:Show()
+		else
+			player_pos_frame:Hide()
+		end
 	end
 end