bid update

This commit is contained in:
Manuel Simon Hirsig
2016-05-21 01:13:46 +02:00
parent d5beff8f1d
commit 38cd0cbd0e
2 changed files with 18 additions and 1 deletions
+4
View File
@@ -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
+14 -1
View File
@@ -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()