载入中...
搜索中...
未找到
LootSystem.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
14#include <cstdint>
15#include <random>
16#include <string>
17#include <vector>
18
19namespace eve::inventory {
20class Bag;
21}
22
23namespace eve::rpg {
24
26struct LootEntry {
27 std::string itemId;
28 double chance = 0.0;
29 int minQty = 1;
30 int maxQty = 1;
31};
32
35 std::string id;
36 std::vector<LootEntry> entries;
37};
38
44public:
46 static void registerTable(const LootTableDefinition &def);
48 static int registerTablesFromJson(const std::string &json);
50 static const LootTableDefinition *find(const std::string &id);
52 static void clear();
54 static int count();
55
60 static int roll(const std::string &tableId, eve::inventory::Bag *bag, std::mt19937 &rng);
61};
62
63} // namespace eve::rpg
#define EVENGINE_API_PLATFORM
Definition Export.h:107
std::uint32_t count
格子型物品容器(脚本可直接操作)。
Definition Bag.h:21
掉落系统:进程级掉落表 + 随机 roll 入包。 @thread roll 使用调用方提供的 rng(命名随机流),可在任意线程执行。
Definition LootSystem.h:43
运行时容器:固定格数的背包 / 箱子 / 商店栏等。 行为由 InventorySystem 提供;本类暴露便于脚本绑定的薄封装方法。
RPG 模块的基础实体:把属性 / 状态 / 技能三张表挂到一个 ECS 实体上。
掉落表里的一条掉落。
Definition LootSystem.h:26
double chance
[0,1],roll 值小于 chance 才掉落
Definition LootSystem.h:28
std::string itemId
Definition LootSystem.h:27
std::vector< LootEntry > entries
Definition LootSystem.h:36