changeset 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 ecfa62976b03
files Degaine.lua Degaine.toc Exceptions.lua
diffstat 3 files changed, 77 insertions(+), 66 deletions(-) [+]
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
 
--- a/Degaine.toc	Sun Feb 27 20:03:10 2011 +0100
+++ b/Degaine.toc	Sun Feb 27 20:28:52 2011 +0100
@@ -6,4 +6,6 @@
 ## Version: @project-version@
 ## SavedVariablesPerCharacter: Degaine_isAuto
 
+Exceptions.lua
+
 Degaine.lua
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Exceptions.lua	Sun Feb 27 20:28:52 2011 +0100
@@ -0,0 +1,70 @@
+local AddonName, T = ...
+
+local GetNumCompanions, GetCompanionInfo = GetNumCompanions, GetCompanionInfo
+
+-- Tables containing all the exceptions
+T.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] = 1.3, -- Mr Chilly
+
+	-- Mounts (exceptions)
+	[48778] = true, -- Acherus Deathcharger
+
+}
+
+T.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 ?
+}
+
+
+T.DoBlackListCrittersAndMount	= function()	-- 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...
+			T.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...
+			T.SpellBlackList[creatureSpellID] = true
+		end
+	end
+end