some refactorings
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
AuxVersion = "1.4.2"
|
||||
AuxVersion = "1.4.3"
|
||||
AuxAuthors = "shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)"
|
||||
|
||||
local lastRightClickAction = GetTime()
|
||||
|
||||
@@ -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
|
||||
@@ -1,11 +1,3 @@
|
||||
<Ui xsi:schemaLocation='http://www.blizzard.com/wow/ui/'>
|
||||
<Script file='post.lua'/>
|
||||
|
||||
<Frame>
|
||||
<Scripts>
|
||||
<OnUpdate>
|
||||
Aux.post.onupdate()
|
||||
</OnUpdate>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
</Ui>
|
||||
@@ -1,5 +0,0 @@
|
||||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
||||
|
||||
<Script file="scan.lua"/>
|
||||
|
||||
</Ui>
|
||||
@@ -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 = {}
|
||||
|
||||
Reference in New Issue
Block a user