载入中...
搜索中...
未找到
ItemTypes.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5// 背包模块的核心数据结构:物品定义、运行时堆叠、变更事件。
6// 全部 key 使用字符串,便于 JSON 配置与跨版本兼容。
7
8#include <string>
9#include <unordered_map>
10#include <vector>
11
12namespace eve::inventory {
13
16 std::string id;
17 std::string displayName;
18 int maxStack = 1;
19 float weight = 0.f;
20 float volume = 0.f;
21 std::vector<std::string> tags;
22 std::string category;
24 std::string equipSlot;
25 std::unordered_map<std::string, std::string> extra;
26
28 bool hasTag(const std::string &tag) const;
30 std::string getExtra(const std::string &key, const std::string &fallback = {}) const;
31};
32
35 int instanceId = 0;
36 std::string itemId;
37 int quantity = 0;
38 float durability = -1.f;
39 std::unordered_map<std::string, std::string> props;
40 std::vector<std::string> tags;
41
43 bool empty() const { return itemId.empty() || quantity <= 0; }
45 void clear();
47 bool hasTag(const std::string &tag) const;
49 std::string getProp(const std::string &key, const std::string &fallback = {}) const;
51 void setProp(const std::string &key, const std::string &value);
52};
53
56 std::string action;
57 std::string bagId;
58 std::string otherBagId;
59 std::string itemId;
60 int quantity = 0;
61 int slot = -1;
62 int otherSlot = -1;
63 std::string equipSlot;
64};
65
66} // namespace eve::inventory
double value
LogicalId itemId
double volume
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Definition Export.h:106
std::uint32_t key
const std::string * tag
运行时容器:固定格数的背包 / 箱子 / 商店栏等。 行为由 InventorySystem 提供;本类暴露便于脚本绑定的薄封装方法。
一次成功库存变更的事件(供脚本 poll / C++ hook)。
Definition ItemTypes.h:55
std::string action
add/remove/move/swap/split/merge/transfer/equip/unequip
Definition ItemTypes.h:56
物品模板(进程级注册表中的定义,不含运行时数量)。
Definition ItemTypes.h:15
std::string equipSlot
非空表示建议装备槽名;是否可装备由 EquipmentSet 槽位配置最终决定。
Definition ItemTypes.h:24
std::unordered_map< std::string, std::string > extra
Definition ItemTypes.h:25
std::vector< std::string > tags
Definition ItemTypes.h:21
容器中的一格堆叠(空槽:itemId 为空或 quantity <= 0)。
Definition ItemTypes.h:34
std::unordered_map< std::string, std::string > props
Definition ItemTypes.h:39
bool empty() const
Empty.
Definition ItemTypes.h:43
std::vector< std::string > tags
Definition ItemTypes.h:40