using Tiger.Communication.Messages.Interfaces; using Tiger.Communication.Messages.Types; using Tiger.Game.Rooms; namespace Tiger.Communication.Messages.Outgoing.Navigator; public class UserFlatCatsComposer : IMessageComposer { private readonly ICollection _privateCategories; private readonly int _rank; public UserFlatCatsComposer(ICollection privateCategories, int rank) { _privateCategories = privateCategories; _rank = rank; } public OutgoingHeaders Header => OutgoingHeaders.NavigatorCategories; public void Compose(ServerMessage message) { message.AppendInt32(_privateCategories.Count); foreach (var privateCategory in _privateCategories) { message.AppendInt32(privateCategory.Id); message.AppendString(privateCategory.Name); message.AppendBoolean(privateCategory.MinRank <= _rank); message.AppendBoolean(true); // automatic? message.AppendString(""); // automatic category key? message.AppendString(""); // global category key? message.AppendBoolean(privateCategory.MinRank >= 4); } } }