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

namespace PSO2SERVER.Protocol.Packets
{
    public class EquipedWeaponPacket : Packet
    {
        /// Player changing the weapon.
        public ObjectHeader player {  get; set; } = new ObjectHeader();
        /// New weapon.
        public PSO2Items Item { get; set; } = new PSO2Items();

        public EquipedWeaponPacket(uint player_id, PSO2Items item)
        {
            player = new ObjectHeader(player_id, ObjectType.Player);
            Item = item;
        }

        #region implemented abstract members of Packet

        public override byte[] Build()
        {
            var pkt = new PacketWriter();
            pkt.WriteObjectHeader(player);
            pkt.WriteStruct(Item);
            return pkt.ToArray();
        }

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

        #endregion
    }
}