﻿using Common;
using wServer.networking.data;
using wServer.realm;

namespace wServer.networking.cliPackets
{
    public class PetUpdateRequestPacket : ClientPacket
    {
        public const int UPGRADE_PET_YARD = 1;
        public const int FEED_PET = 2;
        public const int FUSE_PET = 3;

        public byte PetTransType { get; set; }
        public int PetId1 { get; set; }
        public int PetId2 { get; set; }
        public int ObjectId { get; set; }
        public SlotObjectData SlotObject { get; set; }
        public CurrencyType PaymentTransType { get; set; }

        public override PacketID ID => PacketID.PETYARDCOMMAND;

        public override Packet CreateInstance() => new PetUpdateRequestPacket();

        protected override void Read(Client client, NReader rdr)
        {
            PetTransType = rdr.ReadByte();
            PetId1 = rdr.ReadInt32();
            PetId2 = rdr.ReadInt32();
            ObjectId = rdr.ReadInt32();
            SlotObject = SlotObjectData.Read(client, rdr);
            PaymentTransType = (CurrencyType)rdr.ReadByte();
        }

        protected override void Write(Client client, NWriter wtr)
        {
            wtr.Write(PetTransType);
            wtr.Write(PetId1);
            wtr.Write(PetId2);
            wtr.Write(ObjectId);
            SlotObject.Write(client, wtr);
            wtr.Write((byte)PaymentTransType);
        }
    }
}