载入中...
搜索中...
未找到
eve::inventory::InventorySystem类 参考

#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.h19 行定义.

成员类型定义说明

◆ AcceptFn

using eve::inventory::InventorySystem::AcceptFn = std::function<bool(const Bag &bag, const ItemDefinition &def, int quantity, std::string *reason)>

在文件 InventorySystem.h21 行定义.

◆ CapacityFn

using eve::inventory::InventorySystem::CapacityFn = std::function<bool(const Bag &bag, const ItemDefinition &def, int quantity, std::string *reason)>

在文件 InventorySystem.h23 行定义.

◆ ChangeHook

using eve::inventory::InventorySystem::ChangeHook = std::function<void(const InventoryChangeEvent &ev)>

在文件 InventorySystem.h27 行定义.

◆ StackFn

using eve::inventory::InventorySystem::StackFn = std::function<bool(const ItemStack &a, const ItemStack &b, const ItemDefinition &def)>

在文件 InventorySystem.h25 行定义.

成员函数说明

◆ addItem()

◆ canAdd()

bool eve::inventory::InventorySystem::canAdd ( Bag bag,
const std::string &  itemId,
int  quantity,
std::string *  reason = nullptr 
)
static

◆ clearBag()

◆ clearEvents()

void eve::inventory::InventorySystem::clearEvents ( )
static

在文件 InventorySystem.cpp214 行定义.

被这些函数引用 eve::inventory::Inventory::clearChangeEvents().

◆ countItem()

int eve::inventory::InventorySystem::countItem ( const Bag bag,
const std::string &  itemId 
)
static

在文件 InventorySystem.cpp613 行定义.

引用了 n, s , 以及 eve::inventory::Bag::slots().

被这些函数引用 eve::inventory::Bag::countItem() , 以及 transfer().

◆ ensureBuiltins()

◆ equipFromBag()

◆ events()

◆ findItem()

int eve::inventory::InventorySystem::findItem ( const Bag bag,
const std::string &  itemId 
)
static

◆ findItemByTag()

int eve::inventory::InventorySystem::findItemByTag ( const Bag bag,
const std::string &  tag 
)
static

◆ hasAcceptRule()

bool eve::inventory::InventorySystem::hasAcceptRule ( const std::string &  name)
static

在文件 InventorySystem.cpp69 行定义.

引用了 ensureBuiltins() , 以及 name.

被这些函数引用 eve::inventory::Inventory::hasAcceptRule().

◆ hasCapacityPolicy()

bool eve::inventory::InventorySystem::hasCapacityPolicy ( const std::string &  name)
static

在文件 InventorySystem.cpp83 行定义.

引用了 ensureBuiltins() , 以及 name.

被这些函数引用 eve::inventory::Inventory::hasCapacityPolicy().

◆ hasChangeHook()

bool eve::inventory::InventorySystem::hasChangeHook ( const std::string &  name)
static

在文件 InventorySystem.cpp107 行定义.

引用了 name.

◆ hasStackRule()

bool eve::inventory::InventorySystem::hasStackRule ( const std::string &  name)
static

在文件 InventorySystem.cpp95 行定义.

引用了 ensureBuiltins() , 以及 name.

被这些函数引用 eve::inventory::Inventory::hasStackRule().

◆ moveSlot()

◆ nextInstanceId()

int eve::inventory::InventorySystem::nextInstanceId ( )
static

在文件 InventorySystem.cpp198 行定义.

被这些函数引用 addItem(), splitStack(), transferSlot() , 以及 unequipToBag().

◆ pollEvents()

void eve::inventory::InventorySystem::pollEvents ( std::vector< InventoryChangeEvent > &  out)
static

在文件 InventorySystem.cpp209 行定义.

◆ pushEvent()

void eve::inventory::InventorySystem::pushEvent ( InventoryChangeEvent  ev)
static

在文件 InventorySystem.cpp207 行定义.

被这些函数引用 eve::inventory::EquipmentSet::clearSlot().

◆ registerAcceptRule()

void eve::inventory::InventorySystem::registerAcceptRule ( const std::string &  name,
AcceptFn  fn 
)
static

在文件 InventorySystem.cpp62 行定义.

引用了 fn , 以及 name.

被这些函数引用 ensureBuiltins().

◆ registerCapacityPolicy()

void eve::inventory::InventorySystem::registerCapacityPolicy ( const std::string &  name,
CapacityFn  fn 
)
static

在文件 InventorySystem.cpp74 行定义.

引用了 fn , 以及 name.

被这些函数引用 ensureBuiltins().

◆ registerChangeHook()

void eve::inventory::InventorySystem::registerChangeHook ( const std::string &  name,
ChangeHook  fn 
)
static

在文件 InventorySystem.cpp100 行定义.

引用了 fn , 以及 name.

◆ registerStackRule()

void eve::inventory::InventorySystem::registerStackRule ( const std::string &  name,
StackFn  fn 
)
static

在文件 InventorySystem.cpp88 行定义.

引用了 fn , 以及 name.

被这些函数引用 ensureBuiltins().

◆ removeAt()

◆ removeItem()

◆ splitStack()

◆ swapSlots()

◆ transfer()

◆ transferSlot()

◆ unequipToBag()

◆ unregisterAcceptRule()

void eve::inventory::InventorySystem::unregisterAcceptRule ( const std::string &  name)
static

在文件 InventorySystem.cpp67 行定义.

引用了 name.

◆ unregisterCapacityPolicy()

void eve::inventory::InventorySystem::unregisterCapacityPolicy ( const std::string &  name)
static

在文件 InventorySystem.cpp79 行定义.

引用了 name.

◆ unregisterChangeHook()

void eve::inventory::InventorySystem::unregisterChangeHook ( const std::string &  name)
static

在文件 InventorySystem.cpp105 行定义.

引用了 name.

◆ unregisterStackRule()

void eve::inventory::InventorySystem::unregisterStackRule ( const std::string &  name)
static

在文件 InventorySystem.cpp93 行定义.

引用了 name.

◆ usedSlotCount()

int eve::inventory::InventorySystem::usedSlotCount ( const Bag bag)
static

在文件 InventorySystem.cpp665 行定义.

引用了 n, s , 以及 eve::inventory::Bag::slots().

被这些函数引用 eve::inventory::Bag::getUsedSlotCount().

◆ usedVolume()

float eve::inventory::InventorySystem::usedVolume ( const Bag bag)
static

◆ usedWeight()

float eve::inventory::InventorySystem::usedWeight ( const Bag bag)
static

该类的文档由以下文件生成: