From a537db207fb0dad9052d090e100a4f5933bca6dd Mon Sep 17 00:00:00 2001 From: D1GQ Date: Sun, 25 Aug 2024 15:07:20 -0500 Subject: [PATCH] Integrate better role algorithm --- BetterAmongUs.csproj | 6 ++++++ Patches/ClientOptionsPatch.cs | 6 ------ Patches/CommandsPatch.cs | 5 ----- Patches/GameSettingMenuPatch.cs | 10 ++-------- Patches/RoleManagerPatch.cs | 4 ---- main.cs | 2 -- 6 files changed, 8 insertions(+), 25 deletions(-) diff --git a/BetterAmongUs.csproj b/BetterAmongUs.csproj index 1d0bb6b..4da5c31 100644 --- a/BetterAmongUs.csproj +++ b/BetterAmongUs.csproj @@ -25,4 +25,10 @@ + + + + + + \ No newline at end of file diff --git a/Patches/ClientOptionsPatch.cs b/Patches/ClientOptionsPatch.cs index f811f98..8d94d53 100644 --- a/Patches/ClientOptionsPatch.cs +++ b/Patches/ClientOptionsPatch.cs @@ -10,7 +10,6 @@ public static class OptionsMenuBehaviourPatch { private static ClientOptionItem AntiCheat; private static ClientOptionItem BetterHost; - private static ClientOptionItem BetterRoleAlgorithma; private static ClientOptionItem BetterNotifications; private static ClientOptionItem ChatInGameplay; private static ClientOptionItem LobbyPlayerInfo; @@ -63,11 +62,6 @@ public static class OptionsMenuBehaviourPatch } } - if (BetterRoleAlgorithma == null || BetterRoleAlgorithma.ToggleButton == null) - { - BetterRoleAlgorithma = ClientOptionItem.Create("Better Role Algorithma", Main.BetterRoleAlgorithma, __instance, toggleCheck: () => !toggleCheckInGamePlay("Better Role Algorithma")); - } - if (BetterNotifications == null || BetterNotifications.ToggleButton == null) { BetterNotifications = ClientOptionItem.Create("Better Notifications", Main.BetterNotifications, __instance, BetterNotificationsToggle); diff --git a/Patches/CommandsPatch.cs b/Patches/CommandsPatch.cs index a37465f..b618e98 100644 --- a/Patches/CommandsPatch.cs +++ b/Patches/CommandsPatch.cs @@ -303,11 +303,6 @@ class CommandsPatch case "role" or "setrole": if (HandleIsHost(command) == true) { - if (!Main.BetterRoleAlgorithma.Value) - { - Utils.AddChatPrivate($"{error}\nBetter Role Algorithma in better options must be turned on to use this command"); - return; - } if (command[0][1..].ToLower().Trim() == "role") { var player = PlayerControl.LocalPlayer; diff --git a/Patches/GameSettingMenuPatch.cs b/Patches/GameSettingMenuPatch.cs index 774e01a..8550b1c 100644 --- a/Patches/GameSettingMenuPatch.cs +++ b/Patches/GameSettingMenuPatch.cs @@ -69,14 +69,8 @@ static class GameSettingMenuPatch else if (IsPreload || GameStates.IsHideNSeek) { new BetterOptionHeaderItem().Create(BetterSettingsTab, "Hide & Seek Settings"); - - if (IsPreload || Main.BetterRoleAlgorithma.Value) - { - new BetterOptionTitleItem().Create(BetterSettingsTab, $"Better Role Algorithma"); - BetterOptionItem.SpacingNum += 0.2f; - new BetterOptionTitleItem().Create(BetterSettingsTab, $"Imposter"); - BetterGameSettings.HideAndSeekImpNum = new BetterOptionIntItem().Create(1000, BetterSettingsTab, "# Seekers", [1, 5, 1], 1, "", ""); - } + new BetterOptionTitleItem().Create(BetterSettingsTab, $"Imposter"); + BetterGameSettings.HideAndSeekImpNum = new BetterOptionIntItem().Create(1000, BetterSettingsTab, "# Seekers", [1, 5, 1], 1, "", ""); } } } diff --git a/Patches/RoleManagerPatch.cs b/Patches/RoleManagerPatch.cs index eb4ad5f..4c2c684 100644 --- a/Patches/RoleManagerPatch.cs +++ b/Patches/RoleManagerPatch.cs @@ -21,8 +21,6 @@ public class RoleManagerPatch [HarmonyPrefix] public static bool RoleManager_Prefix(/*RoleManager __instance*/) { - if (!Main.BetterRoleAlgorithma.Value) return true; - if (!GameStates.IsHideNSeek) { RegularBetterRoleAssignment(); @@ -377,8 +375,6 @@ public class RoleManagerPatch [HarmonyPrefix] public static bool AssignRoleOnDeath_Prefix(/*RoleManager __instance*/ [HarmonyArgument(0)] PlayerControl player) { - if (!Main.BetterRoleAlgorithma.Value) return true; - Dictionary GhostRoles = new() // Role, Amount { { RoleTypes.GuardianAngel, 0 }, diff --git a/main.cs b/main.cs index bbd2247..2db0077 100644 --- a/main.cs +++ b/main.cs @@ -174,7 +174,6 @@ public class Main : BasePlugin public static ConfigEntry AntiCheat { get; private set; } public static ConfigEntry BetterHost { get; private set; } - public static ConfigEntry BetterRoleAlgorithma { get; private set; } public static ConfigEntry BetterNotifications { get; private set; } public static ConfigEntry ChatInGameplay { get; private set; } public static ConfigEntry LobbyPlayerInfo { get; private set; } @@ -186,7 +185,6 @@ public class Main : BasePlugin { AntiCheat = Config.Bind("Better Options", "AntiCheat", true); BetterHost = Config.Bind("Better Options", "BetterHost", false); - BetterRoleAlgorithma = Config.Bind("Better Options", "BetterRoleAlgorithma", true); BetterNotifications = Config.Bind("Better Options", "BetterNotifications", true); ChatInGameplay = Config.Bind("Better Options", "ChatInGameplay", true); LobbyPlayerInfo = Config.Bind("Better Options", "LobbyPlayerInfo", true);