Mercurial > wow > inventory
changeset 218:07263a435f3c
Merchant restocking now takes the price threshold into account.
author | Zerotorescue |
---|---|
date | Sun, 06 Feb 2011 19:27:20 +0100 |
parents | ca05b8ade1ea |
children | 5f5453e6cdc4 |
files | Modules/Scanner.lua |
diffstat | 1 files changed, 16 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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