using System;
using PSO2SERVER.Models;

namespace PSO2SERVER.Protocol.Packets
{
    public class QuestCategoryPacket : Packet
    {
        private QuestDefiniton[] questdefs;

        public QuestCategoryPacket(QuestDefiniton[] questdefs)
        {
            this.questdefs = questdefs;
        }

        public override byte[] Build()
        {
            PacketWriter writer = new PacketWriter();
            writer.WriteMagic((uint)questdefs.Length, 0x1DB0, 0xC5);
            foreach (QuestDefiniton d in questdefs)
            {
                writer.WriteStruct(d);
            }
            return writer.ToArray();
        }

        public override PacketHeader GetHeader()
        {
            return new PacketHeader(0x0B, 0x18, PacketFlags.PACKED);
        }

        // Hoo boy, this is 468 bytes!
        // TODO: Map out this struct.
        // Most of this is WRONG!!! Needs serious investigation.
        /*
            [K873] What I've currently mapped out
              24  -> Start
              38  -> Quest Name/Type Index?
              100 -> Bitfield 1
              102 -> Estimated Play Time
              103 -> Party Type
              104 -> Difficulties Available
              105 -> Difficulties Completed
              108 -> Starting Level
              120 -> Item Data 1?
              12C -> Item Data 2?
        */
    }
}
