Quantcast

Fixes to potential craft calculation.

pschifferer [02-24-09 - 06:40]
Fixes to potential craft calculation.
Filename
CauldronUtil.lua
diff --git a/CauldronUtil.lua b/CauldronUtil.lua
index 4b57b68..1c8a4ab 100644
--- a/CauldronUtil.lua
+++ b/CauldronUtil.lua
@@ -15,13 +15,16 @@ function Cauldron:GetPotentialCraftCount(skillInfo)
 	local count = 999999;

 	-- iterate over the reagent list and find out how many can be made for each reagent count;
-	-- the lowest value is the potential amount craftable
-	for i,rinfo in ipairs(skillInfo.reagents) do
-		local counts = Cauldron:ReagentCount(rinfo.name);
-		local makeable = math.floor(counts.total / rinfo.numRequired);
-
-		if (makeable > 0) and (count > 0) and (makeable < count) then
-			count = makeable;
+	-- the lowest value is the potential amount craftable; only count a skill if it has more
+	-- than one reagent
+	if #skillInfo.reagents > 1 then
+		for i,rinfo in ipairs(skillInfo.reagents) do
+			local counts = Cauldron:ReagentCount(rinfo.name);
+			local makeable = math.floor(counts.total / rinfo.numRequired);
+
+			if (makeable > 0) and (count > 0) and (makeable < count) then
+				count = makeable;
+			end
 		end
 	end