view data.lua @ 12:2273a56762cb

Manage -partially- multiple recipes for the same item adn track the number of items made by a recipe
author contrebasse
date Sun, 03 Apr 2011 00:25:08 +0200
parents 2716889648bd
children 5c8fcfdd1e24
line wrap: on
line source
local addonName, A = ...

MillID = 51005
macroMill = "/cast "..GetSpellInfo(MillID).."\n/use "
ProspectID = 31252
macroProspect = "/cast "..GetSpellInfo(ProspectID).."\n/use "
A.data = {
	-- Mill
	-- Normal pigments
	[39151] = { -- Alabaster Pigment
		spell = macroMill,
		spellID = MillID,
		{2447,5,2,3}, -- Peacebloom
		{ 765,5,2,3},  -- Silverleaf
		{2449,5,2,4}}, -- Earthroot
	[39224] = { -- Dusky Pigment
		spell = macroMill,
		spellID = MillID,
		{ 785,5,2,3}, -- Mageroyal
		{2450,5,2,3}, -- Briarthorn
		{2452,5,2,3}, -- Swiftthistle
		{2453,5,2,4}, -- Bruiseweed
		{3820,5,2,4}}, -- Stranglekelp
	[39338] = { -- Golden Pigment
		spell = macroMill,
		spellID = MillID,
		{3369,5,2,3}, -- Grave Moss
		{3355,5,2,3}, -- Wild Steelbloom
		{3356,5,2,4}, -- Kingsblood
		{3357,5,2,4}}, -- Liferoot
	[39339] = { -- Emerald Pigment
		spell = macroMill,
		spellID = MillID,
		{3818,5,2,3}, -- Fadeleaf
		{3821,5,2,3}, -- Goldthorn
		{3358,5,3,4}, -- Khadgar's Whisker
		{3819,5,3,4}}, -- Dragon's Teeth
	[39340] = { -- Violet Pigment
		spell = macroMill,
		spellID = MillID,
		{4625,5,2,3}, -- Firebloom
		{8831,5,2,3}, -- Purple Lotus
		{8836,5,2,3}, -- Arthas' Tears
		{8838,5,2,3}, -- Sungrass
		{8839,5,2,4}, -- Blindweed
		{8845,5,2,4}, -- Ghost Mushroom
		{8846,5,2,4}}, -- Gromsblood
	[39341] = { -- Silvery Pigment
		spell = macroMill,
		spellID = MillID,
		{13464,5,2,3}, -- Golden Sansam
		{13463,5,2,3}, -- Dreamfoil
		{13465,5,2,4}, -- Mountain Silversage
		{13466,5,2,4}, -- Sorrowmoss
		{13467,5,2,4}}, -- Icecap
	[39342] = { -- Nether Pigment
		spell = macroMill,
		spellID = MillID,
		{22786,5,2,3}, -- Dreaming Glory
		{22785,5,2,3}, -- Felweed
		{22789,5,2,3}, -- Terocone
		{22787,5,2,3}, -- Ragveil
		{22790,5,2,4}, -- Ancient Lichen
		{22793,5,2,4}, -- Mana Thistle
		{22791,5,2,4}, -- Netherbloom
		{22792,5,2,4}}, -- Nightmare Vine
	[39343] = { -- Azure Pigment
		spellID = MillID,
		spell = macroMill,
		{37921,5,2,3}, -- Deadnettle
		{36901,5,2,3}, -- Goldclover
		{36907,5,2,3}, -- Talandra's Rose
		{36904,5,2,3}, -- Tiger Lily
		{39970,5,2,3}, -- Fire Leaf
		{39969,5,2.5,3}, -- Fire Seed (2:33%/3:67%)
		{36903,5,2,4}, -- Adder's Tongue
		{36906,5,2,4}, -- Icethorn
		{36905,5,2,4}}, -- Lichbloom
	[61979] = { -- Ashen Pigment
		spell = macroMill,
		spellID = MillID,
		{52983,5,2,3}, -- Cinderbloom
		{52985,5,2,3}, -- Azshara's Veil
		{52984,5,2,3}, -- Stormvine
		{52986,5,2,3}, -- Heartblossom
		{52988,5,2,4}, -- Whiptail
		{52987,5,2,4}}, -- Twilight Jasmine
	-- Rare pigments
	[43103] = { -- Verdant Pigment
		spell = macroMill,
		spellID = MillID,
		{785,5,0.25},  -- Mageroyal
		{2450,5,0.25}, -- Briarthorn
		{2452,5,0.25}, -- Swiftthistle
		{2453,5,0.5}, -- Bruiseweed
		{3820,5,0.5}}, -- Stranglekelp
	[43104] = { -- Burnt Pigment
		spell = macroMill,
		spellID = MillID,
		{3369,5,0.25}, -- Grave Moss
		{3355,5,0.25}, -- Wild Steelbloom
		{3356,5,0.5}, -- Kingsblood
		{3357,5,0.5}}, -- Liferoot
	[43105] = { -- Indigo Pigment
		spell = macroMill,
		spellID = MillID,
		{3818,5,0.25}, -- Fadeleaf
		{3821,5,0.25}, -- Goldthorn
		{3358,5,0.5}, -- Khadgar's Whisker
		{3819,5,0.5}}, -- Dragon's Teeth
	[43106] = { -- Ruby Pigment
		spell = macroMill,
		spellID = MillID,
		{4625,5,0.25}, -- Firebloom
		{8831,5,0.25}, -- Purple Lotus
		{8836,5,0.25}, -- Arthas' Tears
		{8838,5,0.25}, -- Sungrass
		{8839,5,0.5}, -- Blindweed
		{8845,5,0.5}, -- Ghost Mushroom
		{8846,5,0.5}}, -- Gromsblood
	[43107] = { -- Sapphire Pigment
		spell = macroMill,
		spellID = MillID,
		{13464,5,0.25}, -- Golden Sansam
		{13463,5,0.25}, -- Dreamfoil
		{13465,5,0.5}, -- Mountain Silversage
		{13466,5,0.5}, -- Sorrowmoss
		{13467,5,0.5}}, -- Icecap
	[43108] = { -- Ebon Pigment
		spell = macroMill,
		spellID = MillID,
		{22786,5,0.25}, -- Dreaming Glory
		{22785,5,0.25}, -- Felweed
		{22789,5,0.25}, -- Terocone
		{22787,5,0.25}, -- Ragveil
		{22790,5,0.5}, -- Ancient Lichen
		{22793,5,0.5}, -- Mana Thistle
		{22791,5,0.5}, -- Netherbloom
		{22792,5,0.5}}, -- Nightmare Vine
	[43109] = { -- Icy Pigment
		spellID = MillID,
		spell = macroMill,
		{37921,5,0.25}, -- Deadnettle
		{36901,5,0.25}, -- Goldclover
		{36907,5,0.25}, -- Talandra's Rose
		{36904,5,0.25}, -- Tiger Lily
		{39970,5,0.25}, -- Fire Leaf
		{39969,5,0.25}, -- Fire Seed
		{36903,5,0.5}, -- Adder's Tongue
		{36906,5,0.5}, -- Icethorn
		{36905,5,0.5}}, -- Lichbloom
	[61980] = { -- Burning Embers
		spell = macroMill,
		spellID = MillID,
		{52983,5,0.25}, -- Cinderbloom
		{52985,5,0.25}, -- Azshara's Veil
		{52984,5,0.25}, -- Stormvine
		{52986,5,0.25}, -- Heartblossom
		{52988,5,0.5}, -- Whiptail
		{52987,5,0.5}}, -- Twilight Jasmine

	-- Prospect
	[774] = { -- Malachite
		spell = macroProspect,
		spellID = ProspectID,
		{2770,5,0.5}}, -- Copper Ore
	[818] = { -- Tigerseye
		spell = macroProspect,
		spellID = ProspectID,
		{2770,5,0.5}}, -- Copper Ore
	[1210] = { -- Shadowgem
		spell = macroProspect,
		spellID = ProspectID,
		{2771,50,0.38}, -- Tin Ore
		{2770,5,0.1}}, -- Copper Ore
	[1705] = { -- Lesser Moonstone
		spell = macroProspect,
		spellID = ProspectID,
		{2771,5,0.38}, -- Tin Ore
		{2772,5,0.35}}, -- Iron Ore
	[1206] = { -- Moss Agate
		spell = macroProspect,
		spellID = ProspectID,
		{2771,5,0.37}}, -- Tin Ore
	[1529] = { -- Jade
		spell = macroProspect,
		spellID = ProspectID,
		{2772,5,0.35}, -- Iron Ore
		{2771,5,0.03}}, -- Tin Ore
	[7909] = { -- Aquamarine
		spell = macroProspect,
		spellID = ProspectID,
		{3858,5,0.35}, -- Mithril Ore
		{2772,5,0.05}, -- Iron Ore
		{2771,5,0.03}}, -- Tin Ore
	[3864] = { -- Citrine
		spell = macroProspect,
		spellID = ProspectID,
		{2772,5,0.36}, -- Iron Ore
		{3858,5,0.35}, -- Mithril Ore
		{2771,5,0.03}}, -- Tin Ore
	[7910] = { -- Star Ruby
		spell = macroProspect,
		spellID = ProspectID,
		{3858,5,0.36}, -- Mithril Ore
		{10620,5,0.15}, -- Thorium Ore
		{2772,5,0.05}}, -- Iron Ore
	[12799] = { -- Large Opal
		spell = macroProspect,
		spellID = ProspectID,
		{10620,5,0.31}, -- Thorium Ore
		{3858,5,0.03}}, -- Mithril Ore
	[12361] = { -- Blue Sapphire
		spell = macroProspect,
		spellID = ProspectID,
		{10620,5,0.31}, -- Thorium Ore
		{3858,5,0.02}}, -- Mithril Ore
	[12800] = { -- Azerothian Diamond
		spell = macroProspect,
		spellID = ProspectID,
		{10620,5,0.31}, -- Thorium Ore
		{3858,5,0.02}}, -- Mithril Ore
	[12364] = { -- Huge Emerald
		spell = macroProspect,
		spellID = ProspectID,
		{10620,5,0.31}, -- Thorium Ore
		{3858,5,0.02}}, -- Mithril Ore
	[23112] = { -- Golden Draenite
		spell = macroProspect,
		spellID = ProspectID,
		{23424,5,0.19}, -- Fel Iron Ore
		{23425,5,0.18}}, -- Adamantite Ore
	-- To be continued...


	-- To add : enchants, elementals, prospecting
}

-- @todo improve scanning
-- @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
function A:ScanSimpleRecipes()
	for i = 1,GetNumTradeSkills() do
		local skillName, skillType, numAvailable, isExpanded, serviceType, numSkillUps = GetTradeSkillInfo(i)
		if skillType ~= "header" then
			if GetTradeSkillNumReagents(i) == 1 then
				-- item ID
				local itemID = A.link2ID(GetTradeSkillItemLink(i))

				-- reagent ID
				local reagentID = A.link2ID(GetTradeSkillReagentItemLink(i, 1))

				-- reagent number needed
				local reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(i, 1)

				-- number of reagent created by the recipe
				local minMade, maxMade = GetTradeSkillNumMade(i)
				if maxMade==minMade then
					maxMade = nil
					if minMade==1 then
						minMade = nil
					end
				end

				-- error checking
				if not reagentID or not reagentCount or not skillName or not itemID or not minMade or not maxMade then
					print("Erreur de scan :",itemID,skillName,reagentID,reagentCount,minMade,maxMade)
				end

				-- skillName or...???
				if not A.data[itemID] then
					A.data[itemID] = {}
				end
				local newSpell = true
				for _,v in ipairs(A.data[itemID]) do
					if v.spellName==skillName then
						newSpell = nil
						break
					end
				end
				if newSpell then
					tinsert(A.data[itemID],{reagentID,reagentCount,minMade,maxMade,spellName=skillName})
				end
			end -- if
		end -- if
	end -- for
end