changeset 56:16828b1f9f9d

Track the manual ToggleSheath
author contrebasse
date Thu, 03 Mar 2011 14:36:08 +0100
parents e5e29ead60e8
children e9024d5cd624
files Degaine.lua
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Degaine.lua	Mon Feb 28 01:26:06 2011 +0100
+++ b/Degaine.lua	Thu Mar 03 14:36:08 2011 +0100
@@ -9,7 +9,7 @@
 --     (it's not possible to know if you were sitting or standing before)
 
 --@debug@
-local debug = true
+local debug = false
 local debugAll = false
 --@end-debug@
 
@@ -32,12 +32,17 @@
 -- Wow functions
 local GetTime = GetTime
 local InCombatLockdown = InCombatLockdown
-local ToggleSheath = ToggleSheath
 local UnitName = UnitName
 local IsMounted = IsMounted
 local UnitCastingInfo = UnitCastingInfo
 local GetUnitSpeed = GetUnitSpeed
 local UnitBuff = UnitBuff
+-- The hook has to be done before registering the local reference
+local t_lastDegaine = 0 -- Time of the last draw
+hooksecurefunc("ToggleSheath",function()
+	t_lastDegaine = GetTime()
+end);
+local ToggleSheath = ToggleSheath
 
 
 ---------------------------------------------------------------
@@ -56,7 +61,6 @@
 local t_lastGossipClosed = 0
 --local wasMounted = IsMounted() -- handle mounts with UNIT_AURA
 local isTradeSkill = false
-local t_lastDegaine = 0 -- Time of the last draw
 
 
 ---------------------------------------------------------------
@@ -71,13 +75,13 @@
 ---------------------------------------------------------------
 -- Launch drawing weapons
 ---------------------------------------------------------------
+
 -- Wait a few seconds before drawing, to be able to see the curren animation (and avoid bugs)
 local Degaine_OnUpdate = function(self,t_elapsed)
 	t_left = t_left - t_elapsed;
 	if t_left<=0 then
 		ToggleSheath()
 		DegaineFrame:SetScript("OnUpdate", nil)
-		t_lastDegaine = GetTime()
 	end
 end
 local start = function(arg_delay)