掉落系统:进程级掉落表 + 随机 roll 入包。 @thread 在 Bag 与注册表的 owning simulation thread 执行,不支持并发修改。 更多...
#include <LootSystem.h>
静态 Public 成员函数 | |
| static void | registerTable (const LootTableDefinition &def) |
| Registers table. | |
| static int | registerTablesFromJson (const std::string &json) |
| Registers tables from json. | |
| static const LootTableDefinition * | find (const std::string &id) |
| Finds . | |
| static void | clear () |
| Clears . | |
| static int | count () |
| Returns the number of . | |
| static int | roll (const std::string &tableId, eve::inventory::Bag *bag, std::mt19937 &rng) |
| 兼容入口:随机抽取后原子入包,内部使用 Result 事务路径。 | |
| static eve::Result< int > | rollDetailed (const std::string &tableId, eve::inventory::Bag *bag, std::mt19937 &rng, const LootRollRequest &request={}) |
| Structured loot roll with luck / diagnostics. | |
详细描述
掉落系统:进程级掉落表 + 随机 roll 入包。 @thread 在 Bag 与注册表的 owning simulation thread 执行,不支持并发修改。
在文件 LootSystem.h 第 63 行定义.
成员函数说明
◆ clear()
|
static |
◆ count()
|
static |
Returns the number of .
在文件 LootSystem.cpp 第 88 行定义.
引用了 size.
被这些函数引用 eve::rpg::RPG::getLootTableCount().
◆ find()
|
static |
◆ registerTable()
|
static |
◆ registerTablesFromJson()
|
static |
Registers tables from json.
在文件 LootSystem.cpp 第 39 行定义.
引用了 eve::json::Value::at(), eve::rpg::LootEntry::chance, entries, eve::rpg::LootTableDefinition::entries, eve::json::Value::get(), eve::json::Value::getBool(), eve::json::Value::getDouble(), eve::json::Value::getInt(), eve::json::Value::getString(), eve::rpg::LootTableDefinition::id, eve::rpg::Independent, eve::rpg::LootEntry::itemId, eve::rpg::LootEntry::maxQty, eve::rpg::LootEntry::minQty, n, eve::json::Document::parse(), eve::json::Document::root(), root, eve::rpg::LootTableDefinition::selectMode, eve::rpg::LootEntry::unique, eve::json::Document::valid() , 以及 eve::rpg::LootEntry::weight.
◆ roll()
|
static |
兼容入口:随机抽取后原子入包,内部使用 Result 事务路径。
- 返回
- 成功提交的表项数;失败或全部未命中返回 0(兼容 API 无错误诊断)。
- 备注
- 无效定义、未知物品或容量不足时不修改 Bag、随机流或发布事件。 成功但未命中仍消耗随机流;跨标准库不承诺逐位相同的随机分布结果。 @ownership bag 和 rng 由调用方拥有,只在本次同步调用期间借用。 @thread Bag、定义注册表与随机流的 owning simulation thread。 @reentrancy 库存策略不得修改参与者;变更钩子在 Bag 与随机流提交后执行。 @cost 复制背包并遍历掉落表,远高于属性查询;只在发奖时调用。
在文件 LootSystem.cpp 第 175 行定义.
引用了 result , 以及 rollDetailed().
被这些函数引用 eve::rpg::RPG::rollLoot().
◆ rollDetailed()
|
static |
Structured loot roll with luck / diagnostics.
- 返回
- Granted entry count, or a structured failure leaving bag and rng unchanged (except successful zero-hit Independent rolls, which advance rng). @cost Same order as roll(); once per reward settlement, not per frame.
在文件 LootSystem.cpp 第 181 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), find(), eve::InvalidArgument, eve::NotFound , 以及 request.
被这些函数引用 roll().
该类的文档由以下文件生成:
- src/modules/rpg/LootSystem.h
- src/modules/rpg/LootSystem.cpp