diff --git a/GameMode/BedWars.cs b/GameMode/BedWars.cs index aaf81c017..93b722ed5 100644 --- a/GameMode/BedWars.cs +++ b/GameMode/BedWars.cs @@ -873,6 +873,13 @@ public static class BedWars [BedWarsTeam.Yellow] = new(new(19.83f, 11.07f), SystemTypes.Comms, new(20.19f, 13.63f), new(22.89f, 13.32f), new(24.24f, 14.41f)), [BedWarsTeam.Red] = new(new(-7.39f, 8.81f), SystemTypes.Dropship, new(-9.86f, 13.43f), new(-7.47f, 10.92f), new(-11.21f, 12.5f)), [BedWarsTeam.Green] = new(new(-15.55f, -7.04f), SystemTypes.Kitchen, new(-17.22f, -9.32f), new(-13.78f, -9.32f), new(-22.83f, -7.19f)) + }, + [(MapNames)6] = new() + { + [BedWarsTeam.Blue] = new(new(-12.69f, -27.88f), SystemTypes.Engine, new(-14.67f, -34.71f), new(-12f, -34.71f), new(-14.6f, -30.96f)), + [BedWarsTeam.Yellow] = new(new(9.84f, -27.66f), SystemTypes.Electrical, new(10.22f, -31.58f), new(12.76f, -32.24f), new(12.29f, -29.15f)), + [BedWarsTeam.Red] = new(new(11f, 23.43f), SystemTypes.Comms, new(14.33f, 25f), new(14.33f, 23.44f), new(12.77f, 23.85f)), + [BedWarsTeam.Green] = new(new(-12f, 19f), (SystemTypes)SubmergedCompatibility.SubmergedSystemTypes.Observatory, new(-12f, 20f), new(-12.13f, 17.83f), new(-11.66f, 15.16f)) } }; @@ -912,6 +919,13 @@ public static class BedWars [Item.Gold] = [new(18.19f, -12.48f), new(24.6f, 11.33f), new(-8.63f, 9.81f), new(-13.67f, -7.6f)], [Item.Emerald] = [new(9.37f, 0.99f), new(-3.15f, -10.55f), new(2f, -1.57f)], [Item.Diamond] = [new(22.28f, 3.18f), new(2.86f, 1.28f), new(-17.61f, 2.65f), new(-4.56f, -14.77f)] + }, + [(MapNames)6] = new() + { + [Item.Iron] = [new(-11.39f, -30.8f), new(13f, -25.27f), new(10.45f, 28.13f), new(-15f, 17.1f)], + [Item.Gold] = [new(-11.39f, -31.43f), new(13f, -25.9f), new(10.45f, 27.4f), new(-15f, 17.72f)], + [Item.Emerald] = [new(1.11f, 9.93f), new(0f, 33.62f), new(8.79f, -38.3f), new(-11f, -39.22f)], + [Item.Diamond] = [new(3.71f, 32.11f), new(-6.69f, 9.65f), new(-12.32f, 30.53f), new(4.72f, 7.56f), new(-3.01f, -33.05f), new(-0.77f, -35.73f), new(1.71f, -20f), new(-6.5f, -43.06f)] } }; diff --git a/GameMode/CaptureTheFlag.cs b/GameMode/CaptureTheFlag.cs index 5d050aae4..545821e08 100644 --- a/GameMode/CaptureTheFlag.cs +++ b/GameMode/CaptureTheFlag.cs @@ -76,6 +76,7 @@ public static class CaptureTheFlag MapNames.Polus => (new(9.5f, -12.5f), Translator.GetString(nameof(SystemTypes.Electrical))), MapNames.Airship => (new(-23.5f, -1.6f), Translator.GetString(nameof(SystemTypes.Cockpit))), MapNames.Fungle => (new(-15.5f, -7.5f), Translator.GetString(nameof(SystemTypes.Kitchen))), + (MapNames)6 => (new(-13.31f, -34.56f), Translator.GetString(nameof(SystemTypes.Engine))), _ => (Vector2.zero, string.Empty) }; @@ -87,6 +88,7 @@ public static class CaptureTheFlag MapNames.Polus => (new(36.5f, -7.5f), Translator.GetString(nameof(SystemTypes.Laboratory))), MapNames.Airship => (new(33.5f, -1.5f), Translator.GetString(nameof(SystemTypes.CargoBay))), MapNames.Fungle => (new(22.2f, 13.7f), Translator.GetString(nameof(SystemTypes.Comms))), + (MapNames)6 => (new(14.07f, 23.93f), Translator.GetString(nameof(SystemTypes.Comms))), _ => (Vector2.zero, string.Empty) }; diff --git a/GameMode/KingOfTheZones.cs b/GameMode/KingOfTheZones.cs index 99fe8801a..6bc7c1b98 100644 --- a/GameMode/KingOfTheZones.cs +++ b/GameMode/KingOfTheZones.cs @@ -68,6 +68,13 @@ public static class KingOfTheZones [SystemTypes.Cafeteria, SystemTypes.Reactor], [SystemTypes.FishingDock, SystemTypes.Comms, SystemTypes.Reactor], [SystemTypes.FishingDock, SystemTypes.Dropship, SystemTypes.Comms, SystemTypes.Reactor] + ], + [(MapNames)6] = + [ + [(SystemTypes)SubmergedCompatibility.SubmergedSystemTypes.UpperCentral], + [(SystemTypes)SubmergedCompatibility.SubmergedSystemTypes.UpperCentral, (SystemTypes)SubmergedCompatibility.SubmergedSystemTypes.LowerCentral], + [(SystemTypes)SubmergedCompatibility.SubmergedSystemTypes.Research, SystemTypes.Admin, (SystemTypes)SubmergedCompatibility.SubmergedSystemTypes.UpperLobby], + [(SystemTypes)SubmergedCompatibility.SubmergedSystemTypes.UpperCentral, (SystemTypes)SubmergedCompatibility.SubmergedSystemTypes.LowerCentral, (SystemTypes)SubmergedCompatibility.SubmergedSystemTypes.Ballast, SystemTypes.Cafeteria] ] }; diff --git a/GameMode/Quiz.cs b/GameMode/Quiz.cs index 9eff3bdd4..2c0e52478 100644 --- a/GameMode/Quiz.cs +++ b/GameMode/Quiz.cs @@ -68,6 +68,14 @@ public static class Quiz ['C'] = SystemTypes.Storage, ['D'] = SystemTypes.MeetingRoom, ['E'] = SystemTypes.Kitchen + }, + [(MapNames)6] = new() + { + ['A'] = (SystemTypes)SubmergedCompatibility.SubmergedSystemTypes.Observatory, + ['B'] = SystemTypes.Cafeteria, + ['C'] = (SystemTypes)SubmergedCompatibility.SubmergedSystemTypes.UpperCentral, + ['D'] = SystemTypes.Lounge, + ['E'] = SystemTypes.Admin } }; diff --git a/Main.cs b/Main.cs index f02fdb147..2f55e226e 100644 --- a/Main.cs +++ b/Main.cs @@ -17,6 +17,9 @@ using HarmonyLib; using Il2CppInterop.Runtime.Injection; using UnityEngine; using UnityEngine.Networking; +#if !ANDROID +using EHR.Patches; +#endif [assembly: AssemblyFileVersion(Main.PluginVersion)] [assembly: AssemblyInformationalVersion(Main.PluginVersion)] diff --git a/Modules/AddSteamID.cs b/Modules/AddSteamID.cs index d91761ac3..f798e5afb 100644 --- a/Modules/AddSteamID.cs +++ b/Modules/AddSteamID.cs @@ -1,4 +1,8 @@ -namespace EHR; +#if !ANDROID +using System; +#endif + +namespace EHR; public static class AddSteamID { @@ -15,7 +19,7 @@ public static class AddSteamID File.Create(FilePath).Close(); File.WriteAllText(FilePath, "945360"); - ModUpdater.ShowPopup(GetString("AppIDAdded"), StringNames.Close, true); + ModUpdater.ShowPopup(Translator.GetString("AppIDAdded"), StringNames.Close, true); } } catch (Exception e) { Utils.ThrowException(e); } diff --git a/Modules/DisableDevice.cs b/Modules/DisableDevice.cs index 3d579f4c7..02c0e4fc3 100644 --- a/Modules/DisableDevice.cs +++ b/Modules/DisableDevice.cs @@ -9,7 +9,7 @@ using UnityEngine; namespace EHR; -//参考元 : https://github.com/ykundesu/SuperNewRoles/blob/master/SuperNewRoles/Mode/SuperHostRoles/BlockTool.cs +// Reference: https://github.com/ykundesu/SuperNewRoles/blob/master/SuperNewRoles/Mode/SuperHostRoles/BlockTool.cs internal static class DisableDevice { private static readonly List DesyncComms = []; @@ -32,7 +32,11 @@ internal static class DisableDevice ["AirshipCamera"] = new(8.10f, -9.63f), ["AirshipVital"] = new(25.24f, -7.94f), ["FungleCamera"] = new(6.20f, 0.10f), - ["FungleVital"] = new(-2.50f, -9.80f) + ["FungleVital"] = new(-2.50f, -9.80f), + ["SubmergedVital"] = new(5f, 32.54f), + ["SubmergedLeftAdmin"] = new(-9.45f, 10.16f), + ["SubmergedRightAdmin"] = new(-7.07f, 10.16f), + ["SubmergedCamera"] = new(-3.41f, -34.56f) }; public static bool DoDisable => Options.DisableDevices.GetBool(); diff --git a/Modules/Translator.cs b/Modules/Translator.cs index a08a6686d..a4cd16d8e 100644 --- a/Modules/Translator.cs +++ b/Modules/Translator.cs @@ -7,6 +7,9 @@ using System.Reflection; using System.Text; using System.Text.Json; using System.Text.RegularExpressions; +#if !ANDROID +using Il2CppInterop.Runtime.InteropTypes.Arrays; +#endif namespace EHR; diff --git a/Patches/DleksPatch.cs b/Patches/DleksPatch.cs index 5a5fb2ebb..dc193b4f1 100644 --- a/Patches/DleksPatch.cs +++ b/Patches/DleksPatch.cs @@ -65,7 +65,7 @@ public static class DleksPatch } // removed dleks check as it's always false - int num2 = GameOptionsManager.Instance.CurrentGameOptions.MapId == 6 && SubmergedCompatibility.Loaded && SubmergedCompatibility.IsSupported(Options.CurrentGameMode) ? 6 : Mathf.Clamp(GameOptionsManager.Instance.CurrentGameOptions.MapId, 0, Constants.MapNames.Length - 1); + int num2 = GameOptionsManager.Instance.CurrentGameOptions.MapId == 6 && SubmergedCompatibility.Loaded ? 6 : Mathf.Clamp(GameOptionsManager.Instance.CurrentGameOptions.MapId, 0, Constants.MapNames.Length - 1); __instance.__2__current = __instance.__4__this.ShipLoadingAsyncHandle = __instance.__4__this.ShipPrefabs[num2].InstantiateAsync(); __instance.__1__state = 1; diff --git a/Patches/GameOptionsMenuPatch.cs b/Patches/GameOptionsMenuPatch.cs index 941ff6bc7..135c69cda 100644 --- a/Patches/GameOptionsMenuPatch.cs +++ b/Patches/GameOptionsMenuPatch.cs @@ -1124,7 +1124,6 @@ public static class GameSettingMenuPatch Vector3 gameSettingsLabelPos = gameSettingsLabel.transform.localPosition; CustomGameMode[] gms = Enum.GetValues()[..^1]; - if (Main.NormalOptions.MapId == 6 && SubmergedCompatibility.Loaded) gms = gms.Where(SubmergedCompatibility.IsSupported).ToArray(); int totalCols = Mathf.Max(1, Mathf.CeilToInt(gms.Length / 5f)); GMButtons = []; diff --git a/Patches/GameStartManagerPatch.cs b/Patches/GameStartManagerPatch.cs index cc5485015..b15e989ea 100644 --- a/Patches/GameStartManagerPatch.cs +++ b/Patches/GameStartManagerPatch.cs @@ -234,7 +234,7 @@ public static class GameStartManagerPatch try { instance.UpdateMapImage((MapNames)GameManager.Instance.LogicOptions.MapId); } catch (Exception e) { - if (!(GameManager.Instance.LogicOptions.MapId == 6 && SubmergedCompatibility.Loaded && SubmergedCompatibility.IsSupported(Options.CurrentGameMode))) + if (!(GameManager.Instance.LogicOptions.MapId == 6 && SubmergedCompatibility.Loaded)) { if (GameManager.Instance.LogicOptions.MapId >= Enum.GetValues().Length) ErrorText.Instance.AddError(ErrorCode.UnsupportedMap); diff --git a/Patches/MapPickerMenuPatch.cs b/Patches/MapPickerMenuPatch.cs index fcaedbad2..06f833f04 100644 --- a/Patches/MapPickerMenuPatch.cs +++ b/Patches/MapPickerMenuPatch.cs @@ -18,6 +18,13 @@ internal static class CreateOptionsPickerPatch [HarmonyPatch] public static class GameOptionsMapPickerPatch { + [HarmonyPatch(typeof(GameOptionsMapPicker), nameof(GameOptionsMapPicker.SelectMap), typeof(int))] + [HarmonyPrefix] + public static void Prefix_SelectMap([HarmonyArgument(0)] ref int mapId) + { + if (mapId > 5) mapId = 0; + } + [HarmonyPatch(typeof(GameOptionsMapPicker), nameof(GameOptionsMapPicker.SetupMapButtons))] [HarmonyPostfix] public static void Postfix_Initialize(CreateGameMapPicker __instance) diff --git a/Patches/OnGameStartedPatch.cs b/Patches/OnGameStartedPatch.cs index 4f7b2e01e..d55e89191 100644 --- a/Patches/OnGameStartedPatch.cs +++ b/Patches/OnGameStartedPatch.cs @@ -550,7 +550,7 @@ internal static class StartGameHostPatch if (!ShipStatus.Instance) { - int index = GameOptionsManager.Instance.CurrentGameOptions.MapId == 6 && SubmergedCompatibility.Loaded && SubmergedCompatibility.IsSupported(Options.CurrentGameMode) ? 6 : Mathf.Clamp(GameOptionsManager.Instance.CurrentGameOptions.MapId, 0, Constants.MapNames.Length - 1); + int index = Mathf.Clamp(GameOptionsManager.Instance.CurrentGameOptions.MapId, 0, Constants.MapNames.Length - 1); AUClient.ShipLoadingAsyncHandle = AUClient.ShipPrefabs[index].InstantiateAsync(); while (!AUClient.ShipLoadingAsyncHandle.IsDone) diff --git a/Roles/Impostor/AntiAdminer.cs b/Roles/Impostor/AntiAdminer.cs index e6b969451..074171cfa 100644 --- a/Roles/Impostor/AntiAdminer.cs +++ b/Roles/Impostor/AntiAdminer.cs @@ -174,6 +174,7 @@ internal class AntiAdminer : RoleBase switch (Main.NormalOptions.MapId) { case 0: + { if (!Options.DisableSkeldAdmin.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["SkeldAdmin"]) <= usableDistance) { admin = true; @@ -187,7 +188,9 @@ internal class AntiAdminer : RoleBase } break; + } case 1: + { if (!Options.DisableMiraHQAdmin.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["MiraHQAdmin"]) <= usableDistance) { admin = true; @@ -201,7 +204,9 @@ internal class AntiAdminer : RoleBase } break; + } case 2: + { if (!Options.DisablePolusAdmin.GetBool() && (Vector2.Distance(playerPos, DisableDevice.DevicePos["PolusLeftAdmin"]) <= usableDistance || Vector2.Distance(playerPos, DisableDevice.DevicePos["PolusRightAdmin"]) <= usableDistance)) { admin = true; @@ -221,7 +226,9 @@ internal class AntiAdminer : RoleBase } break; + } case 3: + { if (!Options.DisableSkeldAdmin.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["DleksAdmin"]) <= usableDistance) { admin = true; @@ -235,7 +242,9 @@ internal class AntiAdminer : RoleBase } break; + } case 4: + { if (!Options.DisableAirshipCockpitAdmin.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["AirshipCockpitAdmin"]) <= usableDistance) { admin = true; @@ -261,7 +270,9 @@ internal class AntiAdminer : RoleBase } break; + } case 5: + { if (!Options.DisableFungleCamera.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["FungleCamera"]) <= usableDistance) { camera = true; @@ -275,6 +286,29 @@ internal class AntiAdminer : RoleBase } break; + } + case 6 when SubmergedCompatibility.IsSubmerged(): + { + if (Vector2.Distance(playerPos, DisableDevice.DevicePos["SubmergedLeftAdmin"]) <= usableDistance || Vector2.Distance(playerPos, DisableDevice.DevicePos["SubmergedRightAdmin"]) <= usableDistance) + { + admin = true; + AddDeviceUse(pc.PlayerId, Device.Admin); + } + + if (Vector2.Distance(playerPos, DisableDevice.DevicePos["SubmergedCamera"]) <= usableDistance) + { + camera = true; + AddDeviceUse(pc.PlayerId, Device.Camera); + } + + if (Vector2.Distance(playerPos, DisableDevice.DevicePos["SubmergedVital"]) <= usableDistance) + { + vital = true; + AddDeviceUse(pc.PlayerId, Device.Vitals); + } + + break; + } } } catch (Exception ex) { Logger.Error(ex.ToString(), "AntiAdminer"); } diff --git a/SubmergedCompatibility.cs b/SubmergedCompatibility.cs index 0ef495dcd..8586f89c5 100644 --- a/SubmergedCompatibility.cs +++ b/SubmergedCompatibility.cs @@ -223,11 +223,6 @@ public static class SubmergedCompatibility return (bool)InTransitionField.GetValue(null)!; } - public static bool IsSupported(CustomGameMode gameMode) - { - return gameMode is CustomGameMode.Standard or CustomGameMode.SoloKombat or CustomGameMode.FFA or CustomGameMode.MoveAndStop or CustomGameMode.HotPotato or CustomGameMode.HideAndSeek or CustomGameMode.Speedrun or CustomGameMode.NaturalDisasters or CustomGameMode.RoomRush; - } - /* public static void RepairOxygen()