Decompiled source of NiceAutopilot v1.0.1

NiceAutopilot.dll

Decompiled 4 months ago
using 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 NiceAutopilot.Patches;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ChocoQuota")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ChocoQuota")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d38d2064-347b-417a-a052-2ecb101156a1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NiceAutopilot
{
	[BepInPlugin("Jade.NiceAutopilot", "NiceAutopilot", "1.0.1")]
	public class ModBase : BaseUnityPlugin
	{
		private const string modGUID = "Jade.NiceAutopilot";

		private const string modName = "NiceAutopilot";

		private const string modVersion = "1.0.1";

		private readonly Harmony harmony = new Harmony("Jade.NiceAutopilot");

		public static ModBase Instance;

		internal ManualLogSource als;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			als = Logger.CreateLogSource("Jade.NiceAutopilot");
			als.LogInfo((object)":");
			als.LogInfo((object)"NiceAutopilot has loaded!");
			als.LogInfo((object)":");
			harmony.PatchAll(typeof(ModBase));
			harmony.PatchAll(typeof(TimeOfDayPatch));
		}
	}
}
namespace NiceAutopilot.Patches
{
	[HarmonyPatch(typeof(TimeOfDay))]
	internal class TimeOfDayPatch : NetworkBehaviour
	{
		[HarmonyPatch("TimeOfDayEvents")]
		[HarmonyPrefix]
		private static bool EventsPatch(ref float ___currentDayTime, ref float ___totalTime, ref DayMode ___dayMode, ref DayMode ___dayModeLastTimePlayerWasOutside)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected I4, but got Unknown
			Traverse val = Traverse.Create((object)TimeOfDay.Instance);
			___dayMode = (DayMode)(int)TimeOfDay.Instance.GetDayPhase(___currentDayTime / ___totalTime);
			if ((int)___dayMode > (int)___dayModeLastTimePlayerWasOutside)
			{
				val.Method("PlayerSeesNewTimeOfDay", Array.Empty<object>());
			}
			return false;
		}
	}
}