本文整理汇总了C++中CGameItemPtr::computeItemWornState方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameItemPtr::computeItemWornState方法的具体用法?C++ CGameItemPtr::computeItemWornState怎么用?C++ CGameItemPtr::computeItemWornState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameItemPtr
的用法示例。
在下文中一共展示了CGameItemPtr::computeItemWornState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onItemChanged
// ****************************************************************************
void CCharacterInvView::onItemChanged(uint32 slot, INVENTORIES::TItemChangeFlags changeFlags)
{
H_AUTO(OnItemChange);
if ( changeFlags.checkEnumValue(INVENTORIES::itc_inserted)
|| changeFlags.checkEnumValue(INVENTORIES::itc_lock_state)
|| changeFlags.checkEnumValue(INVENTORIES::itc_enchant)
|| changeFlags.checkEnumValue(INVENTORIES::itc_worned)
)
{
const CGameItemPtr item = getInventory()->getItem(slot);
nlassert(item != NULL);
updateClientSlot(slot, item);
}
else if (changeFlags.checkEnumValue(INVENTORIES::itc_removed))
{
// Cleanup the item in player inventory
updateClientSlot(slot, NULL);
}
else if (changeFlags.checkEnumValue(INVENTORIES::itc_hp))
{
const CGameItemPtr item = getInventory()->getItem(slot);
nlassert(item != NULL);
// get new worn state
ITEM_WORN_STATE::TItemWornState wornState = item->getItemWornState();
item->computeItemWornState();
// if states differs send a message
if (wornState != item->getItemWornState())
{
if (getCharacter() != NULL)
{
string msgName = ITEM_WORN_STATE::getMessageForState(item->getItemWornState());
if ( !msgName.empty())
{
SM_STATIC_PARAMS_1(params, STRING_MANAGER::item);
params[0].SheetId = item->getSheetId();
CCharacter::sendDynamicSystemMessage( getCharacter()->getEntityRowId(), msgName, params);
}
}
}
// send slot update to the client
updateClientSlot(slot, item);
}
if (changeFlags.checkEnumValue(INVENTORIES::itc_info_version))
{
getCharacter()->_InventoryUpdater.syncInfoVersion(getInventory()->getInventoryId(), slot);
}
}