TigerEmu/Communication/Messages/Incoming/Handshake/InfoRetrieveMessageEvent.cs

28 lines
905 B
C#

using Tiger.Communication.Messages.Interfaces;
using Tiger.Communication.Messages.Outgoing.User.Data;
using Tiger.Communication.Messages.Types;
using Tiger.Networking.Game.Sessions;
namespace Tiger.Communication.Messages.Incoming.Handshake;
public class InfoRetrieveMessageEvent : IMessageEvent
{
private readonly IGameSessionManager _gameSessionManager;
public InfoRetrieveMessageEvent(IGameSessionManager gameSessionManager)
{
_gameSessionManager = gameSessionManager;
}
public IncomingHeaders Header => IncomingHeaders.UserInfo;
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
{
if (gameSession.Habbo == null)
{
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
return;
}
await gameSession.SendComposerAsync(new UserInfoComposer(gameSession.Habbo));
}
}