From e8a430a178ebbfcb4e24bbe8600fe4157818a452 Mon Sep 17 00:00:00 2001 From: Hondacrx Date: Sun, 17 Aug 2025 23:08:18 -0400 Subject: [PATCH] Core/AreaTriggers: Fixed areatrigger spline duration calculation Port From (https://github.com/TrinityCore/TrinityCore/commit/5e8adaabcc1bef7563036d3765a0c13894e860f7) --- Source/Game/Entities/AreaTrigger/AreaTrigger.cs | 12 ++++++------ Source/Game/Networking/Packets/MovementPackets.cs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/Game/Entities/AreaTrigger/AreaTrigger.cs b/Source/Game/Entities/AreaTrigger/AreaTrigger.cs index b96a24a0b..9da2fb323 100644 --- a/Source/Game/Entities/AreaTrigger/AreaTrigger.cs +++ b/Source/Game/Entities/AreaTrigger/AreaTrigger.cs @@ -322,7 +322,7 @@ namespace Game.Entities { float orientation = Global.DB2Mgr.GetCurveValueAt(createProperties.FacingCurveId, GetProgress()); if (GetCreateProperties() == null || !GetCreateProperties().Flags.HasFlag(AreaTriggerCreatePropertiesFlag.HasAbsoluteOrientation)) - orientation += GetStationaryO(); + orientation += _stationaryPosition.GetOrientation(); SetOrientation(orientation); } @@ -1061,7 +1061,7 @@ namespace Game.Entities _movementTime = 0; - _spline = new Spline(); + _spline = new Spline(); _spline.InitSpline(splinePoints, splinePoints.Length, EvaluationMode.Linear, GetStationaryO()); _spline.InitLengths(); @@ -1255,7 +1255,7 @@ namespace Game.Entities Vector3 currentPosition; _spline.Evaluate_Percent(lastPositionIndex, percentFromLastPoint, out currentPosition); - float orientation = GetStationaryO(); + float orientation = _stationaryPosition.GetOrientation(); if (createProperties != null && createProperties.FacingCurveId != 0) orientation += Global.DB2Mgr.GetCurveValueAt(createProperties.FacingCurveId, GetProgress()); @@ -1290,7 +1290,7 @@ namespace Game.Entities { orientation = Global.DB2Mgr.GetCurveValueAt(GetCreateProperties().FacingCurveId, GetProgress()); if (GetCreateProperties() == null || !GetCreateProperties().Flags.HasFlag(AreaTriggerCreatePropertiesFlag.HasAbsoluteOrientation)) - orientation += GetStationaryO(); + orientation += _stationaryPosition.GetOrientation(); } GetMap().AreaTriggerRelocation(this, x, y, z, orientation); @@ -1444,7 +1444,7 @@ namespace Game.Entities public Vector3 GetTargetRollPitchYaw() { return _targetRollPitchYaw; } public bool HasSplines() { return !_spline.Empty(); } - public Spline GetSpline() { return _spline; } + public Spline GetSpline() { return _spline; } public uint GetElapsedTimeForMovement() { return GetTimeSinceCreated(); } // @todo: research the right value, in sniffs both timers are nearly identical public AreaTriggerOrbitInfo GetOrbit() { return _orbitInfo; } @@ -1468,7 +1468,7 @@ namespace Game.Entities Position _rollPitchYaw; Position _targetRollPitchYaw; List _polygonVertices; - Spline _spline; + Spline _spline; bool _reachedDestination; int _lastSplineIndex; diff --git a/Source/Game/Networking/Packets/MovementPackets.cs b/Source/Game/Networking/Packets/MovementPackets.cs index b846e093e..21d2f425a 100644 --- a/Source/Game/Networking/Packets/MovementPackets.cs +++ b/Source/Game/Networking/Packets/MovementPackets.cs @@ -342,7 +342,7 @@ namespace Game.Networking.Packets } } - public static void WriteCreateObjectAreaTriggerSpline(Spline spline, WorldPacket data) + public static void WriteCreateObjectAreaTriggerSpline(Spline spline, WorldPacket data) { data.WriteBits(spline.GetPoints().Length, 16); foreach (var point in spline.GetPoints())