Inventory Sorting
Hey,
would like to test the idea of sorting items in bag depending on vendor price. Any tips? I think I know a way to loop through inventory, but I do not know how to swap slots in bag. I'm a total newbie to XML/LUA/WoW, but can I for example put all items in a List and sort the list depending on Vendor price, before I put item out in the correct order? Item will swap order in bag while that is being done, so I don't know how that would work either Help or link to APIs that can be helpful is appreciated :) |
You might want to check out PickupContainerItem().
You'll have to apply the sort in multiple stages since the items will become "locked" once you attempt to swap them. The swapping itself doesn't actually occur until the server responds. When doing each pass, you can keep track which slots you've put into a locked state and work on the others simultaneously. This'll make the overall process quicker as waiting for the server to catch up can consume a lot of time. |
Quote:
|
Hello again!
I tried a lot of different things. I got some help from people on discord and this is my current result. It doesn't work 100%. I believe the issue is that slots ain't updated if they are moved, so they might try to move even if they are at the correct spot, or trade spot with a item that is at the correct spot. Example of issue: First Slot A updates: Slot A <-> Slot B Then its Slot B's turn Slot B <-> Slot A Any tips on how to sort this better to avoid this kind of behavior? - Couple other issues I haven't done much about: Currently its only for main bag. What if a item swap with another and they merge? Will that break something Code:
local AllItems = {} |
ITEM_LOCK_CHANGED fires when the lock state changes. BAG_UPDATE_DELAYED is what fires when items are added/deleted/moved in the bags.
|
Quote:
the swapping script is not working correctly thought and I'm not sure how I'm gonna fix this. Example: I have to click multiple times for items to get to the correct spot at times, and sometime it just won't help. I know why this happens, but I don't know how to get around it yet. Trying to think of ways to swap them around, but I'm so new to Lua/WoW it's hard to think of something Will update if I find a solution *UPDATE* This work as far as I can tell. Is it pretty? Not at all Tips to improve is appreciated. Code:
local AllItems = {} Everything works, but 1 issue is that if I have multiple of the same items it and calculcate total price of itemcount * sellprice, it doesn't care what stack the orders are in |
All times are GMT -6. The time now is 09:47 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI