diff --git a/src/Syroot.Worms.Mgame.GameServer/Client.WorldPartyAqua.Channel.cs b/src/Syroot.Worms.Mgame.GameServer/Client.WorldPartyAqua.Channel.cs index 1b16019..8cabf35 100644 --- a/src/Syroot.Worms.Mgame.GameServer/Client.WorldPartyAqua.Channel.cs +++ b/src/Syroot.Worms.Mgame.GameServer/Client.WorldPartyAqua.Channel.cs @@ -8,12 +8,21 @@ namespace Syroot.Worms.Mgame.GameServer { // ---- METHODS (PUBLIC) --------------------------------------------------------------------------------------- + public void HandleWwpaChannelAddFriend(AddFriendQuery packet) + { + SendPacket(new AddFriendReply + { + Result = FriendRequestResult.Success, + UserName = packet.UserName + }); + } + public void HandleWwpaChannelCmdFindUser(CmdFindUserQuery packet) { SendPacket(new CmdFindUserReply { Success = true, - NickName = "Fuckerman", + NickName = packet.UserName, Gender = UserGender.Male, GamesWon = 12, GamesLost = 17, diff --git a/src/Syroot.Worms.Mgame.GameServer/Packets/WorldPartyAqua/Channel/AddFriendQuery.cs b/src/Syroot.Worms.Mgame.GameServer/Packets/WorldPartyAqua/Channel/AddFriendQuery.cs new file mode 100644 index 0000000..94b390c --- /dev/null +++ b/src/Syroot.Worms.Mgame.GameServer/Packets/WorldPartyAqua/Channel/AddFriendQuery.cs @@ -0,0 +1,28 @@ +using System; +using Syroot.BinaryData.Memory; + +namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Channel +{ + /// + /// Represents the client request for an . + /// + [WwpaPacket(0x15C)] + internal class AddFriendQuery : IPacket + { + // ---- PROPERTIES --------------------------------------------------------------------------------------------- + + /// + /// Gets or sets the name of the user to add as a friend. + /// + 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(); + } +} diff --git a/src/Syroot.Worms.Mgame.GameServer/Packets/WorldPartyAqua/Channel/AddFriendReply.cs b/src/Syroot.Worms.Mgame.GameServer/Packets/WorldPartyAqua/Channel/AddFriendReply.cs new file mode 100644 index 0000000..a8951a6 --- /dev/null +++ b/src/Syroot.Worms.Mgame.GameServer/Packets/WorldPartyAqua/Channel/AddFriendReply.cs @@ -0,0 +1,39 @@ +using System; +using Syroot.BinaryData.Memory; + +namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Channel +{ + /// + /// Represents the server response to an . + /// + [WwpaPacket(0x15D)] + internal class AddFriendReply : IPacket + { + // ---- PROPERTIES --------------------------------------------------------------------------------------------- + + public FriendRequestResult Result { get; set; } + + /// + /// Gets or sets the name of the user who was added as a friend. + /// + public string UserName { get; set; } + + // ---- METHODS (PUBLIC) --------------------------------------------------------------------------------------- + + public void Load(ref SpanReader reader) => throw new NotImplementedException(); + + public void Save(ref SpanWriter writer) + { + writer.WriteEnumSafe(Result); + if (Result == FriendRequestResult.Success) + writer.WriteString2(UserName); + } + } + + internal enum FriendRequestResult : int + { + Success = 0, + NotFound = 1, + Fail = 99 + } +} diff --git a/src/Syroot.Worms.Mgame.GameServer/Packets/WorldPartyAqua/Channel/CmdFindUserQuery.cs b/src/Syroot.Worms.Mgame.GameServer/Packets/WorldPartyAqua/Channel/CmdFindUserQuery.cs index 72348f4..7f628d4 100644 --- a/src/Syroot.Worms.Mgame.GameServer/Packets/WorldPartyAqua/Channel/CmdFindUserQuery.cs +++ b/src/Syroot.Worms.Mgame.GameServer/Packets/WorldPartyAqua/Channel/CmdFindUserQuery.cs @@ -11,6 +11,9 @@ namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Channel { // ---- PROPERTIES --------------------------------------------------------------------------------------------- + /// + /// Gets or sets the name of the user to search. + /// public string UserName { get; set; } // ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------