Decompiled source of Prime Ammunitions v1.0.2

Prime_Ammunitions.dll

Decompiled 7 months ago
using System.Collections.Generic;
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 OpenScripts2;
using OtherLoader;
using PrimeVrScripts;
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]
public class BombLance : MonoBehaviour
{
	public FVRFireArmChamber harpoonChamber;

	public Transform harpoonParent;

	public FVRFireArm bombLance;

	public bool isHarpoonCocked = false;

	public float harpoonStartPosZ;

	public float harpoonLerp;

	public float harpoonEndPosZ;

	private float m_triggerFloat;

	public Transform Trigger;

	public float Trigger_Rot_Forward;

	public float Trigger_Rot_Rearward;

	public float TriggerThreshold;

	private bool hasAlreadyTriggeredOnce = false;

	public void Update()
	{
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		m_triggerFloat = 0f;
		FVRViveHand hand = ((FVRInteractiveObject)bombLance).m_hand;
		if (!((Object)(object)hand == (Object)null))
		{
			if (hand.Input.TriggerFloat < 0.1f)
			{
				hasAlreadyTriggeredOnce = false;
			}
			if (((FVRInteractiveObject)bombLance).m_hasTriggeredUpSinceBegin && (Object)(object)hand != (Object)null)
			{
				m_triggerFloat = hand.Input.TriggerFloat;
			}
			Trigger.localEulerAngles = new Vector3(Mathf.Lerp(Trigger_Rot_Forward, Trigger_Rot_Rearward, m_triggerFloat), 0f, 0f);
			if (!((double)m_triggerFloat <= (double)TriggerThreshold) && !hasAlreadyTriggeredOnce)
			{
				hasAlreadyTriggeredOnce = true;
				FireHarpoon();
			}
		}
	}

	public void FireHarpoon()
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		bombLance.PlayAudioEvent((FirearmAudioEventType)6, 1f);
		if (isHarpoonCocked)
		{
			bombLance.PlayAudioEvent((FirearmAudioEventType)100, 1f);
			harpoonParent.localPosition = new Vector3(harpoonParent.localPosition.x, harpoonParent.localPosition.y, harpoonEndPosZ);
		}
		if (isHarpoonCocked && harpoonChamber.Fire())
		{
			bombLance.Fire(harpoonChamber, bombLance.MuzzlePos, true, 1f, -1f);
			bombLance.Recoil(bombLance.IsTwoHandStabilized(), (Object)(object)((FVRPhysicalObject)bombLance).AltGrip != (Object)null, bombLance.IsShoulderStabilized(), (FVRFireArmRecoilProfile)null, 1f);
			isHarpoonCocked = false;
			harpoonChamber.SetRound((FVRFireArmRound)null, false);
			Debug.Log((object)("before" + harpoonParent.localPosition));
			harpoonParent.localPosition = new Vector3(harpoonParent.localPosition.x, harpoonParent.localPosition.y, harpoonEndPosZ);
			Debug.Log((object)("after" + harpoonParent.localPosition));
		}
	}
}
public class BroomSound : MonoBehaviour
{
	public AudioClip[] clips;

	public AudioSource audioSource;

	private void OnTriggerEnter(Collider other)
	{
		audioSource.clip = clips[Random.Range(0, clips.Length)];
		if (!audioSource.isPlaying)
		{
			audioSource.Play();
		}
	}
}
public class ChainLinkColliderController : MonoBehaviour
{
	private void Start()
	{
	}

	private void Update()
	{
	}
}
public class ChainRevolver : MonoBehaviour
{
	public Transform[] ChamberLinks;

	public Transform[] ChambersToMove;

	public int CurChamber;

	private bool chambersMoving;

	public float speed = 1f;

	public bool[] chambersFinishedMoving;

	public int numChambers;

	public bool advanceChamberTest;

	public ChainWaggle chainWaggle;

	private void Start()
	{
		CurChamber = 0;
		chambersMoving = false;
		chambersFinishedMoving = new bool[numChambers];
	}

	private void resetChambersFinishedMoving()
	{
		for (int i = 0; i < chambersFinishedMoving.Length; i++)
		{
			chambersFinishedMoving[i] = false;
		}
	}

	private bool checkIfAllChambersMoved()
	{
		bool result = true;
		for (int i = 0; i < chambersFinishedMoving.Length; i++)
		{
			if (!chambersFinishedMoving[i])
			{
				result = false;
				break;
			}
		}
		return result;
	}

	private void Update()
	{
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		if (advanceChamberTest)
		{
			CurChamber++;
			if (CurChamber >= numChambers)
			{
				CurChamber = 0;
			}
			resetChambersFinishedMoving();
			chambersMoving = true;
			advanceChamberTest = false;
		}
		if (!chambersMoving)
		{
			return;
		}
		for (int i = 0; i < ChambersToMove.Length; i++)
		{
			if (!chambersFinishedMoving[i])
			{
				float num = speed * Time.deltaTime;
				int num2 = i + CurChamber;
				if (num2 >= ChamberLinks.Length)
				{
					num2 = (numChambers - num2) * -1;
				}
				ChambersToMove[i].position = Vector3.MoveTowards(ChambersToMove[i].position, ChamberLinks[num2].position, num);
				if (Vector3.Distance(ChambersToMove[i].position, ChamberLinks[num2].position) < 0.001f)
				{
					ChambersToMove[i].position = ChamberLinks[num2].position;
					chambersFinishedMoving[i] = true;
				}
			}
		}
		if (checkIfAllChambersMoved())
		{
			chambersMoving = false;
		}
	}

	public void FixedUpdate()
	{
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		if (chambersMoving)
		{
			return;
		}
		for (int i = 0; i < ChamberLinks.Length; i++)
		{
			float num = 1f * Time.deltaTime;
			int num2 = i + CurChamber;
			if (num2 >= ChamberLinks.Length)
			{
				num2 = (numChambers - num2) * -1;
			}
			ChambersToMove[i].position = Vector3.MoveTowards(ChambersToMove[i].position, ChamberLinks[num2].position, num);
		}
	}

	public void advanceChamber()
	{
		CurChamber++;
		if (CurChamber >= numChambers)
		{
			CurChamber = 0;
		}
		resetChambersFinishedMoving();
		chambersMoving = true;
	}
}
public class ChainWaggle : MonoBehaviour
{
	[Tooltip("The distance the particle is clamped to, scale this up to make it less sensitive to changes.")]
	public float distanceLimit = 0.25f;

	public float angleLimitLeft = 45f;

	public float angleLimitRight = 45f;

	[Tooltip("Multiplier for the physics gravity effecting the particle. Good for dealing with stiff joints or low gravity values.")]
	public float gravityScale = 1f;

	[Tooltip("Pulls the particle back to the hinge direction")]
	public bool useSpring;

	[Tooltip("Rate at which the particle approaches the hinge direction, eg: 0.95 mean's 95% closer each second.")]
	public float springApproachRate = 0.95f;

	[Tooltip("Rate at which the particle loses velocity, eg: 0.5 mean's 50% slower each second.")]
	public float damping;

	[Tooltip("This transform will LookAt() the particle being simulated.")]
	public bool ManualExecution;

	[Tooltip("Puts a cooldown on how often the OnHitLimit event can be fired.")]
	public float onHitLimitCooldown = 0.05f;

	public Vector3 particlePos;

	private Vector3 particleVel;

	private bool leftCatchState;

	private bool rightCatchState;

	private float lastTouchTime = float.MinValue;

	private static float Approach(float rate, float time)
	{
		return 1f - Mathf.Pow(1f - rate, time);
	}

	private static Vector3 Approach(Vector3 point, Vector3 target, float rate, float time)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		return Vector3.Lerp(point, target, WaggleJoint.Approach(rate, time));
	}

	private static float SignedAngle(Vector3 from, Vector3 to, Vector3 axis)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		float num = Vector3.Angle(from, to);
		float num2 = (float)((double)from.y * (double)to.z - (double)from.z * (double)to.y);
		float num3 = (float)((double)from.z * (double)to.x - (double)from.x * (double)to.z);
		float num4 = (float)((double)from.x * (double)to.y - (double)from.y * (double)to.x);
		float num5 = Mathf.Sign((float)((double)axis.x * (double)num2 + (double)axis.y * (double)num3 + (double)axis.z * (double)num4));
		return num * num5;
	}

	private static float ToHingeAngle(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = Vector3.ProjectOnPlane(point - hingePivot, hingeAxis);
		Vector3 normalized = ((Vector3)(ref val)).normalized;
		return WaggleJoint.SignedAngle(hingeDirection, normalized, hingeAxis);
	}

	private static Vector3 ProjectOnHinge(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection, float distanceLimit, float angleMin, float angleMax)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		return Quaternion.AngleAxis(Mathf.Clamp(WaggleJoint.ToHingeAngle(point, hingePivot, hingeAxis, hingeDirection), angleMin, angleMax), hingeAxis) * hingeDirection * distanceLimit + hingePivot;
	}

	private static bool DetectOnHitLimit(float angle, float minAngle, float maxAngle, ref bool minCatchState, ref bool maxCatchState, float catchThreshold = 0.5f, float releaseThreshold = 5f)
	{
		float num = Mathf.Abs(maxAngle - minAngle);
		float num2 = Mathf.Min(releaseThreshold, num - catchThreshold);
		float num3 = angle - minAngle;
		float num4 = (float)(0.0 - ((double)angle - (double)maxAngle));
		bool flag = minCatchState;
		bool flag2 = maxCatchState;
		minCatchState = (double)num3 <= (minCatchState ? ((double)num2) : ((double)catchThreshold));
		maxCatchState = (double)num4 <= (maxCatchState ? ((double)num2) : ((double)catchThreshold));
		if (!flag && minCatchState)
		{
			return true;
		}
		return !flag2 && maxCatchState;
	}

	public void ResetParticlePos()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: 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)
		particlePos = ((Component)this).transform.position + ((Component)this).transform.forward * distanceLimit;
		particleVel = Vector3.zero;
	}

	private void OnHitLimit(float angularVelocity)
	{
	}

	public void Execute()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: 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_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: 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_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: 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_0068: 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)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: 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_0112: 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_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
		float deltaTime = Time.deltaTime;
		Transform transform = ((Component)this).transform;
		Vector3 val = Physics.gravity * gravityScale;
		Vector3 val2 = particlePos;
		Vector3 val3 = WaggleJoint.Approach(particleVel, Vector3.zero, damping, deltaTime) + val * deltaTime;
		Vector3 val4 = val2 + val3 * deltaTime;
		Vector3 val5 = val4;
		Vector3 position = transform.position;
		Vector3 right = transform.right;
		Vector3 up = transform.up;
		if (useSpring)
		{
			val4 = WaggleJoint.Approach(val4, position + up * distanceLimit, springApproachRate, deltaTime);
		}
		particleVel = ((particlePos = WaggleJoint.ProjectOnHinge(val4, position, right, up, distanceLimit, 0f - angleLimitRight, angleLimitLeft)) - val2) / deltaTime;
		float angularVelocity = WaggleJoint.SignedAngle(val5 - position, val2 - position, right) / Mathf.Max(Mathf.Epsilon, deltaTime);
		bool flag = WaggleJoint.DetectOnHitLimit(WaggleJoint.ToHingeAngle(particlePos, position, right, up), 0f - angleLimitRight, angleLimitLeft, ref rightCatchState, ref leftCatchState, 0.5f, 5f);
		bool flag2 = (double)Time.timeSinceLevelLoad < (double)lastTouchTime + (double)onHitLimitCooldown;
		if (flag && !flag2)
		{
			OnHitLimit(angularVelocity);
			lastTouchTime = Time.timeSinceLevelLoad;
		}
	}

	private void Start()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: 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)
		particlePos = ((Component)this).transform.position + ((Component)this).transform.forward * distanceLimit;
		particleVel = Vector3.zero;
	}

	private void Update()
	{
		if (!ManualExecution)
		{
			Execute();
		}
	}

	private void OnDrawGizmosSelected()
	{
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: 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)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		if (Application.isPlaying)
		{
			Gizmos.color = new Color(0.1f, 0.3f, 0.9f);
			Gizmos.DrawWireCube(particlePos, Vector3.one * 0.025f);
			Gizmos.color = new Color(0.1f, 0.3f, 0.9f, 0.5f);
			Gizmos.DrawCube(particlePos, Vector3.one * 0.025f);
			float num = Time.timeSinceLevelLoad - lastTouchTime;
			Gizmos.color = new Color(0.1f, 0.7f, 0.9f, Mathf.Clamp01((float)((0.5 - (double)num) * 2.0)));
			Gizmos.DrawWireCube(particlePos, Vector3.one * (float)(0.100000001490116 * ((double)num + 0.5)));
		}
		Vector3 val = ((Component)this).transform.position + ((Component)this).transform.up * distanceLimit;
		Gizmos.color = new Color(0.7f, 0.9f, 0.1f);
		Gizmos.DrawWireCube(val, Vector3.one * 0.02f);
		Gizmos.color = new Color(0.7f, 0.9f, 0.1f, 0.5f);
		Gizmos.DrawCube(val, Vector3.one * 0.02f);
		Gizmos.color = new Color(0.9f, 0.7f, 0.1f);
		Gizmos.DrawRay(((Component)this).transform.position, Quaternion.AngleAxis(angleLimitLeft, ((Component)this).transform.right) * ((Component)this).transform.up * distanceLimit);
		Gizmos.DrawRay(((Component)this).transform.position, Quaternion.AngleAxis(0f - angleLimitRight, ((Component)this).transform.right) * ((Component)this).transform.up * distanceLimit);
	}
}
public class CoilGunDisplay : MonoBehaviour
{
	private void Start()
	{
	}

	private void Update()
	{
	}
}
public class DisableEmission : MonoBehaviour
{
	private void Start()
	{
	}

	private void Update()
	{
	}
}
public class DualMagSwitcher : MonoBehaviour
{
	public FVRFireArmMagazine frontMag;

	public FVRFireArmMagazine backMag;

	public GameObject frontPosition;

	private void Start()
	{
	}

	private void Update()
	{
	}
}
public class ExplosiveHarpoon : MonoBehaviour
{
	[Header("Harpoon Config")]
	public int fuseTimer;

	public bool isFuseActive = false;

	public GameObject ExplosionVFX;

	public GameObject ExplosionSFX;

	public AudioSource audioSource;

	private bool hasExploded = false;

	public void Awake()
	{
		hasExploded = false;
		isFuseActive = false;
		audioSource.Play();
		((MonoBehaviour)this).Invoke("Explode", (float)fuseTimer);
		isFuseActive = true;
	}

	private void Explode()
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		if (!hasExploded)
		{
			isFuseActive = false;
			audioSource.Stop();
			hasExploded = true;
			Object.Instantiate<GameObject>(ExplosionVFX, ((Component)this).transform.position, Quaternion.identity);
			Object.Instantiate<GameObject>(ExplosionSFX, ((Component)this).transform.position, Quaternion.identity);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}

	public void Update()
	{
		if ((Object)(object)audioSource != (Object)null)
		{
			if (!audioSource.isPlaying && isFuseActive)
			{
				audioSource.Play();
			}
			else if (!isFuseActive)
			{
				audioSource.Stop();
			}
		}
	}
}
public class FlippableHammer : FVRInteractiveObject
{
	public DAMerwinHulbert merwinHulbert;

	private bool isFlipped = false;

	public Vector3 unflippedRotation;

	public Vector3 flippedRotation;

	public Transform objectToFlip;

	public override void SimpleInteraction(FVRViveHand hand)
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		isFlipped = !isFlipped;
		merwinHulbert.CanManuallyCockHammer = isFlipped;
		if (isFlipped)
		{
			objectToFlip.localEulerAngles = flippedRotation;
		}
		else
		{
			objectToFlip.localEulerAngles = unflippedRotation;
		}
		((FVRInteractiveObject)this).SimpleInteraction(hand);
	}
}
public class FollowerScript : MonoBehaviour
{
	public GameObject FollowerSpring;

	public GameObject FollowerTip;

	public Vector3[] SpringScale;

	public Vector3[] TipPosition;

	public FVRFireArmMagazine tubeMagazine;

	public FVRFireArmMagazineReloadTrigger reloadTrigger;

	public bool isSpringDepressed;

	public int ammoCount;

	public void Awake()
	{
	}

	public void FixedUpdate()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: 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)
		//IL_0057: 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)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		FollowerSpring.transform.localScale = Vector3.Lerp(FollowerSpring.transform.localScale, SpringScale[ammoCount], 0.5f);
		FollowerTip.transform.localPosition = Vector3.Lerp(FollowerTip.transform.localPosition, TipPosition[ammoCount], 0.5f);
	}
}
public class HarpoonCrank : MonoBehaviour
{
	public bool isOpen;

	public Transform handCrank;

	public FVRFireArmAttachment attachment;

	public MovableObjectPart movableWeaponPartScript;

	public float curLerp = 0f;

	public bool justAttached = false;

	public AudioClip[] crankAudioClips;

	public AudioSource crankAudioSource;

	private float prevLerp = 0f;

	private AudioSourcePool m_pool_handling;

	private int currentAudioSet = -1;

	private int previousAudioSet = -1;

	public void Awake()
	{
	}

	public void Update()
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0240: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_028a: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0302: Unknown result type (might be due to invalid IL or missing references)
		FVRViveHand hand = ((FVRInteractiveObject)movableWeaponPartScript).m_hand;
		prevLerp = curLerp;
		curLerp = Mathf.InverseLerp(movableWeaponPartScript.LowerLimit, movableWeaponPartScript.UpperLimit, handCrank.localEulerAngles.x);
		previousAudioSet = currentAudioSet;
		if ((double)curLerp < 0.16)
		{
			currentAudioSet = 0;
		}
		else if ((double)curLerp < 0.32)
		{
			currentAudioSet = 1;
		}
		else if ((double)curLerp < 0.48)
		{
			currentAudioSet = 2;
		}
		else if ((double)curLerp < 0.64)
		{
			currentAudioSet = 3;
		}
		else if ((double)curLerp < 0.8)
		{
			currentAudioSet = 4;
		}
		else
		{
			currentAudioSet = 5;
		}
		if ((Object)(object)hand != (Object)null && !crankAudioSource.isPlaying && previousAudioSet != currentAudioSet)
		{
			crankAudioSource.clip = crankAudioClips[currentAudioSet];
			crankAudioSource.Play();
		}
		if ((Object)(object)attachment.curMount == (Object)null)
		{
			justAttached = false;
		}
		else if (Object.op_Implicit((Object)(object)((Component)attachment.curMount).GetComponentInParent<BombLance>()))
		{
			if (!justAttached)
			{
				handCrank.localEulerAngles = new Vector3(0f, handCrank.localEulerAngles.y, handCrank.localEulerAngles.z);
			}
			justAttached = true;
			BombLance componentInParent = ((Component)attachment.curMount).GetComponentInParent<BombLance>();
			componentInParent.harpoonLerp = Mathf.Lerp(componentInParent.harpoonEndPosZ, componentInParent.harpoonStartPosZ, curLerp);
			((Component)componentInParent.harpoonParent).transform.localPosition = new Vector3(((Component)componentInParent.harpoonParent).transform.localPosition.x, ((Component)componentInParent.harpoonParent).transform.localPosition.y, componentInParent.harpoonLerp);
			if (movableWeaponPartScript.UpperLimit - handCrank.localEulerAngles.x <= movableWeaponPartScript.LimitWiggleRoom && !isOpen)
			{
				isOpen = true;
				componentInParent.isHarpoonCocked = true;
				attachment.DetachFromMount();
				handCrank.localEulerAngles = new Vector3(0f, handCrank.localEulerAngles.y, handCrank.localEulerAngles.z);
			}
			else
			{
				isOpen = false;
			}
		}
	}
}
public class IgnoreCollision : MonoBehaviour
{
	public GameObject collidersParent;

	private void OnCollisionEnter(Collision collision)
	{
		if (((Object)collision.gameObject).name.Contains("m6g_reach"))
		{
			collidersParent.SetActive(false);
		}
		else
		{
			collidersParent.SetActive(true);
		}
	}
}
public class LaserMaterialSwap : LaserPointer
{
	public Material offMaterial;

	public Material onMaterial;

	public Renderer rendererToSwap;

	public Light[] lightsToTurnOn;

	public override void UpdateInteraction(FVRViveHand hand)
	{
		((LaserPointer)this).UpdateInteraction(hand);
		if (base.IsOn)
		{
			rendererToSwap.material = onMaterial;
			Light[] array = lightsToTurnOn;
			foreach (Light val in array)
			{
				((Behaviour)val).enabled = true;
			}
		}
		else
		{
			rendererToSwap.material = offMaterial;
			Light[] array2 = lightsToTurnOn;
			foreach (Light val2 in array2)
			{
				((Behaviour)val2).enabled = false;
			}
		}
	}
}
namespace PrimeVR.Prime_Ammunitions;

[BepInPlugin("PrimeVR.Prime_Ammunitions", "Prime_Ammunitions", "1.0.2")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class Prime_AmmunitionsPlugin : 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(), "PrimeVR.Prime_Ammunitions");
		OtherLoader.RegisterDirectLoad(BasePath, "PrimeVR.Prime_Ammunitions", "", "", "prime_ammunitions", "");
	}
}
public class RandomSpawnerPanel : MonoBehaviour
{
	private Dictionary<ItemSpawnerCategory, List<ItemSpawnerObjectDefinition>> DefDic = new Dictionary<ItemSpawnerCategory, List<ItemSpawnerObjectDefinition>>();

	private List<ItemSpawnerObjectDefinition> Definitions = new List<ItemSpawnerObjectDefinition>();

	private Dictionary<ItemSpawnerCategory, int> CurrentItemIndex = new Dictionary<ItemSpawnerCategory, int>();

	private ItemSpawnerCategory CurrentCategory = (ItemSpawnerCategory)(-1);

	private void PrimeDefs()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: 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_0125: 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_009f: Unknown result type (might be due to invalid IL or missing references)
		Object[] array = Resources.LoadAll("ItemSpawnerDefinitions", typeof(ItemSpawnerObjectDefinition));
		for (int i = 0; i < array.Length; i++)
		{
			ItemSpawnerObjectDefinition val = (ItemSpawnerObjectDefinition)array[i];
			Debug.Log((object)val);
			Definitions.Add(val);
		}
		for (int j = 0; j < Definitions.Count; j++)
		{
			if (DefDic.ContainsKey(Definitions[j].Category))
			{
				Debug.Log((object)Definitions[j].Category);
				DefDic[Definitions[j].Category].Add(Definitions[j]);
				continue;
			}
			List<ItemSpawnerObjectDefinition> value = new List<ItemSpawnerObjectDefinition>();
			DefDic.Add(Definitions[j].Category, value);
			DefDic[Definitions[j].Category].Add(Definitions[j]);
			CurrentItemIndex.Add(Definitions[j].Category, 0);
		}
	}

	private void Awake()
	{
		PrimeDefs();
	}

	private void Update()
	{
	}
}
public class TriggerMagnification : FVRInteractiveObject
{
	public Amplifier scopeInterface;

	public override void SimpleInteraction(FVRViveHand hand)
	{
		int curSelectedOptionIndex = scopeInterface.CurSelectedOptionIndex;
		((FVRInteractiveObject)this).SimpleInteraction(hand);
		scopeInterface.CurSelectedOptionIndex = 1;
		scopeInterface.SetCurSettingUp(true);
		scopeInterface.CurSelectedOptionIndex = curSelectedOptionIndex;
	}
}
public class RetractableBarrelTest : MonoBehaviour
{
	private Quaternion handStartRot;

	private Quaternion objectStartRot;

	private float previousRot;

	public Transform hand;

	public Transform objectToRotate;

	public bool activateGrab;

	public bool firstPass;

	private void Update()
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		if (activateGrab)
		{
			if (firstPass)
			{
				handStartRot = hand.localRotation;
				objectStartRot = objectToRotate.localRotation;
				firstPass = false;
			}
			Quaternion val = objectStartRot * Quaternion.Inverse(((Component)hand).transform.localRotation);
			float z = ((Quaternion)(ref val)).eulerAngles.z;
			float val2 = objectStartRot.z - z;
			val2 = CustomClamp(val2, -90f, 0f, objectToRotate.localEulerAngles.z);
			if (previousRot < -10f && val2 >= -10f)
			{
				val2 = 0f;
			}
			objectToRotate.eulerAngles = new Vector3(objectToRotate.localEulerAngles.x, objectToRotate.localEulerAngles.y, 0f - val2);
			previousRot = 0f - objectToRotate.eulerAngles.z;
		}
	}

	public float CustomClamp(float val, float min, float max, float currentRot)
	{
		if (val >= min && val <= max)
		{
			return val;
		}
		return 0f - currentRot;
	}
}
public class ShowCenterMass : MonoBehaviour
{
	public Rigidbody rigidbody;

	public Transform desiredCenterMassPosition;

	private void Awake()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		rigidbody.centerOfMass = desiredCenterMassPosition.position;
	}

	private void Update()
	{
	}
}
public class SmartlinkTrigger : FVRInteractiveObject
{
	public Transform smartLinkObject;

	private bool isOpening = false;

	public AudioEvent audioClipTurnOn;

	public AudioEvent audioClipTurnOff;

	public MeshRenderer smartLinkMesh;

	public Material turnedOffMaterial;

	public Material turnedOnMaterial;

	public override void SimpleInteraction(FVRViveHand hand)
	{
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		((FVRInteractiveObject)this).SimpleInteraction(hand);
		isOpening = !isOpening;
		if (isOpening)
		{
			SM.PlayGenericSound(audioClipTurnOn, ((Component)this).transform.position);
			((Component)smartLinkObject).gameObject.SetActive(true);
			((Renderer)smartLinkMesh).material = turnedOnMaterial;
		}
		else
		{
			((Renderer)smartLinkMesh).material = turnedOffMaterial;
			((Component)smartLinkObject).gameObject.SetActive(false);
			SM.PlayGenericSound(audioClipTurnOff, ((Component)this).transform.position);
		}
	}

	public override void Awake()
	{
		((FVRInteractiveObject)this).Awake();
		isOpening = false;
	}

	public override void FVRUpdate()
	{
		((FVRInteractiveObject)this).FVRUpdate();
	}
}
public class TemporaryDisc : MonoBehaviour
{
	[Header("Disc Config")]
	public int timeToLive;

	public void Awake()
	{
		((MonoBehaviour)this).Invoke("reduceToAtoms", (float)timeToLive);
	}

	private void reduceToAtoms()
	{
		if (Object.op_Implicit((Object)(object)((Component)this).gameObject))
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
public class UtasLoadingGate : FVRInteractiveObject
{
	public bool isOpen;

	public AudioEvent audioClipOpen;

	public AudioEvent audioClipClose;

	public FollowerScript follower;

	public override void SimpleInteraction(FVRViveHand hand)
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		((FVRInteractiveObject)this).SimpleInteraction(hand);
		isOpen = !isOpen;
		if (isOpen)
		{
			SM.PlayGenericSound(audioClipOpen, ((Component)this).transform.position);
		}
		else
		{
			SM.PlayGenericSound(audioClipClose, ((Component)this).transform.position);
		}
	}
}
public class changeSpring : FVRInteractiveObject
{
	public HingeJoint hinge;

	public override void SimpleInteraction(FVRViveHand hand)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		((FVRInteractiveObject)this).SimpleInteraction(hand);
		JointSpring spring = hinge.spring;
		spring.spring += 0.025f;
		if (spring.spring > 1f)
		{
			spring.spring = 0f;
		}
		hinge.spring = spring;
		Debug.Log((object)spring);
	}
}
public class instantiateTest : MonoBehaviour
{
	public GameObject objectToInstantiate;

	public Transform objectToInstantiateTarget;

	public GameObject instantiatedClone;

	private void Start()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		instantiatedClone = Object.Instantiate<GameObject>(objectToInstantiate, objectToInstantiateTarget.position, Quaternion.identity);
	}

	private void Update()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		instantiatedClone.transform.position = objectToInstantiateTarget.position;
		instantiatedClone.transform.rotation = objectToInstantiateTarget.rotation;
	}
}