comparison Degaine.lua @ 31:37d2dcb3688d

Back to blacklist with vanity pets and mounts, but there are some exceptions...
author contrebasse
date Sat, 08 Jan 2011 12:19:01 +0100
parents d66bb6a8d8bb
children 64a266eaf0ef
comparison
equal deleted inserted replaced
30:d66bb6a8d8bb 31:37d2dcb3688d
30 local GetTime = GetTime 30 local GetTime = GetTime
31 local InCombatLockdown = InCombatLockdown 31 local InCombatLockdown = InCombatLockdown
32 local ToggleSheath = ToggleSheath 32 local ToggleSheath = ToggleSheath
33 local UnitName = UnitName 33 local UnitName = UnitName
34 local IsMounted = IsMounted 34 local IsMounted = IsMounted
35 local GetNumCompanions, GetCompanionInfo = GetNumCompanions, GetCompanionInfo
35 36
36 37
37 --------------------------------------------------------------- 38 ---------------------------------------------------------------
38 -- Local vars 39 -- Local vars
39 --------------------------------------------------------------- 40 ---------------------------------------------------------------
113 UNIT_SPELLCAST_FAILED = true, 114 UNIT_SPELLCAST_FAILED = true,
114 UNIT_SPELLCAST_INTERRUPTED = true, 115 UNIT_SPELLCAST_INTERRUPTED = true,
115 UNIT_SPELLCAST_SUCCEEDED = true, 116 UNIT_SPELLCAST_SUCCEEDED = true,
116 } 117 }
117 local SpellWhiteList = { -- Spells that do steath weapons (works with events1player) 118 local SpellWhiteList = { -- Spells that do steath weapons (works with events1player)
119 -- Every recipe should be added... Automatically ?
118 [8690] = true, -- Heartstone 120 [8690] = true, -- Heartstone
119 [818] = true, -- Basic Campfire 121 [818] = true, -- Basic Campfire
120 } 122 }
121 --[[ 123
122 local SpellBlackList = { -- spells that don't stealth weapons (works with events1player) 124 local SpellBlackList = { -- spells that don't stealth weapons (works with events1player)
125 -- All vanity pets should be added... Automatically ?
123 [1784] = true, -- Stealth (Rogue) 126 [1784] = true, -- Stealth (Rogue)
124 [58984] = true, -- Shadowmeld (Nightelf stealth) 127 [58984] = true, -- Shadowmeld (Nightelf stealth)
125 128
126 -- Tradeskill spells 129 -- Tradeskill spells
127 [2259] = true, -- Alchemy 130 [2259] = true, -- Alchemy
136 [2550] = true, -- Cooking 139 [2550] = true, -- Cooking
137 [3273] = true, -- First Aid 140 [3273] = true, -- First Aid
138 [53428] = true -- Runeforge 141 [53428] = true -- Runeforge
139 -- Archaeology ? 142 -- Archaeology ?
140 } 143 }
141 --]] 144
142 local events2playername = { -- the 2nd arg is playername 145 local events2playername = { -- the 2nd arg is playername
143 CHAT_MSG_SAY = true, 146 CHAT_MSG_SAY = true,
144 CHAT_MSG_YELL = true, 147 CHAT_MSG_YELL = true,
145 CHAT_MSG_TEXT_EMOTE = true, 148 CHAT_MSG_TEXT_EMOTE = true,
146 } 149 }
219 -- Event/hooks functions 222 -- Event/hooks functions
220 --------------------------------------------------------------- 223 ---------------------------------------------------------------
221 local Degaine_OnEvent = function(self,event, arg1, arg2, _, _, arg5, ...) 224 local Degaine_OnEvent = function(self,event, arg1, arg2, _, _, arg5, ...)
222 --@debug@ 225 --@debug@
223 --if debug then 226 --if debug then
224 DEFAULT_CHAT_FRAME:AddMessage(event) 227 --DEFAULT_CHAT_FRAME:AddMessage(event)
225 --if arg1 then DEFAULT_CHAT_FRAME:AddMessage("arg1 = "..arg1) end 228 --if arg1 then DEFAULT_CHAT_FRAME:AddMessage("arg1 = "..arg1) end
226 --if arg2 then DEFAULT_CHAT_FRAME:AddMessage("arg2 = "..arg2) end 229 --if arg2 then DEFAULT_CHAT_FRAME:AddMessage("arg2 = "..arg2) end
227 --end 230 --end
228 --@end-debug@ 231 --@end-debug@
229 232
249 if type(events[event])~="function" or events[event]() then 252 if type(events[event])~="function" or events[event]() then
250 start() 253 start()
251 end 254 end
252 elseif events1player[event] then 255 elseif events1player[event] then
253 if arg1=="player" then 256 if arg1=="player" then
254 if arg5 and SpellWhiteList[arg5] then -- arg5 is SpellID 257 --if arg5 and SpellWhiteList[arg5] then -- arg5 is SpellID
258 if arg5 and not SpellBlackList[arg5] then -- arg5 is SpellID
255 start() 259 start()
256 end 260 end
257 end 261 end
258 elseif events2playername[event] then 262 elseif events2playername[event] then
259 if arg2==playername then 263 if arg2==playername then
278 if Degaine_isAuto then activate() else desactivate() end 282 if Degaine_isAuto then activate() else desactivate() end
279 printState() 283 printState()
280 284
281 -- Not needed anymore 285 -- Not needed anymore
282 DegaineFrame:UnregisterEvent("ADDON_LOADED") 286 DegaineFrame:UnregisterEvent("ADDON_LOADED")
283 end 287
284 end 288 elseif event == "PLAYER_LOGIN" then
289 -- add some spell to the blacklist
290 for i=1,GetNumCompanions("CRITTER") do
291 -- creatureID, creatureName, creatureSpellID, icon, issummoned = GetCompanionInfo("CRITTER", i)
292 local _, _, creatureSpellID = GetCompanionInfo("CRITTER", i)
293 if creatureSpellID ~= 55068 then -- Mr Chilly stealth weapons...
294 SpellBlackList[creatureSpellID] = true
295 end
296 end
297
298 -- mount is important only if the invocation is cancelled
299 for i=1,GetNumCompanions("MOUNT") do
300 -- creatureID, creatureName, creatureSpellID, icon, issummoned = GetCompanionInfo("MOUNT", i)
301 local _, _, creatureSpellID = GetCompanionInfo("MOUNT", i)
302 if creatureSpellID ~= 48778 then -- Acherus Deathcharger stealth weapons...
303 SpellBlackList[creatureSpellID] = true
304 end
305 end
306 end
307 end
308
285 -- Hook when standing up 309 -- Hook when standing up
286 -- (Didn't work, see http://forums.wowace.com/showthread.php?p=310547#post310547) 310 -- (Didn't work, see http://forums.wowace.com/showthread.php?p=310547#post310547)
287 hooksecurefunc("SitStandOrDescendStart",start); 311 hooksecurefunc("SitStandOrDescendStart",start);
288 312
289 313
307 -- Global events 331 -- Global events
308 DegaineFrame:RegisterEvent("GOSSIP_CLOSED") 332 DegaineFrame:RegisterEvent("GOSSIP_CLOSED")
309 DegaineFrame:RegisterEvent("PLAYER_REGEN_ENABLED") 333 DegaineFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
310 DegaineFrame:RegisterEvent("PLAYER_REGEN_DISABLED") 334 DegaineFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
311 DegaineFrame:RegisterEvent("ADDON_LOADED") 335 DegaineFrame:RegisterEvent("ADDON_LOADED")
336 DegaineFrame:RegisterEvent("PLAYER_LOGIN")
312 activate() 337 activate()
313 338