From 5e83369480399571aa6a0a8a60580c4db7521330 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Tue, 28 Oct 2025 18:13:28 -0500 Subject: [PATCH 1/3] FIx chat --- Helpers/Utils.cs | 1 - Patches/Gameplay/UI/Chat/ChatPatch.cs | 22 ++++++++-------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Helpers/Utils.cs b/Helpers/Utils.cs index 8a8a71b..abca6fa 100644 --- a/Helpers/Utils.cs +++ b/Helpers/Utils.cs @@ -155,7 +155,6 @@ internal static class Utils } SoundManager.Instance.PlaySound(chat.messageSound, false, 1f, null).pitch = 0.5f + data.PlayerId / 15f; - ChatPatch.ChatControllerPatch.SetChatPoolTheme(pooledBubble); } catch { diff --git a/Patches/Gameplay/UI/Chat/ChatPatch.cs b/Patches/Gameplay/UI/Chat/ChatPatch.cs index 15396b1..c9dc547 100644 --- a/Patches/Gameplay/UI/Chat/ChatPatch.cs +++ b/Patches/Gameplay/UI/Chat/ChatPatch.cs @@ -124,8 +124,10 @@ internal static class ChatPatch [HarmonyPatch(nameof(ChatController.SetChatBubbleName))] [HarmonyPostfix] - private static void SetChatBubbleName_Postfix(ChatController __instance, ChatBubble bubble, NetworkedPlayerInfo playerInfo) + private static void SetChatBubbleName_Postfix(ChatController __instance, ChatBubble bubble, NetworkedPlayerInfo playerInfo, bool isDead, bool didVote) { + if (didVote) return; + StringBuilder sbTag = new(); StringBuilder sbInfo = new(); @@ -196,21 +198,13 @@ internal static class ChatPatch } bubble.NameText.SetText(playerName); - SetChatPoolTheme(bubble); } - [HarmonyPatch(nameof(ChatController.AddChatNote))] + [HarmonyPatch(nameof(ChatController.GetPooledBubble))] [HarmonyPostfix] - private static void AddChatNote_Postfix(ChatController __instance) + private static void GetPooledBubble_Postfix(ChatController __instance, ChatBubble __result) { - SetChatPoolTheme(); - } - - [HarmonyPatch(nameof(ChatController.AddChatWarning))] - [HarmonyPostfix] - private static void AddChatWarning_Postfix(ChatController __instance) - { - SetChatPoolTheme(); + SetChatPoolTheme(__result); } internal static void SetChatTheme() @@ -245,9 +239,9 @@ internal static class ChatPatch } // Set chat theme - internal static ChatBubble SetChatPoolTheme(ChatBubble? asChatBubble = null) + internal static ChatBubble SetChatPoolTheme(ChatBubble asChatBubble) { - ChatBubble chatBubble = asChatBubble ?? HudManager.Instance.Chat.GetPooledBubble(); + ChatBubble chatBubble = asChatBubble; if (BAUPlugin.ChatDarkMode.Value) { From 70902112f5ce2181ce0cca97fde7e8ea9d6a52d6 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Tue, 28 Oct 2025 18:13:49 -0500 Subject: [PATCH 2/3] Update mod info --- ModInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ModInfo.cs b/ModInfo.cs index eeb85bb..614937a 100644 --- a/ModInfo.cs +++ b/ModInfo.cs @@ -4,7 +4,7 @@ internal static class ModInfo { internal static readonly ReleaseTypes ReleaseBuildType = ReleaseTypes.Release; internal const string BetaNum = "0"; - internal const string HotfixNum = "2"; + internal const string HotfixNum = "3"; internal const bool IsHotFix = true; internal const string PluginName = "BetterAmongUs"; internal const string PluginGuid = "com.d1gq.betteramongus"; From c815985cf1df348d9957ab0dc452fb35bb2d78d0 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Tue, 28 Oct 2025 18:18:24 -0500 Subject: [PATCH 3/3] try to fix null ref --- Helpers/Utils.cs | 2 +- Mono/PlayerInfoDisplay.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Helpers/Utils.cs b/Helpers/Utils.cs index abca6fa..aeaa512 100644 --- a/Helpers/Utils.cs +++ b/Helpers/Utils.cs @@ -369,7 +369,7 @@ internal static class Utils // Platform utilities internal static string GetPlatformName(PlayerControl player, bool useTag = false) { - if (player?.GetClient() == null) return string.Empty; + if (player?.GetClient()?.PlatformData == null) return string.Empty; return GetPlatformName(player.GetClient().PlatformData.Platform, useTag); } diff --git a/Mono/PlayerInfoDisplay.cs b/Mono/PlayerInfoDisplay.cs index 02c8592..a3d3c51 100644 --- a/Mono/PlayerInfoDisplay.cs +++ b/Mono/PlayerInfoDisplay.cs @@ -183,7 +183,7 @@ internal class PlayerInfoDisplay : MonoBehaviour string newText = Utils.FormatInfo(sb); if (newText != lastValue) { - textMesh.SetText(newText); + textMesh?.SetText(newText); lastValue = newText; } }