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

namespace PSO2SERVER.Protocol.Packets
{
    public class ChangeWeaponPalettePacket : Packet
    {
        /// Player switching the palette.
        public ObjectHeader Player { get; set; } = new ObjectHeader();
        public FixedList<ushort> unk { get; set; } = new FixedList<ushort>(0x12, 0);
        public uint Unk1 { get; set; } = 0;
        /// New palette ID.
        public uint cur_palette { get; set; } = 0;

        #region implemented abstract members of Packet

        public ChangeWeaponPalettePacket(Client client)
        {
            Player = new ObjectHeader((uint)client._account.AccountId, ObjectType.Player);
            cur_palette = client.Palette.CurPalette;
        }

        public override byte[] Build()
        {
            var pkt = new PacketWriter();
            pkt.WriteObjectHeader(Player);
            pkt.WriteList(unk);
            pkt.Write(Unk1);
            pkt.Write(cur_palette);
            return pkt.ToArray();
        }

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

        #endregion
    }
}