From b24fd8173439db21abf736dae9482710d4c418f8 Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Thu, 20 Jan 2022 16:12:40 +0100 Subject: [PATCH] fix(Core/Spells): Properly handle client-side orientation on stun. (#10107) Fixes #9738 --- src/server/game/Entities/Unit/Unit.cpp | 15 +++++++++++---- src/server/game/Entities/Unit/Unit.h | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 5334c4cb1..cc90f7bc2 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -17485,7 +17485,7 @@ void Unit::SetStunned(bool apply) SetStandState(UNIT_STAND_STATE_STAND); } - SetRooted(true); + SetRooted(true, true); CastStop(); } @@ -17511,12 +17511,12 @@ void Unit::SetStunned(bool apply) if (!HasUnitState(UNIT_STATE_ROOT)) // prevent moving if it also has root effect { - SetRooted(false); + SetRooted(false, true); } } } -void Unit::SetRooted(bool apply) +void Unit::SetRooted(bool apply, bool isStun) { if (apply) { @@ -17540,7 +17540,14 @@ void Unit::SetRooted(bool apply) // Creature specific if (GetTypeId() != TYPEID_PLAYER) { - StopMoving(); + if (isStun && movespline->Finalized()) + { + StopMovingOnCurrentPos(); + } + else + { + StopMoving(); + } } if (m_movedByPlayer) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 938ae255e..66c1c3353 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -2480,7 +2480,7 @@ protected: void SetFeared(bool apply); void SetConfused(bool apply); void SetStunned(bool apply); - void SetRooted(bool apply); + void SetRooted(bool apply, bool isStun = false); uint32 m_rootTimes;