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)"
|
AuxAuthors = "shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)"
|
||||||
|
|
||||||
local lastRightClickAction = GetTime()
|
local lastRightClickAction = GetTime()
|
||||||
|
|||||||
@@ -2,44 +2,59 @@ Aux.post = {
|
|||||||
orig = {}
|
orig = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local controller = (function()
|
||||||
|
local controller
|
||||||
|
return function()
|
||||||
|
controller = controller or Aux.control.controller()
|
||||||
|
return controller
|
||||||
|
end
|
||||||
|
end)()
|
||||||
|
|
||||||
local state
|
local state
|
||||||
|
|
||||||
local post_auction
|
local post_auction, stop, process
|
||||||
|
|
||||||
local DELAY = 0.5
|
function process()
|
||||||
|
if state.posted < state.count then
|
||||||
local last_posted = GetTime()
|
local stacking_complete
|
||||||
|
local stack_slot
|
||||||
function Aux.post.onupdate()
|
|
||||||
if state then
|
Aux.stack.start(
|
||||||
if state.auctioning then
|
state.name,
|
||||||
if not GetContainerItemInfo(state.auctioning.bag, state.auctioning.bag_slot) then
|
state.stack_size,
|
||||||
state.auctioning = nil
|
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
|
state.posted = state.posted + 1
|
||||||
end
|
process()
|
||||||
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
|
|
||||||
else
|
else
|
||||||
Aux.post.stop()
|
stop()
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
stop()
|
||||||
end
|
end
|
||||||
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
|
if state then
|
||||||
local callback = state.callback
|
local callback = state.callback
|
||||||
local posted = state.posted
|
local posted = state.posted
|
||||||
@@ -52,7 +67,7 @@ function Aux.post.stop()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function post_auction(slot)
|
function post_auction(slot, k)
|
||||||
ClearCursor()
|
ClearCursor()
|
||||||
ClickAuctionSellItemButton()
|
ClickAuctionSellItemButton()
|
||||||
ClearCursor()
|
ClearCursor()
|
||||||
@@ -60,26 +75,28 @@ function post_auction(slot)
|
|||||||
ClickAuctionSellItemButton()
|
ClickAuctionSellItemButton()
|
||||||
ClearCursor()
|
ClearCursor()
|
||||||
StartAuction(state.bid, state.buyout, state.duration)
|
StartAuction(state.bid, state.buyout, state.duration)
|
||||||
state.auctioning = slot
|
controller().wait(function() return not GetContainerItemInfo(slot.bag, slot.bag_slot) end, k)
|
||||||
state.stacking = false
|
|
||||||
-- TODO CHAT_MSG_SYSTEM arg1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Aux.post.start(name, stack_size, duration, bid, buyout, count, callback)
|
function Aux.post.start(name, stack_size, duration, bid, buyout, count, callback)
|
||||||
Aux.post.stop()
|
Aux.control.on_next_update(function()
|
||||||
|
stop()
|
||||||
ClearCursor()
|
|
||||||
ClickAuctionSellItemButton()
|
ClearCursor()
|
||||||
ClearCursor()
|
ClickAuctionSellItemButton()
|
||||||
|
ClearCursor()
|
||||||
state = {
|
|
||||||
name = name,
|
state = {
|
||||||
stack_size = stack_size,
|
name = name,
|
||||||
duration = duration,
|
stack_size = stack_size,
|
||||||
bid = bid,
|
duration = duration,
|
||||||
buyout = buyout,
|
bid = bid,
|
||||||
count = count,
|
buyout = buyout,
|
||||||
posted = 0,
|
count = count,
|
||||||
callback = callback,
|
posted = 0,
|
||||||
}
|
callback = callback,
|
||||||
|
}
|
||||||
|
|
||||||
|
process()
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
@@ -1,11 +1,3 @@
|
|||||||
<Ui xsi:schemaLocation='http://www.blizzard.com/wow/ui/'>
|
<Ui xsi:schemaLocation='http://www.blizzard.com/wow/ui/'>
|
||||||
<Script file='post.lua'/>
|
<Script file='post.lua'/>
|
||||||
|
|
||||||
<Frame>
|
|
||||||
<Scripts>
|
|
||||||
<OnUpdate>
|
|
||||||
Aux.post.onupdate()
|
|
||||||
</OnUpdate>
|
|
||||||
</Scripts>
|
|
||||||
</Frame>
|
|
||||||
</Ui>
|
</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 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()
|
function inventory()
|
||||||
local inventory = {}
|
local inventory = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user