diff --git a/src/tool/Syroot.Worms.Worms2.GameServer/PacketCode.cs b/src/tool/Syroot.Worms.Worms2.GameServer/PacketCode.cs index d53afde..88323e7 100644 --- a/src/tool/Syroot.Worms.Worms2.GameServer/PacketCode.cs +++ b/src/tool/Syroot.Worms.Worms2.GameServer/PacketCode.cs @@ -19,12 +19,14 @@ JoinReply = 801, LeaveRoom = 900, LeaveRoomReply = 901, - LeaveRoom2 = 1100, - LeaveRoomReply2 = 1101, + DisconnectUser = 1000, + CloseRoom = 1100, + CloseRoomReply = 1101, CreateGame = 1200, CreateGameReply = 1201, ChatRoom = 1300, ChatRoomReply = 1301, - JoinGame = 1326, + ConnectGame = 1326, + ConnectGameReply = 1327, } } diff --git a/src/tool/Syroot.Worms.Worms2.GameServer/Server.cs b/src/tool/Syroot.Worms.Worms2.GameServer/Server.cs index e98b91d..ed766c2 100644 --- a/src/tool/Syroot.Worms.Worms2.GameServer/Server.cs +++ b/src/tool/Syroot.Worms.Worms2.GameServer/Server.cs @@ -35,6 +35,7 @@ namespace Syroot.Worms.Worms2.GameServer [PacketCode.LeaveRoom] = OnLeaveRoom, [PacketCode.CreateGame] = OnCreateGame, [PacketCode.ChatRoom] = OnChatRoom, + [PacketCode.ConnectGame] = OnConnectGame }; } @@ -94,7 +95,7 @@ namespace Syroot.Worms.Worms2.GameServer SendPacket(connection, new Packet(PacketCode.ListItem, value1: 1234, data: Encoding.ASCII.GetBytes("12.34.45.56"), - name: "Room Name", + name: "SomeRoom", session: new SessionInfo { Unknown0 = 0x17171717, @@ -113,6 +114,21 @@ namespace Syroot.Worms.Worms2.GameServer private void OnListUsers(PacketConnection connection, Packet packet) { + SendPacket(connection, new Packet(PacketCode.ListItem, + value1: 12, // user ID, + data: Encoding.ASCII.GetBytes("12.34.45.67"), + name: "SomeUser", + session: new SessionInfo + { + Unknown0 = 0x17171717, + Unknown4 = 0x02010101, + GameVersion = 49, + GameRelease = 49, + Nation = Nation.IT, + Action0 = 01, + Action1 = 01, + Action2 = 01, + })); SendPacket(connection, new Packet(PacketCode.ListEnd)); } @@ -124,8 +140,14 @@ namespace Syroot.Worms.Worms2.GameServer name: "SomeUser", session: new SessionInfo { + Unknown0 = 0x17171717, + Unknown4 = 0x02010101, GameVersion = 49, - Nation = Nation.IT + GameRelease = 49, + Nation = Nation.IT, + Action0 = 01, + Action1 = 02, + Action2 = 01, })); SendPacket(connection, new Packet(PacketCode.ListEnd)); } @@ -168,5 +190,11 @@ namespace Syroot.Worms.Worms2.GameServer SendPacket(connection, new Packet(PacketCode.ChatRoomReply, error: 0)); } + + private void OnConnectGame(PacketConnection connection, Packet packet) + { + SendPacket(connection, new Packet(PacketCode.ConnectGameReply, + data: Encoding.ASCII.GetBytes("12.34.45.56"))); + } } } diff --git a/src/tool/Syroot.Worms.Worms2.GameServer/SessionInfo.cs b/src/tool/Syroot.Worms.Worms2.GameServer/SessionInfo.cs index 0051524..818bb22 100644 --- a/src/tool/Syroot.Worms.Worms2.GameServer/SessionInfo.cs +++ b/src/tool/Syroot.Worms.Worms2.GameServer/SessionInfo.cs @@ -28,6 +28,6 @@ namespace Syroot.Worms.Worms2.GameServer /// public override string ToString() => $"{Unknown0:X8}-{Unknown4:X8} {Nation} {GameVersion}/{GameRelease} " + $"{Action0:X2}-{Action1:X2}-{Action2:X2}-{Action3:X2} " - + $"{Unused15:X2}{Unused16:X8}{Unused24:X8}{Unused24:X8}{Unused40:X8}{Unused48:X2}"; + + $"{Unused15:X2}{Unused16:X16}{Unused24:X16}{Unused24:X16}{Unused40:X16}{Unused48:X4}"; } } diff --git a/src/tool/Syroot.Worms.Worms2.GameServer/Syroot.Worms.Worms2.GameServer.csproj b/src/tool/Syroot.Worms.Worms2.GameServer/Syroot.Worms.Worms2.GameServer.csproj index 4768fd0..c6fc5fe 100644 --- a/src/tool/Syroot.Worms.Worms2.GameServer/Syroot.Worms.Worms2.GameServer.csproj +++ b/src/tool/Syroot.Worms.Worms2.GameServer/Syroot.Worms.Worms2.GameServer.csproj @@ -7,7 +7,7 @@ netcoreapp3 - +