module refactoring
This commit is contained in:
committed by
Simon Hirsig
parent
5e093306e6
commit
62ef2683f5
+13
-13
@@ -22,7 +22,7 @@ local settings_schema = {'tuple', '#', {duration='number'}, {start_price='number
|
||||
|
||||
local scan_id, inventory_records, bid_records, buyout_records = 0, {}, {}, {}
|
||||
|
||||
function get_default_settings()
|
||||
function get.default_settings()
|
||||
return O('duration', DURATION_8, 'start_price', 0, 'buyout_price', 0, 'hidden', false)
|
||||
end
|
||||
|
||||
@@ -41,16 +41,16 @@ end
|
||||
|
||||
do
|
||||
local bid_selections, buyout_selections = {}, {}
|
||||
function get_bid_selection()
|
||||
function get.bid_selection()
|
||||
return bid_selections[selected_item.key]
|
||||
end
|
||||
function set_bid_selection(record)
|
||||
function set.bid_selection(record)
|
||||
bid_selections[selected_item.key] = record
|
||||
end
|
||||
function get_buyout_selection()
|
||||
function get.buyout_selection()
|
||||
return buyout_selections[selected_item.key]
|
||||
end
|
||||
function set_buyout_selection(record)
|
||||
function set.buyout_selection(record)
|
||||
buyout_selections[selected_item.key] = record
|
||||
end
|
||||
end
|
||||
@@ -63,14 +63,14 @@ end
|
||||
|
||||
do
|
||||
local item
|
||||
function get_selected_item() return item end
|
||||
function set_selected_item(v) item = v end
|
||||
function get.selected_item() return item end
|
||||
function set.selected_item(v) item = v end
|
||||
end
|
||||
|
||||
do
|
||||
local c = 0
|
||||
function get_refresh() return c end
|
||||
function set_refresh(v) c = v end
|
||||
function get.refresh() return c end
|
||||
function set.refresh(v) c = v end
|
||||
end
|
||||
|
||||
function OPEN()
|
||||
@@ -88,21 +88,21 @@ function USE_ITEM(item_info)
|
||||
select_item(item_info.item_key)
|
||||
end
|
||||
|
||||
function get_unit_start_price()
|
||||
function get.unit_start_price()
|
||||
return selected_item and read_settings().start_price or 0
|
||||
end
|
||||
|
||||
function set_unit_start_price(amount)
|
||||
function set.unit_start_price(amount)
|
||||
local settings = read_settings()
|
||||
settings.start_price = amount
|
||||
write_settings(settings)
|
||||
end
|
||||
|
||||
function get_unit_buyout_price()
|
||||
function get.unit_buyout_price()
|
||||
return selected_item and read_settings().buyout_price or 0
|
||||
end
|
||||
|
||||
function set_unit_buyout_price(amount)
|
||||
function set.unit_buyout_price(amount)
|
||||
local settings = read_settings()
|
||||
settings.buyout_price = amount
|
||||
write_settings(settings)
|
||||
|
||||
@@ -44,7 +44,7 @@ function USE_ITEM(item_info)
|
||||
execute(nil, false)
|
||||
end
|
||||
|
||||
function set_subtab(tab)
|
||||
function set.subtab(tab)
|
||||
CloseDropDownMenus()
|
||||
search_results_button:UnlockHighlight()
|
||||
saved_searches_button:UnlockHighlight()
|
||||
@@ -65,7 +65,7 @@ function set_subtab(tab)
|
||||
end
|
||||
end
|
||||
|
||||
function M.set_filter(filter_string)
|
||||
function M.set.filter(filter_string)
|
||||
search_box:SetFocus()
|
||||
search_box:SetText(filter_string)
|
||||
end
|
||||
|
||||
@@ -105,7 +105,7 @@ function update_form()
|
||||
end
|
||||
end
|
||||
|
||||
function get_filter_builder_query()
|
||||
function get.filter_builder_query()
|
||||
local filter_string
|
||||
|
||||
local function add(part)
|
||||
@@ -150,7 +150,7 @@ function get_filter_builder_query()
|
||||
return filter_string or ''
|
||||
end
|
||||
|
||||
function set_form(filter)
|
||||
function set.form(filter)
|
||||
clear_form()
|
||||
for _, component in ipairs(filter.components) do
|
||||
if component[1] == 'blizzard' then
|
||||
@@ -184,7 +184,7 @@ end
|
||||
function 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)
|
||||
set.form(filter)
|
||||
end
|
||||
update_form()
|
||||
end
|
||||
|
||||
@@ -12,10 +12,10 @@ end
|
||||
|
||||
do
|
||||
local id = 0
|
||||
function get_search_scan_id()
|
||||
function get.search_scan_id()
|
||||
return id
|
||||
end
|
||||
function set_search_scan_id(v)
|
||||
function set.search_scan_id(v)
|
||||
id = v
|
||||
end
|
||||
end
|
||||
@@ -36,7 +36,7 @@ do
|
||||
local searches = {}
|
||||
local search_index = 1
|
||||
|
||||
function get_current_search()
|
||||
function get.current_search()
|
||||
return searches[search_index]
|
||||
end
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ handlers = {
|
||||
end
|
||||
}
|
||||
|
||||
function get_auto_buy_validator()
|
||||
function get.auto_buy_validator()
|
||||
local validators = T
|
||||
for _, search in pairs(favorite_searches) do
|
||||
if search.auto_buy then
|
||||
|
||||
Reference in New Issue
Block a user