Skip to content

Bag and Ring Handle Patch#99

Closed
shot1330 wants to merge 3 commits intoBujuArena:masterfrom
shot1330:patch-5
Closed

Bag and Ring Handle Patch#99
shot1330 wants to merge 3 commits intoBujuArena:masterfrom
shot1330:patch-5

Conversation

@shot1330
Copy link
Contributor

Currently, AutoGear has an issue when comparing ring-slot scores: it fails to replace the lower-scored ring with a higher-scored ring after evaluating both equipped rings. I modified it so that it checks both equipped rings and replaces the lower-scored one if the new ring is better.

Additionally, there is a problem with bag scoring. The current bag score is calculated as the total number of slots across all equipped bags excluding the default backpack (for example, if four 6-slot bags are equipped, the bag score is treated as 24). Because of this, if an 18-slot bag exists in the inventory, AutoGear may incorrectly decide that no replacement is needed and do nothing, even though bag upgrades should be evaluated per bag slot.

There is also another issue: even when a replacement is possible, if the larger bag to equip is located inside the smaller bag that is supposed to be replaced, AutoGear still attempts that replacement, which makes the equip attempt meaningless. (In WoW, a bag cannot be equipped into the same bag slot if that bag is currently inside the bag being replaced.)

Currently, AutoGear has an issue when comparing ring-slot scores: it fails to replace the lower-scored ring with a higher-scored ring after evaluating both equipped rings. I modified it so that it checks both equipped rings and replaces the lower-scored one if the new ring is better.

Additionally, there is a problem with bag scoring. The current bag score is calculated as the total number of slots across all equipped bags excluding the default backpack (for example, if four 6-slot bags are equipped, the bag score is treated as 24). Because of this, if an 18-slot bag exists in the inventory, AutoGear may incorrectly decide that no replacement is needed and do nothing, even though bag upgrades should be evaluated per bag slot.

There is also another issue: even when a replacement is possible, if the larger bag to equip is located inside the smaller bag that is supposed to be replaced, AutoGear still attempts that replacement, which makes the equip attempt meaningless. (In WoW, a bag cannot be equipped into the same bag slot if that bag is currently inside the bag being replaced.)
@shot1330
Copy link
Contributor Author

In the case of bags, when this situation occurs, I made it call Blizzard’s Auto Sort to move the replacement bag into the default backpack, so it can be replaced naturally during the next scan process.

Added debug functions for logging item information and optimized paired slot handling.
Removed debug print statements to clean up code.
@BujuArena
Copy link
Owner

BujuArena commented Feb 26, 2026

Where do you see the logic of bag scoring being a total number of slots across all equipped bags? I don't think that's right and my testing confirms it: AutoGear already replaces the lowest-scoring bag accurately, and when I dump AutoGearBestItems and see the bag slots, each one has its own score accurately. I have never seen the issue you're talking about.

There's 1 valid part of this pull request, and that's a way to avoid the equipping issue at equip time. However, I don't like the brute-force solution of running Blizzard's full bag-sort functions repeatedly. It would be preferable if the bag to be equipped was surgically moved into another bag's first empty slot and then equipped from there without rearranging all the player's items without warning.

@shot1330
Copy link
Contributor Author

You’re right — after re-checking the original file, my earlier claim about “total bag score across all equipped bags” was incorrect.

I reviewed the candidate logic again, and bag replacement is indeed handled per slot (lowest-scoring valid bag slot), not by summing all equipped bag scores. So that part of my PR rationale was wrong.

The real issue I was hitting is at equip time: when the replacement bag is located inside the bag being replaced, the direct PickupContainerItem + EquipCursorItem path can fail. My current patch used bag sort retries as a workaround, but I agree that this is too brute-force.

Thanks for the correction.

@BujuArena
Copy link
Owner

I implemented the surgical fix for this myself, so I'm closing this. Thanks for inspiring me to work on it.

@BujuArena BujuArena closed this Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants