PSO2SERVER/Server/Protocol/Handlers/1A-MailHandler/1A-00-MailListRequest.cs

39 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using PSO2SERVER.Models;
using PSO2SERVER.Protocol.Packets;
namespace PSO2SERVER.Protocol.Handlers
{
[PacketHandlerAttr(0x1A, 0x00)]
public class MailListRequest : PacketHandler
{
public struct MailListRequestPacket
{
public uint unk1;
public MailType unk2;//mail type
public uint unk3;
}
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 reader = new PacketReader(data, position, size);
var pkt = reader.ReadStruct<MailListRequestPacket>();
Logger.WriteObj(pkt);
List<MailHeader> Headers = new List<MailHeader>
{
new MailHeader(1, 0, (uint)context._account.AccountId, new byte[0x14], 0, 0, TimeSpan.FromDays(1), 0, context.Character.Name, "MailSubject")
};
MailListPacket packet = new MailListPacket(1, 2, 3, 4, new byte[0x4], 100, context.Character.Name, context._account.Nickname, Headers);
context.SendPacket(packet);
}
}
}