Mercurial > wow > inventory
diff Modules/Mover.lua @ 88:f1c035694545
Now trying to continue moving item 0.5 seconds after the last ITEM_LOCK_CHANGED-event, rather than 1 second after BAG_UPDATE.
Skipping items which are tagged locked by the client while not tagged as locked in our addon.
author | Zerotorescue |
---|---|
date | Fri, 07 Jan 2011 10:34:38 +0100 |
parents | 3bec0ea44607 |
children | a12d22ef3f39 |
line wrap: on
line diff
--- a/Modules/Mover.lua Thu Jan 06 20:25:35 2011 +0100 +++ b/Modules/Mover.lua Fri Jan 07 10:34:38 2011 +0100 @@ -267,7 +267,8 @@ return; end - self:RegisterEvent("BAG_UPDATE"); + --self:RegisterEvent("BAG_UPDATE"); + self:RegisterEvent("ITEM_LOCK_CHANGED"); self:RegisterEvent("UI_ERROR_MESSAGE"); -- combinedMoves now has all moves in it (source -> target) @@ -288,9 +289,11 @@ while numCurrentMove ~= 0 do local move = combinedMoves[numCurrentMove]; + local isSourceLocked = ((sourceLocationsLocked[move.sourceContainer] and sourceLocationsLocked[move.sourceContainer][move.sourceSlot]) or select(3, GetContainerItemInfo(move.sourceContainer, move.sourceSlot))); + local isTargetLocked = ((targetLocationsLocked[move.targetContainer] or targetLocationsLocked[move.targetContainer][move.targetSlot]) or select(3, GetContainerItemInfo(move.targetContainer, move.targetSlot))); + -- sourceContainer, sourceSlot, targetContainer, targetSlot, itemId, num - if move and (not sourceLocationsLocked[move.sourceContainer] or not sourceLocationsLocked[move.sourceContainer][move.sourceSlot]) and - (not targetLocationsLocked[move.targetContainer] or not targetLocationsLocked[move.targetContainer][move.targetSlot]) then + if move and isSourceLocked and isTargetLocked then print(("Moving %dx%s."):format(move.num, IdToItemLink(move.itemId))); @@ -355,9 +358,9 @@ end local tmrProcessNext; -function mod:BAG_UPDATE() +function mod:ITEM_LOCK_CHANGED() self:CancelTimer(tmrProcessNext, true); -- silent - tmrProcessNext = self:ScheduleTimer("ProcessMove", 1); + tmrProcessNext = self:ScheduleTimer("ProcessMove", 0.5); end function IdToItemLink(itemId)