some refactoring for post/stack
This commit is contained in:
@@ -49,13 +49,17 @@ function private.process()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.stop(k)
|
function private.post_auction(slot, k)
|
||||||
Aux.control.on_next_update(function()
|
ClearCursor()
|
||||||
private.stop()
|
ClickAuctionSellItemButton()
|
||||||
|
ClearCursor()
|
||||||
if k then
|
PickupContainerItem(slot.bag, slot.bag_slot)
|
||||||
return k()
|
ClickAuctionSellItemButton()
|
||||||
end
|
ClearCursor()
|
||||||
|
local stack_size = Aux.info.container_item(slot.bag, slot.bag_slot).aux_quantity
|
||||||
|
StartAuction(max(1, Aux.round(state.unit_start_price * stack_size)), Aux.round(state.unit_buyout_price * stack_size), state.duration)
|
||||||
|
controller().wait(function() return not GetContainerItemInfo(slot.bag, slot.bag_slot) end, function()
|
||||||
|
return k(stack_size)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -74,22 +78,18 @@ function private.stop()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function private.post_auction(slot, k)
|
function public.stop(k)
|
||||||
ClearCursor()
|
controller().wait(function()
|
||||||
ClickAuctionSellItemButton()
|
private.stop()
|
||||||
ClearCursor()
|
|
||||||
PickupContainerItem(slot.bag, slot.bag_slot)
|
if k then
|
||||||
ClickAuctionSellItemButton()
|
return k()
|
||||||
ClearCursor()
|
end
|
||||||
local stack_size = Aux.info.container_item(slot.bag, slot.bag_slot).aux_quantity
|
|
||||||
StartAuction(max(1, Aux.round(state.unit_start_price * stack_size)), Aux.round(state.unit_buyout_price * stack_size), state.duration)
|
|
||||||
controller().wait(function() return not GetContainerItemInfo(slot.bag, slot.bag_slot) end, function()
|
|
||||||
return k(stack_size)
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.start(item_key, stack_size, duration, unit_start_price, unit_buyout_price, count, allow_partial, callback)
|
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()
|
private.stop()
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ end)()
|
|||||||
|
|
||||||
local state
|
local state
|
||||||
|
|
||||||
local scan_auctions, scan_auctions_helper, submit_query, wait_for_callback, wait_for_results, wait_for_owner_data, on_abort, current_query
|
local scan_auctions, scan_auctions_helper, submit_query, wait_for_callback, wait_for_results, wait_for_owner_data, abort, current_query
|
||||||
|
|
||||||
function private.default_next_page(page, total_pages)
|
function private.default_next_page(page, total_pages)
|
||||||
local last_page = max(total_pages - 1, 0)
|
local last_page = max(total_pages - 1, 0)
|
||||||
@@ -28,7 +28,7 @@ end
|
|||||||
|
|
||||||
function public.start(params)
|
function public.start(params)
|
||||||
return controller().wait(function() return true end, function()
|
return controller().wait(function() return true end, function()
|
||||||
on_abort()
|
abort()
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
params = params,
|
params = params,
|
||||||
@@ -40,9 +40,7 @@ end
|
|||||||
|
|
||||||
function public.abort(k)
|
function public.abort(k)
|
||||||
return controller().wait(function() return true end, function()
|
return controller().wait(function() return true end, function()
|
||||||
on_abort()
|
abort()
|
||||||
|
|
||||||
state = nil
|
|
||||||
|
|
||||||
if k then
|
if k then
|
||||||
return k()
|
return k()
|
||||||
@@ -50,7 +48,7 @@ function public.abort(k)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_abort()
|
function abort()
|
||||||
local on_abort = Aux.util.safe_index{state, 'params', 'on_abort' }
|
local on_abort = Aux.util.safe_index{state, 'params', 'on_abort' }
|
||||||
state = nil
|
state = nil
|
||||||
if on_abort then
|
if on_abort then
|
||||||
|
|||||||
@@ -112,20 +112,9 @@ function private.max_stack(slot)
|
|||||||
return container_item_info and container_item_info.max_stack
|
return container_item_info and container_item_info.max_stack
|
||||||
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()
|
function private.stop()
|
||||||
controller().reset()
|
controller().reset()
|
||||||
if state then
|
if state then
|
||||||
|
|
||||||
local callback, slot = state.callback, state.target_slot
|
local callback, slot = state.callback, state.target_slot
|
||||||
|
|
||||||
state = nil
|
state = nil
|
||||||
@@ -136,8 +125,18 @@ function private.stop()
|
|||||||
end
|
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, size, callback)
|
function public.start(item_key, size, callback)
|
||||||
Aux.control.on_next_update(function()
|
controller().wait(function()
|
||||||
private.stop()
|
private.stop()
|
||||||
|
|
||||||
local slots = private.item_slots(item_key)
|
local slots = private.item_slots(item_key)
|
||||||
|
|||||||
Reference in New Issue
Block a user