0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-22 11:15:15 +00:00
This commit is contained in:
Sanae 2022-04-27 14:09:50 -06:00
parent a775e593c3
commit df2e976782
2 changed files with 12 additions and 7 deletions

View file

@ -40,12 +40,17 @@ public class Client : IDisposable {
PacketAttribute packetAttribute = Constants.PacketMap[typeof(T)]; PacketAttribute packetAttribute = Constants.PacketMap[typeof(T)];
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 {
PacketHeader header = new PacketHeader { PacketHeader header = new PacketHeader {
Id = sender?.Id ?? Id, Id = sender?.Id ?? Id,
Type = packetAttribute.Type, Type = packetAttribute.Type,
PacketSize = packet.Size PacketSize = packet.Size
}; };
Server.FillPacket(header, packet, memory.Memory); Server.FillPacket(header, packet, memory.Memory);
}
catch (Exception e) {
Logger.Error($"I will lose my shit {e}");
}
if (packetAttribute.Type is not PacketType.Cap and not PacketType.Player) if (packetAttribute.Type is not PacketType.Cap and not PacketType.Player)
Logger.Info($"About to receive {packetAttribute.Type} ({(short)packetAttribute.Type}) - {typeof(T)}"); Logger.Info($"About to receive {packetAttribute.Type} ({(short)packetAttribute.Type}) - {typeof(T)}");

View file

@ -14,7 +14,7 @@ Logger consoleLogger = new Logger("Console");
server.ClientJoined += (c, _) => { server.ClientJoined += (c, _) => {
c.Metadata["shineSync"] = new ConcurrentBag<int>(); c.Metadata["shineSync"] = new ConcurrentBag<int>();
c.Metadata["loadedSave"] = false; c.Metadata["loadedSave"] = false;
c.Metadata["scenario"] = 0; c.Metadata["scenario"] = (byte?)0;
c.Metadata["2d"] = false; c.Metadata["2d"] = false;
c.Metadata["speedrun"] = false; c.Metadata["speedrun"] = false;
foreach (Client client in server.Clients.Where(client => client.Metadata.ContainsKey("lastGamePacket")).ToArray()) { foreach (Client client in server.Clients.Where(client => client.Metadata.ContainsKey("lastGamePacket")).ToArray()) {