Core/AreaTriggers: Fixed areatrigger spline duration calculation

Port From (https://github.com/TrinityCore/TrinityCore/commit/5e8adaabcc1bef7563036d3765a0c13894e860f7)
This commit is contained in:
Hondacrx
2025-08-17 23:08:18 -04:00
parent 590b5ce1c5
commit e8a430a178
2 changed files with 7 additions and 7 deletions
@@ -322,7 +322,7 @@ namespace Game.Entities
{ {
float orientation = Global.DB2Mgr.GetCurveValueAt(createProperties.FacingCurveId, GetProgress()); float orientation = Global.DB2Mgr.GetCurveValueAt(createProperties.FacingCurveId, GetProgress());
if (GetCreateProperties() == null || !GetCreateProperties().Flags.HasFlag(AreaTriggerCreatePropertiesFlag.HasAbsoluteOrientation)) if (GetCreateProperties() == null || !GetCreateProperties().Flags.HasFlag(AreaTriggerCreatePropertiesFlag.HasAbsoluteOrientation))
orientation += GetStationaryO(); orientation += _stationaryPosition.GetOrientation();
SetOrientation(orientation); SetOrientation(orientation);
} }
@@ -1061,7 +1061,7 @@ namespace Game.Entities
_movementTime = 0; _movementTime = 0;
_spline = new Spline<int>(); _spline = new Spline<float>();
_spline.InitSpline(splinePoints, splinePoints.Length, EvaluationMode.Linear, GetStationaryO()); _spline.InitSpline(splinePoints, splinePoints.Length, EvaluationMode.Linear, GetStationaryO());
_spline.InitLengths(); _spline.InitLengths();
@@ -1255,7 +1255,7 @@ namespace Game.Entities
Vector3 currentPosition; Vector3 currentPosition;
_spline.Evaluate_Percent(lastPositionIndex, percentFromLastPoint, out currentPosition); _spline.Evaluate_Percent(lastPositionIndex, percentFromLastPoint, out currentPosition);
float orientation = GetStationaryO(); float orientation = _stationaryPosition.GetOrientation();
if (createProperties != null && createProperties.FacingCurveId != 0) if (createProperties != null && createProperties.FacingCurveId != 0)
orientation += Global.DB2Mgr.GetCurveValueAt(createProperties.FacingCurveId, GetProgress()); orientation += Global.DB2Mgr.GetCurveValueAt(createProperties.FacingCurveId, GetProgress());
@@ -1290,7 +1290,7 @@ namespace Game.Entities
{ {
orientation = Global.DB2Mgr.GetCurveValueAt(GetCreateProperties().FacingCurveId, GetProgress()); orientation = Global.DB2Mgr.GetCurveValueAt(GetCreateProperties().FacingCurveId, GetProgress());
if (GetCreateProperties() == null || !GetCreateProperties().Flags.HasFlag(AreaTriggerCreatePropertiesFlag.HasAbsoluteOrientation)) if (GetCreateProperties() == null || !GetCreateProperties().Flags.HasFlag(AreaTriggerCreatePropertiesFlag.HasAbsoluteOrientation))
orientation += GetStationaryO(); orientation += _stationaryPosition.GetOrientation();
} }
GetMap().AreaTriggerRelocation(this, x, y, z, orientation); GetMap().AreaTriggerRelocation(this, x, y, z, orientation);
@@ -1444,7 +1444,7 @@ namespace Game.Entities
public Vector3 GetTargetRollPitchYaw() { return _targetRollPitchYaw; } public Vector3 GetTargetRollPitchYaw() { return _targetRollPitchYaw; }
public bool HasSplines() { return !_spline.Empty(); } public bool HasSplines() { return !_spline.Empty(); }
public Spline<int> GetSpline() { return _spline; } public Spline<float> GetSpline() { return _spline; }
public uint GetElapsedTimeForMovement() { return GetTimeSinceCreated(); } // @todo: research the right value, in sniffs both timers are nearly identical public uint GetElapsedTimeForMovement() { return GetTimeSinceCreated(); } // @todo: research the right value, in sniffs both timers are nearly identical
public AreaTriggerOrbitInfo GetOrbit() { return _orbitInfo; } public AreaTriggerOrbitInfo GetOrbit() { return _orbitInfo; }
@@ -1468,7 +1468,7 @@ namespace Game.Entities
Position _rollPitchYaw; Position _rollPitchYaw;
Position _targetRollPitchYaw; Position _targetRollPitchYaw;
List<Position> _polygonVertices; List<Position> _polygonVertices;
Spline<int> _spline; Spline<float> _spline;
bool _reachedDestination; bool _reachedDestination;
int _lastSplineIndex; int _lastSplineIndex;
@@ -342,7 +342,7 @@ namespace Game.Networking.Packets
} }
} }
public static void WriteCreateObjectAreaTriggerSpline(Spline<int> spline, WorldPacket data) public static void WriteCreateObjectAreaTriggerSpline(Spline<float> spline, WorldPacket data)
{ {
data.WriteBits(spline.GetPoints().Length, 16); data.WriteBits(spline.GetPoints().Length, 16);
foreach (var point in spline.GetPoints()) foreach (var point in spline.GetPoints())