Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reagent bag & add sorting bag #29947

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

Bloodtigress
Copy link
Contributor

@Bloodtigress Bloodtigress commented Apr 28, 2024

The bag cleanup order are :

  • hearthstone
  • Food and drink
  • Weapon
  • Armor
  • All other items
  • Grey (poor) quality items

Changes proposed:

  • Fix an issue (not logged) where a new looted bag go to the reagent bag instead of inventory if all bag slot are taken
  • Add cleanup item fonctionality for: backpack, bags, bank and reagent bank
  • Replace some 'magic number' in ItemHandler with enum value

Issues addressed:
#17564
Closes # (insert issue tracker number)
#17564

Tests performed:

  • Build OK
  • Tested ingame for all functionality

Known issues and TODO list: (add/remove lines as needed)

  • None that I know of

Fix an issue with the reagent bag
Add cleanup item functionnality
@Shauren
Copy link
Member

Shauren commented Apr 28, 2024

Sorting logic is a lot more complex than just those five classifications, then by entry (by the use of sorted map)
For example:

  • weapons and armor are additionally sorted by slot and itemlevel (descending)
  • junk (poor items) go to the end of last bag instead of directly following all other items
  • bags can be marked as "preferred" for a category of items during sorting (click on bag icon when its open)
  • bags can be marked as ignored for sorting

Auto equipping bag change is problematic, it causes these bags to be unable to be looted to backpack (in case all bag slots are full and the bags are filled)

@Bloodtigress
Copy link
Contributor Author

Here are my answers

  • I could do more complex logic. but I need to know what is the logic of the sorting. Right now, I don't know all the logic of the sorting. I remembered that the first item was always the hearthstone. After that I know it's the food/drink. After that comes the armors/weapons (I don't know which one comes first)

  • For the junk item I can change that

  • About the flag of bags, I can't do that right now because the code does nothing when it receives the change flag message (CMSG_CHANGE_BAG_SLOT_FLAG). I'd like to add the code to do taht (or at least try) but I need to know what is the message we need to send to the client. Once this is done then I think I could take into account the flag of each bag.

  • Finally about the auto equip I'm working on it. I think I know how to fix this. But I need to do some test first

If you have any information about the sorting order, let me know and I'll change the code

-Fix a bug no bags go to the backpack when all bags slot are taken
-The poor quality (grey) item now go the most left bag instead of right after all the other items
@Bloodtigress
Copy link
Contributor Author

Bloodtigress commented Apr 28, 2024

OK I've just push the modification of the code.
So the issue about the bag not going to the backpack is fixed
And now, the grey item will go the last bag instead of right after the other items

Once I know more about the sorting complexity, I'll change the way it works.

By the way I've seen some bugs about the reagent bag :

  • When you log out the bag in the reagent slot is empty and you receive the new bag in your mail box when you had a bag
  • You can't equip the reagent bag when you have one in your inventory

@Shauren
Copy link
Member

Shauren commented Apr 28, 2024

bag flags implemented - cc92417

@Bloodtigress
Copy link
Contributor Author

First of all thanks very much for the implementation of the bag flags system. With that I was able to take the bag flags into account!
I really wanted to use them so really thanks!
It took me a while to figure out how to use them because there was a strange behaviour with those flags.
When I remove a 'Priority' flag in the game, it seems to me that another one was added. I figure out it was because only one 'Priority' flag must be set at a time (it also causes issues with the game itself like displaying only one 'Priority' flags)

I fixed that (that's why there is a modification of the HandleChangeBagSlotFlag and HandleChangeBankBagSlotFlag in the itemHandler)

After that and some testing I didn't find any issue. But if you find any, let me know so that I can fix them.

About the last thing I need to do (the logic behind the sorting), I'll look for it later

@Bloodtigress
Copy link
Contributor Author

I update the code to add more complexity to the sorting code.
I try to make it more Blizzlike.
It works for most of the item. But unfortunately there are still some items that are quite weird.
For example:
If you have Core of Earth, Elemental Fire and Essence of Fire
Then in retail you have this order Core of Earth, Elemental Fire and Essence of Fire
But with what I've done you'll have Essence of Fire, Core of Earth and Elemental Fire

There is also an issue with some special item for example Cold Iron Pick

Anyway the way the sorting is done is :
1 - special items (hearthstone, etc.)
2 - Consummable
3 - Weapon order by Item level only in descending order (it seems to be the same way in retail)
4 - Armor order by armor type then item level in descending order
5 - All other item order by item class (ascending order) then subclass (descending order) then finally item Id (descending order)

@Shauren
Copy link
Member

Shauren commented May 12, 2024

Magic numbers (2c286b5) and reagent bag slot (6f9e359) were fixed, you can remove those from the PR

@Aokromes Aokromes reopened this May 16, 2024
Update to master Branch
Sync with master
@Bloodtigress
Copy link
Contributor Author

I've removed the magic number from my repo as well as the reagent bag slot fix.
I've also put the code about the storing of the item in the bag in the player files. I think it's better to put them there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants