From b8532d4e97903a61e0b604e370788092aab3a1bf Mon Sep 17 00:00:00 2001 From: Gurge44 Date: Sun, 28 Sep 2025 10:57:49 +0200 Subject: [PATCH] major fix --- EHR.csproj | 4 ++-- Main.cs | 4 ++-- Modules/OptionHolder.cs | 3 ++- Modules/RPC.cs | 21 ++++++++++++--------- Patches/PlayerControlPatch.cs | 25 ++++++++++++++++--------- Roles/Impostor/Venerer.cs | 3 +-- 6 files changed, 35 insertions(+), 25 deletions(-) diff --git a/EHR.csproj b/EHR.csproj index 33a41880e..1c35a2e4d 100644 --- a/EHR.csproj +++ b/EHR.csproj @@ -8,8 +8,8 @@ EHR Gurge44 preview - D:\SteamLibrary\steamapps\common\Among Us - + + C:\Program Files\Epic Games\AmongUs true True $(MSBuildProjectName) diff --git a/Main.cs b/Main.cs index 1366ed1e8..973e51ce6 100644 --- a/Main.cs +++ b/Main.cs @@ -42,8 +42,8 @@ public class Main : BasePlugin private const string DebugKeyHash = "c0fd562955ba56af3ae20d7ec9e64c664f0facecef4b3e366e109306adeae29d"; private const string DebugKeySalt = "59687b"; private const string PluginGuid = "com.gurge44.endlesshostroles"; - public const string PluginVersion = "6.4.1"; - public const string PluginDisplayVersion = "6.4.1"; + public const string PluginVersion = "6.4.2"; + public const string PluginDisplayVersion = "6.4.2"; public const bool TestBuild = false; public const string NeutralColor = "#ffab1b"; diff --git a/Modules/OptionHolder.cs b/Modules/OptionHolder.cs index 986c91e87..388050204 100644 --- a/Modules/OptionHolder.cs +++ b/Modules/OptionHolder.cs @@ -66,6 +66,7 @@ public static class Options public static Dictionary GroupedOptions = []; public static Dictionary> GroupedAddons = []; + public static OptionItem Preset; public static OptionItem GameMode; private static readonly string[] GameModes = @@ -1266,7 +1267,7 @@ public static class Options int defaultPresetNumber = OptionSaver.GetDefaultPresetNumber(); - _ = new PresetOptionItem(defaultPresetNumber, TabGroup.SystemSettings) + Preset = new PresetOptionItem(defaultPresetNumber, TabGroup.SystemSettings) .SetColor(new Color32(255, 235, 4, byte.MaxValue)) .SetHidden(true); diff --git a/Modules/RPC.cs b/Modules/RPC.cs index 7dc84054a..7ccd77ae1 100644 --- a/Modules/RPC.cs +++ b/Modules/RPC.cs @@ -455,17 +455,18 @@ internal static class RPCHandlerPatch if (AmongUsClient.Instance.AmHost) break; int startIndex = reader.ReadPackedInt32(); + + if (startIndex == 2) + { + Options.Preset.SetValue(9); + Options.GameMode.SetValue(reader.ReadPackedInt32()); + } for (int i = startIndex; i < OptionItem.AllOptions.Count; ++i) { if (reader.BytesRemaining == 0) break; var option = OptionItem.AllOptions[i]; - - if (option.Id == 0) - { - option.SetValue(9); - continue; - } + if (option is TextOptionItem) continue; option.SetValue(reader.ReadPackedInt32()); } @@ -1352,13 +1353,15 @@ internal static class RPC if (!AmongUsClient.Instance.AmHost || PlayerControl.AllPlayerControls.Count <= 1) return; - Logger.Msg(" Starting from 0", "SyncCustomSettings"); + Logger.Msg(" Starting from 2", "SyncCustomSettings"); MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncCustomSettings, SendOption.Reliable, targetId); - writer.WritePacked(0); + writer.WritePacked(2); + writer.WritePacked(Options.GameMode.GetValue()); - for (int i = 0; i < OptionItem.AllOptions.Count; ++i) + for (int i = 2; i < OptionItem.AllOptions.Count; ++i) { var option = OptionItem.AllOptions[i]; + if (option is TextOptionItem) continue; if (writer.Length > 500) { diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index 38dcecc49..22707cab8 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -1687,16 +1687,20 @@ internal static class FixedUpdatePatch string roleText; + bool hideRoleText = false; if (Options.CurrentGameMode is not CustomGameMode.Standard and not CustomGameMode.HideAndSeek || !IsRoleTextEnabled(__instance)) + { roleText = string.Empty; + hideRoleText = true; + } else { (string, Color) roleTextData = GetRoleText(lpId, playerId, seeTargetBetrayalAddons: shouldSeeTargetAddons); roleText = ColorString(roleTextData.Item2, roleTextData.Item1); } - if (PlayerControl.LocalPlayer.IsAlive() && PlayerControl.LocalPlayer.IsRevealedPlayer(__instance) && __instance.Is(CustomRoles.Trickster)) + if (!hideRoleText && PlayerControl.LocalPlayer.IsAlive() && PlayerControl.LocalPlayer.IsRevealedPlayer(__instance) && __instance.Is(CustomRoles.Trickster)) { roleText = Farseer.RandomRole[lpId]; roleText += Farseer.GetTaskState(); @@ -1705,6 +1709,7 @@ internal static class FixedUpdatePatch if (!AmongUsClient.Instance.IsGameStarted && AmongUsClient.Instance.NetworkMode != NetworkModes.FreePlay) { roleText = string.Empty; + hideRoleText = true; if (!__instance.AmOwner) __instance.cosmetics.nameText.text = __instance?.Data?.PlayerName; } @@ -1715,7 +1720,7 @@ internal static class FixedUpdatePatch bool moveandstop = Options.CurrentGameMode == CustomGameMode.MoveAndStop; - if (Main.VisibleTasksCount) + if (!hideRoleText && Main.VisibleTasksCount) { if (moveandstop) roleText = roleText.Insert(0, progressText); else roleText += progressText; @@ -1960,18 +1965,20 @@ internal static class FixedUpdatePatch if (!self && Options.CurrentGameMode == CustomGameMode.KingOfTheZones && Main.IntroDestroyed && !KingOfTheZones.GameGoing) realName = EmptyMessage; - if (!Options.LargerRoleTextSize.GetBool()) - roleText = $"{roleText}\n"; + if (!hideRoleText) + { + if (!Options.LargerRoleTextSize.GetBool()) + roleText = $"{roleText}\n"; + else + roleText += "\n"; + } else - roleText += "\n"; + roleText = string.Empty; string newLineBeforeSuffix = !(Options.CurrentGameMode == CustomGameMode.BedWars && !self && GameStates.InGame) ? "\r\n" : " - "; string deathReason = !seer.IsAlive() && seer.KnowDeathReason(target) ? $"{newLineBeforeSuffix}『{ColorString(GetRoleColor(CustomRoles.Doctor), GetVitalText(target.PlayerId))}』" : string.Empty; - string currentText = target.cosmetics.nameText.text; - var changeTo = $"{roleText}{realName}{deathReason}{Mark}{newLineBeforeSuffix}{Suffix}"; - bool needUpdate = currentText != changeTo; - if (needUpdate) target.cosmetics.nameText.text = changeTo; + target.cosmetics.nameText.text = $"{roleText}{realName}{deathReason}{Mark}{newLineBeforeSuffix}{Suffix}"; } } diff --git a/Roles/Impostor/Venerer.cs b/Roles/Impostor/Venerer.cs index e83d6ed98..100b36318 100644 --- a/Roles/Impostor/Venerer.cs +++ b/Roles/Impostor/Venerer.cs @@ -88,8 +88,7 @@ public class Venerer : RoleBase switch (Stage) { case 1: - var o = pc.CurrentOutfit; - var outfit = new NetworkedPlayerInfo.PlayerOutfit().Set(o.PlayerName, o.ColorId, o.HatId, o.SkinId, o.VisorId, o.PetId, o.NamePlateId); + var outfit = Camouflage.PlayerSkins[pc.PlayerId]; Utils.RpcChangeSkin(pc, new NetworkedPlayerInfo.PlayerOutfit().Set("", 15, "", "", "", "", "")); ChangedSkin = true; LateTask.New(() =>