diff ReagentMaker.lua @ 108:618163a6d970 v1.0beta13

Always show counts and bypass all filtering and searches
author contrebasse
date Thu, 02 Jun 2011 14:12:06 +0200
parents d64a19e5a47d
children d60d6b4cab0c
line wrap: on
line diff
--- a/ReagentMaker.lua	Thu Jun 02 00:57:17 2011 +0200
+++ b/ReagentMaker.lua	Thu Jun 02 14:12:06 2011 +0200
@@ -116,6 +116,10 @@
 
 -- Function run after selecting a item in the tradeskill window
 function A.ProcessReagent(btn, ...)
+	--SPELL_FAILED_REAGENTS = "Missing reagent: %s";
+	--ERR_SPELL_FAILED_REAGENTS_GENERIC = "Missing reagent";
+	--ERR_INTERNAL_BAG_ERROR = "Internal Bag Error";
+	--SPELL_FAILED_ERROR = "Internal error";
 
 	-- Do not manage guild tradeskill
 	if IsTradeSkillGuild() or IsTradeSkillLinked() then return end
@@ -141,16 +145,22 @@
 			return
 		end
 
-		local numMakable, reagentIndex = A.numMakable(reagentID)
+		local reagentIndex = A.findSkillIndex(reagentID) -- finds only the first recipe that creates the reagent, should check recipe name too
 
 		-- Try to show the recipe by removing filters once if it was not found
 		if not reagentIndex then
 			A.SaveActiveFilters(A.data[reagentID][1].header)
-			numMakable, reagentIndex = A.numMakable(reagentID)
+			reagentIndex = A.findSkillIndex(reagentID)
+		end
+		if not reagentIndex 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."])
+			A.RestoreActiveFilters()
+			return
 		end
 
+		local numMakable = A.numMakable(reagentID)
 		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."])
+			A.Error(A.L["There was a problem while retrieving informations, please retry."])
 			A.RestoreActiveFilters()
 			return
 		end
@@ -291,7 +301,8 @@
 		else
 			-- Count and show
 			local numMakable = A.numMakable(reagentID)
-			if not numMakable or #(A.data[reagentID]) ~= 1 or A.data[reagentID][1].macro then
+			--if not numMakable or #(A.data[reagentID]) ~= 1 or A.data[reagentID][1].macro then
+			if not numMakable then
 				label:SetText("?")
 				label:SetTextColor(0, 0.5, 1, 1) -- blue
 			else