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

背包模块(eve.Inventory)。 更多...

#include <Inventory.h>

类 eve::inventory::Inventory 继承关系图:
eve::Module

Public 成员函数

 Module_REG (Inventory)
 
 Inventory ()
 Inventory.
 
 ~Inventory () override
 Inventory.
 
int registerItemsFromJson (const std::string &json)
 从 JSON 注册物品定义;返回成功注册数量。
 
void clearItemDefinitions ()
 清空物品定义。
 
int getItemDefinitionCount ()
 已注册物品定义数量。
 
bool hasItemDefinition (const std::string &itemId)
 物品定义查询(显示名/堆叠/重量/体积/类别/装备槽/标签/额外属性)。
 
std::string getItemDisplayName (const std::string &itemId)
 Returns the item display name.
 
int getItemMaxStack (const std::string &itemId)
 Returns the item max stack.
 
float getItemWeight (const std::string &itemId)
 Returns the item weight.
 
float getItemVolume (const std::string &itemId)
 Returns the item volume.
 
std::string getItemCategory (const std::string &itemId)
 Returns the item category.
 
std::string getItemEquipSlot (const std::string &itemId)
 Returns the item equip slot.
 
bool itemHasTag (const std::string &itemId, const std::string &tag)
 Item has tag.
 
std::string getItemExtra (const std::string &itemId, const std::string &key, const std::string &fallback={})
 Returns the item extra.
 
Bag * newBag (int slotCount)
 工厂:创建容器 / 装备栏。
 
EquipmentSet * newEquipmentSet ()
 Creates a equipment set. @ownership Caller deletes unless documented otherwise.
 
int transferItem (Bag *from, Bag *to, const std::string &itemId, int quantity)
 跨容器转移(按物品 id / 按槽位);返回实际转移数量。
 
int transferSlot (Bag *from, int fromSlot, Bag *to, int quantity)
 Transfer slot.
 
bool hasAcceptRule (const std::string &name)
 扩展策略是否存在(接受规则 / 容量策略 / 堆叠规则)。
 
bool hasCapacityPolicy (const std::string &name)
 True when capacity policy.
 
bool hasStackRule (const std::string &name)
 True when stack rule.
 
void clearChangeEvents ()
 变更事件队列(添加/移除/移动/装备)。
 
int getChangeEventCount () const
 Returns the change event count.
 
std::string getChangeEventAction (int index) const
 Returns the change event action.
 
std::string getChangeEventBagId (int index) const
 Returns the change event bag id.
 
std::string getChangeEventOtherBagId (int index) const
 Returns the change event other bag id.
 
std::string getChangeEventItemId (int index) const
 Returns the change event item id.
 
int getChangeEventQuantity (int index) const
 Returns the change event quantity.
 
int getChangeEventSlot (int index) const
 Returns the change event slot.
 
int getChangeEventOtherSlot (int index) const
 Returns the change event other slot.
 
std::string getChangeEventEquipSlot (int index) const
 Returns the change event equip slot.
 
eve::Result< void > publishGameplay (const std::string &instanceId, const std::string &ownerId, Bag *bag, EquipmentSet *equipment=nullptr)
 把一个玩家背包实例发布到共享玩法协议(eve_gameplay / MCP)。
 
eve::Result< void > unpublishGameplay (const std::string &instanceId)
 取消发布一个实例;该实例未发布(或 id 非法)时返回诊断。
 
void clearGameplayControls ()
 取消发布本模块持有的全部玩法实例。
 
int gameplayControlCount () const
 已发布的玩法实例数量。
 
std::vector< std::string > gameplayInstances () const
 已发布的玩法实例标识(发布顺序)。
 
- Public 成员函数 继承自 eve::Module
virtual ~Module ()
 Module.
 
virtual std::string getName () const =0
 Returns the name.
 

详细描述

背包模块(eve.Inventory)。

在文件 Inventory.h 第 24 行定义.

构造及析构函数说明

◆ Inventory()

eve::inventory::Inventory::Inventory ( )
default

◆ ~Inventory()

eve::inventory::Inventory::~Inventory ( )
override

Inventory.

在文件 Inventory.cpp 第 317 行定义.

成员函数说明

◆ clearChangeEvents()

void eve::inventory::Inventory::clearChangeEvents ( )

变更事件队列(添加/移除/移动/装备)。

在文件 Inventory.cpp 第 101 行定义.

引用了 eve::inventory::InventorySystem::clearEvents().

◆ clearGameplayControls()

void eve::inventory::Inventory::clearGameplayControls ( )

取消发布本模块持有的全部玩法实例。

在文件 Inventory.cpp 第 347 行定义.

◆ clearItemDefinitions()

void eve::inventory::Inventory::clearItemDefinitions ( )

清空物品定义。

在文件 Inventory.cpp 第 22 行定义.

引用了 eve::inventory::ItemRegistry::clear().

◆ gameplayControlCount()

int eve::inventory::Inventory::gameplayControlCount ( ) const

已发布的玩法实例数量。

在文件 Inventory.cpp 第 351 行定义.

◆ gameplayInstances()

std::vector< std::string > eve::inventory::Inventory::gameplayInstances ( ) const

已发布的玩法实例标识(发布顺序)。

在文件 Inventory.cpp 第 353 行定义.

◆ getChangeEventAction()

std::string eve::inventory::Inventory::getChangeEventAction ( int  index) const

Returns the change event action.

在文件 Inventory.cpp 第 107 行定义.

引用了 eve::inventory::InventorySystem::events() , 以及 index.

◆ getChangeEventBagId()

std::string eve::inventory::Inventory::getChangeEventBagId ( int  index) const

Returns the change event bag id.

在文件 Inventory.cpp 第 113 行定义.

引用了 eve::inventory::InventorySystem::events() , 以及 index.

◆ getChangeEventCount()

int eve::inventory::Inventory::getChangeEventCount ( ) const

Returns the change event count.

在文件 Inventory.cpp 第 103 行定义.

引用了 eve::inventory::InventorySystem::events() , 以及 size.

◆ getChangeEventEquipSlot()

std::string eve::inventory::Inventory::getChangeEventEquipSlot ( int  index) const

Returns the change event equip slot.

在文件 Inventory.cpp 第 149 行定义.

引用了 eve::inventory::InventorySystem::events() , 以及 index.

◆ getChangeEventItemId()

std::string eve::inventory::Inventory::getChangeEventItemId ( int  index) const

Returns the change event item id.

在文件 Inventory.cpp 第 125 行定义.

引用了 eve::inventory::InventorySystem::events() , 以及 index.

◆ getChangeEventOtherBagId()

std::string eve::inventory::Inventory::getChangeEventOtherBagId ( int  index) const

Returns the change event other bag id.

在文件 Inventory.cpp 第 119 行定义.

引用了 eve::inventory::InventorySystem::events() , 以及 index.

◆ getChangeEventOtherSlot()

int eve::inventory::Inventory::getChangeEventOtherSlot ( int  index) const

Returns the change event other slot.

在文件 Inventory.cpp 第 143 行定义.

引用了 eve::inventory::InventorySystem::events() , 以及 index.

◆ getChangeEventQuantity()

int eve::inventory::Inventory::getChangeEventQuantity ( int  index) const

Returns the change event quantity.

在文件 Inventory.cpp 第 131 行定义.

引用了 eve::inventory::InventorySystem::events() , 以及 index.

◆ getChangeEventSlot()

int eve::inventory::Inventory::getChangeEventSlot ( int  index) const

Returns the change event slot.

在文件 Inventory.cpp 第 137 行定义.

引用了 eve::inventory::InventorySystem::events() , 以及 index.

◆ getItemCategory()

std::string eve::inventory::Inventory::getItemCategory ( const std::string &  itemId)

Returns the item category.

在文件 Inventory.cpp 第 50 行定义.

引用了 eve::inventory::ItemRegistry::find() , 以及 itemId.

◆ getItemDefinitionCount()

int eve::inventory::Inventory::getItemDefinitionCount ( )

已注册物品定义数量。

在文件 Inventory.cpp 第 24 行定义.

引用了 eve::inventory::ItemRegistry::count().

◆ getItemDisplayName()

std::string eve::inventory::Inventory::getItemDisplayName ( const std::string &  itemId)

Returns the item display name.

在文件 Inventory.cpp 第 30 行定义.

引用了 eve::inventory::ItemRegistry::find() , 以及 itemId.

◆ getItemEquipSlot()

std::string eve::inventory::Inventory::getItemEquipSlot ( const std::string &  itemId)

Returns the item equip slot.

在文件 Inventory.cpp 第 55 行定义.

引用了 eve::inventory::ItemRegistry::find() , 以及 itemId.

◆ getItemExtra()

std::string eve::inventory::Inventory::getItemExtra ( const std::string &  itemId,
const std::string &  key,
const std::string &  fallback = {} 
)

Returns the item extra.

在文件 Inventory.cpp 第 65 行定义.

引用了 eve::inventory::ItemRegistry::find(), itemId , 以及 key.

◆ getItemMaxStack()

int eve::inventory::Inventory::getItemMaxStack ( const std::string &  itemId)

Returns the item max stack.

在文件 Inventory.cpp 第 35 行定义.

引用了 eve::inventory::ItemRegistry::find() , 以及 itemId.

◆ getItemVolume()

float eve::inventory::Inventory::getItemVolume ( const std::string &  itemId)

Returns the item volume.

在文件 Inventory.cpp 第 45 行定义.

引用了 eve::inventory::ItemRegistry::find() , 以及 itemId.

◆ getItemWeight()

float eve::inventory::Inventory::getItemWeight ( const std::string &  itemId)

Returns the item weight.

在文件 Inventory.cpp 第 40 行定义.

引用了 eve::inventory::ItemRegistry::find() , 以及 itemId.

◆ hasAcceptRule()

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

扩展策略是否存在(接受规则 / 容量策略 / 堆叠规则)。

在文件 Inventory.cpp 第 89 行定义.

引用了 eve::inventory::InventorySystem::hasAcceptRule().

◆ hasCapacityPolicy()

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

True when capacity policy.

在文件 Inventory.cpp 第 93 行定义.

引用了 eve::inventory::InventorySystem::hasCapacityPolicy().

◆ hasItemDefinition()

bool eve::inventory::Inventory::hasItemDefinition ( const std::string &  itemId)

物品定义查询(显示名/堆叠/重量/体积/类别/装备槽/标签/额外属性)。

在文件 Inventory.cpp 第 26 行定义.

引用了 eve::inventory::ItemRegistry::find() , 以及 itemId.

◆ hasStackRule()

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

True when stack rule.

在文件 Inventory.cpp 第 97 行定义.

引用了 eve::inventory::InventorySystem::hasStackRule().

◆ itemHasTag()

bool eve::inventory::Inventory::itemHasTag ( const std::string &  itemId,
const std::string &  tag 
)

Item has tag.

在文件 Inventory.cpp 第 60 行定义.

引用了 eve::inventory::ItemRegistry::find(), itemId , 以及 tag.

◆ Module_REG()

eve::inventory::Inventory::Module_REG ( Inventory  )

◆ newBag()

Bag * eve::inventory::Inventory::newBag ( int  slotCount)

工厂:创建容器 / 装备栏。

在文件 Inventory.cpp 第 71 行定义.

引用了 eve::inventory::InventorySystem::ensureBuiltins().

◆ newEquipmentSet()

EquipmentSet * eve::inventory::Inventory::newEquipmentSet ( )

Creates a equipment set. @ownership Caller deletes unless documented otherwise.

在文件 Inventory.cpp 第 76 行定义.

引用了 eve::inventory::InventorySystem::ensureBuiltins().

◆ publishGameplay()

eve::Result< void > eve::inventory::Inventory::publishGameplay ( const std::string &  instanceId,
const std::string &  ownerId,
Bag *  bag,
EquipmentSet *  equipment = nullptr 
)

把一个玩家背包实例发布到共享玩法协议(eve_gameplay / MCP)。

领域动作词表就是本模块自己的操作(add/remove/split/equip/unequip), 因此 Agent 与玩家走同一条权威写入路径,而不是另开一条调试旁路。 一个模块只注册一个领域适配器(共享路由器要求每个领域唯一),该适配器 服务全部已发布实例;同一 instanceId 重复发布返回 Conflict。

参数
instanceId实例稳定标识,必须是规范持久 id(UUID 文本,如 00000000-0000-7000-8000-000000000701),与 eve_gameplay 的 request.instance 逐字一致。
ownerId控制该实例的玩家/角色稳定标识,同为规范持久 id (session.controlledSubjects 校验用)。
bag借用容器,必须比本次发布存活更久。
equipment借用装备栏,可为 null(则实例没有装备动作)。
返回
成功时返回空结果;实例 id 非法、重复或 bag 为空时返回诊断。 @ownership 适配器由本模块持有并随模块销毁;bag / equipment 所有权不变。 @thread 所有者模拟线程。

在文件 Inventory.cpp 第 319 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::SubjectRef::fromPersistentId(), eve::InvalidArgument , 以及 eve::detail::Id128< Tag >::parse().

◆ registerItemsFromJson()

int eve::inventory::Inventory::registerItemsFromJson ( const std::string &  json)

从 JSON 注册物品定义;返回成功注册数量。

在文件 Inventory.cpp 第 17 行定义.

引用了 eve::inventory::InventorySystem::ensureBuiltins() , 以及 eve::inventory::ItemRegistry::loadFromJson().

◆ transferItem()

int eve::inventory::Inventory::transferItem ( Bag *  from,
Bag *  to,
const std::string &  itemId,
int  quantity 
)

跨容器转移(按物品 id / 按槽位);返回实际转移数量。

在文件 Inventory.cpp 第 81 行定义.

引用了 from, itemId, to , 以及 eve::inventory::InventorySystem::transfer().

◆ transferSlot()

int eve::inventory::Inventory::transferSlot ( Bag *  from,
int  fromSlot,
Bag *  to,
int  quantity 
)

Transfer slot.

在文件 Inventory.cpp 第 85 行定义.

引用了 from, to , 以及 eve::inventory::InventorySystem::transferSlot().

◆ unpublishGameplay()

eve::Result< void > eve::inventory::Inventory::unpublishGameplay ( const std::string &  instanceId)

取消发布一个实例;该实例未发布(或 id 非法)时返回诊断。

在文件 Inventory.cpp 第 336 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::SubjectRef::fromPersistentId(), eve::InvalidArgument, eve::NotFound , 以及 eve::detail::Id128< Tag >::parse().


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