Don't disable auth server on officials

Since 2023.6.13 official servers went back to using DTLS for auth only
This commit is contained in:
js6pak committed 2023-06-15 21:46:21 +02:00
1 parent 89146cea4f
commit c84d36a3f6
1 file changed
+17 -1
@@ -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<StaticHttpRegionInfo>() 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;
}