2022-05-22 15:55:26 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
2022-05-30 14:32:38 +08:00
|
|
|
|
using GTA.Math;
|
2022-05-22 15:55:26 +08:00
|
|
|
|
using Lidgren.Network;
|
|
|
|
|
|
|
|
|
|
namespace RageCoop.Core
|
|
|
|
|
{
|
2022-07-01 14:39:43 +08:00
|
|
|
|
internal partial class Packets
|
2022-05-22 15:55:26 +08:00
|
|
|
|
{
|
|
|
|
|
|
2022-07-01 14:39:43 +08:00
|
|
|
|
internal class BulletShot : Packet
|
2022-05-22 15:55:26 +08:00
|
|
|
|
{
|
2022-08-06 10:49:55 +08:00
|
|
|
|
public override PacketType Type => PacketType.BulletShot;
|
2022-05-22 15:55:26 +08:00
|
|
|
|
public int OwnerID { get; set; }
|
|
|
|
|
|
|
|
|
|
public uint WeaponHash { get; set; }
|
|
|
|
|
|
2022-05-30 14:32:38 +08:00
|
|
|
|
public Vector3 StartPosition { get; set; }
|
|
|
|
|
public Vector3 EndPosition { get; set; }
|
2022-05-22 15:55:26 +08:00
|
|
|
|
|
2022-08-06 10:43:24 +08:00
|
|
|
|
public override byte[] Serialize()
|
2022-05-22 15:55:26 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
List<byte> byteArray = new List<byte>();
|
|
|
|
|
|
|
|
|
|
// Write OwnerID
|
|
|
|
|
byteArray.AddRange(BitConverter.GetBytes(OwnerID));
|
|
|
|
|
|
|
|
|
|
// Write weapon hash
|
|
|
|
|
byteArray.AddRange(BitConverter.GetBytes(WeaponHash));
|
|
|
|
|
|
|
|
|
|
// Write StartPosition
|
2022-05-30 14:32:38 +08:00
|
|
|
|
byteArray.AddVector3(StartPosition);
|
2022-05-22 15:55:26 +08:00
|
|
|
|
|
|
|
|
|
// Write EndPosition
|
2022-05-30 14:32:38 +08:00
|
|
|
|
byteArray.AddVector3(EndPosition);
|
2022-05-22 15:55:26 +08:00
|
|
|
|
|
|
|
|
|
|
2022-08-06 10:43:24 +08:00
|
|
|
|
return byteArray.ToArray();
|
2022-05-22 15:55:26 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-06 10:43:24 +08:00
|
|
|
|
public override void Deserialize(byte[] array)
|
2022-05-22 15:55:26 +08:00
|
|
|
|
{
|
|
|
|
|
#region NetIncomingMessageToPacket
|
|
|
|
|
BitReader reader = new BitReader(array);
|
|
|
|
|
|
|
|
|
|
// Read OwnerID
|
|
|
|
|
OwnerID=reader.ReadInt();
|
|
|
|
|
|
|
|
|
|
// Read WeponHash
|
|
|
|
|
WeaponHash=reader.ReadUInt();
|
|
|
|
|
|
|
|
|
|
// Read StartPosition
|
2022-05-30 14:32:38 +08:00
|
|
|
|
StartPosition=reader.ReadVector3();
|
2022-05-22 15:55:26 +08:00
|
|
|
|
|
|
|
|
|
// Read EndPosition
|
2022-05-30 14:32:38 +08:00
|
|
|
|
EndPosition=reader.ReadVector3();
|
2022-05-22 15:55:26 +08:00
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|