PSO2SERVER/Server/Protocol/Handlers/11-ClientHandler/11-90-CharacterUndeletionRequest.cs

33 lines
1.1 KiB
C#

using System;
using PSO2SERVER.Models;
using PSO2SERVER.Protocol.Packets;
using static PSO2SERVER.Protocol.Handlers.CharacterNewNameRequest;
using static PSO2SERVER.Protocol.Packets.CharacterUndeletionPacket;
namespace PSO2SERVER.Protocol.Handlers
{
[PacketHandlerAttr(0x11, 0x90)]
public class CharacterUndeletionRequest : PacketHandler
{
public struct CharacterUndeletionRequestPacket
{
public uint char_id { get; set; }
}
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
{
var info = string.Format("[<--] 接收到的数据 (hex): {0} 字节", data.Length);
Logger.WriteHex(info, data);
// 创建一个结构体实例
var packet = new CharacterUndeletionRequestPacket();
// 读取数据并填充到结构体中
var reader = new PacketReader(data, position, size);
packet.char_id = reader.ReadUInt32();
context.SendPacket(new CharacterUndeletionPacket(UndeletionStatus.Success));
}
}
}