private async ValueTask OnNewConnection(NewConnectionEventArgs e) { // Handshake. ModdedHandshakeC2S.Deserialize(e.HandshakeData, out var clientVersion, out var name, out var mods); var connection = new HazelConnection(e.Connection, _connectionLogger); // Register client await _clientManager.RegisterConnectionAsync(connection, name, clientVersion, mods); }
public void OnClientConnectionEvent(IClientConnectionEvent e) { if (!ModdedHandshakeC2S.Deserialize(e.HandshakeData, out var protocolVersion, out var modCount)) { return; } e.Connection.SetReactor(new ReactorClientInfo(protocolVersion.Value, modCount.Value)); _logger.LogTrace("New modded connection (protocol version: {protocolVersion}, mods: {modCount})", protocolVersion, modCount); }
public static void Postfix(ref Il2CppStructArray <byte> __result) { ModList.Update(); var handshake = MessageWriter.Get(SendOption.Reliable); handshake.Write(__result); ModdedHandshakeC2S.Serialize( handshake, ModList.Current.Count ); __result = handshake.ToByteArray(false); handshake.Recycle(); }
public static bool Prefix(out Il2CppStructArray <byte> __result) { var handshake = MessageWriter.Get(SendOption.Reliable); ModdedHandshakeC2S.Serialize( handshake, Constants.GetBroadcastVersionBytes(), SaveManager.PlayerName, ModList.GetCurrent() ); __result = handshake.ToByteArray(false); handshake.Recycle(); return(false); }