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
+7
View File
@@ -1,3 +1,10 @@
1. Added auto bid feature, doubled the existing auto buy code and slighly editted 1. Added auto bid feature, doubled the existing auto buy code and slighly editted
2. Added auto pricing heuristic, these are activate when posting an item with bid price 0, the buyout price works as a minimum 2. Added auto pricing heuristic, these are activate when posting an item with bid price 0, the buyout price works as a minimum
3. Added a keybind for the post button, this significantly speeds up mass posting of items 3. Added a keybind for the post button, this significantly speeds up mass posting of items
4. Changed the default post stack size to rand(1,max) instead of always max
5. FIXED TWILLIGHT CULTIST SET NOT DISENCHATABLE
6. use SHagu tweaks vendor values if aux values not avaialbe
7. dont auto bid on own items
8. new filter disenchant-percent and bid-disencahnt-percent
9. enchanting created wands are not encahntabke, same with twillight stuff at 5. reworked implementation for easier addition
10. disenchant values are calcualted from min(value,value_today), this protects users from low enchanting mat prices
+1
View File
@@ -1,5 +1,6 @@
## Interface: 11200 ## Interface: 11200
## Author: shirsig ## Author: shirsig
## OptionalDeps: ShaguTweaks
## Title: aux ## Title: aux
## Notes: Auction House replacement ## Notes: Auction House replacement
## SavedVariables: aux ## SavedVariables: aux
+14 -5
View File
@@ -33,21 +33,30 @@ local WEAPON = T.set(
'INVTYPE_RANGEDRIGHT' 'INVTYPE_RANGEDRIGHT'
) )
function M.value(slot, quality, level) function M.value(slot, quality, level, item_id)
local expectation local expectation
for _, event in distribution(slot, quality, level) do for _, event in distribution(slot, quality, level, item_id) do
local value = history.value(event.item_id .. ':' .. 0) local value = history.value(event.item_id .. ':' .. 0)
if not value then if not value then
return return
else else
local value_today = history.market_value(event.item_id .. ':' .. 0)
if value_today then
value=min(value,value_today)
end
expectation = (expectation or 0) + event.probability * (event.min_quantity + event.max_quantity) / 2 * value expectation = (expectation or 0) + event.probability * (event.min_quantity + event.max_quantity) / 2 * value
end end
end end
return expectation return expectation
end end
function M.distribution(slot, quality, level) function M.distribution(slot, quality, level, item_id)
if not ARMOR[slot] and not WEAPON[slot] or level == 0 then if not ARMOR[slot] and not WEAPON[slot] or level == 0
--twillight cultist items are not disenchantable
or item_id==20408 or item_id==20407 or item_id==20406
--enchanting created wands are not disenchantable
or item_id==11288 or item_id==11290 or item_id==11287 or item_id==11289
then
return T.acquire() return T.acquire()
end end
+57 -22
View File
@@ -46,14 +46,17 @@ function post_auction(slot, k)
local start_price = state.unit_start_price local start_price = state.unit_start_price
local buyout_price = state.unit_buyout_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 --use autoprice heuristic if start bid 0 is set
if start_price == 0 then if start_price == 0 then
local kz_daily = 0
local kz_pricing = 0
local kz_warn = 0
if buyout_price > 0 then if buyout_price > 0 then
kz_pricing=1 kz_pricing=1
start_price = buyout_price
end end
if history.market_value(state.item_key) ~= nil then if history.market_value(state.item_key) ~= nil then
@@ -63,18 +66,20 @@ function post_auction(slot, k)
kz_daily = 1 kz_daily = 1
end end
if disenchant.value(item_info.slot, item_info.quality, item_info.level) ~= nil then if history.value(state.item_key) ~= nil then
buyout_price = max(buyout_price,0.85* tonumber(disenchant.value(item_info.slot, item_info.quality, item_info.level))) 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
buyout_price = max(buyout_price,0.99* tonumber(history.value(state.item_key)))
end
else
kz_warn = kz_warn + 1
end end
if aux.account_data.merchant_sell[item_info.item_id] ~= nil then if disenchant.value(item_info.slot, item_info.quality, item_info.level, item_info.item_id) ~= nil then
if kz_daily == 0 then start_price = max(start_price,0.85* tonumber(disenchant.value(item_info.slot, item_info.quality, item_info.level, item_info.item_id)))
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)
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)
end
end end
if aux.account_data.merchant_buy[item_info.item_id] ~= nil then if aux.account_data.merchant_buy[item_info.item_id] ~= nil then
@@ -82,20 +87,50 @@ function post_auction(slot, k)
tmp = strsub(tmp,1,-3) tmp = strsub(tmp,1,-3)
start_price = max(start_price,tonumber(tmp) * 1.1) start_price = max(start_price,tonumber(tmp) * 1.1)
buyout_price = max(buyout_price,tonumber(tmp) * 1.15) buyout_price = max(buyout_price,tonumber(tmp) * 1.15)
end else
local vendor_price = 0
if history.value(state.item_key) ~= nil then if aux.account_data.merchant_sell[item_info.item_id] ~= nil then
if kz_pricing == 1 and kz_daily == 1 then vendor_price = tonumber(aux.account_data.merchant_sell[item_info.item_id])
buyout_price = max(buyout_price,1.0*tonumber(history.value(state.item_key))) elseif ShaguTweaks.SellValueDB[item_info.item_id] ~= nil then
elseif kz_daily == 1 then local charges = 1
start_price = max(start_price,0.91*tonumber(history.value(state.item_key))) if info.max_item_charges(item_info.item_id) ~= nil then
buyout_price = max(buyout_price,0.91*tonumber(history.value(state.item_key))) 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 else
buyout_price = max(buyout_price,0.99* tonumber(history.value(state.item_key))) kz_warn = kz_warn + 1
end end
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 end
StartAuction(max(1, aux.round(start_price * item_info.aux_quantity)), aux.round(buyout_price * item_info.aux_quantity), state.duration) StartAuction(max(1, aux.round(start_price * item_info.aux_quantity)), aux.round(buyout_price * item_info.aux_quantity), state.duration)
+2 -2
View File
@@ -147,11 +147,11 @@ function scan_page(i)
history.process_auction(auction_info) history.process_auction(auction_info)
if (get_state().params.auto_bid_validator or pass)(auction_info) then if (get_state().params.auto_bid_validator or pass)(auction_info) and auction_info.owner ~= UnitName("player") then
local send_signal, signal_received = aux.signal() local send_signal, signal_received = aux.signal()
aux.when(signal_received, scan_page, i) aux.when(signal_received, scan_page, i)
return aux.place_bid(auction_info.query_type, auction_info.index, auction_info.bid_price, send_signal) return aux.place_bid(auction_info.query_type, auction_info.index, auction_info.bid_price, send_signal)
elseif (get_state().params.auto_buy_validator or pass)(auction_info) then elseif (get_state().params.auto_buy_validator or pass)(auction_info) and auction_info.owner ~= UnitName("player") then
local send_signal, signal_received = aux.signal() local send_signal, signal_received = aux.signal()
aux.when(signal_received, scan_page, i) aux.when(signal_received, scan_page, i)
return aux.place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, send_signal) return aux.place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, send_signal)
+9 -2
View File
@@ -54,7 +54,7 @@ function M.extend_tooltip(tooltip, link, quantity)
quantity = IsShiftKeyDown() and quantity or 1 quantity = IsShiftKeyDown() and quantity or 1
local item_info = T.temp-info.item(item_id) local item_info = T.temp-info.item(item_id)
if item_info then if item_info then
local distribution = disenchant.distribution(item_info.slot, item_info.quality, item_info.level) local distribution = disenchant.distribution(item_info.slot, item_info.quality, item_info.level, item_id)
if getn(distribution) > 0 then if getn(distribution) > 0 then
if settings.disenchant_distribution then if settings.disenchant_distribution then
tooltip:AddLine('Disenchants into:', aux.color.tooltip.disenchant.distribution()) tooltip:AddLine('Disenchants into:', aux.color.tooltip.disenchant.distribution())
@@ -64,7 +64,7 @@ function M.extend_tooltip(tooltip, link, quantity)
end end
end end
if settings.disenchant_value then if settings.disenchant_value then
local disenchant_value = disenchant.value(item_info.slot, item_info.quality, item_info.level) local disenchant_value = disenchant.value(item_info.slot, item_info.quality, item_info.level, item_id)
tooltip:AddLine('Disenchant: ' .. (disenchant_value and money.to_string2(disenchant_value) or UNKNOWN), aux.color.tooltip.disenchant.value()) tooltip:AddLine('Disenchant: ' .. (disenchant_value and money.to_string2(disenchant_value) or UNKNOWN), aux.color.tooltip.disenchant.value())
end end
end end
@@ -77,6 +77,13 @@ function M.extend_tooltip(tooltip, link, quantity)
end end
if settings.merchant_sell then if settings.merchant_sell then
local price = info.merchant_info(item_id) local price = info.merchant_info(item_id)
if price == nil and ShaguTweaks.SellValueDB[item_id] ~= nil then
local charges = 1
if info.max_item_charges(item_id) ~= nil then
charges=info.max_item_charges(item_id)
end
price = ShaguTweaks.SellValueDB[item_id] / charges
end
if price ~= 0 then if price ~= 0 then
tooltip:AddLine('Vendor: ' .. (price and money.to_string2(price * quantity) or UNKNOWN), aux.color.tooltip.merchant()) tooltip:AddLine('Vendor: ' .. (price and money.to_string2(price * quantity) or UNKNOWN), aux.color.tooltip.merchant())
end end
+6 -2
View File
@@ -431,19 +431,23 @@ function update_item(item)
UIDropDownMenu_SetSelectedValue(duration_dropdown, settings.duration) UIDropDownMenu_SetSelectedValue(duration_dropdown, settings.duration)
hide_checkbox:SetChecked(settings.hidden) hide_checkbox:SetChecked(settings.hidden)
local ii = 1
if selected_item.max_charges then if selected_item.max_charges then
for i = selected_item.max_charges, 1, -1 do for i = selected_item.max_charges, 1, -1 do
if selected_item.availability[i] > 0 then if selected_item.availability[i] > 0 then
stack_size_slider:SetMinMaxValues(1, i) stack_size_slider:SetMinMaxValues(1, i)
ii=i
break break
end end
end end
else else
ii = min(selected_item.max_stack, selected_item.aux_quantity)
stack_size_slider:SetMinMaxValues(1, min(selected_item.max_stack, selected_item.aux_quantity)) stack_size_slider:SetMinMaxValues(1, min(selected_item.max_stack, selected_item.aux_quantity))
end end
stack_size_slider:SetValue(math.random(1,ii))
--stack_size_slider:SetValue(aux.huge) --stack_size_slider:SetValue(aux.huge)
stack_size_slider:SetValue(1) --stack_size_slider:SetValue(1)
quantity_update(true) quantity_update(true)
unit_start_price_input:SetText(money.to_string(settings.start_price, true, nil, nil, true)) unit_start_price_input:SetText(money.to_string(settings.start_price, true, nil, nil, true))
+1 -1
View File
@@ -323,7 +323,7 @@ function set_filter_display_offset(x_offset, y_offset)
end end
function initialize_filter_dropdown() function initialize_filter_dropdown()
for _, filter in ipairs(T.temp-T.list('and', 'or', 'not', 'price', 'profit', 'vendor-profit', 'disenchant-profit', 'percent', 'bid-price', 'bid-profit', 'bid-vendor-profit', 'bid-disenchant-profit', 'bid-percent', 'item', 'tooltip', 'min-level', 'max-level', 'rarity', 'left', 'utilizable', 'seller')) do for _, filter in ipairs(T.temp-T.list('and', 'or', 'not', 'price', 'profit', 'vendor-profit', 'disenchant-profit', 'percent', 'disenchant-percent', 'bid-price', 'bid-profit', 'bid-vendor-profit', 'bid-disenchant-profit', 'bid-percent', 'bid-disenchant-percent', 'item', 'tooltip', 'min-level', 'max-level', 'rarity', 'left', 'utilizable', 'seller')) do
UIDropDownMenu_AddButton(T.map( UIDropDownMenu_AddButton(T.map(
'text', filter, 'text', filter,
'value', filter, 'value', filter,
+45 -4
View File
@@ -111,6 +111,16 @@ M.filters = {
end end
}, },
['bid-disenchant-percent'] = {
input_type = 'number',
validator = function(pct)
return function(auction_record)
return disenchant.value(auction_record.slot, auction_record.quality, auction_record.level, auction_record.item_id)
and auction_record.unit_bid_price / disenchant.value(auction_record.slot, auction_record.quality, auction_record.level, auction_record.item_id) * 100 <= pct
end
end
},
['percent'] = { ['percent'] = {
input_type = 'number', input_type = 'number',
validator = function(pct) validator = function(pct)
@@ -122,6 +132,17 @@ M.filters = {
end end
}, },
['disenchant-percent'] = {
input_type = 'number',
validator = function(pct)
return function(auction_record)
return auction_record.unit_buyout_price > 0
and disenchant.value(auction_record.slot, auction_record.quality, auction_record.level, auction_record.item_id)
and auction_record.unit_buyout_price / disenchant.value(auction_record.slot, auction_record.quality, auction_record.level, auction_record.item_id) * 100 <= pct
end
end
},
['bid-profit'] = { ['bid-profit'] = {
input_type = 'money', input_type = 'money',
validator = function(amount) validator = function(amount)
@@ -144,8 +165,8 @@ M.filters = {
input_type = 'money', input_type = 'money',
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
local disenchant_value = disenchant.value(auction_record.slot, auction_record.quality, auction_record.level) local disenchant_value = disenchant.value(auction_record.slot, auction_record.quality, auction_record.level, auction_record.item_id)
return disenchant_value and disenchant_value - auction_record.bid_price >= amount return disenchant_value and disenchant_value - auction_record.bid_price >= amount
end end
end end
}, },
@@ -154,8 +175,8 @@ M.filters = {
input_type = 'money', input_type = 'money',
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
local disenchant_value = disenchant.value(auction_record.slot, auction_record.quality, auction_record.level) local disenchant_value = disenchant.value(auction_record.slot, auction_record.quality, auction_record.level, auction_record.item_id)
return auction_record.buyout_price > 0 and disenchant_value and disenchant_value - auction_record.buyout_price >= amount return auction_record.buyout_price > 0 and disenchant_value and disenchant_value - auction_record.buyout_price >= amount
end end
end end
}, },
@@ -165,6 +186,16 @@ M.filters = {
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
local vendor_price = info.merchant_info(auction_record.item_id) local vendor_price = info.merchant_info(auction_record.item_id)
if not vendor_price then
vendor_price = ShaguTweaks.SellValueDB[auction_record.item_id]
if vendor_price then
local charges = 1
if info.max_item_charges(auction_record.item_id) ~= nil then
info.charges=info.max_item_charges(auction_record.item_id)
end
vendor_price= vendor_price/ charges
end
end
return vendor_price and vendor_price * auction_record.aux_quantity - auction_record.bid_price >= amount return vendor_price and vendor_price * auction_record.aux_quantity - auction_record.bid_price >= amount
end end
end end
@@ -175,6 +206,16 @@ M.filters = {
validator = function(amount) validator = function(amount)
return function(auction_record) return function(auction_record)
local vendor_price = info.merchant_info(auction_record.item_id) local vendor_price = info.merchant_info(auction_record.item_id)
if not vendor_price then
vendor_price = ShaguTweaks.SellValueDB[auction_record.item_id]
if vendor_price then
local charges = 1
if info.max_item_charges(auction_record.item_id) ~= nil then
info.charges=info.max_item_charges(auction_record.item_id)
end
vendor_price= vendor_price/ charges
end
end
return auction_record.buyout_price > 0 and vendor_price and vendor_price * auction_record.aux_quantity - auction_record.buyout_price >= amount return auction_record.buyout_price > 0 and vendor_price and vendor_price * auction_record.aux_quantity - auction_record.buyout_price >= amount
end end
end end