This week I implemented a revamped version of the marketplace found in TutorialDynamicCities.

The Market

Every market building will have Trader Gooey (Neutral Gooey for now). Players will interact with it to get the marketplace dialog to pop up. Here they can choose to either buy or sell.

Depending on whether they chose to buy or sell, they'll get a list on the left of resources in the city or the items in their inventory. The confirm button completes that transaction.

The cost and description data will have to be provided in the MarketItemBuilder class. The items whose data is not available will have a random cost (<50) and a preset description.

Anything that is placed in the Blacksmith's chest will be available in all markets. The Economy module will also create new resources from the ones that are already available. For example if someone puts planks in the Blacksmith's chest, the market will have barrels available for purchase after a while.

The currency system is working perfectly. Right now players regularly get 20 cash at regular intervals, for testing. This will be changed to something more appropriate for gameplay later on.

Problems

I had some trouble converting resources in the market (the Economy module) into entities/blocks that the player can store in their inventory, or vice versa while selling. Selling is a simple affair because I can just delete that item from the inventory and add its name as a resource. For buying I am replicating what the give command does.

PRs

WIP
- Economy #10
- Metal Renegades #18

To do

  • Complete the marketplace and inventory management
  • Start work on trading with NPCs