All pastes #403100 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-03-20 04:58 UTC
rendered paste body
local base

-- if auctioneer doesn't know the price or has seen it less than twice
if (auctPrice == 0 or auctSeen < 2) then
  -- make base = 3/4 conservative price
  base = consPrice * 0.75

-- else if auctioneer is more than 3 time the conservative
elseif (auctPrice > 3 * consPrice) then
  -- make base = 3:1 weighted average of prices in favor of conservative
  base = (3 * consPrice + auctPrice) / 4

-- else if auctioneer price is less than 1.2 times the conservative
elseif (auctPrice < consPrice * 1.2) then
  -- just use auctioneer's price
  base = auctPrice

-- otherwise, auctioneer's more than 1.2 and less than 3 times the conservative
else
  -- make base = 3:1 weighted average of prices in favor of auctioneer
  base = (consPrice + 3 * auctPrice) / 4
end

-- set the auctionFee, so that the tooltip knows it's been accounted for
auctionFee = cutRate * base

-- value the item at base - 3* deposit - the auction fee
basePrice = base - 3*depositCost - auctionFee