From fbf9b2b6ebe37c9295351ec9338ff3c80faf5f3e Mon Sep 17 00:00:00 2001 From: Ape <155788660+ApeMV@users.noreply.github.com> Date: Wed, 1 Apr 2026 12:49:21 +0200 Subject: [PATCH] 3 Small fixes --- AmongUsRevamped.cs | 2 +- Modules/CustomRoleManagement.cs | 2 ++ Patches/IntroPatch.cs | 2 +- Patches/OnGameStartedPatch.cs | 5 +++-- Patches/PlayerControlPatches.cs | 15 +++++++++++++-- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/AmongUsRevamped.cs b/AmongUsRevamped.cs index 8ba1763..79dd0ca 100644 --- a/AmongUsRevamped.cs +++ b/AmongUsRevamped.cs @@ -42,7 +42,7 @@ public partial class Main : BasePlugin public static bool HasArgumentException; public static string CredentialsText; - public const string ModVersion = "v1.6.6"; + public const string ModVersion = "v1.7.0"; public static float GameTimer; diff --git a/Modules/CustomRoleManagement.cs b/Modules/CustomRoleManagement.cs index 3b0f3ac..575a0dd 100644 --- a/Modules/CustomRoleManagement.cs +++ b/Modules/CustomRoleManagement.cs @@ -19,6 +19,8 @@ public static class CustomRoleManagement public static void AssignRoles() { + if (Options.Gamemode.GetValue() > 1) return; + // crewmateRoles = assigned with crewmate role base // impostorRoles = assigned with impostor role base List<(string roleName, int percentage)> crewmateRoles = new() diff --git a/Patches/IntroPatch.cs b/Patches/IntroPatch.cs index 18a0643..81c0397 100644 --- a/Patches/IntroPatch.cs +++ b/Patches/IntroPatch.cs @@ -17,7 +17,7 @@ internal static class CoShowIntroPatch NormalGameEndChecker.customRoles = CustomRoleManagement.PlayerToCustomRole(); - if (CustomRoleManagement.PlayerRoles.Count != 0 && !Utils.isHideNSeek) + if (CustomRoleManagement.PlayerRoles.Count != 0 && !Utils.isHideNSeek && Options.Gamemode.GetValue() < 2) { _ = new LateTask(() => { diff --git a/Patches/OnGameStartedPatch.cs b/Patches/OnGameStartedPatch.cs index 24522ad..7d0adbc 100644 --- a/Patches/OnGameStartedPatch.cs +++ b/Patches/OnGameStartedPatch.cs @@ -43,9 +43,10 @@ class PlayerControlSetRolePatch if (Main.GM.Value && __instance == PlayerControl.LocalPlayer) { roleType = RoleTypes.CrewmateGhost; + return true; } - if (CustomRoleManagement.PlayerRoles.TryGetValue(__instance.PlayerId, out var role) && role == "Mayor") + if (CustomRoleManagement.PlayerRoles.TryGetValue(__instance.PlayerId, out var role) && role == "Mayor" && Options.Gamemode.GetValue() < 2) { if (Options.MayorVentToMeeting.GetBool()) { @@ -57,7 +58,7 @@ class PlayerControlSetRolePatch roleType = RoleTypes.Crewmate; } } - if (CustomRoleManagement.PlayerRoles.TryGetValue(__instance.PlayerId, out var r) && r == "Jester") + if (CustomRoleManagement.PlayerRoles.TryGetValue(__instance.PlayerId, out var r) && r == "Jester" && Options.Gamemode.GetValue() < 2) { if (Options.JesterCanVent.GetBool()) { diff --git a/Patches/PlayerControlPatches.cs b/Patches/PlayerControlPatches.cs index 7a7e02b..1ab9aff 100644 --- a/Patches/PlayerControlPatches.cs +++ b/Patches/PlayerControlPatches.cs @@ -23,11 +23,12 @@ class ReportDeadBodyPatch } // target == null means meeting - if (target == null) return true; if (Options.Gamemode.GetValue() == 2 || Options.Gamemode.GetValue() == 3) { - Logger.Info($" Stopped {__instance.Data.PlayerName} reporting the body of {target.PlayerName}", "ReportDeadBodyPatch"); + if (target != null) Logger.Info($" Stopped {__instance.Data.PlayerName} reporting the body of {target.PlayerName}", "ReportDeadBodyPatch"); + else Logger.Info($" Stopped {__instance.Data.PlayerName} trying to call a meeting", "ReportDeadBodyPatch"); + return false; } else return true; @@ -174,6 +175,16 @@ class PlayerControlCompleteTaskPatch if (Options.Gamemode.GetValue() != 3) CalculateTaskWin(); + if (Options.Gamemode.GetValue() == 3) + { + if (!__instance.Data.IsDead && playerTasksCompleted[__instance] >= __instance.Data.Tasks.Count) + { + Utils.CustomWinnerEndGame(__instance, 1); + NormalGameEndChecker.LastWinReason = $"{__instance.Data.PlayerName} wins! (Completed tasks)"; + NormalGameEndChecker.canUpdateWinnerText = false; + } + } + if (PlayerControl.LocalPlayer.Data.IsDead) { TMP_Text nameText = __instance.cosmetics.nameText;