public sealed class VendorStateOne vendor's live state: what is left, when it comes back, and the buyback window.
Remarks
⚠ Per vendor instance, not per definition. A shard's vendor running out is a fact about that shard; sharing the counter across a fleet would make a limited-stock item a race between continents.
⚠ Buyback is per player, and it is a list rather than a container. This library never holds an item — see the README — so what is recorded is what was sold and what was paid for it, and the caller puts the item back where it came from.
Fields and properties (1)
public Vendor VendorWhich vendor.
Methods (8)
public VendorState(Vendor vendor)Makes a fresh one with everything in stock.
public int Remaining(int row)How many of a row are left. Unlimited rows report their price count as −1.
public IReadOnlyList<BuybackEntry> BuybackFor(PlayerId player)What a vendor is holding for somebody.
public int Restock(float now)Puts back whatever has restocked.
public VendorRefusal CanBuy(int row, int count, IRequirementContext? context)Whether somebody may buy something, and why not.
public VendorRefusal Buy(PlayerId buyer, int row, int count, IEconomyLedger ledger, IRequirementContext? context, float now, string operation)Buys something.
public VendorRefusal Sell(PlayerId seller, DefId item, int count, DefId currency, long price, IEconomyLedger ledger, string operation)Sells something to the vendor, which records it for buyback.
public VendorRefusal BuyBack(PlayerId player, int slot, IEconomyLedger ledger, string operation)Buys something back at exactly what it was sold for.
Used by (1)
- VendorTestsVixen.Gameplay.Economy.Tests