Module engine.Store

Functions

_M:descObject (what, o, who) Called to describe an object, being to sell or to buy
_M:interact (who) Actor interacts with the store
_M:loadup (level, zone) Fill the store with goods
_M:onBuy (who, o, item, nb) Called on object purchase
_M:onSell (who, o, item, nb) Called on object sale


Functions

_M:descObject (what, o, who)
Called to describe an object, being to sell or to buy

Parameters

  • what: either "sell" or "buy"
  • o: the object
  • who: the actor

Return value:

a string (possibly multiline) describing the object
_M:interact (who)
Actor interacts with the store

Parameters

  • who: the actor who interracts
_M:loadup (level, zone)
Fill the store with goods

Parameters

  • level: the level to generate for (inctance of type engine.Level)
  • zone: the zone to generate for
_M:onBuy (who, o, item, nb)
Called on object purchase

Parameters

  • who: the actor buying
  • o: the object trying to be purchased
  • item: the index in the inventory
  • nb: number of items (if stacked) to buy

Return value:

a number (or nil) if allowed to buy, giving the number of objects to buy
_M:onSell (who, o, item, nb)
Called on object sale

Parameters

  • who: the actor selling
  • o: the object trying to be sold
  • item: the index in the inventory
  • nb: number of items (if stacked) to sell

Return value:

a number (or nil) if allowed to sell, giving the number of objects to sell

Valid XHTML 1.0!