Quantcast

Fixed logic error in have key reagent filter.

pschifferer [02-26-09 - 02:39]
Fixed logic error in have key reagent filter.
Changed color of tooltip text for vendor-available items.
Filename
CauldronMain.lua
CauldronTradeskill.lua
diff --git a/CauldronMain.lua b/CauldronMain.lua
index cf644c4..a8df139 100644
--- a/CauldronMain.lua
+++ b/CauldronMain.lua
@@ -760,7 +760,7 @@ function Cauldron:SetTradeSkillItem(tooltip, itemIndex, reagentIndex)

 		-- let the user know if the reagent is a "non-key" reagent
 		if not reagentInfo.key then
-			tooltip:AddLine("|cff444444"..L["Available at vendor"].."|r");
+			tooltip:AddLine("|cff666666"..L["Available at vendor"].."|r");
 		end
 	else
 --		link = GetTradeSkillItemLink(itemIndex);
diff --git a/CauldronTradeskill.lua b/CauldronTradeskill.lua
index 352b753..7948eff 100644
--- a/CauldronTradeskill.lua
+++ b/CauldronTradeskill.lua
@@ -333,24 +333,21 @@ function Cauldron:GetSkillList(playername, skillName)
 			end
 		elseif self.db.realm.userdata[playername].skills[skillName].window.filter.haveKeyReagents then
 			-- check if the reagent count for key reagents is 0
-self:info("have key reagents: "..recipe.name);
-			for rname, rinfo in pairs(recipe.reagents) do
+-- self:info("have key reagents: "..recipe.name);
+			for _, rinfo in ipairs(recipe.reagents) do
 				-- check possession count
-self:info("(have key) rname: "..rname.."; key: "..rinfo.key.."; count: "..GetItemCount(rinfo.link, false));
-				if (GetItemCount(rinfo.link, false) == 0) and (rinfo.key) then
-self:info("(have key) setting add to false");
+-- self:info("(have key) rname: "..rname.."; key: "..tostring(rinfo.key).."; count: "..GetItemCount(rinfo.link, false));
+				if (GetItemCount(rinfo.link, false) < rinfo.numRequired) and (rinfo.key) then
+-- self:info("(have key) setting add to false");
 					add = false;
 				end
 			end
 		elseif self.db.realm.userdata[playername].skills[skillName].window.filter.haveAnyReagents then
 			-- check if the reagent count for any reagent is > 0
-self:info("have any reagents: "..recipe.name);
 			add = false;
-			for rname, rinfo in pairs(recipe.reagents) do
+			for _, rinfo in ipairs(recipe.reagents) do
 				-- check possession count
-self:info("(have any) rname: "..rname.."; key: "..rinfo.key.."; count: "..GetItemCount(rinfo.link, false));
 				if GetItemCount(rinfo.link, false) > 0 then
-self:info("(have any) setting add to true");
 					add = true;
 				end
 			end