diff Queue.lua @ 31:e732843b16d2 v0.1.6-BETA

Added an info box to the top of the general group. Removed the ?Don't queue when below threshold?, this is now default (can?t make it too complicated). Implemented working functionality for virtual groups. ?Include in local item data? can now be overridden in every group. Added help text at the replenishing stock indicating how auction values are used when queueing. The tabs ?add items? and ?current items? will now be hidden rather than disabled when you have a virtual group selected. The auction value/price threshold for items will now be used when queueing items.
author Zerotorescue
date Sat, 30 Oct 2010 23:04:45 +0200
parents 7d7aaa3fbe94
children 58fb38f0b447
line wrap: on
line diff
--- a/Queue.lua	Fri Oct 29 13:43:41 2010 +0200
+++ b/Queue.lua	Sat Oct 30 23:04:45 2010 +0200
@@ -76,22 +76,37 @@
 			end
 			
 			local currentStock = addon:GetItemCount(itemId, groupName);
+			
 			if currentStock >= 0 then
 				-- Current stock will be -1 when no itemcount addon was found
+				
+				-- Retrieve group settings
 				local restockTarget = addon:GetOptionByKey(groupName, "restockTarget");
 				local bonusQueue = addon:GetOptionByKey(groupName, "bonusQueue");
 				local minCraftingQueue = floor( addon:GetOptionByKey(groupName, "minCraftingQueue") * restockTarget );
 				
+				-- Calculate the amount to be queued
 				local amount = ( restockTarget - currentStock );
 				
 				if currentStock == 0 and bonusQueue > 0 then
+					-- If we have none left and the bonus queue is enabled, modify the amount to  be queued
+					
 					amount = floor( ( amount * ( bonusQueue + 1 ) ) + .5 ); -- round
 				end
 				
 				if amount > 0 and amount >= minCraftingQueue then
-					self:Queue(i, amount, groupName);
+					-- If we are queueing at least one AND more than the minimum amount, then proceed
 					
-					print("Queued " .. amount .. " of " .. itemLink);
+					-- Auction value settings
+					local priceThreshold = addon:GetOptionByKey(groupName, "priceThreshold");
+					
+					if priceThreshold == 0 or addon:GetAuctionValue(itemLink, groupName) >= priceThreshold then
+						-- If no price threshold is set or the auction value is equal to or larger than the price threshold, then proceed
+						
+						self:Queue(i, amount, groupName);
+						
+						print("Queued " .. amount .. " of " .. itemLink);
+					end
 				end
 			else
 				print("No usable itemcount addon found.");