using Tiger.Communication.Messages.Interfaces; using Tiger.Communication.Messages.Outgoing; using Tiger.Communication.Messages.Outgoing.Navigator; using Tiger.Communication.Messages.Types; using Tiger.Game.Navigator; using Tiger.Networking.Game.Sessions; namespace Tiger.Communication.Messages.Incoming.Navigator; public class NavigatorSearchEvent : IMessageEvent { private readonly IGameSessionManager _gameSessionManager; private readonly INavigatorManager _navigatorManager; public NavigatorSearchEvent(IGameSessionManager gameSessionManager, INavigatorManager navigatorManager) { _gameSessionManager = gameSessionManager; _navigatorManager = navigatorManager; } public IncomingHeaders Header => IncomingHeaders.NavigatorSearch; public async Task HandleAsync(GameSession gameSession, ClientMessage request) { if (gameSession.Habbo == null) { await _gameSessionManager.CloseAsync("Not logged in", gameSession); return; } if (!_navigatorManager.NavigatorViews.TryGetValue(request.ReadString(), out var navigatorView)) return; var qry = request.ReadString(); var message = new ServerMessage((short)OutgoingHeaders.NavigatorSearch); message.AppendString(navigatorView.Code); message.AppendString(qry); await navigatorView.Compose(message, gameSession.Habbo, qry); await gameSession.SendMessageAsync(message); // await gameSession.SendComposerAsync(new NavigatorSearchComposer(navigatorView, request.ReadString(), gameSession.Habbo)); } }