changeset 12:9f8a4f3c8641

Added a blacklist for spells with only stealth in it (for now)
author contrebasse
date Fri, 10 Dec 2010 17:18:56 +0100
parents 62abf847fef9
children 7b1f3a9cba48
files Degaine.lua
diffstat 1 files changed, 27 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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()
+