Skip to content

Commit

Permalink
LoginServer: Add DeleteCharacterHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
Andoryuuta committed Jan 9, 2022
1 parent ea5cee5 commit f641d20
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions Arrowgene.Ddon.LoginServer/DdonLoginServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ private void LoadPacketHandler()
AddHandler(new GetLoginSettingHandler(this));
AddHandler(new GpCourseGetInfoHandler(this));
AddHandler(new GetCharacterListHandler(this));
AddHandler(new DeleteCharacterHandler(this));
AddHandler(new ClientX6Handler(this));
AddHandler(new ClientX9Handler(this));
AddHandler(new ClientX10Handler(this));
Expand Down
32 changes: 32 additions & 0 deletions Arrowgene.Ddon.LoginServer/Handler/DeleteCharacterHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Arrowgene.Buffers;
using Arrowgene.Ddon.Server.Logging;
using Arrowgene.Ddon.Server.Network;
using Arrowgene.Logging;
using System.Text;

namespace Arrowgene.Ddon.LoginServer.Handler
{
public class DeleteCharacterHandler : PacketHandler<LoginClient>
{
private static readonly DdonLogger Logger = LogProvider.Logger<DdonLogger>(typeof(DeleteCharacterHandler));

public DeleteCharacterHandler(DdonLoginServer server) : base(server)
{
}

public override PacketId Id => PacketId.C2L_DELETE_CHARACTER_INFO_REQ;

public override void Handle(LoginClient client, Packet packet)
{
IBuffer recv = packet.AsBuffer();
uint characterID = recv.ReadUInt32(Endianness.Big);
Logger.Debug(client, $"Tried to delete character with ID: {characterID}");


IBuffer buffer = new StreamBuffer();
buffer.WriteInt32(0); //us_error
buffer.WriteUInt32(0, Endianness.Big);
client.Send(new Packet(PacketId.L2C_DELETE_CHARACTER_INFO_RES, buffer.GetAllBytes(), PacketSource.Server));
}
}
}
5 changes: 5 additions & 0 deletions Arrowgene.Ddon.Server/Network/PacketId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ public override int GetHashCode()
public static readonly PacketId X11_REQ = new PacketId(5, 3, 1, "X11_REQ");
public static readonly PacketId X11_RES = new PacketId(5, 3, 2, "X11_RES");

public static readonly PacketId C2L_DELETE_CHARACTER_INFO_REQ = new PacketId(5, 4, 1, "C2L_DELETE_CHARACTER_INFO_REQ");
public static readonly PacketId L2C_DELETE_CHARACTER_INFO_RES = new PacketId(5, 4, 2, "L2C_DELETE_CHARACTER_INFO_RES");

public static readonly PacketId X60 = new PacketId(5, 1, 1, "X60");
public static readonly PacketId X61 = new PacketId(5, 1, 2, "X61");
public static readonly PacketId X62 = new PacketId(5, 5, 16, "X62");
Expand Down Expand Up @@ -134,6 +137,8 @@ private static Dictionary<int, PacketId> InitializeLoginPacketIds()
AddPacketIdEntry(packetIds, L2C_GP_COURSE_GET_INFO_RES);
AddPacketIdEntry(packetIds, C2L_GET_CHARACTER_LIST_REQ);
AddPacketIdEntry(packetIds, L2C_GET_CHARACTER_LIST_RES);
AddPacketIdEntry(packetIds, C2L_DELETE_CHARACTER_INFO_REQ);
AddPacketIdEntry(packetIds, L2C_DELETE_CHARACTER_INFO_RES);
AddPacketIdEntry(packetIds, X60);
AddPacketIdEntry(packetIds, X61);
AddPacketIdEntry(packetIds, X62);
Expand Down

0 comments on commit f641d20

Please sign in to comment.