Module engine.Store

Functions

_M:allowStockObject (e) Checks if the given entity is allowed
_M:canRestock () Default restock checking method Checks based on turns elapsed, you may overload it to do your own checks
_M:descObject (who, what, o) Called to describe an object, being to sell or to buy
_M:descObjectPrice (who, what, o) Called to describe an object's price, being to sell or to buy
_M:interact (who, name) Actor interacts with the store
_M:loadup (level, zone, force_nb) Fill the store with goods
_M:onBuy (who, o, item, nb, before) Called on object purchase
_M:onSell (who, o, item, nb, before) Called on object sale
_M:tryBuy (who, o, item, nb) Called on object purchase try
_M:trySell (who, o, item, nb) Called on object sale try


Functions

_M:allowStockObject (e)
Checks if the given entity is allowed

Parameters

  • e:
_M:canRestock ()
Default restock checking method Checks based on turns elapsed, you may overload it to do your own checks
_M:descObject (who, what, o)
Called to describe an object, being to sell or to buy

Parameters

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

Return value:

a string (possibly multiline) describing the object
_M:descObjectPrice (who, what, o)
Called to describe an object's price, being to sell or to buy

Parameters

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

Return value:

a string describing the price
_M:interact (who, name)
Actor interacts with the store

Parameters

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

Parameters

  • level: the level to generate for (instance of type engine.Level)
  • zone: the zone to generate for
  • force_nb:
_M:onBuy (who, o, item, nb, before)
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
  • before: true if this happens before removing the item
_M:onSell (who, o, item, nb, before)
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
  • before: true if this happens before removing the item
_M:tryBuy (who, o, item, nb)
Called on object purchase try

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:trySell (who, o, item, nb)
Called on object sale try

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!