Decompiled source of Arcturus Weapons Pack v1.0.0

Arcturus_Weapons_Pack.dll

Decompiled 2 months 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;
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 earwig256.Arcturus_Weapons_Pack
{
	public class Arcturus_Minigun : FVRFireArm
	{
		[Header("Components")]
		public FVRFireArmChamber Chamber;

		public Transform Trigger;

		public Transform Barrels;

		public Transform EjectionStart;

		public Transform EjectionEnd;

		public Vector3 EjectionSpeed;

		public Vector3 EjectionSpin;

		[Header("Trigger Config")]
		public float TriggerFiringThreshold = 0.8f;

		public float Trigger_ForwardPosition;

		public float Trigger_RearwardPosition;

		public InterpStyle Trigger_InterpStyle;

		public Axis Trigger_Axis;

		[Header("Minigun Config")]
		public float minSpeed;

		public float maxSpeed;

		public float spoolTime;

		public float Backup_Fire_Time;

		public float Barrel_Angle;

		public bool clockWise;

		[Header("Only Set Size")]
		public FVRLoadedRound[] Loading_Rounds;

		public FVRLoadedRound[] Ejecting_Rounds;

		private bool spooling;

		private bool spinning;

		private bool canFire;

		private float currentSpeed;

		private float triggerPos;

		private float prevRot;

		private float currRot;

		private float fireTime;

		private float prevTrigger;

		public override void Awake()
		{
			((FVRFireArm)this).Awake();
			base.FChambers.Add(Chamber);
			spooling = true;
			spinning = false;
			prevRot = 0f;
			currRot = 0f;
			fireTime = 0f;
			currentSpeed = minSpeed;
		}

		public override void FVRUpdate()
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: 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)
			((FVRFireArm)this).FVRUpdate();
			canFire = false;
			if (!((FVRInteractiveObject)this).IsHeld)
			{
				return;
			}
			prevTrigger = triggerPos;
			if (!((FVRPhysicalObject)this).IsAltHeld && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin)
			{
				triggerPos = ((FVRInteractiveObject)this).m_hand.Input.TriggerFloat;
				if (Mathf.Abs(prevTrigger - triggerPos) > 0.001f)
				{
					((FVRPhysicalObject)this).SetAnimatedComponent(Trigger, Mathf.Lerp(Trigger_ForwardPosition, Trigger_RearwardPosition, triggerPos), Trigger_InterpStyle, Trigger_Axis);
				}
			}
			else
			{
				triggerPos = 0f;
				spooling = true;
				currentSpeed = minSpeed;
			}
			if (triggerPos > TriggerFiringThreshold)
			{
				spinning = true;
			}
			else
			{
				spinning = false;
				spooling = true;
				currentSpeed = minSpeed;
			}
			if (!spinning)
			{
				return;
			}
			prevRot = Mathf.Abs(Barrels.localEulerAngles.z);
			fireTime += Time.deltaTime;
			if (clockWise)
			{
				Barrels.localEulerAngles -= new Vector3(0f, 0f, currentSpeed * Time.deltaTime);
			}
			else
			{
				Barrels.localEulerAngles += new Vector3(0f, 0f, currentSpeed * Time.deltaTime);
			}
			currRot = Mathf.Abs(Barrels.localEulerAngles.z);
			if (spooling)
			{
				currentSpeed = Mathf.MoveTowards(currentSpeed, maxSpeed, Time.deltaTime * ((maxSpeed - minSpeed) / spoolTime));
				if (currentSpeed >= maxSpeed)
				{
					currentSpeed = maxSpeed;
					spooling = false;
				}
			}
			if (!clockWise)
			{
				if (prevRot % Barrel_Angle > currRot % Barrel_Angle || fireTime > Backup_Fire_Time)
				{
					canFire = true;
				}
			}
			else if (prevRot % Barrel_Angle < currRot % Barrel_Angle || fireTime > Backup_Fire_Time)
			{
				canFire = true;
			}
			if (canFire)
			{
				fireTime = 0f;
				if (!Fiyaahh())
				{
					((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
				}
			}
		}

		public bool Fiyaahh()
		{
			//IL_00b6: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//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_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_0117: 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_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: 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)
			if ((Object)(object)base.Magazine != (Object)null && base.Magazine.HasARound())
			{
				Chamber.Autochamber(base.Magazine.RemoveRound(1).LR_Class);
			}
			if (!Chamber.Fire())
			{
				return false;
			}
			((FVRFireArm)this).Fire(Chamber, base.CurrentMuzzle, true, 1f, -1f);
			((FVRFireArm)this).FireMuzzleSmoke();
			bool flag = ((FVRFireArm)this).IsTwoHandStabilized();
			bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null;
			bool flag3 = ((FVRFireArm)this).IsShoulderStabilized();
			((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f);
			((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
			Chamber.EjectRound(EjectionEnd.position, ((Component)this).transform.right * EjectionSpeed.x + ((Component)this).transform.up * EjectionSpeed.y + ((Component)this).transform.forward * EjectionSpeed.z, ((Component)this).transform.right * EjectionSpin.x + ((Component)this).transform.up * EjectionSpin.y + ((Component)this).transform.forward * EjectionSpin.z, EjectionStart.position, EjectionStart.rotation, false);
			return true;
		}
	}
	public class Arcturus_Rocket_Launcher : FVRFireArm
	{
		[Header("Components")]
		public FVRFireArmChamber Chamber;

		[Header("Trigger Config")]
		public Transform Trigger;

		public float Trigger_Firing_Threshold = 0.9f;

		public float Trigger_Reset_Threshold = 0.4f;

		public float Trigger_Reset_Time = 0.25f;

		public Vector2 Trigger_Positions;

		public InterpStyle Trigger_InterpStyle;

		public Axis Trigger_Axis;

		private bool m_triggerReset;

		private float m_triggerFloat;

		private float m_prevTrigger;

		private float m_triggerTimer;

		private bool m_fireCycle;

		public override void Awake()
		{
			((FVRFireArm)this).Awake();
			base.FChambers.Add(Chamber);
			m_triggerReset = true;
			m_triggerFloat = 0f;
			m_prevTrigger = 0f;
			m_fireCycle = true;
			m_triggerTimer = Trigger_Reset_Time + 0.1f;
		}

		public override void FVRUpdate()
		{
			((FVRFireArm)this).FVRUpdate();
			if (!m_fireCycle)
			{
				m_triggerTimer += Time.deltaTime;
				if (m_triggerTimer >= Trigger_Reset_Time)
				{
					m_fireCycle = true;
				}
			}
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			((FVRPhysicalObject)this).UpdateInteraction(hand);
			m_prevTrigger = m_triggerFloat;
			if (((FVRInteractiveObject)this).IsHeld)
			{
				if (!((FVRPhysicalObject)this).IsAltHeld && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin)
				{
					m_triggerFloat = hand.Input.TriggerFloat;
				}
				else
				{
					m_triggerFloat = 0f;
				}
				if (m_triggerReset && m_fireCycle && m_triggerFloat > Trigger_Firing_Threshold)
				{
					if (Shoot())
					{
						m_fireCycle = false;
						m_triggerTimer = 0f;
					}
					m_triggerReset = false;
				}
				else if (!m_triggerReset && m_triggerFloat < Trigger_Reset_Threshold)
				{
					m_triggerReset = true;
				}
			}
			else
			{
				m_triggerFloat = 0f;
				m_triggerReset = true;
			}
			if (m_triggerFloat != m_prevTrigger)
			{
				((FVRPhysicalObject)this).SetAnimatedComponent(Trigger, Mathf.Lerp(Trigger_Positions.x, Trigger_Positions.y, m_triggerFloat), Trigger_InterpStyle, Trigger_Axis);
			}
		}

		public bool Shoot()
		{
			//IL_00b6: 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)
			if ((Object)(object)base.Magazine != (Object)null && base.Magazine.HasARound())
			{
				Chamber.Autochamber(base.Magazine.RemoveRound(1).LR_Class);
			}
			if (!Chamber.Fire())
			{
				return false;
			}
			((FVRFireArm)this).Fire(Chamber, base.CurrentMuzzle, true, 1f, -1f);
			((FVRFireArm)this).FireMuzzleSmoke();
			bool flag = ((FVRFireArm)this).IsTwoHandStabilized();
			bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null;
			bool flag3 = ((FVRFireArm)this).IsShoulderStabilized();
			((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f);
			((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
			((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)101, 1f);
			Chamber.SetRound((FVRFireArmRound)null, false);
			return true;
		}
	}
}
namespace Earwig_Scripts
{
	public class EWG_Simple_Rangefinder : MonoBehaviour
	{
		public Text Range_Text;

		public Transform Laser_Pointer;

		public LayerMask LM_Laser_Pointer;

		private RaycastHit m_hit;

		public bool Uses_Scope;

		public PIPScope Scope;

		public float Max_Range;

		private void Update()
		{
			if (Uses_Scope)
			{
				if (((Behaviour)Scope).enabled)
				{
					UpdateText(GetRange());
					((Component)Range_Text).gameObject.SetActive(true);
				}
				else
				{
					((Component)Range_Text).gameObject.SetActive(false);
				}
			}
			else
			{
				UpdateText(GetRange());
			}
		}

		public float GetRange()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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)
			float scopeMaxDrawRange = GM.CurrentSceneSettings.ScopeMaxDrawRange;
			scopeMaxDrawRange = Mathf.Min(scopeMaxDrawRange, 9999f);
			if (Physics.Raycast(Laser_Pointer.position, Laser_Pointer.forward, ref m_hit, scopeMaxDrawRange, LayerMask.op_Implicit(LM_Laser_Pointer)))
			{
				return ((RaycastHit)(ref m_hit)).distance;
			}
			return scopeMaxDrawRange;
		}

		private void UpdateText(float rangeNum)
		{
			rangeNum = Mathf.Min(rangeNum, Max_Range);
			string text = ((!(rangeNum < 100f)) ? rangeNum.ToString("f0") : rangeNum.ToString("f1"));
			Range_Text.text = text;
		}
	}
	public class GroundFire : MonoBehaviour
	{
		public GameObject GroundFirePrefab;

		public int Amount_To_Spawn;

		public int Max_Tries;

		public float Range;

		public LayerMask LM;

		private RaycastHit m_hit;

		private int m_spawned;

		private void Start()
		{
			//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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_003a: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			m_spawned = 0;
			for (int i = 0; i < Max_Tries; i++)
			{
				if (m_spawned >= Amount_To_Spawn)
				{
					break;
				}
				Vector3 val = -Vector3.up;
				if (i > 0)
				{
					val = Random.onUnitSphere;
					if (val.y > 0f)
					{
						val.y = 0f - val.y;
					}
				}
				if (Physics.Raycast(((Component)this).transform.position + Vector3.up, val, ref m_hit, Range, LayerMask.op_Implicit(LM), (QueryTriggerInteraction)1))
				{
					Object.Instantiate<GameObject>(GroundFirePrefab, ((RaycastHit)(ref m_hit)).point, Quaternion.LookRotation(Vector3.up));
					m_spawned++;
				}
			}
		}
	}
	public class Left_Right_Switcher : MonoBehaviour
	{
		public enum Axis
		{
			X,
			Y,
			Z
		}

		public GameObject Left_Object;

		public GameObject Right_Object;

		public Transform Switch_Object;

		public Axis Mirror_Axis;

		public bool Is_Left;

		public PIPScopeController pipscope;

		public ReflexSightController reflex;

		public LaserLightAttachment laser;

		public void Switch_Sides()
		{
			if (Is_Left)
			{
				Is_Left = false;
				Left_Object.SetActive(false);
				Right_Object.SetActive(true);
				Mirror(Mirror_Axis);
				UpdateComponents();
			}
			else
			{
				Is_Left = true;
				Left_Object.SetActive(true);
				Right_Object.SetActive(false);
				Mirror(Mirror_Axis);
				UpdateComponents();
			}
		}

		private void Mirror(Axis a)
		{
			//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_003a: 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_004d: 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_005a: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00cb: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			switch (a)
			{
			case Axis.X:
				Switch_Object.localPosition = new Vector3(0f - Switch_Object.localPosition.x, Switch_Object.localPosition.y, Switch_Object.localPosition.z);
				break;
			case Axis.Y:
				Switch_Object.localPosition = new Vector3(Switch_Object.localPosition.x, 0f - Switch_Object.localPosition.y, Switch_Object.localPosition.z);
				break;
			case Axis.Z:
				Switch_Object.localPosition = new Vector3(Switch_Object.localPosition.x, Switch_Object.localPosition.y, 0f - Switch_Object.localPosition.z);
				break;
			}
		}

		private void UpdateComponents()
		{
			if ((Object)(object)pipscope != (Object)null)
			{
				pipscope.UpdateScopeParams();
			}
			if ((Object)(object)reflex != (Object)null)
			{
				reflex.Zero();
			}
			if ((Object)(object)laser != (Object)null)
			{
				laser.UpdateParams();
			}
		}
	}
	public class Left_Right_Trigger : FVRInteractiveObject
	{
		public Left_Right_Switcher Switch;

		public AudioEvent Switch_Sound;

		public override void SimpleInteraction(FVRViveHand hand)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).SimpleInteraction(hand);
			Switch.Switch_Sides();
			SM.PlayGenericSound(Switch_Sound, ((Component)this).transform.position);
		}
	}
	public class Revolving_Shotgun_Caseless_Fixed_Trigger : RevolvingShotgunTrigger
	{
		public override void BeginInteraction(FVRViveHand hand)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			if ((Object)(object)base.Shotgun != (Object)null && (int)base.TType == 1)
			{
				for (int i = 0; i < base.Shotgun.Chambers.Length; i++)
				{
					if ((Object)(object)base.Shotgun.Chambers[i].GetRound() != (Object)null && base.Shotgun.Chambers[i].IsSpent && base.Shotgun.Chambers[i].GetRound().IsCaseless)
					{
						base.Shotgun.Chambers[i].Unload();
					}
				}
			}
			((RevolvingShotgunTrigger)this).BeginInteraction(hand);
		}
	}
}
namespace earwig256.Arcturus_Weapons_Pack
{
	[BepInPlugin("earwig256.Arcturus_Weapons_Pack", "Arcturus_Weapons_Pack", "1.0.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class Arcturus_Weapons_PackPlugin : 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(), "earwig256.Arcturus_Weapons_Pack");
			OtherLoader.RegisterDirectLoad(BasePath, "earwig256.Arcturus_Weapons_Pack", "", "", "arcturus_sidearms,arcturus snipers,arcturus primaries,arcturus attachments,arcturus shotguns,arcturus ordinance", "");
		}
	}
}
public class Regulus_Deployable_Launcher : MonoBehaviour
{
	private void Start()
	{
	}

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

	private void Update()
	{
	}
}