using Fiesta.Game.Networking.PacketTypes;
using Fiesta.Networking.Packets;
using Fiesta.Worlds.Networking;
using Login.Worlds.Networking.Packets.Misc.Out;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Villain.Networking.Packets;

namespace Login.Worlds.Networking.Packets.Misc.In
{
	public static class HeartbeatRequest
	{
		[PacketHandler("World", MISC.HEARTBEAT_REQ)]
		public static void Handle(WorldConnection client, InPacket packet)
		{
			if(client.World == null)
			{
				using (InterconnectionReady interconnectionReady = new InterconnectionReady())
				{
					client.Send(interconnectionReady);
				}
			}

			using (Heartbeat heartbeat = new Heartbeat())
			{
				client.Send(heartbeat);
			}
		}
	}
}