If I have an item in my inventory, but the store does not have that item in stock, the item does not appear as available for sale when we switch to sell items mode, as only items from the store’s inventory are displayed.
When selling, you’ll need to gather a collection of shopItems by getting the player’s inventory. Instead of discarding items not found in the shop’s shopItems, use the base price and create a shop item record with no discount. (You could even set a - discount so that items the merchant doesn’t handle sell for even less. The tricky part is saving the items that the merchant has purchased. You have two options here… you can save the non-stock items the merchant has purchased, or you can discard them (inferring that the merchant has sold the items on the black market while you were in another scene).
1 Like