TigerEmu/Communication/Messages/Outgoing/Navigator/FlatResultsComposer.cs

33 lines
855 B
C#

using Tiger.Communication.Messages.Interfaces;
using Tiger.Communication.Messages.Types;
using Tiger.Game.Rooms;
namespace Tiger.Communication.Messages.Outgoing.Navigator;
public class FlatResultsComposer : IMessageComposer
{
public const int UserFlats = 0;
public const int Flats = 1;
private readonly int _flatResultType;
private readonly ICollection<Room> _rooms;
public FlatResultsComposer(int flatResultType, ICollection<Room> rooms)
{
_flatResultType = flatResultType;
_rooms = rooms;
}
public OutgoingHeaders Header => OutgoingHeaders.FlatResults;
public void Compose(ServerMessage message)
{
message.AppendWire(_flatResultType);
message.AppendWire(_rooms.Count);
foreach (var room in _rooms)
{
room.ParseNode(message);
}
}
}