Decompiled source of KilnLavaRiverRestoreForTFA v1.0.1

KilnFix/KilnMod.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("KilnMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("KilnMod")]
[assembly: AssemblyTitle("KilnMod")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace KilnMod
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "KilnMod";

		public const string PLUGIN_NAME = "KilnMod";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace RestoreKilnLava
{
	[BepInPlugin("com.custom.restorekilnlava", "Restore Kiln Lava Falls", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class RestoreKilnLavaPlugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			Harmony val = new Harmony("com.custom.restorekilnlava");
			Type type = AccessTools.TypeByName("TrueFinalAscent.FinalAscentKilnLava");
			if (type == null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Could not find TrueFinalAscent.FinalAscentKilnLava!");
				return;
			}
			MethodInfo methodInfo = AccessTools.Method(type, "Clear", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(RestoreKilnLavaPlugin), "PreventLavaClearPrefix", (Type[])null, (Type[])null);
			if (methodInfo != null && methodInfo2 != null)
			{
				val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully patched TrueFinalAscent: Kiln lava falls will now spawn!");
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to hook FinalAscentKilnLava.Clear() method.");
			}
		}

		private static bool PreventLavaClearPrefix()
		{
			return false;
		}
	}
}