This commit is contained in:
Manuel Simon Hirsig
2016-08-04 01:32:35 +02:00
parent 9da474c616
commit df5724a264
5 changed files with 35 additions and 50 deletions
+2 -2
View File
@@ -40,10 +40,10 @@ function private.post_auction(slot, k)
end)
local posted
Aux.control.event_listener('CHAT_MSG_SYSTEM', function()
Aux.control.event_listener('CHAT_MSG_SYSTEM', function(kill)
if arg1 == ERR_AUCTION_STARTED then
c()
Aux.control.kill()
kill()
end
end)
else
+3 -3
View File
@@ -8,7 +8,7 @@ do
local scan_states = {}
function public.start(params)
for old_state in {scan_states[params.type]} do
for _, old_state in {scan_states[params.type]} do
m.abort(old_state.id)
end
local thread_id = Aux.control.thread(Aux.f(m.wait_for_callback, params.on_scan_start, m.scan))
@@ -215,8 +215,8 @@ end
function private.wait_for_list_results(c)
local updated, last_update
Aux.control.event_listener('AUCTION_ITEM_LIST_UPDATE', function()
Aux.control.kill(-c)
Aux.control.event_listener('AUCTION_ITEM_LIST_UPDATE', function(kill)
kill(-c)
last_update = GetTime()
updated = true
end)
+1 -10
View File
@@ -52,7 +52,6 @@ function private.find_charge_item_slot()
end
function private.move_item(from_slot, to_slot, amount, k)
if m.locked(from_slot) or m.locked(to_slot) then
return Aux.control.wait(k)
end
@@ -80,7 +79,6 @@ function private.process()
m.state.target_slot = m.find_charge_item_slot()
return m.stop()
end
if m.stack_size(m.state.target_slot) > m.state.target_size then
local slot = m.find_item_slot(true) or m.find_empty_slot()
if slot then
@@ -102,24 +100,18 @@ function private.process()
)
end
end
return m.stop()
end
function public.stop()
if m.state then
Aux.control.kill_thread(m.state.thread_id)
local callback, slot = m.state.callback, m.state.target_slot
if slot and not m.matching_item(slot) then
slot = nil
end
m.state = nil
if callback then
callback(slot)
end
Aux.safe_call(callback, slot)
end
end
@@ -127,7 +119,6 @@ function public.start(item_key, size, callback)
m.stop()
local thread_id = Aux.control.thread(m.process)
m.state = {
thread_id = thread_id,
item_key = item_key,