Core/Movement: Corrected values sent in knockback packet when speedXY < 0

Port From (https://github.com/TrinityCore/TrinityCore/commit/732a8ee26199d7f04c692fa64f96955db13cf69d)
This commit is contained in:
hondacrx
2021-11-08 10:44:57 -05:00
parent 5f0af0e527
commit 80d6b08c13
5 changed files with 19 additions and 31 deletions
+11 -4
View File
@@ -235,7 +235,7 @@ namespace Game.Entities
GetMotionMaster().LaunchMoveSpline(init, 0, MovementGeneratorPriority.Normal, MovementGeneratorType.Point);
}
public void KnockbackFrom(float x, float y, float speedXY, float speedZ, SpellEffectExtraData spellEffectExtraData = null)
public void KnockbackFrom(Position origin, float speedXY, float speedZ, SpellEffectExtraData spellEffectExtraData = null)
{
Player player = ToPlayer();
if (!player)
@@ -250,11 +250,18 @@ namespace Game.Entities
}
if (!player)
GetMotionMaster().MoveKnockbackFrom(x, y, speedXY, speedZ, spellEffectExtraData);
GetMotionMaster().MoveKnockbackFrom(origin, speedXY, speedZ, spellEffectExtraData);
else
{
float vcos, vsin;
GetSinCos(x, y, out vsin, out vcos);
float o = GetPosition() == origin ? GetOrientation() + MathF.PI : origin.GetRelativeAngle(this);
if (speedXY < 0)
{
speedXY = -speedXY;
o = o - MathF.PI;
}
float vcos = MathF.Cos(o);
float vsin = MathF.Sin(o);
SendMoveKnockBack(player, speedXY, -speedZ, vcos, vsin);
}
}