载入中...
搜索中...
未找到
eve::rpg::LootSystem类 参考

掉落系统:进程级掉落表 + 随机 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()

void eve::rpg::LootSystem::clear ( )
static

Clears .

在文件 LootSystem.cpp 第 86 行定义.

被这些函数引用 eve::rpg::RPG::clearLootTables().

◆ count()

int eve::rpg::LootSystem::count ( )
static

Returns the number of .

在文件 LootSystem.cpp 第 88 行定义.

引用了 size.

被这些函数引用 eve::rpg::RPG::getLootTableCount().

◆ find()

const LootTableDefinition * eve::rpg::LootSystem::find ( const std::string &  id)
static

Finds .

在文件 LootSystem.cpp 第 80 行定义.

引用了 t.

被这些函数引用 rollDetailed().

◆ registerTable()

void eve::rpg::LootSystem::registerTable ( const LootTableDefinition &  def)
static

Registers table.

在文件 LootSystem.cpp 第 34 行定义.

引用了 eve::rpg::LootTableDefinition::id.

◆ registerTablesFromJson()

◆ roll()

int eve::rpg::LootSystem::roll ( const std::string &  tableId,
eve::inventory::Bag *  bag,
std::mt19937 &  rng 
)
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()

eve::Result< int > eve::rpg::LootSystem::rollDetailed ( const std::string &  tableId,
eve::inventory::Bag *  bag,
std::mt19937 &  rng,
const LootRollRequest &  request = {} 
)
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().


该类的文档由以下文件生成: