Decompiled source of Longer Day v1.0.0

plugins/longerDay.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using longerDay.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("longerDay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("longerDay")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6a40fb13-2c78-4d62-9ce4-a4930c323a28")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace longerDay
{
	[BepInPlugin("Damir.longerDayMod", "longerDay", "1.0.0")]
	public class longerDayBase : BaseUnityPlugin
	{
		private const string modGuid = "Damir.longerDayMod";

		private const string modName = "longerDay";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Damir.longerDayMod");

		private static longerDayBase instance;

		internal static ManualLogSource log = new ManualLogSource("longerDayLog");

		public static ConfigEntry<float> timeSpeed;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			Logger.Sources.Add((ILogSource)(object)log);
			timeSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "timeSpeed", 0.5f, "The speed of time, game default is 1f.");
			log.LogInfo((object)$"time speed = {timeSpeed.Value}");
			harmony.PatchAll(typeof(longerDayBase));
			harmony.PatchAll(typeof(TimeOfDayPatch));
		}
	}
}
namespace longerDay.Patches
{
	[HarmonyPatch(typeof(TimeOfDay))]
	internal class TimeOfDayPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		private static void startPatch(ref float ___globalTimeSpeedMultiplier)
		{
			___globalTimeSpeedMultiplier = longerDayBase.timeSpeed.Value;
		}
	}
}