Handle additional packets.

This commit is contained in:
Ray Koopa 2020-07-09 17:06:37 +02:00
parent 17b0edf67f
commit ac2d12c1b6
4 changed files with 37 additions and 7 deletions

View File

@ -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,
}
}

View File

@ -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")));
}
}
}

View File

@ -28,6 +28,6 @@ namespace Syroot.Worms.Worms2.GameServer
/// <inheritdoc/>
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}";
}
}

View File

@ -7,7 +7,7 @@
<TargetFramework>netcoreapp3</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Syroot.ColoredConsole" Version="1.0.0-beta.1" />
<PackageReference Include="Syroot.ColoredConsole" Version="1.0.0" />
<ProjectReference Include="..\..\library\Syroot.Worms\Syroot.Worms.csproj" />
</ItemGroup>
</Project>