From 761f51b22fb526e28fdeaaa15582482f1b8a8cb9 Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Thu, 1 Oct 2015 03:09:22 +0200 Subject: [PATCH] stacking fix --- post.lua | 6 +++++- stack.lua | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/post.lua b/post.lua index 0953fb7..1251a75 100644 --- a/post.lua +++ b/post.lua @@ -6,6 +6,10 @@ local state local post_auction +local DELAY = 0.5 + +local last_posted = GetTime() + function Aux.post.onupdate() if state then if state.auctioning then @@ -21,7 +25,7 @@ function Aux.post.onupdate() state.name, state.stack_size, function(slot) - if slot then + if state and slot then post_auction(slot) else Aux.post.stop() diff --git a/stack.lua b/stack.lua index a4a6fb8..f3b0457 100644 --- a/stack.lua +++ b/stack.lua @@ -4,6 +4,8 @@ local state local last_move = GetTime() +local DELAY = 0 + local inventory, item_slots, find_empty_slot, locked, same_slot, move_item, item_name, stack_size -- returns iterator for inventory slots @@ -68,12 +70,18 @@ function move_item(from_slot, to_slot, amount) amount = min(max_stack(from_slot) - stack_size(to_slot), amount) - state.processing = 3 + if stack_size(to_slot) == 0 then + state.processing = 4 + else + state.processing = 3 + end + if CursorHasItem() then + state.processing = state.processing + 1 + ClearCursor() + end - ClearCursor() SplitContainerItem(from_slot.bag, from_slot.bag_slot, amount) PickupContainerItem(to_slot.bag, to_slot.bag_slot) - ClearCursor() end end @@ -103,7 +111,7 @@ function item_charges(slot) end function Aux.stack.onupdate() - if state and state.processing <= 0 and GetTime() - last_move > 0.3 then + if state and state.processing <= 0 and GetTime() - last_move > DELAY then local empty_slot = find_empty_slot() if empty_slot and stack_size(state.target_slot) > state.target_size then