From c84d36a3f6507bace684f78ce4fc2b735a25c048 Mon Sep 17 00:00:00 2001 From: js6pak Date: Thu, 15 Jun 2023 19:17:44 +0200 Subject: [PATCH] Don't disable auth server on officials Since 2023.6.13 official servers went back to using DTLS for auth only --- .../Miscellaneous/CustomServersPatch.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Reactor/Patches/Miscellaneous/CustomServersPatch.cs b/Reactor/Patches/Miscellaneous/CustomServersPatch.cs index d053daf..8a37141 100644 --- a/Reactor/Patches/Miscellaneous/CustomServersPatch.cs +++ b/Reactor/Patches/Miscellaneous/CustomServersPatch.cs @@ -1,3 +1,5 @@ +using System; +using System.Linq; using HarmonyLib; namespace Reactor.Patches.Miscellaneous; @@ -5,11 +7,25 @@ namespace Reactor.Patches.Miscellaneous; [HarmonyPatch] internal static class CustomServersPatch { + private static bool IsCurrentServerOfficial() + { + const string Domain = "among.us"; + + return ServerManager.Instance.CurrentRegion?.TryCast() is { } regionInfo && + regionInfo.PingServer.EndsWith(Domain, StringComparison.Ordinal) && + regionInfo.Servers.All(serverInfo => serverInfo.Ip.EndsWith(Domain, StringComparison.Ordinal)); + } + [HarmonyPatch(typeof(AuthManager._CoConnect_d__4), nameof(AuthManager._CoConnect_d__4.MoveNext))] [HarmonyPatch(typeof(AuthManager._CoWaitForNonce_d__6), nameof(AuthManager._CoWaitForNonce_d__6.MoveNext))] [HarmonyPrefix] - public static bool DisableAuthServer(out bool __result) + public static bool DisableAuthServer(ref bool __result) { + if (IsCurrentServerOfficial()) + { + return true; + } + __result = false; return false; }