Please disclose if any significant portion of your mod was created 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 Ragnavik v1.1.11
plugins/RagnavikSleepTimer/RagnavikSleepTimer.dll
Decompiled 4 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RagnavikSleepTimer")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+3e529da9c707af6a0991f6141d8c3ed164d7e36e")] [assembly: AssemblyProduct("RagnavikSleepTimer")] [assembly: AssemblyTitle("RagnavikSleepTimer")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RagnavikSleepTimer { [BepInPlugin("LostKode.RagnavikSleepTimer", "Ragnavik Sleep Timer", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class SleepTimerPlugin : BaseUnityPlugin { public const string PluginGuid = "LostKode.RagnavikSleepTimer"; private Harmony? _harmony; private static float _warningEndsAt; private static bool _warningActive; private void Awake() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown Type type = AccessTools.TypeByName("SleepSkip.SleepSkipPlugin"); if (type == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"SleepSkip type was not found; sleep timer is disabled."); return; } MethodInfo methodInfo = AccessTools.Method(type, "UpdateWarningTime", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(type, "ResetVariables", (Type[])null, (Type[])null); MethodInfo methodInfo3 = AccessTools.Method(type, "OpenMenuOnClient", (Type[])null, (Type[])null); if (methodInfo == null || methodInfo2 == null || methodInfo3 == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"SleepSkip warning methods were not found; sleep timer is disabled."); return; } _harmony = new Harmony("LostKode.RagnavikSleepTimer"); _harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(SleepTimerPlugin), "OnWarningUpdated", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(SleepTimerPlugin), "OnWarningFinished", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _harmony.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, new HarmonyMethod(typeof(SleepTimerPlugin), "OnWarningFinished", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Persistent SleepSkip warning countdown is active."); } private static void OnWarningUpdated(int time) { _warningActive = time > 0; _warningEndsAt = Time.realtimeSinceStartup + (float)Math.Max(0, time); } private static void OnWarningFinished() { _warningActive = false; } private void OnGUI() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (_warningActive) { int num = Mathf.CeilToInt(_warningEndsAt - Time.realtimeSinceStartup); if (num <= 0) { _warningActive = false; } else { GUI.Box(new Rect(((float)Screen.width - 270f) / 2f, 90f, 270f, 40f), $"Sleep vote starts in {num}s"); } } } private void OnDestroy() { _warningActive = false; Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } }