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 LaterNightsFork v1.0.0
LaterNightsFork.dll
Decompiled 5 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using LaterNightsFork.Patches; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LaterNightsFork")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LaterNightsFork")] [assembly: AssemblyTitle("LaterNightsFork")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = 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 LaterNightsFork { [BepInPlugin("atk.lethalcompany.laternights", "Later Nights", "1.0.0")] public class LaterNightsForkMod : BaseUnityPlugin { public const string pluginGuid = "atk.lethalcompany.laternightsfork"; public const string pluginName = "Later Nights Fork"; public const string pluginVersion = "1.0.0"; public static Harmony harmony; public void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown harmony = new Harmony("atk.lethalcompany.laternightsfork"); harmony.PatchAll(typeof(LaterNightsFork.Patches.Patches)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Later Nights Fork mod loaded, God help us all"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LaterNightsFork"; public const string PLUGIN_NAME = "LaterNightsFork"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace LaterNightsFork.Patches { [HarmonyPatch] internal class Patches { private static float realTotalTime; private static float offset; [HarmonyPatch(typeof(TimeOfDay), "Start")] [HarmonyPostfix] public static void Start(ref TimeOfDay __instance) { realTotalTime = __instance.lengthOfHours * (float)__instance.numberOfHours; __instance.numberOfHours = 24; __instance.totalTime = __instance.lengthOfHours * (float)__instance.numberOfHours; offset = (float)(__instance.numberOfHours - 18) / (float)__instance.numberOfHours; } [HarmonyPatch(typeof(TimeOfDay), "MoveTimeOfDay")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> MoveTimeOfDay(IEnumerable<CodeInstruction> instructions) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(Patches), "offset"); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldfld && list[i + 1].opcode == OpCodes.Ldc_R4 && (float)list[i + 1].operand == 0f) { list.Insert(i + 1, new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo)); list.Insert(i + 2, new CodeInstruction(OpCodes.Add, (object)null)); } } return list.AsEnumerable(); } [HarmonyPatch(typeof(HUDManager), "SetClock")] [HarmonyPostfix] public static void SetClock(ref HUDManager __instance, ref string ___newLine, ref string ___amPM, float timeNormalized, float numberOfHours, bool createNewLine = true) { int num = (int)(timeNormalized * (60f * numberOfHours)) + 360; int num2 = (int)Mathf.Floor((float)(num / 60)); if (!createNewLine) { ___newLine = " "; } else { ___newLine = "\n"; } ___amPM = ___newLine + "AM"; if (num2 >= 24) { num2 %= 24; } if (num2 < 12) { ___amPM = ___newLine + "AM"; } else { ___amPM = ___newLine + "PM"; } if (num2 > 12) { num2 %= 12; } int num3 = num % 60; string text = $"{num2:00}:{num3:00}" + ___amPM; ((TMP_Text)__instance.clockNumber).text = text; } [HarmonyPatch(typeof(RoundManager), "SpawnEnemiesOutside")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SpawnEnemiesOutside(IEnumerable<CodeInstruction> instructions) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(TimeOfDay), "totalTime"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(Patches), "realTotalTime"); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo, false)) { list[i] = new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo2); list.RemoveAt(i - 1); list.RemoveAt(i - 2); i -= -2; } } return list.AsEnumerable(); } [HarmonyPatch(typeof(RoundManager), "SpawnDaytimeEnemiesOutside")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SpawnDaytimeEnemiesOutside(IEnumerable<CodeInstruction> instructions) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(TimeOfDay), "totalTime"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(Patches), "realTotalTime"); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo, false)) { list[i] = new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo2); list.RemoveAt(i - 1); list.RemoveAt(i - 2); i -= -2; } } return list.AsEnumerable(); } [HarmonyPatch(typeof(RoundManager), "SpawnRandomDaytimeEnemy")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SpawnRandomDaytimeEnemy(IEnumerable<CodeInstruction> instructions) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(TimeOfDay), "totalTime"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(TimeOfDay), "normalizedTimeOfDay"); FieldInfo fieldInfo3 = AccessTools.Field(typeof(Patches), "realTotalTime"); FieldInfo fieldInfo4 = AccessTools.Field(typeof(Patches), "offset"); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo, false)) { list[i] = new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo3); list.RemoveAt(i - 1); list.RemoveAt(i - 2); i -= -2; } else if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo2, false)) { list.Insert(i + 1, new CodeInstruction(OpCodes.Add, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo4)); } } return list.AsEnumerable(); } [HarmonyPatch(typeof(RoundManager), "AssignRandomEnemyToVent")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> AssignRandomEnemyToVent(IEnumerable<CodeInstruction> instructions) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(TimeOfDay), "totalTime"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(TimeOfDay), "normalizedTimeOfDay"); FieldInfo fieldInfo3 = AccessTools.Field(typeof(Patches), "realTotalTime"); FieldInfo fieldInfo4 = AccessTools.Field(typeof(Patches), "offset"); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo, false)) { list[i] = new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo3); list.RemoveAt(i - 1); i++; } else if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo2, false)) { list.Insert(i + 1, new CodeInstruction(OpCodes.Add, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo4)); } } return list.AsEnumerable(); } [HarmonyPatch(typeof(RoundManager), "AdvanceHourAndSpawnNewBatchOfEnemies")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> AdvanceHourAndSpawnNewBatchOfEnemies(IEnumerable<CodeInstruction> instructions) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(TimeOfDay), "totalTime"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(TimeOfDay), "normalizedTimeOfDay"); FieldInfo fieldInfo3 = AccessTools.Field(typeof(Patches), "realTotalTime"); FieldInfo fieldInfo4 = AccessTools.Field(typeof(Patches), "offset"); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo, false)) { list[i] = new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo3); list.RemoveAt(i - 1); list.RemoveAt(i - 2); i -= -2; } else if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo2, false)) { list.Insert(i + 1, new CodeInstruction(OpCodes.Add, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo4)); } } return list.AsEnumerable(); } } }