From bedb16d1a18aa1eba62a9199dcd11ff94020d7a7 Mon Sep 17 00:00:00 2001 From: Gurge44 Date: Fri, 9 Oct 2026 09:11:27 +0200 Subject: [PATCH] few fixes --- Gamemodes/Deathrace.cs | 11 ++++++++++- Main.cs | 4 ++-- Patches/ChatControlPatch.cs | 9 ++++++++- Patches/HudPatch.cs | 15 ++++++--------- Patches/MeetingHudPatch.cs | 7 ++++--- Patches/TextBoxPatch.cs | 19 +++++++++++++------ Roles/Standard/Impostor/Madmate/Hypocrite.cs | 7 ++++++- 7 files changed, 49 insertions(+), 23 deletions(-) diff --git a/Gamemodes/Deathrace.cs b/Gamemodes/Deathrace.cs index aff122705..a3b58ecc8 100644 --- a/Gamemodes/Deathrace.cs +++ b/Gamemodes/Deathrace.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using AmongUs.GameOptions; using EHR.Modules; @@ -510,6 +511,8 @@ public static class Deathrace public static class FixedUpdatePatch { + private static Stopwatch NotifyTimer = new(); + public static void Postfix() { if (!AmongUsClient.Instance.AmHost || !GameGoing || GameStates.IsEnded) return; @@ -612,6 +615,12 @@ public static class Deathrace } Data.Remove(removeId); + + if (NotifyTimer.Elapsed.TotalSeconds >= 1) + { + NotifyTimer.Reset(); + Utils.NotifyRoles(); + } } private static void CheckAndNotify(PlayerData data) @@ -620,7 +629,7 @@ public static class Deathrace if (data.LastSuffix != suffix) { - Utils.NotifyRoles(SpecifySeer: data.Player, SpecifyTarget: data.Player); + NotifyTimer.Start(); data.LastSuffix = suffix; } } diff --git a/Main.cs b/Main.cs index db11dcafb..0d5f0c194 100644 --- a/Main.cs +++ b/Main.cs @@ -53,8 +53,8 @@ public class Main : BaseUnityPlugin private const string DebugKeyHash = "c0fd562955ba56af3ae20d7ec9e64c664f0facecef4b3e366e109306adeae29d"; private const string DebugKeySalt = "59687b"; public const string PluginGuid = "com.gurge44.endlesshostroles"; - public const string PluginVersion = "8.0.2"; - public const string PluginDisplayVersion = "8.0.2"; + public const string PluginVersion = "8.0.3"; + public const string PluginDisplayVersion = "8.0.3"; public const int TestBuildNumber = 0; // 0 = Release public const string NeutralColor = "#ffab1b"; diff --git a/Patches/ChatControlPatch.cs b/Patches/ChatControlPatch.cs index c61a3537c..677d5f70b 100644 --- a/Patches/ChatControlPatch.cs +++ b/Patches/ChatControlPatch.cs @@ -1,5 +1,7 @@ using System; +#if !IL2CPP using System.Collections; +#endif using System.Collections.Generic; using System.Linq; using AmongUs.Data; @@ -15,9 +17,11 @@ namespace EHR; [HarmonyPatch(typeof(ChatController), nameof(ChatController.Awake))] static class ChatControllerAwakePatch { +#if !IL2CPP private static SpriteRenderer QuickChatIcon; private static SpriteRenderer OpenBanMenuIcon; private static SpriteRenderer OpenKeyboardIcon; +#endif public static readonly Color32 DarkBackgroundColor = new(40, 40, 40, byte.MaxValue); @@ -36,6 +40,7 @@ static class ChatControllerAwakePatch chatBubble.TextArea.color = Color.white; chatBubble.Background.color = new(0.1f, 0.1f, 0.1f, 1f); +#if !IL2CPP __instance.freeChatField.background.color = DarkBackgroundColor; if (!TextBoxPatch.IsInvalidCommand) @@ -48,10 +53,11 @@ static class ChatControllerAwakePatch __instance.quickChatField.text.color = Color.white; Main.Instance.StartCoroutine(Coroutine()); +#endif } else __instance.freeChatField.textArea.outputText.color = Color.black; - +#if !IL2CPP return; IEnumerator Coroutine() @@ -81,6 +87,7 @@ static class ChatControllerAwakePatch yield return null; } } +#endif } } diff --git a/Patches/HudPatch.cs b/Patches/HudPatch.cs index 1b36ce834..ff3a2b11d 100644 --- a/Patches/HudPatch.cs +++ b/Patches/HudPatch.cs @@ -959,7 +959,9 @@ internal static class MapRoomDoorsStartPatch } } } +#if !IL2CPP [HarmonyPatch(typeof(MapRoom), nameof(MapRoom.DoorsUpdate))] +#endif internal static class MapRoomDoorsUpdatePatch { public static Dictionary DoorTimerTexts = []; @@ -1002,16 +1004,11 @@ internal static class MapRoomDoorsUpdatePatch goto Skip; } - foreach (OpenableDoor door in shipStatusInstance.AllDoors) + if (AutoOpenDoors.TryGetValue(room, out AutoOpenDoor autoOpenDoor) && autoOpenDoor) { - if (door.Room != room) continue; - - if (AutoOpenDoors.TryGetValue(room, out AutoOpenDoor autoOpenDoor) && autoOpenDoor) - { - total = 30f; - timer = autoOpenDoor.CooldownTimer; - goto Skip; - } + total = 30f; + timer = autoOpenDoor.CooldownTimer; + goto Skip; } } diff --git a/Patches/MeetingHudPatch.cs b/Patches/MeetingHudPatch.cs index bee1ca538..050ed5f02 100644 --- a/Patches/MeetingHudPatch.cs +++ b/Patches/MeetingHudPatch.cs @@ -1384,9 +1384,10 @@ internal static class MeetingHudOnDestroyPatch try { - foreach (PlayerControl pc in Main.CachedAlivePlayerControls()) - if (pc.Is(CustomRoles.Evader)) - pc.RpcMakeInvisible(); + if (CheckForEndVotingPatch.CommsWasCalled || Utils.IsAnySabotageActive()) + foreach (PlayerControl pc in Main.CachedAlivePlayerControls()) + if (pc.Is(CustomRoles.Evader)) + pc.RpcMakeInvisible(); } catch (Exception e) { Utils.ThrowException(e); } diff --git a/Patches/TextBoxPatch.cs b/Patches/TextBoxPatch.cs index ece844d0b..ff436da8d 100644 --- a/Patches/TextBoxPatch.cs +++ b/Patches/TextBoxPatch.cs @@ -58,9 +58,7 @@ public static class TextBoxPatch { Destroy(); IsInvalidCommand = false; - Color textColor = Main.DarkTheme.Value ? Color.white : Color.black; - __instance.compoText.Color(textColor); - __instance.outputText.color = textColor; + ResetTextColor(__instance); return; } @@ -126,9 +124,7 @@ public static class TextBoxPatch if (IsInvalidCommand) { IsInvalidCommand = false; - Color textColor = Main.DarkTheme.Value ? Color.white : Color.black; - __instance.compoText.Color(textColor); - __instance.outputText.color = textColor; + ResetTextColor(__instance); } HudManager hud = HudManager.Instance; @@ -300,6 +296,17 @@ public static class TextBoxPatch } } + private static void ResetTextColor(TextBoxTMP __instance) + { +#if IL2CPP + Color textColor = Color.black; +#else + Color textColor = Main.DarkTheme.Value ? Color.white : Color.black; +#endif + __instance.compoText.Color(textColor); + __instance.outputText.color = textColor; + } + public static void OnTabPress(ChatController __instance) { if (!PlaceHolderText || PlaceHolderText.text == "") return; diff --git a/Roles/Standard/Impostor/Madmate/Hypocrite.cs b/Roles/Standard/Impostor/Madmate/Hypocrite.cs index 0c6a85386..be44843fa 100644 --- a/Roles/Standard/Impostor/Madmate/Hypocrite.cs +++ b/Roles/Standard/Impostor/Madmate/Hypocrite.cs @@ -36,6 +36,11 @@ public class Hypocrite : RoleBase HypocritePC = playerId.GetPlayer(); } + public override bool CanUseKillButton(PlayerControl pc) + { + return false; + } + public override void OnTaskComplete(PlayerControl pc, int completedTaskCount, int totalTaskCount) { if (!pc.IsAlive()) return; @@ -63,7 +68,7 @@ public class Hypocrite : RoleBase public override string GetSuffix(PlayerControl seer, PlayerControl target, bool hud = false, bool meeting = false) { - if (seer.PlayerId != target.PlayerId || hud || seer.Is(Team.Impostor) || meeting || HypocritePC == null || !HypocritePC.IsAlive() || !seer.IsAlive()) return string.Empty; + if (seer.PlayerId != target.PlayerId || hud || seer.Is(Team.Impostor) || meeting || !HypocritePC || !HypocritePC.IsAlive() || !seer.IsAlive()) return string.Empty; TaskState ts = HypocritePC.GetTaskState(); if (!NonImpGetsNotifyWhenLowTasks.GetBool() || ts.RemainingTasksCount > NotifyAtXTasksLeft.GetInt()) return string.Empty;