module refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-09-23 09:07:56 +02:00
parent 1344ae0d23
commit 240589eef1
32 changed files with 525 additions and 499 deletions
+5 -3
View File
@@ -19,7 +19,7 @@ StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = {
}
do
local function action()
_G.aux_auto_buy_filter = _G[this:GetParent():GetName() .. 'EditBox']:GetText()
aux_auto_buy_filter = _G[this:GetParent():GetName() .. 'EditBox']:GetText()
update_auto_buy_filter()
end
@@ -47,7 +47,9 @@ do
}
end
RESULTS, SAVED, FILTER = 1, 2, 3
private.RESULTS = 1
private.SAVED = 2
private.FILTER = 3
function LOAD()
create_frames()
@@ -113,7 +115,7 @@ function public.add_filter(filter_string)
search_box:SetText(old_filter_string .. filter_string)
end
function blizzard_page_index(str)
function private.blizzard_page_index(str)
if tonumber(str) then
return max(0, tonumber(str) - 1)
end
+23 -23
View File
@@ -1,11 +1,11 @@
aux 'search_tab' local filter_util = aux.filter_util
function valid_level(str)
function private.valid_level(str)
local level = tonumber(str)
return level and bounded(1, 60, level)
end
blizzard_query = setmetatable(t, {
private.blizzard_query = setmetatable(t, {
__index = function(_, key)
if key == 'name' then
return name_input:GetText()
@@ -58,7 +58,7 @@ blizzard_query = setmetatable(t, {
end,
})
function update_form()
function private.update_form()
if blizzard_query.class and GetAuctionItemSubClasses(blizzard_query.class) then
subclass_dropdown.button:Enable()
else
@@ -99,7 +99,7 @@ function update_form()
end
end
function get_filter_builder_query()
function private.get_filter_builder_query()
local filter_string
local function add(part)
@@ -143,7 +143,7 @@ function get_filter_builder_query()
return filter_string or ''
end
function set_form(filter)
function private.set_form(filter)
clear_form()
for _, component in filter.components do
if component[1] == 'blizzard' then
@@ -155,7 +155,7 @@ function set_form(filter)
update_filter_display()
end
function clear_form()
function private.clear_form()
blizzard_query.name = ''
name_input:ClearFocus()
blizzard_query.exact = false
@@ -174,14 +174,14 @@ function clear_form()
update_filter_display()
end
function import_filter_string()
function private.import_filter_string()
local filter, error = filter_util.parse_filter_string(select(3, strfind(search_box:GetText(), '^([^;]*)')))
if filter or print(error) then
set_form(filter)
end
end
function export_filter_string()
function private.export_filter_string()
search_box:SetText(get_filter_builder_query())
filter_parameter_input:ClearFocus()
end
@@ -230,14 +230,14 @@ function public.formatted_post_filter(components)
return '<html><body><p>' .. str .. '</p></body></html>'
end
function data_link(id, str)
function private.data_link(id, str)
return '|H' .. id .. '|h' .. str .. '|h'
end
post_filter = t
filter_builder_state = T('selected', 0)
private.post_filter = t
private.filter_builder_state = T('selected', 0)
function data_link_click()
function private.data_link_click()
local button = arg3
local index = tonumber(arg1)
if button == 'LeftButton' then
@@ -248,7 +248,7 @@ function data_link_click()
update_filter_display()
end
function remove_component(index)
function private.remove_component(index)
index = index or filter_builder_state.selected
if filter_builder_state.selected >= index then
filter_builder_state.selected = max(filter_builder_state.selected - 1, min(1, getn(post_filter)))
@@ -257,12 +257,12 @@ function remove_component(index)
tremove(post_filter, index)
end
function add_component(component)
function private.add_component(component)
filter_builder_state.selected = filter_builder_state.selected + 1
tinsert(post_filter, filter_builder_state.selected, component)
end
function add_post_filter()
function private.add_post_filter()
for str in present(filter_input:GetText()) do
for filter in present(filter_util.filters[str]) do
if filter.input_type ~= '' then
@@ -284,13 +284,13 @@ end
do
local text = ''
function update_filter_display()
function private.update_filter_display()
text = formatted_post_filter(post_filter)
filter_display:SetWidth(filter_display_size())
set_filter_display_offset()
filter_display:SetText(text)
end
function filter_display_size()
function private.filter_display_size()
local font, font_size = filter_display:GetFont()
filter_display.measure:SetFont(font, font_size)
local lines = 0
@@ -304,7 +304,7 @@ do
end
end
function set_filter_display_offset(x_offset, y_offset)
function private.set_filter_display_offset(x_offset, y_offset)
local scroll_frame = filter_display:GetParent()
x_offset, y_offset = x_offset or scroll_frame:GetHorizontalScroll(), y_offset or scroll_frame:GetVerticalScroll()
local width, height = filter_display_size()
@@ -316,7 +316,7 @@ function set_filter_display_offset(x_offset, y_offset)
scroll_frame:SetVerticalScroll(bounded(y_lower_bound, y_upper_bound, y_offset))
end
function initialize_filter_dropdown()
function private.initialize_filter_dropdown()
for filter in temp-S('and', 'or', 'not', 'min-unit-bid', 'min-unit-buy', 'max-unit-bid', 'max-unit-buy', 'bid-profit', 'buy-profit', 'bid-vend-profit', 'buy-vend-profit', 'bid-dis-profit', 'buy-dis-profit', 'bid-pct', 'buy-pct', 'item', 'tooltip', 'min-lvl', 'max-lvl', 'rarity', 'left', 'utilizable', 'discard') do
UIDropDownMenu_AddButton(T(
'text', filter,
@@ -336,7 +336,7 @@ function initialize_filter_dropdown()
end
end
function initialize_class_dropdown()
function private.initialize_class_dropdown()
local function on_click()
if this.value ~= blizzard_query.class then
UIDropDownMenu_SetSelectedValue(class_dropdown, this.value)
@@ -353,7 +353,7 @@ function initialize_class_dropdown()
end
end
function initialize_subclass_dropdown()
function private.initialize_subclass_dropdown()
local function on_click()
if this.value ~= blizzard_query.subclass then
UIDropDownMenu_SetSelectedValue(subclass_dropdown, this.value)
@@ -371,7 +371,7 @@ function initialize_subclass_dropdown()
end
end
function initialize_slot_dropdown()
function private.initialize_slot_dropdown()
local function on_click()
UIDropDownMenu_SetSelectedValue(slot_dropdown, this.value)
update_form()
@@ -386,7 +386,7 @@ function initialize_slot_dropdown()
end
end
function initialize_quality_dropdown()
function private.initialize_quality_dropdown()
local function on_click()
UIDropDownMenu_SetSelectedValue(quality_dropdown, this.value)
update_form()
+58 -58
View File
@@ -2,8 +2,8 @@ aux 'search_tab' local gui, completion, listing, auction_listing, filter_util =
FILTER_SPACING = 28.5
function create_frames()
frame = CreateFrame('Frame', nil, aux_frame)
function private.create_frames()
private.frame = CreateFrame('Frame', nil, aux_frame)
frame:SetAllPoints()
frame:SetScript('OnUpdate', on_update)
frame:Hide()
@@ -49,7 +49,7 @@ function create_frames()
fake_icon_part:SetText('_')
end
settings_button = btn
private.settings_button = btn
end
do
local panel = CreateFrame('Frame', nil, frame)
@@ -59,14 +59,14 @@ function create_frames()
panel:SetPoint('RIGHT', 0, 0)
panel:SetHeight(42)
panel:Hide()
settings = panel
private.settings = panel
end
do
local panel = CreateFrame('Frame', nil, frame)
panel:SetPoint('LEFT', settings_button, 'RIGHT', 0, 0)
panel:SetPoint('RIGHT', 0, 1)
panel:SetHeight(40)
controls = panel
private.controls = panel
end
do
local function change()
@@ -93,7 +93,7 @@ function create_frames()
label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0)
label:SetText('Pages')
label:SetTextColor(color.text.enabled())
first_page_input = editbox
private.first_page_input = editbox
end
do
local editbox = gui.editbox(settings)
@@ -107,7 +107,7 @@ function create_frames()
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
label:SetText('-')
label:SetTextColor(color.text.enabled())
last_page_input = editbox
private.last_page_input = editbox
end
end
do
@@ -118,9 +118,9 @@ function create_frames()
btn:SetText('Real Time Mode')
btn:SetScript('OnClick', function()
this:SetChecked(not this:GetChecked())
_G.this = first_page_input
this = first_page_input
first_page_input:GetScript('OnTextChanged')()
_G.this = last_page_input
this = last_page_input
last_page_input:GetScript('OnTextChanged')()
end)
public.real_time_button = btn
@@ -138,7 +138,7 @@ function create_frames()
StaticPopup_Show('AUX_SEARCH_AUTO_BUY')
end
end)
auto_buy_button = btn
private.auto_buy_button = btn
end
do
local btn = gui.checkbutton(settings)
@@ -149,7 +149,7 @@ function create_frames()
btn:SetScript('OnClick', function()
if this:GetChecked() then
this:SetChecked(false)
_G.aux_auto_buy_filter = nil
aux_auto_buy_filter = nil
this.prettified = nil
auto_buy_validator = nil
else
@@ -166,7 +166,7 @@ function create_frames()
btn:SetScript('OnLeave', function()
GameTooltip:Hide()
end)
auto_buy_filter_button = btn
private.auto_buy_filter_button = btn
end
do
local btn = gui.button(controls, 25)
@@ -175,7 +175,7 @@ function create_frames()
btn:SetHeight(25)
btn:SetText('<')
btn:SetScript('OnClick', previous_search)
previous_button = btn
private.previous_button = btn
end
do
local btn = gui.button(controls, 25)
@@ -184,7 +184,7 @@ function create_frames()
btn:SetHeight(25)
btn:SetText('>')
btn:SetScript('OnClick', next_search)
next_button = btn
private.next_button = btn
end
do
local btn = gui.button(controls, gui.font_size.huge)
@@ -199,7 +199,7 @@ function create_frames()
end
execute()
end)
start_button = btn
private.start_button = btn
end
do
local btn = gui.button(controls, gui.font_size.huge)
@@ -210,7 +210,7 @@ function create_frames()
btn:SetScript('OnClick', function()
aux.scan.abort(search_scan_id)
end)
stop_button = btn
private.stop_button = btn
end
do
local btn = gui.button(controls, gui.font_size.huge)
@@ -221,7 +221,7 @@ function create_frames()
btn:SetScript('OnClick', function()
execute(true)
end)
resume_button = btn
private.resume_button = btn
end
do
local editbox = gui.editbox(controls)
@@ -240,7 +240,7 @@ function create_frames()
this:HighlightText(0, 0)
end)
editbox.enter = execute
search_box = editbox
private.search_box = editbox
end
do
gui.horizontal_line(frame, -40)
@@ -252,7 +252,7 @@ function create_frames()
btn:SetHeight(22)
btn:SetText('Search Results')
btn:SetScript('OnClick', function() subtab = RESULTS end)
search_results_button = btn
private.search_results_button = btn
end
do
local btn = gui.button(frame, gui.font_size.large)
@@ -261,7 +261,7 @@ function create_frames()
btn:SetHeight(22)
btn:SetText('Saved Searches')
btn:SetScript('OnClick', function() subtab = SAVED end)
saved_searches_button = btn
private.saved_searches_button = btn
end
do
local btn = gui.button(frame, gui.font_size.large)
@@ -270,28 +270,28 @@ function create_frames()
btn:SetHeight(22)
btn:SetText('Filter Builder')
btn:SetScript('OnClick', function() subtab = FILTER end)
new_filter_button = btn
private.new_filter_button = btn
end
do
local frame = CreateFrame('Frame', nil, frame)
frame:SetWidth(265)
frame:SetHeight(25)
frame:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
status_bar_frame = frame
private.status_bar_frame = frame
end
do
local btn = gui.button(frame.results)
btn:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0)
btn:SetText('Bid')
btn:Disable()
bid_button = btn
private.bid_button = btn
end
do
local btn = gui.button(frame.results)
btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
btn:SetText('Buyout')
btn:Disable()
buyout_button = btn
private.buyout_button = btn
end
do
local btn = gui.button(frame.results)
@@ -340,7 +340,7 @@ function create_frames()
end
do
local editbox = gui.editbox(frame.filter)
editbox.complete_item = completion.complete(function() return _G.aux_auctionable_items end)
editbox.complete_item = completion.complete(function() return aux_auctionable_items end)
editbox:SetPoint('TOPLEFT', 14, -FILTER_SPACING)
editbox:SetWidth(260)
editbox.char = function()
@@ -359,11 +359,11 @@ function create_frames()
end
end)
editbox.change = update_form
editbox.enter = partial(editbox.ClearFocus, editbox)
editbox.enter = papply(editbox.ClearFocus, editbox)
local label = gui.label(editbox, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Name')
name_input = editbox
private.name_input = editbox
end
do
local checkbox = gui.checkbox(frame.filter)
@@ -372,7 +372,7 @@ function create_frames()
local label = gui.label(checkbox, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
label:SetText('Exact')
exact_checkbox = checkbox
private.exact_checkbox = checkbox
end
do
local editbox = gui.editbox(frame.filter)
@@ -386,7 +386,7 @@ function create_frames()
max_level_input:SetFocus()
end
end)
editbox.enter = partial(editbox.ClearFocus, editbox)
editbox.enter = papply(editbox.ClearFocus, editbox)
editbox.change = function()
local valid_level = valid_level(this:GetText())
if tostring(valid_level) ~= this:GetText() then
@@ -397,7 +397,7 @@ function create_frames()
local label = gui.label(editbox, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Level Range')
min_level_input = editbox
private.min_level_input = editbox
end
do
local editbox = gui.editbox(frame.filter)
@@ -411,7 +411,7 @@ function create_frames()
name_input:SetFocus()
end
end)
editbox.enter = partial(editbox.ClearFocus, editbox)
editbox.enter = papply(editbox.ClearFocus, editbox)
editbox.change = function()
local valid_level = valid_level(this:GetText())
if tostring(valid_level) ~= this:GetText() then
@@ -422,7 +422,7 @@ function create_frames()
local label = gui.label(editbox, gui.font_size.medium)
label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
label:SetText('-')
max_level_input = editbox
private.max_level_input = editbox
end
do
local checkbox = gui.checkbox(frame.filter)
@@ -431,11 +431,11 @@ function create_frames()
local label = gui.label(checkbox, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
label:SetText('Usable')
usable_checkbox = checkbox
private.usable_checkbox = checkbox
end
do
local dropdown = gui.dropdown(frame.filter)
class_dropdown = dropdown
private.class_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', min_level_input, 'BOTTOMLEFT', 0, 5 - FILTER_SPACING)
dropdown:SetWidth(300)
local label = gui.label(dropdown, gui.font_size.small)
@@ -448,7 +448,7 @@ function create_frames()
end
do
local dropdown = gui.dropdown(frame.filter)
subclass_dropdown = dropdown
private.subclass_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', class_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
dropdown:SetWidth(300)
local label = gui.label(dropdown, gui.font_size.small)
@@ -461,7 +461,7 @@ function create_frames()
end
do
local dropdown = gui.dropdown(frame.filter)
slot_dropdown = dropdown
private.slot_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', subclass_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
dropdown:SetWidth(300)
local label = gui.label(dropdown, gui.font_size.small)
@@ -474,7 +474,7 @@ function create_frames()
end
do
local dropdown = gui.dropdown(frame.filter)
quality_dropdown = dropdown
private.quality_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', slot_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
dropdown:SetWidth(300)
local label = gui.label(dropdown, gui.font_size.small)
@@ -498,7 +498,7 @@ function create_frames()
local label = gui.label(dropdown, gui.font_size.medium)
label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0)
label:SetText('Post Filter')
filter_dropdown = dropdown
private.filter_dropdown = dropdown
end
do
local input = gui.editbox(frame.filter)
@@ -525,7 +525,7 @@ function create_frames()
add_post_filter()
end
end
filter_input = input
private.filter_input = input
end
do
local input = gui.editbox(frame.filter)
@@ -537,7 +537,7 @@ function create_frames()
input.char = function() this:complete() end
input.enter = add_post_filter
input:Hide()
filter_parameter_input = input
private.filter_parameter_input = input
end
do
local scroll_frame = CreateFrame('ScrollFrame', nil, frame.filter)
@@ -578,14 +578,14 @@ function create_frames()
scroll_child:SetWidth(1)
scroll_child:SetHeight(1)
scroll_child:SetScript('OnHyperlinkClick', data_link_click)
-- scroll_child:SetHyperlinkFormat("format")
-- scroll_child:SetHyperlinkFormat("format") TODO
scroll_child.measure = scroll_child:CreateFontString()
filter_display = scroll_child
private.filter_display = scroll_child
end
status_bars = t
tables = t
for _=1,5 do
private.status_bars = t
private.tables = t
for _ = 1, 5 do
local status_bar = gui.status_bar(frame)
status_bar:SetAllPoints(status_bar_frame)
status_bar:Hide()
@@ -618,16 +618,16 @@ function create_frames()
add_filter(data.search.filter_string)
elseif button == 'LeftButton' and IsControlKeyDown() then
if st == favorite_searches_listing and data.index > 1 then
local temp = _G.aux_favorite_searches[data.index - 1]
_G.aux_favorite_searches[data.index - 1] = data.search
_G.aux_favorite_searches[data.index] = temp
local temp = aux_favorite_searches[data.index - 1]
aux_favorite_searches[data.index - 1] = data.search
aux_favorite_searches[data.index] = temp
update_search_listings()
end
elseif button == 'RightButton' and IsControlKeyDown() then
if st == favorite_searches_listing and data.index < getn(_G.aux_favorite_searches) then
local temp = _G.aux_favorite_searches[data.index + 1]
_G.aux_favorite_searches[data.index + 1] = data.search
_G.aux_favorite_searches[data.index] = temp
if st == favorite_searches_listing and data.index < getn(aux_favorite_searches) then
local temp = aux_favorite_searches[data.index + 1]
aux_favorite_searches[data.index + 1] = data.search
aux_favorite_searches[data.index] = temp
update_search_listings()
end
elseif button == 'LeftButton' then
@@ -635,9 +635,9 @@ function create_frames()
execute()
elseif button == 'RightButton' then
if st == recent_searches_listing then
tinsert(_G.aux_favorite_searches, 1, data.search)
tinsert(aux_favorite_searches, 1, data.search)
elseif st == favorite_searches_listing then
tremove(_G.aux_favorite_searches, data.index)
tremove(aux_favorite_searches, data.index)
end
update_search_listings()
end
@@ -654,16 +654,16 @@ function create_frames()
end
}
recent_searches_listing = listing.CreateScrollingTable(frame.saved.recent)
recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}}
private.recent_searches_listing = listing.CreateScrollingTable(frame.saved.recent)
recent_searches_listing:SetColInfo{{ name='Recent Searches', width=1 }}
recent_searches_listing:EnableSorting(false)
recent_searches_listing:DisableSelection(true)
recent_searches_listing:SetHandler('OnClick', handlers.OnClick)
recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
favorite_searches_listing = listing.CreateScrollingTable(frame.saved.favorite)
favorite_searches_listing:SetColInfo{{name='Favorite Searches', width=1}}
private.favorite_searches_listing = listing.CreateScrollingTable(frame.saved.favorite)
favorite_searches_listing:SetColInfo{{ name='Favorite Searches', width=1 }}
favorite_searches_listing:EnableSorting(false)
favorite_searches_listing:DisableSelection(true)
favorite_searches_listing:SetHandler('OnClick', handlers.OnClick)
+21 -21
View File
@@ -1,6 +1,6 @@
aux 'search_tab' local info, scan = aux.info, aux.scan
_G.aux_auto_buy_filter = ''
aux_auto_buy_filter = ''
do
local id = 0
@@ -19,7 +19,7 @@ do
function private.current_search.get() return searches[search_index] end
function update_search(index)
function private.update_search(index)
searches[search_index].status_bar:Hide()
searches[search_index].table:Hide()
searches[search_index].table:SetSelectedRecord()
@@ -46,7 +46,7 @@ do
update_continuation()
end
function new_search(filter_string)
function private.new_search(filter_string)
while getn(searches) > search_index do
tremove(searches)
end
@@ -71,26 +71,26 @@ do
update_search(getn(searches))
end
function previous_search()
function private.previous_search()
search_box:ClearFocus()
update_search(search_index - 1)
subtab = RESULTS
end
function next_search()
function private.next_search()
search_box:ClearFocus()
update_search(search_index + 1)
subtab = RESULTS
end
end
function close_settings()
function private.close_settings()
if settings_button.open then
settings_button:Click()
end
end
function update_continuation()
function private.update_continuation()
if current_search.continuation then
resume_button:Show()
search_box:SetPoint('RIGHT', resume_button, 'LEFT', -4, 0)
@@ -100,7 +100,7 @@ function update_continuation()
end
end
function discard_continuation()
function private.discard_continuation()
scan.abort(search_scan_id)
current_search.continuation = nil
update_continuation()
@@ -116,9 +116,9 @@ function update_start_stop()
end
end
function update_auto_buy_filter()
if _G.aux_auto_buy_filter ~= '' then
local queries, error = aux.filter_util.queries(_G.aux_auto_buy_filter)
function private.update_auto_buy_filter()
if aux_auto_buy_filter ~= '' then
local queries, error = aux.filter_util.queries(aux_auto_buy_filter)
if queries then
if getn(queries) > 1 then
print 'Error: The automatic buyout filter does not support multi-queries'
@@ -134,10 +134,10 @@ function update_auto_buy_filter()
print('Invalid auto buy filter:', error)
end
end
_G.aux_auto_buy_filter = ''
aux_auto_buy_filter = ''
end
function start_real_time_scan(query, search, continuation)
function private.start_real_time_scan(query, search, continuation)
local ignore_page
if not search then
@@ -167,7 +167,7 @@ function start_real_time_scan(query, search, continuation)
if not ignore_page then
if search.auto_buy then
ctrl.suspend()
place_bid('list', auction_record.index, auction_record.buyout_price, partial(ctrl.resume, true))
place_bid('list', auction_record.index, auction_record.buyout_price, papply(ctrl.resume, true))
thread(when, later(GetTime(), 10), ctrl.resume, false)
else
tinsert(new_records, auction_record)
@@ -211,7 +211,7 @@ function start_real_time_scan(query, search, continuation)
}
end
function start_search(queries, continuation)
function private.start_search(queries, continuation)
local current_query, current_page, total_queries, start_query, start_page
local search = current_search
@@ -260,7 +260,7 @@ function start_search(queries, continuation)
on_auction = function(auction_record, ctrl)
if search.auto_buy then
ctrl.suspend()
place_bid('list', auction_record.index, auction_record.buyout_price, partial(ctrl.resume, true))
place_bid('list', auction_record.index, auction_record.buyout_price, papply(ctrl.resume, true))
thread(when, later(GetTime(), 10), ctrl.resume, false)
elseif getn(search.records) < 1000 then
tinsert(search.records, auction_record)
@@ -368,7 +368,7 @@ function public.execute(resume, real_time)
end
end
function test(record)
function private.test(record)
return function(index)
local auction_info = info.auction(index)
return auction_info and auction_info.search_signature == record.search_signature
@@ -381,7 +381,7 @@ do
local state = IDLE
local found_index
function find_auction(record)
function private.find_auction(record)
local search = current_search
if not search.table:ContainsRecord(record) or is_player(record.owner) then
@@ -414,7 +414,7 @@ do
place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
info.bid_update(record)
search.table:SetDatabase()
end or partial(search.table.RemoveAuctionRecord, search.table, record))
end or papply(search.table.RemoveAuctionRecord, search.table, record))
end
end)
bid_button:Enable()
@@ -423,7 +423,7 @@ do
if record.buyout_price > 0 then
buyout_button:SetScript('OnClick', function()
if test(record)(index) and search.table:ContainsRecord(record) then
place_bid('list', index, record.buyout_price, partial(search.table.RemoveAuctionRecord, search.table, record))
place_bid('list', index, record.buyout_price, papply(search.table.RemoveAuctionRecord, search.table, record))
end
end)
buyout_button:Enable()
@@ -432,7 +432,7 @@ do
)
end
function on_update()
function private.on_update()
if state == IDLE or state == SEARCHING then
buyout_button:Disable()
bid_button:Disable()
+10 -10
View File
@@ -1,14 +1,14 @@
aux 'search_tab'
_G.aux_favorite_searches = t
_G.aux_recent_searches = t
aux_favorite_searches = t
aux_recent_searches = t
function update_search_listings()
function private.update_search_listings()
local favorite_search_rows = t
for i, favorite_search in _G.aux_favorite_searches do
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,
})
@@ -16,7 +16,7 @@ function update_search_listings()
favorite_searches_listing:SetData(favorite_search_rows)
local recent_search_rows = t
for i, recent_search in _G.aux_recent_searches do
for i, recent_search in aux_recent_searches do
local name = strsub(recent_search.prettified, 1, 250)
tinsert(recent_search_rows, {
cols = {{ value=name }},
@@ -27,13 +27,13 @@ function update_search_listings()
recent_searches_listing:SetData(recent_search_rows)
end
function new_recent_search(filter_string, prettified)
tinsert(_G.aux_recent_searches, 1, {
function private.new_recent_search(filter_string, prettified)
tinsert(aux_recent_searches, 1, {
filter_string = filter_string,
prettified = prettified,
})
while getn(_G.aux_recent_searches) > 50 do
tremove(_G.aux_recent_searches)
while getn(aux_recent_searches) > 50 do
tremove(aux_recent_searches)
end
update_search_listings()
end