Class LuaMerchantHelper

java.lang.Object
games.stendhal.server.core.scripting.lua.LuaMerchantHelper

public class LuaMerchantHelper extends Object
Exposes merchant handling classes & functions to Lua.
  • Field Details

  • Method Details

    • get

      public static LuaMerchantHelper get()
      Retrieves the static instance.
      Returns:
      Static MerchantHelper instance.
    • add

      public void add(String merchantType, SpeakerNPC npc, Object prices, Boolean addOffer)
      Adds merchant behavior to a SpeakerNPC. FIXME: LuaTable not working for "prices" object
      Parameters:
      merchantType - If set to "buyer", will add buyer behavior, otherwise will be "seller".
      npc - The SpeakerNPC to add the behavior to.
      prices - List of items & their prices (can be instance of either Map or LuaTable).
      addOffer - If true, will add default replies for "offer" (default: true).
    • addSeller

      public void addSeller(SpeakerNPC npc, Object prices, boolean addOffer)
      Adds merchant seller behavior to a SpeakerNPC.
      Parameters:
      npc - The SpeakerNPC to add the behavior to.
      prices - List of items & their prices (can be instance of either Map or LuaTable).
      addOffer - If true, will add default replies for "offer" (default: true).
    • addBuyer

      public void addBuyer(SpeakerNPC npc, Object prices, boolean addOffer)
      Adds merchant buyer behavior to a SpeakerNPC.
      Parameters:
      npc - The SpeakerNPC to add the behavior to.
      prices - List of items & their prices (can be instance of either Map or LuaTable).
      addOffer - If true, will add default replies for "offer" (default: true).