public static TransportInfo Read(BinaryReader reader, MovementFlags2 flags2) { var tInfo = new TransportInfo(); tInfo.Guid = reader.ReadPackedGuid(); tInfo.Position = reader.ReadCoords3(); tInfo.Facing = reader.ReadSingle(); tInfo.Time = reader.ReadUInt32(); tInfo.Seat = reader.ReadByte(); if (flags2.HasFlag(MovementFlags2.InterpolatedPlayerMovement)) tInfo.Time2 = reader.ReadUInt32(); return tInfo; }
public static TransportInfo Read(BinaryReader reader, MovementFlags2 flags2) { var tInfo = new TransportInfo(); tInfo.Guid = reader.ReadPackedGuid(); tInfo.Position = reader.ReadCoords3(); tInfo.Facing = reader.ReadSingle(); tInfo.Time = reader.ReadUInt32(); tInfo.Seat = reader.ReadByte(); if (flags2.HasFlag(MovementFlags2.InterpolatedPlayerMovement)) { tInfo.Time2 = reader.ReadUInt32(); } return(tInfo); }
public static MovementInfo Read(BinaryReader gr) { var movementInfo = new MovementInfo(); movementInfo.Flags = (MovementFlags)gr.ReadUInt32(); movementInfo.Flags2 = (MovementFlags2)gr.ReadUInt16(); movementInfo.TimeStamp = gr.ReadUInt32(); movementInfo.Position = gr.ReadCoords3(); movementInfo.Facing = gr.ReadSingle(); if (movementInfo.Flags.HasFlag(MovementFlags.ONTRANSPORT)) { movementInfo.Transport = TransportInfo.Read(gr, movementInfo.Flags2); } if (movementInfo.Flags.HasFlag(MovementFlags.SWIMMING) || movementInfo.Flags.HasFlag(MovementFlags.FLYING) || movementInfo.Flags2.HasFlag(MovementFlags2.AlwaysAllowPitching)) { movementInfo.Pitch = gr.ReadSingle(); } movementInfo.FallTime = gr.ReadUInt32(); if (movementInfo.Flags.HasFlag(MovementFlags.FALLING)) { movementInfo.FallVelocity = gr.ReadSingle(); movementInfo.FallCosAngle = gr.ReadSingle(); movementInfo.FallSinAngle = gr.ReadSingle(); movementInfo.FallSpeed = gr.ReadSingle(); } if (movementInfo.Flags.HasFlag(MovementFlags.SPLINEELEVATION)) { movementInfo.SplineElevation = gr.ReadSingle(); } return(movementInfo); }
public static MovementInfo Read(BinaryReader gr) { var movement = new MovementInfo(); movement.UpdateFlags = (UpdateFlags)gr.ReadUInt16(); if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_LIVING)) { movement.Flags = (MovementFlags)gr.ReadUInt32(); movement.Flags2 = (MovementFlags2)gr.ReadUInt16(); movement.TimeStamp = gr.ReadUInt32(); movement.Position = gr.ReadCoords3(); movement.Facing = gr.ReadSingle(); if (movement.Flags.HasFlag(MovementFlags.ONTRANSPORT)) { movement.Transport = TransportInfo.Read(gr, movement.Flags2); } if (movement.Flags.HasFlag(MovementFlags.SWIMMING) || movement.Flags.HasFlag(MovementFlags.FLYING) || movement.Flags2.HasFlag(MovementFlags2.AlwaysAllowPitching)) { movement.Pitch = gr.ReadSingle(); } movement.FallTime = gr.ReadUInt32(); if (movement.Flags.HasFlag(MovementFlags.FALLING)) { movement.FallVelocity = gr.ReadSingle(); movement.FallCosAngle = gr.ReadSingle(); movement.FallSinAngle = gr.ReadSingle(); movement.FallSpeed = gr.ReadSingle(); } if (movement.Flags.HasFlag(MovementFlags.SPLINEELEVATION)) { movement.SplineElevation = gr.ReadSingle(); } for (byte i = 0; i < movement.speeds.Length; ++i) { movement.speeds[i] = gr.ReadSingle(); } if (movement.Flags.HasFlag(MovementFlags.SPLINEENABLED)) { movement.Spline = SplineInfo.Read(gr); } } else { if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_GO_POSITION)) { movement.Transport.Guid = gr.ReadPackedGuid(); movement.Position = gr.ReadCoords3(); movement.Transport.Position = gr.ReadCoords3(); movement.Facing = gr.ReadSingle(); movement.Transport.Facing = gr.ReadSingle(); } else if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_HAS_POSITION)) { movement.Position = gr.ReadCoords3(); movement.Facing = gr.ReadSingle(); } } if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_LOWGUID)) { movement.LowGuid = gr.ReadUInt32(); } if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_HIGHGUID)) { movement.HighGuid = gr.ReadUInt32(); } if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_TARGET_GUID)) { movement.AttackingTarget = gr.ReadPackedGuid(); } if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_TRANSPORT)) { movement.TransportTime = gr.ReadUInt32(); } // WotLK if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_VEHICLE)) { movement.VehicleId = gr.ReadUInt32(); movement.VehicleAimAdjustement = gr.ReadSingle(); } // 3.1 if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_GO_ROTATION)) { movement.GoRotationULong = gr.ReadUInt64(); } return(movement); }
public MovementInfo() { Transport = new TransportInfo(); Spline = new SplineInfo(); }
public MovementInfo() { Transport = new TransportInfo(); }