scan refactoring
This commit is contained in:
+10
-9
@@ -89,7 +89,8 @@ function private.wait_for_list_results(k)
|
|||||||
end)
|
end)
|
||||||
listener:start()
|
listener:start()
|
||||||
Aux.control.wait_until(function()
|
Aux.control.wait_until(function()
|
||||||
-- order important, owner_data_complete must be called after an update to request missing data
|
-- short circuiting order important, owner_data_complete must be called iif an update has happened.
|
||||||
|
-- if no update has happened it must not be called for performance reasons, otherwise it must be called to request further missing data if there is any
|
||||||
local ok = updated and m.owner_data_complete() or last_update and GetTime() - last_update > 5
|
local ok = updated and m.owner_data_complete() or last_update and GetTime() - last_update > 5
|
||||||
updated = false
|
updated = false
|
||||||
return ok
|
return ok
|
||||||
@@ -103,8 +104,8 @@ function private.owner_data_complete()
|
|||||||
if m.current_thread().params.ignore_owner or aux_ignore_owner then
|
if m.current_thread().params.ignore_owner or aux_ignore_owner then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
local count = GetNumAuctionItems(m.current_thread().params.type)
|
|
||||||
for i=1,count do
|
for i=1,PAGE_SIZE do
|
||||||
local auction_info = Aux.info.auction(i, m.current_thread().params.type)
|
local auction_info = Aux.info.auction(i, m.current_thread().params.type)
|
||||||
if auction_info and not auction_info.owner then
|
if auction_info and not auction_info.owner then
|
||||||
return false
|
return false
|
||||||
@@ -182,11 +183,11 @@ function private.scan_auctions(k)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function private.scan_auctions_helper(i, k)
|
function private.scan_auctions_helper(i, k)
|
||||||
local recurse = function()
|
local recurse = function(retry)
|
||||||
if i >= (m.current_thread().page_auctions or GetNumAuctionItems(m.current_thread().params.type)) then
|
if i >= PAGE_SIZE then
|
||||||
return k()
|
return k()
|
||||||
else
|
else
|
||||||
return m.scan_auctions_helper(i + 1, k)
|
return m.scan_auctions_helper(retry and i or i + 1, k)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -200,11 +201,11 @@ function private.scan_auctions_helper(i, k)
|
|||||||
Aux.history.process_auction(auction_info)
|
Aux.history.process_auction(auction_info)
|
||||||
|
|
||||||
if m.current_thread().params.auto_buy_validator and m.current_thread().params.auto_buy_validator(auction_info) then
|
if m.current_thread().params.auto_buy_validator and m.current_thread().params.auto_buy_validator(auction_info) then
|
||||||
return Aux.place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, function() return private.scan_auctions_helper(i, k) end)
|
return Aux.place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, function() return recurse(true) end)
|
||||||
elseif not m.current_query().validator or m.current_query().validator(auction_info) then
|
elseif not m.current_query().validator or m.current_query().validator(auction_info) then
|
||||||
return m.wait_for_callback(m.current_thread().params.on_auction, auction_info, function(removed)
|
return m.wait_for_callback(m.current_thread().params.on_auction, auction_info, function(removed)
|
||||||
if removed then
|
if removed then
|
||||||
return m.scan_auctions_helper(i, k)
|
return recurse(true)
|
||||||
else
|
else
|
||||||
return recurse()
|
return recurse()
|
||||||
end
|
end
|
||||||
@@ -239,7 +240,7 @@ function private.submit_query(k)
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
m.wait_for_results(function()
|
m.wait_for_results(function()
|
||||||
m.current_thread().page_auctions, m.current_thread().total_auctions = GetNumAuctionItems(m.current_thread().params.type)
|
_, m.current_thread().total_auctions = GetNumAuctionItems(m.current_thread().params.type)
|
||||||
m.wait_for_callback(
|
m.wait_for_callback(
|
||||||
m.current_thread().params.on_page_loaded,
|
m.current_thread().params.on_page_loaded,
|
||||||
m.current_thread().page - (m.current_query().blizzard_query.first_page or 0) + 1,
|
m.current_thread().page - (m.current_query().blizzard_query.first_page or 0) + 1,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ private.search_scan_id = 0
|
|||||||
private.auto_buy_validator = nil
|
private.auto_buy_validator = nil
|
||||||
|
|
||||||
StaticPopupDialogs['AUX_SEARCH_TABLE_FULL'] = {
|
StaticPopupDialogs['AUX_SEARCH_TABLE_FULL'] = {
|
||||||
text = 'Table full!\nFurther results from this search will not be displayed.',
|
text = 'Table full!\nFurther results from this search will still be processed but no longer displayed in the table.',
|
||||||
button1 = 'Ok',
|
button1 = 'Ok',
|
||||||
showAlert = 1,
|
showAlert = 1,
|
||||||
timeout = 0,
|
timeout = 0,
|
||||||
@@ -109,7 +109,6 @@ function private.update_search_listings()
|
|||||||
cols = {{value=name}},
|
cols = {{value=name}},
|
||||||
search = favorite_search,
|
search = favorite_search,
|
||||||
index = i,
|
index = i,
|
||||||
name = name,
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
m.favorite_searches_listing:SetData(favorite_search_rows)
|
m.favorite_searches_listing:SetData(favorite_search_rows)
|
||||||
@@ -121,7 +120,6 @@ function private.update_search_listings()
|
|||||||
cols = {{value=name}},
|
cols = {{value=name}},
|
||||||
search = recent_search,
|
search = recent_search,
|
||||||
index = i,
|
index = i,
|
||||||
name = name,
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
m.recent_searches_listing:SetData(recent_search_rows)
|
m.recent_searches_listing:SetData(recent_search_rows)
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
|||||||
local btn = Aux.gui.button(m.settings, 16)
|
local btn = Aux.gui.button(m.settings, 16)
|
||||||
btn:SetBackdropColor(unpack(Aux.gui.config.frame_color))
|
btn:SetBackdropColor(unpack(Aux.gui.config.frame_color))
|
||||||
btn:SetPoint('LEFT', 240, 0)
|
btn:SetPoint('LEFT', 240, 0)
|
||||||
btn:SetWidth(120)
|
btn:SetWidth(140)
|
||||||
btn:SetHeight(25)
|
btn:SetHeight(25)
|
||||||
btn:SetText('Real Time Mode')
|
btn:SetText('Real Time Mode')
|
||||||
btn:SetBackdropColor(0.7, 0.3, 0.3)
|
btn:SetBackdropColor(0.7, 0.3, 0.3)
|
||||||
@@ -137,9 +137,9 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
|||||||
local btn = Aux.gui.button(m.settings, 16)
|
local btn = Aux.gui.button(m.settings, 16)
|
||||||
btn:SetBackdropColor(unpack(Aux.gui.config.frame_color))
|
btn:SetBackdropColor(unpack(Aux.gui.config.frame_color))
|
||||||
btn:SetPoint('LEFT', m.real_time_button, 'RIGHT', 30, 0)
|
btn:SetPoint('LEFT', m.real_time_button, 'RIGHT', 30, 0)
|
||||||
btn:SetWidth(120)
|
btn:SetWidth(140)
|
||||||
btn:SetHeight(25)
|
btn:SetHeight(25)
|
||||||
btn:SetText('Auto Buy Mode')
|
btn:SetText('Auto Buyout Mode')
|
||||||
btn:SetBackdropColor(0.7, 0.3, 0.3)
|
btn:SetBackdropColor(0.7, 0.3, 0.3)
|
||||||
btn:SetScript('OnClick', function()
|
btn:SetScript('OnClick', function()
|
||||||
if this.on then
|
if this.on then
|
||||||
@@ -155,9 +155,9 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
|||||||
local btn = Aux.gui.button(m.settings, 16)
|
local btn = Aux.gui.button(m.settings, 16)
|
||||||
btn:SetBackdropColor(unpack(Aux.gui.config.frame_color))
|
btn:SetBackdropColor(unpack(Aux.gui.config.frame_color))
|
||||||
btn:SetPoint('LEFT', m.auto_buy_button, 'RIGHT', 30, 0)
|
btn:SetPoint('LEFT', m.auto_buy_button, 'RIGHT', 30, 0)
|
||||||
btn:SetWidth(120)
|
btn:SetWidth(140)
|
||||||
btn:SetHeight(25)
|
btn:SetHeight(25)
|
||||||
btn:SetText('Auto Buy Filter')
|
btn:SetText('Auto Buyout Filter')
|
||||||
btn:SetBackdropColor(0.7, 0.3, 0.3)
|
btn:SetBackdropColor(0.7, 0.3, 0.3)
|
||||||
btn:SetScript('OnClick', function()
|
btn:SetScript('OnClick', function()
|
||||||
if this.on then
|
if this.on then
|
||||||
|
|||||||
Reference in New Issue
Block a user