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

28 lines
909 B
C#

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