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