From f641d20a7642b9e416be106a800cabc5716b2652 Mon Sep 17 00:00:00 2001 From: Andrew Gutekanst Date: Sun, 9 Jan 2022 17:23:41 -0500 Subject: [PATCH] LoginServer: Add DeleteCharacterHandler --- Arrowgene.Ddon.LoginServer/DdonLoginServer.cs | 1 + .../Handler/DeleteCharacterHandler.cs | 32 +++++++++++++++++++ Arrowgene.Ddon.Server/Network/PacketId.cs | 5 +++ 3 files changed, 38 insertions(+) create mode 100644 Arrowgene.Ddon.LoginServer/Handler/DeleteCharacterHandler.cs diff --git a/Arrowgene.Ddon.LoginServer/DdonLoginServer.cs b/Arrowgene.Ddon.LoginServer/DdonLoginServer.cs index 8b9ee0b59..f6e13359f 100644 --- a/Arrowgene.Ddon.LoginServer/DdonLoginServer.cs +++ b/Arrowgene.Ddon.LoginServer/DdonLoginServer.cs @@ -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)); diff --git a/Arrowgene.Ddon.LoginServer/Handler/DeleteCharacterHandler.cs b/Arrowgene.Ddon.LoginServer/Handler/DeleteCharacterHandler.cs new file mode 100644 index 000000000..b51f77ffc --- /dev/null +++ b/Arrowgene.Ddon.LoginServer/Handler/DeleteCharacterHandler.cs @@ -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 + { + private static readonly DdonLogger Logger = LogProvider.Logger(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)); + } + } +} diff --git a/Arrowgene.Ddon.Server/Network/PacketId.cs b/Arrowgene.Ddon.Server/Network/PacketId.cs index bd79273b0..730be12aa 100644 --- a/Arrowgene.Ddon.Server/Network/PacketId.cs +++ b/Arrowgene.Ddon.Server/Network/PacketId.cs @@ -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"); @@ -134,6 +137,8 @@ private static Dictionary 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);