some refactoring for post/stack

This commit is contained in:
Manuel Simon Hirsig
2016-02-20 07:22:48 +01:00
parent 9fe07b2520
commit e976d3da0d
3 changed files with 41 additions and 44 deletions
+26 -26
View File
@@ -49,31 +49,6 @@ function private.process()
end
end
function public.stop(k)
Aux.control.on_next_update(function()
private.stop()
if k then
return k()
end
end)
end
function private.stop()
controller().reset()
if state then
local callback = state.callback
local posted = state.posted
local partial_stack = state.partial_stack
state = nil
if callback then
callback(posted, partial_stack)
end
end
end
function private.post_auction(slot, k)
ClearCursor()
ClickAuctionSellItemButton()
@@ -88,8 +63,33 @@ function private.post_auction(slot, k)
end)
end
function private.stop()
controller().reset()
if state then
local callback = state.callback
local posted = state.posted
local partial_stack = state.partial_stack
state = nil
if callback then
callback(posted, partial_stack)
end
end
end
function public.stop(k)
controller().wait(function()
private.stop()
if k then
return k()
end
end)
end
function public.start(item_key, stack_size, duration, unit_start_price, unit_buyout_price, count, allow_partial, callback)
Aux.control.on_next_update(function()
controller().wait(function()
private.stop()
state = {