Decompiled source of MeloncorpBoxes v1.0.11

MeloncorpBoxes.dll

Decompiled 4 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using FistVR;
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 AmmoBox;

public class MagazineBox : FVRFireArmMagazine
{
	public override void UpdateInteraction(FVRViveHand hand)
	{
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_0362: Unknown result type (might be due to invalid IL or missing references)
		//IL_0367: Unknown result type (might be due to invalid IL or missing references)
		//IL_036d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0387: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: 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_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: Unknown result type (might be due to invalid IL or missing references)
		//IL_047b: Unknown result type (might be due to invalid IL or missing references)
		//IL_049a: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0404: Unknown result type (might be due to invalid IL or missing references)
		//IL_0409: Unknown result type (might be due to invalid IL or missing references)
		//IL_0431: Unknown result type (might be due to invalid IL or missing references)
		//IL_0436: Unknown result type (might be due to invalid IL or missing references)
		//IL_044f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02df: Unknown result type (might be due to invalid IL or missing references)
		//IL_0327: Unknown result type (might be due to invalid IL or missing references)
		//IL_024d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_0278: Unknown result type (might be due to invalid IL or missing references)
		//IL_027d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0294: Unknown result type (might be due to invalid IL or missing references)
		((FVRFireArmMagazine)this).UpdateInteraction(hand);
		if (!base.CanManuallyEjectRounds || !((Object)(object)base.RoundEjectionPos != (Object)null) || !((FVRFireArmMagazine)this).HasARound())
		{
			return;
		}
		bool flag = false;
		if (((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)this).m_hand.Input.BYButtonDown)
		{
			flag = true;
		}
		else if (!((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)this).m_hand.Input.TouchpadDown && (double)Vector2.Angle(((FVRInteractiveObject)this).m_hand.Input.TouchpadAxes, Vector2.down) < 45.0)
		{
			flag = true;
		}
		if (!flag)
		{
			return;
		}
		if ((Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable == (Object)null && ((FVRInteractiveObject)this).m_hand.OtherHand.Input.IsGrabbing && (double)Vector3.Distance(base.RoundEjectionPos.position, ((HandInput)(ref ((FVRInteractiveObject)this).m_hand.OtherHand.Input)).Pos) < 0.150000005960464)
		{
			FVRFireArmRound component = Object.Instantiate<GameObject>(((FVRFireArmMagazine)this).RemoveRound(false), base.RoundEjectionPos.position, base.RoundEjectionPos.rotation).GetComponent<FVRFireArmRound>();
			((FVRPhysicalObject)component).SetIFF(GM.CurrentPlayerBody.GetPlayerIFF());
			((FVRInteractiveObject)this).m_hand.OtherHand.ForceSetInteractable((FVRInteractiveObject)(object)component);
			((FVRInteractiveObject)component).BeginInteraction(((FVRInteractiveObject)this).m_hand.OtherHand);
			if (((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable is FVRFireArmRound && ((FVRFireArmRound)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).RoundType == base.RoundType && ((FVRFireArmRound)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).ProxyRounds.Count < ((FVRFireArmRound)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).MaxPalmedAmount && (double)Vector3.Distance(((HandInput)(ref ((FVRInteractiveObject)this).m_hand.Input)).Pos, ((HandInput)(ref ((FVRInteractiveObject)this).m_hand.OtherHand.Input)).Pos) < 0.2)
			{
				while (base.m_numRounds != 0 && ((FVRFireArmRound)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).ProxyRounds.Count < ((FVRFireArmRound)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).MaxPalmedAmount)
				{
					FireArmRoundClass lR_Class = base.LoadedRounds[base.m_numRounds - 1].LR_Class;
					FVRObject lR_ObjectWrapper = base.LoadedRounds[base.m_numRounds - 1].LR_ObjectWrapper;
					((FVRFireArmRound)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).AddProxy(lR_Class, lR_ObjectWrapper);
					((FVRFireArmRound)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).UpdateProxyDisplay();
					((FVRFireArmMagazine)this).RemoveRound();
				}
				if ((Object)(object)base.FireArm != (Object)null)
				{
					base.FireArm.PlayAudioEvent((FirearmAudioEventType)29, 1f);
				}
				else
				{
					SM.PlayGenericSound(base.Profile.MagazineEjectRound, ((Component)this).transform.position);
				}
			}
		}
		else if (((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable is FVRFireArmRound && ((FVRFireArmRound)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).RoundType == base.RoundType && ((FVRFireArmRound)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).ProxyRounds.Count < ((FVRFireArmRound)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).MaxPalmedAmount && (double)Vector3.Distance(((HandInput)(ref ((FVRInteractiveObject)this).m_hand.Input)).Pos, ((HandInput)(ref ((FVRInteractiveObject)this).m_hand.OtherHand.Input)).Pos) < 0.2)
		{
			while (base.m_numRounds != 0 && ((FVRFireArmRound)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).ProxyRounds.Count < ((FVRFireArmRound)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).MaxPalmedAmount)
			{
				FireArmRoundClass lR_Class2 = base.LoadedRounds[base.m_numRounds - 1].LR_Class;
				FVRObject lR_ObjectWrapper2 = base.LoadedRounds[base.m_numRounds - 1].LR_ObjectWrapper;
				((FVRFireArmRound)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).AddProxy(lR_Class2, lR_ObjectWrapper2);
				((FVRFireArmRound)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).UpdateProxyDisplay();
				((FVRFireArmMagazine)this).RemoveRound();
			}
			if ((Object)(object)base.FireArm != (Object)null)
			{
				base.FireArm.PlayAudioEvent((FirearmAudioEventType)29, 1f);
			}
			else
			{
				SM.PlayGenericSound(base.Profile.MagazineEjectRound, ((Component)this).transform.position);
			}
		}
	}
}
[BepInPlugin("Melon.MeloncorpBoxes", "MeloncorpBoxes", "1.0.11")]
[BepInProcess("h3vr.exe")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class MeloncorpBoxesPlugin : BaseUnityPlugin
{
	private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

	private void Awake()
	{
		LoadAssets();
	}

	private void LoadAssets()
	{
		OtherLoader.RegisterDirectLoad(BasePath, "Melon.MeloncorpBoxes", "", "", "boxes", "");
	}
}