Mercurial > wow > degaine
comparison Degaine.lua @ 56:16828b1f9f9d
Track the manual ToggleSheath
author | contrebasse |
---|---|
date | Thu, 03 Mar 2011 14:36:08 +0100 |
parents | 12a568d6387a |
children |
comparison
equal
deleted
inserted
replaced
55:e5e29ead60e8 | 56:16828b1f9f9d |
---|---|
7 --------------------------------------------------------------- | 7 --------------------------------------------------------------- |
8 -- If you stand up by jumping or walking it won't draw your weapon | 8 -- If you stand up by jumping or walking it won't draw your weapon |
9 -- (it's not possible to know if you were sitting or standing before) | 9 -- (it's not possible to know if you were sitting or standing before) |
10 | 10 |
11 --@debug@ | 11 --@debug@ |
12 local debug = true | 12 local debug = false |
13 local debugAll = false | 13 local debugAll = false |
14 --@end-debug@ | 14 --@end-debug@ |
15 | 15 |
16 | 16 |
17 --------------------------------------------------------------- | 17 --------------------------------------------------------------- |
30 local wipe = wipe | 30 local wipe = wipe |
31 | 31 |
32 -- Wow functions | 32 -- Wow functions |
33 local GetTime = GetTime | 33 local GetTime = GetTime |
34 local InCombatLockdown = InCombatLockdown | 34 local InCombatLockdown = InCombatLockdown |
35 local ToggleSheath = ToggleSheath | |
36 local UnitName = UnitName | 35 local UnitName = UnitName |
37 local IsMounted = IsMounted | 36 local IsMounted = IsMounted |
38 local UnitCastingInfo = UnitCastingInfo | 37 local UnitCastingInfo = UnitCastingInfo |
39 local GetUnitSpeed = GetUnitSpeed | 38 local GetUnitSpeed = GetUnitSpeed |
40 local UnitBuff = UnitBuff | 39 local UnitBuff = UnitBuff |
40 -- The hook has to be done before registering the local reference | |
41 local t_lastDegaine = 0 -- Time of the last draw | |
42 hooksecurefunc("ToggleSheath",function() | |
43 t_lastDegaine = GetTime() | |
44 end); | |
45 local ToggleSheath = ToggleSheath | |
41 | 46 |
42 | 47 |
43 --------------------------------------------------------------- | 48 --------------------------------------------------------------- |
44 -- Local vars | 49 -- Local vars |
45 --------------------------------------------------------------- | 50 --------------------------------------------------------------- |
54 local isGossipClosed = true | 59 local isGossipClosed = true |
55 local wasGossipOpened = false | 60 local wasGossipOpened = false |
56 local t_lastGossipClosed = 0 | 61 local t_lastGossipClosed = 0 |
57 --local wasMounted = IsMounted() -- handle mounts with UNIT_AURA | 62 --local wasMounted = IsMounted() -- handle mounts with UNIT_AURA |
58 local isTradeSkill = false | 63 local isTradeSkill = false |
59 local t_lastDegaine = 0 -- Time of the last draw | |
60 | 64 |
61 | 65 |
62 --------------------------------------------------------------- | 66 --------------------------------------------------------------- |
63 -- Some stuff... | 67 -- Some stuff... |
64 --------------------------------------------------------------- | 68 --------------------------------------------------------------- |
69 | 73 |
70 | 74 |
71 --------------------------------------------------------------- | 75 --------------------------------------------------------------- |
72 -- Launch drawing weapons | 76 -- Launch drawing weapons |
73 --------------------------------------------------------------- | 77 --------------------------------------------------------------- |
78 | |
74 -- Wait a few seconds before drawing, to be able to see the curren animation (and avoid bugs) | 79 -- Wait a few seconds before drawing, to be able to see the curren animation (and avoid bugs) |
75 local Degaine_OnUpdate = function(self,t_elapsed) | 80 local Degaine_OnUpdate = function(self,t_elapsed) |
76 t_left = t_left - t_elapsed; | 81 t_left = t_left - t_elapsed; |
77 if t_left<=0 then | 82 if t_left<=0 then |
78 ToggleSheath() | 83 ToggleSheath() |
79 DegaineFrame:SetScript("OnUpdate", nil) | 84 DegaineFrame:SetScript("OnUpdate", nil) |
80 t_lastDegaine = GetTime() | |
81 end | 85 end |
82 end | 86 end |
83 local start = function(arg_delay) | 87 local start = function(arg_delay) |
84 | 88 |
85 --@debug@ | 89 --@debug@ |