diff 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
line wrap: on
line diff
--- a/Degaine.lua	Sun Feb 27 20:03:10 2011 +0100
+++ b/Degaine.lua	Sun Feb 27 20:28:52 2011 +0100
@@ -33,7 +33,6 @@
 local ToggleSheath = ToggleSheath
 local UnitName = UnitName
 local IsMounted = IsMounted
-local GetNumCompanions, GetCompanionInfo = GetNumCompanions, GetCompanionInfo
 local UnitCastingInfo = UnitCastingInfo
 local GetUnitSpeed = GetUnitSpeed
 
@@ -127,51 +126,6 @@
 	UNIT_SPELLCAST_SUCCEEDED = true,
 	UNIT_SPELLCAST_START = true, -- to ckeck tradeskill
 }
-local SpellWhiteList = { -- Spells that do steath weapons (works with events1player)
-	-- True recipes are treated separately
-	[8690] = true, -- Heartstone
-	[818] = true, -- Basic Campfire
-	[13262] = true, -- Disenchant
-	[51005] = true, -- Milling
-
-	-- Critters (exceptions)
-	[55068] = true, -- Mr Chilly
-
-	-- Mounts (exceptions)
-	[48778] = true, -- Acherus Deathcharger
-
-}
-
-local SpellBlackList = { -- spells that don't stealth weapons (works with events1player)
-	-- All vanity pets and mount are added at PLAYER_LOGIN
-
-	--
-	[1784] = true,  -- Stealth (Rogue)
-	[58984] = true, -- Shadowmeld (Nightelf stealth)
-
-	-- DK presences
-	[48263] = true, -- Blood
-	[48266] = true, -- Frost
-	[48265] = true, -- Unholy
-
-	[3714] = true, -- Path of Frost
-
-
-	-- Tradeskill spells
-	[2259] = true,  -- Alchemy
-	[45357] = true, -- Inscription
-	[3908] = true,  -- Tailoring
-	[7411] = true,  -- Enchanting
-	[2018] = true,  -- Blacksmithing
-	[4036] = true,  -- Engineering
-	[25229] = true, -- Jewelcrafting
-	[2656] = true,  -- Smelting
-	[2108] = true,  -- Leatherworking
-	[2550] = true,  -- Cooking
-	[3273] = true,  -- First Aid
-	[53428] = true  -- Runeforge
-	-- Archaeology ?
-}
 
 --[[
 -- Was used when moving prevented to play the emote when talking
@@ -301,10 +255,10 @@
 				--if isTradeSkill then
 
 				--end
-			--elseif arg5 and not SpellBlackList[arg5] then -- arg5 is SpellID
-			elseif (arg5 and SpellWhiteList[arg5]) or isTradeSkill then -- arg5 is SpellID
+			--elseif arg5 and not T.SpellBlackList[arg5] then -- arg5 is SpellID
+			elseif (arg5 and T.SpellWhiteList[arg5]) or isTradeSkill then -- arg5 is SpellID
 				isTradeSkill = false -- for next time
-				start(delay_short)
+				start(type(T.SpellWhiteList[arg5])=="number" and T.SpellWhiteList[arg5] or delay_short)
 			end
 		end
 	elseif events2playername[event] then
@@ -334,23 +288,8 @@
 		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
+		-- BLacklis alomst all Companions and mounts
+		T.DoBlackListCrittersAndMount()
 	end
 end