Sell all items on inventory

Hi, I’m sharing with you the solution that I used to be able to sell any item that the player has in his inventory. I tried to respect the original code and simply make a getter to retrieve a list of items.

and the code

I hope this can help! it’s also extensible, you can potentially put conditions to say that such an item is not for sale etc etc (by modifying the item class) have fun!!

PS: if you want to make it work 100% you have to modify what happens in the getallitems my first version is not great for selling mod. I made a second version where I store the items in a dictionary before looping. Then I do what is necessary to group them according to their type in order to avoid having duplicate lines.


Great solution :clap:
Thanks for sharing.

Privacy & Terms