working on module refactoring
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
module 'aux.auctions_tab.frame'
|
||||
module 'aux.tabs.auctions.frame'
|
||||
|
||||
local gui = require 'aux.gui'
|
||||
local auction_listing = require 'aux.gui.auction_listing'
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
module'aux.bids_tab.frame'
|
||||
module 'aux.tabs.bids.frame'
|
||||
|
||||
local gui = require 'aux.gui'
|
||||
local auction_listing = require 'aux.gui.auction_listing'
|
||||
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
module'aux.post_tab'
|
||||
module 'aux.tabs.post'
|
||||
|
||||
include'green_t'
|
||||
include'aux'
|
||||
include'aux.util'
|
||||
include'aux.control'
|
||||
include'aux.util.color'
|
||||
include 'green_t'
|
||||
include 'aux'
|
||||
include 'aux.util'
|
||||
include 'aux.control'
|
||||
include 'aux.util.color'
|
||||
|
||||
local info = require 'aux.util.info'
|
||||
local sort_util = require 'aux.util.sort'
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
module'aux.post_tab.frame'
|
||||
module'aux.tabs.post.frame'
|
||||
|
||||
local info = require 'aux.util.info'
|
||||
local money = require 'aux.util.money'
|
||||
|
||||
+17
-21
@@ -1,10 +1,10 @@
|
||||
aux_search_tab = module
|
||||
module 'aux.tabs.search'
|
||||
|
||||
include (green_t)
|
||||
include (aux)
|
||||
include (aux_util)
|
||||
include (aux_control)
|
||||
include (aux_util_color)
|
||||
include 'green_t'
|
||||
include 'aux'
|
||||
include 'aux.util'
|
||||
include 'aux.control'
|
||||
include 'aux.util.color'
|
||||
|
||||
TAB 'Search'
|
||||
|
||||
@@ -26,23 +26,23 @@ StaticPopupDialogs.AUX_SEARCH_AUTO_BUY = {
|
||||
hideOnEscape = 1,
|
||||
}
|
||||
|
||||
public.RESULTS = 1
|
||||
public.SAVED = 2
|
||||
public.FILTER = 3
|
||||
private.RESULTS = 1
|
||||
private.SAVED = 2
|
||||
private.FILTER = 3
|
||||
|
||||
function LOAD()
|
||||
aux_search_tab_frame.create()
|
||||
-- aux_search_tab_frame.create()
|
||||
subtab = SAVED
|
||||
end
|
||||
|
||||
function OPEN()
|
||||
frame:Show()
|
||||
aux_search_tab_saved.update_search_listings()
|
||||
update_search_listings()
|
||||
end
|
||||
|
||||
function CLOSE()
|
||||
aux_search_tab_results.close_settings()
|
||||
aux_search_tab_results.current_search.table:SetSelectedRecord()
|
||||
close_settings()
|
||||
current_search.table:SetSelectedRecord()
|
||||
frame:Hide()
|
||||
end
|
||||
|
||||
@@ -56,11 +56,7 @@ function USE_ITEM(item_info)
|
||||
execute(nil, false)
|
||||
end
|
||||
|
||||
function public.execute(resume, real_time)
|
||||
aux_search_tab_results.execute(resume, real_time)
|
||||
end
|
||||
|
||||
function public.subtab.set(tab)
|
||||
function private.subtab.set(tab)
|
||||
search_results_button:UnlockHighlight()
|
||||
saved_searches_button:UnlockHighlight()
|
||||
new_filter_button:UnlockHighlight()
|
||||
@@ -80,11 +76,11 @@ function public.subtab.set(tab)
|
||||
end
|
||||
end
|
||||
|
||||
function public.set_filter(filter_string)
|
||||
function private.set_filter(filter_string)
|
||||
search_box:SetText(filter_string)
|
||||
end
|
||||
|
||||
function public.add_filter(filter_string)
|
||||
function private.add_filter(filter_string)
|
||||
local old_filter_string = search_box:GetText()
|
||||
old_filter_string = trim(old_filter_string)
|
||||
|
||||
@@ -95,7 +91,7 @@ function public.add_filter(filter_string)
|
||||
search_box:SetText(old_filter_string .. filter_string)
|
||||
end
|
||||
|
||||
function public.blizzard_page_index(str)
|
||||
function private.blizzard_page_index(str)
|
||||
if tonumber(str) then
|
||||
return max(0, tonumber(str) - 1)
|
||||
end
|
||||
|
||||
+30
-37
@@ -1,23 +1,16 @@
|
||||
aux_search_tab_filter = module
|
||||
module 'aux.tabs.search'
|
||||
|
||||
include (green_t)
|
||||
include (aux)
|
||||
include (aux_util)
|
||||
include (aux_control)
|
||||
include (aux_util_color)
|
||||
local info = require 'aux.util.info'
|
||||
local money = require 'aux.util.money'
|
||||
local cache = require 'aux.core.cache'
|
||||
local filter_util = require 'aux.util.filter'
|
||||
|
||||
function LOAD()
|
||||
include (aux_search_tab)
|
||||
end
|
||||
|
||||
local filter_util = aux_filter_util
|
||||
|
||||
function public.valid_level(str)
|
||||
function private.valid_level(str)
|
||||
local level = tonumber(str)
|
||||
return level and bounded(1, 60, level)
|
||||
end
|
||||
|
||||
public.blizzard_query = setmetatable(t, {
|
||||
private.blizzard_query = setmetatable(t, {
|
||||
__index = function(_, key)
|
||||
if key == 'name' then
|
||||
return name_input:GetText()
|
||||
@@ -30,16 +23,16 @@ public.blizzard_query = setmetatable(t, {
|
||||
elseif key == 'usable' then
|
||||
return usable_checkbox:GetChecked()
|
||||
elseif key == 'class' then
|
||||
local class_index = UIDropDownMenu_GetSelectedValue(aux_search_tab.class_dropdown)
|
||||
local class_index = UIDropDownMenu_GetSelectedValue(class_dropdown)
|
||||
return (class_index or 0) > 0 and class_index or nil
|
||||
elseif key == 'subclass' then
|
||||
local subclass_index = UIDropDownMenu_GetSelectedValue(aux_search_tab.subclass_dropdown)
|
||||
local subclass_index = UIDropDownMenu_GetSelectedValue(subclass_dropdown)
|
||||
return (subclass_index or 0) > 0 and subclass_index or nil
|
||||
elseif key == 'slot' then
|
||||
local slot_index = UIDropDownMenu_GetSelectedValue(aux_search_tab.slot_dropdown)
|
||||
local slot_index = UIDropDownMenu_GetSelectedValue(slot_dropdown)
|
||||
return (slot_index or 0) > 0 and slot_index or nil
|
||||
elseif key == 'quality' then
|
||||
local quality_code = UIDropDownMenu_GetSelectedValue(aux_search_tab.quality_dropdown)
|
||||
local quality_code = UIDropDownMenu_GetSelectedValue(quality_dropdown)
|
||||
return (quality_code or -1) >= 0 and quality_code or nil
|
||||
end
|
||||
end,
|
||||
@@ -70,7 +63,7 @@ public.blizzard_query = setmetatable(t, {
|
||||
end,
|
||||
})
|
||||
|
||||
function public.update_form()
|
||||
function private.update_form()
|
||||
if blizzard_query.class and GetAuctionItemSubClasses(blizzard_query.class) then
|
||||
subclass_dropdown.button:Enable()
|
||||
else
|
||||
@@ -186,19 +179,19 @@ function private.clear_form()
|
||||
update_filter_display()
|
||||
end
|
||||
|
||||
function public.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 public.export_filter_string()
|
||||
function private.export_filter_string()
|
||||
search_box:SetText(get_filter_builder_query())
|
||||
filter_parameter_input:ClearFocus()
|
||||
end
|
||||
|
||||
function public.formatted_post_filter(components)
|
||||
function private.formatted_post_filter(components)
|
||||
local no_line_break
|
||||
local stack = tt
|
||||
local str = ''
|
||||
@@ -208,7 +201,7 @@ function public.formatted_post_filter(components)
|
||||
str = str .. ' '
|
||||
elseif i > 1 then
|
||||
str = str .. '</p><p>'
|
||||
for _=1,getn(stack) do
|
||||
for _ = 1, getn(stack) do
|
||||
str = str .. color.content.background('----')
|
||||
end
|
||||
end
|
||||
@@ -222,9 +215,9 @@ function public.formatted_post_filter(components)
|
||||
elseif component[1] == 'filter' then
|
||||
for parameter in present(component[3]) do
|
||||
if component[2] == 'item' then
|
||||
parameter = aux_info.display_name(aux_cache.item_id(parameter)) or '[' .. parameter .. ']'
|
||||
parameter = info.display_name(cache.item_id(parameter)) or '[' .. parameter .. ']'
|
||||
elseif filter_util.filters[component[2]].input_type == 'money' then
|
||||
parameter = aux_money.to_string(aux_money.from_string(parameter), nil, true)
|
||||
parameter = money.to_string(money.from_string(parameter), nil, true)
|
||||
end
|
||||
component_text = component_text .. filter_color(': ') .. parameter
|
||||
end
|
||||
@@ -249,7 +242,7 @@ end
|
||||
private.post_filter = t
|
||||
private.filter_builder_state = T('selected', 0)
|
||||
|
||||
function public.data_link_click()
|
||||
function private.data_link_click()
|
||||
local button = arg3
|
||||
local index = tonumber(arg1)
|
||||
if button == 'LeftButton' then
|
||||
@@ -274,7 +267,7 @@ function private.add_component(component)
|
||||
tinsert(post_filter, filter_builder_state.selected, component)
|
||||
end
|
||||
|
||||
function public.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
|
||||
@@ -296,7 +289,7 @@ end
|
||||
|
||||
do
|
||||
local text = ''
|
||||
function public.update_filter_display()
|
||||
function private.update_filter_display()
|
||||
text = formatted_post_filter(post_filter)
|
||||
filter_display:SetWidth(filter_display_size())
|
||||
set_filter_display_offset()
|
||||
@@ -316,7 +309,7 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
function public.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()
|
||||
@@ -328,7 +321,7 @@ function public.set_filter_display_offset(x_offset, y_offset)
|
||||
scroll_frame:SetVerticalScroll(bounded(y_lower_bound, y_upper_bound, y_offset))
|
||||
end
|
||||
|
||||
function public.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,
|
||||
@@ -348,7 +341,7 @@ function public.initialize_filter_dropdown()
|
||||
end
|
||||
end
|
||||
|
||||
function public.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)
|
||||
@@ -365,7 +358,7 @@ function public.initialize_class_dropdown()
|
||||
end
|
||||
end
|
||||
|
||||
function public.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)
|
||||
@@ -374,7 +367,7 @@ function public.initialize_subclass_dropdown()
|
||||
update_form()
|
||||
end
|
||||
end
|
||||
local class_index = UIDropDownMenu_GetSelectedValue(aux_search_tab.class_dropdown)
|
||||
local class_index = UIDropDownMenu_GetSelectedValue(class_dropdown)
|
||||
if class_index and GetAuctionItemSubClasses(class_index) then
|
||||
UIDropDownMenu_AddButton(T('text', ALL, 'value', 0, 'func', on_click))
|
||||
for i, subclass in temp-A(GetAuctionItemSubClasses(class_index)) do
|
||||
@@ -383,13 +376,13 @@ function public.initialize_subclass_dropdown()
|
||||
end
|
||||
end
|
||||
|
||||
function public.initialize_slot_dropdown()
|
||||
function private.initialize_slot_dropdown()
|
||||
local function on_click()
|
||||
UIDropDownMenu_SetSelectedValue(slot_dropdown, this.value)
|
||||
update_form()
|
||||
end
|
||||
local class_index = UIDropDownMenu_GetSelectedValue(aux_search_tab.class_dropdown)
|
||||
local subclass_index = UIDropDownMenu_GetSelectedValue(aux_search_tab.subclass_dropdown)
|
||||
local class_index = UIDropDownMenu_GetSelectedValue(class_dropdown)
|
||||
local subclass_index = UIDropDownMenu_GetSelectedValue(subclass_dropdown)
|
||||
if subclass_index and GetAuctionInvTypes(class_index, subclass_index) then
|
||||
UIDropDownMenu_AddButton(T('text', ALL, 'value', '', 'func', on_click))
|
||||
for i, slot in temp-A(GetAuctionInvTypes(class_index, subclass_index)) do
|
||||
@@ -398,7 +391,7 @@ function public.initialize_slot_dropdown()
|
||||
end
|
||||
end
|
||||
|
||||
function public.initialize_quality_dropdown()
|
||||
function private.initialize_quality_dropdown()
|
||||
local function on_click()
|
||||
UIDropDownMenu_SetSelectedValue(quality_dropdown, this.value)
|
||||
update_form()
|
||||
|
||||
+651
-649
File diff suppressed because it is too large
Load Diff
+24
-28
@@ -1,20 +1,16 @@
|
||||
aux_search_tab_results = module
|
||||
module 'aux.tabs.search'
|
||||
|
||||
include (green_t)
|
||||
include (aux)
|
||||
include (aux_util)
|
||||
include (aux_control)
|
||||
include (aux_util_color)
|
||||
local info = require 'aux.util.info'
|
||||
local filter_util = require 'aux.util.filter'
|
||||
local scan_util = require 'aux.util.scan'
|
||||
local scan = require 'aux.core.scan'
|
||||
|
||||
function LOAD()
|
||||
include (aux_search_tab)
|
||||
new_search('')
|
||||
new_search''
|
||||
current_search.dummy = true
|
||||
update_auto_buy_filter()
|
||||
end
|
||||
|
||||
local info, scan = aux_info, aux_scan
|
||||
|
||||
aux_auto_buy_filter = ''
|
||||
|
||||
do
|
||||
@@ -49,20 +45,20 @@ end
|
||||
|
||||
do
|
||||
local id = 0
|
||||
function public.search_scan_id.get() return id end
|
||||
function public.search_scan_id.set(v) id = v end
|
||||
function private.search_scan_id.get() return id end
|
||||
function private.search_scan_id.set(v) id = v end
|
||||
end
|
||||
do
|
||||
local validator
|
||||
function public.auto_buy_validator.get() return validator end
|
||||
function public.auto_buy_validator.set(v) validator = v end
|
||||
function private.auto_buy_validator.get() return validator end
|
||||
function private.auto_buy_validator.set(v) validator = v end
|
||||
end
|
||||
|
||||
do
|
||||
local searches = t
|
||||
local search_index = 1
|
||||
|
||||
function public.current_search.get()
|
||||
function private.current_search.get()
|
||||
return searches[search_index]
|
||||
end
|
||||
|
||||
@@ -118,20 +114,20 @@ do
|
||||
update_search(getn(searches))
|
||||
end
|
||||
|
||||
function public.previous_search()
|
||||
function private.previous_search()
|
||||
search_box:ClearFocus()
|
||||
update_search(search_index - 1)
|
||||
subtab = RESULTS
|
||||
end
|
||||
|
||||
function public.next_search()
|
||||
function private.next_search()
|
||||
search_box:ClearFocus()
|
||||
update_search(search_index + 1)
|
||||
subtab = RESULTS
|
||||
end
|
||||
end
|
||||
|
||||
function public.close_settings()
|
||||
function private.close_settings()
|
||||
if settings_button.open then
|
||||
settings_button:Click()
|
||||
end
|
||||
@@ -165,7 +161,7 @@ end
|
||||
|
||||
function private.update_auto_buy_filter()
|
||||
if aux_auto_buy_filter ~= '' then
|
||||
local queries, error = aux_filter_util.queries(aux_auto_buy_filter)
|
||||
local queries, error = 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'
|
||||
@@ -232,7 +228,7 @@ function private.start_real_time_scan(query, search, continuation)
|
||||
init[new_records] = temp-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)
|
||||
@@ -244,7 +240,7 @@ function private.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
|
||||
|
||||
@@ -312,13 +308,13 @@ function private.start_search(queries, continuation)
|
||||
elseif 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
|
||||
@@ -329,7 +325,7 @@ function private.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}
|
||||
@@ -359,7 +355,7 @@ function public.execute(resume, real_time)
|
||||
end
|
||||
local filter_string = search_box:GetText()
|
||||
|
||||
local queries, error = aux_filter_util.queries(filter_string)
|
||||
local queries, error = filter_util.queries(filter_string)
|
||||
if not queries then
|
||||
print('Invalid filter:', error)
|
||||
return
|
||||
@@ -385,7 +381,7 @@ function public.execute(resume, real_time)
|
||||
else
|
||||
new_search(filter_string)
|
||||
end
|
||||
aux_search_tab_saved.new_recent_search(filter_string, join(map(copy(queries), function(filter) return filter.prettified end), ';'))
|
||||
new_recent_search(filter_string, join(map(copy(queries), function(filter) return filter.prettified end), ';'))
|
||||
else
|
||||
current_search.records = t
|
||||
current_search.table:SetDatabase(current_search.records)
|
||||
@@ -428,7 +424,7 @@ do
|
||||
local state = IDLE
|
||||
local found_index
|
||||
|
||||
function public.find_auction(record)
|
||||
function private.find_auction(record)
|
||||
local search = current_search
|
||||
|
||||
if not search.table:ContainsRecord(record) or is_player(record.owner) then
|
||||
@@ -437,7 +433,7 @@ do
|
||||
|
||||
scan.abort(scan_id)
|
||||
state = SEARCHING
|
||||
scan_id = aux_scan_util.find(
|
||||
scan_id = scan_util.find(
|
||||
record,
|
||||
current_search.status_bar,
|
||||
function()
|
||||
|
||||
+3
-13
@@ -1,19 +1,9 @@
|
||||
aux_search_tab_saved = module
|
||||
|
||||
include (green_t)
|
||||
include (aux)
|
||||
include (aux_util)
|
||||
include (aux_control)
|
||||
include (aux_util_color)
|
||||
|
||||
function LOAD()
|
||||
include (aux_search_tab)
|
||||
end
|
||||
module 'aux.tabs.search'
|
||||
|
||||
aux_favorite_searches = t
|
||||
aux_recent_searches = t
|
||||
|
||||
function public.update_search_listings()
|
||||
function private.update_search_listings()
|
||||
local favorite_search_rows = t
|
||||
for i, favorite_search in aux_favorite_searches do
|
||||
local name = strsub(favorite_search.prettified, 1, 250)
|
||||
@@ -37,7 +27,7 @@ function public.update_search_listings()
|
||||
recent_searches_listing:SetData(recent_search_rows)
|
||||
end
|
||||
|
||||
function public.new_recent_search(filter_string, prettified)
|
||||
function private.new_recent_search(filter_string, prettified)
|
||||
tinsert(aux_recent_searches, 1, {
|
||||
filter_string = filter_string,
|
||||
prettified = prettified,
|
||||
|
||||
Reference in New Issue
Block a user