|
|
|
|
@ -156,15 +156,19 @@ function Post:ProcessItem(itemString)
|
|
|
|
|
if toPost then |
|
|
|
|
local bid |
|
|
|
|
bid, buyout, reason = Post:GetPostPrice(itemString, operation) |
|
|
|
|
local postTime = (operation.duration == 48 and 3) or (operation.duration == 24 and 2) or 1 |
|
|
|
|
|
|
|
|
|
for i = 1, #toPost do |
|
|
|
|
local stackSize, numStacks = unpack(toPost[i]) |
|
|
|
|
|
|
|
|
|
-- Increase the bid/buyout based on how many items we're posting |
|
|
|
|
local stackBid, stackBuyout = floor(bid * stackSize), floor(buyout * stackSize) |
|
|
|
|
Post:QueueItemToPost(itemString, numStacks, stackSize, stackBid, stackBuyout, postTime, operation) |
|
|
|
|
tinsert(data, { numStacks = numStacks, stackSize = stackSize, buyout = buyout, postTime = postTime }) |
|
|
|
|
if not bid or not buyout then |
|
|
|
|
toPost = nil |
|
|
|
|
reason = reason or "invalid" |
|
|
|
|
else |
|
|
|
|
local postTime = (operation.duration == 48 and 3) or (operation.duration == 24 and 2) or 1 |
|
|
|
|
for i = 1, #toPost do |
|
|
|
|
local stackSize, numStacks = unpack(toPost[i]) |
|
|
|
|
|
|
|
|
|
-- Increase the bid/buyout based on how many items we're posting |
|
|
|
|
local stackBid, stackBuyout = floor(bid * stackSize), floor(buyout * stackSize) |
|
|
|
|
Post:QueueItemToPost(itemString, numStacks, stackSize, stackBid, stackBuyout, postTime, operation) |
|
|
|
|
tinsert(data, { numStacks = numStacks, stackSize = stackSize, buyout = buyout, postTime = postTime }) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
@ -203,6 +207,9 @@ function Post:ShouldPost(itemString, operation, numInBags)
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
local prices = TSM.Util:GetItemPrices(operation, itemString) |
|
|
|
|
if not prices.minPrice or not prices.maxPrice or not prices.normalPrice or not prices.undercut then |
|
|
|
|
return nil, "invalid", numInBags |
|
|
|
|
end |
|
|
|
|
if buyout and buyout <= prices.minPrice then |
|
|
|
|
-- lowest is below min price |
|
|
|
|
if not prices.resetPrice then |
|
|
|
|
@ -253,11 +260,14 @@ function Post:GetPostPrice(itemString, operation)
|
|
|
|
|
local lowestBuyout, lowestBid, lowestOwner, isWhitelist, isPlayer = TSM.Scan:GetLowestAuction(itemString, operation) |
|
|
|
|
local bid, buyout, info |
|
|
|
|
local prices = TSM.Util:GetItemPrices(operation, itemString) |
|
|
|
|
if not prices.minPrice or not prices.maxPrice or not prices.normalPrice or not prices.undercut then |
|
|
|
|
return nil, nil, "invalid" |
|
|
|
|
end |
|
|
|
|
if not lowestOwner then |
|
|
|
|
-- No other auctions up, default to normalPrice |
|
|
|
|
info = "postingNormal" |
|
|
|
|
buyout = prices.normalPrice |
|
|
|
|
elseif prices.resetPrice and lowestBuyout <= prices.minPrice then |
|
|
|
|
elseif prices.resetPrice and lowestBuyout and lowestBuyout <= prices.minPrice then |
|
|
|
|
-- item is below min price and a priceReset is set |
|
|
|
|
if operation.priceReset == "minPrice" then |
|
|
|
|
info = "postingResetMin" |
|
|
|
|
@ -270,10 +280,14 @@ function Post:GetPostPrice(itemString, operation)
|
|
|
|
|
error("Unknown 'below minimum' price setting.") |
|
|
|
|
end |
|
|
|
|
buyout = prices.resetPrice |
|
|
|
|
elseif isPlayer or (isWhitelist and lowestBuyout - prices.undercut <= prices.maxPrice) then |
|
|
|
|
elseif isPlayer or (isWhitelist and lowestBuyout and lowestBuyout - prices.undercut <= prices.maxPrice) then |
|
|
|
|
-- Either we already have one up or someone on the whitelist does |
|
|
|
|
bid, buyout = min(lowestBid, lowestBuyout), lowestBuyout |
|
|
|
|
info = isPlayer and "postingPlayer" or "postingWhitelist" |
|
|
|
|
elseif not lowestBuyout then |
|
|
|
|
-- We have an owner record but no valid buyout; treat as no reliable floor. |
|
|
|
|
info = "postingNormal" |
|
|
|
|
buyout = prices.normalPrice |
|
|
|
|
else |
|
|
|
|
-- we've been undercut and we are going to undercut back |
|
|
|
|
buyout = lowestBuyout - prices.undercut |
|
|
|
|
|