diff Modules/Config.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 a27948591159
children 311eb97cb983
line wrap: on
line diff
--- a/Modules/Config.lua	Tue Jan 18 06:33:06 2011 +0100
+++ b/Modules/Config.lua	Tue Jan 18 11:34:48 2011 +0100
@@ -95,7 +95,7 @@
 		return tostring( 7 - (itemRarity or 0) ) .. (itemName or "");
 	end,
 	get = function(info)
-		return tostring(info[#info]); -- Ace is going to be anal about this if it's a numeric value, so we transmute it into a string here then back to a number on the other side
+		return tostring(info[#info]); -- Ace is going to be bitching about this if it's a numeric value, so we transmute it into a string here then back to a number on the other side
 	end,
 	set = function(groupId, itemData)
     	-- This is NOT a real "set", we pass the widget reference to this function which contains similar, but not the same, info.
@@ -152,12 +152,12 @@
 		addon.db.profile.groups[groupName].items = {};
 	end
 	
-	-- Merge all items from all groups together
+	-- Merge all items from all groups together (we only use this to check if an item is already in a group)
 	local items = {};
 	for groupName, values in pairs(addon.db.profile.groups) do
 		if values.items then
-			for itemId, _ in pairs(values.items) do
-				items[itemId] = true;
+			for itemId, count in pairs(values.items) do
+				items[itemId] = tonumber(count) or 0;
 			end
 		end
 	end
@@ -2017,7 +2017,7 @@
 									
 									if temp.items then
 										-- Remove items that are already in another group
-										for value, _ in pairs(temp.items) do
+										for value, count in pairs(temp.items) do
 											local itemId = tonumber(value);
 											
 											local itemData = addon.ItemData:New(itemId);
@@ -2031,7 +2031,7 @@
 											else
 												-- Ensure the keys are numeric
 												temp.items[value] = nil;
-												temp.items[itemId] = true;
+												temp.items[itemId] = tonumber(count) or 0;
 											end
 										end
 									end