#include <InventorySystem.h>
Public 类型 | |
| using | AcceptFn = std::function< bool(const Bag &bag, const ItemDefinition &def, int quantity, std::string *reason)> |
| using | CapacityFn = std::function< bool(const Bag &bag, const ItemDefinition &def, int quantity, std::string *reason)> |
| using | StackFn = std::function< bool(const ItemStack &a, const ItemStack &b, const ItemDefinition &def)> |
| using | ChangeHook = std::function< void(const InventoryChangeEvent &ev)> |
静态 Public 成员函数 | |
| static void | registerAcceptRule (const std::string &name, AcceptFn fn) |
| static void | unregisterAcceptRule (const std::string &name) |
| static bool | hasAcceptRule (const std::string &name) |
| static void | registerCapacityPolicy (const std::string &name, CapacityFn fn) |
| static void | unregisterCapacityPolicy (const std::string &name) |
| static bool | hasCapacityPolicy (const std::string &name) |
| static void | registerStackRule (const std::string &name, StackFn fn) |
| static void | unregisterStackRule (const std::string &name) |
| static bool | hasStackRule (const std::string &name) |
| static void | registerChangeHook (const std::string &name, ChangeHook fn) |
| static void | unregisterChangeHook (const std::string &name) |
| static bool | hasChangeHook (const std::string &name) |
| static void | ensureBuiltins () |
| 确保内置规则已注册(模块首次使用时自动调用)。 | |
| static bool | canAdd (Bag *bag, const std::string &itemId, int quantity, std::string *reason=nullptr) |
| static int | addItem (Bag *bag, const std::string &itemId, int quantity) |
| 返回实际放入数量(可能部分成功)。 | |
| static int | removeItem (Bag *bag, const std::string &itemId, int quantity) |
| static int | removeAt (Bag *bag, int slot, int quantity) |
| static bool | swapSlots (Bag *bag, int slotA, int slotB) |
| static bool | moveSlot (Bag *bag, int fromSlot, int toSlot) |
| static bool | splitStack (Bag *bag, int slot, int quantity, int toSlot) |
| static int | transfer (Bag *from, Bag *to, const std::string &itemId, int quantity) |
| static int | transferSlot (Bag *from, int fromSlot, Bag *to, int quantity) |
| static int | countItem (const Bag *bag, const std::string &itemId) |
| static int | findItem (const Bag *bag, const std::string &itemId) |
| static int | findItemByTag (const Bag *bag, const std::string &tag) |
| static float | usedWeight (const Bag *bag) |
| static float | usedVolume (const Bag *bag) |
| static int | usedSlotCount (const Bag *bag) |
| static void | clearBag (Bag *bag) |
| static bool | equipFromBag (EquipmentSet *eq, const std::string &equipSlot, Bag *bag, int bagSlot) |
| static bool | unequipToBag (EquipmentSet *eq, const std::string &equipSlot, Bag *bag) |
| static void | pushEvent (InventoryChangeEvent ev) |
| static void | pollEvents (std::vector< InventoryChangeEvent > &out) |
| static void | clearEvents () |
| static const std::vector< InventoryChangeEvent > & | events () |
| static int | nextInstanceId () |
详细描述
在文件 InventorySystem.h 第 19 行定义.
成员类型定义说明
◆ AcceptFn
| using eve::inventory::InventorySystem::AcceptFn = std::function<bool(const Bag &bag, const ItemDefinition &def, int quantity, std::string *reason)> |
在文件 InventorySystem.h 第 21 行定义.
◆ CapacityFn
| using eve::inventory::InventorySystem::CapacityFn = std::function<bool(const Bag &bag, const ItemDefinition &def, int quantity, std::string *reason)> |
在文件 InventorySystem.h 第 23 行定义.
◆ ChangeHook
| using eve::inventory::InventorySystem::ChangeHook = std::function<void(const InventoryChangeEvent &ev)> |
在文件 InventorySystem.h 第 27 行定义.
◆ StackFn
| using eve::inventory::InventorySystem::StackFn = std::function<bool(const ItemStack &a, const ItemStack &b, const ItemDefinition &def)> |
在文件 InventorySystem.h 第 25 行定义.
成员函数说明
◆ addItem()
|
static |
返回实际放入数量(可能部分成功)。
在文件 InventorySystem.cpp 第 288 行定义.
引用了 eve::inventory::InventoryChangeEvent::action, eve::inventory::InventoryChangeEvent::bagId, eve::inventory::ItemRegistry::find(), eve::inventory::Bag::getId(), eve::inventory::Bag::getSlotCount(), eve::inventory::ItemDefinition::id, eve::inventory::InventoryChangeEvent::itemId, nextInstanceId(), eve::inventory::InventoryChangeEvent::quantity, s , 以及 eve::inventory::Bag::slots().
被这些函数引用 eve::inventory::Bag::addItem(), transfer(), transferSlot() , 以及 unequipToBag().
◆ canAdd()
|
static |
◆ clearBag()
|
static |
◆ clearEvents()
|
static |
在文件 InventorySystem.cpp 第 214 行定义.
◆ countItem()
|
static |
在文件 InventorySystem.cpp 第 613 行定义.
引用了 n, s , 以及 eve::inventory::Bag::slots().
被这些函数引用 eve::inventory::Bag::countItem() , 以及 transfer().
◆ ensureBuiltins()
|
static |
确保内置规则已注册(模块首次使用时自动调用)。
在文件 InventorySystem.cpp 第 111 行定义.
引用了 a, eve::inventory::Bag::acceptTags(), b, eve::inventory::Bag::getMaxVolume(), eve::inventory::Bag::getMaxWeight(), eve::inventory::Bag::getSlotCount(), registerAcceptRule(), registerCapacityPolicy(), registerStackRule(), eve::inventory::Bag::rejectTags(), eve::inventory::ItemDefinition::tags, usedVolume(), usedWeight(), eve::inventory::ItemDefinition::volume , 以及 eve::inventory::ItemDefinition::weight.
被这些函数引用 hasAcceptRule(), hasCapacityPolicy(), hasStackRule(), eve::inventory::Inventory::newBag(), eve::inventory::Inventory::newEquipmentSet() , 以及 eve::inventory::Inventory::registerItemsFromJson().
◆ equipFromBag()
|
static |
在文件 InventorySystem.cpp 第 684 行定义.
引用了 eve::inventory::InventoryChangeEvent::action, eve::inventory::InventoryChangeEvent::bagId, eve::inventory::EquipmentSet::canEquipFromBag(), eve::inventory::ItemStack::clear(), eve::inventory::InventoryChangeEvent::equipSlot, eve::inventory::Bag::getId(), eve::inventory::InventoryChangeEvent::itemId, eve::inventory::InventoryChangeEvent::quantity, eve::inventory::InventoryChangeEvent::slot, eve::inventory::Bag::slots() , 以及 eve::inventory::EquipmentSet::stackAt().
◆ events()
|
static |
在文件 InventorySystem.cpp 第 216 行定义.
被这些函数引用 eve::inventory::Inventory::getChangeEventAction(), eve::inventory::Inventory::getChangeEventBagId(), eve::inventory::Inventory::getChangeEventCount(), eve::inventory::Inventory::getChangeEventEquipSlot(), eve::inventory::Inventory::getChangeEventItemId(), eve::inventory::Inventory::getChangeEventOtherBagId(), eve::inventory::Inventory::getChangeEventOtherSlot(), eve::inventory::Inventory::getChangeEventQuantity() , 以及 eve::inventory::Inventory::getChangeEventSlot().
◆ findItem()
|
static |
在文件 InventorySystem.cpp 第 622 行定义.
引用了 eve::inventory::Bag::getSlotCount(), s , 以及 eve::inventory::Bag::slots().
被这些函数引用 eve::inventory::Bag::findItem().
◆ findItemByTag()
|
static |
◆ hasAcceptRule()
|
static |
在文件 InventorySystem.cpp 第 69 行定义.
引用了 ensureBuiltins() , 以及 name.
◆ hasCapacityPolicy()
|
static |
在文件 InventorySystem.cpp 第 83 行定义.
引用了 ensureBuiltins() , 以及 name.
◆ hasChangeHook()
|
static |
在文件 InventorySystem.cpp 第 107 行定义.
引用了 name.
◆ hasStackRule()
|
static |
在文件 InventorySystem.cpp 第 95 行定义.
引用了 ensureBuiltins() , 以及 name.
◆ moveSlot()
|
static |
在文件 InventorySystem.cpp 第 406 行定义.
引用了 eve::inventory::InventoryChangeEvent::action, eve::inventory::InventoryChangeEvent::bagId, eve::inventory::ItemRegistry::find(), eve::inventory::Bag::getId(), eve::inventory::Bag::getSlotCount(), eve::inventory::InventoryChangeEvent::itemId, eve::inventory::ItemDefinition::maxStack, eve::inventory::InventoryChangeEvent::otherSlot, eve::inventory::InventoryChangeEvent::quantity, eve::inventory::InventoryChangeEvent::slot, eve::inventory::Bag::slots() , 以及 swapSlots().
被这些函数引用 eve::inventory::Bag::moveSlot().
◆ nextInstanceId()
|
static |
在文件 InventorySystem.cpp 第 198 行定义.
被这些函数引用 addItem(), splitStack(), transferSlot() , 以及 unequipToBag().
◆ pollEvents()
|
static |
在文件 InventorySystem.cpp 第 209 行定义.
◆ pushEvent()
|
static |
在文件 InventorySystem.cpp 第 207 行定义.
◆ registerAcceptRule()
|
static |
◆ registerCapacityPolicy()
|
static |
◆ registerChangeHook()
|
static |
在文件 InventorySystem.cpp 第 100 行定义.
◆ registerStackRule()
|
static |
◆ removeAt()
|
static |
在文件 InventorySystem.cpp 第 374 行定义.
引用了 eve::inventory::InventoryChangeEvent::action, eve::inventory::InventoryChangeEvent::bagId, eve::inventory::Bag::getId(), eve::inventory::Bag::getSlotCount(), eve::inventory::InventoryChangeEvent::itemId, eve::inventory::InventoryChangeEvent::quantity, s, eve::inventory::InventoryChangeEvent::slot , 以及 eve::inventory::Bag::slots().
被这些函数引用 eve::inventory::Bag::removeAt().
◆ removeItem()
|
static |
在文件 InventorySystem.cpp 第 350 行定义.
引用了 eve::inventory::InventoryChangeEvent::action, eve::inventory::InventoryChangeEvent::bagId, eve::inventory::Bag::getId(), eve::inventory::Bag::getSlotCount(), eve::inventory::InventoryChangeEvent::itemId, eve::inventory::InventoryChangeEvent::quantity, removed, s , 以及 eve::inventory::Bag::slots().
被这些函数引用 eve::inventory::Bag::removeItem().
◆ splitStack()
|
static |
在文件 InventorySystem.cpp 第 451 行定义.
引用了 eve::inventory::InventoryChangeEvent::action, eve::inventory::InventoryChangeEvent::bagId, eve::inventory::Bag::getId(), eve::inventory::Bag::getSlotCount(), eve::inventory::InventoryChangeEvent::itemId, nextInstanceId(), eve::inventory::InventoryChangeEvent::otherSlot, eve::inventory::InventoryChangeEvent::quantity, eve::inventory::InventoryChangeEvent::slot , 以及 eve::inventory::Bag::slots().
被这些函数引用 eve::inventory::Bag::splitStack().
◆ swapSlots()
|
static |
在文件 InventorySystem.cpp 第 392 行定义.
引用了 eve::inventory::InventoryChangeEvent::action, eve::inventory::InventoryChangeEvent::bagId, eve::inventory::Bag::getId(), eve::inventory::Bag::getSlotCount(), eve::inventory::InventoryChangeEvent::otherSlot, eve::inventory::InventoryChangeEvent::slot , 以及 eve::inventory::Bag::slots().
被这些函数引用 moveSlot() , 以及 eve::inventory::Bag::swapSlots().
◆ transfer()
|
static |
在文件 InventorySystem.cpp 第 476 行定义.
引用了 eve::inventory::InventoryChangeEvent::action, addItem(), eve::inventory::InventoryChangeEvent::bagId, canAdd(), countItem(), eve::inventory::Bag::getId(), eve::inventory::Bag::getSlotCount(), eve::inventory::InventoryChangeEvent::itemId, n, eve::inventory::InventoryChangeEvent::otherBagId, eve::inventory::InventoryChangeEvent::quantity, s , 以及 eve::inventory::Bag::slots().
◆ transferSlot()
|
static |
在文件 InventorySystem.cpp 第 516 行定义.
引用了 eve::inventory::InventoryChangeEvent::action, addItem(), eve::inventory::InventoryChangeEvent::bagId, canAdd(), eve::inventory::ItemRegistry::find(), eve::inventory::Bag::getId(), eve::inventory::Bag::getSlotCount(), eve::inventory::InventoryChangeEvent::itemId, eve::inventory::ItemDefinition::maxStack, n, nextInstanceId(), eve::inventory::InventoryChangeEvent::otherBagId, eve::inventory::InventoryChangeEvent::otherSlot, eve::inventory::InventoryChangeEvent::quantity, s, eve::inventory::InventoryChangeEvent::slot , 以及 eve::inventory::Bag::slots().
◆ unequipToBag()
|
static |
在文件 InventorySystem.cpp 第 719 行定义.
引用了 eve::inventory::InventoryChangeEvent::action, addItem(), eve::inventory::InventoryChangeEvent::bagId, canAdd(), eve::inventory::InventoryChangeEvent::equipSlot, eve::inventory::Bag::getId(), eve::inventory::Bag::getSlotCount(), eve::inventory::ItemStack::itemId, eve::inventory::InventoryChangeEvent::itemId, nextInstanceId(), eve::inventory::InventoryChangeEvent::quantity, eve::inventory::InventoryChangeEvent::slot, eve::inventory::Bag::slots() , 以及 eve::inventory::EquipmentSet::stackAt().
◆ unregisterAcceptRule()
|
static |
在文件 InventorySystem.cpp 第 67 行定义.
引用了 name.
◆ unregisterCapacityPolicy()
|
static |
在文件 InventorySystem.cpp 第 79 行定义.
引用了 name.
◆ unregisterChangeHook()
|
static |
在文件 InventorySystem.cpp 第 105 行定义.
引用了 name.
◆ unregisterStackRule()
|
static |
在文件 InventorySystem.cpp 第 93 行定义.
引用了 name.
◆ usedSlotCount()
|
static |
在文件 InventorySystem.cpp 第 665 行定义.
引用了 n, s , 以及 eve::inventory::Bag::slots().
◆ usedVolume()
|
static |
在文件 InventorySystem.cpp 第 654 行定义.
引用了 eve::inventory::ItemRegistry::find(), s, eve::inventory::Bag::slots(), v , 以及 eve::inventory::ItemDefinition::volume.
被这些函数引用 ensureBuiltins() , 以及 eve::inventory::Bag::getUsedVolume().
◆ usedWeight()
|
static |
在文件 InventorySystem.cpp 第 643 行定义.
引用了 eve::inventory::ItemRegistry::find(), s, eve::inventory::Bag::slots(), w , 以及 eve::inventory::ItemDefinition::weight.
被这些函数引用 ensureBuiltins() , 以及 eve::inventory::Bag::getUsedWeight().
该类的文档由以下文件生成:
- src/modules/inventory/InventorySystem.h
- src/modules/inventory/InventorySystem.cpp