diff Modules/Queue.lua @ 209:1ed7ce9b1c5d

Cleaned up Queue; errors should now stop a queue all loop rather than occur at every single group.
author Zerotorescue
date Sat, 05 Feb 2011 20:09:03 +0100
parents 5d6b3d116b80
children 2e4e52a589e5
line wrap: on
line diff
--- a/Modules/Queue.lua	Sat Feb 05 20:02:45 2011 +0100
+++ b/Modules/Queue.lua	Sat Feb 05 20:09:03 2011 +0100
@@ -28,11 +28,6 @@
 		"The recorded auction value of this item is below your price threshold.",
 		15,
 	},
-	["NO_ITEMCOUNT_ADDON"] = {
-		"|cffff0000No itemcount addon|r", -- red
-		"No compatible item count could be found.",
-		20,
-	},
 	["REMOVED"] = { -- because this is updated realtime, it is most useful around the top of the list
 		"|cffff0000Removed|r", -- red
 		"You manually removed this item from the queue.",
@@ -419,11 +414,6 @@
 	-- Prepare a table with all possible tradeskill craftables
 	local craftables = self:GetTradeskillCraftables();
 	
-	if not craftables then
-		addon:Print("No tradeskill window detected. Please open a profession before trying to queue.", addon.Colors.Red);
-		return;
-	end
-	
 	-- Forget old queue
 	twipe(queue);
 	twipe(skipped);
@@ -435,7 +425,9 @@
 		local trackAt = addon:GetOptionByKey(groupName, "trackAtCharacters");
 		
 		if trackAt[playerName] then
-			self:QueueGroup(groupName, craftables);
+			if not self:QueueGroup(groupName, craftables) then
+				return;
+			end
 		end
 	end
 	
@@ -450,13 +442,13 @@
 	
 	if not craftables then
 		addon:Print("No tradeskill window detected. Please open a profession before trying to queue.", addon.Colors.Red);
-		return;
+		return false; -- exit
 	elseif not addon.db.profile.groups[groupName] then
 		addon:Print(sformat("Tried to queue items from a group named \"%s\", but no such group exists.", groupName), addon.Colors.Red);
-		return;
+		return false; -- exit
 	elseif not addon.db.profile.groups[groupName].items then
 		addon:Debug("This group (%s) has no items.", groupName);
-		return;
+		return true; -- continue with next group
 	end
 	
 	-- Retrieve group settings
@@ -510,9 +502,8 @@
 				end
 			else
 				-- No item count addon
-				self:Skip(itemId, skipReasons.NO_ITEMCOUNT_ADDON);
-				addon:Print("No usable itemcount addon found.");
-				return;
+				addon:Print("No usable itemcount addon found.", addon.Colors.Red);
+				return false; -- exit
 			end
 		else
 			self:Skip(itemId, skipReasons.NOT_CRAFTABLE);
@@ -522,6 +513,8 @@
 	if displayQueue then
 		mod:BuildQueue();
 	end
+	
+	return true; -- continue
 end
 
 function mod:Queue(itemId, amount, bonus, craft, groupName)