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

31 lines
1.0 KiB
C#
Raw Normal View History

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