mirror of
https://gitlab.com/Syroot/Worms.git
synced 2025-01-13 15:27:59 +03:00
Implement AddFriendQuery/Reply
This commit is contained in:
parent
e9c88caadc
commit
5c84357edb
@ -8,12 +8,21 @@ namespace Syroot.Worms.Mgame.GameServer
|
|||||||
{
|
{
|
||||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public void HandleWwpaChannelAddFriend(AddFriendQuery packet)
|
||||||
|
{
|
||||||
|
SendPacket(new AddFriendReply
|
||||||
|
{
|
||||||
|
Result = FriendRequestResult.Success,
|
||||||
|
UserName = packet.UserName
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void HandleWwpaChannelCmdFindUser(CmdFindUserQuery packet)
|
public void HandleWwpaChannelCmdFindUser(CmdFindUserQuery packet)
|
||||||
{
|
{
|
||||||
SendPacket(new CmdFindUserReply
|
SendPacket(new CmdFindUserReply
|
||||||
{
|
{
|
||||||
Success = true,
|
Success = true,
|
||||||
NickName = "Fuckerman",
|
NickName = packet.UserName,
|
||||||
Gender = UserGender.Male,
|
Gender = UserGender.Male,
|
||||||
GamesWon = 12,
|
GamesWon = 12,
|
||||||
GamesLost = 17,
|
GamesLost = 17,
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using Syroot.BinaryData.Memory;
|
||||||
|
|
||||||
|
namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Channel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the client request for an <see cref="AddFriendReply"/>.
|
||||||
|
/// </summary>
|
||||||
|
[WwpaPacket(0x15C)]
|
||||||
|
internal class AddFriendQuery : IPacket
|
||||||
|
{
|
||||||
|
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the user to add as a friend.
|
||||||
|
/// </summary>
|
||||||
|
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,39 @@
|
|||||||
|
using System;
|
||||||
|
using Syroot.BinaryData.Memory;
|
||||||
|
|
||||||
|
namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Channel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the server response to an <see cref="AddFriendQuery"/>.
|
||||||
|
/// </summary>
|
||||||
|
[WwpaPacket(0x15D)]
|
||||||
|
internal class AddFriendReply : IPacket
|
||||||
|
{
|
||||||
|
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public FriendRequestResult Result { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the user who was added as a friend.
|
||||||
|
/// </summary>
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,9 @@ namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Channel
|
|||||||
{
|
{
|
||||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the user to search.
|
||||||
|
/// </summary>
|
||||||
public string UserName { get; set; }
|
public string UserName { get; set; }
|
||||||
|
|
||||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user