using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PSO2SERVER.Protocol.Packets
{
    public class ItemPickupResponsePacket : Packet
    {
        /// Packet receiver object (? or player, who picked up the item, unsure)
        public ObjectHeader Target {  get; set; } = new ObjectHeader();
        /// Item drop ID.
        public uint Drop_id { get; set; } = new uint();
        /// Was the item actually picked up.
        public uint Was_pickedup { get; set; } = new uint();
        public uint Unk { get; set; } = new uint();

        public ItemPickupResponsePacket(int player_id, uint drop_id, uint was_pickedup, uint unk)
        {
            Target = new ObjectHeader((uint)player_id, ObjectType.Player);
            Drop_id = drop_id;
            Was_pickedup = was_pickedup;
            Unk = unk;
        }

        #region implemented abstract members of Packet

        public override byte[] Build()
        {
            var pkt = new PacketWriter();
            pkt.WriteObjectHeader(Target);
            pkt.Write(Drop_id);
            pkt.Write(Was_pickedup);
            pkt.Write(Unk);
            return pkt.ToArray();
        }

        public override PacketHeader GetHeader()
        {
            return new PacketHeader(0x0F, 0x02, PacketFlags.None);
        }

        #endregion
    }
}