Decompiled source of CrystalPerspectiveLock v0.1.1

CrystalPerspectiveLock.dll

Decompiled a day 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.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("CrystalPerspectiveLock")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CrystalPerspectiveLock")]
[assembly: AssemblyTitle("CrystalPerspectiveLock")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 CrystalPerspectiveLock
{
	[BepInPlugin("lch.crystalperspectivelock", "CrystalPerspectiveLock", "0.1.1")]
	public class CrystalPerspectiveLockPlugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(CrystalBallValuable), "Start")]
		private static class StartPatch
		{
			public static void Postfix(CrystalBallValuable __instance)
			{
				if (_fMin != null)
				{
					_fMin.SetValue(__instance, 0f);
				}
				if (_fMax != null)
				{
					_fMax.SetValue(__instance, 0f);
				}
			}
		}

		[HarmonyPatch(typeof(CrystalBallValuable), "Update")]
		private static class UpdatePatch
		{
			public static bool Prefix()
			{
				return false;
			}
		}

		public const string GUID = "lch.crystalperspectivelock";

		public const string MODNAME = "CrystalPerspectiveLock";

		public const string VERSION = "0.1.1";

		private static readonly FieldInfo _fMin = typeof(CrystalBallValuable).GetField("lensDistortionMinIntensity", BindingFlags.Instance | BindingFlags.NonPublic);

		private static readonly FieldInfo _fMax = typeof(CrystalBallValuable).GetField("lensDistortionMaxIntensity", BindingFlags.Instance | BindingFlags.NonPublic);

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				new Harmony("lch.crystalperspectivelock").PatchAll();
			}
			catch
			{
			}
		}
	}
}