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

27 lines
739 B
C#
Raw Permalink Normal View History

2023-10-14 20:32:12 +00:00
using Tiger.Communication.Messages.Interfaces;
using Tiger.Communication.Messages.Types;
2023-11-10 13:55:42 +00:00
using Tiger.Game.Navigator.Nodes;
2023-10-14 20:32:12 +00:00
namespace Tiger.Communication.Messages.Outgoing.Navigator;
public class UserFlatCatsComposer : IMessageComposer
{
2023-11-10 13:55:42 +00:00
private readonly ICollection<NavigatorNode> _flatCats;
2023-10-14 20:32:12 +00:00
2023-11-10 13:55:42 +00:00
public UserFlatCatsComposer(ICollection<NavigatorNode> flatCats)
2023-10-14 20:32:12 +00:00
{
2023-11-10 13:55:42 +00:00
_flatCats = flatCats;
2023-10-14 20:32:12 +00:00
}
2023-11-10 13:55:42 +00:00
public OutgoingHeaders Header => OutgoingHeaders.UserFlatCats;
2023-10-14 20:32:12 +00:00
public void Compose(ServerMessage message)
{
2023-11-10 13:55:42 +00:00
message.AppendWire(_flatCats.Count);
2023-10-14 20:32:12 +00:00
2023-11-10 13:55:42 +00:00
foreach (var flatCat in _flatCats)
2023-10-14 20:32:12 +00:00
{
2023-11-10 13:55:42 +00:00
message.AppendWire(flatCat.Id);
message.AppendString(flatCat.Name);
2023-10-14 20:32:12 +00:00
}
}
}