Bagnon

Bagnon

122M Downloads

Sorting is slow for duplicate items

Nezz opened this issue · 2 comments

commented

Running Software (issues missing this information will be deleted):

  • Addon version: 8.2.16 (tried 8.2.19 beta too, but the clean functionality was broken because it tried to put items in my keyring).
  • Server patch: Build 1.13.3.32836

Have you read the changelog? (please don't waste our time)

Describe the bug
When using the "clean items" functionality, sorting is suboptimal and slow for items you have multiple of. For example all Soul Shards are moved one by one instead of only moving a single Soul Shard.

To Reproduce
Steps to reproduce the behaviour:

  1. Have multiple similar items in your bag. Can be anything like a Soul Shard or Runecloth.
  2. Move the first of the similar items to the bottom of the bag.
  3. Click on 'Clean items'
  4. Watch each item getting moved one by one down by one slot.

Expected behaviour
The last item moved should be moved to the first slot to fill the gap.

Screenshots
Here's a video that shows the issue with two kinds of items: https://giphy.com/gifs/fvfe9eXtf2P1PWEA7j

Error Logs
No errors.

Additional context
It's mainly bothersome for warlocks as soul shards are consumed from the first slot and new ones are placed in the last slow available. However, you can run into the issue with any gathering profession.

commented

I have the same problem. When it's an item that can be placed in a specific bag and there is more than what can fit in the bag (typically an overflowing soul-bag for warlocks or arrow bag for hunters) it takes longer and moves everything everywhere. See video: https://media.giphy.com/media/WTKzseVv7BIl7xrIv0/giphy.gif

I'm trying to do something about it and might try a pull request.

commented

So I think I have a fix: https://media.giphy.com/media/QYXxVYp9KQ5w4Toi6v/giphy.gif

I implemented a distance in order to choose the best item to move:

  local item_distance = function(item, goal)
    return math.abs(item.bag - goal.bag) + math.abs(item.slot - goal.slot)
  end

Sometimes it takes two/threes moves because the distance is not perfect, but I think it's good enough as it is. It makes the sort faster in all cases (because it was one by one before). Now that I think of it the distance would be better if it took the position in bagnon monobag into account. Or at least more weight on bag distance than slot distance.

The thing though, is I worked on Combuctor code and I don't see common/api/sorting.lua in Bagnon git repository, so I have a hard time making a pull request.

Could you help me with this @Jaliborc?