Mercurial > wow > degaine
comparison Degaine.lua @ 35:83cfab9dcb63 v1.0beta6
Weapon is not stealthed while moving and talking / Use a constant for short delay (0.5s) / the long delay is now 2.5s to avoid clipping with emotes
author | contrebasse |
---|---|
date | Sat, 08 Jan 2011 17:00:00 +0100 |
parents | 6f99c7f30f15 |
children | 2bca68b42a69 |
comparison
equal
deleted
inserted
replaced
34:6f99c7f30f15 | 35:83cfab9dcb63 |
---|---|
23 -- GLOBALS: DEFAULT_CHAT_FRAME | 23 -- GLOBALS: DEFAULT_CHAT_FRAME |
24 | 24 |
25 -- Lua functions | 25 -- Lua functions |
26 local pairs = pairs; | 26 local pairs = pairs; |
27 local type = type; | 27 local type = type; |
28 local select = select | |
28 | 29 |
29 -- Wow functions | 30 -- Wow functions |
30 local GetTime = GetTime | 31 local GetTime = GetTime |
31 local InCombatLockdown = InCombatLockdown | 32 local InCombatLockdown = InCombatLockdown |
32 local ToggleSheath = ToggleSheath | 33 local ToggleSheath = ToggleSheath |
33 local UnitName = UnitName | 34 local UnitName = UnitName |
34 local IsMounted = IsMounted | 35 local IsMounted = IsMounted |
35 local GetNumCompanions, GetCompanionInfo = GetNumCompanions, GetCompanionInfo | 36 local GetNumCompanions, GetCompanionInfo = GetNumCompanions, GetCompanionInfo |
36 local UnitCastingInfo = UnitCastingInfo | 37 local UnitCastingInfo = UnitCastingInfo |
37 local select = select | 38 local GetUnitSpeed = GetUnitSpeed |
38 | 39 |
39 | 40 |
40 --------------------------------------------------------------- | 41 --------------------------------------------------------------- |
41 -- Local vars | 42 -- Local vars |
42 --------------------------------------------------------------- | 43 --------------------------------------------------------------- |
43 -- const | 44 -- const |
44 local DegaineFrame = CreateFrame("Frame") | 45 local DegaineFrame = CreateFrame("Frame") |
45 local playername = UnitName("player") | 46 local playername = UnitName("player") |
46 local delay = 2 -- seconds | 47 local delay = 2.5 -- seconds |
48 local delay_short = 0.5 -- seconds | |
47 | 49 |
48 -- vars | 50 -- vars |
49 local t_left = -1 | 51 local t_left = -1 |
50 local isGossipClosed = true | 52 local isGossipClosed = true |
51 local wasGossipOpened = false | 53 local wasGossipOpened = false |
163 [3273] = true, -- First Aid | 165 [3273] = true, -- First Aid |
164 [53428] = true -- Runeforge | 166 [53428] = true -- Runeforge |
165 -- Archaeology ? | 167 -- Archaeology ? |
166 } | 168 } |
167 | 169 |
170 local function playerIsNotMoving() | |
171 return GetUnitSpeed("player") == 0 | |
172 end | |
168 local events2playername = { -- the 2nd arg is playername | 173 local events2playername = { -- the 2nd arg is playername |
169 CHAT_MSG_SAY = true, | 174 CHAT_MSG_SAY = playerIsNotMoving, |
170 CHAT_MSG_YELL = true, | 175 CHAT_MSG_YELL = playerIsNotMoving, |
171 CHAT_MSG_TEXT_EMOTE = true, | 176 CHAT_MSG_TEXT_EMOTE = true, -- the emote is not shown, but the weapon is stealthed |
172 } | 177 } |
173 | 178 |
174 | 179 |
175 --------------------------------------------------------------- | 180 --------------------------------------------------------------- |
176 -- Handle mounts with OnUpdate | 181 -- Handle mounts with OnUpdate |
188 function handleMountsOnUpdate(self,t_elapsed) | 193 function handleMountsOnUpdate(self,t_elapsed) |
189 if IsMounted() then | 194 if IsMounted() then |
190 wasMounted = true | 195 wasMounted = true |
191 else | 196 else |
192 if wasMounted then | 197 if wasMounted then |
193 start(0.5) -- no animation for unmounting | 198 start(delay_short) -- no animation for unmounting |
194 wasMounted = false | 199 wasMounted = false |
195 end | 200 end |
196 end | 201 end |
197 end | 202 end |
198 end | 203 end |
286 | 291 |
287 --end | 292 --end |
288 --elseif arg5 and not SpellBlackList[arg5] then -- arg5 is SpellID | 293 --elseif arg5 and not SpellBlackList[arg5] then -- arg5 is SpellID |
289 elseif (arg5 and SpellWhiteList[arg5]) or isTradeSkill then -- arg5 is SpellID | 294 elseif (arg5 and SpellWhiteList[arg5]) or isTradeSkill then -- arg5 is SpellID |
290 isTradeSkill = false -- for next time | 295 isTradeSkill = false -- for next time |
291 start(0.5) | 296 start(delay_short) |
292 end | 297 end |
293 end | 298 end |
294 elseif events2playername[event] then | 299 elseif events2playername[event] then |
295 if arg2==playername then | 300 if arg2==playername and (type(events2playername[event])~="function" or events2playername[event]()) then |
296 start() | 301 start() |
297 end | 302 end |
298 elseif event == "GOSSIP_CLOSED" then | 303 elseif event == "GOSSIP_CLOSED" then |
299 wasGossipOpened = not isGossipClosed | 304 wasGossipOpened = not isGossipClosed |
300 isGossipClosed = true | 305 isGossipClosed = true |