本文整理汇总了C++中Item::GetEnchantment方法的典型用法代码示例。如果您正苦于以下问题:C++ Item::GetEnchantment方法的具体用法?C++ Item::GetEnchantment怎么用?C++ Item::GetEnchantment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item
的用法示例。
在下文中一共展示了Item::GetEnchantment方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Shiv
bool Shiv(uint8_t /*effectIndex*/, Spell* pSpell)
{
Unit* pTarget = pSpell->GetUnitTarget();
if (!pSpell->p_caster || !pTarget) return true;
pSpell->p_caster->castSpell(pTarget->getGuid(), 5940, true);
Item* it = pSpell->p_caster->getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_OFFHAND);
if (!it)
return true;
EnchantmentInstance* ench = it->GetEnchantment(TEMP_ENCHANTMENT_SLOT);
if (ench)
{
DBC::Structures::SpellItemEnchantmentEntry const* Entry = ench->Enchantment;
for (uint8 c = 0; c < 3; c++)
{
if (Entry->type[c] && Entry->spell[c])
{
SpellInfo const* sp = sSpellMgr.getSpellInfo(Entry->spell[c]);
if (!sp) return true;
if (sp->custom_c_is_flags & SPELL_FLAG_IS_POISON)
{
pSpell->p_caster->castSpell(pTarget->getGuid(), Entry->spell[c], true);
}
}
}
}
return true;
}
示例2: Init
void Init(Object* obj)
{
if(obj == NULL)
{
mDeleted = true;
//initializing anyway all fields.
mItemGUID = 0;
damage = 0;
return;
}
mItemGUID = obj->GetGUID();
damage = 0;
uint32 wp_speed;
Item* item = TO_ITEM(obj);
EnchantmentInstance* enchant = item->GetEnchantment(TEMP_ENCHANTMENT_SLOT);
if(enchant != NULL)
{
SpellEntry* sp = dbcSpell.LookupEntryForced(enchant->Enchantment->spell[0]);
if(sp != NULL && sp->NameHash == SPELL_HASH_FLAMETONGUE_WEAPON__PASSIVE_)
{
wp_speed = item->GetProto()->Delay;
damage = (sp->EffectBasePoints[0] + 1) * wp_speed / 100000;
}
}
}
示例3: Init
void Init(Object* obj)
{
if (obj == NULL)
{
mDeleted = true;
//initializing anyway all fields.
mItemGUID = 0;
damage = 0;
return;
}
mItemGUID = obj->GetGUID();
damage = 0;
uint32 wp_speed;
Item* item = static_cast< Item* >(obj);
EnchantmentInstance* enchant = item->GetEnchantment(TEMP_ENCHANTMENT_SLOT);
if (enchant != nullptr)
{
SpellInfo* sp = sSpellCustomizations.GetSpellInfo(enchant->Enchantment->spell[0]);
if (sp != nullptr && sp->custom_NameHash == SPELL_HASH_FLAMETONGUE_WEAPON__PASSIVE_)
{
wp_speed = item->GetItemProperties()->Delay;
damage = (sp->EffectBasePoints[0] + 1) * wp_speed / 100000;
}
}
}
示例4: Shiv
bool Shiv(uint32 i, Spell* pSpell)
{
Unit* pTarget = pSpell->GetUnitTarget();
if(!pSpell->p_caster || !pTarget) return true;
pSpell->p_caster->CastSpell(pTarget->GetGUID(), 5940, true);
Item* it = pSpell->p_caster->GetItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_OFFHAND);
if(!it) return true;
EnchantmentInstance* ench = it->GetEnchantment(TEMP_ENCHANTMENT_SLOT);
if(ench)
{
EnchantEntry* Entry = ench->Enchantment;
for(uint32 c = 0; c < 3; c++)
{
if(Entry->type[c] && Entry->spell[c])
{
SpellEntry* sp = dbcSpell.LookupEntry(Entry->spell[c]);
if(!sp) return true;
if(sp->c_is_flags & SPELL_FLAG_IS_POISON)
{
pSpell->p_caster->CastSpell(pTarget->GetGUID(), Entry->spell[c], true);
}
}
}
}
return true;
}