From af75cc36069c2b8fd9307c6cb7110f11245c32c3 Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Sat, 20 Sep 2025 11:16:56 -0400 Subject: [PATCH] revert un-inline --- MiraAPI/Patches/Events/EndGamePatches.cs | 93 +----------------------- 1 file changed, 1 insertion(+), 92 deletions(-) diff --git a/MiraAPI/Patches/Events/EndGamePatches.cs b/MiraAPI/Patches/Events/EndGamePatches.cs index 13291c6..558c468 100644 --- a/MiraAPI/Patches/Events/EndGamePatches.cs +++ b/MiraAPI/Patches/Events/EndGamePatches.cs @@ -1,6 +1,4 @@ -using System.Linq; -using AmongUs.Data; -using HarmonyLib; +using HarmonyLib; using MiraAPI.Events; using MiraAPI.Events.Vanilla.Gameplay; using MiraAPI.GameEnd; @@ -9,95 +7,6 @@ namespace MiraAPI.Patches.Events; internal static class EndGamePatches { - // To un-inline RpcEndGame - [HarmonyPatch(typeof(LogicGameFlowNormal), nameof(LogicGameFlowNormal.CheckEndCriteria))] - public static class LogicGameFlowNormalPatches - { - public static void Prefix(LogicGameFlowNormal __instance, ref bool __runOriginal) - { - __runOriginal = false; - if (!GameData.Instance) - { - return; - } - - if (ShipStatus.Instance.Systems.TryGetValue(SystemTypes.LifeSupp, out var systemType)) - { - var lifeSuppSystemType = systemType.Cast(); - if (lifeSuppSystemType.Countdown < 0f) - { - __instance.EndGameForSabotage(); - lifeSuppSystemType.Countdown = 10000f; - } - } - - foreach (var systemType2 in ShipStatus.Instance.Systems.Values) - { - var criticalSabotage = systemType2.TryCast(); - if (criticalSabotage is { Countdown: < 0f }) - { - __instance.EndGameForSabotage(); - criticalSabotage.ClearSabotage(); - } - } - - var playerCounts = __instance.GetPlayerCounts(); - var item = playerCounts.Item1; - var item2 = playerCounts.Item2; - var item3 = playerCounts.Item3; - if (item2 <= 0 && (!TutorialManager.InstanceExists || item3 > 0)) - { - if (!TutorialManager.InstanceExists) - { - var gameOverReason = GameOverReason.CrewmatesByVote; - __instance.Manager.RpcEndGame(gameOverReason, !DataManager.Player.Ads.HasPurchasedAdRemoval); - return; - } - - if (!Minigame.Instance) - { - HudManager.Instance.ShowPopUp( - TranslationController.Instance.GetString(StringNames.GameOverImpostorDead)); - __instance.Manager.ReviveEveryoneFreeplay(); - } - } - else if (item <= item2) - { - if (!TutorialManager.InstanceExists) - { - var gameOverReason2 = GameData.LastDeathReason switch - { - DeathReason.Exile => GameOverReason.ImpostorsByVote, - DeathReason.Kill => GameOverReason.ImpostorsByKill, - _ => GameOverReason.CrewmateDisconnect, - }; - - __instance.Manager.RpcEndGame(gameOverReason2, !DataManager.Player.Ads.HasPurchasedAdRemoval); - return; - } - - HudManager.Instance.ShowPopUp(TranslationController.Instance.GetString(StringNames.GameOverImpostorKills)); - __instance.Manager.ReviveEveryoneFreeplay(); - } - else - { - if (!TutorialManager.InstanceExists) - { - __instance.Manager.CheckEndGameViaTasks(); - return; - } - - if (PlayerControl.LocalPlayer.myTasks.ToArray().All(t => t.IsComplete)) - { - HudManager.Instance.ShowPopUp( - TranslationController.Instance.GetString( - StringNames.GameOverTaskWin)); - ShipStatus.Instance.Begin(); - } - } - } - } - [HarmonyPatch(typeof(GameManager), nameof(GameManager.RpcEndGame))] public static class GameManagerPatches {