From ddfad0752d45ac3d4e928471e2ee9e343e748b56 Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Sat, 5 Apr 2025 14:30:52 -0400 Subject: [PATCH] proper fix for meeting vote issue (I HATE IL2CPP) --- MiraAPI/Patches/Voting/MeetingHudPatches.cs | 25 +++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/MiraAPI/Patches/Voting/MeetingHudPatches.cs b/MiraAPI/Patches/Voting/MeetingHudPatches.cs index d873f56..316fc7f 100644 --- a/MiraAPI/Patches/Voting/MeetingHudPatches.cs +++ b/MiraAPI/Patches/Voting/MeetingHudPatches.cs @@ -35,6 +35,7 @@ internal static class MeetingHudPatches modifier.OnMeetingStart(); } } + var @event = new StartMeetingEvent(__instance); MiraEventManager.InvokeEvent(@event); } @@ -53,10 +54,30 @@ internal static class MeetingHudPatches MiraEventManager.InvokeEvent(new VotingCompleteEvent(__instance)); } + // this is necessary because the actual ForceSkipAll method is inlined. [HarmonyPrefix] - [HarmonyPatch(nameof(MeetingHud.ForceSkipAll))] - public static void ForceSkipAllPatch(MeetingHud __instance) + [HarmonyPatch(nameof(MeetingHud.Update))] + public static void ForceSkipPatch(MeetingHud __instance) { + if (__instance.state is not (MeetingHud.VoteStates.NotVoted or MeetingHud.VoteStates.Voted)) + { + return; + } + + var logicOptionsNormal = GameManager.Instance.LogicOptions.Cast(); + var votingTime = logicOptionsNormal.GetVotingTime(); + if (votingTime <= 0) + { + return; + } + + var num2 = __instance.discussionTimer - logicOptionsNormal.GetDiscussionTime(); + + if (!AmongUsClient.Instance.AmHost || num2 < votingTime) + { + return; + } + foreach (var plr in PlayerControl.AllPlayerControls) { var voteData = plr.GetVoteData();