diff Hansgar_And_Franzok_Assist.lua @ 10:f1e32be6773e

- fixed stop casting alert.
author Tercio
date Mon, 06 Apr 2015 19:41:32 -0300
parents 070347df4822
children 2f09fe4be15c
line wrap: on
line diff
--- a/Hansgar_And_Franzok_Assist.lua	Sun Mar 22 15:59:46 2015 -0300
+++ b/Hansgar_And_Franzok_Assist.lua	Mon Apr 06 19:41:32 2015 -0300
@@ -9,7 +9,7 @@
 
 local f = CreateFrame ("frame", "Hansgar_And_Franzok_Assist", UIParent)
 f:SetFrameStrata ("DIALOG")
-f.version = "v0.10"
+f.version = "v0.11"
 
 local tframe = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_PTrack", UIParent)
 
@@ -351,12 +351,17 @@
 			print ("|cFFFFAA00Hansgar and Franzok Assist|r you aren't in a raid group.")
 		end
 	
+	elseif (command == "st") then
+		f.stop_casting_frame:Show()
+		f.stop_casting_frame.alert.animOut:Stop()
+		f.stop_casting_frame.alert.animIn:Play()
+		f:ScheduleTimer ("HideStopSpellAlert", 1.2)
+	
 	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
@@ -420,6 +425,7 @@
 		f.unlocked_frame = true
 		player_pos_frame:Show()
 		player_bar:Show()
+		f.stop_casting_frame:Show()
 
 	elseif (command == "lock") then
 		f:SetLockState()
@@ -427,12 +433,14 @@
 		if (db.FRAME_LOCK) then
 			print ("|cFFFFAA00Hansgar and Franzok Assist|r frame locked.")
 			f.unlocked_frame = false
+			f.stop_casting_frame:Hide()
 		else
 			print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.")
 			
 			f.unlocked_frame = true
 			player_pos_frame:Show()
 			player_bar:Show()
+			f.stop_casting_frame:Show()
 			
 		end
 	
@@ -497,34 +505,49 @@
 
 --
 
-local stop_casting_frame = CreateFrame ("frame", "Hansgar_And_Franzok_AssistStopCasting", UIParent, "ActionBarButtonSpellActivationAlert")
+local stop_casting_frame = CreateFrame ("frame", "Hansgar_And_Franzok_AssistStopCasting", UIParent)
 stop_casting_frame:SetSize (200, 30)
 stop_casting_frame:SetPoint ("center", UIParent, "center", 0, 75)
 stop_casting_frame:SetFrameStrata ("FULLSCREEN")
+f.stop_casting_frame = stop_casting_frame
 stop_casting_frame:Hide()
-stop_casting_frame:SetScript ("OnShow", function (self)
-	self.animOut:Stop()
-	self.animIn:Play()
+
+stop_casting_frame:SetMovable (false)
+stop_casting_frame:EnableMouse (false)
+
+stop_casting_frame:SetScript ("OnMouseDown", function (self)
+	if (not self.isMoving) then
+		self:StartMoving()
+		self.isMoving = true
+	end
 end)
-stop_casting_frame:SetScript ("OnHide", function (self)
-	self.animIn:Stop()
-	self.animOut:Play()
+stop_casting_frame:SetScript ("OnMouseUp", function (self)
+	if (self.isMoving) then
+		self:StopMovingOrSizing()
+		self.isMoving = false
+	end
 end)
 
+local alert = CreateFrame ("frame", "Hansgar_And_Franzok_AssistStopCastingAlert", stop_casting_frame, "ActionBarButtonSpellActivationAlert")
+alert:SetPoint ("topleft", stop_casting_frame, "topleft", -10, 2)
+alert:SetPoint ("bottomright", stop_casting_frame, "bottomright", 10, -2)
+stop_casting_frame.alert = alert
+
 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)
+stop_casting_frame:SetBackdropColor (0, 0, 0, 0.3)
 
+function f:HideStopSpellAlert2()
+	stop_casting_frame.alert.animOut:Stop()
+	stop_casting_frame:Hide()
+end
 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()
+	stop_casting_frame.alert.animIn:Stop()
+	stop_casting_frame.alert.animOut:Play()
+	f:ScheduleTimer ("HideStopSpellAlert2", 0.3)
 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
@@ -542,8 +565,11 @@
 		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)
+		f.stop_casting_frame:Show()
+		f.stop_casting_frame.alert.animOut:Stop()
+		f.stop_casting_frame.alert.animIn:Play()
+		f:ScheduleTimer ("HideStopSpellAlert", 1.2)
+		
 	end
 	
 	if (token == "SPELL_INTERRUPT" and spellid == 160838 and db.STOP_CAST) then
@@ -556,6 +582,7 @@
 	--end
 
 end)
+--	/run Hansgar_And_Franzok_AssistStopCastingAlert.animIn:Play()
 
 --Hansgar_And_Franzok_AssistStopCasting:Show(); Hansgar_And_Franzok_Assist:ScheduleTimer ("HideStopSpellAlert", 1)
 --Hansgar_And_Franzok_Assist:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
@@ -742,6 +769,8 @@
 		f:EnableMouse (false)
 		player_bar:EnableMouse (false)
 		player_pos_frame:EnableMouse (false)
+		stop_casting_frame:SetMovable (false)
+		stop_casting_frame:EnableMouse (false)
 		
 		for _, block in ipairs (f.all_blocks) do
 			block:EnableMouse (false)
@@ -751,11 +780,14 @@
 			f:EndTrackPlayerPosition()
 			f:StopTracking()
 		end
+
 	else
 		--unlocked
 		f:EnableMouse (true)
 		player_bar:EnableMouse (true)
 		player_pos_frame:EnableMouse (true)
+		stop_casting_frame:SetMovable (true)
+		stop_casting_frame:EnableMouse (true)
 		
 		for _, block in ipairs (f.all_blocks) do
 			block:EnableMouse (true)
@@ -765,6 +797,7 @@
 			f:StartTracking()
 			f:StartTrackPlayerPosition()
 		end
+		
 	end
 	
 	if (not db.FRAME_LOCK) then