diff --git a/Modules/OptionHolder.cs b/Modules/OptionHolder.cs index 41799d0c2..4312ae458 100644 --- a/Modules/OptionHolder.cs +++ b/Modules/OptionHolder.cs @@ -727,8 +727,6 @@ public static class Options public static OptionItem AdditionalEmergencyCooldownThreshold; public static OptionItem AdditionalEmergencyCooldownTime; - public static OptionItem DisablePlayerVotedMessage; - // Game Commands public static OptionItem EnableAnagramCommand; public static OptionItem AnagramLanguage; @@ -2987,10 +2985,6 @@ public static class Options .SetGameMode(CustomGameMode.Standard) .SetValueFormat(OptionFormat.Seconds); - DisablePlayerVotedMessage = new BooleanOptionItem(23512, "DisablePlayerVotedMessage", true, TabGroup.GameSettings) - .SetGameMode(CustomGameMode.Standard) - .SetColor(new Color32(147, 241, 240, byte.MaxValue)); - LoadingPercentage = 95; VoteMode = new BooleanOptionItem(23600, "VoteMode", false, TabGroup.GameSettings) diff --git a/Patches/ChatCommandPatch.cs b/Patches/ChatCommandPatch.cs index d26f01e8b..2af8299b8 100644 --- a/Patches/ChatCommandPatch.cs +++ b/Patches/ChatCommandPatch.cs @@ -2395,7 +2395,7 @@ internal static class ChatCommands if (voteId > PlayerControl.AllPlayerControls.Count) return; PlayerControl votedPlayer = voteId.GetPlayer(); - if (!player.UsesMeetingShapeshift() && Main.PlayerStates.TryGetValue(player.PlayerId, out PlayerState state) && votedPlayer != null && state.Role.OnVote(player, votedPlayer)) return; + if (!player.UsesMeetingShapeshift() && !player.UsesJudgeAbilityAsTrigger() && Main.PlayerStates.TryGetValue(player.PlayerId, out PlayerState state) && votedPlayer != null && state.Role.OnVote(player, votedPlayer)) return; MeetingHud.Instance.CastVote(player.PlayerId, voteId); } diff --git a/Patches/CheckGameEndPatch.cs b/Patches/CheckGameEndPatch.cs index 2572b475c..54b5fff9a 100644 --- a/Patches/CheckGameEndPatch.cs +++ b/Patches/CheckGameEndPatch.cs @@ -84,9 +84,6 @@ internal static class GameEndChecker Ended = true; LoadingEndScreen = true; - foreach (var pc in Main.CachedAllPlayerControls()) - Camouflage.RpcSetSkin(pc, true, true, true); - NameNotifyManager.Reset(); NotifyRoles(ForceLoop: true); diff --git a/Patches/MeetingHudPatch.cs b/Patches/MeetingHudPatch.cs index 3d914a29a..24264239f 100644 --- a/Patches/MeetingHudPatch.cs +++ b/Patches/MeetingHudPatch.cs @@ -105,7 +105,7 @@ internal static class CheckForEndVotingPatch __instance.UpdateForeground(); pva.VotedForId = byte.MaxValue; } - else if (voteTarget && !pc.GetCustomRole().CancelsVote() && !pc.UsesMeetingShapeshift()) + else if (voteTarget && !pc.GetCustomRole().CancelsVote() && !pc.UsesMeetingShapeshift() && !pc.UsesJudgeAbilityAsTrigger()) Main.PlayerStates[pc.PlayerId].Role.OnVote(pc, voteTarget); else if (pc.Is(CustomRoles.Godfather)) Godfather.GodfatherTarget = byte.MaxValue; } @@ -1209,6 +1209,8 @@ internal static class MeetingHudStartPatch pva.NameText.SetText(name); } } + + SendChatNotePatch.Voted.Clear(); // ------------------------------------------------------------------------------------------- @@ -1492,7 +1494,7 @@ internal static class MeetingHudCastVotePatch var voteCanceled = false; - if (!Main.DontCancelVoteList.Contains(srcPlayerId) && !skip && pcSrc.GetCustomRole().CancelsVote() && !pcSrc.UsesMeetingShapeshift() && Main.PlayerStates[srcPlayerId].Role.OnVote(pcSrc, pcTarget)) + if (!Main.DontCancelVoteList.Contains(srcPlayerId) && !skip && pcSrc.GetCustomRole().CancelsVote() && !pcSrc.UsesMeetingShapeshift() && !pcSrc.UsesJudgeAbilityAsTrigger() && Main.PlayerStates[srcPlayerId].Role.OnVote(pcSrc, pcTarget)) { ShouldCancelVoteList.TryAdd(srcPlayerId, (__instance, pvaSrc, pcSrc)); voteCanceled = true; @@ -1532,12 +1534,23 @@ internal static class MeetingHudCastVotePatch } } +[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.ClearVote))] +static class ClearVotePatch +{ + public static void Postfix(PlayerId voterIdToClear) + { + SendChatNotePatch.Voted.Remove(voterIdToClear.Value); + } +} + [HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.RpcSendChatNote))] static class SendChatNotePatch { - public static bool Prefix() + public static readonly HashSet Voted = []; + + public static bool Prefix(byte srcPlayerId, ChatNoteTypes noteType) { - return !Options.DisablePlayerVotedMessage.GetBool(); + return noteType != ChatNoteTypes.DidVote || Voted.Add(srcPlayerId); } } @@ -1626,8 +1639,13 @@ internal static class MeetingHudHandleRpcPatch { case (byte)RpcCalls.QueueOverruleVotes: { - byte judgePlayerId = reader.ReadByte(); - byte targetPlayerId = reader.ReadByte(); + byte judgePlayerId, targetPlayerId; + { + MessageReader subReader = MessageReader.Get(reader); + judgePlayerId = subReader.ReadByte(); + targetPlayerId = subReader.ReadByte(); + subReader.Recycle(); + } PlayerControl judge = judgePlayerId.GetPlayer(); PlayerControl target = targetPlayerId.GetPlayer(); diff --git a/Patches/OnGameStartedPatch.cs b/Patches/OnGameStartedPatch.cs index 33218e9e7..963e5abc1 100644 --- a/Patches/OnGameStartedPatch.cs +++ b/Patches/OnGameStartedPatch.cs @@ -642,7 +642,7 @@ internal static class StartGameHostPatch if (!finderBanned) finderList.Add(player.PlayerId); if (!noisyBanned) noisyList.Add(player.PlayerId); - if (!examinerBanned && !kp.Value.UsesMeetingShapeshift()) + if (!examinerBanned && !kp.Value.UsesMeetingShapeshift() && !kp.Value.UsesJudgeAbilityAsTrigger()) examinerList.Add(player.PlayerId); } } diff --git a/Roles/Standard/Crewmate/Investigate/Captain.cs b/Roles/Standard/Crewmate/Investigate/Captain.cs index aba05566b..30720bf1d 100644 --- a/Roles/Standard/Crewmate/Investigate/Captain.cs +++ b/Roles/Standard/Crewmate/Investigate/Captain.cs @@ -40,6 +40,11 @@ public class Captain : RoleBase TargetRooms = []; } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return Options.UseJudgeAbilityAsTrigger.GetBool() || Options.UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl voter, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Crewmate/Investigate/FortuneTeller.cs b/Roles/Standard/Crewmate/Investigate/FortuneTeller.cs index 3e5bf5899..68559c636 100644 --- a/Roles/Standard/Crewmate/Investigate/FortuneTeller.cs +++ b/Roles/Standard/Crewmate/Investigate/FortuneTeller.cs @@ -93,6 +93,11 @@ public class FortuneTeller : RoleBase }, 8f, log: false); } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return UseJudgeAbilityAsTrigger.GetBool() || UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl player, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Crewmate/Investigate/Inquisitor.cs b/Roles/Standard/Crewmate/Investigate/Inquisitor.cs index 1c0096b67..fa46afd08 100644 --- a/Roles/Standard/Crewmate/Investigate/Inquisitor.cs +++ b/Roles/Standard/Crewmate/Investigate/Inquisitor.cs @@ -35,6 +35,11 @@ public class Inquisitor : RoleBase playerId.SetAbilityUseLimit(AbilityUseLimit.GetFloat()); } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return Options.UseJudgeAbilityAsTrigger.GetBool() || Options.UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl voter, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Crewmate/Investigate/Oracle.cs b/Roles/Standard/Crewmate/Investigate/Oracle.cs index 1bd6dedf5..75b229cbb 100644 --- a/Roles/Standard/Crewmate/Investigate/Oracle.cs +++ b/Roles/Standard/Crewmate/Investigate/Oracle.cs @@ -57,6 +57,11 @@ public class Oracle : RoleBase playerId.SetAbilityUseLimit(CheckLimitOpt.GetFloat()); } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return UseJudgeAbilityAsTrigger.GetBool() || UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl player, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Crewmate/Investigate/Scout.cs b/Roles/Standard/Crewmate/Investigate/Scout.cs index d806871b7..ee815b92e 100644 --- a/Roles/Standard/Crewmate/Investigate/Scout.cs +++ b/Roles/Standard/Crewmate/Investigate/Scout.cs @@ -97,6 +97,11 @@ public class Scout : RoleBase return TrackerTarget != null && TrackerTarget.ContainsKey(seer.PlayerId) && TrackerTarget[seer.PlayerId].Contains(target.PlayerId) ? Utils.ColorString(seer.GetRoleColor(), "◀") : string.Empty; } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return UseJudgeAbilityAsTrigger.GetBool() || UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl player, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Crewmate/Investigate/Socialite.cs b/Roles/Standard/Crewmate/Investigate/Socialite.cs index a1cbcd8ac..734c70cfc 100644 --- a/Roles/Standard/Crewmate/Investigate/Socialite.cs +++ b/Roles/Standard/Crewmate/Investigate/Socialite.cs @@ -102,6 +102,11 @@ public class Socialite : RoleBase return true; } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return Options.UseJudgeAbilityAsTrigger.GetBool() || Options.UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl pc, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Crewmate/Investigate/Soothsayer.cs b/Roles/Standard/Crewmate/Investigate/Soothsayer.cs index 0dc39b3b9..12c90a99e 100644 --- a/Roles/Standard/Crewmate/Investigate/Soothsayer.cs +++ b/Roles/Standard/Crewmate/Investigate/Soothsayer.cs @@ -41,6 +41,11 @@ public class Soothsayer : RoleBase Instances?.Remove(this); } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return Options.UseJudgeAbilityAsTrigger.GetBool() || Options.UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl player, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Crewmate/Miscellaneous/Ricochet.cs b/Roles/Standard/Crewmate/Miscellaneous/Ricochet.cs index aab260e31..b1cfee470 100644 --- a/Roles/Standard/Crewmate/Miscellaneous/Ricochet.cs +++ b/Roles/Standard/Crewmate/Miscellaneous/Ricochet.cs @@ -92,6 +92,11 @@ public class Ricochet : RoleBase return true; } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return UseJudgeAbilityAsTrigger.GetBool() || UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl pc, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Crewmate/Miscellaneous/Tether.cs b/Roles/Standard/Crewmate/Miscellaneous/Tether.cs index 9a6af9ce4..d2dbbd7f9 100644 --- a/Roles/Standard/Crewmate/Miscellaneous/Tether.cs +++ b/Roles/Standard/Crewmate/Miscellaneous/Tether.cs @@ -114,6 +114,11 @@ public class Tether : RoleBase AURoleOptions.EngineerInVentMaxTime = 1f; } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return UseJudgeAbilityAsTrigger.GetBool() || UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl pc, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Crewmate/Power/NiceEraser.cs b/Roles/Standard/Crewmate/Power/NiceEraser.cs index efa6f7552..217978f68 100644 --- a/Roles/Standard/Crewmate/Power/NiceEraser.cs +++ b/Roles/Standard/Crewmate/Power/NiceEraser.cs @@ -57,6 +57,11 @@ internal class NiceEraser : RoleBase PlayerIdList.Remove(playerId); } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return Options.UseJudgeAbilityAsTrigger.GetBool() || Options.UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl player, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Crewmate/Power/President.cs b/Roles/Standard/Crewmate/Power/President.cs index d4a92a255..47c7a2746 100644 --- a/Roles/Standard/Crewmate/Power/President.cs +++ b/Roles/Standard/Crewmate/Power/President.cs @@ -240,6 +240,11 @@ public class President : RoleBase return target.PlayerId == PresidentId && IsRevealed; } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return Options.UseJudgeAbilityAsTrigger.GetBool() || Options.UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl voter, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Crewmate/Support/Cleanser.cs b/Roles/Standard/Crewmate/Support/Cleanser.cs index 3f1d39a81..1972fd926 100644 --- a/Roles/Standard/Crewmate/Support/Cleanser.cs +++ b/Roles/Standard/Crewmate/Support/Cleanser.cs @@ -90,6 +90,11 @@ public class Cleanser : RoleBase cs.CleanserUses = Limit; } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return UseJudgeAbilityAsTrigger.GetBool() || UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl voter, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Crewmate/Support/Negotiator.cs b/Roles/Standard/Crewmate/Support/Negotiator.cs index b71db05a6..48c959e99 100644 --- a/Roles/Standard/Crewmate/Support/Negotiator.cs +++ b/Roles/Standard/Crewmate/Support/Negotiator.cs @@ -124,6 +124,11 @@ public class Negotiator : RoleBase } } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return Options.UseJudgeAbilityAsTrigger.GetBool() || Options.UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl voter, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Impostor/Concealing/Penguin.cs b/Roles/Standard/Impostor/Concealing/Penguin.cs index c3252faad..ebfbff4d2 100644 --- a/Roles/Standard/Impostor/Concealing/Penguin.cs +++ b/Roles/Standard/Impostor/Concealing/Penguin.cs @@ -301,7 +301,7 @@ public class Penguin : RoleBase public override void OnFixedUpdate(PlayerControl pc) { - if (!IsEnable) return; + if (!IsEnable || AbductTimer == null) return; if (AbductVictim) { @@ -374,7 +374,7 @@ public class Penguin : RoleBase } } } - else if (AbductTimer != null) + else { AbductTimer = null; Utils.SendRPC(CustomRPC.PenguinSync, PenguinId, 2, true); diff --git a/Roles/Standard/Impostor/Miscellaneous/Loner.cs b/Roles/Standard/Impostor/Miscellaneous/Loner.cs index 9d14e13b9..d6c447505 100644 --- a/Roles/Standard/Impostor/Miscellaneous/Loner.cs +++ b/Roles/Standard/Impostor/Miscellaneous/Loner.cs @@ -34,6 +34,11 @@ public class Loner : RoleBase Done = false; } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return Options.UseJudgeAbilityAsTrigger.GetBool() || Options.UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl pc, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Impostor/Support/EvilEraser.cs b/Roles/Standard/Impostor/Support/EvilEraser.cs index 428c67fa3..25820fc47 100644 --- a/Roles/Standard/Impostor/Support/EvilEraser.cs +++ b/Roles/Standard/Impostor/Support/EvilEraser.cs @@ -98,6 +98,11 @@ internal class EvilEraser : RoleBase return true; } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return Options.UseJudgeAbilityAsTrigger.GetBool() || Options.UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl player, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Impostor/Support/Godfather.cs b/Roles/Standard/Impostor/Support/Godfather.cs index 1a372087e..eb5c22820 100644 --- a/Roles/Standard/Impostor/Support/Godfather.cs +++ b/Roles/Standard/Impostor/Support/Godfather.cs @@ -22,6 +22,11 @@ internal class Godfather : RoleBase On = false; } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return Options.UseJudgeAbilityAsTrigger.GetBool() || Options.UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl voter, PlayerControl target) { if (Starspawn.IsDayBreak) return false; diff --git a/Roles/Standard/Neutral/Pariah/Clerk.cs b/Roles/Standard/Neutral/Pariah/Clerk.cs index c2009907b..414d509b5 100644 --- a/Roles/Standard/Neutral/Pariah/Clerk.cs +++ b/Roles/Standard/Neutral/Pariah/Clerk.cs @@ -42,6 +42,11 @@ public class Clerk : RoleBase playerId.SetAbilityUseLimit(AbilityUseLimit.GetInt()); } + public override bool OnVote(PlayerControl voter, PlayerControl target) + { + return Options.UseJudgeAbilityAsTrigger.GetBool() || Options.UseMeetingShapeshift.GetBool() ? base.OnVote(voter, target) : OnJudge(voter, target); + } + public override bool OnJudge(PlayerControl voter, PlayerControl target) { if (Starspawn.IsDayBreak) return false;