mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-18 09:15:13 +00:00
IsCheats
This commit is contained in:
parent
aec13bb4a6
commit
73d83c0ea8
3 changed files with 6 additions and 1 deletions
|
@ -254,7 +254,7 @@ public class Server {
|
|||
tempBuffer.Dispose();
|
||||
});
|
||||
|
||||
Logger.Info($"Client {client.Name} ({client.Id}/{socket.RemoteEndPoint}) connected.");
|
||||
Logger.Info($"Client {client.Name} ({client.Id}/{socket.RemoteEndPoint}) connected. Using PM = {header.IsCheats}");
|
||||
} else if (header.Id != client.Id && client.Id != Guid.Empty) {
|
||||
throw new Exception($"Client {client.Name} sent packet with invalid client id {header.Id} instead of {client.Id}");
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ public struct PacketHeader : IPacket {
|
|||
public Guid Id;
|
||||
public PacketType Type;
|
||||
public short PacketSize;
|
||||
public bool IsCheats;
|
||||
|
||||
public static short StaticSize => 20;
|
||||
public short Size => StaticSize;
|
||||
|
@ -17,11 +18,13 @@ public struct PacketHeader : IPacket {
|
|||
MemoryMarshal.Write(data[..16], ref Id);
|
||||
MemoryMarshal.Write(data[16..], ref Type);
|
||||
MemoryMarshal.Write(data[18..], ref PacketSize);
|
||||
MemoryMarshal.Write(data[20..], ref IsCheats);
|
||||
}
|
||||
|
||||
public void Deserialize(ReadOnlySpan<byte> data) {
|
||||
Id = MemoryMarshal.Read<Guid>(data[..16]);
|
||||
Type = MemoryMarshal.Read<PacketType>(data[16..]);
|
||||
PacketSize = MemoryMarshal.Read<short>(data[18..]);
|
||||
IsCheats = MemoryMarshal.Read<bool>(data[20..]);
|
||||
}
|
||||
}
|
|
@ -55,6 +55,8 @@ async Task S(string n, Guid otherId, Guid ownId) {
|
|||
Type = PacketType.Connect,
|
||||
Id = ownId,
|
||||
PacketSize = connect.Size,
|
||||
|
||||
|
||||
};
|
||||
IMemoryOwner<byte> connectOwner = MemoryPool<byte>.Shared.RentZero(Constants.HeaderSize + connect.Size);
|
||||
// coolHeader.Serialize(connectOwner.Memory.Span[..Constants.HeaderSize]);
|
||||
|
|
Loading…
Reference in a new issue