Shops - GregHib/void GitHub Wiki

Adding default shops

Find the shop in inventories.yml, or add if you know the container id

bobs_brilliant_axes:
  id: 1
  shop: true
  defaults:
    - bronze_pickaxe: 10
    - bronze_hatchet: 10
    - iron_hatchet: 10
    - steel_hatchet: 10
    - iron_battleaxe: 10
    - steel_battleaxe: 10
    - mithril_battleaxe: 10

Make sure shop: true is set.

Add the shopkeeper to npcs.yml

bob:
  id: 519
  race: "human"
  shop: bobs_brilliant_axes
  examine: "An expert on axes."

shop: needs to be set to the containers string id for shops to open automatically when clicking the "Trade" option

Spawn the shopkeep in the right place in npc-spawns.yml

- { id: bob, x: 3228, y: 3203, plane: 0, direction: SOUTH, members: false }

Opening a shop

Npcs with the Trade option will open shops listed in their npcs.yml automatically however when opened via dialogue options the OpenShop event should be used:

player.events.emit(OpenShop("zekes_superior_scimitars"))

General stores

To add a general store which all players can see and most tradable items can be sold to, simply make sure the container name ends with general_store, for example:

lumbridge_general_store:
  id: 24
  shop: true
  defaults:
    - empty_pot: 30
    - jug: 10
    - shears: 10
    # etc...