Decompiled source of CustomJesterTimer v1.0.0

CustomJesterTimer.dll

Decompiled 8 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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
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("CustomJesterTimer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomJesterTimer")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a6491a00-1343-4677-8f93-c6f82daaa042")]
[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 CustomJesterTimer;

[BepInPlugin("ironbean.CustomJesterTimer", "Custom Jester Timer", "1.0.0")]
public class JesterTimerMod : BaseUnityPlugin
{
	[HarmonyPatch(typeof(JesterAI))]
	internal class JesterPatch
	{
		[HarmonyPatch("SetJesterInitialValues")]
		[HarmonyPostfix]
		private static void CrankinPatch(JesterAI __instance)
		{
			__instance.beginCrankingTimer = Random.Range(minTimer.Value, maxTimer.Value);
		}
	}

	private const string modGUID = "ironbean.CustomJesterTimer";

	private const string modName = "Custom Jester Timer";

	private const string modVersion = "1.0.0";

	private readonly Harmony harmony = new Harmony("ironbean.CustomJesterTimer");

	internal static JesterTimerMod Instance;

	internal static ManualLogSource mls;

	private static ConfigEntry<float> minTimer;

	private static ConfigEntry<float> maxTimer;

	private void Awake()
	{
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Expected O, but got Unknown
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Expected O, but got Unknown
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		mls = Logger.CreateLogSource("ironbean.CustomJesterTimer");
		mls.LogInfo((object)"Custom Jester Timer");
		minTimer = ((BaseUnityPlugin)Instance).Config.Bind<float>("Values", "MinCrankTimer", 13f, new ConfigDescription("The minimum amount of time until a Jester begins cranking, in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 120f), Array.Empty<object>()));
		maxTimer = ((BaseUnityPlugin)Instance).Config.Bind<float>("Values", "MaxCrankTimer", 21f, new ConfigDescription("The maximum amount of time until a Jester begins cranking, in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 120f), Array.Empty<object>()));
		harmony.PatchAll(typeof(JesterTimerMod));
		harmony.PatchAll(typeof(JesterPatch));
	}
}