From a06b3cea3c7e9977e39df110d6e057dd1cfc50c8 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 16 Jan 2022 18:45:07 +0100 Subject: [PATCH] Core/Spells: Fixed caster unit validation for players that have charmed (not possessed) units --- src/server/game/Handlers/SpellHandler.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index dc1b0e0ebd8..1c4063ed82c 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -21,6 +21,7 @@ #include "Config.h" #include "DatabaseEnv.h" #include "DBCStores.h" +#include "GameClient.h" #include "GameObject.h" #include "GameObjectAI.h" #include "Guild.h" @@ -263,8 +264,8 @@ void WorldSession::HandleGameobjectReportUse(WorldPacket& recvPacket) void WorldSession::HandleCastSpellOpcode(WorldPackets::Spells::CastSpell& cast) { // ignore for remote control state (for player case) - Unit* mover = _player->GetCharmedOrSelf(); - if (mover != _player && mover->IsPlayer()) + Unit* mover = GetGameClient()->GetActivelyMovedUnit(); + if (!mover || mover != _player && mover->IsPlayer()) return; SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cast.Cast.SpellID); @@ -401,9 +402,10 @@ void WorldSession::HandleCancelChanneling(WorldPacket& recvData) if (spellInfo->HasAttribute(SPELL_ATTR0_CANT_CANCEL)) return; + Unit* mover = GetGameClient()->GetActivelyMovedUnit(); + // ignore for remote control state (for player case) - Unit* mover = _player->GetCharmedOrSelf(); - if (_player->GetCharmed() && _player->GetCharmed()->GetTypeId() == TYPEID_PLAYER) + if (!mover) return; mover->InterruptSpell(CURRENT_CHANNELED_SPELL);