diff Modules/Queue.lua @ 140:cd461a41723c

Now keeping track how many times an item has been queued into your favorite crafting addon.
author Zerotorescue
date Tue, 18 Jan 2011 11:34:48 +0100
parents 396c2960d54d
children 8eb0f5b5a885
line wrap: on
line diff
--- a/Modules/Queue.lua	Tue Jan 18 06:33:06 2011 +0100
+++ b/Modules/Queue.lua	Tue Jan 18 11:34:48 2011 +0100
@@ -33,6 +33,14 @@
 				
 				OnQueueCancel();
 				return;
+			else
+				-- Update the crafted-item count
+				for groupName, values in pairs(addon.db.profile.groups) do
+					if values.items and values.items[q.itemId] then
+						values.items[q.itemId] = tonumber(values.items[q.itemId]) + 1;
+						break;
+					end
+				end
 			end
 		else
 			addon:Debug("Lost %s", IdToItemLink(q.itemId));
@@ -273,7 +281,7 @@
 	local minCraftingQueue = floor( addon:GetOptionByKey(groupName, "minCraftingQueue") * restockTarget ); -- If the minCraftingQueue is 5% and restockTarget is 60, this will result in 3
 	local priceThreshold = addon:GetOptionByKey(groupName, "priceThreshold");
 	
-	for itemId in pairs(addon.db.profile.groups[groupName].items) do
+	for itemId, count in pairs(addon.db.profile.groups[groupName].items) do
 		if craftables[itemId] then
 			local currentStock = addon:GetItemCount(itemId, groupName);