mirror of
https://gitlab.com/Syroot/Worms.git
synced 2025-01-27 22:27:58 +03:00
Implement proper disconnection from channel.
This commit is contained in:
parent
441648da6a
commit
629103fce5
@ -7,15 +7,14 @@ namespace Syroot.Worms.Mgame.GameServer
|
||||
{
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
public void HandleWwpaConnect(ConnectQuery packet)
|
||||
public void HandleWwpaChannelCmd(ChannelCmdQuery packet)
|
||||
{
|
||||
// Client fails to detect reply at rare times due to unknown reasons.
|
||||
SendPacket(new ConnectReply { ServerVersion = _server.Config.Version });
|
||||
}
|
||||
|
||||
public void HandleWwpaLogin(LoginQuery packet)
|
||||
{
|
||||
SendPacket(new LoginReply { Result = LoginResult.Success });
|
||||
switch (packet.Data)
|
||||
{
|
||||
case StartSingleGameQueryData startSingleGameQuery:
|
||||
HandleWwpaStartGameQuery(startSingleGameQuery);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleWwpaChannelList(ChannelListQuery packet)
|
||||
@ -91,22 +90,43 @@ namespace Syroot.Worms.Mgame.GameServer
|
||||
});
|
||||
}
|
||||
|
||||
public void HandleWwpaChannelConnect(ChannelLoginQuery packet)
|
||||
public void HandleWwpaChannelLogin(ChannelLoginQuery packet)
|
||||
{
|
||||
SendPacket(new ChannelLoginReply());
|
||||
}
|
||||
|
||||
public void HandleWwpaChannelCmd(ChannelCmdQuery packet)
|
||||
public void HandleWwpaConnect(ConnectQuery packet)
|
||||
{
|
||||
switch (packet.Data)
|
||||
{
|
||||
case StartSingleGameQueryData startSingleGameQuery:
|
||||
HandleWwpaStartGameQuery(startSingleGameQuery);
|
||||
break;
|
||||
}
|
||||
// Client fails to detect reply at rare times due to unknown reasons.
|
||||
SendPacket(new ConnectReply { ServerVersion = _server.Config.Version });
|
||||
}
|
||||
|
||||
public void HandleWwpaDisconnectQuery(DisconnectQuery packet) { }
|
||||
public void HandleWwpaDisconnect(DisconnectNotice packet) { }
|
||||
|
||||
public void HandleWwpaLogin(LoginQuery packet)
|
||||
{
|
||||
SendPacket(new LoginReply { Result = LoginResult.Success });
|
||||
}
|
||||
|
||||
public void HandleWwpaLogoutQuery(LogoutQuery packet)
|
||||
{
|
||||
SendPacket(new LogoutReply { Success = true });
|
||||
}
|
||||
|
||||
public void HandleWwpaOptionsQuery(OptionsQuery packet)
|
||||
{
|
||||
SendPacket(new OptionsReply
|
||||
{
|
||||
Success = true,
|
||||
Unknown = 1,
|
||||
WormNames = new List<string> { "WormName1", "WormName2", "WormName3" }
|
||||
});
|
||||
}
|
||||
|
||||
public void HandleWwpaOptionsSaveQuery(OptionsSaveQuery packet)
|
||||
{
|
||||
SendPacket(new OptionsSaveReply { Success = true });
|
||||
}
|
||||
|
||||
// ---- METHODS (PRIVATE) --------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -3,10 +3,10 @@
|
||||
namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the client packet probably sent when it notifies about disconnecting.
|
||||
/// Represents the client notice of disconnecting.
|
||||
/// </summary>
|
||||
[Packet(PacketFormat.Wwpa, 0x801B)]
|
||||
internal class DisconnectQuery : IPacket
|
||||
[Packet(PacketFormat.Wwpa, 0x105)]
|
||||
internal class DisconnectNotice : IPacket
|
||||
{
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
@ -0,0 +1,17 @@
|
||||
using Syroot.BinaryData.Memory;
|
||||
|
||||
namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the client request for a <see cref="LogoutReply"/>.
|
||||
/// </summary>
|
||||
[Packet(PacketFormat.Wwpa, 0x103)]
|
||||
internal class LogoutQuery : IPacket
|
||||
{
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
public void Load(ref SpanReader reader) { }
|
||||
|
||||
public void Save(ref SpanWriter writer) { }
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using Syroot.BinaryData.Memory;
|
||||
|
||||
namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the server response to a <see cref="LogoutQuery"/>.
|
||||
/// </summary>
|
||||
[Packet(PacketFormat.Wwpa, 0x104)]
|
||||
internal class LogoutReply : IPacket
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
public bool Success { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
public void Load(ref SpanReader reader) => throw new NotImplementedException();
|
||||
|
||||
public void Save(ref SpanWriter writer)
|
||||
{
|
||||
writer.WriteBoolean4(Success);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using Syroot.BinaryData.Memory;
|
||||
|
||||
namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the client request for an <see cref="OptionsReply"/>.
|
||||
/// </summary>
|
||||
[Packet(PacketFormat.Wwpa, 0x8046)]
|
||||
internal class OptionsQuery : IPacket
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
public string UserName { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
public void Load(ref SpanReader reader)
|
||||
{
|
||||
UserName = reader.ReadString2();
|
||||
}
|
||||
|
||||
public void Save(ref SpanWriter writer) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Syroot.BinaryData.Memory;
|
||||
|
||||
namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the server response to a <see cref="OptionsQuery"/>.
|
||||
/// </summary>
|
||||
[Packet(PacketFormat.Wwpa, 0x8047)]
|
||||
internal class OptionsReply : IPacket
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
public bool Success { get; set; }
|
||||
|
||||
public byte Unknown { get; set; }
|
||||
|
||||
public IList<string> WormNames { get; set; } // 3 elements, max. 20 chars each
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
public void Load(ref SpanReader reader) => throw new NotImplementedException();
|
||||
|
||||
public void Save(ref SpanWriter writer)
|
||||
{
|
||||
writer.WriteBoolean4(Success);
|
||||
if (Success)
|
||||
{
|
||||
writer.WriteByte(Unknown);
|
||||
writer.WriteString2(WormNames[0]);
|
||||
writer.WriteString2(WormNames[1]);
|
||||
writer.WriteString2(WormNames[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Syroot.BinaryData.Memory;
|
||||
|
||||
namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the client request for an <see cref="OptionsSaveReply"/>.
|
||||
/// </summary>
|
||||
[Packet(PacketFormat.Wwpa, 0x8048)]
|
||||
internal class OptionsSaveQuery : IPacket
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
public string UserName { get; set; }
|
||||
|
||||
public bool Unknown { get; set; }
|
||||
|
||||
public IList<string> WormNames { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
public void Load(ref SpanReader reader)
|
||||
{
|
||||
UserName = reader.ReadString2();
|
||||
Unknown = reader.ReadBoolean();
|
||||
WormNames = new List<string> { reader.ReadString2(), reader.ReadString2(), reader.ReadString2() };
|
||||
}
|
||||
|
||||
public void Save(ref SpanWriter writer) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using Syroot.BinaryData.Memory;
|
||||
|
||||
namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the server response to an <see cref="OptionsSaveQuery"/>.
|
||||
/// </summary>
|
||||
[Packet(PacketFormat.Wwpa, 0x8049)]
|
||||
internal class OptionsSaveReply : IPacket
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
public bool Success { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
public void Load(ref SpanReader reader) => throw new NotImplementedException();
|
||||
|
||||
public void Save(ref SpanWriter writer)
|
||||
{
|
||||
writer.WriteBoolean4(Success);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
// Server settings
|
||||
"IP": "127.0.0.1", // external IP sent to clients to connect to
|
||||
"IP": "89.244.195.103", // external IP sent to clients to connect to
|
||||
"Port": 17022,
|
||||
"Name": "Mgame Worms Private Server",
|
||||
"Region": "Global",
|
||||
|
4
src/desktop.ini
Normal file
4
src/desktop.ini
Normal file
@ -0,0 +1,4 @@
|
||||
[ViewState]
|
||||
Mode=
|
||||
Vid=
|
||||
FolderType=Generic
|
Loading…
x
Reference in New Issue
Block a user