using Tiger.Communication.Messages.Interfaces; using Tiger.Communication.Messages.Outgoing.Users; using Tiger.Communication.Messages.Types; using Tiger.Game.Habbos; using Tiger.Networking.Game.Sessions; using Tiger.Storage; namespace Tiger.Communication.Messages.Incoming.Users; public class GetExtendedProfileEvent : IMessageEvent { private readonly IGameSessionManager _gameSessionManager; private readonly IRepository _habboRepository; public GetExtendedProfileEvent(IGameSessionManager gameSessionManager, IRepository habboRepository) { _gameSessionManager = gameSessionManager; _habboRepository = habboRepository; } public IncomingHeaders Header => IncomingHeaders.GetExtendedProfileEvent; public async Task HandleAsync(GameSession gameSession, ClientMessage request) { var habboId = request.ReadInt32(); if (habboId == null) { await _gameSessionManager.CloseAsync("Malformed packet", gameSession); return; } var habbo = await _habboRepository.FindAsync(habboId); if (habbo == null) { await _gameSessionManager.CloseAsync("Habbo not found", gameSession); return; } await gameSession.SendComposerAsync(new ExtendedProfileComposer(habbo)); } }