refactoring
This commit is contained in:
+14
-12
@@ -10,16 +10,18 @@ do
|
||||
_G.aux = setmetatable({}, {
|
||||
__metatable = false,
|
||||
__index = function(_, key) return modules[key].interface end,
|
||||
__newindex = function() end,
|
||||
__call = function(_, name)
|
||||
__newindex = error,
|
||||
__call = function(self, name)
|
||||
if not modules[name] then
|
||||
module(aux.core)
|
||||
aux = self
|
||||
modules[name] = {env=M, interface=I}
|
||||
end
|
||||
setfenv(2, modules[name].env)
|
||||
end,
|
||||
})
|
||||
end
|
||||
local aux = aux
|
||||
|
||||
local bids_loaded
|
||||
function public.bids_loaded.get() return bids_loaded end
|
||||
@@ -50,7 +52,7 @@ do
|
||||
if getn(pool) < 50 then
|
||||
tinsert(pool, t)
|
||||
else
|
||||
overflow_pool[t] = true
|
||||
tinsert(overflow_pool, t)
|
||||
end
|
||||
-- log(getn(table_pool), '-', getn(weak_pool))
|
||||
end
|
||||
@@ -314,9 +316,9 @@ end
|
||||
function AUCTION_HOUSE_CLOSED()
|
||||
bids_loaded = false
|
||||
current_owner_page = nil
|
||||
post.stop()
|
||||
stack.stop()
|
||||
scan.abort()
|
||||
aux.post.stop()
|
||||
aux.stack.stop()
|
||||
aux.scan.abort()
|
||||
tab = nil
|
||||
aux_frame:Hide()
|
||||
end
|
||||
@@ -366,10 +368,10 @@ do
|
||||
total_cost = nil
|
||||
break
|
||||
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 _, price, limited = cache.merchant_info(item_id)
|
||||
local value = price and not limited and price or history.value(item_id..':'..suffix_id)
|
||||
local _, price, limited = aux.cache.merchant_info(item_id)
|
||||
local value = price and not limited and price or aux.history.value(item_id..':'..suffix_id)
|
||||
if not value then
|
||||
total_cost = nil
|
||||
break
|
||||
@@ -393,10 +395,10 @@ do
|
||||
total_cost = nil
|
||||
break
|
||||
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 _, price, limited = cache.merchant_info(item_id)
|
||||
local value = price and not limited and price or history.value(item_id..':'..suffix_id)
|
||||
local _, price, limited = aux.cache.merchant_info(item_id)
|
||||
local value = price and not limited and price or aux.history.value(item_id..':'..suffix_id)
|
||||
if not value then
|
||||
total_cost = nil
|
||||
break
|
||||
|
||||
+2
-2
@@ -17,17 +17,17 @@ util\persistence.lua
|
||||
util\sort.lua
|
||||
util\money.lua
|
||||
util\info.lua
|
||||
util\scan.lua
|
||||
util\filter.lua
|
||||
util\scan.lua
|
||||
util\completion.lua
|
||||
|
||||
core\cache.lua
|
||||
core\history.lua
|
||||
core\disenchant.lua
|
||||
core\slash.lua
|
||||
core\scan.lua
|
||||
core\stack.lua
|
||||
core\post.lua
|
||||
core\history.lua
|
||||
core\tooltip.lua
|
||||
|
||||
gui\listing.lua
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
aux 'post'
|
||||
|
||||
state = nil
|
||||
local state = nil
|
||||
|
||||
function process()
|
||||
if state.posted < state.count then
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
aux 'stack' local info = aux.info
|
||||
|
||||
state = nil
|
||||
local state = nil
|
||||
|
||||
function stack_size(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
|
||||
|
||||
@@ -523,7 +523,7 @@ public.bids_config = {
|
||||
function record_percentage(record)
|
||||
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 record.unit_buyout_price > 0 then
|
||||
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]
|
||||
for k, v in module.access do
|
||||
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] = PRIVATE
|
||||
access[k], functions[k], getters[k], setters[k] = PRIVATE, module_functions[k], module_getters[k], module_setters[k]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,15 +19,6 @@ do
|
||||
}
|
||||
end
|
||||
|
||||
function property.get() end
|
||||
function property.set() end
|
||||
auto_buy_validator = property
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
do
|
||||
local searches = t
|
||||
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)
|
||||
return {
|
||||
@@ -176,7 +176,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
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
|
||||
end
|
||||
end
|
||||
@@ -186,7 +186,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
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
|
||||
end
|
||||
end
|
||||
@@ -444,7 +444,7 @@ function prettified_query_string(components)
|
||||
|
||||
for key, filter in components.blizzard do
|
||||
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
|
||||
prettified.append(color.blizzard(filter[1]))
|
||||
end
|
||||
@@ -463,7 +463,7 @@ function prettified_query_string(components)
|
||||
end
|
||||
for parameter in present(component[3]) do
|
||||
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
|
||||
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))
|
||||
@@ -495,7 +495,7 @@ function blizzard_query(components)
|
||||
local query = -object('name', filters.name and filters.name[2])
|
||||
|
||||
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)
|
||||
if filters.exact and item_info then
|
||||
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)
|
||||
|
||||
@@ -32,7 +32,7 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
|
||||
|
||||
|
||||
local found
|
||||
return scan.start{
|
||||
return aux.scan.start{
|
||||
type = auction_record.query_type,
|
||||
queries = queries,
|
||||
on_scan_start = function()
|
||||
|
||||
Reference in New Issue
Block a user