#include "td/protocol/packets/SendMobsPacket.h"

namespace td {
namespace protocol {

DataBuffer SendMobsPacket::Serialize(bool packetID) const {
	DataBuffer data;

	WritePacketID(data, packetID);
	data << static_cast<std::uint8_t>(m_MobSends.size());

	data.WriteSome(reinterpret_cast<const std::uint8_t*>(m_MobSends.data()), m_MobSends.size() * sizeof(m_MobSends));

	return data;
}

void SendMobsPacket::Deserialize(DataBuffer& data) {
	std::uint8_t mobSendCount;
	data >> mobSendCount;

	m_MobSends.resize(mobSendCount);
	data.ReadSome(reinterpret_cast<std::uint8_t*>(m_MobSends.data()), mobSendCount * sizeof(MobSend));
}

} // namespace protocol
} // namespace td
