本文整理汇总了C++中ItemInstance::GetItem方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemInstance::GetItem方法的具体用法?C++ ItemInstance::GetItem怎么用?C++ ItemInstance::GetItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemInstance
的用法示例。
在下文中一共展示了ItemInstance::GetItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _ComputePersistentStatModifiers
Void CharStatPackage::_ComputePersistentStatModifiers()
{
// Modifiers from passives
for( UInt i = 0; i < CHARSTAT_COUNT; ++i )
m_arrPassiveStatModifier[i] = 0.0f;
m_pOwner->EnumSkills();
SkillInstance * pSkillInstance = m_pOwner->EnumNextSkill();
while( pSkillInstance != NULL ) {
if ( pSkillInstance->IsPassive() ) {
const Scalar * arrBonus = ( (PassiveSkill*)(pSkillInstance->GetSkill()) )->GetStatBonus();
for( UInt i = 0; i < CHARSTAT_COUNT; ++i )
m_arrPassiveStatModifier[i] += arrBonus[i];
}
pSkillInstance = m_pOwner->EnumNextSkill();
}
// Modifiers from items
for( UInt i = 0; i < CHARSTAT_COUNT; ++i )
m_arrItemStatModifier[i] = 0.0f;
for( UInt i = 0; i < EQUIPSLOTID_COUNT; ++i ) {
ItemInstance * pItemInstance = m_pOwner->GetItem( (EquipmentSoltID)i );
if ( pItemInstance->IsEmpty() )
continue;
Assert( pItemInstance->GetItem()->GetType() == ITEMTYPE_EQUIPMENT );
EquipmentItem * pItem = (EquipmentItem*)( pItemInstance->GetItem() );
const Scalar * arrBonus = pItem->GetStatBonus();
for( UInt j = 0; j < CHARSTAT_COUNT; ++j )
m_arrItemStatModifier[j] += arrBonus[j];
}
// Final stats
for( UInt i = 0; i < CHARSTAT_COUNT; ++i )
m_arrFinalStat[i] = ( m_arrModdedStat[i] + m_arrPassiveStatModifier[i] + m_arrItemStatModifier[i] );
}
示例2:
// Remove all items from container
void EQEmu::ItemInstance::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent)
{
// TODO: This needs work...
// Destroy container contents
std::map<uint8, ItemInstance*>::const_iterator cur, end, del;
cur = m_contents.begin();
end = m_contents.end();
for (; cur != end;) {
ItemInstance* inst = cur->second;
if (inst == nullptr) {
cur = m_contents.erase(cur);
continue;
}
const ItemData* item = inst->GetItem();
if (item == nullptr) {
cur = m_contents.erase(cur);
continue;
}
del = cur;
++cur;
switch (is_nodrop) {
case byFlagSet:
if (item->NoDrop == 0) {
safe_delete(inst);
m_contents.erase(del->first);
continue;
}
// no 'break;' deletes 'byFlagNotSet' type - can't add at the moment because it really *breaks* the process somewhere
case byFlagNotSet:
if (item->NoDrop != 0) {
safe_delete(inst);
m_contents.erase(del->first);
continue;
}
default:
break;
}
switch (is_norent) {
case byFlagSet:
if (item->NoRent == 0) {
safe_delete(inst);
m_contents.erase(del->first);
continue;
}
// no 'break;' deletes 'byFlagNotSet' type - can't add at the moment because it really *breaks* the process somewhere
case byFlagNotSet:
if (item->NoRent != 0) {
safe_delete(inst);
m_contents.erase(del->first);
continue;
}
default:
break;
}
}
}