post price listing bugfix and click changes

This commit is contained in:
Manuel Simon Hirsig
2016-12-11 10:12:35 +01:00
parent 20c6b7b37e
commit e1b87d71cb
8 changed files with 103 additions and 100 deletions
+17 -13
View File
@@ -127,6 +127,7 @@ function update_auction_listing(listing, records, reference)
local rows = T
if selected_item then
local historical_value = history.value(selected_item.key)
local stack_size = stack_size_slider:GetValue()
for i = 1, getn(records[selected_item.key] or empty) do
local record = records[selected_item.key][i]
tinsert(rows, O(
@@ -134,17 +135,32 @@ function update_auction_listing(listing, records, reference)
O('value', record.own and color.yellow(record.count) or record.count),
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', money.to_string(record.unit_price, true, nil, 3, price_color(record, reference, stack_size_slider:GetValue()))),
O('value', money.to_string(record.unit_price, true, nil, 3, price_color(record, reference, stack_size))),
O('value', historical_value and al.percentage_historical(round(record.unit_price / historical_value * 100)) or '---')
),
'record', record
))
end
if historical_value then
tinsert(rows, O(
'cols', A(
O('value', '---'),
O('value', '---'),
O('value', '---'),
O('value', money.to_string(historical_value, true, nil, 3, color.green)),
O('value', historical_value and al.percentage_historical(100) or '---')
),
'record', O('historical_value', true, 'stack_size', stack_size, 'unit_price', historical_value, 'own', true)
))
end
sort(rows, function(a, b)
return sort_util.multi_lt(
a.record.unit_price,
b.record.unit_price,
a.record.historical_value and 1 or 0,
b.record.historical_value and 1 or 0,
a.record.stack_size,
b.record.stack_size,
@@ -268,7 +284,6 @@ function update_item_configuration()
stack_count_slider:Hide()
deposit:Hide()
duration_dropdown:Hide()
historical_value_button:Hide()
hide_checkbox:Hide()
else
unit_start_price_input:Show()
@@ -277,7 +292,6 @@ function update_item_configuration()
stack_count_slider:Show()
deposit:Show()
duration_dropdown:Show()
historical_value_button:Show()
hide_checkbox:Show()
item.texture:SetTexture(selected_item.texture)
@@ -346,14 +360,6 @@ function unit_vendor_price(item_key)
end
end
function update_historical_value_button()
if selected_item then
local historical_value = history.value(selected_item.key)
historical_value_button.amount = historical_value
historical_value_button:SetText(historical_value and money.to_string(historical_value, true, nil, 3) or '---')
end
end
function update_item(item)
local settings = read_settings(item.key)
@@ -460,7 +466,6 @@ function refresh_entries()
end,
on_abort = function()
bid_records[item_key], buyout_records[item_key]= nil, nil
update_historical_value_button()
status_bar:update_status(1, 1)
status_bar:set_text('Scan aborted')
end,
@@ -510,7 +515,6 @@ function on_update()
if refresh then
refresh = false
price_update()
update_historical_value_button()
update_item_configuration()
update_inventory_listing()
update_auction_listings()
+11 -20
View File
@@ -84,6 +84,10 @@ bid_listing:DisableSelection(true)
bid_listing:SetHandler('OnClick', function(table, row_data, column, button)
unit_start_price = undercut(row_data.record, stack_size_slider:GetValue(), button == 'RightButton')
end)
bid_listing:SetHandler('OnDoubleClick', function(table, row_data, column, button)
stack_size_slider:SetValue(row_data.record.stack_size)
unit_start_price = undercut(row_data.record, stack_size_slider:GetValue())
end)
buyout_listing = listing.new(frame.buyout_listing)
buyout_listing:SetColInfo{
@@ -97,6 +101,10 @@ buyout_listing:DisableSelection(true)
buyout_listing:SetHandler('OnClick', function(table, row_data, column, button)
unit_buyout_price = undercut(row_data.record, stack_size_slider:GetValue(), button == 'RightButton')
end)
buyout_listing:SetHandler('OnDoubleClick', function(table, row_data, column, button)
stack_size_slider:SetValue(row_data.record.stack_size)
unit_buyout_price = undercut(row_data.record, stack_size_slider:GetValue())
end)
do
status_bar = gui.status_bar(frame)
@@ -199,11 +207,6 @@ do
end)
duration_dropdown = dropdown
end
do
local label = gui.label(frame.parameters, gui.font_size.medium)
label:SetPoint('LEFT', duration_dropdown, 'RIGHT', 25, 0)
deposit = label
end
do
local checkbox = gui.checkbox(frame.parameters)
checkbox:SetPoint('TOPRIGHT', -83, -6)
@@ -289,19 +292,7 @@ do
unit_buyout_price_input = editbox
end
do
local btn = gui.button(frame.parameters, 14)
btn:SetPoint('TOPRIGHT', -10, -146)
gui.set_size(btn, 150, 20)
btn:GetFontString():SetJustifyH('RIGHT')
btn:GetFontString():SetPoint('RIGHT', -2, 0)
btn:SetScript('OnClick', function()
if this.amount then
unit_start_price = this.amount
unit_buyout_price = this.amount
end
end)
local label = gui.label(btn, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
label:SetText('Historical Value')
historical_value_button = btn
local label = gui.label(frame.parameters, gui.font_size.medium)
label:SetPoint('TOPLEFT', unit_buyout_price_input, 'BOTTOMLEFT', 0, -24)
deposit = label
end