diff --git a/CTA/CustomTeamAssigner/Utils.cs b/CTA/CustomTeamAssigner/Utils.cs index 7efb3a8c3..c359be331 100644 --- a/CTA/CustomTeamAssigner/Utils.cs +++ b/CTA/CustomTeamAssigner/Utils.cs @@ -28,6 +28,8 @@ namespace CustomTeamAssigner { CustomRoles.EvilDiviner, "Consigliere" }, { CustomRoles.Minimalism, "Killing Machine" }, { CustomRoles.BallLightning, "Lightning" }, + { CustomRoles.LovingCrewmate, "Lover" }, + { CustomRoles.LovingImpostor, "Loving Impostor" }, { CustomRoles.Mafia, "Nemesis" }, { CustomRoles.SerialKiller, "Mercenary" }, { CustomRoles.Assassin, "Ninja" }, diff --git a/Modules/DebugModeManager.cs b/Modules/DebugModeManager.cs index 799a46416..87719ac70 100644 --- a/Modules/DebugModeManager.cs +++ b/Modules/DebugModeManager.cs @@ -4,18 +4,18 @@ namespace EHR; public static class DebugModeManager { + public static OptionItem EnableDebugMode; public static bool AmDebugger { get; private set; } = #if DEBUG true; #else - false; + false; #endif public static bool IsDebugMode => AmDebugger && EnableDebugMode != null && EnableDebugMode.GetBool(); - public static OptionItem EnableDebugMode; public static void Auth(HashAuth auth, string input) { - AmDebugger = AmDebugger || auth.CheckString(input); + AmDebugger |= auth.CheckString(input); } public static void SetupCustomOption() diff --git a/Modules/Utils.cs b/Modules/Utils.cs index f530238ed..7fdf208ec 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -1965,7 +1965,7 @@ public static class Utils if (Options.CurrentGameMode != CustomGameMode.Standard) goto GameMode0; SelfMark.Append(Snitch.GetWarningArrow(seer)); - if (Main.LoversPlayers.Contains(seer)) SelfMark.Append(ColorString(GetRoleColor(CustomRoles.Lovers), " ♥")); + if (Main.LoversPlayers.Any(x => x.PlayerId == seer.PlayerId)) SelfMark.Append(ColorString(GetRoleColor(CustomRoles.Lovers), " ♥")); if (BallLightning.IsGhost(seer)) SelfMark.Append(ColorString(GetRoleColor(CustomRoles.BallLightning), "■")); SelfMark.Append(Medic.GetMark(seer, seer)); SelfMark.Append(Gamer.TargetMark(seer, seer)); @@ -2154,7 +2154,7 @@ public static class Utils TargetMark.Append(Snitch.GetWarningMark(seer, target)); - if (Main.LoversPlayers.TrueForAll(x => x.PlayerId == seer.PlayerId || x.PlayerId == target.PlayerId) || (seer.Data.IsDead && Main.LoversPlayers.Contains(target))) + if (Main.LoversPlayers.TrueForAll(x => x.PlayerId == seer.PlayerId || x.PlayerId == target.PlayerId) || (seer.Data.IsDead && Main.LoversPlayers.Any(x => x.PlayerId == target.PlayerId))) { TargetMark.Append($" ♥"); } diff --git a/Patches/ChatCommandPatch.cs b/Patches/ChatCommandPatch.cs index 638e321f1..ce7d1903a 100644 --- a/Patches/ChatCommandPatch.cs +++ b/Patches/ChatCommandPatch.cs @@ -762,7 +762,7 @@ internal class ChatCommands ChatUpdatePatch.LoversMessage = true; Utils.SendMessage(text, otherLover.PlayerId, title); Utils.SendMessage(text, PlayerControl.LocalPlayer.PlayerId, title); - LateTask.New(() => ChatUpdatePatch.LoversMessage = false, Main.MessageWait.Value, log: false); + LateTask.New(() => ChatUpdatePatch.LoversMessage = false, Math.Max((AmongUsClient.Instance.Ping / 1000f) * 2f, 0.2f), log: false); } goto Canceled; @@ -1406,7 +1406,7 @@ internal class ChatCommands ChatUpdatePatch.LoversMessage = true; Utils.SendMessage(text, otherLover.PlayerId, title); Utils.SendMessage(text, player.PlayerId, title); - LateTask.New(() => ChatUpdatePatch.LoversMessage = false, Main.MessageWait.Value, log: false); + LateTask.New(() => ChatUpdatePatch.LoversMessage = false, Math.Max((AmongUsClient.Instance.Ping / 1000f) * 2f, 0.2f), log: false); }, 0.2f, log: false); } } diff --git a/Patches/DisconnectPenaltyPatch.cs b/Patches/DisconnectPenaltyPatch.cs index 5e72b72a3..a969023e2 100644 --- a/Patches/DisconnectPenaltyPatch.cs +++ b/Patches/DisconnectPenaltyPatch.cs @@ -7,10 +7,7 @@ namespace EHR.Patches { public static bool Prefix(StatsManager __instance, ref int __result) { - if (!DebugModeManager.AmDebugger) - { - return true; - } + if (!DebugModeManager.AmDebugger) return true; if (__instance.BanPoints != 0f) { __instance.BanPoints = 0f; @@ -18,8 +15,9 @@ namespace EHR.Patches Logger.Info("Debug Removed Disconnect ban", "PenaltyPatch"); return false; } + return true; } } } -//Code from https://github.com/scp222thj/MalumMenu/blob/main/src/Passive/PenaltyPatch.cs +//Code from https://github.com/scp222thj/MalumMenu/blob/main/src/Passive/PenaltyPatch.cs \ No newline at end of file diff --git a/Patches/MeetingHudPatch.cs b/Patches/MeetingHudPatch.cs index a540cd13c..68ee7f285 100644 --- a/Patches/MeetingHudPatch.cs +++ b/Patches/MeetingHudPatch.cs @@ -365,7 +365,7 @@ class CheckForEndVotingPatch } if (Options.ConfirmEgoistOnEject.GetBool() && player.Is(CustomRoles.Egoist)) coloredRole = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Egoist), GetRoleString("Temp.Blank") + coloredRole.RemoveHtmlTags()); - if (Options.ConfirmLoversOnEject.GetBool() && Main.LoversPlayers.Contains(player)) coloredRole = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Lovers), GetRoleString("Temp.Blank") + coloredRole.RemoveHtmlTags()); + if (Options.ConfirmLoversOnEject.GetBool() && Main.LoversPlayers.Any(x => x.PlayerId == player.PlayerId)) coloredRole = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Lovers), GetRoleString("Temp.Blank") + coloredRole.RemoveHtmlTags()); if (Options.RascalAppearAsMadmate.GetBool() && player.Is(CustomRoles.Rascal)) coloredRole = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Madmate), GetRoleString("Mad-") + coloredRole.RemoveHtmlTags()); var name = string.Empty; @@ -972,7 +972,7 @@ class MeetingHudStartPatch if (Silencer.ForSilencer.Contains(target.PlayerId)) sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Silencer), "╳")); - if (Main.LoversPlayers.Contains(target) && (Main.LoversPlayers.Contains(seer) || seer.Data.IsDead)) + if (Main.LoversPlayers.Any(x => x.PlayerId == target.PlayerId) && (Main.LoversPlayers.Any(x => x.PlayerId == seer.PlayerId) || seer.Data.IsDead)) { sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Lovers), "♥")); } diff --git a/Roles/Crewmate/SabotageMaster.cs b/Roles/Crewmate/SabotageMaster.cs index 4a7a12242..e3d271e76 100644 --- a/Roles/Crewmate/SabotageMaster.cs +++ b/Roles/Crewmate/SabotageMaster.cs @@ -1,7 +1,9 @@ using System.Collections.Generic; +using System.Globalization; using AmongUs.GameOptions; using EHR.Modules; using Hazel; +using UnityEngine; namespace EHR.Roles.Crewmate; @@ -75,7 +77,8 @@ public class SabotageMaster : RoleBase public override string GetProgressText(byte playerId, bool comms) { var limit = SkillLimit.GetInt() - UsedSkillCount; - return limit + base.GetProgressText(playerId, comms); + var str = Utils.ColorString(Color.white, limit.ToString(CultureInfo.CurrentCulture)); + return str + base.GetProgressText(playerId, comms); } public void SendRPC() diff --git a/Roles/Neutral/FFF.cs b/Roles/Neutral/FFF.cs index 8a16a8f27..a9d0aa9d4 100644 --- a/Roles/Neutral/FFF.cs +++ b/Roles/Neutral/FFF.cs @@ -92,7 +92,7 @@ namespace EHR.Roles.Neutral ((target.Is(CustomRoles.Madmate) || target.Is(CustomRoles.Gangster)) && CanKillMadmate.GetBool()) || ((target.Is(CustomRoles.Charmed) || target.Is(CustomRoles.Succubus)) && CanKillCharmed.GetBool()) || ((target.Is(CustomRoles.Undead) || target.Is(CustomRoles.Necromancer) || target.Is(CustomRoles.Deathknight)) && CanKillUndead.GetBool()) - || ((Main.LoversPlayers.Contains(target) || target.Is(CustomRoles.Ntr)) && CanKillLovers.GetBool()) + || ((Main.LoversPlayers.Any(x => x.PlayerId == target.PlayerId) || target.Is(CustomRoles.Ntr)) && CanKillLovers.GetBool()) || ((target.Is(CustomRoles.Romantic) || target.Is(CustomRoles.RuthlessRomantic) || target.Is(CustomRoles.VengefulRomantic) || Romantic.PartnerId == target.PlayerId) && CanKillLovers.GetBool()) || ((target.Is(CustomRoles.Sidekick) || target.Is(CustomRoles.Jackal) || target.Is(CustomRoles.Recruit)) && CanKillSidekicks.GetBool()) diff --git a/Roles/Neutral/Shifter.cs b/Roles/Neutral/Shifter.cs index b8f802fb9..d7f75b006 100644 --- a/Roles/Neutral/Shifter.cs +++ b/Roles/Neutral/Shifter.cs @@ -98,8 +98,8 @@ namespace EHR.Neutral var taskState = target.GetTaskState(); if (taskState.hasTasks) Main.PlayerStates[killer.PlayerId].taskState = taskState; - var killerSubRoles = killer.GetCustomSubRoles(); - var targetSubRoles = target.GetCustomSubRoles(); + var killerSubRoles = killer.GetCustomSubRoles().ToList(); + var targetSubRoles = target.GetCustomSubRoles().ToList(); if (targetSubRoles.Count > 0) { killer.RpcSetCustomRole(targetSubRoles[0], replaceAllAddons: true); diff --git a/main.cs b/main.cs index 5aeedc30e..afa9c3743 100644 --- a/main.cs +++ b/main.cs @@ -29,8 +29,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 = "3.5.0"; - public const string PluginDisplayVersion = "3.5.0"; + public const string PluginVersion = "3.5.1"; + public const string PluginDisplayVersion = "3.5.1"; public const string NeutralColor = "#ffab1b"; public const string ImpostorColor = "#ff1919"; public const string CrewmateColor = "#8cffff";