refactoring
This commit is contained in:
@@ -28,13 +28,13 @@ end
|
||||
function M.scan_auctions()
|
||||
|
||||
status_bar:update_status(0,0)
|
||||
status_bar:set_text'Scanning auctions...'
|
||||
status_bar:set_text('Scanning auctions...')
|
||||
|
||||
wipe(auction_records)
|
||||
update_listing()
|
||||
scan.start{
|
||||
type = 'owner',
|
||||
queries = {{ blizzard_query = t }},
|
||||
queries = {{blizzard_query = t}},
|
||||
on_page_loaded = function(page, total_pages)
|
||||
status_bar:update_status(100 * (page - 1) / total_pages, 0)
|
||||
status_bar:set_text(format('Scanning (Page %d / %d)', page, total_pages))
|
||||
@@ -44,12 +44,12 @@ function M.scan_auctions()
|
||||
end,
|
||||
on_complete = function()
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text'Scan complete'
|
||||
status_bar:set_text('Scan complete')
|
||||
update_listing()
|
||||
end,
|
||||
on_abort = function()
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text'Scan aborted'
|
||||
status_bar:set_text('Scan aborted')
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
@@ -32,19 +32,19 @@ do
|
||||
status_bar:SetHeight(25)
|
||||
status_bar:SetPoint('TOPLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text''
|
||||
status_bar:set_text('')
|
||||
end
|
||||
do
|
||||
local btn = gui.button(frame)
|
||||
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetText'Cancel'
|
||||
btn:SetText('Cancel')
|
||||
btn:Disable()
|
||||
cancel_button = btn
|
||||
end
|
||||
do
|
||||
local btn = gui.button(frame)
|
||||
btn:SetPoint('TOPLEFT', cancel_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetText'Refresh'
|
||||
btn:SetText('Refresh')
|
||||
btn:SetScript('OnClick', function()
|
||||
scan_auctions()
|
||||
end)
|
||||
|
||||
+4
-4
@@ -28,13 +28,13 @@ end
|
||||
function M.scan_bids()
|
||||
|
||||
status_bar:update_status(0,0)
|
||||
status_bar:set_text'Scanning auctions...'
|
||||
status_bar:set_text('Scanning auctions...')
|
||||
|
||||
wipe(auction_records)
|
||||
update_listing()
|
||||
scan.start{
|
||||
type = 'bidder',
|
||||
queries = {{ blizzard_query=t }},
|
||||
queries = {{blizzard_query=t}},
|
||||
on_page_loaded = function(page, total_pages)
|
||||
status_bar:update_status(100 * (page - 1) / total_pages, 0)
|
||||
status_bar:set_text(format('Scanning (Page %d / %d)', page, total_pages))
|
||||
@@ -44,12 +44,12 @@ function M.scan_bids()
|
||||
end,
|
||||
on_complete = function()
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text'Scan complete'
|
||||
status_bar:set_text('Scan complete')
|
||||
update_listing()
|
||||
end,
|
||||
on_abort = function()
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text'Scan aborted'
|
||||
status_bar:set_text('Scan aborted')
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
+3
-3
@@ -41,21 +41,21 @@ end
|
||||
do
|
||||
local btn = gui.button(frame)
|
||||
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetText'Bid'
|
||||
btn:SetText('Bid')
|
||||
btn:Disable()
|
||||
bid_button = btn
|
||||
end
|
||||
do
|
||||
local btn = gui.button(frame)
|
||||
btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetText'Buyout'
|
||||
btn:SetText('Buyout')
|
||||
btn:Disable()
|
||||
buyout_button = btn
|
||||
end
|
||||
do
|
||||
local btn = gui.button(frame)
|
||||
btn:SetPoint('TOPLEFT', buyout_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetText'Refresh'
|
||||
btn:SetText('Refresh')
|
||||
btn:SetScript('OnClick', function()
|
||||
scan_bids()
|
||||
end)
|
||||
|
||||
+5
-5
@@ -17,7 +17,7 @@ local al = require 'aux.gui.auction_listing'
|
||||
TAB 'Post'
|
||||
|
||||
local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
|
||||
local settings_schema = {'record', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
|
||||
local settings_schema = {'tuple', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
|
||||
|
||||
function get_default_settings()
|
||||
return T('duration', DURATION_8 , 'stack_size', 1, 'start_price', 0, 'buyout_price', 0, 'hidden', false)
|
||||
@@ -277,7 +277,7 @@ function update_item_configuration()
|
||||
item.texture:SetTexture(nil)
|
||||
item.count:SetText()
|
||||
item.name:SetTextColor(color.label.enabled())
|
||||
item.name:SetText'No item selected'
|
||||
item.name:SetText('No item selected')
|
||||
|
||||
unit_start_price_input:Hide()
|
||||
unit_buyout_price_input:Hide()
|
||||
@@ -451,7 +451,7 @@ function refresh_entries()
|
||||
existing_auctions[item_key] = nil
|
||||
local query = scan_util.item_query(item_id)
|
||||
status_bar:update_status(0,0)
|
||||
status_bar:set_text'Scanning auctions...'
|
||||
status_bar:set_text('Scanning auctions...')
|
||||
|
||||
scan_id = scan.start{
|
||||
type = 'list',
|
||||
@@ -477,13 +477,13 @@ function refresh_entries()
|
||||
existing_auctions[item_key] = nil
|
||||
update_historical_value_button()
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text'Scan aborted'
|
||||
status_bar:set_text('Scan aborted')
|
||||
end,
|
||||
on_complete = function()
|
||||
existing_auctions[item_key] = existing_auctions[item_key] or t
|
||||
refresh = true
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text'Scan complete'
|
||||
status_bar:set_text('Scan complete')
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
+7
-7
@@ -64,13 +64,13 @@ inventory_listing = item_listing.create(
|
||||
|
||||
auction_listing = listing.CreateScrollingTable(frame.auctions)
|
||||
auction_listing:SetColInfo{
|
||||
{ name='Auctions', width=.12, align='CENTER' },
|
||||
{ name='Left', width=.1, align='CENTER' },
|
||||
{ name='Qty', width=.08, align='CENTER' },
|
||||
{ name='Bid/ea', width=.22, align='RIGHT' },
|
||||
{ name='Bid Pct', width=.13, align='CENTER' },
|
||||
{ name='Buy/ea', width=.22, align='RIGHT' },
|
||||
{ name='Buy Pct', width=.13, align='CENTER' },
|
||||
{name='Auctions', width=.12, align='CENTER'},
|
||||
{name='Left', width=.1, align='CENTER'},
|
||||
{name='Qty', width=.08, align='CENTER'},
|
||||
{name='Bid/ea', width=.22, align='RIGHT'},
|
||||
{name='Bid Pct', width=.13, align='CENTER'},
|
||||
{name='Buy/ea', width=.22, align='RIGHT'},
|
||||
{name='Buy Pct', width=.13, align='CENTER'},
|
||||
}
|
||||
auction_listing:EnableSorting(false)
|
||||
auction_listing:DisableSelection(true)
|
||||
|
||||
@@ -40,7 +40,7 @@ do
|
||||
btn:SetPoint('TOPLEFT', 5, -8)
|
||||
btn:SetWidth(30)
|
||||
btn:SetHeight(25)
|
||||
btn:SetText'<'
|
||||
btn:SetText('<')
|
||||
btn:SetScript('OnClick', previous_search)
|
||||
previous_button = btn
|
||||
end
|
||||
@@ -49,7 +49,7 @@ do
|
||||
btn:SetPoint('LEFT', previous_button, 'RIGHT', 4, 0)
|
||||
btn:SetWidth(30)
|
||||
btn:SetHeight(25)
|
||||
btn:SetText'>'
|
||||
btn:SetText('>')
|
||||
btn:SetScript('OnClick', next_search)
|
||||
next_button = btn
|
||||
end
|
||||
@@ -99,7 +99,7 @@ do
|
||||
local label = gui.label(editbox, gui.font_size.medium)
|
||||
label:SetPoint('LEFT', editbox, 'RIGHT', 0, 0)
|
||||
label:SetTextColor(color.label.enabled())
|
||||
label:SetText'-'
|
||||
label:SetText('-')
|
||||
first_page_input = editbox
|
||||
end
|
||||
do
|
||||
@@ -125,7 +125,7 @@ do
|
||||
local btn = gui.button(frame)
|
||||
btn:SetHeight(25)
|
||||
btn:SetPoint('TOPRIGHT', -5, -8)
|
||||
btn:SetText'Search'
|
||||
btn:SetText('Search')
|
||||
btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
btn:SetScript('OnClick', function()
|
||||
if arg1 == 'RightButton' then
|
||||
@@ -358,7 +358,7 @@ do
|
||||
end
|
||||
local label = gui.label(editbox, gui.font_size.medium)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
|
||||
label:SetText'-'
|
||||
label:SetText('-')
|
||||
max_level_input = editbox
|
||||
end
|
||||
do
|
||||
@@ -488,7 +488,7 @@ do
|
||||
child:SetFont('p', [[Fonts\ARIALN.TTF]], bounded(11, 23, select(2, child:GetFont()) + arg1*2))
|
||||
update_filter_display()
|
||||
end)
|
||||
scroll_frame:RegisterForDrag'LeftButton'
|
||||
scroll_frame:RegisterForDrag('LeftButton')
|
||||
scroll_frame:SetScript('OnDragStart', function()
|
||||
this.x, this.y = GetCursorPosition()
|
||||
this.x_offset, this.y_offset = this:GetHorizontalScroll(), this:GetVerticalScroll()
|
||||
|
||||
+11
-11
@@ -86,7 +86,7 @@ do
|
||||
|
||||
search.status_bar = status_bars[getn(searches)]
|
||||
search.status_bar:update_status(100, 100)
|
||||
search.status_bar:set_text''
|
||||
search.status_bar:set_text('')
|
||||
|
||||
search.table = tables[getn(searches)]
|
||||
search.table:SetSort(1, 2, 3, 4, 5, 6, 7, 8, 9)
|
||||
@@ -159,7 +159,7 @@ function start_real_time_scan(query, search, continuation)
|
||||
auto_buy_validator = search.auto_buy_validator,
|
||||
on_scan_start = function()
|
||||
search.status_bar:update_status(99.99, 99.99)
|
||||
search.status_bar:set_text'Scanning last page ...'
|
||||
search.status_bar:set_text('Scanning last page ...')
|
||||
end,
|
||||
on_page_loaded = function(_, _, last_page)
|
||||
next_page = last_page
|
||||
@@ -184,7 +184,7 @@ function start_real_time_scan(query, search, continuation)
|
||||
new_records = values(map)
|
||||
|
||||
if getn(new_records) > 2000 then
|
||||
StaticPopup_Show'AUX_SEARCH_TABLE_FULL'
|
||||
StaticPopup_Show('AUX_SEARCH_TABLE_FULL')
|
||||
else
|
||||
search.records = new_records
|
||||
search.table:SetDatabase(search.records)
|
||||
@@ -196,7 +196,7 @@ function start_real_time_scan(query, search, continuation)
|
||||
end,
|
||||
on_abort = function()
|
||||
search.status_bar:update_status(100, 100)
|
||||
search.status_bar:set_text'Scan paused'
|
||||
search.status_bar:set_text('Scan paused')
|
||||
|
||||
search.continuation = next_page or not ignore_page and query.blizzard_query.first_page or true
|
||||
|
||||
@@ -236,9 +236,9 @@ function start_search(queries, continuation)
|
||||
on_scan_start = function()
|
||||
search.status_bar:update_status(0,0)
|
||||
if continuation then
|
||||
search.status_bar:set_text'Resuming scan...'
|
||||
search.status_bar:set_text('Resuming scan...')
|
||||
else
|
||||
search.status_bar:set_text'Scanning auctions...'
|
||||
search.status_bar:set_text('Scanning auctions...')
|
||||
end
|
||||
end,
|
||||
on_page_loaded = function(_, total_scan_pages)
|
||||
@@ -260,13 +260,13 @@ function start_search(queries, continuation)
|
||||
if getn(search.records) < 2000 then
|
||||
tinsert(search.records, auction_record)
|
||||
if getn(search.records) == 2000 then
|
||||
StaticPopup_Show'AUX_SEARCH_TABLE_FULL'
|
||||
StaticPopup_Show('AUX_SEARCH_TABLE_FULL')
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_complete = function()
|
||||
search.status_bar:update_status(100, 100)
|
||||
search.status_bar:set_text'Scan complete'
|
||||
search.status_bar:set_text('Scan complete')
|
||||
|
||||
if current_search == search and frame.results:IsVisible() and getn(search.records) == 0 then
|
||||
subtab = SAVED
|
||||
@@ -277,7 +277,7 @@ function start_search(queries, continuation)
|
||||
end,
|
||||
on_abort = function()
|
||||
search.status_bar:update_status(100, 100)
|
||||
search.status_bar:set_text'Scan paused'
|
||||
search.status_bar:set_text('Scan paused')
|
||||
|
||||
if current_query then
|
||||
search.continuation = {current_query, current_page + 1}
|
||||
@@ -313,10 +313,10 @@ function M.execute(resume, real_time)
|
||||
return
|
||||
elseif real_time then
|
||||
if getn(queries) > 1 then
|
||||
print'Error: The real time mode does not support multi-queries'
|
||||
print('Error: The real time mode does not support multi-queries')
|
||||
return
|
||||
elseif queries[1].blizzard_query.first_page or queries[1].blizzard_query.last_page then
|
||||
print'Error: The real time mode does not support page ranges'
|
||||
print('Error: The real time mode does not support page ranges')
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,7 +11,7 @@ function update_search_listings()
|
||||
for i, autobuy_filter in aux_auto_buy_filters do
|
||||
local name = strsub(autobuy_filter.prettified, 1, 250)
|
||||
tinsert(autobuy_filter_rows, {
|
||||
cols = {{ value=name }},
|
||||
cols = {{value=name}},
|
||||
search = autobuy_filter,
|
||||
index = i,
|
||||
})
|
||||
@@ -22,7 +22,7 @@ function update_search_listings()
|
||||
for i, favorite_search in aux_favorite_searches do
|
||||
local name = strsub(favorite_search.prettified, 1, 250)
|
||||
tinsert(favorite_search_rows, {
|
||||
cols = {{ value=name }},
|
||||
cols = {{value=name}},
|
||||
search = favorite_search,
|
||||
index = i,
|
||||
})
|
||||
@@ -33,7 +33,7 @@ function update_search_listings()
|
||||
for i, recent_search in aux_recent_searches do
|
||||
local name = strsub(recent_search.prettified, 1, 250)
|
||||
tinsert(recent_search_rows, {
|
||||
cols = {{ value=name }},
|
||||
cols = {{value=name}},
|
||||
search = recent_search,
|
||||
index = i,
|
||||
})
|
||||
@@ -136,9 +136,9 @@ function add_auto_buy(filter_string)
|
||||
local queries, error = filter_util.queries(filter_string)
|
||||
if queries then
|
||||
if getn(queries) > 1 then
|
||||
print'Error: The automatic buyout filter does not support multi-queries'
|
||||
print('Error: The automatic buyout filter does not support multi-queries')
|
||||
elseif size(queries[1].blizzard_query) > 0 and not filter_util.parse_filter_string(filter_string).blizzard.exact then
|
||||
print'Error: The automatic buyout filter does not support Blizzard filters'
|
||||
print('Error: The automatic buyout filter does not support Blizzard filters')
|
||||
else
|
||||
tinsert(aux_auto_buy_filters, 1, T(
|
||||
'filter_string', filter_string,
|
||||
|
||||
Reference in New Issue
Block a user