Core/PacketIO: Remove duplicated areatrigger spline packet writer
Port From (https://github.com/TrinityCore/TrinityCore/commit/dc10ac722f5e059852785372f9ff91e205d730ce)
This commit is contained in:
@@ -1086,7 +1086,7 @@ namespace Game.Entities
|
||||
reshape.AreaTriggerSpline = new();
|
||||
reshape.AreaTriggerSpline.ElapsedTimeForMovement = GetElapsedTimeForMovement();
|
||||
reshape.AreaTriggerSpline.TimeToTarget = timeToTarget;
|
||||
reshape.AreaTriggerSpline.Points = _spline.GetPoints();
|
||||
reshape.AreaTriggerSpline.Points = _spline;
|
||||
SendMessageToSet(reshape, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -577,8 +577,6 @@ namespace Game.Entities
|
||||
bool hasMorphCurveID = createProperties != null && createProperties.MorphCurveId != 0;
|
||||
bool hasFacingCurveID = createProperties != null && createProperties.FacingCurveId != 0;
|
||||
bool hasMoveCurveID = createProperties != null && createProperties.MoveCurveId != 0;
|
||||
bool hasAreaTriggerSpline = areaTrigger.HasSplines();
|
||||
bool hasOrbit = areaTrigger.HasOrbit();
|
||||
bool hasMovementScript = false;
|
||||
bool hasPositionalSoundKitID = false;
|
||||
|
||||
@@ -595,19 +593,14 @@ namespace Game.Entities
|
||||
data.WriteBit(hasFacingCurveID);
|
||||
data.WriteBit(hasMoveCurveID);
|
||||
data.WriteBit(hasPositionalSoundKitID);
|
||||
data.WriteBit(hasAreaTriggerSpline);
|
||||
data.WriteBit(hasOrbit);
|
||||
data.WriteBit(areaTrigger.HasSplines());
|
||||
data.WriteBit(areaTrigger.HasOrbit());
|
||||
data.WriteBit(hasMovementScript);
|
||||
|
||||
data.FlushBits();
|
||||
|
||||
if (hasAreaTriggerSpline)
|
||||
{
|
||||
data.WriteUInt32(areaTrigger.GetTimeToTarget());
|
||||
data.WriteUInt32(areaTrigger.GetElapsedTimeForMovement());
|
||||
|
||||
MovementExtensions.WriteCreateObjectAreaTriggerSpline(areaTrigger.GetSpline(), data);
|
||||
}
|
||||
if (areaTrigger.HasSplines())
|
||||
AreaTriggerSplineInfo.WriteAreaTriggerSpline(data, areaTrigger.GetTimeToTarget(), areaTrigger.GetElapsedTimeForMovement(), areaTrigger.GetSpline());
|
||||
|
||||
if (hasTargetRollPitchYaw)
|
||||
data.WriteVector3(areaTrigger.GetTargetRollPitchYaw());
|
||||
@@ -630,7 +623,7 @@ namespace Game.Entities
|
||||
//if (hasMovementScript)
|
||||
// *data << *areaTrigger.GetMovementScript(); // AreaTriggerMovementScriptInfo
|
||||
|
||||
if (hasOrbit)
|
||||
if (areaTrigger.HasOrbit())
|
||||
areaTrigger.GetOrbit().Write(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Game.Entities;
|
||||
using Game.Movement;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
@@ -95,20 +96,26 @@ namespace Game.Networking.Packets
|
||||
//Structs
|
||||
class AreaTriggerSplineInfo
|
||||
{
|
||||
public void Write(WorldPacket data)
|
||||
public static void WriteAreaTriggerSpline(WorldPacket data, uint timeToTarget, uint elapsedTimeForMovement, Spline<float> areaTriggerSpline)
|
||||
{
|
||||
data.WriteUInt32(TimeToTarget);
|
||||
data.WriteUInt32(ElapsedTimeForMovement);
|
||||
data.WriteUInt32(timeToTarget);
|
||||
data.WriteUInt32(elapsedTimeForMovement);
|
||||
|
||||
data.WriteBits(Points.Length, 16);
|
||||
var points = areaTriggerSpline.GetPoints();
|
||||
data.WriteBits(points.Length, 16);
|
||||
data.FlushBits();
|
||||
|
||||
foreach (Vector3 point in Points)
|
||||
foreach (Vector3 point in points)
|
||||
data.WriteVector3(point);
|
||||
}
|
||||
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
WriteAreaTriggerSpline(data, TimeToTarget, ElapsedTimeForMovement, Points);
|
||||
}
|
||||
|
||||
public uint TimeToTarget;
|
||||
public uint ElapsedTimeForMovement;
|
||||
public Vector3[] Points = new Vector3[0];
|
||||
public Spline<float> Points;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,13 +342,6 @@ namespace Game.Networking.Packets
|
||||
}
|
||||
}
|
||||
|
||||
public static void WriteCreateObjectAreaTriggerSpline(Spline<float> spline, WorldPacket data)
|
||||
{
|
||||
data.WriteBits(spline.GetPoints().Length, 16);
|
||||
foreach (var point in spline.GetPoints())
|
||||
data.WriteVector3(point);
|
||||
}
|
||||
|
||||
public static void WriteMovementForceWithDirection(MovementForce movementForce, WorldPacket data, Position objectPosition = null)
|
||||
{
|
||||
data.WritePackedGuid(movementForce.ID);
|
||||
|
||||
Reference in New Issue
Block a user