Decompiled source of CameronYaggi1903 v0.1.0

CameronYaggi1903.dll

Decompiled 3 weeks 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 JerryAr.CameronYaggi1903
{
	[BepInPlugin("JerryAr.CameronYaggi1903", "CameronYaggi1903", "0.1.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class CameronYaggi1903Plugin : 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(), "JerryAr.CameronYaggi1903");
			OtherLoader.RegisterDirectLoad(BasePath, "JerryAr.CameronYaggi1903", "", "", "trench1903", "");
		}
	}
}
public class SnapToPoint : MonoBehaviour
{
	public GameObject Obj;

	public GameObject Targ;

	private void Start()
	{
	}

	private void Update()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		Obj.transform.position = Targ.transform.position;
		Obj.transform.rotation = Targ.transform.rotation;
	}
}
namespace JerryTrenchGun
{
	public class PreAttachedAtt : MonoBehaviour
	{
		public FVRObject Item;

		public FVRFireArmAttachment att;

		public FVRFireArmAttachmentMount mount;

		public bool spawned = false;

		private void Start()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if (!spawned)
			{
				GameObject val = Object.Instantiate<GameObject>(((AnvilAsset)Item).GetGameObject(), ((Component)mount).transform.position, ((Component)mount).transform.rotation);
				att = val.GetComponent<FVRFireArmAttachment>();
				att.AttachToMount(mount, true);
				spawned = true;
			}
		}
	}
	public class Trench1903 : MonoBehaviour
	{
		public BoltActionRifle gun;

		public BoltActionRifle_Handle handle1;

		public BoltActionRifle_Handle handle2;

		public Transform stockpos1;

		public Transform stockpos2;

		public Collider colgrab1;

		public Collider colgrab2;

		public Transform trigger1;

		public Transform trigger2;

		public GameObject Frame;

		public GameObject FrameBolt;

		public AR15HandleSightFlipper trig;

		public AudioEvent click;

		public Transform pos1;

		public Transform pos2;

		public Collider colTrig;

		public AR15HandleSightFlipper safety;

		public AR15HandleSightFlipper sight;

		public bool isflippedsafety;

		public bool isflippedsight;

		public GameObject appear;

		public FVRFireArmAttachmentMount mount;

		public Collider boltcol1;

		public Collider boltcol2;

		public GameObject holder;

		public GameObject follower;

		public float up;

		public float down;

		public bool isSwitched;

		private void FixedUpdate()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Invalid comparison between Unknown and I4
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Invalid comparison between Unknown and I4
			//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
			follower.transform.localPosition = new Vector3(0f, -1f * (float)((FVRFireArm)gun).Magazine.m_numRounds / (float)((FVRFireArm)gun).Magazine.m_capacity, 0f);
			if (sight.m_isLargeAperture && isflippedsight)
			{
				SM.PlayCoreSound((FVRPooledAudioType)41, click, ((Component)sight).gameObject.transform.position);
				isflippedsight = false;
			}
			if (!sight.m_isLargeAperture && !isflippedsight)
			{
				SM.PlayCoreSound((FVRPooledAudioType)41, click, ((Component)sight).gameObject.transform.position);
				isflippedsight = true;
			}
			if (safety.m_isLargeAperture)
			{
				if (isflippedsafety)
				{
					SM.PlayCoreSound((FVRPooledAudioType)41, click, ((Component)safety).gameObject.transform.position);
					isflippedsafety = false;
				}
				gun.m_fireSelectorMode = 0;
			}
			if (!safety.m_isLargeAperture)
			{
				if (!isflippedsafety)
				{
					SM.PlayCoreSound((FVRPooledAudioType)41, click, ((Component)safety).gameObject.transform.position);
					isflippedsafety = true;
				}
				gun.m_fireSelectorMode = 1;
			}
			if ((int)handle1.HandleState == 0 && (int)handle1.HandleRot == 2 && (int)handle2.HandleState == 0 && (int)handle2.HandleRot == 2)
			{
				if (mount.HasAttachmentsOnIt())
				{
					appear.SetActive(true);
				}
				if (!mount.HasAttachmentsOnIt())
				{
					appear.SetActive(false);
				}
			}
			if (!appear.activeSelf)
			{
				holder.transform.localPosition = new Vector3(0f, 0f, 0.013f);
				((Behaviour)handle1).enabled = true;
				((Component)handle1).gameObject.SetActive(true);
				((Behaviour)handle2).enabled = false;
				((Component)handle2).gameObject.SetActive(false);
				gun.BoltHandle = handle1;
				((Component)((FVRFireArm)gun).StockPos).transform.localPosition = stockpos1.localPosition;
				colgrab1.enabled = true;
				colgrab2.enabled = false;
				gun.Trigger_Display = trigger1;
				((FVRInteractiveObject)gun).PoseOverride = pos1;
				((FVRInteractiveObject)gun).PoseOverride_Touch = pos1;
				boltcol1.enabled = true;
				boltcol2.enabled = false;
				if (!Frame.activeSelf)
				{
					Frame.SetActive(true);
					SM.PlayCoreSound((FVRPooledAudioType)41, click, ((Component)trig).gameObject.transform.position);
				}
				if (!FrameBolt.activeSelf)
				{
					FrameBolt.SetActive(true);
				}
				if (isSwitched)
				{
					if (((FVRPhysicalObject)gun).IsAltHeld)
					{
						((FVRPhysicalObject)gun).IsAltHeld = false;
					}
					isSwitched = false;
				}
			}
			if (!appear.activeSelf)
			{
				return;
			}
			holder.transform.localPosition = new Vector3(0f, -0.4f, 0.013f);
			((Behaviour)handle2).enabled = true;
			((Component)handle2).gameObject.SetActive(true);
			((Behaviour)handle1).enabled = false;
			((Component)handle1).gameObject.SetActive(false);
			gun.BoltHandle = handle2;
			((Component)((FVRFireArm)gun).StockPos).transform.localPosition = stockpos2.localPosition;
			colgrab2.enabled = true;
			colgrab1.enabled = false;
			gun.Trigger_Display = trigger2;
			((FVRInteractiveObject)gun).PoseOverride = pos2;
			((FVRInteractiveObject)gun).PoseOverride_Touch = pos2;
			boltcol2.enabled = true;
			boltcol1.enabled = false;
			if (Frame.activeSelf)
			{
				Frame.SetActive(false);
				SM.PlayCoreSound((FVRPooledAudioType)41, click, ((Component)trig).gameObject.transform.position);
			}
			if (FrameBolt.activeSelf)
			{
				FrameBolt.SetActive(false);
			}
			if (!isSwitched)
			{
				if (((FVRPhysicalObject)gun).IsAltHeld)
				{
					((FVRPhysicalObject)gun).IsAltHeld = false;
				}
				isSwitched = true;
			}
		}
	}
}