Decompiled source of InfiniteTorch v1.0.1

InfiniteTorch.dll

Decompiled 21 hours ago
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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
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("CheekyEntity")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A simple quality-of-life mod for Cave Crawlers that grants torches infinite duration.")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+36e2883cfcbf56a08475f22aac34b90ceb2967cb")]
[assembly: AssemblyProduct("InfiniteTorch")]
[assembly: AssemblyTitle("InfiniteTorch")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 InfiniteTorch
{
	[BepInPlugin("InfiniteTorch", "InfiniteTorch", "1.0.1")]
	public class Plugin : BasePlugin
	{
		internal static ManualLogSource Log;

		public static bool HasShownWelcomePopup;

		public override void Load()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			Log = ((BasePlugin)this).Log;
			Harmony val = new Harmony("InfiniteTorch");
			val.PatchAll();
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(27, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("InfiniteTorch");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" by CheekyEntity is loaded!");
			}
			log.LogInfo(val2);
		}
	}
	[HarmonyPatch(typeof(Torch), "Start")]
	public static class TorchStartPatch
	{
		[HarmonyPostfix]
		public static void Postfix(Torch __instance)
		{
			if (__instance.info != null)
			{
				__instance.info.infiniteDuration = true;
			}
			__instance.FreezeDuration = true;
			if (!Plugin.HasShownWelcomePopup && (Object)(object)Singleton<MasterUI>.Instance != (Object)null)
			{
				Singleton<MasterUI>.Instance.CreatePopUp("Torch Blessed: Infinite Light!", new Nullable<Color>(), true, 3f);
				Plugin.HasShownWelcomePopup = true;
				Plugin.Log.LogInfo((object)"Shown infinite torch welcome message.");
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "InfiniteTorch";

		public const string PLUGIN_NAME = "InfiniteTorch";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}