mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Spells: implemented SPELL_EFFECT_DESTROY_ITEM
This commit is contained in:
@@ -367,6 +367,7 @@ class Spell
|
||||
void EffectResurrectWithAura(SpellEffIndex effIndex);
|
||||
void EffectCreateAreaTrigger(SpellEffIndex effIndex);
|
||||
void EffectRemoveTalent(SpellEffIndex effIndex);
|
||||
void EffectDestroyItem(SpellEffIndex effIndex);
|
||||
|
||||
typedef std::set<Aura*> UsedSpellMods;
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
|
||||
&Spell::EffectGiveCurrency, //166 SPELL_EFFECT_GIVE_CURRENCY
|
||||
&Spell::EffectNULL, //167 SPELL_EFFECT_167
|
||||
&Spell::EffectNULL, //168 SPELL_EFFECT_ALLOW_CONTROL_PET
|
||||
&Spell::EffectNULL, //169 SPELL_EFFECT_DESTROY_ITEM
|
||||
&Spell::EffectDestroyItem, //169 SPELL_EFFECT_DESTROY_ITEM
|
||||
&Spell::EffectNULL, //170 SPELL_EFFECT_UPDATE_ZONE_AURAS_AND_PHASES
|
||||
&Spell::EffectNULL, //171 SPELL_EFFECT_171
|
||||
&Spell::EffectResurrectWithAura, //172 SPELL_EFFECT_RESURRECT_WITH_AURA
|
||||
@@ -5786,3 +5786,20 @@ void Spell::EffectRemoveTalent(SpellEffIndex /*effIndex*/)
|
||||
player->RemoveTalent(talent);
|
||||
player->SendTalentsInfoData();
|
||||
}
|
||||
|
||||
void Spell::EffectDestroyItem(SpellEffIndex effIndex)
|
||||
{
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* player = unitTarget->ToPlayer();
|
||||
if (SpellEffectInfo const* effect = GetEffect(effIndex))
|
||||
{
|
||||
uint32 itemId = effect->ItemType;
|
||||
if (Item* item = player->GetItemByEntry(itemId))
|
||||
player->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user