PSO2SERVER/Server/Protocol/Handlers/0F-ItemHandler/0F-E0-MoveToMatStorageRequest.cs

38 lines
1.2 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using PSO2SERVER.Models;
using PSO2SERVER.Protocol.Packets;
namespace PSO2SERVER.Protocol.Handlers
{
[PacketHandlerAttr(0x0F, 0xE0)]
public class MoveToMatStorageRequest : PacketHandler
{
public struct MoveToMatStorageRequestPacket
{
/// Information about items being moved.
public List<MaterialStorageItem> Items;
}
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 items_count = reader.ReadMagic(0x9087, 0xEA);
var pkt = new MoveToMatStorageRequestPacket();
for (int i = 0; i < items_count; i++)
{
var item = reader.ReadStruct<MaterialStorageItem>();
pkt.Items.Add(item);
}
//TODO
var newinv = new List<UpdatedInventoryItem>();
context.SendPacket(new MoveToMatStoragePacket(newinv, pkt.Items));
}
}
}