simplified post coloring, bid listing changes
This commit is contained in:
+15
-31
@@ -107,22 +107,6 @@ function update_inventory_listing()
|
|||||||
item_listing.populate(inventory_listing, records)
|
item_listing.populate(inventory_listing, records)
|
||||||
end
|
end
|
||||||
|
|
||||||
function price_color(record, reference)
|
|
||||||
local unit_undercut = undercut(record, stack_size_slider:GetValue())
|
|
||||||
unit_undercut = money.from_string(money.to_string(unit_undercut, true, nil, 3))
|
|
||||||
|
|
||||||
local stack_undercut = undercut(record, stack_size_slider:GetValue(), true)
|
|
||||||
stack_undercut = money.from_string(money.to_string(stack_undercut, true, nil, 3))
|
|
||||||
|
|
||||||
if unit_undercut < reference and stack_undercut < reference then
|
|
||||||
return color.red
|
|
||||||
elseif unit_undercut < reference then
|
|
||||||
return color.orange
|
|
||||||
elseif stack_undercut < reference then
|
|
||||||
return color.yellow
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function update_auction_listing(listing, records, reference)
|
function update_auction_listing(listing, records, reference)
|
||||||
local rows = T
|
local rows = T
|
||||||
if selected_item then
|
if selected_item then
|
||||||
@@ -135,7 +119,7 @@ function update_auction_listing(listing, records, reference)
|
|||||||
O('value', record.own and color.yellow(record.count) or record.count),
|
O('value', record.own and color.yellow(record.count) or record.count),
|
||||||
O('value', al.time_left(record.duration)),
|
O('value', al.time_left(record.duration)),
|
||||||
O('value', record.stack_size == stack_size and color.yellow(record.stack_size) or record.stack_size),
|
O('value', record.stack_size == stack_size and color.yellow(record.stack_size) or record.stack_size),
|
||||||
O('value', money.to_string(record.unit_price, true, nil, 3, price_color(record, reference, stack_size))),
|
O('value', money.to_string(record.unit_price, true, nil, 3, undercut(record, stack_size_slider:GetValue(), listing == 'bid') < reference and color.red)),
|
||||||
O('value', historical_value and al.percentage_historical(round(record.unit_price / historical_value * 100)) or '---')
|
O('value', historical_value and al.percentage_historical(round(record.unit_price / historical_value * 100)) or '---')
|
||||||
),
|
),
|
||||||
'record', record
|
'record', record
|
||||||
@@ -155,8 +139,8 @@ function update_auction_listing(listing, records, reference)
|
|||||||
end
|
end
|
||||||
sort(rows, function(a, b)
|
sort(rows, function(a, b)
|
||||||
return sort_util.multi_lt(
|
return sort_util.multi_lt(
|
||||||
a.record.unit_price,
|
a.record.unit_price * (listing == 'bid' and a.record.stack_size or 1),
|
||||||
b.record.unit_price,
|
b.record.unit_price * (listing == 'bid' and b.record.stack_size or 1),
|
||||||
|
|
||||||
a.record.historical_value and 1 or 0,
|
a.record.historical_value and 1 or 0,
|
||||||
b.record.historical_value and 1 or 0,
|
b.record.historical_value and 1 or 0,
|
||||||
@@ -172,12 +156,16 @@ function update_auction_listing(listing, records, reference)
|
|||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
listing:SetData(rows)
|
if listing == 'bid' then
|
||||||
|
bid_listing:SetData(rows)
|
||||||
|
elseif listing == 'buyout' then
|
||||||
|
buyout_listing:SetData(rows)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function update_auction_listings()
|
function update_auction_listings()
|
||||||
update_auction_listing(bid_listing, bid_records, unit_start_price)
|
update_auction_listing('bid', bid_records, unit_start_price)
|
||||||
update_auction_listing(buyout_listing, buyout_records, unit_buyout_price)
|
update_auction_listing('buyout', buyout_records, unit_buyout_price)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.select_item(item_key)
|
function M.select_item(item_key)
|
||||||
@@ -195,14 +183,10 @@ function price_update()
|
|||||||
|
|
||||||
local historical_value = history.value(selected_item.key)
|
local historical_value = history.value(selected_item.key)
|
||||||
|
|
||||||
if aux_post_bid then
|
if bid_listing:GetSelection() then
|
||||||
if bid_listing:GetSelection() then
|
unit_start_price = undercut(bid_listing:GetSelection().record, stack_size_slider:GetValue(), true)
|
||||||
unit_start_price = undercut(bid_listing:GetSelection().record, stack_size_slider:GetValue())
|
elseif buyout_listing:GetSelection() then
|
||||||
end
|
unit_start_price = undercut(buyout_listing:GetSelection().record, stack_size_slider:GetValue())
|
||||||
else
|
|
||||||
if buyout_listing:GetSelection() then
|
|
||||||
unit_start_price = undercut(buyout_listing:GetSelection().record, stack_size_slider:GetValue())
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
settings.start_price = unit_start_price
|
settings.start_price = unit_start_price
|
||||||
start_price_percentage:SetText(historical_value and al.percentage_historical(round(unit_start_price / historical_value * 100)) or '---')
|
start_price_percentage:SetText(historical_value and al.percentage_historical(round(unit_start_price / historical_value * 100)) or '---')
|
||||||
@@ -245,7 +229,7 @@ function post_auctions()
|
|||||||
stack_count,
|
stack_count,
|
||||||
function(posted)
|
function(posted)
|
||||||
for i = 1, posted do
|
for i = 1, posted do
|
||||||
record_auction(key, stack_size, unit_start_price, unit_buyout_price, duration_code, UnitName'player')
|
record_auction(key, stack_size, unit_start_price * stack_size, unit_buyout_price, duration_code, UnitName'player')
|
||||||
end
|
end
|
||||||
update_inventory_records()
|
update_inventory_records()
|
||||||
local same
|
local same
|
||||||
|
|||||||
+2
-2
@@ -77,7 +77,7 @@ bid_listing:SetColInfo{
|
|||||||
{name='Auctions', width=.17, align='CENTER'},
|
{name='Auctions', width=.17, align='CENTER'},
|
||||||
{name='Time\nLeft', width=.11, align='CENTER'},
|
{name='Time\nLeft', width=.11, align='CENTER'},
|
||||||
{name='Stack\nSize', width=.11, align='CENTER'},
|
{name='Stack\nSize', width=.11, align='CENTER'},
|
||||||
{name='Auction Bid\n(per item)', width=.4, align='RIGHT'},
|
{name='Auction Bid\n(per stack)', width=.4, align='RIGHT'},
|
||||||
{name='% Hist.\nValue', width=.21, align='CENTER'},
|
{name='% Hist.\nValue', width=.21, align='CENTER'},
|
||||||
}
|
}
|
||||||
bid_listing:SetHandler('OnClick', function(table, row_data, column, button)
|
bid_listing:SetHandler('OnClick', function(table, row_data, column, button)
|
||||||
@@ -234,7 +234,7 @@ do
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
editbox.formatter = function() return money.to_string(unit_start_price, true, nil, 3) end
|
editbox.formatter = function() return money.to_string(unit_start_price, true, nil, 3) end
|
||||||
editbox.char = function() bid_listing:ClearSelection() end
|
editbox.char = function() bid_listing:ClearSelection(); buyout_listing:ClearSelection() end
|
||||||
editbox.change = function() refresh = true end
|
editbox.change = function() refresh = true end
|
||||||
editbox.enter = function() this:ClearFocus() end
|
editbox.enter = function() this:ClearFocus() end
|
||||||
editbox.focus_loss = function()
|
editbox.focus_loss = function()
|
||||||
|
|||||||
Reference in New Issue
Block a user