mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-20 01:46:28 +00:00
65 lines
2.0 KiB
C#
65 lines
2.0 KiB
C#
using AmongUs.Data;
|
|
using Hazel;
|
|
using InnerNet;
|
|
using UnityEngine;
|
|
|
|
namespace AmongUsRevamped;
|
|
|
|
[HarmonyPatch(typeof(EndGameManager), nameof(EndGameManager.ShowButtons))]
|
|
public static class EndGameManagerPatch
|
|
{
|
|
public static void Postfix(EndGameManager __instance)
|
|
{
|
|
RpcSetTasksPatch.GlobalTaskIds = null;
|
|
OnGameJoinedPatch.AutoStartCheck = false;
|
|
Main.GameTimer = 0f;
|
|
MurderPlayerPatch.misfireCount.Clear();
|
|
LateTask.Tasks.Clear();
|
|
|
|
EndGameNavigation navigation = __instance.Navigation;
|
|
if (!AmongUsClient.Instance.AmHost || __instance == null || navigation == null || !Options.AutoRejoinLobby.GetBool()) return;
|
|
navigation.NextGame();
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(LogicGameFlowNormal), nameof(LogicGameFlowNormal.CheckEndCriteria))]
|
|
class NormalGameEndChecker
|
|
{
|
|
public static bool Prefix()
|
|
{
|
|
if (Options.NoGameEnd.GetBool()) return false;
|
|
else return true;
|
|
}
|
|
}
|
|
[HarmonyPatch(typeof(LogicGameFlowHnS), nameof(LogicGameFlowHnS.CheckEndCriteria))]
|
|
class HNSGameEndChecker
|
|
{
|
|
public static bool Prefix()
|
|
{
|
|
if (Options.NoGameEnd.GetBool()) return false;
|
|
else return true;
|
|
}
|
|
}
|
|
[HarmonyPatch(typeof(ControllerManager), nameof(ControllerManager.Update))]
|
|
internal class ControllerManagerUpdatePatch
|
|
{
|
|
public static void Postfix()
|
|
{
|
|
if (Input.GetKey(KeyCode.L) && Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.Return))
|
|
{
|
|
MessageWriter writer = AmongUsClient.Instance.StartEndGame();
|
|
writer.Write((byte)GameOverReason.ImpostorDisconnect);
|
|
AmongUsClient.Instance.FinishEndGame(writer);
|
|
}
|
|
|
|
if (Input.GetKey(KeyCode.M) && Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.Return) && Utils.InGame)
|
|
{
|
|
if (Utils.IsMeeting)
|
|
{
|
|
MeetingHud.Instance.RpcClose();
|
|
}
|
|
else
|
|
PlayerControl.LocalPlayer.ReportDeadBody(PlayerControl.LocalPlayer.Data);
|
|
}
|
|
}
|
|
} |