using 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.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Microsoft.CodeAnalysis; using Mirror; using ModSettingsMenu.Api; 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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("DayNightSettings")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DayNightSettings")] [assembly: AssemblyTitle("DayNightSettings")] [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 DayNightSettings { [BepInPlugin("DayNightSettings", "DayNightSettings", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BasePlugin { internal static ManualLogSource Log; public static ConfigEntry PauseDayNight; public static ConfigEntry CurrentTime; internal static Harmony? Harmony { get; set; } public override void Load() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown PauseDayNight = ((BasePlugin)this).Config.Bind("General", "PauseDayNight", false, "Pause the Day/Night cycle"); PauseDayNight.Value = false; PauseDayNight.SettingChanged += delegate { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if ((int)NetworkManager.singleton.mode == 3) { if (PauseDayNight.Value) { SkyManager.SetFixedTime(); } else { SkyManager.ClearFixedTime(); } } }; CurrentTime = ((BasePlugin)this).Config.Bind("General", "CurrentTime", 10f, new ConfigDescription("Current in game time", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 24f), Array.Empty())); CurrentTime.Value = 10f; CurrentTime.SettingChanged += delegate { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if ((int)NetworkManager.singleton.mode == 3) { SkyManager.SetFixedTime(CurrentTime.Value); } }; ModSettingsRegistry.Register("DayNightSettings", new ModSettingsModOptions { Name = "Day Night Settings", Description = "Settings for Day/Night in Big WalkOnly works for the host", Author = "Yorimor", Version = "1.0.0", ThunderstoreTeam = "Yorimor", ThunderstoreModName = "DayNightSettings" }); Patch(); Log = ((BasePlugin)this).Log; ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("DayNightSettings"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!"); } log.LogInfo(val); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("DayNightSettings"); } Harmony.PatchAll(); } internal static void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "DayNightSettings"; public const string PLUGIN_NAME = "DayNightSettings"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace DayNightSettings.Patches { [HarmonyPatch(typeof(SkyManager))] public class GameNetPatches { [HarmonyPatch("Update")] [HarmonyPostfix] public static void PatchUpdate(SkyManager __instance) { Plugin.CurrentTime.Value = Mathf.Round(SkyManager.GetCurrentTime() * 10f) * 0.1f; } [HarmonyPatch("Awake")] [HarmonyPostfix] public static void PatchAwake(SkyManager __instance) { Plugin.PauseDayNight.Value = false; Plugin.CurrentTime.Value = Mathf.Round(SkyManager.GetCurrentTime() * 10f) * 0.1f; } } }