some more improvements

see readme_geojak for changelist compared to the main aux branch
This commit is contained in:
geojak
2022-03-27 15:07:52 +02:00
committed by GitHub
parent 4517dae952
commit 70611ba356
9 changed files with 144 additions and 40 deletions
+58 -23
View File
@@ -46,14 +46,17 @@ function post_auction(slot, k)
local start_price = state.unit_start_price
local buyout_price = state.unit_buyout_price
local kz_daily = 0
local kz_pricing = 0
--use autoprice heuristic if start bid 0 is set
if start_price == 0 then
local kz_daily = 0
local kz_pricing = 0
local kz_warn = 0
if buyout_price > 0 then
kz_pricing=1
start_price = buyout_price
end
if history.market_value(state.item_key) ~= nil then
@@ -63,39 +66,71 @@ function post_auction(slot, k)
kz_daily = 1
end
if disenchant.value(item_info.slot, item_info.quality, item_info.level) ~= nil then
buyout_price = max(buyout_price,0.85* tonumber(disenchant.value(item_info.slot, item_info.quality, item_info.level)))
end
if aux.account_data.merchant_sell[item_info.item_id] ~= nil then
if kz_daily == 0 then
start_price = max(start_price,tonumber(aux.account_data.merchant_sell[item_info.item_id]) * (1.35+3.65*math.exp(-(1/4000)* tonumber(aux.account_data.merchant_sell[item_info.item_id] ))))
buyout_price = max(buyout_price,start_price)
if history.value(state.item_key) ~= nil then
if kz_pricing == 1 and kz_daily == 1 then
buyout_price = max(buyout_price,1.0*tonumber(history.value(state.item_key)))
elseif kz_daily == 1 then
start_price = max(start_price,0.91*tonumber(history.value(state.item_key)))
else
start_price = max(start_price,tonumber(aux.account_data.merchant_sell[item_info.item_id]) * 1.35)
buyout_price = max(buyout_price,start_price)
buyout_price = max(buyout_price,0.99* tonumber(history.value(state.item_key)))
end
else
kz_warn = kz_warn + 1
end
if disenchant.value(item_info.slot, item_info.quality, item_info.level, item_info.item_id) ~= nil then
start_price = max(start_price,0.85* tonumber(disenchant.value(item_info.slot, item_info.quality, item_info.level, item_info.item_id)))
end
if aux.account_data.merchant_buy[item_info.item_id] ~= nil then
local tmp = tostring(aux.account_data.merchant_buy[item_info.item_id])
tmp = strsub(tmp,1,-3)
start_price = max(start_price,tonumber(tmp) * 1.1)
buyout_price = max(buyout_price,tonumber(tmp) * 1.15)
end
if history.value(state.item_key) ~= nil then
if kz_pricing == 1 and kz_daily == 1 then
buyout_price = max(buyout_price,1.0*tonumber(history.value(state.item_key)))
elseif kz_daily == 1 then
start_price = max(start_price,0.91*tonumber(history.value(state.item_key)))
buyout_price = max(buyout_price,0.91*tonumber(history.value(state.item_key)))
buyout_price = max(buyout_price,tonumber(tmp) * 1.15)
else
local vendor_price = 0
if aux.account_data.merchant_sell[item_info.item_id] ~= nil then
vendor_price = tonumber(aux.account_data.merchant_sell[item_info.item_id])
elseif ShaguTweaks.SellValueDB[item_info.item_id] ~= nil then
local charges = 1
if info.max_item_charges(item_info.item_id) ~= nil then
charges=info.max_item_charges(item_info.item_id)
end
vendor_price = ShaguTweaks.SellValueDB[item_info.item_id] / charges
end
if vendor_price > 0 then
if kz_daily == 0 then
start_price = max(start_price, vendor_price * (1.35+3.65*math.exp(-(1/4000)* vendor_price)))
else
start_price = max(start_price, vendor_price * 1.35)
end
else
buyout_price = max(buyout_price,0.99* tonumber(history.value(state.item_key)))
kz_warn = kz_warn + 1
end
end
start_price = max(start_price,0.75 * buyout_price)
start_price = max(start_price,0.91 * buyout_price)
buyout_price = max(start_price, buyout_price)
if kz_warn == 2 and kz_pricing == 0 then
print("WARNING, insufficient data for autopricing!")
if start_price == 0 then
return stop()
end
end
local gold = floor(start_price / COPPER_PER_GOLD)
local silver = floor(mod(start_price, COPPER_PER_GOLD) / COPPER_PER_SILVER)
local copper = aux.round(mod(start_price, COPPER_PER_SILVER))
print("bid_price: "..gold.."g "..silver.."s "..copper.."c")
gold = floor(buyout_price / COPPER_PER_GOLD)
silver = floor(mod(buyout_price, COPPER_PER_GOLD) / COPPER_PER_SILVER)
copper = aux.round(mod(buyout_price, COPPER_PER_SILVER))
print("buyout_price: "..gold.."g "..silver.."s "..copper.."c")
end
StartAuction(max(1, aux.round(start_price * item_info.aux_quantity)), aux.round(buyout_price * item_info.aux_quantity), state.duration)