Class engine.Store
Store
Methods
engine.Store:canRestock ()
Default restock checking method Checks based on turns elapsed, you may overload it to do your own checks
engine.Store:allowStockObject (e)
Checks if the given entity is allowed
engine.Store:loadup (level, zone, force_nb)
Fill the store with goods
engine.Store:interact (who[, name])
Actor interacts with the store
engine.Store:doBuy (who, o, item, nb, store_dialog)
assumes buyer has room
engine.Store:tryBuy (who, o, item, nb)
Called on object purchase try
engine.Store:trySell (who, o, item, nb)
Called on object sale try
engine.Store:onBuy (who, o, item, nb, before)
Called on object purchase
engine.Store:onSell (who, o, item, nb, before)
Called on object sale
engine.Store:descObject (who, what, o)
Called to describe an object, being to sell or to buy
engine.Store:descObjectPrice (who, what, o)
Called to describe an object's price, being to sell or to buy
Methods
- engine.Store:canRestock ()
- Default restock checking method Checks based on turns elapsed, you may overload it to do your own checks
- engine.Store:allowStockObject (e)
-
Checks if the given entity is allowed
Parameters:
- e
- engine.Store: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 [opt] make it generate a specific number of items
- engine.Store:interact (who[, name])
-
Actor interacts with the store
Parameters:
- who the actor who interacts
- name display name of the store (optional)
- engine.Store:doBuy (who, o, item, nb, store_dialog)
-
assumes buyer has room
Parameters:
- who
- o
- item
- nb
- store_dialog
- engine.Store: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
Returns:
-
a number (or nil) if allowed to buy, giving the number of objects to buy
- engine.Store: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
Returns:
-
a number (or nil) if allowed to sell, giving the number of objects to sell
- engine.Store: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
- engine.Store: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
- engine.Store: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
Returns:
-
a string (possibly multiline) describing the object
- engine.Store: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
Returns:
-
a string describing the price