changeset 85:996aaa818d04 v1.0beta4

Clarify error message with cross-tradeskill, and clarify the use of GetTradeSkillLine() internally
author contrebasse
date Sun, 15 May 2011 12:45:52 +0200
parents 10a6078e132f
children d571fa85e1b5
files MillingData.lua ProspectingData.lua ReagentMaker.lua SecureMenu.lua data.lua utils.lua
diffstat 6 files changed, 22 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/MillingData.lua	Sun May 15 12:12:18 2011 +0200
+++ b/MillingData.lua	Sun May 15 12:45:52 2011 +0200
@@ -129,7 +129,8 @@
 
 -- "Tradeskill" data
 local MillID = 51005
-local macroMill = "/cast "..GetSpellInfo(MillID).."\n/use %s"
+local MillName = GetSpellInfo(MillID)
+local macroMill = "/cast "..MillName.."\n/use %s"
 local MillLink = GetSpellLink(MillID)
 
 -- Add "Tradeskill" data to each "recipe"
@@ -137,6 +138,7 @@
 	for i,v in ipairs(t) do
 		v.macro = macroMill
 		v.spellID = MillID
+		v.spellName = MillName
 		v.spellLink = MillLink
 	end
 end
--- a/ProspectingData.lua	Sun May 15 12:12:18 2011 +0200
+++ b/ProspectingData.lua	Sun May 15 12:45:52 2011 +0200
@@ -56,7 +56,8 @@
 
 -- "Tradeskill" data
 local ProspectID = 31252
-local macroProspect = "/cast "..GetSpellInfo(ProspectID).."\n/use %s"
+local ProspectName = GetSpellInfo(ProspectID)
+local macroProspect = "/cast "..ProspectName.."\n/use %s"
 local ProspectLink = GetSpellLink(ProspectID)
 
 -- Add "Tradeskill" data to each "recipe"
@@ -64,6 +65,7 @@
 	for i,v in ipairs(t) do
 		v.macro = macroProspect
 		v.spellID = ProspectID
+		v.spellName = ProspectName
 		v.spellLink = ProspectLink
 	end
 end
--- a/ReagentMaker.lua	Sun May 15 12:12:18 2011 +0200
+++ b/ReagentMaker.lua	Sun May 15 12:45:52 2011 +0200
@@ -127,7 +127,12 @@
 	if not reagentID or not A.data[reagentID] then return end
 
 	-- If only one recipe is known for the reagent, use it
-	if #(A.data[reagentID]) == 1 and not A.data[reagentID][1].macro then	
+	if #(A.data[reagentID]) == 1 and not A.data[reagentID][1].macro then
+		if A.data[reagentID][1].spellName ~= GetTradeSkillLine() then
+			A.Error(A.L["The recipe to make this reagent is in another tradeskill. Currently RagentMaker can not manage such a case, sorry."])
+			return
+		end
+	
 		local numMakable, reagentIndex = A.numMakable(reagentID)
 
 		-- Try to show the recipe once if it was not found
@@ -136,7 +141,7 @@
 			numMakable, reagentIndex = A.numMakable(reagentID)
 		end
 
-		if not numMakable then		
+		if not numMakable then
 			A.Error(A.L["The recipe to make the reagent seems to be hidden, it is not makable. Try to remove the filters on the recipes."])
 			return
 		end
--- a/SecureMenu.lua	Sun May 15 12:12:18 2011 +0200
+++ b/SecureMenu.lua	Sun May 15 12:45:52 2011 +0200
@@ -339,7 +339,7 @@
 			noSkipped = menuAddItem(reagent.macro,itemID,reagent) and noSkipped
 		else
 			-- Standard tradeskill spell
-			if reagent.spellID == A.currentTradeSkill then
+			if reagent.spellName == A.currentTradeSkill then
 				existsValidEntries = true
 				noSkipped = menuAddItem(A.craft,itemID,reagent) and noSkipped
 			end
--- a/data.lua	Sun May 15 12:12:18 2011 +0200
+++ b/data.lua	Sun May 15 12:45:52 2011 +0200
@@ -39,17 +39,17 @@
 			return
 		end
 		
-		tradeskillID = GetTradeSkillLine()
+		tradeskillName = GetTradeSkillLine()
 
 		-- Check if the pseudo tradeskills have to be added
-		if tradeskillID == GetSpellInfo(25229) then -- Jewelcrafting
+		if tradeskillName == GetSpellInfo(25229) then -- Jewelcrafting
 			if not A.ProspectingDataLoaded then
 				for itemID,data in pairs(A.ProspectingData) do
 					A.data[itemID] = data
 				end
 				A.ProspectingDataLoaded = true
 			end
-		elseif tradeskillID == GetSpellInfo(45357) then -- Inscription
+		elseif tradeskillName == GetSpellInfo(45357) then -- Inscription
 			if not A.MillingDataLoaded then
 				for itemID,data in pairs(A.MillingData) do
 					A.data[itemID] = data
@@ -108,7 +108,7 @@
 					-- Cache the data
 					if addSpell then
 						local spell = {reagentID,reagentCount,minMade,maxMade}
-						spell.spellID = tradeskillID
+						spell.spellName = tradeskillName
 						spell.spellLink = recipeLink
 						spell.header = lastHeader
 						spell.manyReagents = GetTradeSkillNumReagents(i)>1
--- a/utils.lua	Sun May 15 12:12:18 2011 +0200
+++ b/utils.lua	Sun May 15 12:45:52 2011 +0200
@@ -251,18 +251,18 @@
 
 --[[
 function A.isTradeskillUnique(itemData)
-	local spellID = itemData[1].spellID
+	local spellName = itemData[1].spellName
 	
 	-- Check if the item is made by only one recipe. If not, return
 	if #itemData>1 then
 		for _,v in ipairs(itemData) do
-			if v.spellID ~= spellID then
-				spellID = nil
+			if v.spellName ~= spellName then
+				spellName = nil
 				break
 			end
 		end
 	end
 	
-	return spellID
+	return spellName
 end
 --]]
\ No newline at end of file