经济模块(eve.Economy):资源类型注册 + 玩家账本 + 事件 + 采集流水线。 更多...
#include <Economy.h>
Public 成员函数 | |
| Module_REG (Economy) | |
| Economy () | |
| Economy. | |
| ~Economy () override | |
| Economy. | |
| int | credit (int player, const std::string &type, int amount) override |
| Credit. | |
| bool | debit (int player, const std::string &type, int amount) override |
| Debit. | |
| int | get (int player, const std::string &type) const override |
| Get. | |
| int | getCap (int player, const std::string &type) const override |
| Get cap. | |
| int | getWasted (int player, const std::string &type) const override |
| Get wasted. | |
| int | getIncome (int player, const std::string &type) const override |
| Get income. | |
| int | getExpense (int player, const std::string &type) const override |
| Get expense. | |
| std::string | getTypeId (int index) |
| 按 id 字典序返回第 index 个资源类型 id;越界返回空串。 | |
| eve::Result< void > | publishGameplay (const std::string &instanceId, const std::string &ownerId, int player) |
把一个玩家账本发布到共享玩法协议(eve_gameplay / MCP)。 | |
| eve::Result< void > | unpublishGameplay (const std::string &instanceId) |
| 取消发布一个实例;该实例未发布(或 id 非法)时返回诊断。 | |
| void | clearGameplayControls () |
| 取消发布本模块持有的全部玩法实例。 | |
| int | gameplayControlCount () const |
| 已发布的玩法实例数量。 | |
| std::vector< std::string > | gameplayInstances () const |
| 已发布的玩法实例标识(发布顺序)。 | |
Public 成员函数 继承自 eve::Module | |
| virtual | ~Module () |
| Module. | |
| virtual std::string | getName () const =0 |
| Returns the name. | |
Public 成员函数 继承自 eve::economy::IEconomy | |
| virtual | ~IEconomy ()=default |
| Releases IEconomy resources. | |
静态 Public 成员函数 | |
| static bool | registerResourceType (const std::string &id, const std::string &category, int stockMax, const std::string &depletion) |
| 注册资源类型;depletion 取值 finite/renewable/infinite/growing。 | |
| static void | clearTypes () |
| 清空资源类型(测试用)。 | |
| static int | typeCount () |
| 已注册类型数量。 | |
| static bool | hasType (const std::string &id) |
| 类型是否已注册。 | |
| static int | getStockMax (const std::string &id) |
| 类型持有上限(未注册返回 0)。 | |
| static Result< int > | registerMarketsFromJson (const std::string &json) |
| 从 JSON 注册地区或全国市场(对象或数组)。 | |
| static void | clearMarkets () |
| 清空市场配置(测试用)。 | |
| static int | marketCount () |
| 已注册市场数量。 | |
| static bool | hasMarket (const std::string &id) |
| 市场 id 是否已注册。 | |
| static std::string | getMarketId (int index) |
| 按 id 字典序返回第 index 个市场 id;越界返回空串。 | |
| static std::string | getMarketScope (const std::string &id) |
| 市场范围文本(regional/national);未知 id 返回空串。 | |
| static std::string | getMarketRegionId (const std::string &id) |
| 地区市场的 regionId;全国市场或未知 id 返回空串。 | |
| static std::string | getMarketNationId (const std::string &id) |
| 市场挂靠/绑定的 nationId;未知 id 返回空串。 | |
| static std::string | getMarketCurrencyType (const std::string &id) |
| 市场报价货币类型;未知 id 返回空串。 | |
| static int | getMarketTariffBps (const std::string &id) |
| 市场关税配置(万分比);未知 id 返回 0。 | |
| static bool | isMarketEnabled (const std::string &id) |
| 市场是否启用;未知 id 返回 false。 | |
| static std::string | findRegionalMarket (const std::string ®ionId) |
| 按 regionId 查找启用中的地区市场 id。 | |
| static std::string | findNationalMarket (const std::string &nationId) |
| 按 nationId 查找启用中的全国市场 id。 | |
| static int | getMarketListingCount (const std::string &marketId) |
| 市场挂牌数量;未知市场返回 0。 | |
| static std::string | getMarketListingResourceType (const std::string &marketId, int index) |
| 第 index 个挂牌的资源类型;越界/未知返回空串。 | |
| static int | getMarketListingBasePrice (const std::string &marketId, int index) |
| 第 index 个挂牌的基准价;越界/未知返回 0。 | |
| static Result< int > | quoteBuyPrice (const std::string &marketId, const std::string &resourceType) |
| 买入报价。 | |
| static Result< int > | quoteSellPrice (const std::string &marketId, const std::string &resourceType) |
| 卖出报价。 | |
| static void | clearEvents () |
| 清空事件队列。 | |
| static int | eventCount () |
| 事件队列长度。 | |
| static std::string | eventAction (int index) |
| 第 index 个事件的动作(credit/debit/waste;越界返回空串)。 | |
| static int | eventPlayer (int index) |
| 第 index 个事件的玩家(越界返回 0)。 | |
| static std::string | eventType (int index) |
| 第 index 个事件的资源类型(越界返回空串)。 | |
| static int | eventAmount (int index) |
| 第 index 个事件的数值(越界返回 0)。 | |
额外继承的成员函数 | |
静态 Public 属性 继承自 eve::economy::IEconomy | |
| static constexpr const char * | capabilityName = "IEconomy" |
详细描述
构造及析构函数说明
◆ Economy()
| eve::economy::Economy::Economy | ( | ) |
在文件 Economy.cpp 第 20 行定义.
◆ ~Economy()
|
override |
成员函数说明
◆ clearEvents()
|
static |
◆ clearGameplayControls()
| void eve::economy::Economy::clearGameplayControls | ( | ) |
◆ clearMarkets()
|
static |
◆ clearTypes()
|
static |
◆ credit()
|
overridevirtual |
◆ debit()
|
overridevirtual |
◆ eventAction()
|
static |
第 index 个事件的动作(credit/debit/waste;越界返回空串)。
在文件 Economy.cpp 第 166 行定义.
引用了 eve::economy::EconomyEvent::action, eve::economy::EconomySystem::eventAt(), eve::economy::EconomySystem::eventCount() , 以及 index.
◆ eventAmount()
|
static |
第 index 个事件的数值(越界返回 0)。
在文件 Economy.cpp 第 181 行定义.
引用了 eve::economy::EconomyEvent::amount, eve::economy::EconomySystem::eventAt(), eve::economy::EconomySystem::eventCount() , 以及 index.
◆ eventCount()
|
static |
◆ eventPlayer()
|
static |
第 index 个事件的玩家(越界返回 0)。
在文件 Economy.cpp 第 171 行定义.
引用了 eve::economy::EconomySystem::eventAt(), eve::economy::EconomySystem::eventCount(), index , 以及 eve::economy::EconomyEvent::player.
◆ eventType()
|
static |
第 index 个事件的资源类型(越界返回空串)。
在文件 Economy.cpp 第 176 行定义.
引用了 eve::economy::EconomySystem::eventAt(), eve::economy::EconomySystem::eventCount(), index , 以及 eve::economy::EconomyEvent::type.
◆ findNationalMarket()
|
static |
◆ findRegionalMarket()
|
static |
◆ gameplayControlCount()
| int eve::economy::Economy::gameplayControlCount | ( | ) | const |
已发布的玩法实例数量。
在文件 Economy.cpp 第 361 行定义.
◆ gameplayInstances()
| std::vector< std::string > eve::economy::Economy::gameplayInstances | ( | ) | const |
◆ get()
|
overridevirtual |
◆ getCap()
|
overridevirtual |
◆ getExpense()
|
overridevirtual |
Get expense.
在文件 Economy.cpp 第 46 行定义.
◆ getIncome()
|
overridevirtual |
◆ getMarketCurrencyType()
|
static |
◆ getMarketId()
|
static |
按 id 字典序返回第 index 个市场 id;越界返回空串。
在文件 Economy.cpp 第 92 行定义.
◆ getMarketListingBasePrice()
|
static |
第 index 个挂牌的基准价;越界/未知返回 0。
在文件 Economy.cpp 第 148 行定义.
引用了 eve::economy::MarketRegistry::find() , 以及 index.
◆ getMarketListingCount()
|
static |
◆ getMarketListingResourceType()
|
static |
第 index 个挂牌的资源类型;越界/未知返回空串。
在文件 Economy.cpp 第 142 行定义.
引用了 eve::economy::MarketRegistry::find() , 以及 index.
◆ getMarketNationId()
|
static |
◆ getMarketRegionId()
|
static |
地区市场的 regionId;全国市场或未知 id 返回空串。
在文件 Economy.cpp 第 102 行定义.
◆ getMarketScope()
|
static |
市场范围文本(regional/national);未知 id 返回空串。
在文件 Economy.cpp 第 97 行定义.
引用了 eve::economy::MarketRegistry::find() , 以及 eve::economy::marketScopeName().
◆ getMarketTariffBps()
|
static |
◆ getStockMax()
|
static |
◆ getTypeId()
| std::string eve::economy::Economy::getTypeId | ( | int | index | ) |
按 id 字典序返回第 index 个资源类型 id;越界返回空串。
在文件 Economy.cpp 第 79 行定义.
引用了 index , 以及 eve::economy::ResourceTypeRegistry::typeAt().
◆ getWasted()
|
overridevirtual |
◆ hasMarket()
|
static |
◆ hasType()
|
static |
◆ isMarketEnabled()
|
static |
◆ marketCount()
|
static |
◆ Module_REG()
| eve::economy::Economy::Module_REG | ( | Economy | ) |
◆ publishGameplay()
| eve::Result< void > eve::economy::Economy::publishGameplay | ( | const std::string & | instanceId, |
| const std::string & | ownerId, | ||
| int | player | ||
| ) |
把一个玩家账本发布到共享玩法协议(eve_gameplay / MCP)。
领域动作词表就是本模块自己的操作:economy:debit 是普通消费(玩家档位 可用,余额不足即拒绝),economy:credit 是发放(仅 test-driver / developer-cheat,且超上限部分以 waste 事件披露)。采集仍由 GatherNode/Collector 按 tick 驱动,不在此另开捷径。
- 参数
-
instanceId 实例稳定标识,必须是规范持久 id(UUID 文本)。 ownerId 控制该实例的玩家/角色稳定标识,同为规范持久 id。 player 模块级玩家 id( EconomySystem的账本键)。
- 返回
- 成功返回空结果;id 非法或实例重复返回诊断。 @ownership 适配器由本模块持有并随模块销毁;账本所有权不变。 @thread 所有者模拟线程。
在文件 Economy.cpp 第 330 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::SubjectRef::fromPersistentId(), instanceId, eve::InvalidArgument, owner , 以及 eve::detail::Id128< Tag >::parse().
◆ quoteBuyPrice()
|
static |
◆ quoteSellPrice()
|
static |
◆ registerMarketsFromJson()
|
static |
从 JSON 注册地区或全国市场(对象或数组)。
- 参数
-
json eve.economy.marketv1;见用户手册。
- 返回
- 成功时为注册/替换的市场数量。 @cost Cheap JSON parse of authoring-size market tables; amortize at load.
在文件 Economy.cpp 第 84 行定义.
◆ registerResourceType()
|
static |
注册资源类型;depletion 取值 finite/renewable/infinite/growing。
在文件 Economy.cpp 第 50 行定义.
引用了 eve::economy::ResourceTypeDef::category, category, eve::economy::ResourceTypeDef::depletion, eve::economy::ResourceTypeDef::displayName, eve::economy::Finite, eve::economy::Growing, id, eve::economy::ResourceTypeDef::id, eve::economy::Infinite, eve::economy::ResourceTypeRegistry::registerType(), eve::economy::Renewable , 以及 eve::economy::ResourceTypeDef::stockMax.
◆ typeCount()
|
static |
◆ unpublishGameplay()
| eve::Result< void > eve::economy::Economy::unpublishGameplay | ( | const std::string & | instanceId | ) |
取消发布一个实例;该实例未发布(或 id 非法)时返回诊断。
在文件 Economy.cpp 第 346 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::SubjectRef::fromPersistentId(), instanceId, eve::InvalidArgument, eve::NotFound , 以及 eve::detail::Id128< Tag >::parse().
该类的文档由以下文件生成:
- src/modules/economy/Economy.h
- src/modules/economy/Economy.cpp
Public 成员函数 继承自