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

namespace Login.Players.Networking.Packets.User.Out
{
	public class WorldList : OutPacket
	{
		public WorldList(bool isUpdateRequest) : base((isUpdateRequest ? USER.WORLD_STATUS_ACK : USER.LOGIN_ACK))
		{
			WriteByte((byte)WorldManager.Worlds.Count);

			foreach (World world in WorldManager.Worlds)
			{
				WriteByte(world.ID);
				WriteString(world.Name, 16);
				WriteByte((byte)world.Status);
			}
		}
	}
}