mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-25 04:35:18 +00:00
I'm going to commit war crimes
This commit is contained in:
parent
df2e976782
commit
605be3947f
3 changed files with 6 additions and 7 deletions
|
@ -41,15 +41,14 @@ public class Client : IDisposable {
|
||||||
if (packetAttribute.Type is not PacketType.Cap and not PacketType.Player)
|
if (packetAttribute.Type is not PacketType.Cap and not PacketType.Player)
|
||||||
Logger.Info($"Pre-header {packetAttribute.Type} ({(short)packetAttribute.Type}) - {typeof(T)}");
|
Logger.Info($"Pre-header {packetAttribute.Type} ({(short)packetAttribute.Type}) - {typeof(T)}");
|
||||||
try {
|
try {
|
||||||
PacketHeader header = new PacketHeader {
|
Server.FillPacket(new PacketHeader {
|
||||||
Id = sender?.Id ?? Id,
|
Id = sender?.Id ?? Id,
|
||||||
Type = packetAttribute.Type,
|
Type = packetAttribute.Type,
|
||||||
PacketSize = packet.Size
|
PacketSize = packet.Size
|
||||||
};
|
}, packet, memory.Memory);
|
||||||
Server.FillPacket(header, packet, memory.Memory);
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Logger.Error($"I will lose my shit {e}");
|
Logger.Error($"I will lose my shit {e} {memory.Memory.Span[..Constants.HeaderSize].Length} {memory.Memory.Span[Constants.HeaderSize..].Length} {packet.Size}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packetAttribute.Type is not PacketType.Cap and not PacketType.Player)
|
if (packetAttribute.Type is not PacketType.Cap and not PacketType.Player)
|
||||||
|
|
|
@ -12,9 +12,9 @@ public struct GamePacket : IPacket {
|
||||||
|
|
||||||
public GamePacket() { }
|
public GamePacket() { }
|
||||||
|
|
||||||
public short Size => 0x3A;
|
public short Size => 0x3C;
|
||||||
public void Serialize(Span<byte> data) {
|
public void Serialize(Span<byte> data) {
|
||||||
MemoryMarshal.Write(data[..0], ref Is2d);
|
MemoryMarshal.Write(data, ref Is2d);
|
||||||
MemoryMarshal.Write(data[1..], ref ScenarioNum);
|
MemoryMarshal.Write(data[1..], ref ScenarioNum);
|
||||||
Encoding.UTF8.GetBytes(Stage).CopyTo(data[2..(2 + StageSize)]);
|
Encoding.UTF8.GetBytes(Stage).CopyTo(data[2..(2 + StageSize)]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue