refactoring
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
module 'auctions_tab'
|
||||
module 'auctions_tab' import 'scan'
|
||||
|
||||
auction_records = nil
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
module 'bids_tab'
|
||||
module 'bids_tab' import 'scan'
|
||||
|
||||
auction_records = nil
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
module 'post_tab'
|
||||
module 'post_tab' import 'scan' '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'}}
|
||||
@@ -88,7 +88,7 @@ end
|
||||
|
||||
function update_inventory_listing()
|
||||
if not ACTIVE then return end
|
||||
item_listing.populate(item_listing, values(filter(inventory_records, function(record)
|
||||
inventory_listing.populate(inventory_listing, values(filter(inventory_records, function(record)
|
||||
local settings = read_settings(record.key)
|
||||
return record.aux_quantity > 0 and (not settings.hidden or show_hidden_checkbox:GetChecked())
|
||||
end)))
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ function create_frames()
|
||||
|
||||
gui.horizontal_line(frame.inventory, -48)
|
||||
|
||||
item_listing = item_listing.create(
|
||||
inventory_listing = item_listing.create(
|
||||
frame.inventory,
|
||||
function()
|
||||
if arg1 == 'LeftButton' then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module 'search_tab'
|
||||
module 'search_tab' import 'scan'
|
||||
|
||||
StaticPopupDialogs['AUX_SEARCH_TABLE_FULL'] = {
|
||||
text = 'Table full!\nFurther results from this search will still be processed but no longer displayed in the table.',
|
||||
|
||||
+11
-11
@@ -1,4 +1,4 @@
|
||||
module 'search_tab'
|
||||
module 'search_tab' import 'filter_util'
|
||||
|
||||
function valid_level(str)
|
||||
local level = tonumber(str)
|
||||
@@ -109,8 +109,8 @@ function get_filter_builder_query()
|
||||
end
|
||||
|
||||
local name = blizzard_query.name
|
||||
if not index(filter.parse_query_string(name), 'blizzard', 'name') then
|
||||
name = filter.quote(name)
|
||||
if not index(filter_util.parse_query_string(name), 'blizzard', 'name') then
|
||||
name = filter_util.quote(name)
|
||||
end
|
||||
add((name ~= '' or blizzard_query.exact) and name)
|
||||
|
||||
@@ -134,7 +134,7 @@ function get_filter_builder_query()
|
||||
add(strlower(_g['ITEM_QUALITY'..quality..'_DESC']))
|
||||
end
|
||||
|
||||
local post_filter_string = filter.query_string{blizzard={}, post=post_filter}
|
||||
local post_filter_string = filter_util.query_string{blizzard={}, post=post_filter}
|
||||
add(post_filter_string ~= '' and post_filter_string)
|
||||
|
||||
return query_string or ''
|
||||
@@ -171,7 +171,7 @@ function clear_form()
|
||||
end
|
||||
|
||||
function import_query_string()
|
||||
local components, error = filter.parse_query_string(select(3, strfind(search_box:GetText(), '^([^;]*)')))
|
||||
local components, error = filter_util.parse_query_string(select(3, strfind(search_box:GetText(), '^([^;]*)')))
|
||||
if components then
|
||||
set_form(components)
|
||||
else
|
||||
@@ -209,7 +209,7 @@ function public.formatted_post_filter(components)
|
||||
for parameter in present(component[3]) do
|
||||
if component[2] == 'item' then
|
||||
parameter = info.display_name(cache.item_id(parameter)) or '['..parameter..']'
|
||||
elseif filter.filters[component[2]].input_type == 'money' then
|
||||
elseif filter_util.filters[component[2]].input_type == 'money' then
|
||||
parameter = money.to_string(money.from_string(parameter), nil, true)
|
||||
end
|
||||
component_text = component_text..filter_color(': ')..parameter
|
||||
@@ -262,13 +262,13 @@ end
|
||||
|
||||
function add_post_filter()
|
||||
for str in present(filter_input:GetText()) do
|
||||
for filter in present(filter.filters[str]) do
|
||||
for filter in present(filter_util.filters[str]) do
|
||||
if filter.input_type ~= '' then
|
||||
str = str..'/'..filter_parameter_input:GetText()
|
||||
end
|
||||
end
|
||||
|
||||
local components, error, suggestions = filter.parse_query_string(str)
|
||||
local components, error, suggestions = filter_util.parse_query_string(str)
|
||||
|
||||
if components and getn(components.blizzard) == 0 and getn(components.post) == 1 then
|
||||
add_component(components.post[1])
|
||||
@@ -319,15 +319,15 @@ function set_filter_display_offset(x_offset, y_offset)
|
||||
end
|
||||
|
||||
function initialize_filter_dropdown()
|
||||
for _, filter in {'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
|
||||
for _, filter in -list '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{
|
||||
text = filter,
|
||||
value = filter,
|
||||
func = function()
|
||||
filter_input:SetText(this.value)
|
||||
if index(filter.filters[this.value], 'input_type') == '' or this.value == 'not' then
|
||||
if index(filter_util.filters[this.value], 'input_type') == '' or this.value == 'not' then
|
||||
add_post_filter()
|
||||
elseif filter.filters[this.value] then
|
||||
elseif filter_util.filters[this.value] then
|
||||
filter_parameter_input:Show()
|
||||
filter_parameter_input:SetFocus()
|
||||
else
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module 'search_tab' import 'gui' [''] 'core' 'completion' 'listing' 'auction_listing'
|
||||
module 'search_tab' import 'gui' [''] 'core' 'completion' 'listing' 'auction_listing' 'filter_util'
|
||||
|
||||
FILTER_SPACING = 28.5
|
||||
|
||||
@@ -311,7 +311,7 @@ function create_frames()
|
||||
btn:SetHeight(24)
|
||||
btn:SetText 'Favorite'
|
||||
btn:SetScript('OnClick', function()
|
||||
local filters = filter.queries(search_box:GetText())
|
||||
local filters = filter_util.queries(search_box:GetText())
|
||||
if filters then
|
||||
tinsert(_g.aux_favorite_searches, 1, {
|
||||
filter_string = search_box:GetText(),
|
||||
@@ -510,13 +510,13 @@ function create_frames()
|
||||
input:SetPoint('CENTER', filter_dropdown, 'CENTER', 0, 0)
|
||||
input:SetWidth(150)
|
||||
input:SetScript('OnTabPressed', function() filter_parameter_input:SetFocus() end)
|
||||
input.complete = completion.complete(function() return {'and', 'or', 'not', unpack(keys(filter.filters))} end)
|
||||
input.complete = completion.complete(function() return {'and', 'or', 'not', unpack(keys(filter_util.filters))} end)
|
||||
input.char = function() this:complete() end
|
||||
input.change = function()
|
||||
local filter = this:GetText()
|
||||
if filter.filters[filter] and filter.filters[filter].input_type ~= '' then
|
||||
local _, _, suggestions = filter.parse_query_string(filter..'/')
|
||||
filter_parameter_input:SetNumeric(filter.filters[filter].input_type == 'number')
|
||||
local text = this:GetText()
|
||||
if filter_util.filters[text] and filter_util.filters[text].input_type ~= '' then
|
||||
local _, _, suggestions = filter_util.parse_query_string(text..'/')
|
||||
filter_parameter_input:SetNumeric(filter_util.filters[text].input_type == 'number')
|
||||
filter_parameter_input.complete = completion.complete(function() return suggestions or {} end)
|
||||
filter_parameter_input:Show()
|
||||
else
|
||||
|
||||
@@ -113,7 +113,7 @@ end
|
||||
|
||||
function update_auto_buy_filter()
|
||||
if _g.aux_auto_buy_filter ~= '' then
|
||||
local queries = filter.queries(_g.aux_auto_buy_filter)
|
||||
local queries = filter_util.queries(_g.aux_auto_buy_filter)
|
||||
if queries then
|
||||
if getn(queries) > 1 then
|
||||
log 'Error: The automatic buyout filter does not support multi-queries'
|
||||
@@ -308,7 +308,7 @@ function public.execute(resume, real_time)
|
||||
end
|
||||
local filter_string = search_box:GetText()
|
||||
|
||||
local queries = filter.queries(filter_string)
|
||||
local queries = filter_util.queries(filter_string)
|
||||
if not queries then
|
||||
return
|
||||
elseif real_time then
|
||||
|
||||
Reference in New Issue
Block a user