dao::store
Declared in dao/Store.h.
Classes
| Class | |
|---|---|
| Entry | An item the store stocks, with what one costs. |
Enumerations
Refusal
enum class Refusal : std::uint8_t
Why a buy or a sale was refused, or None if it went.
| Value | |
|---|---|
None |
|
NoStore |
no store’s screen is up |
NotOffered |
the store does not stock the item, or the party’s backpack does not hold it |
BadCount |
the count is below 1 |
PlotItem |
an item the story needs, which the screen never offers for sale |
TooExpensive |
the party has not the money |
BackpackFull |
the party’s backpack had no room, and the store kept the item |
StoreWontBuy |
the store buys no such item, has not the money, or pays no more than that |
Functions
Buy()
Refusal Buy(ObjectId item, std::int32_t count=1)
Buys some of an item the open store stocks into the party’s backpack, as the screen does.
BuyPrice()
std::int32_t BuyPrice(ObjectId item, std::int32_t count=1)
Returns what the open store charges for some of an item it stocks: more for an item the party has just sold it is bought back at what was paid.
Returns 0 with no store open
Close()
void Close()
Closes the store’s screen as its close does: the store settles, and an item sold can no longer be bought back at what was paid.
Does nothing with no store’s screen up.
Current()
std::optional<ObjectId> Current()
Returns the store whose screen is up.
Call it, and the rest, on the game thread.
Returns nullopt unless the store’s screen is the full screen shown
Money()
std::int32_t Money()
Returns the party’s money, in coppers.
Sell()
Refusal Sell(ObjectId item, std::int32_t count=1)
Sells some of an item from the party’s backpack to the open store, as the screen does.
SellPrice()
std::int32_t SellPrice(ObjectId item, std::int32_t count=1)
Returns what the open store pays for some of an item.
Returns 0 with no store open
Stock()
std::vector<Entry> Stock()
Returns what the open store stocks, in its order.