changeset 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
files Degaine.lua
diffstat 1 files changed, 29 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Degaine.lua	Fri Dec 10 22:46:30 2010 +0100
+++ b/Degaine.lua	Sat Jan 08 12:19:01 2011 +0100
@@ -32,6 +32,7 @@
 local ToggleSheath = ToggleSheath
 local UnitName = UnitName
 local IsMounted = IsMounted
+local GetNumCompanions, GetCompanionInfo = GetNumCompanions, GetCompanionInfo
 
 
 ---------------------------------------------------------------
@@ -115,11 +116,13 @@
 	UNIT_SPELLCAST_SUCCEEDED = true,
 }
 local SpellWhiteList = { -- Spells that do steath weapons (works with events1player)
+	-- Every recipe should be added... Automatically ?
 	[8690] = true, -- Heartstone
 	[818] = true, -- Basic Campfire
 }
---[[
+
 local SpellBlackList = { -- spells that don't stealth weapons (works with events1player)
+	-- All vanity pets should be added... Automatically ?
 	[1784] = true,  -- Stealth (Rogue)
 	[58984] = true, -- Shadowmeld (Nightelf stealth)
 
@@ -138,7 +141,7 @@
 	[53428] = true  -- Runeforge
 	-- Archaeology ?
 }
---]]
+
 local events2playername = { -- the 2nd arg is playername
 	CHAT_MSG_SAY = true,
 	CHAT_MSG_YELL = true,
@@ -221,7 +224,7 @@
 local Degaine_OnEvent = function(self,event, arg1, arg2, _, _, arg5, ...)
 	--@debug@
 	--if debug then
-		DEFAULT_CHAT_FRAME:AddMessage(event)
+		--DEFAULT_CHAT_FRAME:AddMessage(event)
 		--if arg1 then DEFAULT_CHAT_FRAME:AddMessage("arg1 = "..arg1) end
 		--if arg2 then DEFAULT_CHAT_FRAME:AddMessage("arg2 = "..arg2) end
 	--end
@@ -251,7 +254,8 @@
 		end
 	elseif events1player[event] then
 		if arg1=="player" then
-			if arg5 and SpellWhiteList[arg5] then -- arg5 is SpellID
+			--if arg5 and SpellWhiteList[arg5] then -- arg5 is SpellID
+			if arg5 and not SpellBlackList[arg5] then -- arg5 is SpellID
 				start()
 			end
 		end
@@ -280,8 +284,28 @@
 
 		-- Not needed anymore
 		DegaineFrame:UnregisterEvent("ADDON_LOADED")
+
+	elseif event == "PLAYER_LOGIN" then
+		-- add some spell to the blacklist
+		for i=1,GetNumCompanions("CRITTER") do
+			-- creatureID, creatureName, creatureSpellID, icon, issummoned = GetCompanionInfo("CRITTER", i)
+			local _, _, creatureSpellID = GetCompanionInfo("CRITTER", i)
+			if creatureSpellID ~= 55068 then -- Mr Chilly stealth weapons...
+				SpellBlackList[creatureSpellID] = true
+			end
+		end
+
+		-- mount is important only if the invocation is cancelled
+		for i=1,GetNumCompanions("MOUNT") do
+			-- creatureID, creatureName, creatureSpellID, icon, issummoned = GetCompanionInfo("MOUNT", i)
+			local _, _, creatureSpellID = GetCompanionInfo("MOUNT", i)
+			if creatureSpellID ~= 48778 then -- Acherus Deathcharger stealth weapons...
+				SpellBlackList[creatureSpellID] = true
+			end
+		end
 	end
 end
+
 -- Hook when standing up
 -- (Didn't work, see http://forums.wowace.com/showthread.php?p=310547#post310547)
 hooksecurefunc("SitStandOrDescendStart",start);
@@ -309,5 +333,6 @@
 DegaineFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
 DegaineFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
 DegaineFrame:RegisterEvent("ADDON_LOADED")
+DegaineFrame:RegisterEvent("PLAYER_LOGIN")
 activate()