working on module refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-10-09 01:48:27 +02:00
parent cab2733300
commit 945ff6dd87
31 changed files with 225 additions and 236 deletions
+5 -5
View File
@@ -1,9 +1,9 @@
aux_util_color = module
module'aux.util.color'
include (green_t)
include (aux)
include (aux_util)
include (aux_control)
include'green_t'
include'aux'
include'aux.util'
include'aux.control'
local COLORS = {
text = {enabled = {255, 254, 250, 1}, disabled = {147, 151, 139, 1}},
+7 -7
View File
@@ -1,12 +1,12 @@
aux_completion = module
module'aux.completion'
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 filter_util = aux_filter_util
local filter_util = M'aux.filter_util'
function public:complete_filter()
if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution
+3 -3
View File
@@ -1,7 +1,7 @@
aux_util = module
module'aux.util'
include (green_t)
include (aux)
include'green_t'
include'aux'
do
local classes, interfaces, objects = {}, {}, setmetatable({}, { __mode='k' })
+23 -23
View File
@@ -1,12 +1,12 @@
aux_filter_util = module
module'aux.filter_util'
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 = aux_info
local info, history, disenchant, cache, money, filter_util = M'aux.info', M'aux.history', M'aux.disenchant', M'aux.cache', M'aux.money', M'aux.filter_util'
function private.default_filter(str)
return {
@@ -124,7 +124,7 @@ public.filters = {
input_type = 'number',
validator = function(pct)
return function(auction_record)
return aux_history.value(auction_record.item_key) and auction_record.unit_bid_price / aux_history.value(auction_record.item_key) * 100 <= pct
return history.value(auction_record.item_key) and auction_record.unit_bid_price / history.value(auction_record.item_key) * 100 <= pct
end
end
},
@@ -134,8 +134,8 @@ public.filters = {
validator = function(pct)
return function(auction_record)
return auction_record.unit_buyout_price > 0
and aux_history.value(auction_record.item_key)
and auction_record.unit_buyout_price / aux_history.value(auction_record.item_key) * 100 <= pct
and history.value(auction_record.item_key)
and auction_record.unit_buyout_price / history.value(auction_record.item_key) * 100 <= pct
end
end
},
@@ -144,7 +144,7 @@ public.filters = {
input_type = 'money',
validator = function(amount)
return function(auction_record)
return aux_history.value(auction_record.item_key) and aux_history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.bid_price >= amount
return history.value(auction_record.item_key) and history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.bid_price >= amount
end
end
},
@@ -153,7 +153,7 @@ public.filters = {
input_type = 'money',
validator = function(amount)
return function(auction_record)
return auction_record.buyout_price > 0 and aux_history.value(auction_record.item_key) and aux_history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.buyout_price >= amount
return auction_record.buyout_price > 0 and history.value(auction_record.item_key) and history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.buyout_price >= amount
end
end
},
@@ -162,7 +162,7 @@ public.filters = {
input_type = 'money',
validator = function(amount)
return function(auction_record)
local disenchant_value = aux_disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
local disenchant_value = disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
return disenchant_value and disenchant_value - auction_record.bid_price >= amount
end
end
@@ -172,7 +172,7 @@ public.filters = {
input_type = 'money',
validator = function(amount)
return function(auction_record)
local disenchant_value = aux_disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
local disenchant_value = disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
return auction_record.buyout_price > 0 and disenchant_value and disenchant_value - auction_record.buyout_price >= amount
end
end
@@ -182,7 +182,7 @@ public.filters = {
input_type = 'money',
validator = function(amount)
return function(auction_record)
local vendor_price = aux_cache.merchant_info(auction_record.item_id)
local vendor_price = cache.merchant_info(auction_record.item_id)
return vendor_price and vendor_price * auction_record.aux_quantity - auction_record.bid_price >= amount
end
end
@@ -192,7 +192,7 @@ public.filters = {
input_type = 'money',
validator = function(amount)
return function(auction_record)
local vendor_price = aux_cache.merchant_info(auction_record.item_id)
local vendor_price = 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
@@ -269,7 +269,7 @@ end
function private.parse_parameter(input_type, str)
if input_type == 'money' then
local money = aux_money.from_string(str)
local money = money.from_string(str)
return money and money > 0 and money or nil
elseif input_type == 'number' then
local number = tonumber(str)
@@ -435,8 +435,8 @@ function public.filter_string(components)
elseif component[1] == 'filter' then
query_builder.append(component[2])
for parameter in present(component[3]) do
if aux_filter_util.filters[component[2]].input_type == 'money' then
parameter = aux_money.to_string(aux_money.from_string(parameter), nil, true, nil, nil, true)
if filter_util.filters[component[2]].input_type == 'money' then
parameter = money.to_string(money.from_string(parameter), nil, true, nil, nil, true)
end
query_builder.append(parameter)
end
@@ -453,7 +453,7 @@ function private.prettified_filter_string(filter)
if component[1] == 'blizzard' then
if component[2] == 'name' then
if filter.blizzard.exact then
prettified.append(info.display_name(aux_cache.item_id(component[4])) or color.orange('[' .. component[4] .. ']'))
prettified.append(info.display_name(cache.item_id(component[4])) or color.orange('[' .. component[4] .. ']'))
elseif component[4] ~= '' then
prettified.append(color.orange(component[4]))
end
@@ -468,10 +468,10 @@ function private.prettified_filter_string(filter)
end
for parameter in present(component[3]) do
if component[2] == 'item' then
prettified.append(info.display_name(aux_cache.item_id(parameter)) or color.label.enabled('[' .. parameter .. ']'))
prettified.append(info.display_name(cache.item_id(parameter)) or color.label.enabled('[' .. parameter .. ']'))
else
if filters[component[2]].input_type == 'money' then
prettified.append(aux_money.to_string(aux_money.from_string(parameter), nil, true, nil, inline_color.label.enabled))
prettified.append(money.to_string(money.from_string(parameter), nil, true, nil, inline_color.label.enabled))
else
prettified.append(color.label.enabled(parameter))
end
@@ -498,7 +498,7 @@ function private.blizzard_query(filter)
local filters = filter.blizzard
local query = T('name', filters.name and filters.name[2])
local item_info, class_index, subclass_index, slot_index
local item_id = filters.name and aux_cache.item_id(filters.name[2])
local item_id = filters.name and 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)
+9 -7
View File
@@ -1,10 +1,12 @@
aux_info = module
module'aux.info'
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 cache = M'aux.cache'
CreateFrame('GameTooltip', 'AuxTooltip', nil, 'GameTooltipTemplate')
AuxTooltip:SetScript('OnTooltipAddMoney', function()
@@ -371,7 +373,7 @@ function public.item(item_id, suffix_id)
'slot', slot,
'max_stack', max_stack,
'texture', texture
) or aux_cache.item_info(item_id)
) or cache.item_info(item_id)
end
function public.item_class_index(item_class)
+6 -6
View File
@@ -1,10 +1,10 @@
aux_money = module
module'aux.money'
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'
public.GOLD_TEXT = '|cffffd70ag|r'
public.SILVER_TEXT = '|cffc7c7cfs|r'
+7 -7
View File
@@ -1,10 +1,10 @@
aux_persistence = module
module'aux.persistence'
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'
aux_datasets = t
@@ -12,7 +12,7 @@ do
local dataset
function public.dataset.get()
if not dataset then
local dataset_key = format('%s|%s', GetCVar 'realmName', UnitFactionGroup 'player')
local dataset_key = format('%s|%s', GetCVar'realmName', UnitFactionGroup'player')
dataset = aux_datasets[dataset_key] or t
aux_datasets[dataset_key] = dataset
end
+8 -8
View File
@@ -1,12 +1,12 @@
aux_scan_util = module
module'aux.scan_util'
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 , filter_util = aux_info, aux_filter_util
local info , filter_util, scan = M'aux.info', M'aux.filter_util', M'aux.scan'
function public.find(auction_record, status_bar, on_abort, on_failure, on_success)
@@ -39,7 +39,7 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
end
local found
return aux_scan.start{
return scan.start{
type = auction_record.query_type,
queries = queries,
on_scan_start = function()
+6 -6
View File
@@ -1,10 +1,10 @@
aux_sorting = module
module'aux.sorting'
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'
public.EQ = 0
public.LT = 1