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

namespace PSO2SERVER.Protocol.Packets
{
    public class DespawnPlayerPacket : Packet
    {
        /// Player that receives this packet.
        public ObjectHeader receiver { get; set; } = new ObjectHeader();
        /// Player that got removed.
        public ObjectHeader removed_player { get; set; } = new ObjectHeader();

        public DespawnPlayerPacket(int other_playerid, int user_playerid)
        {
            receiver = new ObjectHeader((uint)other_playerid, ObjectType.Player);
            removed_player = new ObjectHeader((uint)user_playerid, ObjectType.Player);
        }

        #region implemented abstract members of Packet

        public override byte[] Build()
        {
            PacketWriter writer = new PacketWriter();
            receiver.WriteObjectHeaderToStream(writer);
            removed_player.WriteObjectHeaderToStream(writer);
            return writer.ToArray();
        }

        public override PacketHeader GetHeader()
        {
            return new PacketHeader(0x04, 0x3B, PacketFlags.OBJECT_RELATED);
        }

        #endregion
    }
}