Core/Unit: movement related corrections prior to getting Charmed
Port From (https://github.com/TrinityCore/TrinityCore/commit/ef6a5d3c3c010f9ad63a71015a533a3894ab38b9)
This commit is contained in:
@@ -17,8 +17,10 @@
|
|||||||
|
|
||||||
using Framework.Constants;
|
using Framework.Constants;
|
||||||
using Game.AI;
|
using Game.AI;
|
||||||
|
using Game.Movement;
|
||||||
using Game.Networking.Packets;
|
using Game.Networking.Packets;
|
||||||
using Game.Spells;
|
using Game.Spells;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -322,26 +324,27 @@ namespace Game.Entities
|
|||||||
_oldFactionId = GetFaction();
|
_oldFactionId = GetFaction();
|
||||||
SetFaction(charmer.GetFaction());
|
SetFaction(charmer.GetFaction());
|
||||||
|
|
||||||
|
// Pause any Idle movement
|
||||||
|
PauseMovement(0, 0, false);
|
||||||
|
|
||||||
|
// Remove any active voluntary movement
|
||||||
|
GetMotionMaster().Clear(MovementGeneratorPriority.Normal);
|
||||||
|
|
||||||
|
// Stop any remaining spline, if no involuntary movement is found
|
||||||
|
Func<MovementGenerator, bool> criteria = movement => movement.Priority == MovementGeneratorPriority.Highest;
|
||||||
|
if (!GetMotionMaster().HasMovementGenerator(criteria))
|
||||||
|
StopMoving();
|
||||||
|
|
||||||
// Set charmed
|
// Set charmed
|
||||||
charmer.SetCharm(this, true);
|
charmer.SetCharm(this, true);
|
||||||
|
|
||||||
if (IsTypeId(TypeId.Unit))
|
Player player = ToPlayer();
|
||||||
|
if (player)
|
||||||
{
|
{
|
||||||
PauseMovement(0, 0, false);
|
if (player.IsAFK())
|
||||||
GetMotionMaster().Clear(MovementGeneratorPriority.Normal);
|
player.ToggleAFK();
|
||||||
|
|
||||||
StopMoving();
|
player.SetClientControl(this, false);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Player player = ToPlayer();
|
|
||||||
if (player)
|
|
||||||
{
|
|
||||||
if (player.IsAFK())
|
|
||||||
player.ToggleAFK();
|
|
||||||
|
|
||||||
player.SetClientControl(this, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// charm is set by aura, and aura effect remove handler was called during apply handler execution
|
// charm is set by aura, and aura effect remove handler was called during apply handler execution
|
||||||
|
|||||||
Reference in New Issue
Block a user