#7345 [CORE] - Items Placed in Bags Don't Always Stack
Adul
Member Posts: 2,002
Sometimes, when placing items in bags (for example lynx stones in gem bags), items of the same type won't stack up.
E.g. you place 2 potions of healing into a bag of holding, then put a leather armor in the same bag, and then put 7 healing potions in it also. Sometimes, when you open up the bag, you will not find a stack of 9 healing potions and a leather armor as expected, but instead a stack of 2 healing potions, a leather armor, and another stack of 7 healing potions.
This issue is not always reproducible - it seems quite random, but it does occur fairly often if you use bags regularly.
E.g. you place 2 potions of healing into a bag of holding, then put a leather armor in the same bag, and then put 7 healing potions in it also. Sometimes, when you open up the bag, you will not find a stack of 9 healing potions and a leather armor as expected, but instead a stack of 2 healing potions, a leather armor, and another stack of 7 healing potions.
This issue is not always reproducible - it seems quite random, but it does occur fairly often if you use bags regularly.
Post edited by Troodon80 on
0
Comments
Proper stores, when they acquire a new item, strip whatever flags the item has; the byte is set to "01" (the identified property turned on, the other two off).
Containers do NOT change this flag/byte. Thus, when you put two potions in a container, one with the "01" flag (identified) and another with the "03" flag (identified and unstealable), the container treats them as different items with different stacks in order to preserve the different flag values.
This is important for containers so that they are capable of carrying two identical items where one is identified and the other one is not.
The solution would have to be hardcoded; containers would have to be given the ability to remove the unstealable flag from items placed within them OR when items hit a character's inventory.
Values would have to change thusly:
Items with a "02" flag would have to be changed to "00"
"03" --> "01"
"06" --> "04"
"07" --> "05"
Well, except the item duplication, which (if exists) is a bug.
The item duplication bug is reproducible:
1) Create two separate stacks of the same item in a container. To do this, a good way would be to first add one item without the can't steal flag, close the container, then add another stack with the can't steal flag. Close your container.
2) Open your container. Completely remove both stacks of that item from the container simultaneously (it is important to remove them both completely before closing, if you remove only one before closing the container, the bug won't occur). Close the container.
3) Open the container again. You will notice that one of the stacks remains in the container as if it were never removed. You can remove it again, allowing you to receive an extra stack of that item.
I'm not sure about the mechanics of this one. My guess is that, when you close the container, it updates the container file with the changes you made in the container interface. Changes that call for the removal of "itemxx" don't stack (it only fires once). So, when you remove multiple "itemxx" entries, only one entry is actually removed.
I suppose one could change how the store file is updated once the interface closes but, personally, I'd tackle the whole flag situation and kill two birds with one stone.