diff options
author | Shauren <shauren.trinity@gmail.com> | 2023-08-26 22:53:02 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2023-08-26 23:36:26 +0200 |
commit | ed98146d317f9b956e8ca23524631cdd2388492b (patch) | |
tree | b535425bfea25e06fe9a84687b041f365bae4480 /src | |
parent | 07a03dd730db6febe61aaec7a411dce9961cabb8 (diff) |
Core/Spells: Allow cancelling spell missiles without cancelling the entire spell
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 17 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d6c3a0e3d51..b3a7746bc4c 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11786,20 +11786,25 @@ void Unit::SendCancelSpellVisualKit(uint32 id) SendMessageToSet(cancelSpellVisualKit.Write(), true); } -void Unit::CancelSpellMissiles(uint32 spellId, bool reverseMissile /*= false*/) +void Unit::CancelSpellMissiles(uint32 spellId, bool reverseMissile /*= false*/, bool abortSpell /*= false*/) { bool hasMissile = false; - for (std::pair<uint64 const, BasicEvent*> const& itr : m_Events.GetEvents()) + if (abortSpell) { - if (Spell const* spell = Spell::ExtractSpellFromEvent(itr.second)) + for (std::pair<uint64 const, BasicEvent*> const& itr : m_Events.GetEvents()) { - if (spell->GetSpellInfo()->Id == spellId) + if (Spell const* spell = Spell::ExtractSpellFromEvent(itr.second)) { - itr.second->ScheduleAbort(); - hasMissile = true; + if (spell->GetSpellInfo()->Id == spellId) + { + itr.second->ScheduleAbort(); + hasMissile = true; + } } } } + else + hasMissile = true; if (hasMissile) { diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index c45ea2b03d7..fd45dfb1a7e 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1208,7 +1208,7 @@ class TC_GAME_API Unit : public WorldObject void SendPlaySpellVisualKit(uint32 id, uint32 type, uint32 duration) const; void SendCancelSpellVisualKit(uint32 id); - void CancelSpellMissiles(uint32 spellId, bool reverseMissile = false); + void CancelSpellMissiles(uint32 spellId, bool reverseMissile = false, bool abortSpell = false); void DeMorph(); |