diff --git a/Modules/CustomRpcSender.cs b/Modules/CustomRpcSender.cs index eff424052..add65d191 100644 --- a/Modules/CustomRpcSender.cs +++ b/Modules/CustomRpcSender.cs @@ -985,14 +985,9 @@ static class PreventLargePacketKickPatch { if (msg.Length <= 1200) return true; - var serverType = GameStates.CurrentServerType; + if (AmongUsClient.Instance.AmHost && GameStates.CurrentServerType is GameStates.ServerType.Niko or GameStates.ServerType.Modded) return true; - if (!AmongUsClient.Instance.AmHost || serverType is GameStates.ServerType.Local or GameStates.ServerType.Vanilla || (serverType == GameStates.ServerType.Niko && !AmongUsClient.Instance.AmHost)) - { - Logger.Warn($" Blocked large packet from sending (size: {msg.Length})", nameof(PreventLargePacketKickPatch)); - return false; - } - - return true; + Logger.Warn($" Blocked large packet from sending (size: {msg.Length})", nameof(PreventLargePacketKickPatch)); + return false; } } \ No newline at end of file diff --git a/Modules/GameState.cs b/Modules/GameState.cs index d0b3e7e27..cfe21a87d 100644 --- a/Modules/GameState.cs +++ b/Modules/GameState.cs @@ -575,6 +575,7 @@ public static class GameStates Vanilla, Modded, Niko, + AOU, Local, Custom } @@ -608,7 +609,9 @@ public static class GameStates "Local Game" => ServerType.Custom, "EU" or "NA" or "AS" => ServerType.Vanilla, "MEU" or "MAS" or "MNA" => ServerType.Modded, - _ => regionName.Contains("Niko", StringComparison.OrdinalIgnoreCase) ? ServerType.Niko : ServerType.Custom + _ when regionName.Contains("Niko", StringComparison.OrdinalIgnoreCase) => ServerType.Niko, + _ when regionName.StartsWith("AOU", StringComparison.OrdinalIgnoreCase) => ServerType.AOU, + _ => ServerType.Custom }; } } @@ -625,7 +628,9 @@ public static class GameStates "Local Game" => ServerType.Custom, "EU" or "NA" or "AS" => ServerType.Vanilla, "MEU" or "MAS" or "MNA" => ServerType.Modded, - _ => regionName.Contains("Niko", StringComparison.OrdinalIgnoreCase) ? ServerType.Niko : ServerType.Custom + _ when regionName.Contains("Niko", StringComparison.OrdinalIgnoreCase) => ServerType.Niko, + _ when regionName.StartsWith("AOU", StringComparison.OrdinalIgnoreCase) => ServerType.AOU, + _ => ServerType.Custom }; } } diff --git a/Modules/Utils.cs b/Modules/Utils.cs index 03f3eaf19..4bf2ed47f 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -1880,7 +1880,8 @@ public static class Utils text = text.Replace("color=#", "#"); title = title.Replace("color=", string.Empty); - bool vanilla = GameStates.CurrentServerType == GameStates.ServerType.Vanilla; + var serverType = GameStates.CurrentServerType; + bool vanilla = serverType == GameStates.ServerType.Vanilla; SendOption sendOption = SendOption.Reliable; @@ -2010,7 +2011,7 @@ public static class Utils // ============================================================================ int fullRpcSizeLimit = Options.MessageRpcSizeLimit.GetInt(); - if (vanilla && fullRpcSizeLimit > 1200) fullRpcSizeLimit = 1200; + if ((vanilla || serverType == GameStates.ServerType.AOU) && fullRpcSizeLimit > 1200) fullRpcSizeLimit = 1200; string resetName = Main.AllPlayerNames.GetValueOrDefault(sender.PlayerId, string.Empty); @@ -5110,6 +5111,12 @@ public static class Utils return name; } + if (ip.Contains("allofus")) + { + name = $"AOU-{ip.Split('.')[0].ToUpper()}"; + return name; + } + if (name.Contains("Niko", StringComparison.OrdinalIgnoreCase)) name = name.Replace("233(", "-").Replace("233 (", "-").TrimEnd(')'); diff --git a/Patches/Crowded.cs b/Patches/Crowded.cs index 946b79061..87a1d41bb 100644 --- a/Patches/Crowded.cs +++ b/Patches/Crowded.cs @@ -347,8 +347,9 @@ internal static class Crowded { public static void Prefix() { - Logger.Info($"Host Game is being called! Region: {CurrentServerTypeInCreateMenu}", "CreateGameOptions"); - if (CurrentServerTypeInCreateMenu != ServerType.Vanilla) return; + ServerType serverTypeInCreateMenu = CurrentServerTypeInCreateMenu; + Logger.Info($"Host Game is being called! Region: {serverTypeInCreateMenu}", "CreateGameOptions"); + if (serverTypeInCreateMenu != ServerType.Vanilla) return; var GameHostOptions = GameOptionsManager.Instance.GameHostOptions; var CurrentGameOptions = GameOptionsManager.Instance.CurrentGameOptions; diff --git a/packaging/epic/BepInEx/config/at.duikbo.regioninstall.cfg b/packaging/epic/BepInEx/config/at.duikbo.regioninstall.cfg index dd2b3cb97..55e31b95d 100644 --- a/packaging/epic/BepInEx/config/at.duikbo.regioninstall.cfg +++ b/packaging/epic/BepInEx/config/at.duikbo.regioninstall.cfg @@ -6,7 +6,7 @@ ## Create an array of regions you want to add/update. To create this array, go to https://impostor.github.io/Impostor/ and put the Regions array from the server file in here # Setting type: String # Default value: {\"CurrentRegionIdx\":0,\"Regions\":[]} -Regions = { \"CurrentRegionIdx\": 2, \"Regions\": [ { \"$type\": \"StaticHttpRegionInfo, Assembly-CSharp\", \"Name\": \"Niko-NA\", \"PingServer\": \"https://au-us.niko233.top\", \"Servers\": [ { \"Name\": \"http-1\", \"Ip\": \"https://au-us.niko233.top\", \"Port\": 443, \"UseDtls\": false, \"Players\": 0, \"ConnectionFailures\": 0 } ], \"TargetServer\": null, \"TranslateName\": 1003 }, { \"$type\": \"StaticHttpRegionInfo, Assembly-CSharp\", \"Name\": \"Niko-AS\", \"PingServer\": \"https://au-as.niko233.top\", \"Servers\": [ { \"Name\": \"http-1\", \"Ip\": \"https://au-as.niko233.top\", \"Port\": 443, \"UseDtls\": false, \"Players\": 0, \"ConnectionFailures\": 0 } ], \"TargetServer\": null, \"TranslateName\": 1003 }, { \"$type\": \"StaticHttpRegionInfo, Assembly-CSharp\", \"Name\": \"Niko-EU\", \"PingServer\": \"https://au-eu.niko233.top\", \"Servers\": [ { \"Name\": \"http-1\", \"Ip\": \"https://au-eu.niko233.top\", \"Port\": 443, \"UseDtls\": false, \"Players\": 0, \"ConnectionFailures\": 0 } ], \"TargetServer\": null, \"TranslateName\": 1003 }, { \"$type\": \"StaticHttpRegionInfo, Assembly-CSharp\", \"Name\": \"Modded EU (MEU)\", \"PingServer\": \"https://au-eu.duikbo.at\", \"Servers\": [ { \"Name\": \"Http-1\", \"Ip\": \"https://au-eu.duikbo.at\", \"Port\": 443, \"UseDtls\": false, \"Players\": 0, \"ConnectionFailures\": 0 } ], \"TargetServer\": null, \"TranslateName\": 1003 }, { \"$type\": \"StaticHttpRegionInfo, Assembly-CSharp\", \"Name\": \"Modded NA (MNA)\", \"PingServer\": \"https://aumods.org\", \"Servers\": [ { \"Name\": \"Http-1\", \"Ip\": \"https://aumods.org\", \"Port\": 443, \"UseDtls\": false, \"Players\": 0, \"ConnectionFailures\": 0 } ], \"TargetServer\": null, \"TranslateName\": 1003 }, { \"$type\": \"StaticHttpRegionInfo, Assembly-CSharp\", \"Name\": \"Modded Asia (MAS)\", \"PingServer\": \"https://au-as.duikbo.at\", \"Servers\": [ { \"Name\": \"Http-1\", \"Ip\": \"https://au-as.duikbo.at\", \"Port\": 443, \"UseDtls\": false, \"Players\": 0, \"ConnectionFailures\": 0 } ], \"TargetServer\": null, \"TranslateName\": 1003 } ] } +Regions = { \"CurrentRegionIdx\": 2, \"Regions\": [ { \"$type\": \"StaticHttpRegionInfo, Assembly-CSharp\", \"Name\": \"AOU-EU\", \"PingServer\": \"https://eu.allofus.dev\", \"Servers\": [ { \"Name\": \"http-1\", \"Ip\": \"https://eu.allofus.dev\", \"Port\": 443, \"UseDtls\": false, \"Players\": 0, \"ConnectionFailures\": 0 } ], \"TargetServer\": null, \"TranslateName\": 1003 }, { \"$type\": \"StaticHttpRegionInfo, Assembly-CSharp\", \"Name\": \"Niko-NA\", \"PingServer\": \"https://au-us.niko233.top\", \"Servers\": [ { \"Name\": \"http-1\", \"Ip\": \"https://au-us.niko233.top\", \"Port\": 443, \"UseDtls\": false, \"Players\": 0, \"ConnectionFailures\": 0 } ], \"TargetServer\": null, \"TranslateName\": 1003 }, { \"$type\": \"StaticHttpRegionInfo, Assembly-CSharp\", \"Name\": \"Niko-AS\", \"PingServer\": \"https://au-as.niko233.top\", \"Servers\": [ { \"Name\": \"http-1\", \"Ip\": \"https://au-as.niko233.top\", \"Port\": 443, \"UseDtls\": false, \"Players\": 0, \"ConnectionFailures\": 0 } ], \"TargetServer\": null, \"TranslateName\": 1003 }, { \"$type\": \"StaticHttpRegionInfo, Assembly-CSharp\", \"Name\": \"Niko-EU\", \"PingServer\": \"https://au-eu.niko233.top\", \"Servers\": [ { \"Name\": \"http-1\", \"Ip\": \"https://au-eu.niko233.top\", \"Port\": 443, \"UseDtls\": false, \"Players\": 0, \"ConnectionFailures\": 0 } ], \"TargetServer\": null, \"TranslateName\": 1003 }, { \"$type\": \"StaticHttpRegionInfo, Assembly-CSharp\", \"Name\": \"Modded EU (MEU)\", \"PingServer\": \"https://au-eu.duikbo.at\", \"Servers\": [ { \"Name\": \"Http-1\", \"Ip\": \"https://au-eu.duikbo.at\", \"Port\": 443, \"UseDtls\": false, \"Players\": 0, \"ConnectionFailures\": 0 } ], \"TargetServer\": null, \"TranslateName\": 1003 }, { \"$type\": \"StaticHttpRegionInfo, Assembly-CSharp\", \"Name\": \"Modded NA (MNA)\", \"PingServer\": \"https://aumods.org\", \"Servers\": [ { \"Name\": \"Http-1\", \"Ip\": \"https://aumods.org\", \"Port\": 443, \"UseDtls\": false, \"Players\": 0, \"ConnectionFailures\": 0 } ], \"TargetServer\": null, \"TranslateName\": 1003 }, { \"$type\": \"StaticHttpRegionInfo, Assembly-CSharp\", \"Name\": \"Modded Asia (MAS)\", \"PingServer\": \"https://au-as.duikbo.at\", \"Servers\": [ { \"Name\": \"Http-1\", \"Ip\": \"https://au-as.duikbo.at\", \"Port\": 443, \"UseDtls\": false, \"Players\": 0, \"ConnectionFailures\": 0 } ], \"TargetServer\": null, \"TranslateName\": 1003 } ] } ## Comma-seperated list of region names that should be removed. # Setting type: String