comparison Degaine.lua @ 44:1967c9a3c5c2

Put exceptions into their own file, and permit to adjust their delay (as it is done with Mr Chilly).
author contrebasse
date Sun, 27 Feb 2011 20:28:52 +0100
parents 3fbe79addc87
children f861e1c0535b
comparison
equal deleted inserted replaced
43:3fbe79addc87 44:1967c9a3c5c2
31 local GetTime = GetTime 31 local GetTime = GetTime
32 local InCombatLockdown = InCombatLockdown 32 local InCombatLockdown = InCombatLockdown
33 local ToggleSheath = ToggleSheath 33 local ToggleSheath = ToggleSheath
34 local UnitName = UnitName 34 local UnitName = UnitName
35 local IsMounted = IsMounted 35 local IsMounted = IsMounted
36 local GetNumCompanions, GetCompanionInfo = GetNumCompanions, GetCompanionInfo
37 local UnitCastingInfo = UnitCastingInfo 36 local UnitCastingInfo = UnitCastingInfo
38 local GetUnitSpeed = GetUnitSpeed 37 local GetUnitSpeed = GetUnitSpeed
39 38
40 39
41 --------------------------------------------------------------- 40 ---------------------------------------------------------------
125 UNIT_SPELLCAST_FAILED = true, 124 UNIT_SPELLCAST_FAILED = true,
126 UNIT_SPELLCAST_INTERRUPTED = true, 125 UNIT_SPELLCAST_INTERRUPTED = true,
127 UNIT_SPELLCAST_SUCCEEDED = true, 126 UNIT_SPELLCAST_SUCCEEDED = true,
128 UNIT_SPELLCAST_START = true, -- to ckeck tradeskill 127 UNIT_SPELLCAST_START = true, -- to ckeck tradeskill
129 } 128 }
130 local SpellWhiteList = { -- Spells that do steath weapons (works with events1player)
131 -- True recipes are treated separately
132 [8690] = true, -- Heartstone
133 [818] = true, -- Basic Campfire
134 [13262] = true, -- Disenchant
135 [51005] = true, -- Milling
136
137 -- Critters (exceptions)
138 [55068] = true, -- Mr Chilly
139
140 -- Mounts (exceptions)
141 [48778] = true, -- Acherus Deathcharger
142
143 }
144
145 local SpellBlackList = { -- spells that don't stealth weapons (works with events1player)
146 -- All vanity pets and mount are added at PLAYER_LOGIN
147
148 --
149 [1784] = true, -- Stealth (Rogue)
150 [58984] = true, -- Shadowmeld (Nightelf stealth)
151
152 -- DK presences
153 [48263] = true, -- Blood
154 [48266] = true, -- Frost
155 [48265] = true, -- Unholy
156
157 [3714] = true, -- Path of Frost
158
159
160 -- Tradeskill spells
161 [2259] = true, -- Alchemy
162 [45357] = true, -- Inscription
163 [3908] = true, -- Tailoring
164 [7411] = true, -- Enchanting
165 [2018] = true, -- Blacksmithing
166 [4036] = true, -- Engineering
167 [25229] = true, -- Jewelcrafting
168 [2656] = true, -- Smelting
169 [2108] = true, -- Leatherworking
170 [2550] = true, -- Cooking
171 [3273] = true, -- First Aid
172 [53428] = true -- Runeforge
173 -- Archaeology ?
174 }
175 129
176 --[[ 130 --[[
177 -- Was used when moving prevented to play the emote when talking 131 -- Was used when moving prevented to play the emote when talking
178 -- Was needed for CHAT_MSG_SAY and CHAT_MSG_YELL 132 -- Was needed for CHAT_MSG_SAY and CHAT_MSG_YELL
179 local function playerIsNotMoving() 133 local function playerIsNotMoving()
299 --DEFAULT_CHAT_FRAME:AddMessage(name) 253 --DEFAULT_CHAT_FRAME:AddMessage(name)
300 --DEFAULT_CHAT_FRAME:AddMessage(isTradeSkill and "True" or "False") 254 --DEFAULT_CHAT_FRAME:AddMessage(isTradeSkill and "True" or "False")
301 --if isTradeSkill then 255 --if isTradeSkill then
302 256
303 --end 257 --end
304 --elseif arg5 and not SpellBlackList[arg5] then -- arg5 is SpellID 258 --elseif arg5 and not T.SpellBlackList[arg5] then -- arg5 is SpellID
305 elseif (arg5 and SpellWhiteList[arg5]) or isTradeSkill then -- arg5 is SpellID 259 elseif (arg5 and T.SpellWhiteList[arg5]) or isTradeSkill then -- arg5 is SpellID
306 isTradeSkill = false -- for next time 260 isTradeSkill = false -- for next time
307 start(delay_short) 261 start(type(T.SpellWhiteList[arg5])=="number" and T.SpellWhiteList[arg5] or delay_short)
308 end 262 end
309 end 263 end
310 elseif events2playername[event] then 264 elseif events2playername[event] then
311 if arg2==playername and (type(events2playername[event])~="function" or events2playername[event]()) then 265 if arg2==playername and (type(events2playername[event])~="function" or events2playername[event]()) then
312 start() 266 start()
332 286
333 -- Not needed anymore 287 -- Not needed anymore
334 DegaineFrame:UnregisterEvent("ADDON_LOADED") 288 DegaineFrame:UnregisterEvent("ADDON_LOADED")
335 289
336 elseif event == "PLAYER_LOGIN" then 290 elseif event == "PLAYER_LOGIN" then
337 -- add some spell to the blacklist 291 -- BLacklis alomst all Companions and mounts
338 for i=1,GetNumCompanions("CRITTER") do 292 T.DoBlackListCrittersAndMount()
339 -- creatureID, creatureName, creatureSpellID, icon, issummoned = GetCompanionInfo("CRITTER", i)
340 local _, _, creatureSpellID = GetCompanionInfo("CRITTER", i)
341 if creatureSpellID ~= 55068 then -- Mr Chilly stealth weapons...
342 SpellBlackList[creatureSpellID] = true
343 end
344 end
345
346 -- mount is important only if the invocation is cancelled
347 for i=1,GetNumCompanions("MOUNT") do
348 -- creatureID, creatureName, creatureSpellID, icon, issummoned = GetCompanionInfo("MOUNT", i)
349 local _, _, creatureSpellID = GetCompanionInfo("MOUNT", i)
350 if creatureSpellID ~= 48778 then -- Acherus Deathcharger stealth weapons...
351 SpellBlackList[creatureSpellID] = true
352 end
353 end
354 end 293 end
355 end 294 end
356 295
357 -- Hook when standing up 296 -- Hook when standing up
358 -- (Didn't work, see http://forums.wowace.com/showthread.php?p=310547#post310547) 297 -- (Didn't work, see http://forums.wowace.com/showthread.php?p=310547#post310547)