Core: Updated to 11.1.7

Port From (https://github.com/TrinityCore/TrinityCore/commit/ceb8d561b44579118b109a9ff71ba415df53bbdc)
This commit is contained in:
Hondacrx
2025-08-18 14:47:48 -04:00
parent 5f6329665a
commit ebd9c9e636
35 changed files with 1824 additions and 1603 deletions
+19 -2
View File
@@ -3,6 +3,7 @@
using Framework.Constants;
using Framework.Dynamic;
using Game.Entities;
using System;
using System.Collections.Generic;
using System.Numerics;
@@ -37,6 +38,7 @@ namespace Game.Movement
vertical_acceleration = 0.0f;
effect_start_time = 0;
spell_effect_extra = args.spellEffectExtra;
turn = args.turnData;
anim_tier = args.animTier;
splineIsFacingOnly = args.path.Count == 2 && args.facing.type != MonsterMoveType.Normal && ((args.path[1] - args.path[0]).Length() < 0.1f);
@@ -108,6 +110,13 @@ namespace Game.Movement
Log.outError(LogFilter.Unit, "MoveSpline.init_spline: zero length spline, wrong input data?");
spline.Set_length(spline.Last(), spline.IsCyclic() ? 1000 : 1);
}
if (turn != null)
{
float totalTurnTime = (float)(turn.TotalTurnRads / turn.RadsPerSec * (float)Time.InMilliseconds);
spline.Set_length(spline.Last(), MathF.Max(spline.Length(), totalTurnTime));
}
point_Idx = spline.First();
}
@@ -127,18 +136,20 @@ namespace Game.Movement
public int CurrentSplineIdx() { return point_Idx; }
public uint GetId() { return m_Id; }
public bool Finalized() { return splineflags.HasFlag(MoveSplineFlagEnum.Done); }
void _Finalize()
{
splineflags.SetUnsetFlag(MoveSplineFlagEnum.Done);
point_Idx = spline.Last() - 1;
time_passed = Duration();
}
public Vector4 ComputePosition(int time_point, int point_index)
{
float u = 1.0f;
int seg_time = spline.Length(point_index, point_index + 1);
float seg_time = (float)spline.Length(point_index, point_index + 1);
if (seg_time > 0)
u = (time_point - spline.Length(point_index)) / (float)seg_time;
u = MathF.Min((time_point - spline.Length(point_index)) / (float)seg_time, 1.0f);
Vector3 c;
float orientation = initialOrientation;
@@ -157,6 +168,10 @@ namespace Game.Movement
orientation = MathF.Atan2(facing.f.Y - c.Y, facing.f.X - c.X);
//nothing to do for MoveSplineFlag.Final_Target flag
}
else if (splineflags.HasFlag(MoveSplineFlagEnum.Turning))
{
orientation = Position.NormalizeOrientation(turn.StartFacing + (float)time_point / (float)Time.InMilliseconds * turn.RadsPerSec);
}
else
{
if (!splineflags.HasFlag(MoveSplineFlagEnum.OrientationFixed | MoveSplineFlagEnum.Falling | MoveSplineFlagEnum.JumpOrientationFixed))
@@ -340,6 +355,7 @@ namespace Game.Movement
int SegmentTimeElapsed() { return NextTimestamp() - time_passed; }
public bool IsCyclic() { return splineflags.HasFlag(MoveSplineFlagEnum.Cyclic); }
public bool IsFalling() { return splineflags.HasFlag(MoveSplineFlagEnum.Falling); }
public bool IsTurning() { return splineflags.HasFlag(MoveSplineFlagEnum.Turning); }
public bool Initialized() { return !spline.Empty(); }
public Vector3 FinalDestination() { return Initialized() ? spline.GetPoint(spline.Last()) : Vector3.Zero; }
public Vector3 CurrentDestination() { return Initialized() ? spline.GetPoint(point_Idx + 1) : Vector3.Zero; }
@@ -362,6 +378,7 @@ namespace Game.Movement
public int point_Idx_offset;
public float velocity;
public SpellEffectExtraData spell_effect_extra;
public TurnData turn;
public AnimTierTransition anim_tier;
#endregion
+17
View File
@@ -176,6 +176,9 @@ namespace Game.Movement
loc.W = unit.GetOrientation();
}
if (move_spline.IsTurning())
SetFacing(loc.W);
args.flags.Flags = MoveSplineFlagEnum.Done;
unit.m_movementInfo.RemoveMovementFlag(MovementFlag.Forward);
move_spline.onTransport = transport;
@@ -186,6 +189,9 @@ namespace Game.Movement
packet.Pos = new Vector3(loc.X, loc.Y, loc.Z);
packet.SplineData.StopSplineStyle = 2;
packet.SplineData.Id = move_spline.GetId();
packet.SplineData.StopUseFaceDirection = args.facing.type == MonsterMoveType.FacingAngle;
packet.SplineData.Move.Face = args.facing.type;
packet.SplineData.Move.FaceDirection = args.facing.angle;
if (transport)
{
@@ -324,6 +330,17 @@ namespace Game.Movement
args.spellEffectExtra = spellEffectExtraData;
}
public void SetTurning(float startFacing, float totalTurnRads, float radsPerSec)
{
args.flags.SetUnsetFlag(MoveSplineFlagEnum.Turning, true);
TurnData turn = new();
turn.StartFacing = startFacing;
turn.TotalTurnRads = totalTurnRads;
turn.RadsPerSec = radsPerSec;
args.turnData = turn;
}
public List<Vector3> Path() { return args.path; }
public MoveSplineInitArgs args = new();
@@ -37,6 +37,7 @@ namespace Game.Movement
public uint splineId;
public float initialOrientation;
public SpellEffectExtraData spellEffectExtra;
public TurnData turnData;
public AnimTierTransition animTier;
public bool walk;
public bool HasVelocity;
@@ -116,6 +117,14 @@ namespace Game.Movement
public uint ParabolicCurveId;
}
public class TurnData
{
public float StartFacing;
public float TotalTurnRads;
public float RadsPerSec;
}
public class AnimTierTransition
{
public uint TierTransitionId;