diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index 95659e42212..d34d24d5729 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -186,6 +186,12 @@ void SpellCastTargets::setItemTarget(Item* item) m_targetMask |= TARGET_FLAG_ITEM; } +void SpellCastTargets::clearItemPointer() +{ + // keep the other information so its clear how the spell was targeted + m_itemTarget = nullptr; +} + void SpellCastTargets::setTradeItemTarget(Player* caster) { m_itemTargetGUID = ObjectGuid(uint64(TRADE_SLOT_NONTRADED)); @@ -5305,7 +5311,7 @@ void Spell::TakeReagents() // if getItemTarget is also spell reagent if (m_targets.getItemTargetEntry() == itemid) - m_targets.setItemTarget(nullptr); + m_targets.clearItemPointer(); p_caster->DestroyItemCount(itemid, itemcount, true); } @@ -8934,7 +8940,7 @@ bool Spell::IsAuraProcced(Aura* aura) void Spell::ClearCastItem() { if (m_CastItem == m_targets.getItemTarget()) - m_targets.setItemTarget(nullptr); + m_targets.clearItemPointer(); m_CastItem = nullptr; } diff --git a/src/game/Spells/Spell.h b/src/game/Spells/Spell.h index 3c9b51f6d5d..eee4b0ef073 100644 --- a/src/game/Spells/Spell.h +++ b/src/game/Spells/Spell.h @@ -181,6 +181,7 @@ class SpellCastTargets Corpse* getCorpseTarget() const { return m_CorpseTarget; } void setItemTarget(Item* item); + void clearItemPointer(); ObjectGuid getItemTargetGuid() const { return m_itemTargetGUID; } Item* getItemTarget() const { return m_itemTarget; } uint32 getItemTargetEntry() const { return m_itemTargetEntry; }