载入中...
搜索中...
未找到
Equipment.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5// 具名装备栏:与 Bag 松耦合,穿脱只搬运物品;属性加成由游戏侧 hook/脚本处理。
6
8
9#include <string>
10#include <unordered_map>
11#include <vector>
12
13namespace eve::inventory {
14
15class Bag;
16class InventorySaveSession;
17
20public:
22 EquipmentSet() = default;
24 ~EquipmentSet() = default;
25
26 EquipmentSet(const EquipmentSet &) = delete;
28
30 void destroy();
31
33 std::string getId() const { return id_; }
35 void setId(const std::string &id) { id_ = id; }
36
38 void defineSlot(const std::string &slotName);
40 void clearSlotAllowedTags(const std::string &slotName);
42 void addSlotAllowedTag(const std::string &slotName, const std::string &tag);
44 bool hasSlot(const std::string &slotName) const;
46 int getSlotCount() const;
48 std::string getSlotName(int index) const;
49
51 bool isSlotEmpty(const std::string &slotName) const;
53 std::string getSlotItemId(const std::string &slotName) const;
55 int getSlotQuantity(const std::string &slotName) const;
57 int getSlotInstanceId(const std::string &slotName) const;
58
60 bool canEquipFromBag(Bag *bag, int bagSlot, const std::string &equipSlot,
61 std::string *reason = nullptr) const;
63 bool equipFromBag(const std::string &equipSlot, Bag *bag, int bagSlot);
65 bool unequipToBag(const std::string &equipSlot, Bag *bag);
67 bool clearSlot(const std::string &slotName);
68
70 const ItemStack *stackAt(const std::string &slotName) const;
72 ItemStack *stackAt(const std::string &slotName);
74 const std::vector<std::string> *allowedTags(const std::string &slotName) const;
75
76private:
77 friend class InventorySystem;
79
80 struct Slot {
81 ItemStack stack;
82 std::vector<std::string> allowedTags;
83 };
84
85 std::string id_;
86 std::unordered_map<std::string, Slot> slots_;
87 std::vector<std::string> order_;
88};
89
90} // namespace eve::inventory
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Definition Export.h:106
void(* destroy)(void *)
const std::string * tag
std::string id
Definition PlayHost.cpp:108
uint32_t index
格子型物品容器(脚本可直接操作)。
Definition Bag.h:21
EVENGINE_API_FOUNDATION public API.
Definition Equipment.h:19
EquipmentSet & operator=(const EquipmentSet &)=delete
void setId(const std::string &id)
Sets the id.
Definition Equipment.h:35
~EquipmentSet()=default
Equipment set.
EquipmentSet()=default
Equipment set.
std::string getId() const
Returns the id.
Definition Equipment.h:33
EquipmentSet(const EquipmentSet &)=delete
Coordinates persistent inventory owners without duplicating their live state.
EVENGINE_API_FOUNDATION public API.
运行时容器:固定格数的背包 / 箱子 / 商店栏等。 行为由 InventorySystem 提供;本类暴露便于脚本绑定的薄封装方法。
容器中的一格堆叠(空槽:itemId 为空或 quantity <= 0)。
Definition ItemTypes.h:34