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

34 lines
1.2 KiB
C#

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<RoomPrivateCategory> _privateCategories;
private readonly int _rank;
public UserFlatCatsComposer(ICollection<RoomPrivateCategory> 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);
}
}
}