From 83024baaf3cb54764422d2fbc9efdb0bccea982e Mon Sep 17 00:00:00 2001 From: Ray Koopa Date: Sun, 6 Jan 2019 23:16:13 +0100 Subject: [PATCH] Rename PacketType to PacketFormat. --- src/Syroot.Worms.OnlineWorms.Server/Client.cs | 3 + src/Syroot.Worms.OnlineWorms.Server/Config.cs | 2 + .../Net/GameConnection.cs | 40 ++++++----- .../Net/Packet.cs | 72 ++++++++----------- .../Net/PacketAttribute.cs | 15 ++-- .../Net/PacketFactory.cs | 6 +- .../Net/Packets/ChannelConnectQuery.cs | 2 +- .../Net/Packets/ChannelConnectReply.cs | 2 +- .../Net/Packets/ChannelEnterFinishReply.cs | 2 +- .../Net/Packets/ChannelEnterQuery.cs | 2 +- .../Net/Packets/ChannelEnterReply.cs | 2 +- .../Net/Packets/ChannelInfosReply.cs | 2 +- .../Net/Packets/ChannelTop20Query.cs | 2 +- .../Net/Packets/ChannelTop20Reply.cs | 2 +- .../Net/Packets/ConnectQuery.cs | 2 +- .../Net/Packets/ConnectReply.cs | 2 +- .../Net/Packets/LoginQuery.cs | 2 +- .../Net/Packets/LoginReply.cs | 2 +- .../Net/Packets/RawQuery.cs | 4 +- .../Net/Packets/ServerInfoReply.cs | 2 +- .../Net/Packets/StartSingleGameQuery.cs | 2 +- .../Net/Packets/StartSingleGameReply.cs | 2 +- .../OWServerConfig.json | 6 +- 23 files changed, 90 insertions(+), 88 deletions(-) diff --git a/src/Syroot.Worms.OnlineWorms.Server/Client.cs b/src/Syroot.Worms.OnlineWorms.Server/Client.cs index 14ceee1..eb769bc 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Client.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Client.cs @@ -2,6 +2,7 @@ using System.Drawing; using System.Net; using System.Net.Sockets; +using System.Threading; using Syroot.Worms.OnlineWorms.Server.Net; namespace Syroot.Worms.OnlineWorms.Server @@ -189,6 +190,8 @@ namespace Syroot.Worms.OnlineWorms.Server protected override void OnPrePacketSend(Packet packet) { _server.Log.Write(LogCategory.Server, $"{TcpClient.Client.RemoteEndPoint} << {packet}"); + if (_server.Config.SendDelay > 0) + Thread.Sleep(_server.Config.SendDelay); } } } \ No newline at end of file diff --git a/src/Syroot.Worms.OnlineWorms.Server/Config.cs b/src/Syroot.Worms.OnlineWorms.Server/Config.cs index 37c3b07..47f85a6 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Config.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Config.cs @@ -20,6 +20,8 @@ namespace Syroot.Worms.OnlineWorms.Server public string Region { get; set; } public ushort Version { get; set; } + public int SendDelay { get; set; } + internal IPAddress IPAddress => IPAddress.Parse(IP); internal IPEndPoint EndPoint => new IPEndPoint(IPAddress, Port); } diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/GameConnection.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/GameConnection.cs index 1560382..cd5322a 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/GameConnection.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/GameConnection.cs @@ -126,7 +126,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net private Packet ReceivePacket() { // Receive the raw packet data. - PacketType type; + PacketFormat type; int id; ushort dataSize; try @@ -135,7 +135,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net ushort tag = _receiveStream.ReadUInt16(); if (tag == _channelPacketStartTag) { - type = PacketType.Channel; + type = PacketFormat.Channel; if (_receiveStream.Read1Byte() != 1) throw new IOException("Invalid channel packet start tag."); dataSize = _receiveStream.ReadUInt16(); @@ -147,7 +147,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net } else { - type = PacketType.Server; + type = PacketFormat.Server; id = tag; dataSize = _receiveStream.ReadUInt16(); _receiveStream.ReadAll(_receiveBuffer, 0, dataSize); @@ -167,34 +167,40 @@ namespace Syroot.Worms.OnlineWorms.Server.Net { OnPrePacketSend(packet); - // Serialize the raw packet data, which must consist of at least 1 byte (at least for channels). + // Serialize the packet data. _sendStream.Position = 0; packet.Serialize(_sendStream); - if (_sendStream.Position == 0) - _sendStream.WriteByte(0); - ushort dataSize = (ushort)_sendStream.Position; + ushort dataSize; - // Send the data and return success. + // Send the packet in one of the two possible formats and return success. try { PacketAttribute attribute = PacketFactory.GetAttribute(packet); - switch (attribute.PacketType) + switch (attribute.Format) { - case PacketType.Channel: + case PacketFormat.Server: + // Retrieve data size. + dataSize = (ushort)_sendStream.Position; + // Send head and data. + _receiveStream.WriteUInt16((ushort)attribute.ID); + _receiveStream.WriteUInt16(dataSize); + _receiveStream.Write(_sendDataBuffer, 0, dataSize); + break; + case PacketFormat.Channel: + // Retrieve data size. Data must have at least 1 byte. + if (_sendStream.Position == 0) + _sendStream.WriteByte(0); + dataSize = (ushort)_sendStream.Position; + // Send head, data, and tail. _receiveStream.WriteUInt16(_channelPacketStartTag); _receiveStream.WriteByte(1); _receiveStream.WriteUInt16(dataSize); - _receiveStream.WriteByte((byte)attribute.PacketID); + _receiveStream.WriteByte((byte)attribute.ID); _receiveStream.Write(_sendDataBuffer, 0, dataSize); _receiveStream.Write(_channelPacketEndTag); break; - case PacketType.Server: - _receiveStream.WriteUInt16((ushort)attribute.PacketID); - _receiveStream.WriteUInt16(dataSize); - _receiveStream.Write(_sendDataBuffer, 0, dataSize); - break; default: - throw new IOException("Cannot send unknown packet type."); + throw new IOException("Cannot send unknown packet format."); } return true; } diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packet.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packet.cs index b881157..1199746 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packet.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packet.cs @@ -41,14 +41,10 @@ namespace Syroot.Worms.OnlineWorms.Server.Net switch (obj) { case null: - sb.Append(indent); - sb.Append("null"); + sb.Append($"{indent}null"); break; case String stringValue: - sb.Append(indent); - sb.Append('"'); - sb.Append(stringValue); - sb.Append('"'); + sb.Append($"{indent}\"{stringValue}\""); break; case Byte[] byteArrayValue: sb.Append(indent); @@ -62,62 +58,50 @@ namespace Syroot.Worms.OnlineWorms.Server.Net sb.Append("]"); break; case Byte byteValue: - sb.Append(indent); - sb.Append("0x" + byteValue.ToString("X2")); + sb.Append($"{indent}0x{byteValue:X2}"); break; case Int16 int16Value: - sb.Append(indent); - sb.Append("0x" + int16Value.ToString("X4")); + sb.Append($"{indent}0x{int16Value:X4}"); break; case Int32 int32Value: - sb.Append(indent); - sb.Append("0x" + int32Value.ToString("X8")); + sb.Append($"{indent}0x{int32Value:X8}"); break; case Int64 int64Value: - sb.Append(indent); - sb.Append("0x" + int64Value.ToString("X16")); + sb.Append($"{indent}0x{int64Value:X16}"); break; case UInt16 uint16Value: - sb.Append(indent); - sb.Append("0x" + uint16Value.ToString("X4")); + sb.Append($"{indent}0x{uint16Value:X4}"); break; case UInt32 uint32Value: - sb.Append(indent); - sb.Append("0x" + uint32Value.ToString("X8")); + sb.Append($"{indent}0x{uint32Value:X8}"); break; case UInt64 uint64Value: - sb.Append(indent); - sb.Append("0x" + uint64Value.ToString("X16")); - break; - case Enum enumValue: - sb.Append(indent); - sb.Append(enumValue.ToString()); - break; - case Color color: - sb.Append(indent); - sb.Append(color.ToString()); + sb.Append($"{indent}0x{uint64Value:X16}"); break; case IPEndPoint ipEndPoint: - sb.Append(indent); - sb.Append($"{ipEndPoint.Address}:{ipEndPoint.Port}"); - break; - case IPAddress ipAddress: - sb.Append(indent); - sb.Append(ipAddress.ToString()); + sb.Append($"{indent}{ipEndPoint.Address}:{ipEndPoint.Port}"); break; default: - foreach (PropertyInfo property in obj.GetType().GetProperties( - BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)) + Type objType = obj.GetType(); + if (objType == typeof(Boolean) || objType.IsEnum || objType == typeof(Color) + || objType == typeof(IPAddress)) { - // Ignore indexers. - if (property.GetIndexParameters().Length > 0) - continue; - sb.AppendLine(); - sb.Append((indent + property.Name).PadRight(20)); - sb.Append(" "); - sb.Append(DumpClass(property.GetValue(obj), indentLevel + 1)); + sb.Append($"{indent}{obj}"); + } + else + { + foreach (PropertyInfo property in objType.GetProperties( + BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)) + { + if (property.GetIndexParameters().Length > 0) + continue; + sb.AppendLine(); + sb.Append((indent + property.Name).PadRight(20)); + sb.Append(" "); + sb.Append(DumpClass(property.GetValue(obj), indentLevel + 1)); + } + sb.AppendLine(); } - sb.AppendLine(); break; } return sb.ToString().TrimEnd(); diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/PacketAttribute.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/PacketAttribute.cs index 1447d34..d1072d0 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/PacketAttribute.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/PacketAttribute.cs @@ -15,10 +15,10 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// packet it represents. /// /// The ID of the packet which the decorated class represents. - public PacketAttribute(PacketType type, int id) + public PacketAttribute(PacketFormat format, int id) { - PacketType = type; - PacketID = id; + Format = format; + ID = id; } // ---- PROPERTIES --------------------------------------------------------------------------------------------- @@ -26,12 +26,15 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// /// Gets the ID of the packet the decorated class represents. /// - public int PacketID { get; } + public int ID { get; } - public PacketType PacketType { get; } + /// + /// Gets the format in which the packet is serialized and sent over the network. + /// + public PacketFormat Format { get; } } - internal enum PacketType + internal enum PacketFormat { Server, Channel diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/PacketFactory.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/PacketFactory.cs index 64bc670..0379f2f 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/PacketFactory.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/PacketFactory.cs @@ -26,7 +26,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net if (_packetMetas.ContainsKey(attrib)) { throw new InvalidOperationException( - $"{attrib.PacketType} packet with ID {attrib.PacketID} mapped to multiple classes."); + $"{attrib.Format} packet with ID {attrib.ID} mapped to multiple classes."); } _packetMetas.Add(attrib, type); } @@ -41,11 +41,11 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// The ID of the packet class to instantiate. /// The created instance. /// No class was mapped to the given packet ID. - internal static Packet Create(PacketType type, int id) + internal static Packet Create(PacketFormat type, int id) { foreach (KeyValuePair packetMeta in _packetMetas) { - if (packetMeta.Key.PacketType == type && packetMeta.Key.PacketID == id) + if (packetMeta.Key.Format == type && packetMeta.Key.ID == id) return (Packet)Activator.CreateInstance(packetMeta.Value, true); } // No packet metadata matching. diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelConnectQuery.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelConnectQuery.cs index 3db4985..55c828c 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelConnectQuery.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelConnectQuery.cs @@ -8,7 +8,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// /// Represents the client request for a . /// - [Packet(PacketType.Channel, 0x10)] + [Packet(PacketFormat.Channel, 0x10)] internal class ChannelConnectQuery : Packet { // ---- PROPERTIES --------------------------------------------------------------------------------------------- diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelConnectReply.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelConnectReply.cs index 84ace68..eb98af0 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelConnectReply.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelConnectReply.cs @@ -6,7 +6,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// /// Represents the server response to a . /// - [Packet(PacketType.Channel, 0x11)] + [Packet(PacketFormat.Channel, 0x11)] internal class ChannelConnectReply : Packet { // ---- PROPERTIES --------------------------------------------------------------------------------------------- diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelEnterFinishReply.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelEnterFinishReply.cs index 3edd749..f32121e 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelEnterFinishReply.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelEnterFinishReply.cs @@ -6,7 +6,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// Represents an additional server response to a , causing the client to switch /// to the channel screen (game lobby). /// - [Packet(PacketType.Channel, 0x44)] + [Packet(PacketFormat.Channel, 0x44)] internal class ChannelEnterFinishReply : Packet { // ---- METHODS (INTERNAL) ------------------------------------------------------------------------------------- diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelEnterQuery.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelEnterQuery.cs index 274923c..8b6dc95 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelEnterQuery.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelEnterQuery.cs @@ -7,7 +7,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// /// Represents the client request for a . /// - [Packet(PacketType.Server, 0x8034)] + [Packet(PacketFormat.Server, 0x8034)] internal class ChannelEnterQuery : Packet { // ---- PROPERTIES --------------------------------------------------------------------------------------------- diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelEnterReply.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelEnterReply.cs index cb538da..8d1c449 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelEnterReply.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelEnterReply.cs @@ -7,7 +7,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// /// Represents the server response to a . /// - [Packet(PacketType.Server, 0x8035)] + [Packet(PacketFormat.Server, 0x8035)] internal class ChannelEnterReply : Packet { // ---- PROPERTIES --------------------------------------------------------------------------------------------- diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelInfosReply.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelInfosReply.cs index edfe321..517987c 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelInfosReply.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelInfosReply.cs @@ -9,7 +9,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// /// Represents an additional server response to a , providing available server channels. /// - [Packet(PacketType.Server, 0x80C9)] + [Packet(PacketFormat.Server, 0x80C9)] internal class ChannelInfosReply : Packet { // ---- PROPERTIES --------------------------------------------------------------------------------------------- diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelTop20Query.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelTop20Query.cs index fa80f1d..55879fb 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelTop20Query.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelTop20Query.cs @@ -6,7 +6,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// /// Represents the client request for a . /// - [Packet(PacketType.Channel, 0x37)] + [Packet(PacketFormat.Channel, 0x37)] internal class ChannelTop20Query : Packet { // ---- PROPERTIES --------------------------------------------------------------------------------------------- diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelTop20Reply.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelTop20Reply.cs index 54ca28e..aa74d33 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelTop20Reply.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ChannelTop20Reply.cs @@ -7,7 +7,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// /// Represents the server response to a . /// - [Packet(PacketType.Channel, 0x36)] + [Packet(PacketFormat.Channel, 0x36)] internal class ChannelTop20Reply : Packet { // ---- PROPERTIES --------------------------------------------------------------------------------------------- diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ConnectQuery.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ConnectQuery.cs index 851b711..90c6c9f 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ConnectQuery.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ConnectQuery.cs @@ -5,7 +5,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// /// Represents the client request for a . /// - [Packet(PacketType.Server, 0x800E)] + [Packet(PacketFormat.Server, 0x800E)] internal class ConnectQuery : Packet { // ---- METHODS (INTERNAL) ------------------------------------------------------------------------------------- diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ConnectReply.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ConnectReply.cs index 91f4646..7c4c3dc 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ConnectReply.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ConnectReply.cs @@ -6,7 +6,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// /// Represents the server response to a . /// - [Packet(PacketType.Server, 0x800F)] + [Packet(PacketFormat.Server, 0x800F)] internal class ConnectReply : Packet { // ---- PROPERTIES --------------------------------------------------------------------------------------------- diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/LoginQuery.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/LoginQuery.cs index fd7d397..98ec6e2 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/LoginQuery.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/LoginQuery.cs @@ -7,7 +7,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// /// Represents the client request for a . /// - [Packet(PacketType.Server, 0x8000)] + [Packet(PacketFormat.Server, 0x8000)] internal class LoginQuery : Packet { // ---- PROPERTIES --------------------------------------------------------------------------------------------- diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/LoginReply.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/LoginReply.cs index c847074..179ab5d 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/LoginReply.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/LoginReply.cs @@ -6,7 +6,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// /// Represents the server response to a . /// - [Packet(PacketType.Server, 0x8001)] + [Packet(PacketFormat.Server, 0x8001)] internal class LoginReply : Packet { // ---- PROPERTIES --------------------------------------------------------------------------------------------- diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/RawQuery.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/RawQuery.cs index 2603beb..741aa26 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/RawQuery.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/RawQuery.cs @@ -10,7 +10,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net { // ---- CONSTRUCTORS & DESTRUCTOR ------------------------------------------------------------------------------ - internal RawPacket(PacketType type, int id, params byte[] data) + internal RawPacket(PacketFormat type, int id, params byte[] data) { Type = type; ID = id; @@ -19,7 +19,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net // ---- PROPERTIES --------------------------------------------------------------------------------------------- - internal PacketType Type { get; } + internal PacketFormat Type { get; } internal int ID { get; } diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ServerInfoReply.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ServerInfoReply.cs index fc71baf..048ee15 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ServerInfoReply.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/ServerInfoReply.cs @@ -6,7 +6,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// Represents an additional server response to a , providing informational server /// screen text. /// - [Packet(PacketType.Server, 0x8033)] + [Packet(PacketFormat.Server, 0x8033)] internal class ServerInfoReply : Packet { // ---- PROPERTIES --------------------------------------------------------------------------------------------- diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/StartSingleGameQuery.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/StartSingleGameQuery.cs index 23ad7d0..9088945 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/StartSingleGameQuery.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/StartSingleGameQuery.cs @@ -6,7 +6,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// /// Represents the client request for a . /// - [Packet(PacketType.Channel, 0x38)] + [Packet(PacketFormat.Channel, 0x38)] internal class StartSingleGameQuery : Packet { // ---- PROPERTIES --------------------------------------------------------------------------------------------- diff --git a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/StartSingleGameReply.cs b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/StartSingleGameReply.cs index 99ed9c5..f76ae14 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/StartSingleGameReply.cs +++ b/src/Syroot.Worms.OnlineWorms.Server/Net/Packets/StartSingleGameReply.cs @@ -6,7 +6,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net /// /// Represents the server response to a . /// - [Packet(PacketType.Channel, 0x39)] + [Packet(PacketFormat.Channel, 0x39)] internal class StartSingleGameReply : Packet { // ---- PROPERTIES --------------------------------------------------------------------------------------------- diff --git a/src/Syroot.Worms.OnlineWorms.Server/OWServerConfig.json b/src/Syroot.Worms.OnlineWorms.Server/OWServerConfig.json index c2190a2..3be4f42 100644 --- a/src/Syroot.Worms.OnlineWorms.Server/OWServerConfig.json +++ b/src/Syroot.Worms.OnlineWorms.Server/OWServerConfig.json @@ -1,7 +1,11 @@ { + // Server settings "IP": "127.0.0.1", // external IP sent to clients to connect to "Port": 17022, "Name": "Online Worms Private Server", "Region": "Global", - "Version": 114 + "Version": 114, + + // Debugging settings (optional) + "SendDelay": 100 // milliseconds to sleep before sending packets (simulate network load) } \ No newline at end of file