(Let me know if I should post follow up questions in new threads)
Idea: Sorting System
Implementation:
I've written an algorithm that will sort items within the player's inventory in a way in which it'll maximize "open space" and keep similar items together. (Only the top 10x4 of the inventory for now. Plans for charms/stash in future iterations)
Problem:
Knowing where I want the items to be placed... depending on available/empty space... the only way to get the items into the correct locations (in the event the inventory is full or nearly full)... is a combination if picking up / putting down and a complicated use of item swapping (swapping the item in the inventory for the item held at the cursor). I am currently working on an algorithm that will determine how to accomplish this in as few steps as possible but even if I implement it perfectly, I feel like it's going to be awful with regard to performance / cleanliness / player perception.
Question:
Is there a way to basically take the items from the inventory, put them in the "void" temporarily... and then, one by one, place them where I want in the inventory? The "void" bit is the (mostly rhetorical) part I don't know about / how to do. Or somehow pickup all of the items at once, and put them down in the correct configuration all at once... Initial testing says no, but I've been testing via packets so far and I would naturally expect the game to reject a packet to pickup a second item as that doesn't make logical sense.