TigerEmu/Communication/Messages/Incoming/Landingview/GetPromoArticlesEvent.cs

31 lines
1.1 KiB
C#

using Tiger.Communication.Messages.Interfaces;
using Tiger.Communication.Messages.Outgoing.Landingview;
using Tiger.Communication.Messages.Types;
using Tiger.Game.LandingView;
using Tiger.Networking.Game.Sessions;
namespace Tiger.Communication.Messages.Incoming.Landingview;
public class GetPromoArticlesEvent : IMessageEvent
{
private readonly IGameSessionManager _gameSessionManager;
private readonly ILandingViewManager _landingViewManager;
public GetPromoArticlesEvent(IGameSessionManager gameSessionManager, ILandingViewManager landingViewManager)
{
_gameSessionManager = gameSessionManager;
_landingViewManager = landingViewManager;
}
public IncomingHeaders Header => IncomingHeaders.GetPromoArticles;
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
{
if (gameSession.Habbo == null)
{
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
return;
}
await gameSession.SendComposerAsync(new PromoArticlesMessageComposer(_landingViewManager.PromoArticles));
}
}