TigerEmu/Communication/Messages/Incoming/Navigator/GetUserFlatCatsEvent.cs

31 lines
1.0 KiB
C#

using Tiger.Communication.Messages.Interfaces;
using Tiger.Communication.Messages.Outgoing.Navigator;
using Tiger.Communication.Messages.Types;
using Tiger.Game.Navigator;
using Tiger.Game.Navigator.Nodes;
using Tiger.Networking.Game.Sessions;
namespace Tiger.Communication.Messages.Incoming.Navigator;
public class GetUserFlatCatsEvent : IMessageEvent
{
private readonly INavigatorManager _navigatorManager;
public GetUserFlatCatsEvent(INavigatorManager navigatorManager)
{
_navigatorManager = navigatorManager;
}
public IncomingHeaders Header => IncomingHeaders.GetUserFlatCats;
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
{
if (gameSession.Habbo == null)
{
await gameSession.CloseAsync();
return;
}
await gameSession.SendComposerAsync(new UserFlatCatsComposer(_navigatorManager.NavigatorNodes.Values
.Where(nn => nn.Type == NavigatorNodeType.Private && nn.RankFlatcat <= gameSession.Habbo.Rank).ToList()));
}
}