Decompiled source of AllRevolversFannable v1.0.0

Niko666.AllRevolversFannable.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("Niko666")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Makes all revolvers' hammer fannable.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Niko666.AllRevolversFannable")]
[assembly: AssemblyTitle("AllRevolversFannable")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace Niko666
{
	[BepInProcess("h3vr.exe")]
	[BepInPlugin("Niko666.AllRevolversFannable", "AllRevolversFannable", "1.0.0")]
	public class AllRevolversFannable : BaseUnityPlugin
	{
		public const string Id = "Niko666.AllRevolversFannable";

		internal static ManualLogSource Logger { get; private set; }

		public static string Name => "AllRevolversFannable";

		public static string Version => "1.0.0";

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Harmony.CreateAndPatchAll(typeof(FanPatch), (string)null);
			Logger.LogMessage((object)("Hello, world! Sent from Niko666.AllRevolversFannable " + Version));
		}
	}
	public static class FanPatch
	{
		[HarmonyPatch(typeof(Revolver), "Awake")]
		[HarmonyPrefix]
		public static bool RevolverAwakePrefix(Revolver __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Expected O, but got Unknown
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance.HammerFanDir == (Object)null)
			{
				GameObject val = new GameObject("tempHammerFanDir");
				val.transform.parent = ((Component)__instance).transform;
				if ((Object)(object)__instance.Hammer != (Object)null)
				{
					val.transform.localPosition = ((Component)__instance.Hammer).transform.localPosition + new Vector3(0f, 0.035f, -0.022f);
				}
				else
				{
					val.transform.localPosition = ((Component)__instance).transform.localPosition + new Vector3(0f, 0.076f, 0f);
				}
				val.transform.localRotation = Quaternion.Euler(40f, -180f, 0f);
				__instance.HammerFanDir = val.transform;
			}
			if ((Object)(object)__instance.RecockingPiece == (Object)null)
			{
				GameObject val2 = new GameObject("tempRecockingPiece");
				val2.transform.parent = ((Component)__instance).transform;
				__instance.RecockingPiece = val2.transform;
			}
			if ((Object)(object)__instance.RecockingPoint_Forward == (Object)null)
			{
				GameObject val3 = new GameObject("tempRecockingPoint_Forward");
				val3.transform.parent = ((Component)__instance).transform;
				val3.transform.localPosition = ((Component)__instance).transform.localPosition + new Vector3(0f, 0.076f, 0f);
				__instance.RecockingPoint_Forward = val3.transform;
			}
			if ((Object)(object)__instance.RecockingPoint_Rearward == (Object)null)
			{
				GameObject val4 = new GameObject("tempRecockingPoint_Rearward");
				val4.transform.parent = ((Component)__instance).transform;
				val4.transform.localPosition = ((Component)__instance).transform.localPosition + new Vector3(0f, 0.076f, 0f);
				__instance.RecockingPoint_Rearward = val4.transform;
			}
			if (!__instance.CanFan)
			{
				__instance.CanFan = true;
			}
			return true;
		}
	}
}