more refactoring
This commit is contained in:
@@ -195,12 +195,12 @@ function public.populate_wdb(item_id)
|
||||
item_id = item_id or MIN_ITEM_ID
|
||||
|
||||
if item_id > MAX_ITEM_ID then
|
||||
aux.log('Cache populated.')
|
||||
log('Cache populated.')
|
||||
return
|
||||
end
|
||||
|
||||
if not GetItemInfo('item:'..item_id) then
|
||||
aux.log('Fetching item '..item_id..'.')
|
||||
log('Fetching item '..item_id..'.')
|
||||
AuxTooltip:SetHyperlink('item:'..item_id)
|
||||
end
|
||||
|
||||
|
||||
+5
-5
@@ -27,14 +27,14 @@ do
|
||||
end
|
||||
end
|
||||
for _, state in aborted do
|
||||
aux.call(state.params.on_abort)
|
||||
call(state.params.on_abort)
|
||||
end
|
||||
end
|
||||
|
||||
function complete()
|
||||
local on_complete = state.params.on_complete
|
||||
scan_states[state.params.type] = nil
|
||||
aux.call(on_complete)
|
||||
call(on_complete)
|
||||
end
|
||||
|
||||
function accessor.state()
|
||||
@@ -81,7 +81,7 @@ end
|
||||
|
||||
function scan()
|
||||
state.query_index = state.query_index and state.query_index + 1 or 1
|
||||
if query and (aux.index(query.blizzard_query, 'first_page') or 0) <= (aux.index(query.blizzard_query, 'last_page') or aux.huge) then
|
||||
if query and (index(query.blizzard_query, 'first_page') or 0) <= (index(query.blizzard_query, 'last_page') or huge) then
|
||||
if query.blizzard_query then
|
||||
state.page = query.blizzard_query.first_page or 0
|
||||
else
|
||||
@@ -103,7 +103,7 @@ end
|
||||
|
||||
function submit_query()
|
||||
aux.control.when(function() return state.params.type ~= 'list' or CanSendAuctionQuery() end, function()
|
||||
aux.call(state.params.on_submit_query)
|
||||
call(state.params.on_submit_query)
|
||||
state.last_query_time = GetTime()
|
||||
if state.params.type == 'bidder' then
|
||||
GetBidderAuctionItems(state.page)
|
||||
@@ -153,7 +153,7 @@ function scan_page(i)
|
||||
|
||||
aux.history.process_auction(auction_info)
|
||||
|
||||
if aux.call(state.params.auto_buy_validator, auction_info) then
|
||||
if call(state.params.auto_buy_validator, auction_info) then
|
||||
local send_signal, signal_received = signal()
|
||||
aux.control.when(signal_received, recurse)
|
||||
aux.place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, aux.C(send_signal, true))
|
||||
|
||||
+19
-19
@@ -4,50 +4,50 @@ function SlashCmdList.AUX(command)
|
||||
local arguments = tokenize(command)
|
||||
if arguments[1] == 'clear' and arguments[2] == 'history' then
|
||||
aux.persistence.load_dataset().history = nil
|
||||
aux.log 'History cleared.'
|
||||
log 'History cleared.'
|
||||
elseif arguments[1] == 'clear' and arguments[2] == 'post' then
|
||||
aux.persistence.load_dataset().post = nil
|
||||
aux.log 'Post settings cleared.'
|
||||
log 'Post settings cleared.'
|
||||
elseif arguments[1] == 'clear' and arguments[2] == 'datasets' then
|
||||
g.aux_datasets = {}
|
||||
aux.log 'Datasets cleared.'
|
||||
log 'Datasets cleared.'
|
||||
elseif arguments[1] == 'clear' and arguments[2] == 'merchant' and arguments[3] == 'buy' then
|
||||
g.aux_merchant_buy = {}
|
||||
aux.log 'Merchant buy prices cleared.'
|
||||
log 'Merchant buy prices cleared.'
|
||||
elseif arguments[1] == 'clear' and arguments[2] == 'merchant' and arguments[3] == 'sell' then
|
||||
g.aux_merchant_sell = {}
|
||||
aux.log 'Merchant sell prices cleared.'
|
||||
log 'Merchant sell prices cleared.'
|
||||
elseif arguments[1] == 'clear' and arguments[2] == 'item' and arguments[3] == 'cache' then
|
||||
g.aux_items = {}
|
||||
g.aux_item_ids = {}
|
||||
g.aux_auctionable_items = {}
|
||||
aux.log 'Item cache cleared.'
|
||||
log 'Item cache cleared.'
|
||||
elseif arguments[1] == 'populate' and arguments[2] == 'wdb' then
|
||||
aux.cache.populate_wdb()
|
||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'value' then
|
||||
g.aux_tooltip_value = not g.aux_tooltip_value
|
||||
aux.log('Historical value in tooltip '..(g.aux_tooltip_value and 'enabled' or 'disabled')..'.')
|
||||
log('Historical value in tooltip '..(g.aux_tooltip_value and 'enabled' or 'disabled')..'.')
|
||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'daily' then
|
||||
g.aux_tooltip_daily = not g.aux_tooltip_daily
|
||||
aux.log('Market value in tooltip '..(g.aux_tooltip_daily and 'enabled' or 'disabled')..'.')
|
||||
log('Market value in tooltip '..(g.aux_tooltip_daily and 'enabled' or 'disabled')..'.')
|
||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'vendor' and arguments[3] == 'buy' then
|
||||
g.aux_tooltip_vendor_buy = not g.aux_tooltip_vendor_buy
|
||||
aux.log('Vendor buy price in tooltip '..(g.aux_tooltip_vendor_buy and 'enabled' or 'disabled')..'.')
|
||||
log('Vendor buy price in tooltip '..(g.aux_tooltip_vendor_buy and 'enabled' or 'disabled')..'.')
|
||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'vendor' and arguments[3] == 'sell' then
|
||||
g.aux_tooltip_vendor_sell = not g.aux_tooltip_vendor_sell
|
||||
aux.log('Vendor sell price in tooltip '..(g.aux_tooltip_vendor_sell and 'enabled' or 'disabled')..'.')
|
||||
log('Vendor sell price in tooltip '..(g.aux_tooltip_vendor_sell and 'enabled' or 'disabled')..'.')
|
||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'value' then
|
||||
g.aux_tooltip_disenchant_value = not g.aux_tooltip_disenchant_value
|
||||
aux.log('Disenchant value in tooltip '..(g.aux_tooltip_disenchant_value and 'enabled' or 'disabled')..'.')
|
||||
log('Disenchant value in tooltip '..(g.aux_tooltip_disenchant_value and 'enabled' or 'disabled')..'.')
|
||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'distribution' then
|
||||
g.aux_tooltip_disenchant_distribution = not g.aux_tooltip_disenchant_distribution
|
||||
aux.log('Disenchant distribution in tooltip '..(g.aux_tooltip_disenchant_distribution and 'enabled' or 'disabled')..'.')
|
||||
log('Disenchant distribution in tooltip '..(g.aux_tooltip_disenchant_distribution and 'enabled' or 'disabled')..'.')
|
||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'source' then
|
||||
g.aux_tooltip_disenchant_source = not g.aux_tooltip_disenchant_source
|
||||
aux.log('Disenchant source in tooltip '..(g.aux_tooltip_disenchant_source and 'enabled' or 'disabled')..'.')
|
||||
log('Disenchant source in tooltip '..(g.aux_tooltip_disenchant_source and 'enabled' or 'disabled')..'.')
|
||||
elseif arguments[1] == 'ignore' and arguments[2] == 'owner' then
|
||||
g.aux_ignore_owner = not g.aux_ignore_owner
|
||||
aux.log('Ignoring of owner '..(g.aux_ignore_owner and 'enabled' or 'disabled')..'.')
|
||||
log('Ignoring of owner '..(g.aux_ignore_owner and 'enabled' or 'disabled')..'.')
|
||||
elseif arguments[1] == 'chars' and arguments[2] == 'add' then
|
||||
local realm = GetCVar 'realmName'
|
||||
g.aux_characters[realm] = g.aux_characters[realm] or {}
|
||||
@@ -55,7 +55,7 @@ function SlashCmdList.AUX(command)
|
||||
local name = string.gsub(strlower(arguments[i]), '^%l', strupper)
|
||||
if not g.aux_characters[realm][name] then
|
||||
g.aux_characters[realm][name] = true
|
||||
aux.log('Character "'..name..'" added.')
|
||||
log('Character "'..name..'" added.')
|
||||
end
|
||||
end
|
||||
elseif arguments[1] == 'chars' and arguments[2] == 'remove' then
|
||||
@@ -67,7 +67,7 @@ function SlashCmdList.AUX(command)
|
||||
local name = string.gsub(strlower(arguments[i]), '^%l', strupper)
|
||||
if g.aux_characters[realm][name] then
|
||||
g.aux_characters[realm][name] = nil
|
||||
aux.log('Character "'..name..'" removed.')
|
||||
log('Character "'..name..'" removed.')
|
||||
end
|
||||
end
|
||||
elseif arguments[1] == 'chars' then
|
||||
@@ -77,11 +77,11 @@ function SlashCmdList.AUX(command)
|
||||
tinsert(chars, name)
|
||||
end
|
||||
if getn(chars) > 0 then
|
||||
aux.log('Your characters: "'..table.concat(chars, ', ')..'".')
|
||||
log('Your characters: "'..table.concat(chars, ', ')..'".')
|
||||
else
|
||||
aux.log 'You don\'t have any additional characters. To add your characters type "/aux chars add NAME1 NAME2 NAME3...".'
|
||||
log 'You don\'t have any additional characters. To add your characters type "/aux chars add NAME1 NAME2 NAME3...".'
|
||||
end
|
||||
else
|
||||
aux.log('Unknown command: "'..command..'"')
|
||||
log('Unknown command: "'..command..'"')
|
||||
end
|
||||
end
|
||||
@@ -111,7 +111,7 @@ function public.stop()
|
||||
slot = nil
|
||||
end
|
||||
m.state = nil
|
||||
aux.call(callback, slot)
|
||||
call(callback, slot)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user