载入中...
搜索中...
未找到
ShopTransaction.cpp
浏览该文件的文档.
全局游戏状态:开关(bool)、变量(数字)、独立变量(按作用域)。
Strict, atomically replaceable RPG shop content.
Atomic RPG currency and inventory purchase/sale orchestration.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
static eve::Result< int > commitRemove(PreparedInventoryRemove prepared)
Commit a prepared removal and publish its event after the no-fail slot swap.
Definition InventorySystem.cpp:535
static eve::Result< int > commitAddBatch(PreparedInventoryAdd prepared)
Commit one prepared addition and then publish its change events.
Definition InventorySystem.cpp:478
static eve::Result< PreparedInventoryAdd > prepareAddBatch(Bag *bag, const std::vector< InventoryItemGrant > &grants)
Validate a multi-item addition against a private candidate Bag.
Definition InventorySystem.cpp:434
static eve::Result< PreparedInventoryRemove > prepareRemove(Bag *bag, const std::string &itemId, int quantity)
Prepare removal of one exact item quantity without mutation or events.
Definition InventorySystem.cpp:497
eve::Result< std::string > snapshotJson() const
Serialize this state as the canonical versioned RPG game-state JSON document.
Definition GameState.cpp:119
static const ShopOffer * find(const std::string &id)
Find an offer by stable offer id, or null when absent.
Definition ShopCatalogue.cpp:109
static eve::Result< int > sell(GameState &gameState, inventory::Bag &bag, const std::string ¤cyId, const std::string &itemId, int quantity, double unitPrice)
Atomically remove an item quantity and credit its sale proceeds.
Definition ShopTransaction.cpp:93
static eve::Result< int > sellOffer(GameState &gameState, inventory::Bag &bag, const std::string ¤cyId, const std::string &offerId, int quantity)
Sell a quantity using the authoritative price and item in ShopCatalogue.
Definition ShopTransaction.cpp:64
static eve::Result< int > buyOffer(GameState &gameState, inventory::Bag &bag, const std::string ¤cyId, const std::string &offerId, int quantity)
Buy a quantity using the authoritative price and item in ShopCatalogue.
Definition ShopTransaction.cpp:53
static eve::Result< int > buy(GameState &gameState, inventory::Bag &bag, const std::string ¤cyId, const std::string &itemId, int quantity, double unitPrice)
Atomically debit currency and add the purchased item quantity.
Definition ShopTransaction.cpp:75
@ InvalidArgument
@ NotFound
@ PreconditionViolation
@ InvariantViolation
One immutable offer in the process-local shop catalogue.
Definition ShopCatalogue.h:14