# HG changeset patch # User Zerotorescue # Date 1297016840 -3600 # Node ID 07263a435f3c9666bca170b6767cd54f700f2864 # Parent ca05b8ade1ea318f7939af48efde5dc6c3115a99 Merchant restocking now takes the price threshold into account. diff -r ca05b8ade1ea -r 07263a435f3c Modules/Scanner.lua --- a/Modules/Scanner.lua Sun Feb 06 19:26:59 2011 +0100 +++ b/Modules/Scanner.lua Sun Feb 06 19:27:20 2011 +0100 @@ -354,10 +354,11 @@ -- Settings local trackAt = addon:GetOptionByKey(groupName, "trackAtCharacters"); local localItemData = addon:GetOptionByKey(groupName, "localItemData"); - local requiredItems, bonusQueue, minCraftingQueue, isRefillEnabled; + local requiredItems, bonusQueue, priceThreshold, minCraftingQueue, isRefillEnabled; if isRestock then requiredItems = addon:GetOptionByKey(groupName, "restockTarget"); bonusQueue = addon:GetOptionByKey(groupName, "bonusQueue"); + priceThreshold = addon:GetOptionByKey(groupName, "priceThreshold"); minCraftingQueue = floor( addon:GetOptionByKey(groupName, "minCraftingQueue") * requiredItems ); -- If the minCraftingQueue is 5% and restockTarget is 60, this will result in 3 else isRefillEnabled = addon:GetOptionByKey(groupName, "autoRefill"); @@ -390,16 +391,22 @@ end if missingItems > 0 and (not isRestock or missingItems >= minCraftingQueue) then - -- Check how many are available - local availableItems = ((containerItem.totalCount) or 0); - -- Calculate how many we'll be moving (less missing than available? use missing, otherwise use available) - -- -1 available items indicates unlimited amount, in that case we must cap at missing items - local moving = (((availableItems == -1 or missingItems <= availableItems) and missingItems) or availableItems); + + -- Get auction value when it is relevant + local value = (isRestock and priceThreshold ~= 0 and addon:GetAuctionValue(IdToItemLink(itemId), groupName)); - if availableItems == -1 or availableItems > 0 then - addon:Debug("Insufficient %s but this location has %d (moving %d)", IdToItemLink(itemId), availableItems, moving); + if not isRestock or priceThreshold == 0 or value == -1 or value >= priceThreshold then + -- Check how many are available + local availableItems = ((containerItem.totalCount) or 0); + -- Calculate how many we'll be moving (less missing than available? use missing, otherwise use available) + -- -1 available items indicates unlimited amount, in that case we must cap at missing items + local moving = (((availableItems == -1 or missingItems <= availableItems) and missingItems) or availableItems); - Mover:AddMove(itemId, moving, missingItems, availableItems, containerItem.price); + if availableItems == -1 or availableItems > 0 then + addon:Debug("Insufficient %s but this location has %d (moving %d)", IdToItemLink(itemId), availableItems, moving); + + Mover:AddMove(itemId, moving, missingItems, availableItems, containerItem.price); + end end end end