Due to update 2.4.3, some mods may no longer function. FixedConfig may be necessary.
Decompiled source of SuddenDeathTimer v1.0.0
SuddenDeathTimer.DLL
Decompiled a year agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyCompany("SuddenDeathTimer")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Displays a timer on the top of the screen indicating how long until Sudden Death begins.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SuddenDeathTimer")] [assembly: AssemblyTitle("SuddenDeathTimer")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace SuddenDeathTimer; [BepInPlugin("me.antimality.SuddenDeathTimer", "SuddenDeathTimer", "1.0.0")] public class Plugin : BaseUnityPlugin { private static ManualLogSource logger; private static Harmony harmony; private static TextMeshProUGUI textComp; private void Awake() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown logger = ((BaseUnityPlugin)this).Logger; logger.LogInfo((object)"Plugin SuddenDeathTimer is loaded!"); harmony = new Harmony("me.antimality.SuddenDeathTimer"); harmony.PatchAll(typeof(Patch)); } internal static void Log(string message, bool err = false) { if (err) { logger.LogError((object)message); } else { logger.LogInfo((object)message); } } private void OnDestroy() { harmony.UnpatchSelf(); Patch.Timer.Dispose(); } } [HarmonyPatch] public class Patch { internal class Timer { private static Timer instance = null; private GameObject textObj; private TextMeshProUGUI textComp; private static int maxTime = 120; internal Timer() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Dispose(); instance = this; maxTime = (int)(long)GetGameSessionHandler().TimeBeforeSuddenDeath; Canvas component = GameObject.Find("AbilitySelectCanvas").GetComponent<Canvas>(); if ((Object)(object)component == (Object)null) { throw new MissingReferenceException("Game canvas doesn't exist yet!"); } textObj = new GameObject("TimeStopTimer", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); textObj.transform.SetParent(((Component)component).transform); textComp = textObj.GetComponent<TextMeshProUGUI>(); ((TMP_Text)textComp).fontSize = 50f; ((TMP_Text)textComp).alignment = (TextAlignmentOptions)514; ((TMP_Text)textComp).font = LocalizedText.localizationTable.GetFont(Settings.Get().Language, false); RectTransform component2 = textObj.GetComponent<RectTransform>(); Rect rect = ((Component)component).GetComponent<RectTransform>().rect; float height = ((Rect)(ref rect)).height; component2.anchoredPosition = new Vector2(0f, height / 2f - 50f); textObj.SetActive(true); } internal static void Update() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (instance != null) { int num = (int)(long)Updater.SimTimeSinceLevelLoaded; int num2 = maxTime - num + 1; ((TMP_Text)instance.textComp).text = num2.ToString(); if (GameSessionHandler.HasGameEnded() || num2 <= 0) { Dispose(); } } } internal static void Dispose() { if (instance != null) { Object.Destroy((Object)(object)instance.textObj); } } } [HarmonyPatch(typeof(GameSessionHandler), "SpawnPlayers")] [HarmonyPostfix] public static void SummonTimerTextbox() { new Timer(); } [HarmonyPatch(typeof(GameSessionHandler), "UpdateSim")] [HarmonyPostfix] public static void UpdateTimer() { Timer.Update(); } [HarmonyPatch(typeof(GameSessionHandler), "LeaveGame")] [HarmonyPostfix] public static void DisposeTimer() { Timer.Dispose(); } internal static GameSessionHandler GetGameSessionHandler() { object? value = typeof(GameSessionHandler).GetField("selfRef", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); return (GameSessionHandler)((value is GameSessionHandler) ? value : null); } } public static class PluginInfo { public const string PLUGIN_GUID = "SuddenDeathTimer"; public const string PLUGIN_NAME = "SuddenDeathTimer"; public const string PLUGIN_VERSION = "1.0.0"; }