Quantcast

Added a new data file.

pschifferer [02-27-09 - 05:48]
Added a new data file.
Fixed an error with searching.
Started using an internal list of vendor items instead of Periodic Table.
Filename
Cauldron.toc
CauldronData.lua
CauldronTradeskill.lua
CauldronUtil.lua
diff --git a/Cauldron.toc b/Cauldron.toc
index 58ac338..d83f38c 100755
--- a/Cauldron.toc
+++ b/Cauldron.toc
@@ -25,6 +25,7 @@ CauldronShoppingList.lua
 CauldronQueue.lua
 CauldronTradeskill.lua
 CauldronUtil.lua
+CauldronData.lua

 CauldronMainUI.lua
 CauldronShoppingListUI.lua
diff --git a/CauldronData.lua b/CauldronData.lua
new file mode 100644
index 0000000..b963a9b
--- /dev/null
+++ b/CauldronData.lua
@@ -0,0 +1,78 @@
+-- $Revision$
+-- Cauldron data
+
+-- tools
+Cauldron.vars.tools = {
+	39505, -- virtuoso inking set
+	7005, -- skinning knife
+	5956, -- blacksmith hammer
+	2901, -- mining pick
+	-- gnomish army knife
+	6256, -- fishing pole
+	20815, -- jeweler's kit
+	20824, -- simple grinder
+};
+
+-- vendor item list
+Cauldron.vars.vendoritems = {
+	6217, -- copper rod
+	8923, -- essence of agony
+	4289, -- salt
+	8924, -- dust of deterioration
+	8925, -- crystal vial
+	9210, -- ghost dye
+	4291, -- silken thread
+	8150, -- deeprock salt
+	11291, -- star wood
+	1179, -- ice cold milk
+	6261, -- orange dye
+	4340, -- gray dye
+	2320, -- coarse thread
+	4341, -- yellow dye
+	2596, -- skin of dwarven stout
+	2604, -- red dye
+	4342, -- purple dye
+	159, -- refreshing spring water
+	2880, -- weak flux
+	2321, -- fine thread
+	3857, -- coal
+	30817, -- simple flour
+	18567, -- elemental flux
+	4470, -- simple wood
+	2692, -- hot spices
+	18256, -- imbued vial
+	8343, -- heavy silken thread
+	5173, -- deathweed
+	2894, -- rhapsody malt
+	2665, -- Stormwind seasoning herbs
+	2928, -- dust of decay
+	2605, -- green dye
+	4536, -- shiny red apple
+	6530, -- nightcrawlers
+	6532, -- bright baubles
+	10647, -- engineer's ink
+	2930, -- essence of pain
+	10648, -- common parchment
+	3713, -- soothing spices
+	17194, -- holiday spices
+	2324, -- bleach
+	3466, -- strong flux
+	6260, -- blue dye
+	2678, -- mild spices
+	14341, -- rune thread
+	3372, -- leaded vial
+	15409, -- refined deeprock salt
+	17196, -- holiday spirits
+	2325, -- black dye
+	4400, -- heavy stock
+	10290, -- pink dye
+	3371, -- empty vial
+	40411, -- enchanted vial
+	39354, -- light parchment
+	4399, -- wooden stock
+	40533, -- walnut stock
+	39684, -- hair trigger
+	38426, -- eternium thread
+	39501, -- heavy parchment
+	39502, -- resilient parchment
+};
diff --git a/CauldronTradeskill.lua b/CauldronTradeskill.lua
index 7948eff..562daa3 100644
--- a/CauldronTradeskill.lua
+++ b/CauldronTradeskill.lua
@@ -138,11 +138,11 @@ function Cauldron:UpdateSkills()
 					local rName, rIcon, rCount, _ = GetTradeSkillReagentInfo(i, j);
 					local rLink = GetTradeSkillReagentItemLink(i, j);
 					local rItemId = Cauldron:GetIdFromLink(rLink);
-					local value, set = self.libs.PT:ItemInSet(rItemId, "Tradeskill.Mat.BySource.Vendor");
-					local key = true;
-					if value then
-						key = false;
-					end
+--					local value, set = self.libs.PT:ItemInSet(rItemId, "Tradeskill.Mat.BySource.Vendor");
+					local key = Cauldron:IsVendorItem(rItemId);
+--					if value then
+--						key = false;
+--					end

 					local r = {
 						["index"] = j,
@@ -286,9 +286,9 @@ function Cauldron:GetSkillList(playername, skillName)
 --@alpha@
 				self:debug("GetSkillList: match by name or reagents");
 --@end-alpha@
-				if not string.find(string.lower(recipe.keywords), string.lower(search)) then
+				if not string.find(string.lower(recipe.keywords or ""), string.lower(search)) then
 --@alpha@
-					self:debug("skipping recipe: "..name.." (keywords: "..recipe.keywords..")");
+					self:debug("skipping recipe: "..name.." (keywords: "..tostring(recipe.keywords)..")");
 --@end-alpha@
 					add = false;
 				end
@@ -333,12 +333,9 @@ 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 _, rinfo in ipairs(recipe.reagents) do
 				-- check possession count
--- 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
diff --git a/CauldronUtil.lua b/CauldronUtil.lua
index 8713476..1942d43 100644
--- a/CauldronUtil.lua
+++ b/CauldronUtil.lua
@@ -1,6 +1,21 @@
 -- $Revision$
 -- Cauldron utility functions

+function Cauldron:IsVendorItem(item)
+
+	if (not item) or (type(item) ~= "number") then
+		return false;
+	end
+
+	for _,num in ipairs(Cauldron.vars.vendoritems) do
+		if num == item then
+			return true;
+		end
+	end
+
+	return false;
+end
+
 function Cauldron:GetAltReagentCount(reagentInfo)
 	self:debug("GetAltReagentCount enter");