10#include <unordered_map>
16class InventorySaveSession;
33 std::string
getId()
const {
return id_; }
35 void setId(
const std::string &
id) { id_ =
id; }
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;
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;
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);
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;
82 std::vector<std::string> allowedTags;
86 std::unordered_map<std::string, Slot> slots_;
87 std::vector<std::string> order_;
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
EVENGINE_API_FOUNDATION public API.
EquipmentSet & operator=(const EquipmentSet &)=delete
void setId(const std::string &id)
Sets the id.
~EquipmentSet()=default
Equipment set.
EquipmentSet()=default
Equipment set.
std::string getId() const
Returns the id.
EquipmentSet(const EquipmentSet &)=delete
Coordinates persistent inventory owners without duplicating their live state.
EVENGINE_API_FOUNDATION public API.
运行时容器:固定格数的背包 / 箱子 / 商店栏等。 行为由 InventorySystem 提供;本类暴露便于脚本绑定的薄封装方法。
容器中的一格堆叠(空槽:itemId 为空或 quantity <= 0)。