refactorings
This commit is contained in:
+10
-10
@@ -1,4 +1,4 @@
|
||||
local m, public, private = Aux.module'post'
|
||||
local m, public, private = aux.module'post'
|
||||
|
||||
private.state = nil
|
||||
|
||||
@@ -7,7 +7,7 @@ function private.process()
|
||||
|
||||
local stacking_complete
|
||||
|
||||
local c = Aux.control.await(function(slot)
|
||||
local c = aux.control.await(function(slot)
|
||||
if slot then
|
||||
return m.post_auction(slot, m.process)
|
||||
else
|
||||
@@ -15,15 +15,15 @@ function private.process()
|
||||
end
|
||||
end)
|
||||
|
||||
return Aux.stack.start(m.state.item_key, m.state.stack_size, c)
|
||||
return aux.stack.start(m.state.item_key, m.state.stack_size, c)
|
||||
end
|
||||
|
||||
return m.stop()
|
||||
end
|
||||
|
||||
function private.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 = 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
|
||||
|
||||
ClearCursor()
|
||||
ClickAuctionSellItemButton()
|
||||
@@ -32,15 +32,15 @@ function private.post_auction(slot, k)
|
||||
ClickAuctionSellItemButton()
|
||||
ClearCursor()
|
||||
|
||||
StartAuction(max(1, Aux.util.round(m.state.unit_start_price * item_info.aux_quantity)), Aux.util.round(m.state.unit_buyout_price * item_info.aux_quantity), m.state.duration)
|
||||
StartAuction(max(1, aux.util.round(m.state.unit_start_price * item_info.aux_quantity)), aux.util.round(m.state.unit_buyout_price * item_info.aux_quantity), m.state.duration)
|
||||
|
||||
local c = Aux.control.await(function()
|
||||
local c = aux.control.await(function()
|
||||
m.state.posted = m.state.posted + 1
|
||||
return k()
|
||||
end)
|
||||
|
||||
local posted
|
||||
Aux.control.event_listener('CHAT_MSG_SYSTEM', function(kill)
|
||||
aux.control.event_listener('CHAT_MSG_SYSTEM', function(kill)
|
||||
if arg1 == ERR_AUCTION_STARTED then
|
||||
c()
|
||||
kill()
|
||||
@@ -53,7 +53,7 @@ end
|
||||
|
||||
function public.stop()
|
||||
if m.state then
|
||||
Aux.control.kill_thread(m.state.thread_id)
|
||||
aux.control.kill_thread(m.state.thread_id)
|
||||
|
||||
local callback = m.state.callback
|
||||
local posted = m.state.posted
|
||||
@@ -69,7 +69,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 = aux.control.thread(m.process)
|
||||
|
||||
m.state = {
|
||||
thread_id = thread_id,
|
||||
|
||||
Reference in New Issue
Block a user