diff options
author | Shauren <shauren.trinity@gmail.com> | 2020-06-12 18:48:45 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-01-06 20:48:29 +0100 |
commit | 1fc9e0172da4018ab24422bee51b025d0fb79701 (patch) | |
tree | d96de84fb9fae6bf7b94a5a50fb8441dced07198 /src/server/game/Handlers/SpellHandler.cpp | |
parent | d48909b5d62986b685368254eed9e886cc0266ec (diff) |
Core/Spells: Prevent manual cancelling of channelled spells that have SPELL_ATTR0_CANT_CANCEL
(cherry picked from commit dacb1e58025b69f61a965a78ffbe89c55a61e34b)
Diffstat (limited to 'src/server/game/Handlers/SpellHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/SpellHandler.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index f66902f92f9..6597bb8dd98 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -457,13 +457,25 @@ void WorldSession::HandleCancelAutoRepeatSpellOpcode(WorldPackets::Spells::Cance _player->InterruptSpell(CURRENT_AUTOREPEAT_SPELL); } -void WorldSession::HandleCancelChanneling(WorldPackets::Spells::CancelChannelling& /*cancelChanneling*/) +void WorldSession::HandleCancelChanneling(WorldPackets::Spells::CancelChannelling& cancelChanneling) { // ignore for remote control state (for player case) Unit* mover = _player->GetUnitBeingMoved(); if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER) return; + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cancelChanneling.ChannelSpell, mover->GetMap()->GetDifficultyID()); + if (!spellInfo) + return; + + // not allow remove spells with attr SPELL_ATTR0_CANT_CANCEL + if (spellInfo->HasAttribute(SPELL_ATTR0_CANT_CANCEL)) + return; + + Spell* spell = mover->GetCurrentSpell(CURRENT_CHANNELED_SPELL); + if (!spell || spell->GetSpellInfo()->Id != spellInfo->Id) + return; + mover->InterruptSpell(CURRENT_CHANNELED_SPELL); } |