Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LcApparatusTimer v1.0.1
LcApparatusTimer.dll
Decompiled a year agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Timer")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Timer")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ba7b3d8e-e4a5-4ae1-ac15-ffde76cbcaa7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace LcCountdownTimer.Patches; [BepInPlugin("LcApparatusTimer", "LcApparatusTimer", "0.1.0")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; private void Awake() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Log = Logger.CreateLogSource("Rissoe.LcApparatusTimer"); Harmony val = new Harmony("LcCountdownTimer"); val.PatchAll(typeof(PluginInfo)); val.PatchAll(typeof(CountdownTimerPatch)); val.PatchAll(typeof(LungPropPatch)); val.PatchAll(typeof(ResetTimer)); val.PatchAll(typeof(ResetTimerOnceAgain)); Log.LogInfo((object)"Plugin LcApparatusTimer is loaded!"); } } public static class PluginInfo { public static double TimeLeft; public const string PLUGIN_GUID = "LcApparatusTimer"; public const string PLUGIN_NAME = "LcApparatusTimer"; public const string PLUGIN_VERSION = "0.1.0"; } [HarmonyPatch(typeof(LungProp))] internal class LungPropPatch { [HarmonyPatch("EquipItem")] [HarmonyPrefix] public static void EquipItemPatch(ref bool ___isLungDocked) { if (___isLungDocked && PluginInfo.TimeLeft == 0.0) { PluginInfo.TimeLeft = 110.0; Plugin.Log.LogInfo((object)"LcApparatusTimer: ACTIVATED"); } } } [HarmonyPatch(typeof(StartOfRound))] internal static class ResetTimer { [HarmonyPatch("EndOfGame")] [HarmonyPrefix] public static void NoMoreTimer() { PluginInfo.TimeLeft = 0.0; } } [HarmonyPatch(typeof(GameNetworkManager))] internal static class ResetTimerOnceAgain { [HarmonyPatch("StartDisconnect")] [HarmonyPostfix] public static void PlayerLeave() { CountdownTimerPatch.timerMade = false; } } internal class CountdownTimerPatch { private static GameObject _timerObject; private static TextMeshProUGUI _timerTextMesh; private static float _lastUpdated; public static bool timerMade; [HarmonyPatch(typeof(TimeOfDay), "Update")] [HarmonyPostfix] public static void Update(TimeOfDay __instance) { //IL_010c: Unknown result type (might be due to invalid IL or missing references) _lastUpdated += Time.deltaTime; if (_lastUpdated < 0.5f) { return; } _lastUpdated = 0f; if (!timerMade && !CreateTimerObject()) { return; } if (PluginInfo.TimeLeft == 0.0) { ((TMP_Text)_timerTextMesh).text = ""; return; } if (PluginInfo.TimeLeft <= 0.0) { PluginInfo.TimeLeft = 0.0; } else { PluginInfo.TimeLeft -= 0.5; } int num = (int)Math.Floor(PluginInfo.TimeLeft / 60.0); int num2 = (int)Math.Floor(PluginInfo.TimeLeft % 60.0); ((TMP_Text)_timerTextMesh).text = $"{num:D2}:{num2:D2}"; ((Graphic)_timerTextMesh).color = Color.red; } private static bool CreateTimerObject() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/TopRightCorner/ControlTip1"); GameObject val2 = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/TopRightCorner/ControlTip2"); _timerObject = Object.Instantiate<GameObject>(val.gameObject, val.transform.parent, false); ((Object)_timerObject).name = "LcCountdownTimer"; float num = val.transform.position.y - val2.transform.position.y; _timerObject.transform.Translate(0f, num, 0f); _timerTextMesh = _timerObject.GetComponentInChildren<TextMeshProUGUI>(); Plugin.Log.LogInfo((object)"LcApparatusTimer created"); timerMade = true; return true; } }