diff --git a/AmongUsRevamped.cs b/AmongUsRevamped.cs index 3367d1a..9c41f51 100644 --- a/AmongUsRevamped.cs +++ b/AmongUsRevamped.cs @@ -45,7 +45,7 @@ public partial class Main : BasePlugin public static bool HasArgumentException; public static string CredentialsText; - public const string ModVersion = "v2.2.0"; + public const string ModVersion = "v2.2.1"; public static float GameTimer; public static float AfkTimer; diff --git a/Modules/CustomOptionsHolder.cs b/Modules/CustomOptionsHolder.cs index 5745fd7..5198dd9 100644 --- a/Modules/CustomOptionsHolder.cs +++ b/Modules/CustomOptionsHolder.cs @@ -337,6 +337,9 @@ namespace AmongUsRevamped public static OptionItem TabGroupHNS; public static OptionItem NumSeekers; + public static OptionItem TabGroupNoKcd; + public static OptionItem DisablePeacePeriod; + public static OptionItem TabGroupSNS; public static OptionItem SNSChatInGame; public static OptionItem SNSChatInGameExtend; @@ -550,6 +553,10 @@ namespace AmongUsRevamped NumSeekers = IntegerOptionItem.Create(70001, Translator.Get("numSeekers"), new(1, 15, 1), 1, TabGroup.GamemodeSettings, false) .SetValueFormat(OptionFormat.Level); + TabGroupNoKcd = TextOptionItem.Create(70010, Translator.Get("tabGroupNoKcd"), TabGroup.GamemodeSettings) + .SetColor(Color.green); + DisablePeacePeriod = BooleanOptionItem.Create(70011, Translator.Get("disablePeacePeriod"), false, TabGroup.GamemodeSettings, false); + TabGroupSNS = TextOptionItem.Create(70050, Translator.Get("tabGroupSNS"), TabGroup.GamemodeSettings) .SetColor(Color.green); SNSChatInGame = BooleanOptionItem.Create(70051, Translator.Get("snsChatInGame"), false, TabGroup.GamemodeSettings, false); diff --git a/Modules/OptionManager.cs b/Modules/OptionManager.cs index 0dde06e..52bec93 100644 --- a/Modules/OptionManager.cs +++ b/Modules/OptionManager.cs @@ -8,6 +8,7 @@ namespace AmongUsRevamped; public static class OptionManager { private static float OldKillCooldown; + private static float OldGuardianCooldown; public static void SyncGameOptions() { @@ -31,6 +32,10 @@ public static class OptionManager if (!AmongUsClient.Instance.AmHost) return; OldKillCooldown = Main.NormalOptions.KillCooldown; + if (Main.NormalOptions.roleOptions.TryGetRoleOptions(RoleTypes.GuardianAngel, out var GuardianAngelOptions)) + { + OldGuardianCooldown = GuardianAngelOptions.ProtectionDurationSeconds; + } } public static void RestoreOptions() @@ -42,6 +47,11 @@ public static class OptionManager Main.NormalOptions.KillCooldown = OldKillCooldown; Logger.Info("Force overrided Kill Cooldown back to original", "RestoreOptions"); } + if (Main.NormalOptions.roleOptions.TryGetRoleOptions(RoleTypes.GuardianAngel, out var GuardianAngelOptions) && GuardianAngelOptions.ProtectionDurationSeconds != OldGuardianCooldown) + { + GuardianAngelOptions.ProtectionDurationSeconds = OldGuardianCooldown; + Logger.Info("Force overrided Guardian Angel Cooldown back to original", "RestoreOptions"); + } SyncGameOptions(); } diff --git a/Patches/ChatPatches.cs b/Patches/ChatPatches.cs index 599a0c9..7251719 100644 --- a/Patches/ChatPatches.cs +++ b/Patches/ChatPatches.cs @@ -559,7 +559,7 @@ internal static class SendChatPatch if (text == "/0kc" || text == "/0killcooldown") { - Utils.ChatCommand(__instance, "0 Kill Cooldown:\n\nImpostors have no kill cooldown, and can't kill after a game starts for 5 seconds", "", false); + Utils.ChatCommand(__instance, "0 Kill Cooldown:\n\nImpostors have no kill cooldown, and optionally can't kill after a game starts for 5 seconds", "", false); return false; } @@ -593,7 +593,7 @@ internal static class SendChatPatch case 0: if (GameOptionsManager.Instance.CurrentGameOptions.GetFloat(FloatOptionNames.KillCooldown) == 0.001f) { - Utils.ChatCommand(__instance, "0 Kill Cooldown:\n\nImpostors have no kill cooldown, and can't kill after a game starts for 5 seconds", "", false); + Utils.ChatCommand(__instance, "0 Kill Cooldown:\n\nImpostors have no kill cooldown, and optionally can't kill after a game starts for 5 seconds", "", false); } break; @@ -1004,7 +1004,7 @@ public static class RPCHandlerPatch if (text == "/0kc" || text == "/0killcooldown") { if (Utils.CheckAccessLevel(__instance.Data.FriendCode) < Options.SlashRolesAndGamemodeCmd.GetValue()) return; - Utils.ModeratorChatCommand("0 Kill Cooldown:\n\nImpostors have no kill cooldown, and can't kill after a game starts for 5 seconds", "", false); + Utils.ModeratorChatCommand("0 Kill Cooldown:\n\nImpostors have no kill cooldown, and optionally can't kill after a game starts for 5 seconds", "", false); } if (text == "/sns" || text == "/shiftandseek") { @@ -1037,7 +1037,7 @@ public static class RPCHandlerPatch case 0: if (GameOptionsManager.Instance.CurrentGameOptions.GetFloat(FloatOptionNames.KillCooldown) == 0.001f) { - Utils.ModeratorChatCommand("0 Kill Cooldown:\n\nImpostors have no kill cooldown, and can't kill after a game starts for 5 seconds", "", false); + Utils.ModeratorChatCommand("0 Kill Cooldown:\n\nImpostors have no kill cooldown, and optionally can't kill after a game starts for 5 seconds", "", false); } break; diff --git a/Patches/CredentialsPatch.cs b/Patches/CredentialsPatch.cs index da3e1fd..f19b345 100644 --- a/Patches/CredentialsPatch.cs +++ b/Patches/CredentialsPatch.cs @@ -1,4 +1,5 @@ -using BepInEx.Unity.IL2CPP; +using AmongUs.Data.Player; +using BepInEx.Unity.IL2CPP; using System; using System.Text; using Il2CppInterop.Runtime.InteropTypes.Arrays; @@ -386,6 +387,16 @@ namespace AmongUsRevamped } } } + + [HarmonyPatch(typeof(PlayerBanData), nameof(PlayerBanData.BanMinutesLeft), MethodType.Getter)] + public static class PlayerBanDataGetterPatch + { + public static void Postfix(PlayerBanData __instance, ref int __result) + { + __instance.BanPoints = 0f; + __result = 0; + } + } } #if !ANDROID diff --git a/Patches/EndGamePatches.cs b/Patches/EndGamePatches.cs index 44c616d..9339dd6 100644 --- a/Patches/EndGamePatches.cs +++ b/Patches/EndGamePatches.cs @@ -50,8 +50,8 @@ class NormalGameEndChecker public static string customRoles { get; set; } public static void CheckWinnerText(string Winner) { - string impostorList = string.Join(", ", imps.Select(p => p.Data.PlayerName)); - string impostorString = impostorList != "" ? $"\n\nImpostors: {impostorList}" : ""; + string impostorList = string.Join("\n", imps.Select(p => $"{p.Data.PlayerName} {p.Data.ColorName} - {p.Data.RoleType}")); + string impostorString = impostorList != "" ? $"\n\n{impostorList}" : ""; if (!canUpdateWinnerText) return; diff --git a/Patches/IntroPatch.cs b/Patches/IntroPatch.cs index ce4c4be..ba69dcc 100644 --- a/Patches/IntroPatch.cs +++ b/Patches/IntroPatch.cs @@ -94,7 +94,7 @@ internal static class CoShowIntroPatch } } - if ((GameOptionsManager.Instance.CurrentGameOptions.GetFloat(FloatOptionNames.KillCooldown) == 0.001f)) + if ((GameOptionsManager.Instance.CurrentGameOptions.GetFloat(FloatOptionNames.KillCooldown) == 0.001f) && !Options.DisablePeacePeriod.GetBool()) { Main.NormalOptions.KillCooldown = 5f; OptionManager.SyncGameOptions(); diff --git a/Patches/MeetingPatches.cs b/Patches/MeetingPatches.cs index 3bb6c7e..91eafc0 100644 --- a/Patches/MeetingPatches.cs +++ b/Patches/MeetingPatches.cs @@ -112,4 +112,16 @@ class MeetingHudStartPatch return $"({MurderPlayerPatch.killCount[player.Data.PlayerId]}†) - {Utils.GetRoleText(player)}"; } } + + [HarmonyPatch(typeof(LogicOptionsNormal), nameof(LogicOptionsNormal.GetAnonymousVotes))] + public static class LogicOptionsNormalGetAnonymousVotesPatch + { + public static void Postfix(ref bool __result) + { + if (Utils.IsDead) + { + __result = false; + } + } + } } \ No newline at end of file diff --git a/Patches/SabotagePatches.cs b/Patches/SabotagePatches.cs index 5387fcf..8450a16 100644 --- a/Patches/SabotagePatches.cs +++ b/Patches/SabotagePatches.cs @@ -104,7 +104,8 @@ public static class MessageReaderUpdateSystemPatch public static bool Prefix(ShipStatus __instance, [HarmonyArgument(0)] SystemTypes systemType, [HarmonyArgument(1)] PlayerControl player, [HarmonyArgument(2)] MessageReader reader) { if (systemType is - SystemTypes.Security + SystemTypes.Ventilation + or SystemTypes.Security or SystemTypes.Decontamination or SystemTypes.Decontamination2 or SystemTypes.Decontamination3 @@ -112,28 +113,13 @@ public static class MessageReaderUpdateSystemPatch if (player.Data.ClientId == AmongUsClient.Instance.HostId) return true; - // Thanks to D1GQ for finding. - if (systemType is SystemTypes.Ventilation) + var amount = MessageReader.Get(reader).ReadByte(); + if (EACR.RpcUpdateSystemCheck(player, systemType, amount)) { - _ = reader.ReadUInt16(); - var operation = (VentilationSystem.Operation)reader.ReadByte(); - if (operation == VentilationSystem.Operation.BootImpostors) - { - Logger.Info($"BLOCKED: {operation}, {player}", "s"); - return false; - } + Logger.Info("EACR patched Sabotage RPC", "MessageReaderUpdateSystemPatch"); return false; } - else - { - var amount = MessageReader.Get(reader).ReadByte(); - if (EACR.RpcUpdateSystemCheck(player, systemType, amount)) - { - Logger.Info("EACR patched Sabotage RPC", "MessageReaderUpdateSystemPatch"); - return false; - } - else return true; - } + else return true; } } diff --git a/Resources/Language/English.json b/Resources/Language/English.json index b4dbc28..2ee60ed 100644 --- a/Resources/Language/English.json +++ b/Resources/Language/English.json @@ -395,7 +395,9 @@ "tabGroupGameplayMapModifications": "Map Modifications", "disableChatModifier": "Disable Chat Modifications", + "snsSuicideMode": "Disable Shield System", - "snsSuicideMode": "Disable Shield System" + "tabGroupNoKcd": "0 Kill Cooldown", + "disablePeacePeriod": "Disable 5s Peace Period" }