From 38cd0cbd0e234689883433fa1c7d447d74b9469f Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Sat, 21 May 2016 01:13:46 +0200 Subject: [PATCH] bid update --- core.lua | 4 ++++ search_frame.lua | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/core.lua b/core.lua index da1e684..2c764bf 100644 --- a/core.lua +++ b/core.lua @@ -306,6 +306,10 @@ function Aux.round(v) return floor(v + 0.5) end +function Aux.min_bid_increment(current_bid) + return ceil(current_bid * 0.05) +end + function Aux.price_level_color(pct) if pct > 135 then return 1.0,0.0,0.0 -- red diff --git a/search_frame.lua b/search_frame.lua index 7302a2c..8b31a9e 100644 --- a/search_frame.lua +++ b/search_frame.lua @@ -919,6 +919,19 @@ function private.record_remover(record) end end +function private.record_bid_updater(record) + return function() + record.high_bid = record.bid_price + record.blizzard_bid = record.bid_price + record.min_increment = Aux.min_bid_increment(record.bid_price) + record.bid_price = record.bid_price + record.min_increment + record.unit_blizzard_bid = record.blizzard_bid / record.aux_quantity + record.unit_bid_price = record.bid_price / record.aux_quantity + record.high_bidder = 1 + private.results_listing:SetDatabase() + end +end + do local scan_id local IDLE, SEARCHING, FOUND = {}, {}, {} @@ -949,7 +962,7 @@ do if not record.high_bidder then private.bid_button:SetScript('OnClick', function() if private.test(record)(index) and private.results_listing:ContainsRecord(record) then - Aux.place_bid('list', index, record.bid_price, private.record_remover(record)) + Aux.place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and private.record_bid_updater(record) or private.record_remover(record)) end end) private.bid_button:Enable()