using Tiger.Communication.Messages.Interfaces; using Tiger.Communication.Messages.Outgoing.Catalog; using Tiger.Communication.Messages.Types; using Tiger.Game.Catalogue; using Tiger.Networking.Game.Sessions; namespace Tiger.Communication.Messages.Incoming.Catalog; public class GetClubOffersMessageEvent : IMessageEvent { private readonly ICatalogueManager _catalogueManager; private readonly IGameSessionManager _gameSessionManager; public GetClubOffersMessageEvent(ICatalogueManager catalogueManager, IGameSessionManager gameSessionManager) { _catalogueManager = catalogueManager; _gameSessionManager = gameSessionManager; } public IncomingHeaders Header => IncomingHeaders.GetClubOffers; public async Task HandleAsync(GameSession gameSession, ClientMessage request) { if (gameSession.Habbo == null) { await _gameSessionManager.CloseAsync("Not logged in", gameSession); return; } var currentSubscription = gameSession.Habbo.GetActiveSubscription(); await gameSession.SendComposerAsync(new HabboClubOffersMessageComposer( _catalogueManager.ClubOffers.Values.Where(co => co.DiscountExtension == currentSubscription is { MonthsLeft: 0, DaysInMonthLeft: <= 5 and > 0 }).ToList(), currentSubscription)); } }