Duplication Glitch Due to UI Item Initialization Error on Player Login
I've encountered a bug related to the initialization of UiItem data when a player logs into the game. Specifically, the issue arises when the combined total of an item in the UiItem and the corresponding slot in the inventory exceeds the stack limit upon player login. The method FillingContainer::add is expected to handle adding items to the player's inventory, but it returns false when the total exceeds the stack limit. This behavior is anticipated as part of its functionality to prevent overfilling.
However, the problem occurs in the subsequent handling of this return value. When FillingContainer::add returns false, the Player::readAdditionalSaveData method interprets this as a failure to add the item to the inventory. As a result, it attempts to reset the quantity of the UiItem, presumably to correct what it perceives as an unsuccessful item addition. Unfortunately, since FillingContainer::add has already added the items to the inventory (up to the maximum stack size), this "correction" inadvertently duplicates items. The player ends up with the items both in their inventory (added by FillingContainer::add) and in the UiItem, which Player::readAdditionalSaveData tries to restore due to the perceived failure.
This duplication glitch can potentially be exploited to create unlimited items, significantly impacting gameplay balance and economy.
Steps to Reproduce:
Ensure the player's inventory contains items that, when combined with a specific UiItem upon login, will exceed the stack limit.
Log out of the game.
Log back into the game.
Observe that the items have been duplicated, with the player receiving the excess items that should have been rejected by FillingContainer::add.
Expected Behavior:
The game should correctly handle the scenario where adding items to the inventory would exceed the stack limit, without resulting in item duplication. Ideally, FillingContainer::add should add items up to the maximum stack size, and any excess should either be dropped or handled in a manner that does not result in duplication.
Actual Behavior:
The game duplicates items when FillingContainer::add returns false due to the total item count exceeding the stack limit, due to a misinterpretation of this return value by Player::readAdditionalSaveData.
2024-04-04, 02:18 PM
2024-11-20, 10:56 PM
0
3
1239534
-