stendhal/doc/mkdocs/lua/objects/merchants.md
2023-05-17 02:08:58 -07:00

3.3 KiB


Contents

[TOC]


Introduction

Object instance: merchants


Description

Exposes merchant handling classes & functions to Lua.


Members


merchants.shops

merchants.shops

Methods


merchants:add

merchants:add (merchantType, npc, prices)
merchants:add (merchantType, npc, prices, addOffer)
  • Adds merchant behavior to a SpeakerNPC.
  • Parameters:
    • merchantType: (string) If set to "buyer", will add buyer behavior, otherwise will be "seller".
    • npc: (SpeakerNPC) The NPC to add the behavior to.
    • prices: List of items & their prices (can be instance of either Map<String, Integer> or a table).
    • addOffer: (bool) If true, will add default replies for "offer" (default: true).
  • TODO:
    • Use ShopType for merchantType parameter.
    • FIXME: Lua table not working for "prices" parameter

merchants:addBuyer

merchants:addBuyer (npc, prices)
merchants:addBuyer (npc, prices, addOffer)
  • Adds buyer behavior to a SpeakerNPC.
  • Parameters:
    • npc: (SpeakerNPC) The NPC to add the behavior to.
    • prices: List of items & their prices (can be instance of either Map<String, Integer> or a table).
    • addOffer: (bool) If true, will add default replies for "offer" (default: true).

merchants:addSeller

merchants:addSeller (npc, prices)
merchants:addSeller (npc, prices, addOffer)
  • Adds seller behavior to a SpeakerNPC.
  • Parameters:
    • npc: (SpeakerNPC) The NPC to add the behavior to.
    • prices: List of items & their prices (can be instance of either Map<String, Integer> or a LuaTable).
    • addOffer: (bool) If true, will add default replies for "offer" (default: true).

TODO