Moving items and unequipping gear not reliable
Hey,
so I implemented a banking feature in my addon. But it's not really reliable since sometimes there are 1 or 2 items that appear to be stuck. I added a 200ms delay between Item move requests. Is that too little or is my basic thought wrong? This is my function to move items which Im calling in a loop. Code:
function MoveItem(sourceBag, sourceSlot, destBag) Thanks for any help in advance :) |
Bank deposit/withdraw does not always take the same amount of time and just adding a delay wont help here as depening on where you are, what istance you are in, how many players are there, how buys the server is, the banking might take >200ms or less. And as it fails all following ones will fail as well!
Use a callback to EVENT_INVENTORY_SINGLE_SLOT_UPDATE to check if an item moved (it will fire with the bagId once the item will be removed from your BAG_BAGPACK e.g. and again with the bag=banking bag as it was deposited. And the slotIndex should be the same (hopefully!) as banked items do not stack automatically (afaik). Be sure to use event filters on EVENT_INVENTORY_SINGLE_SLOT_UPDATE to speed up the event usage, and maybe ONLY register the event after EVENT_BANK_OPEN fired so that it does not fire for any other items you loot or get to your inventory, but wuld fire for nothing then. And unregister after event_bank_closed (or similar) has fired. |
All times are GMT -6. The time now is 10:00 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI