Decompiled source of 12GaugeHell v1.0.0

12GaugeHell.dll

Decompiled a day ago
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using UnityEngine;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace Volks.12GaugeHell;

[BepInPlugin("Volks.12GaugeHell", "12GaugeHell", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class 12GaugeHellPlugin : BaseUnityPlugin
{
	private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

	internal static ManualLogSource Logger;

	private void Awake()
	{
		Logger = ((BaseUnityPlugin)this).Logger;
		LoadAssets();
	}

	private void LoadAssets()
	{
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Volks.12GaugeHell");
		OtherLoader.RegisterDirectLoad(BasePath, "Volks.12GaugeHell", "", "", "12gaugehell", "");
	}
}
internal class AutoReleaseOnMagLoad : MonoBehaviour
{
	private FVRFireArm weapon;

	private Handgun handgun;

	private bool wasLoaded;

	public void Start()
	{
		weapon = ((Component)this).GetComponent<FVRFireArm>();
		if (!((Object)(object)weapon == (Object)null) && weapon is Handgun)
		{
			ref Handgun reference = ref handgun;
			FVRFireArm obj = weapon;
			reference = (Handgun)(object)((obj is Handgun) ? obj : null);
		}
	}

	public void FixedUpdate()
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Invalid comparison between Unknown and I4
		if ((Object)(object)handgun != (Object)null)
		{
			if ((Object)(object)weapon.Magazine != (Object)null)
			{
				if (weapon.Magazine.HasARound())
				{
					if ((int)handgun.Slide.CurPos >= 2 && !wasLoaded)
					{
						handgun.Slide.ImpartFiringImpulse();
						wasLoaded = true;
					}
				}
				else
				{
					wasLoaded = false;
				}
			}
			else
			{
				wasLoaded = false;
			}
		}
		else
		{
			wasLoaded = false;
		}
	}
}