post listing changed
This commit is contained in:
+1
-5
@@ -98,11 +98,7 @@ function public.scan_auctions()
|
||||
private.update_listing()
|
||||
Aux.scan.start{
|
||||
type = 'owner',
|
||||
queries = {
|
||||
{
|
||||
start_page = 0,
|
||||
}
|
||||
},
|
||||
queries = {{ blizzard_query = {} }},
|
||||
on_page_loaded = function(page, total_pages)
|
||||
private.status_bar:update_status(100 * (page + 1) / total_pages, 100 * (page + 1) / total_pages)
|
||||
private.status_bar:set_text(format('Scanning (Page %d / %d)', page + 1, total_pages))
|
||||
|
||||
+1
-5
@@ -118,11 +118,7 @@ function public.scan_bids()
|
||||
private.update_listing()
|
||||
Aux.scan.start{
|
||||
type = 'bidder',
|
||||
queries = {
|
||||
{
|
||||
start_page = 0,
|
||||
}
|
||||
},
|
||||
queries = {{ blizzard_query = {} }},
|
||||
on_page_loaded = function(page, total_pages)
|
||||
private.status_bar:update_status(100 * (page + 1) / total_pages, 100 * (page + 1) / total_pages)
|
||||
private.status_bar:set_text(format('Scanning (Page %d / %d)', page + 1, total_pages))
|
||||
|
||||
+14
-18
@@ -144,8 +144,7 @@ function private.update_auction_listing()
|
||||
|
||||
tinsert(auction_rows, {
|
||||
cols = {
|
||||
{ value=auction_record.count },
|
||||
{ value=auction_record.yours > 0 and GREEN_FONT_COLOR_CODE..auction_record.yours..FONT_COLOR_CODE_CLOSE or auction_record.yours },
|
||||
{ value=auction_record.own and GREEN_FONT_COLOR_CODE..auction_record.count..FONT_COLOR_CODE_CLOSE or auction_record.count },
|
||||
{ value=Aux.auction_listing.time_left(auction_record.duration) },
|
||||
{ value=auction_record.stack_size == stack_size and GREEN_FONT_COLOR_CODE..auction_record.stack_size..FONT_COLOR_CODE_CLOSE or auction_record.stack_size },
|
||||
{ value=Aux.money.to_string(auction_record.unit_blizzard_bid, true, nil, 3, bid_color) },
|
||||
@@ -159,8 +158,7 @@ function private.update_auction_listing()
|
||||
a.record.unit_buyout_price, b.record.unit_buyout_price,
|
||||
a.record.unit_blizzard_bid, b.record.unit_blizzard_bid,
|
||||
a.record.stack_size, b.record.stack_size,
|
||||
a.record.count - a.record.yours, b.record.count - b.record.yours,
|
||||
b.record.yours, a.record.yours,
|
||||
b.record.own and 1 or 0, a.record.own and 1 or 0,
|
||||
a.record.duration, b.record.duration
|
||||
) end)
|
||||
end
|
||||
@@ -224,23 +222,22 @@ function public.on_load()
|
||||
|
||||
private.auction_listing = Aux.listing.CreateScrollingTable(AuxSellAuctions)
|
||||
private.auction_listing:SetColInfo({
|
||||
{ name='Auctions', width=.12, align='CENTER' },
|
||||
{ name='Yours', width=.12, align='CENTER' },
|
||||
{ name='Left', width=.1, align='CENTER' },
|
||||
{ name='Qty', width=.08, align='CENTER' },
|
||||
{ name='Bid/ea', width=.23, align='RIGHT' },
|
||||
{ name='Buy/ea', width=.23, align='RIGHT' },
|
||||
{ name='Pct', width=.12, align='CENTER' }
|
||||
{ name='Auctions', width=.14, align='CENTER' },
|
||||
{ name='Left', width=.12, align='CENTER' },
|
||||
{ name='Qty', width=.1, align='CENTER' },
|
||||
{ name='Bid/ea', width=.25, align='RIGHT' },
|
||||
{ name='Buy/ea', width=.25, align='RIGHT' },
|
||||
{ name='Pct', width=.14, align='CENTER' }
|
||||
})
|
||||
private.auction_listing:DisableSelection(true)
|
||||
private.auction_listing:SetHandler('OnClick', function(table, row_data, column, button)
|
||||
local column_index = Aux.util.index_of(column, column.row.cols)
|
||||
local unit_start_price, unit_buyout_price = private.undercut(row_data.record, private.stack_size_slider:GetValue(), button == 'RightButton')
|
||||
if column_index == 4 then
|
||||
if column_index == 3 then
|
||||
private.stack_size_slider:SetValue(row_data.record.stack_size)
|
||||
elseif column_index == 5 then
|
||||
elseif column_index == 4 then
|
||||
private.set_unit_start_price(unit_start_price)
|
||||
elseif column_index == 6 then
|
||||
elseif column_index == 5 then
|
||||
private.set_unit_buyout_price(unit_buyout_price)
|
||||
end
|
||||
end)
|
||||
@@ -721,7 +718,7 @@ function private.undercut(record, stack_size, stack)
|
||||
local start_price = Aux.round(record.unit_blizzard_bid * (stack and record.stack_size or stack_size))
|
||||
local buyout_price = Aux.round(record.unit_buyout_price * (stack and record.stack_size or stack_size))
|
||||
|
||||
if record.yours < record.count then
|
||||
if not record.own then
|
||||
start_price = max(0, start_price - 1)
|
||||
buyout_price = max(0, buyout_price - 1)
|
||||
end
|
||||
@@ -929,7 +926,7 @@ function private.record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyou
|
||||
existing_auctions[key] = existing_auctions[key] or {}
|
||||
local entry
|
||||
for _, existing_entry in ipairs(existing_auctions[key]) do
|
||||
if unit_blizzard_bid == existing_entry.unit_blizzard_bid and unit_buyout_price == existing_entry.unit_buyout_price and aux_quantity == existing_entry.stack_size and duration == existing_entry.duration then
|
||||
if unit_blizzard_bid == existing_entry.unit_blizzard_bid and unit_buyout_price == existing_entry.unit_buyout_price and aux_quantity == existing_entry.stack_size and duration == existing_entry.duration and Aux.is_player(owner) == existing_entry.own then
|
||||
entry = existing_entry
|
||||
end
|
||||
end
|
||||
@@ -941,14 +938,13 @@ function private.record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyou
|
||||
unit_blizzard_bid = unit_blizzard_bid,
|
||||
unit_buyout_price = unit_buyout_price,
|
||||
duration = duration,
|
||||
own = Aux.is_player(owner),
|
||||
count = 0,
|
||||
yours = 0,
|
||||
}
|
||||
tinsert(existing_auctions[key], entry)
|
||||
end
|
||||
|
||||
entry.count = entry.count + 1
|
||||
entry.yours = entry.yours + (Aux.is_player(owner) and 1 or 0)
|
||||
|
||||
return entry
|
||||
end
|
||||
|
||||
@@ -18,7 +18,7 @@ function private.current_query()
|
||||
end
|
||||
|
||||
function private.current_thread()
|
||||
for _, thread in pairs(threads) do
|
||||
for _, thread in threads do
|
||||
if thread.id == Aux.control.thread_id then
|
||||
return thread
|
||||
end
|
||||
@@ -26,7 +26,7 @@ function private.current_thread()
|
||||
end
|
||||
|
||||
function public.start(params)
|
||||
public.abort(params.type)
|
||||
public.abort(Aux.util.safe_index(threads[params.type], 'id'))
|
||||
|
||||
local thread_id = Aux.control.new_thread(private.scan)
|
||||
threads[params.type] = {
|
||||
@@ -131,13 +131,10 @@ end
|
||||
|
||||
function private.scan()
|
||||
private.wait_for_callback(private.current_thread().params.on_start_scan, function()
|
||||
local start_query_index = private.current_thread().params.start_query_index or 1
|
||||
local next_query_index = private.current_thread().params.next_query_index or function(query_index) return query_index + 1 end
|
||||
|
||||
private.current_thread().query_index = private.current_thread().query_index and next_query_index(private.current_thread().query_index) or start_query_index
|
||||
private.current_thread().query_index = private.current_thread().query_index and private.current_thread().query_index + 1 or 1
|
||||
if private.current_query() then
|
||||
private.wait_for_callback(private.current_thread().params.on_start_query, private.current_thread().query_index, function()
|
||||
private.current_thread().page = private.current_query().start_page
|
||||
private.current_thread().page = private.current_query().start_page or 0
|
||||
return private.process_query()
|
||||
end)
|
||||
else
|
||||
@@ -206,7 +203,7 @@ function private.scan_auctions_helper(i, n, k)
|
||||
end
|
||||
|
||||
function private.submit_query(k)
|
||||
if private.current_thread().blizzard_query then
|
||||
if private.current_query().blizzard_query then
|
||||
Aux.control.wait_until(function() return private.current_thread().params.type ~= 'list' or CanSendAuctionQuery() end, function()
|
||||
|
||||
if private.current_thread().params.on_submit_query then
|
||||
@@ -218,15 +215,15 @@ function private.submit_query(k)
|
||||
GetOwnerAuctionItems(private.current_thread().page)
|
||||
else
|
||||
QueryAuctionItems(
|
||||
Aux.util.safe_index(private.current_query(), 'blizzard_query', 'name'),
|
||||
Aux.util.safe_index(private.current_query(), 'blizzard_query', 'min_level'),
|
||||
Aux.util.safe_index(private.current_query(), 'blizzard_query', 'max_level'),
|
||||
Aux.util.safe_index(private.current_query(), 'blizzard_query', 'slot'),
|
||||
Aux.util.safe_index(private.current_query(), 'blizzard_query', 'class'),
|
||||
Aux.util.safe_index(private.current_query(), 'blizzard_query', 'subclass'),
|
||||
Aux.util.safe_index(private.current_query().blizzard_query, 'name'),
|
||||
Aux.util.safe_index(private.current_query().blizzard_query, 'min_level'),
|
||||
Aux.util.safe_index(private.current_query().blizzard_query, 'max_level'),
|
||||
Aux.util.safe_index(private.current_query().blizzard_query, 'slot'),
|
||||
Aux.util.safe_index(private.current_query().blizzard_query, 'class'),
|
||||
Aux.util.safe_index(private.current_query().blizzard_query, 'subclass'),
|
||||
private.current_thread().page,
|
||||
Aux.util.safe_index(private.current_query(), 'blizzard_query', 'usable'),
|
||||
Aux.util.safe_index(private.current_query(), 'blizzard_query', 'quality')
|
||||
Aux.util.safe_index(private.current_query().blizzard_query, 'usable'),
|
||||
Aux.util.safe_index(private.current_query().blizzard_query, 'quality')
|
||||
)
|
||||
end
|
||||
private.wait_for_results(function()
|
||||
@@ -242,7 +239,7 @@ function private.submit_query(k)
|
||||
end)
|
||||
end)
|
||||
else
|
||||
private.current_thread().total_pages = 0
|
||||
private.current_thread().total_pages = 1
|
||||
return k()
|
||||
end
|
||||
end
|
||||
|
||||
+4
-4
@@ -316,13 +316,13 @@ function m.find(auction_record, status_bar, on_abort, on_failure, on_success)
|
||||
return auction_info and auction_info.search_signature == auction_record.search_signature
|
||||
end
|
||||
|
||||
local pages = auction_record.page > 0 and { auction_record.page, auction_record.page - 1 } or { auction_record.page }
|
||||
|
||||
local queries = {}
|
||||
tinsert(queries, {})
|
||||
if auction_record.blizzard_query then
|
||||
tinsert(queries, {
|
||||
local pages = auction_record.page > 0 and { auction_record.page - 1 } or {}
|
||||
tinsert(queries, {
|
||||
blizzard_query = auction_record.blizzard_query,
|
||||
start_page = auction_record.page,
|
||||
next_page = function()
|
||||
if getn(pages) == 1 then
|
||||
status_bar:update_status(50, 50)
|
||||
@@ -394,7 +394,7 @@ function m.item_query(item_id, page, single_page)
|
||||
if item_info then
|
||||
local filter = m.filter_from_string(item_info.name..'/exact')
|
||||
return {
|
||||
start_page = page or 0,
|
||||
start_page = page,
|
||||
next_page = single_page and Aux.util.pass,
|
||||
validator = filter.validator,
|
||||
blizzard_query = filter.blizzard_query,
|
||||
|
||||
@@ -795,7 +795,6 @@ function public.start_search(filter_string, resume)
|
||||
|
||||
queries = Aux.util.map(filters, function(filter)
|
||||
return {
|
||||
start_page = 0,
|
||||
blizzard_query = filter.blizzard_query,
|
||||
validator = filter.validator,
|
||||
}
|
||||
@@ -980,16 +979,6 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- if auction_info.current_bid == 0 then
|
||||
-- status = 'No Bid'
|
||||
-- elseif auction_info.high_bidder then
|
||||
-- status = GREEN_FONT_COLOR_CODE..'Your Bid'..FONT_COLOR_CODE_CLOSE
|
||||
-- else
|
||||
-- status = 'Other Bidder'
|
||||
-- end
|
||||
|
||||
|
||||
function private.initialize_class_dropdown()
|
||||
local function on_click()
|
||||
if this.value ~= UIDropDownMenu_GetSelectedValue(private.class_dropdown) then
|
||||
|
||||
Reference in New Issue
Block a user