refactoring
This commit is contained in:
+14
-12
@@ -10,16 +10,18 @@ do
|
|||||||
_G.aux = setmetatable({}, {
|
_G.aux = setmetatable({}, {
|
||||||
__metatable = false,
|
__metatable = false,
|
||||||
__index = function(_, key) return modules[key].interface end,
|
__index = function(_, key) return modules[key].interface end,
|
||||||
__newindex = function() end,
|
__newindex = error,
|
||||||
__call = function(_, name)
|
__call = function(self, name)
|
||||||
if not modules[name] then
|
if not modules[name] then
|
||||||
module(aux.core)
|
module(aux.core)
|
||||||
|
aux = self
|
||||||
modules[name] = {env=M, interface=I}
|
modules[name] = {env=M, interface=I}
|
||||||
end
|
end
|
||||||
setfenv(2, modules[name].env)
|
setfenv(2, modules[name].env)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
local aux = aux
|
||||||
|
|
||||||
local bids_loaded
|
local bids_loaded
|
||||||
function public.bids_loaded.get() return bids_loaded end
|
function public.bids_loaded.get() return bids_loaded end
|
||||||
@@ -50,7 +52,7 @@ do
|
|||||||
if getn(pool) < 50 then
|
if getn(pool) < 50 then
|
||||||
tinsert(pool, t)
|
tinsert(pool, t)
|
||||||
else
|
else
|
||||||
overflow_pool[t] = true
|
tinsert(overflow_pool, t)
|
||||||
end
|
end
|
||||||
-- log(getn(table_pool), '-', getn(weak_pool))
|
-- log(getn(table_pool), '-', getn(weak_pool))
|
||||||
end
|
end
|
||||||
@@ -314,9 +316,9 @@ end
|
|||||||
function AUCTION_HOUSE_CLOSED()
|
function AUCTION_HOUSE_CLOSED()
|
||||||
bids_loaded = false
|
bids_loaded = false
|
||||||
current_owner_page = nil
|
current_owner_page = nil
|
||||||
post.stop()
|
aux.post.stop()
|
||||||
stack.stop()
|
aux.stack.stop()
|
||||||
scan.abort()
|
aux.scan.abort()
|
||||||
tab = nil
|
tab = nil
|
||||||
aux_frame:Hide()
|
aux_frame:Hide()
|
||||||
end
|
end
|
||||||
@@ -366,10 +368,10 @@ do
|
|||||||
total_cost = nil
|
total_cost = nil
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
local item_id, suffix_id = info.parse_link(link)
|
local item_id, suffix_id = aux.info.parse_link(link)
|
||||||
local count = select(3, GetCraftReagentInfo(id, i))
|
local count = select(3, GetCraftReagentInfo(id, i))
|
||||||
local _, price, limited = cache.merchant_info(item_id)
|
local _, price, limited = aux.cache.merchant_info(item_id)
|
||||||
local value = price and not limited and price or history.value(item_id..':'..suffix_id)
|
local value = price and not limited and price or aux.history.value(item_id..':'..suffix_id)
|
||||||
if not value then
|
if not value then
|
||||||
total_cost = nil
|
total_cost = nil
|
||||||
break
|
break
|
||||||
@@ -393,10 +395,10 @@ do
|
|||||||
total_cost = nil
|
total_cost = nil
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
local item_id, suffix_id = info.parse_link(link)
|
local item_id, suffix_id = aux.info.parse_link(link)
|
||||||
local count = select(3, GetTradeSkillReagentInfo(id, i))
|
local count = select(3, GetTradeSkillReagentInfo(id, i))
|
||||||
local _, price, limited = cache.merchant_info(item_id)
|
local _, price, limited = aux.cache.merchant_info(item_id)
|
||||||
local value = price and not limited and price or history.value(item_id..':'..suffix_id)
|
local value = price and not limited and price or aux.history.value(item_id..':'..suffix_id)
|
||||||
if not value then
|
if not value then
|
||||||
total_cost = nil
|
total_cost = nil
|
||||||
break
|
break
|
||||||
|
|||||||
+2
-2
@@ -17,17 +17,17 @@ util\persistence.lua
|
|||||||
util\sort.lua
|
util\sort.lua
|
||||||
util\money.lua
|
util\money.lua
|
||||||
util\info.lua
|
util\info.lua
|
||||||
util\scan.lua
|
|
||||||
util\filter.lua
|
util\filter.lua
|
||||||
|
util\scan.lua
|
||||||
util\completion.lua
|
util\completion.lua
|
||||||
|
|
||||||
core\cache.lua
|
core\cache.lua
|
||||||
|
core\history.lua
|
||||||
core\disenchant.lua
|
core\disenchant.lua
|
||||||
core\slash.lua
|
core\slash.lua
|
||||||
core\scan.lua
|
core\scan.lua
|
||||||
core\stack.lua
|
core\stack.lua
|
||||||
core\post.lua
|
core\post.lua
|
||||||
core\history.lua
|
|
||||||
core\tooltip.lua
|
core\tooltip.lua
|
||||||
|
|
||||||
gui\listing.lua
|
gui\listing.lua
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
aux 'post'
|
aux 'post'
|
||||||
|
|
||||||
state = nil
|
local state = nil
|
||||||
|
|
||||||
function process()
|
function process()
|
||||||
if state.posted < state.count then
|
if state.posted < state.count then
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
aux 'stack' local info = aux.info
|
aux 'stack' local info = aux.info
|
||||||
|
|
||||||
state = nil
|
local state = nil
|
||||||
|
|
||||||
function stack_size(slot)
|
function stack_size(slot)
|
||||||
local container_item_info = info.container_item(unpack(slot))
|
local container_item_info = info.container_item(unpack(slot))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
aux 'auction_listing' local gui, sorting, history, money, info = aux.gui, aux.sorting, aux.history, aux.money, aux.info
|
aux 'auction_listing' local gui, sorting, money, info = aux.gui, aux.sorting, aux.money, aux.info
|
||||||
|
|
||||||
_G.aux_price_per_unit = false
|
_G.aux_price_per_unit = false
|
||||||
|
|
||||||
@@ -523,7 +523,7 @@ public.bids_config = {
|
|||||||
function record_percentage(record)
|
function record_percentage(record)
|
||||||
if not record then return end
|
if not record then return end
|
||||||
|
|
||||||
local historical_value = history.value(record.item_key) or 0
|
local historical_value = aux.history.value(record.item_key) or 0
|
||||||
if historical_value > 0 then
|
if historical_value > 0 then
|
||||||
if record.unit_buyout_price > 0 then
|
if record.unit_buyout_price > 0 then
|
||||||
return round(100 * record.unit_buyout_price / historical_value, 1)
|
return round(100 * record.unit_buyout_price / historical_value, 1)
|
||||||
|
|||||||
+1
-2
@@ -100,8 +100,7 @@ function module(...)
|
|||||||
local module_functions, module_getters, module_setters = module[FUNCTION], module[GETTER], module[SETTER]
|
local module_functions, module_getters, module_setters = module[FUNCTION], module[GETTER], module[SETTER]
|
||||||
for k, v in module.access do
|
for k, v in module.access do
|
||||||
if v == PUBLIC and (not access[k] or import_error()) then
|
if v == PUBLIC and (not access[k] or import_error()) then
|
||||||
functions[k], getters[k], setters[k] = module_functions[k], module_getters[k], module_setters[k]
|
access[k], functions[k], getters[k], setters[k] = PRIVATE, module_functions[k], module_getters[k], module_setters[k]
|
||||||
access[k] = PRIVATE
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,15 +19,6 @@ do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function property.get() end
|
|
||||||
function property.set() end
|
|
||||||
auto_buy_validator = property
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
do
|
do
|
||||||
local searches = t
|
local searches = t
|
||||||
local search_index = 1
|
local search_index = 1
|
||||||
|
|||||||
+6
-6
@@ -1,4 +1,4 @@
|
|||||||
aux 'filter_util' local info, cache = aux.info, aux.cache
|
aux 'filter_util' local info = aux.info
|
||||||
|
|
||||||
function default_filter(str)
|
function default_filter(str)
|
||||||
return {
|
return {
|
||||||
@@ -176,7 +176,7 @@ public.filters = {
|
|||||||
input_type = 'money',
|
input_type = 'money',
|
||||||
validator = function(amount)
|
validator = function(amount)
|
||||||
return function(auction_record)
|
return function(auction_record)
|
||||||
local vendor_price = cache.merchant_info(auction_record.item_id)
|
local vendor_price = aux.cache.merchant_info(auction_record.item_id)
|
||||||
return vendor_price and vendor_price * auction_record.aux_quantity - auction_record.bid_price >= amount
|
return vendor_price and vendor_price * auction_record.aux_quantity - auction_record.bid_price >= amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -186,7 +186,7 @@ public.filters = {
|
|||||||
input_type = 'money',
|
input_type = 'money',
|
||||||
validator = function(amount)
|
validator = function(amount)
|
||||||
return function(auction_record)
|
return function(auction_record)
|
||||||
local vendor_price = cache.merchant_info(auction_record.item_id)
|
local vendor_price = aux.cache.merchant_info(auction_record.item_id)
|
||||||
return auction_record.buyout_price > 0 and vendor_price and vendor_price * auction_record.aux_quantity - auction_record.buyout_price >= amount
|
return auction_record.buyout_price > 0 and vendor_price and vendor_price * auction_record.aux_quantity - auction_record.buyout_price >= amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -444,7 +444,7 @@ function prettified_query_string(components)
|
|||||||
|
|
||||||
for key, filter in components.blizzard do
|
for key, filter in components.blizzard do
|
||||||
if key == 'exact' then
|
if key == 'exact' then
|
||||||
prettified.prepend(info.display_name(cache.item_id(components.blizzard.name[2])) or color.blizzard('['..components.blizzard.name[2]..']'))
|
prettified.prepend(info.display_name(aux.cache.item_id(components.blizzard.name[2])) or color.blizzard('['..components.blizzard.name[2]..']'))
|
||||||
elseif key ~= 'name' then
|
elseif key ~= 'name' then
|
||||||
prettified.append(color.blizzard(filter[1]))
|
prettified.append(color.blizzard(filter[1]))
|
||||||
end
|
end
|
||||||
@@ -463,7 +463,7 @@ function prettified_query_string(components)
|
|||||||
end
|
end
|
||||||
for parameter in present(component[3]) do
|
for parameter in present(component[3]) do
|
||||||
if component[2] == 'item' then
|
if component[2] == 'item' then
|
||||||
prettified.append(info.display_name(cache.item_id(parameter)) or color.label.enabled('['..parameter..']'))
|
prettified.append(info.display_name(aux.cache.item_id(parameter)) or color.label.enabled('['..parameter..']'))
|
||||||
else
|
else
|
||||||
if filters[component[2]].input_type == 'money' then
|
if filters[component[2]].input_type == 'money' then
|
||||||
prettified.append(money.to_string(money.from_string(parameter), nil, true, nil, gui.inline_color.label.enabled))
|
prettified.append(money.to_string(money.from_string(parameter), nil, true, nil, gui.inline_color.label.enabled))
|
||||||
@@ -495,7 +495,7 @@ function blizzard_query(components)
|
|||||||
local query = -object('name', filters.name and filters.name[2])
|
local query = -object('name', filters.name and filters.name[2])
|
||||||
|
|
||||||
local item_info, class_index, subclass_index, slot_index
|
local item_info, class_index, subclass_index, slot_index
|
||||||
local item_id = cache.item_id(filters.name[2])
|
local item_id = aux.cache.item_id(filters.name[2])
|
||||||
item_info = item_id and info.item(item_id)
|
item_info = item_id and info.item(item_id)
|
||||||
if filters.exact and item_info then
|
if filters.exact and item_info then
|
||||||
item_info = info.item(item_id)
|
item_info = info.item(item_id)
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
aux 'scan_util' local info , filter_util, scan = aux.info, aux.filter_util, aux.scan
|
aux 'scan_util' local info , filter_util = aux.info, aux.filter_util
|
||||||
|
|
||||||
function public.find(auction_record, status_bar, on_abort, on_failure, on_success)
|
function public.find(auction_record, status_bar, on_abort, on_failure, on_success)
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
|
|||||||
|
|
||||||
|
|
||||||
local found
|
local found
|
||||||
return scan.start{
|
return aux.scan.start{
|
||||||
type = auction_record.query_type,
|
type = auction_record.query_type,
|
||||||
queries = queries,
|
queries = queries,
|
||||||
on_scan_start = function()
|
on_scan_start = function()
|
||||||
|
|||||||
Reference in New Issue
Block a user