Merge items (counted by charges) only when they stack.

Previously they would merge when the item type was the same. This would discard all the properties of one of them.
Now they only merge when they can stack (all their meaningful properties are the same).

Extract logic to merge item by charge into item function.