diff --git a/README_ZH-CN.md b/README_ZH-CN.md index 3ad0bb7e..9989d43f 100644 --- a/README_ZH-CN.md +++ b/README_ZH-CN.md @@ -28,7 +28,9 @@ Even more roles are coming soon. - #### 新增内容: - 对所有按钮增加默认冷却为2.5s(给一部分无冷却技能增加提醒) - - 新增 “ 调整紧急破坏持续时间 ” 的选项(使用了SuperNewRoles的部分代码) + - 将模组设置中“在地图上显示管道”选项移动到游戏内预设中,并新增仅在会议中显示管道信息选项 + - 新增 “ 调整紧急破坏持续时间 ” 的选项(使用了[SuperNewRoles](https://github.com/SuperNewRoles/SuperNewRoles)的部分代码) + - 优化随机出生,现在分散不会有延迟了 - 为中国玩家在连接GitHub时自动替换链接为国内镜像源 - 法医:延长被保护的玩家被击杀时的闪光提醒时间(从0.5s增加到1.5s) - 魅魔:将真爱的任务从船员中移除 diff --git a/Strings.xlsx b/Strings.xlsx index 6ba22ff0..b21f876a 100644 Binary files a/Strings.xlsx and b/Strings.xlsx differ diff --git a/TheOtherRoles/Buttons.cs b/TheOtherRoles/Buttons.cs index 2541441c..8eddebd6 100644 --- a/TheOtherRoles/Buttons.cs +++ b/TheOtherRoles/Buttons.cs @@ -2761,8 +2761,8 @@ public static void createButtonsPostfix(HudManager __instance) arsonistButton.Timer = Arsonist.dousedEveryoneAlive() ? 0 : arsonistButton.MaxTimer; foreach (var p in Arsonist.dousedPlayers) - if (TORMapOptions.playerIcons.ContainsKey(p.PlayerId)) - TORMapOptions.playerIcons[p.PlayerId].setSemiTransparent(false); + if (MapOptions.playerIcons.ContainsKey(p.PlayerId)) + MapOptions.playerIcons[p.PlayerId].setSemiTransparent(false); // Ghost Info var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, diff --git a/TheOtherRoles/CustomGameModes/HideNSeekGM.cs b/TheOtherRoles/CustomGameModes/HideNSeekGM.cs index 31b4b8fe..4302989b 100644 --- a/TheOtherRoles/CustomGameModes/HideNSeekGM.cs +++ b/TheOtherRoles/CustomGameModes/HideNSeekGM.cs @@ -46,7 +46,7 @@ public static bool isHunted() public static void clearAndReload() { - isHideNSeekGM = TORMapOptions.gameMode == CustomGamemodes.HideNSeek; + isHideNSeekGM = MapOptions.gameMode == CustomGamemodes.HideNSeek; if (timerText != null) Object.Destroy(timerText); timerText = null; if (polusVent != null) Object.Destroy(polusVent); diff --git a/TheOtherRoles/CustomGameModes/PropHunt.cs b/TheOtherRoles/CustomGameModes/PropHunt.cs index 30807e67..ddaf1adb 100644 --- a/TheOtherRoles/CustomGameModes/PropHunt.cs +++ b/TheOtherRoles/CustomGameModes/PropHunt.cs @@ -80,7 +80,7 @@ internal class PropHunt public static void clearAndReload() { remainingShots.Clear(); - isPropHuntGM = TORMapOptions.gameMode == CustomGamemodes.PropHunt; + isPropHuntGM = MapOptions.gameMode == CustomGamemodes.PropHunt; numberOfHunters = CustomOptionHolder.propHuntNumberOfHunters.getQuantity(); initialBlackoutTime = CustomOptionHolder.hunterInitialBlackoutTime.getFloat(); //maxMissesBeforeDeath = CustomOptionHolder.hunterMaxMissesBeforeDeath.getQuantity(); @@ -202,8 +202,8 @@ public static void poolablePlayerUpdate() foreach (var pc in PlayerControl.AllPlayerControls) { - if (!TORMapOptions.playerIcons.ContainsKey(pc.PlayerId)) continue; - var poolablePlayer = TORMapOptions.playerIcons[pc.PlayerId]; + if (!MapOptions.playerIcons.ContainsKey(pc.PlayerId)) continue; + var poolablePlayer = MapOptions.playerIcons[pc.PlayerId]; if (pc.Data.IsDead) { poolablePlayer.setSemiTransparent(true); @@ -620,14 +620,14 @@ public static void MakePropImpostorPatch(PlayerControl __instance) public static void MapSetPostfix() { // Make sure the map in the settings is in sync with the map from li - if ((TORMapOptions.gameMode != CustomGamemodes.PropHunt && - TORMapOptions.gameMode != CustomGamemodes.HideNSeek) || AmongUsClient.Instance.IsGameStarted) return; + if ((MapOptions.gameMode != CustomGamemodes.PropHunt && + MapOptions.gameMode != CustomGamemodes.HideNSeek) || AmongUsClient.Instance.IsGameStarted) return; int map = GameOptionsManager.Instance.currentGameOptions.MapId; if (map > 3) map--; - if (TORMapOptions.gameMode == CustomGamemodes.HideNSeek) + if (MapOptions.gameMode == CustomGamemodes.HideNSeek) if (CustomOptionHolder.hideNSeekMap.selection != map) CustomOptionHolder.hideNSeekMap.updateSelection(map); - if (TORMapOptions.gameMode == CustomGamemodes.PropHunt) + if (MapOptions.gameMode == CustomGamemodes.PropHunt) if (CustomOptionHolder.propHuntMap.selection != map) CustomOptionHolder.propHuntMap.updateSelection(map); } @@ -721,10 +721,10 @@ public static bool KillButtonClickPatch(KillButton __instance) [HarmonyPatch(typeof(MapBehaviour), nameof(MapBehaviour.Show))] [HarmonyPrefix] - public static void MapBehaviourShowPatch(MapBehaviour __instance, ref MapOptions opts) + public static void MapBehaviourShowPatch(MapBehaviour __instance, ref global::MapOptions opts) { if (!isPropHuntGM) return; - if (opts.Mode == MapOptions.Modes.Sabotage) opts.Mode = MapOptions.Modes.Normal; + if (opts.Mode == global::MapOptions.Modes.Sabotage) opts.Mode = global::MapOptions.Modes.Normal; } diff --git a/TheOtherRoles/CustomOptionHolder.cs b/TheOtherRoles/CustomOptionHolder.cs index 3250aced..a07a56e0 100644 --- a/TheOtherRoles/CustomOptionHolder.cs +++ b/TheOtherRoles/CustomOptionHolder.cs @@ -498,6 +498,7 @@ public class CustomOptionHolder public static CustomOption impostorSeeRoles; public static CustomOption transparentTasks; + public static CustomOption ShowVentsOnMap; public static CustomOption enableMapOptions; public static CustomOption randomGameStartPosition; public static CustomOption randomGameStartToVents; @@ -715,6 +716,8 @@ public static void Load() randomGameStartPosition = CustomOption.Create(50, Types.General, "随机出生点", false, enableMapOptions, true); randomGameStartToVents = CustomOption.Create(51, Types.General, "随机出生在通风口上", false, randomGameStartPosition); + ShowVentsOnMap = CustomOption.Create(211, Types.General, getString("ShowVentsOnMapText"), false, enableMapOptions, true); + enableMiraModify = CustomOption.Create(70, Types.General, cs(new Color(200f / 200f, 200f / 200f, 0, 1f), "Mira"), false, enableMapOptions, true); miraVitals = CustomOption.Create(71, Types.General, "添加生命检测装置", false, enableMiraModify); diff --git a/TheOtherRoles/GameHistory.cs b/TheOtherRoles/GameHistory.cs index d98be73e..04dd379d 100644 --- a/TheOtherRoles/GameHistory.cs +++ b/TheOtherRoles/GameHistory.cs @@ -21,6 +21,11 @@ public enum CustomDeathReason LoveStolen, Loneliness, Arson, + SheriffKill, + SheriffMisfire, + SheriffMisadventure, + Suicide, + BombVictim, } public CustomDeathReason deathReason; diff --git a/TheOtherRoles/Helper/Helpers.cs b/TheOtherRoles/Helper/Helpers.cs index 887182a7..b47bc6bf 100644 --- a/TheOtherRoles/Helper/Helpers.cs +++ b/TheOtherRoles/Helper/Helpers.cs @@ -177,7 +177,7 @@ public static bool isCommsActive() public static bool isCamoComms() { - return isCommsActive() && TORMapOptions.camoComms; + return isCommsActive() && MapOptions.camoComms; } public static bool isActiveCamoComms() @@ -606,7 +606,7 @@ public static bool canBeErased(this PlayerControl player) public static bool shouldShowGhostInfo() { return (CachedPlayer.LocalPlayer.PlayerControl != null && CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead && - TORMapOptions.ghostsSeeInformation) || + MapOptions.ghostsSeeInformation) || AmongUsClient.Instance.GameState == InnerNetClient.GameStates.Ended; } @@ -660,6 +660,30 @@ public static bool isFungle() return GameOptionsManager.Instance.CurrentGameOptions.MapId == 5; } + + public static bool IsCN() + { + return (int)AmongUs.Data.DataManager.Settings.Language.CurrentLanguage == 13; + } + + public static string GithubUrl(this string url) + { + if (IsCN() && !url.Contains("github.moeyy.xyz")) + { + if (url.Contains("github.com")) + { + return url.Replace("https://github.com", "https://github.moeyy.xyz/https://github.com"); + } + + if (url.Contains("raw.githubusercontent.com")) + { + return url.Replace("https://raw.githubusercontent.com", "https://github.moeyy.xyz/https://raw.githubusercontent.com"); + } + } + Info("Rewrite URL" + url); + return url; + } + public static bool MushroomSabotageActive() { return CachedPlayer.LocalPlayer.PlayerControl.myTasks.ToArray() @@ -723,7 +747,7 @@ public static bool hidePlayerName(PlayerControl source, PlayerControl target) if (SurveillanceMinigamePatch.nightVisionIsActive) return true; if (Ninja.isInvisble && Ninja.ninja == target) return true; if (Swooper.isInvisable && Swooper.swooper == target) return true; - if (TORMapOptions.hideOutOfSightNametags && gameStarted && !source.Data.IsDead && GameOptionsManager.Instance.currentNormalGameOptions.MapId != 5 && + if (MapOptions.hideOutOfSightNametags && gameStarted && !source.Data.IsDead && GameOptionsManager.Instance.currentNormalGameOptions.MapId != 5 && PhysicsHelpers.AnythingBetween(localPlayer.GetTruePosition(), target.GetTruePosition(), Constants.ShadowMask, false)) return true; /* @@ -736,7 +760,7 @@ public static bool hidePlayerName(PlayerControl source, PlayerControl target) } } */ - if (!TORMapOptions.hidePlayerNames) return false; // All names are visible + if (!MapOptions.hidePlayerNames) return false; // All names are visible if (source == null || target == null) return true; if (source == target) return false; // Player sees his own name if (source.Data.Role.IsImpostor && (target.Data.Role.IsImpostor || target == Spy.spy || @@ -953,7 +977,7 @@ public static MurderAttemptResult checkMuderAttempt(PlayerControl killer, Player return MurderAttemptResult.PerformKill; // Handle first kill attempt - if (TORMapOptions.shieldFirstKill && TORMapOptions.firstKillPlayer == target) + if (MapOptions.shieldFirstKill && MapOptions.firstKillPlayer == target) return MurderAttemptResult.SuppressKill; // Handle blank shot diff --git a/TheOtherRoles/Main.cs b/TheOtherRoles/Main.cs index feeb1d9c..35a281f9 100644 --- a/TheOtherRoles/Main.cs +++ b/TheOtherRoles/Main.cs @@ -49,7 +49,6 @@ public class TheOtherRolesPlugin : BasePlugin public static ConfigEntry EnableSoundEffects { get; set; } public static ConfigEntry EnableHorseMode { get; set; } public static ConfigEntry ToggleCursor { get; set; } - public static ConfigEntry ShowVentsOnMap { get; set; } public static ConfigEntry enableDebugLogMode { get; set; } public static ConfigEntry Ip { get; set; } public static ConfigEntry Port { get; set; } @@ -107,7 +106,6 @@ public override void Load() EnableSoundEffects = Config.Bind("Custom", "Enable Sound Effects", true); EnableHorseMode = Config.Bind("Custom", "Enable Horse Mode", false); ShowPopUpVersion = Config.Bind("Custom", "Show PopUp", "0"); - ShowVentsOnMap = Config.Bind("Custom", "Show vent positions on minimap", true); enableDebugLogMode = Config.Bind("Custom", "Debug Log Mode", false); Ip = Config.Bind("Custom", "Custom Server IP", "127.0.0.1"); diff --git a/TheOtherRoles/MapOptions.cs b/TheOtherRoles/MapOptions.cs index 5df91fb7..fe6755c9 100644 --- a/TheOtherRoles/MapOptions.cs +++ b/TheOtherRoles/MapOptions.cs @@ -4,7 +4,7 @@ namespace TheOtherRoles; -internal static class TORMapOptions +internal static class MapOptions { // Set values public static int maxNumberOfMeetings = 10; @@ -26,8 +26,8 @@ internal static class TORMapOptions public static bool impostorSeeRoles; public static bool transparentTasks; public static bool hideOutOfSightNametags; - public static bool ShowVentsOnMap = true; - public static bool enableDebugLogMode = false; + public static bool ShowVentsOnMap; + public static bool enableDebugLogMode; public static bool disableMedscanWalking; public static int restrictDevices; @@ -116,8 +116,8 @@ public static void reloadPluginOptions() toggleCursor = TheOtherRolesPlugin.ToggleCursor.Value; enableSoundEffects = TheOtherRolesPlugin.EnableSoundEffects.Value; enableHorseMode = TheOtherRolesPlugin.EnableHorseMode.Value; - ShowVentsOnMap = TheOtherRolesPlugin.ShowVentsOnMap.Value; - ShowVentsOnMap = TheOtherRolesPlugin.enableDebugLogMode.Value; + ShowVentsOnMap = CustomOptionHolder.ShowVentsOnMap.getBool(); + enableDebugLogMode = TheOtherRolesPlugin.enableDebugLogMode.Value; //Patches.ShouldAlwaysHorseAround.isHorseMode = TheOtherRolesPlugin.EnableHorseMode.Value; } diff --git a/TheOtherRoles/Modules/ChatCommands.cs b/TheOtherRoles/Modules/ChatCommands.cs index c62b8d65..036a6bf4 100644 --- a/TheOtherRoles/Modules/ChatCommands.cs +++ b/TheOtherRoles/Modules/ChatCommands.cs @@ -179,7 +179,7 @@ public static void Postfix(HudManager __instance) __instance.Chat.SetVisible(true); if (Multitasker.multitasker.FindAll(x => x.PlayerId == CachedPlayer.LocalPlayer.PlayerId).Count > 0 || - TORMapOptions.transparentTasks) + MapOptions.transparentTasks) { if (PlayerControl.LocalPlayer.Data.IsDead || PlayerControl.LocalPlayer.Data.Disconnected) return; if (!Minigame.Instance) return; diff --git a/TheOtherRoles/Modules/CustomHats/CustomHatManager.cs b/TheOtherRoles/Modules/CustomHats/CustomHatManager.cs index 1cb11fd9..5e868679 100644 --- a/TheOtherRoles/Modules/CustomHats/CustomHatManager.cs +++ b/TheOtherRoles/Modules/CustomHats/CustomHatManager.cs @@ -16,14 +16,7 @@ public static class CustomHatManager public const string InnerslothPackageName = "Innersloth Hats"; public const string DeveloperPackageName = "Developer Hats"; - internal static string RepositoryUrl - { - get - { - var Url = $"https://raw.githubusercontent.com/TheOtherRolesAU/TheOtherHats/master".GithubUrl(); - return Url; - } - } + internal static string RepositoryUrl => $"https://raw.githubusercontent.com/TheOtherRolesAU/TheOtherHats/master".GithubUrl(); internal static readonly string ManifestFileName = "CustomHats.json"; diff --git a/TheOtherRoles/Modules/CustomOptions.cs b/TheOtherRoles/Modules/CustomOptions.cs index e762e9a8..40417b4a 100644 --- a/TheOtherRoles/Modules/CustomOptions.cs +++ b/TheOtherRoles/Modules/CustomOptions.cs @@ -331,7 +331,7 @@ internal class GameOptionsMenuStartPatch { public static void Postfix(GameOptionsMenu __instance) { - switch (TORMapOptions.gameMode) + switch (MapOptions.gameMode) { case CustomGamemodes.Classic: createClassicTabs(__instance); @@ -1143,24 +1143,24 @@ private static string buildOptionsOfType(CustomOptionType type, bool headerOnly) { var sb = new StringBuilder("\n"); var options = CustomOption.options.Where(o => o.type == type); - if (TORMapOptions.gameMode == CustomGamemodes.Guesser) + if (MapOptions.gameMode == CustomGamemodes.Guesser) { if (type == CustomOptionType.General) options = CustomOption.options.Where(o => o.type == type || o.type == CustomOptionType.Guesser); var remove = new List { 308, 310, 311, 312, 313, 314, 315, 316, 317, 318 }; options = options.Where(x => !remove.Contains(x.id)); } - else if (TORMapOptions.gameMode == CustomGamemodes.Classic) + else if (MapOptions.gameMode == CustomGamemodes.Classic) { options = options.Where(x => !(x.type == CustomOptionType.Guesser || x == CustomOptionHolder.crewmateRolesFill)); } - else if (TORMapOptions.gameMode == CustomGamemodes.HideNSeek) + else if (MapOptions.gameMode == CustomGamemodes.HideNSeek) { options = options.Where(x => x.type == CustomOptionType.HideNSeekMain || x.type == CustomOptionType.HideNSeekRoles); } - else if (TORMapOptions.gameMode == CustomGamemodes.PropHunt) + else if (MapOptions.gameMode == CustomGamemodes.PropHunt) { options = options.Where(x => x.type == CustomOptionType.PropHunt); } @@ -1177,7 +1177,7 @@ private static string buildOptionsOfType(CustomOptionType type, bool headerOnly) if (option.id == 30170) //Deputy sb.AppendLine( $"- {Helpers.cs(Deputy.color, "捕快")}: {option.selections[option.selection].ToString()}"); - else if (option.id == 20136) //Sidekick + else if (option.id == 20135) //Sidekick sb.AppendLine( $"- {Helpers.cs(Sidekick.color, "跟班")}: {option.selections[option.selection].ToString()}"); else if (option.id == 20181) //Prosecutor @@ -1190,9 +1190,9 @@ private static string buildOptionsOfType(CustomOptionType type, bool headerOnly) foreach (var option in options) { - if (TORMapOptions.gameMode == CustomGamemodes.HideNSeek && option.type != CustomOptionType.HideNSeekMain && + if (MapOptions.gameMode == CustomGamemodes.HideNSeek && option.type != CustomOptionType.HideNSeekMain && option.type != CustomOptionType.HideNSeekRoles) continue; - if (TORMapOptions.gameMode == CustomGamemodes.PropHunt && + if (MapOptions.gameMode == CustomGamemodes.PropHunt && option.type != CustomOptionType.PropHunt) continue; if (option.parent != null) { @@ -1284,7 +1284,7 @@ public static string buildAllOptions(string vanillaSettings = "", bool hideExtra ? Helpers.cs(DateTime.Now.Second % 2 == 0 ? Color.white : Color.red, "(如有必要,请使用滚轮)\n\n") : ""; - if (TORMapOptions.gameMode == CustomGamemodes.HideNSeek) + if (MapOptions.gameMode == CustomGamemodes.HideNSeek) { if (TheOtherRolesPlugin.optionsPage > 1) TheOtherRolesPlugin.optionsPage = 0; maxPage = 2; @@ -1298,7 +1298,7 @@ public static string buildAllOptions(string vanillaSettings = "", bool hideExtra break; } } - else if (TORMapOptions.gameMode == CustomGamemodes.PropHunt) + else if (MapOptions.gameMode == CustomGamemodes.PropHunt) { maxPage = 1; switch (counter) diff --git a/TheOtherRoles/Objects/Bomb.cs b/TheOtherRoles/Objects/Bomb.cs index d8fac377..8aac8b19 100644 --- a/TheOtherRoles/Objects/Bomb.cs +++ b/TheOtherRoles/Objects/Bomb.cs @@ -85,18 +85,21 @@ public static Sprite getDefuseSprite() public static void explode(Bomb b) { - var local = CachedPlayer.LocalPlayer.PlayerControl; if (b == null) return; if (Terrorist.terrorist != null) { var position = b.bomb.transform.position; - var distance = - Vector2.Distance(position, - CachedPlayer.LocalPlayer.transform - .position); // every player only checks that for their own client (desynct with positions sucks) - if (distance < Terrorist.destructionRange && !CachedPlayer.LocalPlayer.Data.IsDead - || (Terrorist.selfExplosion && local != Terrorist.terrorist)) + // every player only checks that for their own client (desynct with positions sucks) + var distance = Vector2.Distance(position, CachedPlayer.LocalPlayer.transform.position); + + if (distance <= Terrorist.destructionRange && !CachedPlayer.LocalPlayer.Data.IsDead) { + if (Terrorist.selfExplosion && CachedPlayer.LocalPlayer.PlayerControl == Terrorist.terrorist) + { + Terrorist.clearBomb(); + return; + }; + Helpers.checkMurderAttemptAndKill(Terrorist.terrorist, CachedPlayer.LocalPlayer.PlayerControl, false, false, true, true); diff --git a/TheOtherRoles/Objects/CustomButton.cs b/TheOtherRoles/Objects/CustomButton.cs index f91f81db..e64502fd 100644 --- a/TheOtherRoles/Objects/CustomButton.cs +++ b/TheOtherRoles/Objects/CustomButton.cs @@ -71,7 +71,7 @@ public CustomButton(Action OnClick, Func HasButton, Func CouldUse, A button.OnClick.AddListener((UnityAction)onClickEvent); //开局按钮cd - Timer = CustomOptionHolder.resteButtonCooldown.getFloat() + 8.5f; + Timer = ResetButtonCooldown.killCooldown + 8.5f; setActive(false); } diff --git a/TheOtherRoles/Patches/CameraPatch.cs b/TheOtherRoles/Patches/CameraPatch.cs index 1521865e..06198511 100644 --- a/TheOtherRoles/Patches/CameraPatch.cs +++ b/TheOtherRoles/Patches/CameraPatch.cs @@ -23,7 +23,7 @@ public static void ResetData() private static void UseCameraTime() { // Don't waste network traffic if we're out of time. - if (TORMapOptions.restrictDevices > 0 && TORMapOptions.restrictCamerasTime > 0f && + if (MapOptions.restrictDevices > 0 && MapOptions.restrictCamerasTime > 0f && CachedPlayer.LocalPlayer.PlayerControl.isAlive() && CachedPlayer.LocalPlayer.PlayerControl != Hacker.hacker && CachedPlayer.LocalPlayer.PlayerControl != SecurityGuard.securityGuard) @@ -95,7 +95,7 @@ public static bool Prefix(SurveillanceMinigame __instance) if (cameraTimer > 0.1f) UseCameraTime(); - if (TORMapOptions.restrictDevices > 0) + if (MapOptions.restrictDevices > 0) { if (TimeRemaining == null) { @@ -108,13 +108,13 @@ public static bool Prefix(SurveillanceMinigame __instance) TimeRemaining.color = Palette.White; } - if (TORMapOptions.disableCamsRoundOne && TORMapOptions.isRoundOne) + if (MapOptions.disableCamsRoundOne && MapOptions.isRoundOne) { __instance.Close(); return false; } - if (TORMapOptions.restrictCamerasTime <= 0f && + if (MapOptions.restrictCamerasTime <= 0f && CachedPlayer.LocalPlayer.PlayerControl != Hacker.hacker && CachedPlayer.LocalPlayer.PlayerControl != SecurityGuard.securityGuard && !CachedPlayer.LocalPlayer.Data.IsDead) @@ -123,7 +123,7 @@ public static bool Prefix(SurveillanceMinigame __instance) return false; } - var timeString = TimeSpan.FromSeconds(TORMapOptions.restrictCamerasTime).ToString(@"mm\:ss\.ff"); + var timeString = TimeSpan.FromSeconds(MapOptions.restrictCamerasTime).ToString(@"mm\:ss\.ff"); TimeRemaining.text = $"Remaining: {timeString}"; TimeRemaining.gameObject.SetActive(true); } @@ -220,7 +220,7 @@ public static bool Prefix(PlanetSurveillanceMinigame __instance) if (cameraTimer > 0.1f) UseCameraTime(); - if (TORMapOptions.restrictDevices <= 0) return true; + if (MapOptions.restrictDevices <= 0) return true; if (TimeRemaining == null) { TimeRemaining = @@ -232,13 +232,13 @@ public static bool Prefix(PlanetSurveillanceMinigame __instance) TimeRemaining.color = Palette.White; } - if (TORMapOptions.disableCamsRoundOne && TORMapOptions.isRoundOne) + if (MapOptions.disableCamsRoundOne && MapOptions.isRoundOne) { __instance.Close(); return false; } - if (TORMapOptions.restrictCamerasTime <= 0f && + if (MapOptions.restrictCamerasTime <= 0f && CachedPlayer.LocalPlayer.PlayerControl != Hacker.hacker && CachedPlayer.LocalPlayer.PlayerControl != SecurityGuard.securityGuard && !CachedPlayer.LocalPlayer.Data.IsDead) @@ -247,7 +247,7 @@ public static bool Prefix(PlanetSurveillanceMinigame __instance) return false; } - var timeString = TimeSpan.FromSeconds(TORMapOptions.restrictCamerasTime).ToString(@"mm\:ss\.ff"); + var timeString = TimeSpan.FromSeconds(MapOptions.restrictCamerasTime).ToString(@"mm\:ss\.ff"); TimeRemaining.text = $"Remaining: {timeString}"; TimeRemaining.gameObject.SetActive(true); @@ -299,7 +299,7 @@ public static bool Prefix(SecurityLogGame __instance) if (cameraTimer > 0.1f) UseCameraTime(); - if (TORMapOptions.restrictDevices <= 0) return true; + if (MapOptions.restrictDevices <= 0) return true; if (TimeRemaining == null) { TimeRemaining = @@ -311,7 +311,7 @@ public static bool Prefix(SecurityLogGame __instance) TimeRemaining.color = Palette.White; } - if (TORMapOptions.restrictCamerasTime <= 0f && + if (MapOptions.restrictCamerasTime <= 0f && CachedPlayer.LocalPlayer.PlayerControl != Hacker.hacker && CachedPlayer.LocalPlayer.PlayerControl != SecurityGuard.securityGuard && !CachedPlayer.LocalPlayer.Data.IsDead) @@ -320,7 +320,7 @@ public static bool Prefix(SecurityLogGame __instance) return false; } - var timeString = TimeSpan.FromSeconds(TORMapOptions.restrictCamerasTime).ToString(@"mm\:ss\.ff"); + var timeString = TimeSpan.FromSeconds(MapOptions.restrictCamerasTime).ToString(@"mm\:ss\.ff"); TimeRemaining.text = string.Format("Remaining: {0}", timeString); TimeRemaining.gameObject.SetActive(true); diff --git a/TheOtherRoles/Patches/ClientOptionsPatch.cs b/TheOtherRoles/Patches/ClientOptionsPatch.cs index 0ee12575..184c3cd8 100644 --- a/TheOtherRoles/Patches/ClientOptionsPatch.cs +++ b/TheOtherRoles/Patches/ClientOptionsPatch.cs @@ -15,39 +15,35 @@ public static class ClientOptionsPatch private static readonly SelectionBehaviour[] AllOptions = [ new SelectionBehaviour(getString("GhostsSeeInformationText"), - () => TORMapOptions.ghostsSeeInformation = Main.GhostsSeeInformation.Value = + () => MapOptions.ghostsSeeInformation = Main.GhostsSeeInformation.Value = !Main.GhostsSeeInformation.Value, Main.GhostsSeeInformation.Value), new SelectionBehaviour(getString("GhostsSeeVotesText"), - () => TORMapOptions.ghostsSeeVotes = + () => MapOptions.ghostsSeeVotes = Main.GhostsSeeVotes.Value = !Main.GhostsSeeVotes.Value, Main.GhostsSeeVotes.Value), new SelectionBehaviour(getString("GhostsSeeRolesText"), - () => TORMapOptions.ghostsSeeRoles = + () => MapOptions.ghostsSeeRoles = Main.GhostsSeeRoles.Value = !Main.GhostsSeeRoles.Value, Main.GhostsSeeRoles.Value), new SelectionBehaviour(getString("GhostsSeeModifierText"), - () => TORMapOptions.ghostsSeeModifier = Main.GhostsSeeModifier.Value = + () => MapOptions.ghostsSeeModifier = Main.GhostsSeeModifier.Value = !Main.GhostsSeeModifier.Value, Main.GhostsSeeModifier.Value), new SelectionBehaviour(getString("ShowRoleSummaryText"), - () => TORMapOptions.showRoleSummary = + () => MapOptions.showRoleSummary = Main.ShowRoleSummary.Value = !Main.ShowRoleSummary.Value, Main.ShowRoleSummary.Value), new SelectionBehaviour(getString("ShowLighterDarkerText"), - () => TORMapOptions.showLighterDarker = Main.ShowLighterDarker.Value = + () => MapOptions.showLighterDarker = Main.ShowLighterDarker.Value = !Main.ShowLighterDarker.Value, Main.ShowLighterDarker.Value), new SelectionBehaviour(getString("ToggleCursorText"), - () => TORMapOptions.toggleCursor = + () => MapOptions.toggleCursor = Main.ToggleCursor.Value = !Main.ToggleCursor.Value, Main.ToggleCursor.Value), new SelectionBehaviour(getString("EnableSoundEffectsText"), - () => TORMapOptions.enableSoundEffects = Main.EnableSoundEffects.Value = + () => MapOptions.enableSoundEffects = Main.EnableSoundEffects.Value = !Main.EnableSoundEffects.Value, Main.EnableSoundEffects.Value), - new SelectionBehaviour(getString("ShowVentsOnMapText"), - () => TORMapOptions.ShowVentsOnMap = - Main.ShowVentsOnMap.Value = !Main.ShowVentsOnMap.Value, - Main.ShowVentsOnMap.Value), new SelectionBehaviour(getString("EnableDebugLogModeText"), - () => TORMapOptions.enableDebugLogMode = + () => MapOptions.enableDebugLogMode = Main.enableDebugLogMode.Value = !Main.enableDebugLogMode.Value, Main.enableDebugLogMode.Value) ]; diff --git a/TheOtherRoles/Patches/CreateOptionsPickerPatch.cs b/TheOtherRoles/Patches/CreateOptionsPickerPatch.cs index 678e6c37..a374e2d6 100644 --- a/TheOtherRoles/Patches/CreateOptionsPickerPatch.cs +++ b/TheOtherRoles/Patches/CreateOptionsPickerPatch.cs @@ -16,7 +16,7 @@ public static bool Prefix(CreateOptionsPicker __instance, ref GameModes mode) { if (mode <= GameModes.HideNSeek) { - TORMapOptions.gameMode = CustomGamemodes.Classic; + MapOptions.gameMode = CustomGamemodes.Classic; return true; } @@ -26,15 +26,15 @@ public static bool Prefix(CreateOptionsPicker __instance, ref GameModes mode) { case CustomGamemodes.Guesser: __instance.GameModeText.text = getString("isGuesserGm"); - TORMapOptions.gameMode = CustomGamemodes.Guesser; + MapOptions.gameMode = CustomGamemodes.Guesser; break; case CustomGamemodes.HideNSeek: __instance.GameModeText.text = getString("isHideNSeekGM"); - TORMapOptions.gameMode = CustomGamemodes.HideNSeek; + MapOptions.gameMode = CustomGamemodes.HideNSeek; break; case CustomGamemodes.PropHunt: __instance.GameModeText.text = getString("isPropHuntGM"); - TORMapOptions.gameMode = CustomGamemodes.PropHunt; + MapOptions.gameMode = CustomGamemodes.PropHunt; break; } @@ -45,7 +45,7 @@ public static bool Prefix(CreateOptionsPicker __instance, ref GameModes mode) [HarmonyPatch(typeof(CreateOptionsPicker), nameof(CreateOptionsPicker.Refresh))] public static void Postfix(CreateOptionsPicker __instance) { - __instance.GameModeText.text = TORMapOptions.gameMode switch + __instance.GameModeText.text = MapOptions.gameMode switch { CustomGamemodes.Guesser => getString("isGuesserGm"), CustomGamemodes.HideNSeek => getString("isHideNSeekGM"), @@ -89,11 +89,11 @@ public static bool Prefix(GameModeMenu __instance) chatLanguageButton.Button.OnClick.RemoveAllListeners(); chatLanguageButton.Button.OnClick.AddListener((Action)delegate { __instance.ChooseOption(entry); }); - var isCurrentMode = i <= 2 && TORMapOptions.gameMode == CustomGamemodes.Classic + var isCurrentMode = i <= 2 && MapOptions.gameMode == CustomGamemodes.Classic ? (long)entry == gameMode - : (i == 3 && TORMapOptions.gameMode == CustomGamemodes.Guesser) || - (i == 4 && TORMapOptions.gameMode == CustomGamemodes.HideNSeek) || - (i == 5 && TORMapOptions.gameMode == CustomGamemodes.PropHunt); + : (i == 3 && MapOptions.gameMode == CustomGamemodes.Guesser) || + (i == 4 && MapOptions.gameMode == CustomGamemodes.HideNSeek) || + (i == 5 && MapOptions.gameMode == CustomGamemodes.PropHunt); chatLanguageButton.SetSelected(isCurrentMode); __instance.controllerSelectable.Add(chatLanguageButton.Button); if (isCurrentMode) __instance.defaultButtonSelected = chatLanguageButton.Button; diff --git a/TheOtherRoles/Patches/CredentialsPatch.cs b/TheOtherRoles/Patches/CredentialsPatch.cs index 1b205a10..92753966 100644 --- a/TheOtherRoles/Patches/CredentialsPatch.cs +++ b/TheOtherRoles/Patches/CredentialsPatch.cs @@ -58,7 +58,7 @@ private static void Postfix(PingTracker __instance) } else { - var gameModeText = TORMapOptions.gameMode switch + var gameModeText = MapOptions.gameMode switch { CustomGamemodes.HideNSeek => getString("isHideNSeekGM"), CustomGamemodes.Guesser => getString("isGuesserGm"), @@ -152,7 +152,7 @@ public static void updateSprite() renderer.color = new Color(1, 1, 1, 1 - p); if (p == 1) { - renderer.sprite = TORMapOptions.enableHorseMode ? horseBannerSprite : bannerSprite; + renderer.sprite = MapOptions.enableHorseMode ? horseBannerSprite : bannerSprite; instance.StartCoroutine(Effects.Lerp(fadeDuration, new Action(p => { renderer.color = new Color(1, 1, 1, p); }))); } diff --git a/TheOtherRoles/Patches/EndGamePatch.cs b/TheOtherRoles/Patches/EndGamePatch.cs index d57e7220..be272b08 100644 --- a/TheOtherRoles/Patches/EndGamePatch.cs +++ b/TheOtherRoles/Patches/EndGamePatch.cs @@ -384,7 +384,7 @@ public static void Postfix(AmongUsClient __instance, [HarmonyArgument(0)] ref En .TotalMilliseconds / 1000; // Reset Settings - if (TORMapOptions.gameMode == CustomGamemodes.HideNSeek) ShipStatusPatch.resetVanillaSettings(); + if (MapOptions.gameMode == CustomGamemodes.HideNSeek) ShipStatusPatch.resetVanillaSettings(); RPCProcedure.resetVariables(); EventUtility.gameEndsUpdate(); } @@ -542,7 +542,7 @@ public static void Postfix(EndGameManager __instance) break; } - if (TORMapOptions.showRoleSummary || HideNSeek.isHideNSeekGM || PropHunt.isPropHuntGM) + if (MapOptions.showRoleSummary || HideNSeek.isHideNSeekGM || PropHunt.isPropHuntGM) { if (Camera.main != null) { diff --git a/TheOtherRoles/Patches/ExileControllerPatch.cs b/TheOtherRoles/Patches/ExileControllerPatch.cs index d70f24aa..5fa886b8 100644 --- a/TheOtherRoles/Patches/ExileControllerPatch.cs +++ b/TheOtherRoles/Patches/ExileControllerPatch.cs @@ -129,16 +129,16 @@ public static void Prefix(ExileController __instance, [HarmonyArgument(0)] ref G // SecurityGuard vents and cameras var allCameras = MapUtilities.CachedShipStatus.AllCameras.ToList(); - TORMapOptions.camerasToAdd.ForEach(camera => + MapOptions.camerasToAdd.ForEach(camera => { camera.gameObject.SetActive(true); camera.gameObject.GetComponent().color = Color.white; allCameras.Add(camera); }); MapUtilities.CachedShipStatus.AllCameras = allCameras.ToArray(); - TORMapOptions.camerasToAdd = new List(); + MapOptions.camerasToAdd = new List(); - foreach (var vent in TORMapOptions.ventsToSeal) + foreach (var vent in MapOptions.ventsToSeal) { var animator = vent.GetComponent(); vent.EnterVentAnim = vent.ExitVentAnim = null; @@ -163,10 +163,10 @@ public static void Prefix(ExileController __instance, [HarmonyArgument(0)] ref G vent.name = "SealedVent_" + vent.name; } - TORMapOptions.ventsToSeal = new List(); + MapOptions.ventsToSeal = new List(); // 1 = reset per turn - if (TORMapOptions.restrictDevices == 1) - TORMapOptions.resetDeviceTimes(); + if (MapOptions.restrictDevices == 1) + MapOptions.resetDeviceTimes(); EventUtility.meetingEndsUpdate(); } @@ -278,14 +278,14 @@ private static void WrapUpPostfix(GameData.PlayerInfo exiled) var BottomLeft = newBottomLeft + new Vector3(-0.25f, -0.25f, 0); foreach (PlayerControl p in CachedPlayer.AllPlayers) { - if (!TORMapOptions.playerIcons.ContainsKey(p.PlayerId)) continue; + if (!MapOptions.playerIcons.ContainsKey(p.PlayerId)) continue; if (p.Data.IsDead || p.Data.Disconnected) { - TORMapOptions.playerIcons[p.PlayerId].gameObject.SetActive(false); + MapOptions.playerIcons[p.PlayerId].gameObject.SetActive(false); } else { - TORMapOptions.playerIcons[p.PlayerId].transform.localPosition = + MapOptions.playerIcons[p.PlayerId].transform.localPosition = newBottomLeft + (Vector3.right * visibleCounter * 0.35f); visibleCounter++; } diff --git a/TheOtherRoles/Patches/GameStartManagerPatch.cs b/TheOtherRoles/Patches/GameStartManagerPatch.cs index 48065b40..9887b87f 100644 --- a/TheOtherRoles/Patches/GameStartManagerPatch.cs +++ b/TheOtherRoles/Patches/GameStartManagerPatch.cs @@ -27,7 +27,7 @@ public static void Postfix(AmongUsClient __instance, [HarmonyArgument(0)] Client { var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer!.PlayerControl.NetId, (byte)CustomRPC.ShareGamemode, SendOption.Reliable); - writer.Write((byte)TORMapOptions.gameMode); + writer.Write((byte)MapOptions.gameMode); AmongUsClient.Instance.FinishRpcImmediately(writer); } @@ -51,7 +51,7 @@ public static void Postfix(AmongUsClient __instance, [HarmonyArgument(0)] Client { var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer!.PlayerControl.NetId, (byte)CustomRPC.ShareGamemode, SendOption.Reliable); - writer.Write((byte)TORMapOptions.gameMode); + writer.Write((byte)MapOptions.gameMode); AmongUsClient.Instance.FinishRpcImmediately(writer); } } @@ -306,9 +306,9 @@ void StopStartFunc() if (AmongUsClient.Instance.AmHost) { MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.ShareGamemode, SendOption.Reliable, -1); - writer.Write((byte)TORMapOptions.gameMode); + writer.Write((byte)MapOptions.gameMode); AmongUsClient.Instance.FinishRpcImmediately(writer); - RPCProcedure.shareGameMode((byte)TORMapOptions.gameMode); + RPCProcedure.shareGameMode((byte)MapOptions.gameMode); } } } @@ -347,11 +347,11 @@ public static bool Prefix(GameStartManager __instance) } if (continueStart && - (TORMapOptions.gameMode == CustomGamemodes.HideNSeek || - TORMapOptions.gameMode == CustomGamemodes.PropHunt) && + (MapOptions.gameMode == CustomGamemodes.HideNSeek || + MapOptions.gameMode == CustomGamemodes.PropHunt) && GameOptionsManager.Instance.CurrentGameOptions.MapId != 6) { - byte mapId = TORMapOptions.gameMode switch + byte mapId = MapOptions.gameMode switch { CustomGamemodes.HideNSeek => (byte)CustomOptionHolder.hideNSeekMap.getSelection(), CustomGamemodes.PropHunt => (byte)CustomOptionHolder.propHuntMap.getSelection(), diff --git a/TheOtherRoles/Patches/HauntMenuMinigamePatch.cs b/TheOtherRoles/Patches/HauntMenuMinigamePatch.cs index b90f8540..b858433b 100644 --- a/TheOtherRoles/Patches/HauntMenuMinigamePatch.cs +++ b/TheOtherRoles/Patches/HauntMenuMinigamePatch.cs @@ -18,7 +18,7 @@ public static void Postfix(HauntMenuMinigame __instance) if (GameOptionsManager.Instance.currentGameOptions.GameMode != GameModes.Normal) return; var target = __instance.HauntTarget; var roleInfo = RoleInfo.getRoleInfoForPlayer(target, false); - var roleString = roleInfo.Count > 0 && TORMapOptions.ghostsSeeRoles ? roleInfo[0].name : ""; + var roleString = roleInfo.Count > 0 && MapOptions.ghostsSeeRoles ? roleInfo[0].name : ""; if (__instance.HauntTarget.Data.IsDead) { __instance.FilterText.text = roleString + " Ghost"; @@ -48,7 +48,7 @@ public static void MatchesFilterPostfix(HauntMenuMinigame __instance, PlayerCont public static bool StartPrefix(HauntMenuMinigame __instance) { if (GameOptionsManager.Instance.currentGameOptions.GameMode != GameModes.Normal || - !TORMapOptions.ghostsSeeRoles) return true; + !MapOptions.ghostsSeeRoles) return true; __instance.FilterButtons[0].gameObject.SetActive(true); var numActive = 0; var numButtons = __instance.FilterButtons.Count(s => s.isActiveAndEnabled); diff --git a/TheOtherRoles/Patches/IntroPatch.cs b/TheOtherRoles/Patches/IntroPatch.cs index 42aac379..214afbfd 100644 --- a/TheOtherRoles/Patches/IntroPatch.cs +++ b/TheOtherRoles/Patches/IntroPatch.cs @@ -47,7 +47,7 @@ public static void Prefix(IntroCutscene __instance) //PlayerControl.SetPetImage(data.DefaultOutfit.PetId, data.DefaultOutfit.ColorId, player.PetSlot); player.cosmetics.nameText.text = data.PlayerName; player.SetFlipX(true); - TORMapOptions.playerIcons[p.PlayerId] = player; + MapOptions.playerIcons[p.PlayerId] = player; player.gameObject.SetActive(false); if (CachedPlayer.LocalPlayer.PlayerControl == Arsonist.arsonist && p != Arsonist.arsonist) @@ -155,11 +155,11 @@ public static void Prefix(IntroCutscene __instance) } // First kill - if (AmongUsClient.Instance.AmHost && TORMapOptions.shieldFirstKill && TORMapOptions.firstKillName != "" && + if (AmongUsClient.Instance.AmHost && MapOptions.shieldFirstKill && MapOptions.firstKillName != "" && !HideNSeek.isHideNSeekGM && !PropHunt.isPropHuntGM) { var target = PlayerControl.AllPlayerControls.ToArray().ToList() - .FirstOrDefault(x => x.Data.PlayerName.Equals(TORMapOptions.firstKillName)); + .FirstOrDefault(x => x.Data.PlayerName.Equals(MapOptions.firstKillName)); if (target != null) { var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, @@ -170,7 +170,7 @@ public static void Prefix(IntroCutscene __instance) } } - TORMapOptions.firstKillName = ""; + MapOptions.firstKillName = ""; EventUtility.gameStartsUpdate(); diff --git a/TheOtherRoles/Patches/MainMenuPatch.cs b/TheOtherRoles/Patches/MainMenuPatch.cs index 9fd3ffd2..62d57905 100644 --- a/TheOtherRoles/Patches/MainMenuPatch.cs +++ b/TheOtherRoles/Patches/MainMenuPatch.cs @@ -13,7 +13,7 @@ namespace TheOtherRoles.Modules; [HarmonyPatch(typeof(MainMenuManager), nameof(MainMenuManager.Start))] public class MainMenuPatch { - private static bool horseButtonState = TORMapOptions.enableHorseMode; + private static bool horseButtonState = MapOptions.enableHorseMode; //private static Sprite horseModeOffSprite = null; //private static Sprite horseModeOnSprite = null; @@ -134,7 +134,7 @@ public static void addSceneChangeCallbacks() SceneManager.add_sceneLoaded((Action)((scene, _) => { if (!scene.name.Equals("MatchMaking", StringComparison.Ordinal)) return; - TORMapOptions.gameMode = CustomGamemodes.Classic; + MapOptions.gameMode = CustomGamemodes.Classic; // Add buttons For Guesser Mode, Hide N Seek in this scene. // find "HostLocalGameButton" var template = Object.FindObjectOfType(); @@ -149,7 +149,7 @@ public static void addSceneChangeCallbacks() guesserButtonPassiveButton.OnClick = new Button.ButtonClickedEvent(); guesserButtonPassiveButton.OnClick.AddListener((Action)(() => { - TORMapOptions.gameMode = CustomGamemodes.Guesser; + MapOptions.gameMode = CustomGamemodes.Guesser; template.OnClick(); })); @@ -161,7 +161,7 @@ public static void addSceneChangeCallbacks() HideNSeekButtonPassiveButton.OnClick = new Button.ButtonClickedEvent(); HideNSeekButtonPassiveButton.OnClick.AddListener((Action)(() => { - TORMapOptions.gameMode = CustomGamemodes.HideNSeek; + MapOptions.gameMode = CustomGamemodes.HideNSeek; template.OnClick(); })); @@ -173,7 +173,7 @@ public static void addSceneChangeCallbacks() PropHuntButtonPassiveButton.OnClick = new Button.ButtonClickedEvent(); PropHuntButtonPassiveButton.OnClick.AddListener((Action)(() => { - TORMapOptions.gameMode = CustomGamemodes.PropHunt; + MapOptions.gameMode = CustomGamemodes.PropHunt; template.OnClick(); })); diff --git a/TheOtherRoles/Patches/MapBehaviourPatch.cs b/TheOtherRoles/Patches/MapBehaviourPatch.cs index 48458f49..068d9005 100644 --- a/TheOtherRoles/Patches/MapBehaviourPatch.cs +++ b/TheOtherRoles/Patches/MapBehaviourPatch.cs @@ -111,7 +111,7 @@ private static void Postfix(MapBehaviour __instance) PlayerControl.LocalPlayer.Data.IsDead)) continue; //for trickster vents - if (!Main.ShowVentsOnMap.Value) + if (!MapOptions.ShowVentsOnMap) { if (mapIcons.Count > 0) { diff --git a/TheOtherRoles/Patches/MedBayWalkPatch.cs b/TheOtherRoles/Patches/MedBayWalkPatch.cs index b4ba066b..4b79b8a3 100644 --- a/TheOtherRoles/Patches/MedBayWalkPatch.cs +++ b/TheOtherRoles/Patches/MedBayWalkPatch.cs @@ -7,7 +7,7 @@ internal class MedscanMiniGamePatchWTP { private static bool Prefix(MedScanMinigame._WalkToPad_d__16 __instance) { - if (TORMapOptions.disableMedscanWalking) + if (MapOptions.disableMedscanWalking) { var num = __instance.__1__state; var medScanMinigame = __instance.__4__this; @@ -41,7 +41,7 @@ internal class MedscanMiniGamePatchWTO { private static bool Prefix(MedScanMinigame._WalkToOffset_d__15 __instance) { - if (TORMapOptions.disableMedscanWalking) + if (MapOptions.disableMedscanWalking) { var num = __instance.__1__state; var medScanMinigame = __instance.__4__this; diff --git a/TheOtherRoles/Patches/MeetingPatch.cs b/TheOtherRoles/Patches/MeetingPatch.cs index 9d586661..dcbabe1b 100644 --- a/TheOtherRoles/Patches/MeetingPatch.cs +++ b/TheOtherRoles/Patches/MeetingPatch.cs @@ -10,7 +10,7 @@ using TMPro; using UnityEngine; using static TheOtherRoles.TheOtherRoles; -using static TheOtherRoles.TORMapOptions; +using static TheOtherRoles.MapOptions; using Object = UnityEngine.Object; using Random = System.Random; diff --git a/TheOtherRoles/Patches/PlayerControlPatch.cs b/TheOtherRoles/Patches/PlayerControlPatch.cs index c67f49b1..9a85d563 100644 --- a/TheOtherRoles/Patches/PlayerControlPatch.cs +++ b/TheOtherRoles/Patches/PlayerControlPatch.cs @@ -107,9 +107,9 @@ private static void setBasePlayerOutlines() } if (!Helpers.isCamoComms() && Camouflager.camouflageTimer <= 0f && !Helpers.MushroomSabotageActive() && - TORMapOptions.firstKillPlayer != null && TORMapOptions.shieldFirstKill && - ((target == TORMapOptions.firstKillPlayer && !isMorphedMorphling) || - (isMorphedMorphling && Morphling.morphTarget == TORMapOptions.firstKillPlayer))) + MapOptions.firstKillPlayer != null && MapOptions.shieldFirstKill && + ((target == MapOptions.firstKillPlayer && !isMorphedMorphling) || + (isMorphedMorphling && Morphling.morphTarget == MapOptions.firstKillPlayer))) { hasVisibleShield = true; color = Color.blue; @@ -767,7 +767,7 @@ public static void updatePlayerInfo() CachedPlayer.LocalPlayer.Data.IsDead || (CachedPlayer.LocalPlayer.PlayerControl == Slueth.slueth && Slueth.reported.Any(x => x.PlayerId == p.PlayerId)) || - (TORMapOptions.impostorSeeRoles && Spy.spy == null && CachedPlayer.LocalPlayer.Data.Role.IsImpostor && + (MapOptions.impostorSeeRoles && Spy.spy == null && CachedPlayer.LocalPlayer.Data.Role.IsImpostor && !CachedPlayer.LocalPlayer.Data.IsDead && p == (p.Data.Role.IsImpostor && !p.Data.IsDead)) || (CachedPlayer.LocalPlayer.PlayerControl == Poucher.poucher && Poucher.killed.Any(x => x.PlayerId == p.PlayerId))) @@ -806,12 +806,12 @@ public static void updatePlayerInfo() var (tasksCompleted, tasksTotal) = TasksHandler.taskInfo(p.Data); var roleNames = RoleInfo.GetRolesString(p, true, false); - var roleText = RoleInfo.GetRolesString(p, true, TORMapOptions.ghostsSeeModifier); + var roleText = RoleInfo.GetRolesString(p, true, MapOptions.ghostsSeeModifier); var taskInfo = tasksTotal > 0 ? $"({tasksCompleted}/{tasksTotal})" : ""; var playerInfoText = ""; var meetingInfoText = ""; - if (p == CachedPlayer.LocalPlayer.PlayerControl || (TORMapOptions.impostorSeeRoles && Spy.spy == null && + if (p == CachedPlayer.LocalPlayer.PlayerControl || (MapOptions.impostorSeeRoles && Spy.spy == null && CachedPlayer.LocalPlayer.Data.Role.IsImpostor && !CachedPlayer.LocalPlayer.Data.IsDead && p == (p.Data.Role.IsImpostor && !p.Data.IsDead))) @@ -829,17 +829,17 @@ public static void updatePlayerInfo() meetingInfoText = $"{roleNames} {taskInfo}".Trim(); } - else if (TORMapOptions.ghostsSeeRoles && TORMapOptions.ghostsSeeInformation) + else if (MapOptions.ghostsSeeRoles && MapOptions.ghostsSeeInformation) { playerInfoText = $"{roleText} {taskInfo}".Trim(); meetingInfoText = playerInfoText; } - else if (TORMapOptions.ghostsSeeInformation) + else if (MapOptions.ghostsSeeInformation) { playerInfoText = $"{taskInfo}".Trim(); meetingInfoText = playerInfoText; } - else if (TORMapOptions.ghostsSeeRoles || (Lawyer.lawyerKnowsRole && !Lawyer.isProsecutor && + else if (MapOptions.ghostsSeeRoles || (Lawyer.lawyerKnowsRole && !Lawyer.isProsecutor && CachedPlayer.LocalPlayer.PlayerControl == Lawyer.lawyer && p == Lawyer.target)) { @@ -1040,7 +1040,7 @@ private static void bountyHunterUpdate() Object.Destroy(BountyHunter.cooldownText.gameObject); BountyHunter.cooldownText = null; BountyHunter.bounty = null; - foreach (var p in TORMapOptions.playerIcons.Values) + foreach (var p in MapOptions.playerIcons.Values) if (p != null && p.gameObject != null) p.gameObject.SetActive(false); return; @@ -1077,17 +1077,17 @@ private static void bountyHunterUpdate() if (FastDestroyableSingleton.Instance != null && FastDestroyableSingleton.Instance.UseButton != null) { - foreach (var pp in TORMapOptions.playerIcons.Values) pp.gameObject.SetActive(false); - if (TORMapOptions.playerIcons.ContainsKey(BountyHunter.bounty.PlayerId) && - TORMapOptions.playerIcons[BountyHunter.bounty.PlayerId].gameObject != null) - TORMapOptions.playerIcons[BountyHunter.bounty.PlayerId].gameObject.SetActive(true); + foreach (var pp in MapOptions.playerIcons.Values) pp.gameObject.SetActive(false); + if (MapOptions.playerIcons.ContainsKey(BountyHunter.bounty.PlayerId) && + MapOptions.playerIcons[BountyHunter.bounty.PlayerId].gameObject != null) + MapOptions.playerIcons[BountyHunter.bounty.PlayerId].gameObject.SetActive(true); } } // Hide in meeting - if (MeetingHud.Instance && TORMapOptions.playerIcons.ContainsKey(BountyHunter.bounty.PlayerId) && - TORMapOptions.playerIcons[BountyHunter.bounty.PlayerId].gameObject != null) - TORMapOptions.playerIcons[BountyHunter.bounty.PlayerId].gameObject.SetActive(false); + if (MeetingHud.Instance && MapOptions.playerIcons.ContainsKey(BountyHunter.bounty.PlayerId) && + MapOptions.playerIcons[BountyHunter.bounty.PlayerId].gameObject != null) + MapOptions.playerIcons[BountyHunter.bounty.PlayerId].gameObject.SetActive(false); // Update Cooldown Text if (BountyHunter.cooldownText != null) @@ -2022,7 +2022,7 @@ public static void Postfix(PlayerControl __instance, [HarmonyArgument(0)] Player target.clearAllTasks(); // First kill (set before lover suicide) - if (TORMapOptions.firstKillName == "") TORMapOptions.firstKillName = target.Data.PlayerName; + if (MapOptions.firstKillName == "") MapOptions.firstKillName = target.Data.PlayerName; // Lover suicide trigger on murder if ((Lovers.lover1 != null && target == Lovers.lover1) || (Lovers.lover2 != null && target == Lovers.lover2)) @@ -2172,14 +2172,14 @@ public static void Postfix(PlayerControl __instance, [HarmonyArgument(0)] Player var bottomLeft = IntroCutsceneOnDestroyPatch.bottomLeft + new Vector3(-0.25f, -0.25f, 0); foreach (PlayerControl p in CachedPlayer.AllPlayers) { - if (!TORMapOptions.playerIcons.ContainsKey(p.PlayerId) || p.Data.Role.IsImpostor) continue; + if (!MapOptions.playerIcons.ContainsKey(p.PlayerId) || p.Data.Role.IsImpostor) continue; if (p.Data.IsDead || p.Data.Disconnected) { - TORMapOptions.playerIcons[p.PlayerId].gameObject.SetActive(false); + MapOptions.playerIcons[p.PlayerId].gameObject.SetActive(false); } else { - TORMapOptions.playerIcons[p.PlayerId].transform.localPosition = + MapOptions.playerIcons[p.PlayerId].transform.localPosition = bottomLeft + (Vector3.right * visibleCounter * 0.35f); visibleCounter++; } diff --git a/TheOtherRoles/Patches/RoleAssignmentPatch.cs b/TheOtherRoles/Patches/RoleAssignmentPatch.cs index 45607a03..f021cf68 100644 --- a/TheOtherRoles/Patches/RoleAssignmentPatch.cs +++ b/TheOtherRoles/Patches/RoleAssignmentPatch.cs @@ -27,9 +27,9 @@ internal class GameOptionsDataGetAdjustedNumImpostorsPatch { public static void Postfix(ref int __result) { - if (TORMapOptions.gameMode == CustomGamemodes.HideNSeek || TORMapOptions.gameMode == CustomGamemodes.PropHunt) + if (MapOptions.gameMode == CustomGamemodes.HideNSeek || MapOptions.gameMode == CustomGamemodes.PropHunt) { - var impCount = TORMapOptions.gameMode == CustomGamemodes.HideNSeek + var impCount = MapOptions.gameMode == CustomGamemodes.HideNSeek ? Mathf.RoundToInt(CustomOptionHolder.hideNSeekHunterCount.getFloat()) : CustomOptionHolder.propHuntNumberOfHunters.getQuantity(); __result = impCount; @@ -48,9 +48,9 @@ internal class GameOptionsDataValidatePatch { public static void Postfix(GameOptionsData __instance) { - if (TORMapOptions.gameMode == CustomGamemodes.HideNSeek || + if (MapOptions.gameMode == CustomGamemodes.HideNSeek || GameOptionsManager.Instance.CurrentGameOptions.GameMode != GameModes.Normal) return; - if (TORMapOptions.gameMode == CustomGamemodes.PropHunt) + if (MapOptions.gameMode == CustomGamemodes.PropHunt) __instance.NumImpostors = CustomOptionHolder.propHuntNumberOfHunters.getQuantity(); __instance.NumImpostors = GameOptionsManager.Instance.CurrentGameOptions.NumImpostors; } @@ -65,7 +65,7 @@ internal class RoleManagerSelectRolesPatch //private static bool isEvilGuesser; private static readonly List> playerRoleMap = new(); - public static bool isGuesserGamemode => TORMapOptions.gameMode == CustomGamemodes.Guesser; + public static bool isGuesserGamemode => MapOptions.gameMode == CustomGamemodes.Guesser; public static void Postfix() { @@ -73,7 +73,7 @@ public static void Postfix() (byte)CustomRPC.ResetVaribles, SendOption.Reliable); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.resetVariables(); - if (TORMapOptions.gameMode == CustomGamemodes.HideNSeek || TORMapOptions.gameMode == CustomGamemodes.PropHunt || + if (MapOptions.gameMode == CustomGamemodes.HideNSeek || MapOptions.gameMode == CustomGamemodes.PropHunt || GameOptionsManager.Instance.currentGameOptions.GameMode == GameModes.HideNSeek) return; // Don't assign Roles in Hide N Seek if (CustomOptionHolder.activateRoles.getBool()) // Don't assign Roles in Tutorial or if deactivated diff --git a/TheOtherRoles/Patches/ShipStatusPatch.cs b/TheOtherRoles/Patches/ShipStatusPatch.cs index b513fc1e..7fa56b04 100644 --- a/TheOtherRoles/Patches/ShipStatusPatch.cs +++ b/TheOtherRoles/Patches/ShipStatusPatch.cs @@ -162,13 +162,13 @@ public static bool Prefix(ShipStatus __instance) originalNumShortTasksOption = GameOptionsManager.Instance.currentNormalGameOptions.NumShortTasks; originalNumLongTasksOption = GameOptionsManager.Instance.currentNormalGameOptions.NumLongTasks; - if (TORMapOptions.gameMode != CustomGamemodes.HideNSeek) + if (MapOptions.gameMode != CustomGamemodes.HideNSeek) { var commonTaskCount = __instance.CommonTasks.Count; var normalTaskCount = __instance.ShortTasks.Count; var longTaskCount = __instance.LongTasks.Count; - if (TORMapOptions.gameMode == CustomGamemodes.PropHunt) + if (MapOptions.gameMode == CustomGamemodes.PropHunt) commonTaskCount = normalTaskCount = longTaskCount = 0; diff --git a/TheOtherRoles/Patches/UpdatePatch.cs b/TheOtherRoles/Patches/UpdatePatch.cs index f5746e34..48e56607 100644 --- a/TheOtherRoles/Patches/UpdatePatch.cs +++ b/TheOtherRoles/Patches/UpdatePatch.cs @@ -341,7 +341,7 @@ private static void setNameTags() } // Display lighter / darker color for all alive players - if (CachedPlayer.LocalPlayer != null && MeetingHud.Instance != null && TORMapOptions.showLighterDarker) + if (CachedPlayer.LocalPlayer != null && MeetingHud.Instance != null && MapOptions.showLighterDarker) foreach (var player in MeetingHud.Instance.playerStates) { var target = Helpers.playerById(player.TargetPlayerId); @@ -459,8 +459,8 @@ private static void updateUseButton(HudManager __instance) private static void updateSabotageButton(HudManager __instance) { - if (MeetingHud.Instance || TORMapOptions.gameMode == CustomGamemodes.HideNSeek || - TORMapOptions.gameMode == CustomGamemodes.PropHunt) __instance.SabotageButton.Hide(); + if (MeetingHud.Instance || MapOptions.gameMode == CustomGamemodes.HideNSeek || + MapOptions.gameMode == CustomGamemodes.PropHunt) __instance.SabotageButton.Hide(); } private static void updateMapButton(HudManager __instance) diff --git a/TheOtherRoles/Patches/UsablesPatch.cs b/TheOtherRoles/Patches/UsablesPatch.cs index 187c4a26..3a8344e2 100644 --- a/TheOtherRoles/Patches/UsablesPatch.cs +++ b/TheOtherRoles/Patches/UsablesPatch.cs @@ -10,7 +10,7 @@ using UnityEngine; using static TheOtherRoles.GameHistory; using static TheOtherRoles.TheOtherRoles; -using static TheOtherRoles.TORMapOptions; +using static TheOtherRoles.MapOptions; using Object = UnityEngine.Object; using Random = UnityEngine.Random; @@ -367,9 +367,9 @@ public static bool Prefix(SabotageButton __instance) //MapOptionsTor.Mode = MapOptionsTor.Modes.Sabotage; //DestroyableSingleton.Instance.ToggleMapVisible(DestroyableSingleton.Instance.Modes.Sabotage); - DestroyableSingleton.Instance.ToggleMapVisible(new MapOptions + DestroyableSingleton.Instance.ToggleMapVisible(new global::MapOptions { - Mode = MapOptions.Modes.Sabotage + Mode = global::MapOptions.Modes.Sabotage }); return false; diff --git a/TheOtherRoles/Patches/VitalsPatch.cs b/TheOtherRoles/Patches/VitalsPatch.cs index b23233eb..c7cb48a6 100644 --- a/TheOtherRoles/Patches/VitalsPatch.cs +++ b/TheOtherRoles/Patches/VitalsPatch.cs @@ -30,7 +30,7 @@ public static void ResetData() private static void UseVitalsTime() { // Don't waste network traffic if we're out of time. - if (TORMapOptions.restrictDevices > 0 && TORMapOptions.restrictVitalsTime > 0f && + if (MapOptions.restrictDevices > 0 && MapOptions.restrictVitalsTime > 0f && CachedPlayer.LocalPlayer.PlayerControl.isAlive() && CachedPlayer.LocalPlayer.PlayerControl != Hacker.hacker) { var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, @@ -75,7 +75,7 @@ private static bool Prefix(VitalsMinigame __instance) if (vitalsTimer > 0.1f) UseVitalsTime(); - if (TORMapOptions.restrictDevices > 0) + if (MapOptions.restrictDevices > 0) { if (TimeRemaining == null) { @@ -87,14 +87,14 @@ private static bool Prefix(VitalsMinigame __instance) TimeRemaining.color = Palette.White; } - if (TORMapOptions.restrictVitalsTime <= 0f && CachedPlayer.LocalPlayer.PlayerControl != Hacker.hacker && + if (MapOptions.restrictVitalsTime <= 0f && CachedPlayer.LocalPlayer.PlayerControl != Hacker.hacker && !CachedPlayer.LocalPlayer.Data.IsDead) { __instance.Close(); return false; } - var timeString = TimeSpan.FromSeconds(TORMapOptions.restrictVitalsTime).ToString(@"mm\:ss\.ff"); + var timeString = TimeSpan.FromSeconds(MapOptions.restrictVitalsTime).ToString(@"mm\:ss\.ff"); TimeRemaining.text = string.Format("Remaining: {0}", timeString); TimeRemaining.gameObject.SetActive(true); } diff --git a/TheOtherRoles/RPC.cs b/TheOtherRoles/RPC.cs index aedc6cd6..2d009320 100644 --- a/TheOtherRoles/RPC.cs +++ b/TheOtherRoles/RPC.cs @@ -19,7 +19,7 @@ using static TheOtherRoles.GameHistory; using static TheOtherRoles.HudManagerStartPatch; using static TheOtherRoles.TheOtherRoles; -using static TheOtherRoles.TORMapOptions; +using static TheOtherRoles.MapOptions; using Object = UnityEngine.Object; namespace TheOtherRoles; @@ -2871,8 +2871,7 @@ private static void GetRpcNames() private static void Postfix([HarmonyArgument(0)] byte callId, [HarmonyArgument(1)] MessageReader reader) { var packetId = (CustomRPC)callId; - if (RpcNames!.ContainsKey(packetId)) - return; + if (RpcNames!.ContainsKey(packetId)) return; if (enableDebugLogMode) Info($"接收 PlayerControl 原版Rpc RpcId{callId} Message Size {reader.Length}"); } diff --git a/TheOtherRoles/Resources/stringData.json b/TheOtherRoles/Resources/stringData.json index a760b525..d313ad2b 100644 --- a/TheOtherRoles/Resources/stringData.json +++ b/TheOtherRoles/Resources/stringData.json @@ -45,8 +45,8 @@ "13": " \u7279\u522b\u611f\u8c22\uff1a\u5584\u826f\u7684\u597d\u4eba & \u5929\u5bf8\u68a6\u521d & Imp11" }, "creditsString1": { - "0": "TheOtherUs-Edited Team:\nmxyx Huier-Huang haoren\nImp2 FangKuaiYa\n\nFormer TheOtherUs Team Members:\nSpexGH Xer FangKuaiYa mxyx Huier-Huang\n\nThanks to The Other Roles, The Other Roles CE, The Other Roles GM IA, Town of Us, Stellar Roles!\n\nThanks to miniduikboot & GD for hosting modded servers (and so much more)\n\n", - "13": "TheOtherUs-Edited \u5f00\u53d1\u8005:\n\u6cab\u590f\u60a0\u8f69 \u5929\u5bf8\u68a6\u521d \u5584\u826f\u7684\u597d\u4eba Imp11\n\n\u7f8e\u5de5:\n\u65b9\u5757\n\n\u7ffb\u8bd1:\nEN\uff1a\u4e5d\u5934\u86c7\nCN\uff1a\u6cab\u590f\u60a0\u8f69\n\nGitHub\u8d21\u732e\u8005:\n\u6cab\u590f\u60a0\u8f69 \u5929\u5bf8\u68a6\u521d Imp11\n\n\u524d TheOtherUs \u5f00\u53d1\u8005:\nSpexGH Xer \u65b9\u5757 \u6cab\u590f\u60a0\u8f69 \u5929\u5bf8\u68a6\u521d\n\n\n\u672c\u6a21\u7ec4\u4f7f\u7528\u4e86\u90e8\u5206[https://github.com/dabao40/TheOtherRolesGMIA]TheOtherRolesGMIA[]\u7684\u4ee3\u7801\uff0c\u611f\u8c22Imp11\u7684\u652f\u6301\uff01\n\nThanks to The Other Roles, The Other Roles CE, The Other Roles GM IA, Town of Us, Stellar Roles!\n\nThanks to miniduikboot & GD for hosting modded servers (and so much more)\n" + "0": "TheOtherUs-Edited Team:\nmxyx Huier-Huang haoren\nImp2 FangKuaiYa\n\nThanks to The Other Roles, The Other Roles CE, The Other Roles GM IA, Town of Us, Stellar Roles, SuperNewRoles!\n\nThanks to miniduikboot & GD for hosting modded servers (and so much more)\n\n", + "13": "TheOtherUs-Edited \u5f00\u53d1\u8005:\n\u6cab\u590f\u60a0\u8f69 \u5929\u5bf8\u68a6\u521d \u5584\u826f\u7684\u597d\u4eba Imp11\n\n\u7f8e\u5de5:\n\u65b9\u5757\n\n\u7ffb\u8bd1:\nEN\uff1a\u4e5d\u5934\u86c7\nCN\uff1a\u6cab\u590f\u60a0\u8f69\n\nGitHub\u8d21\u732e\u8005:\n\u6cab\u590f\u60a0\u8f69 \u5929\u5bf8\u68a6\u521d Imp11\n\n\u672c\u6a21\u7ec4\u4f7f\u7528\u4e86\u90e8\u5206[https://github.com/dabao40/TheOtherRolesGMIA]TheOtherRolesGMIA[]\u7684\u4ee3\u7801\uff0c\u611f\u8c22Imp11\u7684\u652f\u6301\uff01\n\nThanks to The Other Roles, The Other Roles CE, The Other Roles GM IA, Town of Us, Stellar Roles , SuperNewRoles!\n\nThanks to miniduikboot & GD for hosting modded servers (and so much more)\n" }, "TORMapOptionsButtonText": { "0": "Mod Options...", diff --git a/TheOtherRoles/RoleInfo.cs b/TheOtherRoles/RoleInfo.cs index 640921f5..f1a6de5c 100644 --- a/TheOtherRoles/RoleInfo.cs +++ b/TheOtherRoles/RoleInfo.cs @@ -348,13 +348,13 @@ public static List getRoleInfoForPlayer(PlayerControl p, bool showModi if (infos.Count == count) { if (p.Data.Role.IsImpostor) - infos.Add(TORMapOptions.gameMode == CustomGamemodes.HideNSeek || - TORMapOptions.gameMode == CustomGamemodes.PropHunt + infos.Add(MapOptions.gameMode == CustomGamemodes.HideNSeek || + MapOptions.gameMode == CustomGamemodes.PropHunt ? hunter : impostor); else - infos.Add(TORMapOptions.gameMode == CustomGamemodes.HideNSeek ? hunted : - TORMapOptions.gameMode == CustomGamemodes.PropHunt ? prop : crewmate); + infos.Add(MapOptions.gameMode == CustomGamemodes.HideNSeek ? hunted : + MapOptions.gameMode == CustomGamemodes.PropHunt ? prop : crewmate); } return infos; @@ -365,8 +365,7 @@ public static string GetRolesString(PlayerControl p, bool useColors, bool showMo { string roleName; roleName = string.Join(" ", - getRoleInfoForPlayer(p, showModifier).Select(x => useColors ? Helpers.cs(x.color, x.name) : x.name) - .ToArray()); + getRoleInfoForPlayer(p, showModifier).Select(x => useColors ? Helpers.cs(x.color, x.name) : x.name).ToArray()); if (Lawyer.target != null && p.PlayerId == Lawyer.target.PlayerId && CachedPlayer.LocalPlayer.PlayerControl != Lawyer.target) roleName += useColors ? Helpers.cs(Pursuer.color, " §") : " §"; @@ -378,10 +377,8 @@ public static string GetRolesString(PlayerControl p, bool useColors, bool showMo (CachedPlayer.LocalPlayer.PlayerControl == Shifter.shifter || Helpers.shouldShowGhostInfo()) && Shifter.futureShift != null) roleName += Helpers.cs(Color.yellow, " ← " + Shifter.futureShift.Data.PlayerName); - if (p == Vulture.vulture && (CachedPlayer.LocalPlayer.PlayerControl == Vulture.vulture || - Helpers.shouldShowGhostInfo())) - roleName = roleName + Helpers.cs(Vulture.color, - $" (剩余 {Vulture.vultureNumberToWin - Vulture.eatenBodies} )"); + if (p == Vulture.vulture && (CachedPlayer.LocalPlayer.PlayerControl == Vulture.vulture || Helpers.shouldShowGhostInfo())) + roleName += Helpers.cs(Vulture.color, $" (剩余 {Vulture.vultureNumberToWin - Vulture.eatenBodies} )"); if (Helpers.shouldShowGhostInfo()) { if (Eraser.futureErased.Contains(p)) @@ -406,7 +403,7 @@ public static string GetRolesString(PlayerControl p, bool useColors, bool showMo if (Arsonist.dousedPlayers.Contains(p)) roleName = Helpers.cs(Arsonist.color, "♨ ") + roleName; if (p == Arsonist.arsonist) - roleName = roleName + Helpers.cs(Arsonist.color, + roleName += Helpers.cs(Arsonist.color, $" (剩余 {CachedPlayer.AllPlayers.Count(x => { return x.PlayerControl != Arsonist.arsonist && !x.Data.IsDead && !x.Data.Disconnected && !Arsonist.dousedPlayers.Any(y => y.PlayerId == x.PlayerId); })} )"); if (p == Jackal.fakeSidekick) roleName = Helpers.cs(Sidekick.color, " (假跟班) ") + roleName; @@ -432,6 +429,21 @@ public static string GetRolesString(PlayerControl p, bool useColors, bool showMo case DeadPlayer.CustomDeathReason.Disconnect: deathReasonString = " - 断开连接"; break; + case DeadPlayer.CustomDeathReason.SheriffKill: + deathReasonString = $" - 出警 {Helpers.cs(killerColor, deadPlayer.killerIfExisting.Data.PlayerName)}"; + break; + case DeadPlayer.CustomDeathReason.SheriffMisfire: + deathReasonString = " - 走火"; + break; + case DeadPlayer.CustomDeathReason.SheriffMisadventure: + deathReasonString = $" - 被误杀于 {Helpers.cs(killerColor, deadPlayer.killerIfExisting.Data.PlayerName)}"; + break; + case DeadPlayer.CustomDeathReason.Suicide: + deathReasonString = " - 自杀"; + break; + case DeadPlayer.CustomDeathReason.BombVictim: + deathReasonString = " - 恐袭"; + break; case DeadPlayer.CustomDeathReason.Exile: deathReasonString = " - 被驱逐"; break; diff --git a/TheOtherRoles/SoundEffectsManager.cs b/TheOtherRoles/SoundEffectsManager.cs index 624a1684..6a960c74 100644 --- a/TheOtherRoles/SoundEffectsManager.cs +++ b/TheOtherRoles/SoundEffectsManager.cs @@ -34,7 +34,7 @@ public static AudioClip get(string path) public static void play(string path, float volume = 0.8f, bool loop = false) { - if (!TORMapOptions.enableSoundEffects) return; + if (!MapOptions.enableSoundEffects) return; var clipToPlay = get(path); stop(path); if (Constants.ShouldPlaySfx() && clipToPlay != null) @@ -47,7 +47,7 @@ public static void play(string path, float volume = 0.8f, bool loop = false) public static void playAtPosition(string path, Vector2 position, float maxDuration = 15f, float range = 5f, bool loop = false) { - if (!TORMapOptions.enableSoundEffects || !Constants.ShouldPlaySfx()) return; + if (!MapOptions.enableSoundEffects || !Constants.ShouldPlaySfx()) return; var clipToPlay = get(path); var source = SoundManager.Instance.PlaySound(clipToPlay, false); diff --git a/TheOtherRoles/TheOtherRoles.cs b/TheOtherRoles/TheOtherRoles.cs index 3cc5a63e..3923b67f 100644 --- a/TheOtherRoles/TheOtherRoles.cs +++ b/TheOtherRoles/TheOtherRoles.cs @@ -2151,7 +2151,7 @@ public static void clearAndReload() douseTarget = null; triggerArsonistWin = false; dousedPlayers = new List(); - foreach (var p in TORMapOptions.playerIcons.Values) + foreach (var p in MapOptions.playerIcons.Values) if (p != null && p.gameObject != null) p.gameObject.SetActive(false); cooldown = CustomOptionHolder.arsonistCooldown.getFloat(); @@ -2301,7 +2301,7 @@ public static void clearAndReload() arrow = null; if (cooldownText != null && cooldownText.gameObject != null) Object.Destroy(cooldownText.gameObject); cooldownText = null; - foreach (var p in TORMapOptions.playerIcons.Values) + foreach (var p in MapOptions.playerIcons.Values) if (p != null && p.gameObject != null) p.gameObject.SetActive(false); diff --git a/TheOtherRoles/Utilities/GithubUtils.cs b/TheOtherRoles/Utilities/GithubUtils.cs deleted file mode 100644 index 3cbad59c..00000000 --- a/TheOtherRoles/Utilities/GithubUtils.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace TheOtherRoles.Utilities; - -public static class GithubUtils -{ - public static bool IsCN() => (int)AmongUs.Data.DataManager.Settings.Language.CurrentLanguage == 13; - - public static string GithubUrl(this string url) - { - if (IsCN() && !url.Contains("github.moeyy.xyz")) - { - if (url.Contains("github.com")) - { - return url.Replace("https://github.com", "https://github.moeyy.xyz/https://github.com"); - } - - if (url.Contains("raw.githubusercontent.com")) - { - return url.Replace("https://raw.githubusercontent.com", "https://github.moeyy.xyz/https://raw.githubusercontent.com"); - } - } - Info("Rewrite URL" + url); - return url; - } -} \ No newline at end of file diff --git a/TheOtherRoles/Utilities/HandleGuesser.cs b/TheOtherRoles/Utilities/HandleGuesser.cs index cb582e88..26747a49 100644 --- a/TheOtherRoles/Utilities/HandleGuesser.cs +++ b/TheOtherRoles/Utilities/HandleGuesser.cs @@ -39,7 +39,7 @@ public static void clearAndReload() { Guesser.clearAndReload(); GuesserGM.clearAndReload(); - isGuesserGm = TORMapOptions.gameMode == CustomGamemodes.Guesser; + isGuesserGm = MapOptions.gameMode == CustomGamemodes.Guesser; if (isGuesserGm) { guesserCantGuessSnitch = CustomOptionHolder.guesserGamemodeCantGuessSnitchIfTaksDone.getBool();