diff --git a/core.lua b/core.lua
index 3cf5b3e..51ed742 100644
--- a/core.lua
+++ b/core.lua
@@ -1,4 +1,4 @@
-AuxVersion = "1.4.2"
+AuxVersion = "1.4.3"
AuxAuthors = "shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)"
local lastRightClickAction = GetTime()
diff --git a/post.lua b/post.lua
index 368a5b2..c7fe8f0 100644
--- a/post.lua
+++ b/post.lua
@@ -2,44 +2,59 @@ Aux.post = {
orig = {}
}
+local controller = (function()
+ local controller
+ return function()
+ controller = controller or Aux.control.controller()
+ return controller
+ end
+end)()
+
local state
-local post_auction
+local post_auction, stop, process
-local DELAY = 0.5
-
-local last_posted = GetTime()
-
-function Aux.post.onupdate()
- if state then
- if state.auctioning then
- if not GetContainerItemInfo(state.auctioning.bag, state.auctioning.bag_slot) then
- state.auctioning = nil
+function process()
+ if state.posted < state.count then
+ local stacking_complete
+ local stack_slot
+
+ Aux.stack.start(
+ state.name,
+ state.stack_size,
+ function(slot)
+ stacking_complete = true
+ stack_slot = slot
+ end
+ )
+
+ controller().wait(function() return stacking_complete end, function()
+ if stack_slot then
+ post_auction(stack_slot, function()
state.posted = state.posted + 1
- end
- end
- if state.posted < state.count then
- if not state.stacking and not state.auctioning then
- state.stacking = true
- Aux.stack.start(
- state.name,
- state.stack_size,
- function(slot)
- if state and slot then
- post_auction(slot)
- else
- Aux.post.stop()
- end
- end
- )
- end
+ process()
+ end)
else
- Aux.post.stop()
+ stop()
end
+ end)
+ else
+ stop()
end
end
-function Aux.post.stop()
+function Aux.post.stop(k)
+ Aux.control.on_next_update(function()
+ stop()
+
+ if k then
+ return k()
+ end
+ end)
+end
+
+function stop()
+ controller().reset()
if state then
local callback = state.callback
local posted = state.posted
@@ -52,7 +67,7 @@ function Aux.post.stop()
end
end
-function post_auction(slot)
+function post_auction(slot, k)
ClearCursor()
ClickAuctionSellItemButton()
ClearCursor()
@@ -60,26 +75,28 @@ function post_auction(slot)
ClickAuctionSellItemButton()
ClearCursor()
StartAuction(state.bid, state.buyout, state.duration)
- state.auctioning = slot
- state.stacking = false
- -- TODO CHAT_MSG_SYSTEM arg1
+ controller().wait(function() return not GetContainerItemInfo(slot.bag, slot.bag_slot) end, k)
end
function Aux.post.start(name, stack_size, duration, bid, buyout, count, callback)
- Aux.post.stop()
-
- ClearCursor()
- ClickAuctionSellItemButton()
- ClearCursor()
-
- state = {
- name = name,
- stack_size = stack_size,
- duration = duration,
- bid = bid,
- buyout = buyout,
- count = count,
- posted = 0,
- callback = callback,
- }
+ Aux.control.on_next_update(function()
+ stop()
+
+ ClearCursor()
+ ClickAuctionSellItemButton()
+ ClearCursor()
+
+ state = {
+ name = name,
+ stack_size = stack_size,
+ duration = duration,
+ bid = bid,
+ buyout = buyout,
+ count = count,
+ posted = 0,
+ callback = callback,
+ }
+
+ process()
+ end)
end
\ No newline at end of file
diff --git a/post.xml b/post.xml
index 1bbdaa3..4dce3eb 100644
--- a/post.xml
+++ b/post.xml
@@ -1,11 +1,3 @@
-
-
-
-
- Aux.post.onupdate()
-
-
-
\ No newline at end of file
diff --git a/scan.xml b/scan.xml
deleted file mode 100644
index 17cb2d5..0000000
--- a/scan.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/stack.lua b/stack.lua
index 0f54c46..3c649c3 100644
--- a/stack.lua
+++ b/stack.lua
@@ -10,7 +10,7 @@ end)()
local state
-local inventory, item_slots, find_empty_slot, locked, same_slot, move_item, item_name, stack_size, stop
+local inventory, item_slots, find_empty_slot, locked, same_slot, move_item, item_name, stack_size, stop, process
function inventory()
local inventory = {}
diff --git a/stack.xml b/stack.xml
deleted file mode 100644
index 689ee88..0000000
--- a/stack.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file