Implement CmdFindUser

This commit is contained in:
Ray Koopa 2019-01-22 18:22:01 +01:00
parent 38035742d6
commit 1b527a3f20
5 changed files with 143 additions and 5 deletions

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Channel; using Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Channel;
namespace Syroot.Worms.Mgame.GameServer namespace Syroot.Worms.Mgame.GameServer
@ -7,7 +8,31 @@ namespace Syroot.Worms.Mgame.GameServer
{ {
// ---- METHODS (PUBLIC) --------------------------------------------------------------------------------------- // ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
public void HandleWwpaChannelCmd(CmdStartSingleGameQuery packet) public void HandleWwpaChannelCmdFindUser(CmdFindUserQuery packet)
{
SendPacket(new CmdFindUserReply
{
Success = true,
NickName = "Fuckerman",
Gender = UserGender.Male,
GamesWon = 12,
GamesLost = 17,
GamesDrawn = 8,
Level = 15,
Guild = "Shitterguild",
Experience = 2350,
Currency = 12000,
Phone = "081 892 0242",
Address = "Asshole Road 13",
Birthday = new DateTime(1997, 11, 3),
Introduction = "Hello I'm sooo gay",
MaybeAvatar = new int[13]
});
}
public void HandleWwpaChannelCmdStartSingleGame(CmdStartSingleGameQuery packet)
{ {
SendPacket(new CmdStartSingleGameReply SendPacket(new CmdStartSingleGameReply
{ {
@ -25,7 +50,7 @@ namespace Syroot.Worms.Mgame.GameServer
}); });
} }
public void HandleWwpaChannelCmd(CmdUnknown6Query packet) public void HandleWwpaChannelCmdUnknown6(CmdUnknown6Query packet)
{ {
SendPacket(new CmdUnknown6Reply SendPacket(new CmdUnknown6Reply
{ {

View File

@ -48,6 +48,9 @@ namespace Syroot.Worms.Mgame.GameServer.Core
case Byte byteValue: case Byte byteValue:
sb.Append($"{indent}0x{byteValue:X2}"); sb.Append($"{indent}0x{byteValue:X2}");
break; break;
case DateTime dateTimeValue:
sb.Append($"{indent}{dateTimeValue}");
break;
case Int16 int16Value: case Int16 int16Value:
sb.Append($"{indent}0x{int16Value:X4}"); sb.Append($"{indent}0x{int16Value:X4}");
break; break;

View File

@ -0,0 +1,25 @@
using System;
using Syroot.BinaryData.Memory;
namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Channel
{
/// <summary>
/// Represents the client request for a <see cref="CmdFindUserReply"/>.
/// </summary>
[WwpaPacket(0x10A, Command = 1)]
internal class CmdFindUserQuery : 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();
}
}

View File

@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using Syroot.BinaryData.Memory;
namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Channel
{
/// <summary>
/// Represents the server response to a <see cref="CmdFindUserQuery"/>.
/// </summary>
[WwpaPacket(0x10B, Command = 1)]
internal class CmdFindUserReply : IPacket
{
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
public bool Success { get; set; }
public string NickName { get; set; }
public UserGender Gender { get; set; }
public int GamesWon { get; set; }
public int GamesLost { get; set; }
public int GamesDrawn { get; set; }
public ushort Level { get; set; }
public uint MaybeClass { get; set; }
public string Guild { get; set; }
public long Experience { get; set; }
public long Currency { get; set; }
public uint MaybeLocation { get; set; }
public string Phone { get; set; }
public string Address { get; set; }
public DateTime Birthday { get; set; }
public string Introduction { get; set; }
public IList<int> MaybeAvatar { get; set; } // 13 elements
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
public void Load(ref SpanReader reader) => throw new NotImplementedException();
public void Save(ref SpanWriter writer)
{
writer.WriteInt32(Success ? 1 : 2);
if (Success)
{
writer.WriteString2(NickName);
writer.WriteEnumSafe(Gender);
writer.WriteInt32(GamesWon);
writer.WriteInt32(GamesLost);
writer.WriteInt32(GamesDrawn);
writer.WriteUInt16(Level);
writer.WriteUInt32(MaybeClass);
writer.WriteString2(Guild);
writer.WriteInt64(Experience);
writer.WriteInt64(Currency);
writer.WriteString2(Phone);
writer.WriteString2(Address);
writer.WriteString2(Birthday.ToShortDateString());
writer.WriteString2(Introduction);
writer.WriteUInt32(MaybeLocation);
for (int i = 0; i < 13; i++)
writer.WriteInt32(MaybeAvatar[i]);
}
}
}
internal enum UserGender : byte
{
Male = 1,
Female = 2
}
}

View File

@ -1,4 +1,5 @@
using System.Net; using System;
using System.Net;
using Syroot.BinaryData.Memory; using Syroot.BinaryData.Memory;
namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Channel namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Channel
@ -23,6 +24,6 @@ namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Channel
ClientIP = IPAddress.Parse(reader.ReadString2()); ClientIP = IPAddress.Parse(reader.ReadString2());
} }
public void Save(ref SpanWriter writer) { } public void Save(ref SpanWriter writer) => throw new NotImplementedException();
} }
} }