big refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-21 06:17:53 +02:00
parent e94eaac52c
commit 40753f2ac5
31 changed files with 709 additions and 742 deletions
+8 -8
View File
@@ -8,7 +8,7 @@ function process()
local stacking_complete
local send_signal, signal_received = signal()
aux.control.when(signal_received, function()
control.when(signal_received, function()
local slot = signal_received()[1]
if slot then
return m.post_auction(slot, m.process)
@@ -17,15 +17,15 @@ function process()
end
end)
return aux.stack.start(m.state.item_key, m.state.stack_size, send_signal)
return stack.start(m.state.item_key, m.state.stack_size, send_signal)
end
return m.stop()
end
function post_auction(slot, k)
local item_info = aux.info.container_item(unpack(slot))
if item_info.item_key == m.state.item_key and aux.info.auctionable(item_info.tooltip) and item_info.aux_quantity == m.state.stack_size then
local item_info = info.container_item(unpack(slot))
if item_info.item_key == m.state.item_key and info.auctionable(item_info.tooltip) and item_info.aux_quantity == m.state.stack_size then
ClearCursor()
ClickAuctionSellItemButton()
@@ -37,13 +37,13 @@ function post_auction(slot, k)
StartAuction(max(1, round(m.state.unit_start_price * item_info.aux_quantity)), round(m.state.unit_buyout_price * item_info.aux_quantity), m.state.duration)
local send_signal, signal_received = signal()
aux.control.when(signal_received, function()
control.when(signal_received, function()
m.state.posted = m.state.posted + 1
return k()
end)
local posted
aux.control.event_listener('CHAT_MSG_SYSTEM', function(kill)
control.event_listener('CHAT_MSG_SYSTEM', function(kill)
if arg1 == ERR_AUCTION_STARTED then
send_signal()
kill()
@@ -56,7 +56,7 @@ end
function public.stop()
if m.state then
aux.control.kill_thread(m.state.thread_id)
control.kill_thread(m.state.thread_id)
local callback = m.state.callback
local posted = m.state.posted
@@ -72,7 +72,7 @@ end
function public.start(item_key, stack_size, duration, unit_start_price, unit_buyout_price, count, callback)
m.stop()
local thread_id = aux.control.thread(m.process)
local thread_id = control.thread(m.process)
m.state = {
thread_id = thread_id,