# HG changeset patch # User contrebasse # Date 1291997936 -3600 # Node ID 9f8a4f3c86415141efb6432739f6e9e1e47b8250 # Parent 62abf847fef9f7ae51a58bca5c71fb871363a825 Added a blacklist for spells with only stealth in it (for now) diff -r 62abf847fef9 -r 9f8a4f3c8641 Degaine.lua --- a/Degaine.lua Fri Dec 10 16:55:44 2010 +0100 +++ b/Degaine.lua Fri Dec 10 17:18:56 2010 +0100 @@ -1,7 +1,10 @@ local AddonName = ... -- Draw your weapons automagically --- Known bugs : + +--------------------------------------------------------------- +-- Known bugs +--------------------------------------------------------------- -- If you stand up by jumping or walking it won't draw your weapon -- (it's not possible to know if you were sitting or standing before) @@ -9,6 +12,7 @@ local debug = false --@end-debug@ + --------------------------------------------------------------- -- Globals to local --------------------------------------------------------------- @@ -38,6 +42,7 @@ local t_left = -1 local delay = 2 -- seconds + --------------------------------------------------------------- -- Some stuff... --------------------------------------------------------------- @@ -60,15 +65,15 @@ BANKFRAME_OPENED = true, --function() return GossipFrame:IsShown() end, AUCTION_HOUSE_SHOW = true, } -local SpellBlacklist = { - [1784] = true, -- Stealth (Rogue) - [58984] = true, -- Shadowmeld (Nightelf stealth) -} local events1player = { -- the first arg is "player" UNIT_SPELLCAST_FAILED = true, UNIT_SPELLCAST_INTERRUPTED = true, UNIT_SPELLCAST_SUCCEEDED = true, } +local SpellBlackList = { -- spells that don't stealth weapons (works with events1player) + [1784] = true, -- Stealth (Rogue) + [58984] = true, -- Shadowmeld (Nightelf stealth) +} local events2playername = { -- the 2nd arg is playername CHAT_MSG_SAY = true, CHAT_MSG_YELL = true, @@ -94,6 +99,7 @@ end end + --------------------------------------------------------------- -- Activation functions --------------------------------------------------------------- @@ -134,7 +140,7 @@ --------------------------------------------------------------- -- Event/hooks functions --------------------------------------------------------------- -local Degaine_OnEvent = function(self,event, arg1, arg2, ...) +local Degaine_OnEvent = function(self,event, arg1, arg2, _, _, arg5, ...) --@debug@ if debug then DEFAULT_CHAT_FRAME:AddMessage(event) @@ -143,10 +149,20 @@ end --@end-debug@ - if ((events[event] and (type(events[event])~="function" or events[event]())) - or (events1player[event] and arg1=="player") - or (events2playername[event] and arg2==playername)) then - start() + if events[event] then + if type(events[event])~="function" or events[event]() then + start() + end + elseif events1player[event] then + if arg1=="player" then + if not SpellBlackList[arg5] then -- arg5 is SpellID + start() + end + end + elseif events2playername[event] then + if arg2==playername then + start() + end elseif event == "PLAYER_REGEN_ENABLED" then desactivate() @@ -191,3 +207,4 @@ DegaineFrame:RegisterEvent("PLAYER_REGEN_DISABLED") DegaineFrame:RegisterEvent("ADDON_LOADED") activate() +