Decompiled source of HK VP70 v1.0.0

HK_VP70.dll

Decompiled a year ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using OtherLoader;
using UnityEngine;
using UnityEngine.UI;

[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 cityrobo.HK_VP70;

[BepInPlugin("cityrobo.HK_VP70", "HK_VP70", "1.0.3")]
[BepInProcess("h3vr.exe")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class HK_VP70Plugin : BaseUnityPlugin
{
	private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

	private void Awake()
	{
		LoadAssets();
	}

	private void LoadAssets()
	{
		OtherLoader.RegisterDirectLoad(BasePath, "cityrobo.HK_VP70", "", "", "hk_vp70", "");
	}
}
public class SaveSourceImage : MonoBehaviour
{
	public bool Save = false;

	public Image image;

	private void Start()
	{
	}

	private void Update()
	{
		if (Save)
		{
			Save = false;
			Sprite sprite = image.sprite;
			Texture2D texture = sprite.texture;
			byte[] bytes = texture.EncodeToPNG();
			File.WriteAllBytes("C:/Item Images/Background.png", bytes);
		}
	}
}

HK_VP70_Stock.dll

Decompiled a year ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using FistVR;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("HK_VP70_Stock")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HK_VP70_Stock")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f15e12b7-d3db-48bd-8f44-76a9f8abf06c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Cityrobo;

public class HK_VP70_Stock_Interface : AttachableStock
{
	public override void OnAttach()
	{
		((AttachableStock)this).OnAttach();
		(((FVRFireArmAttachmentInterface)this).Attachment as HK_VP70_Stock).AddBurst();
	}

	public override void OnDetach()
	{
		((AttachableStock)this).OnDetach();
		(((FVRFireArmAttachmentInterface)this).Attachment as HK_VP70_Stock).RemoveBurst();
	}
}
public class HK_VP70_Stock : FVRFireArmAttachment
{
	[Header("Stock Config")]
	public Transform FireSelector;

	public float ModeSingle;

	public float ModeBurst;

	public int BurstAmount = 3;

	public Transform StockLatch;

	public float LatchUnheld;

	public float LatchHeld;

	public Transform StockCap;

	public AR15HandleSightFlipper SightFlipper;

	public FVRQuickBeltSlot QBSlot;

	private Handgun _handgun;

	private FireSelectorMode[] _originalHandgunFireModes;

	private bool _handgunHadFireSelectorButton;

	public override bool CanDetach()
	{
		if ((Object)(object)_handgun != (Object)null && _handgun.FireSelectorModeIndex == 1)
		{
			return false;
		}
		return ((FVRFireArmAttachment)this).CanDetach();
	}

	public void AddBurst()
	{
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Expected O, but got Unknown
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		ref Handgun handgun = ref _handgun;
		FVRPhysicalObject myObject = base.curMount.GetRootMount().MyObject;
		handgun = (Handgun)(object)((myObject is Handgun) ? myObject : null);
		if ((Object)(object)_handgun != (Object)null)
		{
			_originalHandgunFireModes = _handgun.FireSelectorModes;
			_handgunHadFireSelectorButton = _handgun.HasFireSelector;
			if (!_handgunHadFireSelectorButton)
			{
				_handgun.HasFireSelector = true;
				_handgun.FireSelector = new GameObject("FireSelector").transform;
			}
			FireSelectorMode val = new FireSelectorMode();
			val.ModeType = (FireSelectorModeType)4;
			val.BurstAmount = BurstAmount;
			_handgun.FireSelectorModes = _handgun.FireSelectorModes.Concat((IEnumerable<FireSelectorMode>)(object)new FireSelectorMode[1] { val }).ToArray();
		}
	}

	public void RemoveBurst()
	{
		if ((Object)(object)_handgun != (Object)null)
		{
			_handgun.m_fireSelectorMode = _originalHandgunFireModes.Length - 1;
			_handgun.FireSelectorModes = _originalHandgunFireModes;
			if (!_handgunHadFireSelectorButton)
			{
				Object.Destroy((Object)(object)((Component)_handgun.FireSelector).gameObject);
				_handgun.HasFireSelector = false;
			}
		}
	}

	public override void FVRUpdate()
	{
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: 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_0124: Unknown result type (might be due to invalid IL or missing references)
		((FVRPhysicalObject)this).FVRUpdate();
		if ((Object)(object)_handgun != (Object)null)
		{
			switch (_handgun.FireSelectorModeIndex)
			{
			case 0:
				FireSelector.localRotation = Quaternion.Euler(ModeSingle, 0f, 0f);
				break;
			case 1:
				FireSelector.localRotation = Quaternion.Euler(ModeBurst, 0f, 0f);
				break;
			}
		}
		if (((FVRInteractiveObject)this).IsHeld)
		{
			StockLatch.localPosition = new Vector3(StockLatch.localPosition.x, StockLatch.localPosition.y, LatchHeld);
		}
		else if (((FVRInteractiveObject)base.AttachmentInterface).IsHeld && ((FVRInteractiveObject)base.AttachmentInterface).m_hand.Input.TouchpadPressed && Vector2.Angle(((FVRInteractiveObject)base.AttachmentInterface).m_hand.Input.TouchpadAxes, Vector2.down) < 45f)
		{
			StockLatch.localPosition = new Vector3(StockLatch.localPosition.x, StockLatch.localPosition.y, LatchHeld);
		}
		else
		{
			StockLatch.localPosition = new Vector3(StockLatch.localPosition.x, StockLatch.localPosition.y, LatchUnheld);
		}
		if ((Object)(object)QBSlot.HeldObject != (Object)null && (Object)(object)((FVRPhysicalObject)this).QuickbeltSlot != (Object)null)
		{
			((Component)this).gameObject.layer = LayerMask.NameToLayer("NoCol");
			((Component)QBSlot).gameObject.layer = LayerMask.NameToLayer("Interactable");
			((FVRPhysicalObject)this).QuickbeltSlot.IsSelectable = false;
		}
		else if ((Object)(object)QBSlot.HeldObject == (Object)null && (Object)(object)((FVRPhysicalObject)this).QuickbeltSlot != (Object)null)
		{
			((Component)this).gameObject.layer = LayerMask.NameToLayer("Interactable");
			((Component)QBSlot).gameObject.layer = LayerMask.NameToLayer("Interactable");
			((FVRPhysicalObject)this).QuickbeltSlot.IsSelectable = true;
		}
		else
		{
			((Component)this).gameObject.layer = LayerMask.NameToLayer("Interactable");
		}
		if (!SightFlipper.m_isLargeAperture)
		{
			QBSlot.IsSelectable = true;
			if ((Object)(object)QBSlot.HeldObject != (Object)null)
			{
				FVRInteractiveObject heldObject = QBSlot.HeldObject;
				Handgun val = (Handgun)(object)((heldObject is Handgun) ? heldObject : null);
				if (val != null && ((Component)val.Slide).gameObject.layer != LayerMask.NameToLayer("Interactable"))
				{
					((Component)val.Slide).gameObject.layer = LayerMask.NameToLayer("Interactable");
				}
			}
			return;
		}
		QBSlot.IsSelectable = false;
		if ((Object)(object)QBSlot.HeldObject != (Object)null)
		{
			FVRInteractiveObject heldObject2 = QBSlot.HeldObject;
			Handgun val2 = (Handgun)(object)((heldObject2 is Handgun) ? heldObject2 : null);
			if (val2 != null && ((Component)val2.Slide).gameObject.layer != LayerMask.NameToLayer("NoCol"))
			{
				((Component)val2.Slide).gameObject.layer = LayerMask.NameToLayer("NoCol");
			}
		}
	}
}
[BepInPlugin("h3vr.cityrobo.HK_VP70_Stock", "Heckler&Koch VP70 Script", "1.0.1")]
internal class HK_VP70_Stock_BepInEx : BaseUnityPlugin
{
	private HK_VP70_Stock_BepInEx()
	{
	}
}