TigerEmu/Communication/Messages/Incoming/Landingview/GetPromoArticlesMessageEven...

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 GetPromoArticlesMessageEvent : IMessageEvent
{
private readonly IGameSessionManager _gameSessionManager;
private readonly ILandingViewManager _landingViewManager;
public GetPromoArticlesMessageEvent(IGameSessionManager gameSessionManager, ILandingViewManager landingViewManager)
{
_gameSessionManager = gameSessionManager;
_landingViewManager = landingViewManager;
}
public IncomingHeaders Header => IncomingHeaders.GetPromoArticlesEvent;
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
{
if (gameSession.Habbo == null)
{
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
return;
}
await gameSession.SendComposerAsync(new PromoArticlesComposer(_landingViewManager.PromoArticles));
}
}