﻿using Common;
using wServer.networking.data;

namespace wServer.networking.cliPackets
{
    public class InvSwapPacket : ClientPacket
    {
        public int Time { get; set; }
        public WorldPosData Position { get; set; }
        public SlotObjectData SlotObject1 { get; set; }
        public SlotObjectData SlotObject2 { get; set; }

        public override PacketID ID => PacketID.INVSWAP;

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

        protected override void Read(Client psr, NReader rdr)
        {
            Time = rdr.ReadInt32();
            Position = WorldPosData.Read(psr, rdr);
            SlotObject1 = SlotObjectData.Read(psr, rdr);
            SlotObject2 = SlotObjectData.Read(psr, rdr);
        }

        protected override void Write(Client psr, NWriter wtr)
        {
            wtr.Write(Time);
            Position.Write(psr, wtr);
            SlotObject1.Write(psr, wtr);
            SlotObject2.Write(psr, wtr);
        }
    }
}