big module refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-18 17:28:38 +02:00
parent 54c45f8fdb
commit 337bc19578
17 changed files with 145 additions and 143 deletions
+2 -2
View File
@@ -292,7 +292,7 @@ function public.parse_query_string(str)
if input_type ~= '' then
if not parts[i + 1] or not m.parse_parameter(input_type, parts[i + 1]) then
if parts[i] == 'item' then
return nil, 'Invalid item name', aux_auctionable_items
return nil, 'Invalid item name', _G.aux_auctionable_items
elseif type(input_type) == 'table' then
return nil, 'Invalid choice for '..parts[i], input_type
else
@@ -423,7 +423,7 @@ function private.suggestions(components)
-- item names
if aux.util.size(components.blizzard) + getn(components.post) == 1 and components.blizzard.name == '' then
for _, name in aux_auctionable_items do
for _, name in _G.aux_auctionable_items do
tinsert(suggestions, name..'/exact')
end
end
+3 -3
View File
@@ -124,8 +124,8 @@ function public.auction(index, query_type)
hyperlink = hyperlink,
itemstring = item_info.itemstring,
item_key = item_id..':'..suffix_id,
search_signature = table.concat({item_id, suffix_id, enchant_id, start_price, buyout_price, bid_price, aux_quantity, duration, query_type == 'owner' and high_bidder or (high_bidder and 1 or 0), aux_ignore_owner and (aux.is_player(owner) and 0 or 1) or (owner or '?')}, ':'),
sniping_signature = table.concat({item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, aux_ignore_owner and (aux.is_player(owner, true) and 0 or 1) or (owner or '?')}, ':'),
search_signature = table.concat({item_id, suffix_id, enchant_id, start_price, buyout_price, bid_price, aux_quantity, duration, query_type == 'owner' and high_bidder or (high_bidder and 1 or 0), _G.aux_ignore_owner and (aux.is_player(owner) and 0 or 1) or (owner or '?')}, ':'),
sniping_signature = table.concat({item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, _G.aux_ignore_owner and (aux.is_player(owner, true) and 0 or 1) or (owner or '?')}, ':'),
name = name,
texture = texture,
@@ -169,7 +169,7 @@ function public.bid_update(auction_record)
auction_record.unit_blizzard_bid = auction_record.blizzard_bid / auction_record.aux_quantity
auction_record.unit_bid_price = auction_record.bid_price / auction_record.aux_quantity
auction_record.high_bidder = 1
auction_record.search_signature = table.concat({auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, aux_ignore_owner and (aux.is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')}, ':')
auction_record.search_signature = table.concat({auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, _G.aux_ignore_owner and (aux.is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')}, ':')
end
function public.set_tooltip(itemstring, owner, anchor)
+1 -1
View File
@@ -34,7 +34,7 @@ function public.format(money, exact, color)
-- Round to nearest silver
money = floor(money / 100 + 0.5) * 100
end
local g, s, c = aux.money.gsc(money)
local g, s, c = m.gsc(money)
local str = ''
+3 -3
View File
@@ -1,6 +1,6 @@
aux.module 'persistence'
aux_datasets = {}
_G.aux_datasets = {}
do
local realm, faction
@@ -17,8 +17,8 @@ end
function public.load_dataset()
local dataset_key = m.get_dataset_key()
aux_datasets[dataset_key] = aux_datasets[dataset_key] or {}
return aux_datasets[dataset_key]
_G.aux_datasets[dataset_key] = _G.aux_datasets[dataset_key] or {}
return _G.aux_datasets[dataset_key]
end
function public.read(schema, str)