diff data.lua @ 3:ed0582126cae

The base features semms to work.
author contrebasse
date Sat, 02 Apr 2011 01:49:39 +0200
parents eba26c900e99
children 17844b0b88c1
line wrap: on
line diff
--- a/data.lua	Tue Mar 29 22:06:36 2011 +0200
+++ b/data.lua	Sat Apr 02 01:49:39 2011 +0200
@@ -1,71 +1,89 @@
 local addonName, A = ...
 
-
-A.Mill = "/use "..GetSpellInfo(51005)
+MillID = 51005
+macroMill = "/cast "..GetSpellInfo(51005).."\n/use "
 A.data = {
 	-- Mill
 	[39151] = { -- Alabaster Pigment
-		{2447,5, spell = A.Mill}, -- Peacebloom
-		{765,5, spell = A.Mill},  -- Silverleaf
-		{2449,5, spell = A.Mill}}, -- Earthroot
+		spell = macroMill,
+		spellID = MillID,
+		{2447,5}, -- Peacebloom
+		{765,5},  -- Silverleaf
+		{2449,5}}, -- Earthroot
 	[39224] = { -- Dusky Pigment
-		{785,5, spell = A.Mill},  -- Mageroyal
-		{2450,5, spell = A.Mill}, -- Briarthorn
-		{2452,5, spell = A.Mill}, -- Swiftthistle
-		{2453,5, spell = A.Mill}, -- Bruiseweed
-		{3820,5, spell = A.Mill}}, -- Stranglekelp
+		spell = macroMill,
+		spellID = MillID,
+		{785,5},  -- Mageroyal
+		{2450,5}, -- Briarthorn
+		{2452,5}, -- Swiftthistle
+		{2453,5}, -- Bruiseweed
+		{3820,5}}, -- Stranglekelp
 	[39338] = { -- Golden Pigment
-		{3369,5, spell = A.Mill}, -- Grave Moss
-		{3355,5, spell = A.Mill}, -- Wild Steelbloom
-		{3356,5, spell = A.Mill}, -- Kingsblood
-		{3357,5, spell = A.Mill}}, -- Liferoot
+		spell = macroMill,
+		spellID = MillID,
+		{3369,5}, -- Grave Moss
+		{3355,5}, -- Wild Steelbloom
+		{3356,5}, -- Kingsblood
+		{3357,5}}, -- Liferoot
 	[39339] = { -- Emerald Pigment
-		{3818,5, spell = A.Mill}, -- Fadeleaf
-		{3821,5, spell = A.Mill}, -- Goldthorn
-		{3358,5, spell = A.Mill}, -- Khadgar's Whisker
-		{3819,5, spell = A.Mill}}, -- Dragon's Teeth
+		spell = macroMill,
+		spellID = MillID,
+		{3818,5}, -- Fadeleaf
+		{3821,5}, -- Goldthorn
+		{3358,5}, -- Khadgar's Whisker
+		{3819,5}}, -- Dragon's Teeth
 	[39340] = { -- Violet Pigment
-		{4625,5, spell = A.Mill}, -- Firebloom
-		{8831,5, spell = A.Mill}, -- Purple Lotus
-		{8836,5, spell = A.Mill}, -- Arthas' Tears
-		{8838,5, spell = A.Mill}, -- Sungrass
-		{8839,5, spell = A.Mill}, -- Blindweed
-		{8845,5, spell = A.Mill}, -- Ghost Mushroom
-		{8846,5, spell = A.Mill}}, -- Gromsblood
+		spell = macroMill,
+		spellID = MillID,
+		{4625,5}, -- Firebloom
+		{8831,5}, -- Purple Lotus
+		{8836,5}, -- Arthas' Tears
+		{8838,5}, -- Sungrass
+		{8839,5}, -- Blindweed
+		{8845,5}, -- Ghost Mushroom
+		{8846,5}}, -- Gromsblood
 	[39341] = { -- Silvery Pigment
-		{13464,5, spell = A.Mill}, -- Golden Sansam
-		{13463,5, spell = A.Mill}, -- Dreamfoil
-		{13465,5, spell = A.Mill}, -- Mountain Silversage
-		{13466,5, spell = A.Mill}, -- Sorrowmoss
-		{13467,5, spell = A.Mill}}, -- Icecap
+		spell = macroMill,
+		spellID = MillID,
+		{13464,5}, -- Golden Sansam
+		{13463,5}, -- Dreamfoil
+		{13465,5}, -- Mountain Silversage
+		{13466,5}, -- Sorrowmoss
+		{13467,5}}, -- Icecap
 	[39342] = { -- Nether Pigment
-		{22786,5, spell = A.Mill}, -- Dreaming Glory
-		{22785,5, spell = A.Mill}, -- Felweed
-		{22789,5, spell = A.Mill}, -- Terocone
-		{22787,5, spell = A.Mill}, -- Ragveil
-		{22790,5, spell = A.Mill}, -- Ancient Lichen
-		{22793,5, spell = A.Mill}, -- Mana Thistle
-		{22791,5, spell = A.Mill}, -- Netherbloom
-		{22792,5, spell = A.Mill}}, -- Nightmare Vine
+		spell = macroMill,
+		spellID = MillID,
+		{22786,5}, -- Dreaming Glory
+		{22785,5}, -- Felweed
+		{22789,5}, -- Terocone
+		{22787,5}, -- Ragveil
+		{22790,5}, -- Ancient Lichen
+		{22793,5}, -- Mana Thistle
+		{22791,5}, -- Netherbloom
+		{22792,5}}, -- Nightmare Vine
 	[39343] = { -- Azure Pigment
-		{37921,5, spell = A.Mill}, -- Deadnettle
-		{36901,5, spell = A.Mill}, -- Goldclover
-		{36907,5, spell = A.Mill}, -- Talandra's Rose
-		{36904,5, spell = A.Mill}, -- Tiger Lily
-		{39970,5, spell = A.Mill}, -- Fire Leaf
-		{39969,5, spell = A.Mill}, -- Fire Seed
-		{36903,5, spell = A.Mill}, -- Fire Seed
-		{36906,5, spell = A.Mill}, -- Icethorn
-		{36905,5, spell = A.Mill}}, -- Icethorn
+		spellID = MillID,
+		spell = macroMill,
+		{37921,5}, -- Deadnettle
+		{36901,5}, -- Goldclover
+		{36907,5}, -- Talandra's Rose
+		{36904,5}, -- Tiger Lily
+		{39970,5}, -- Fire Leaf
+		{39969,5}, -- Fire Seed
+		{36903,5}, -- Fire Seed
+		{36906,5}, -- Icethorn
+		{36905,5}}, -- Icethorn
 	[61979] = { -- Ashen Pigment
-		{52983,5, spell = A.Mill}, -- Cinderbloom
-		{52985,5, spell = A.Mill}, -- Azshara's Veil
-		{52984,5, spell = A.Mill}, -- Stormvine
-		{52986,5, spell = A.Mill}, -- Heartblossom
-		{52988,5, spell = A.Mill}, -- Whiptail
-		{52987,5, spell = A.Mill}}, -- Twilight Jasmine
+		spell = macroMill,
+		spellID = MillID,
+		{52983,5}, -- Cinderbloom
+		{52985,5}, -- Azshara's Veil
+		{52984,5}, -- Stormvine
+		{52986,5}, -- Heartblossom
+		{52988,5}, -- Whiptail
+		{52987,5}}, -- Twilight Jasmine
 
-	-- To add : pigments, enchants, elementals
+	-- To add : enchants, elementals, prospecting
 }
 A.data[43103] = A.data[39224] -- Verdant Pigment
 A.data[43104] = A.data[39338] -- Burnt Pigment
@@ -81,7 +99,6 @@
 -- @todo rescan when a new refipe appears (TRADESKILL_UPDATE ?)
 -- @todo be sure that skillName is unique, or use something else
 -- @todo add support for multi-reagents recipes
-local sfind = string.find
 function A:ScanSimpleRecipes()
 	for i = 1,GetNumTradeSkills() do
 		local skillName, skillType, numAvailable, isExpanded, serviceType, numSkillUps = GetTradeSkillInfo(i)
@@ -91,8 +108,7 @@
 				local itemID = A.link2ID(GetTradeSkillItemLink(i))
 
 				-- reagent ID
-				local link = GetTradeSkillReagentItemLink(i, 1)
-				local reagentID = A.link2ID(link)
+				local reagentID = A.link2ID(GetTradeSkillReagentItemLink(i, 1))
 
 				-- reagent number needed
 				local reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(i, 1)
@@ -103,10 +119,9 @@
 					print(itemID," ",skillName," ",reagentID," ",reagentCount)
 				end
 
-				if not A.data[itemID] or not A.data[itemID][skillName] then
-					A.data[itemID] = {[skillName] = {reagentID,reagentCount}}
+				if not A.data[itemID] then
+					A.data[itemID] = {{reagentID,reagentCount}}
 				end
-			else
 			end -- if
 		end -- if
 	end -- for