From 15d6f54982bbde2b1fe2d14586b4b9bbb9831711 Mon Sep 17 00:00:00 2001 From: Ape <155788660+ApeMV@users.noreply.github.com> Date: Mon, 2 Feb 2026 14:10:50 +0100 Subject: [PATCH] Better options, String fix, HnS fix --- AmongUsRevamped.csproj | 5 +++ Modules/Hotkeys.cs | 5 +++ Patches/DiscordPatch.cs | 8 ++--- Patches/IntroPatch.cs | 12 ++++++- Patches/NumberOptionsPatch.cs | 65 ++++++++++++++++++++++++++--------- Patches/OnGameStartedPatch.cs | 17 --------- Resources/Language/Strings.cs | 2 +- 7 files changed, 75 insertions(+), 39 deletions(-) diff --git a/AmongUsRevamped.csproj b/AmongUsRevamped.csproj index 179354f..863be0a 100644 --- a/AmongUsRevamped.csproj +++ b/AmongUsRevamped.csproj @@ -8,6 +8,11 @@ apemv true Release;Android + Release + + + + Release diff --git a/Modules/Hotkeys.cs b/Modules/Hotkeys.cs index fa58ae5..37cbe61 100644 --- a/Modules/Hotkeys.cs +++ b/Modules/Hotkeys.cs @@ -9,6 +9,7 @@ namespace AmongUsRevamped; [HarmonyPatch(typeof(ControllerManager), nameof(ControllerManager.Update))] internal class Hotkeys { + public static int IncrementMultiplier; public static void Postfix() { bool Shift = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift); @@ -52,6 +53,10 @@ internal class Hotkeys GameStartManager.Instance.ResetStartState(); Logger.SendInGame("Starting countdown canceled"); } + + if (Shift) IncrementMultiplier = 5; + else if (Ctrl) IncrementMultiplier = 10; + else IncrementMultiplier = 1; } } #endif \ No newline at end of file diff --git a/Patches/DiscordPatch.cs b/Patches/DiscordPatch.cs index ecf7a65..4734415 100644 --- a/Patches/DiscordPatch.cs +++ b/Patches/DiscordPatch.cs @@ -16,7 +16,7 @@ public class DiscordRPC { if (activity == null) return; - var details = $"AmongUsRevamped {Main.ModVersion}"; + var details = $"Revamped {Main.ModVersion}"; activity.Details = details; try @@ -31,10 +31,10 @@ public class DiscordRPC Region = Utils.GetRegionName(); } - if (Lobbycode != "" && Region != "") details = $"AmongUsRevamped - {Lobbycode} ({Region})"; + if (Lobbycode != "" && Region != "") details = $"Revamped - {Lobbycode} ({Region})"; } else - details = $"AmongUsRevamped {Main.ModVersion}"; + details = $"Revamped {Main.ModVersion}"; activity.Details = details; } @@ -43,7 +43,7 @@ public class DiscordRPC { Logger.Error("Error in updating discord rpc", "DiscordPatch"); Logger.Exception(ex, "DiscordPatch"); - details = $"AmongUsRevamped v{Main.ModVersion}"; + details = $"Revamped v{Main.ModVersion}"; activity.Details = details; } } diff --git a/Patches/IntroPatch.cs b/Patches/IntroPatch.cs index 424e47e..375e1e7 100644 --- a/Patches/IntroPatch.cs +++ b/Patches/IntroPatch.cs @@ -10,7 +10,7 @@ internal static class CoShowIntroPatch { public static void Postfix(IntroCutscene __instance) { - Logger.Info("Intro initiated", "d"); + Logger.Info("Intro initiated", "CoShowIntro"); if (!AmongUsClient.Instance.AmHost) return; @@ -24,5 +24,15 @@ internal static class CoShowIntroPatch { "Jester", $"{String.Jester}"}, { "Mayor", $"{String.Mayor}"} }); + + if (!Utils.isHideNSeek) return; + + foreach (var p in PlayerControl.AllPlayerControls) + { + if (p.Data.Role.TeamType == RoleTeamTypes.Impostor) + { + p.RpcSetRole(AmongUs.GameOptions.RoleTypes.Impostor, false); + } + } } } \ No newline at end of file diff --git a/Patches/NumberOptionsPatch.cs b/Patches/NumberOptionsPatch.cs index 5f3dcfd..ec7b53d 100644 --- a/Patches/NumberOptionsPatch.cs +++ b/Patches/NumberOptionsPatch.cs @@ -1,25 +1,32 @@ using AmongUs.GameOptions; +using UnityEngine; namespace AmongUsRevamped; // https://github.com/astra1dev/AUnlocker/blob/main/src/OptionsPatches.cs - [HarmonyPatch(typeof(NumberOption), nameof(NumberOption.Increase))] public static class NumberOption_Increase { public static bool Prefix(NumberOption __instance) { - if (ModGameOptionsMenu.TabIndex >= 3) return true; + float increment = Hotkeys.IncrementMultiplier * __instance.Increment; if (Utils.isHideNSeek || Utils.IsLobby && !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed) { - __instance.Value += __instance.Increment; - __instance.UpdateValue(); - __instance.OnValueChanged.Invoke(__instance); - __instance.AdjustButtonsActiveState(); - return false; + + if (__instance.Value + increment > __instance.ValidRange.max) + { + return true; + } + else + { + __instance.Value += increment; + __instance.UpdateValue(); + __instance.OnValueChanged.Invoke(__instance); + return false; + } } - else return true; + return true; } } @@ -28,17 +35,23 @@ public static class NumberOption_Decrease { public static bool Prefix(NumberOption __instance) { - if (ModGameOptionsMenu.TabIndex >= 3) return true; + float increment = Hotkeys.IncrementMultiplier * __instance.Increment; if (Utils.isHideNSeek || Utils.IsLobby && !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed) { - __instance.Value -= __instance.Increment; - __instance.UpdateValue(); - __instance.OnValueChanged.Invoke(__instance); - __instance.AdjustButtonsActiveState(); - return false; + if (__instance.Value - increment < __instance.ValidRange.min) + { + return true; + } + else + { + __instance.Value -= increment; + __instance.UpdateValue(); + __instance.OnValueChanged.Invoke(__instance); + return false; + } } - else return true; + return true; } } @@ -51,7 +64,27 @@ public static class NumberOption_Initialize if (Utils.isHideNSeek || Utils.IsLobby && !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed) { - __instance.ValidRange = new FloatRange(-900f, 900f); + __instance.ValidRange = new FloatRange(0f, 900f); + } + + switch (__instance.Title) + { + case StringNames.GameVotingTime: + case StringNames.GameDiscussTime: + __instance.Increment = 5f; + break; + case StringNames.GameKillCooldown: + __instance.Increment = 0.5f; + break; + case StringNames.GamePlayerSpeed: + case StringNames.GameCrewLight: + case StringNames.GameImpostorLight: + __instance.Increment = 0.05f; + break; + + default: + __instance.Increment = 1f; + break; } } } \ No newline at end of file diff --git a/Patches/OnGameStartedPatch.cs b/Patches/OnGameStartedPatch.cs index 029a337..128da2a 100644 --- a/Patches/OnGameStartedPatch.cs +++ b/Patches/OnGameStartedPatch.cs @@ -67,28 +67,11 @@ internal class CoStartGamePatch (candidates[i], candidates[j]) = (candidates[j], candidates[i]); } - // 1st RpcSetRole forces the role on that user. 2nd is needed to allow them to kill. for (int i = 0; i < toAdd; i++) { var player = candidates[i]; player.RpcSetRole(AmongUs.GameOptions.RoleTypes.Impostor, false); - - foreach (var p in PlayerControl.AllPlayerControls) - { - if (p.Data.Role.TeamType == RoleTeamTypes.Impostor) - { - new LateTask(() => - { - p.RpcSetRole(AmongUs.GameOptions.RoleTypes.Impostor, false); - }, 5f, "HNS Secondary RPCSetRole"); - - new LateTask(() => - { - p.RpcSetRole(AmongUs.GameOptions.RoleTypes.Impostor, false); - }, 9f, "HNS Tertiary RPCSetRole"); - } - } } } } diff --git a/Resources/Language/Strings.cs b/Resources/Language/Strings.cs index 8baeee5..e719ea7 100644 --- a/Resources/Language/Strings.cs +++ b/Resources/Language/Strings.cs @@ -18,7 +18,7 @@ public static class String return $"Shift and Seek:\n\nImpostors can only kill someone while shapeshifted as them\nSabotages & Meetings = Off";}} public static string SnSModeTwo{get{ - return $"Crew wins by tasks/surviving {Options.CrewAutoWinsGameAfter.GetInt()}s\nImp wins by killing\nOne wrong kill = Can't kill for {Options.CantKillTime.GetInt()}s\n{Utils.BasicIntToWord(Options.MisfiresToSuicide.GetInt())} wrong kills = suicide";}} + return $"Crew wins by tasks/surviving {Options.CrewAutoWinsGameAfter.GetInt()}s\n" + "Imp wins by killing\n" + (Options.MisfiresToSuicide.GetInt() == 1 ? "" : $"One wrong kill = Can't kill for {Options.CantKillTime.GetInt()}s\n") + $"{Utils.BasicIntToWord(Options.MisfiresToSuicide.GetInt())} wrong kill{(Options.MisfiresToSuicide.GetInt() == 1 ? "" : "s")} = suicide";}} public static string speedrunMode{get{ return $"Speedrun:\n\nEveryone is a crewmate. The 1st player to finish tasks wins the game. Game auto ends after {Options.GameAutoEndsAfter.GetInt()}s";}}