using Tiger.Communication.Messages.Interfaces; 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 NavigateEvent : IMessageEvent { private readonly INavigatorManager _navigatorManager; public NavigateEvent(INavigatorManager navigatorManager) { _navigatorManager = navigatorManager; } public IncomingHeaders Header => IncomingHeaders.Navigate; public async Task HandleAsync(GameSession gameSession, ClientMessage request) { if (gameSession.Habbo == null) { await gameSession.CloseAsync(); return; } var nodeMask = request.ReadWire() == 1; var nodeId = request.ReadWire(); if (!_navigatorManager.NavigatorNodes.TryGetValue(nodeId, out var node)) { return; } await gameSession.SendComposerAsync(new NavNodeInfoComposer(nodeMask, node)); } }