Decompiled source of Jericho942FS v1.0.0

Jericho942FS.dll

Decompiled 4 days 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 OpenScripts2;
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]
public class ForeMagRelease : UniversalAdvancedMagazineGrabTrigger
{
	[Header("ForeMagRelease Config")]
	public bool EjectMainMagOnSecondaryRelease = true;

	private bool wasSecondaryMagPresent = true;

	public override void UpdateInteraction(FVRViveHand hand)
	{
		((UniversalAdvancedMagazineGrabTrigger)this).UpdateInteraction(hand);
		if (base.IsSecondarySlotGrab)
		{
			FVRFireArmMagazine magazine = base.FireArm.SecondaryMagazineSlots[base.SecondaryGrabSlot].Magazine;
			if (wasSecondaryMagPresent && (Object)(object)magazine == (Object)null && EjectMainMagOnSecondaryRelease && (Object)(object)base.FireArm.Magazine != (Object)null)
			{
				base.FireArm.EjectMag(false);
			}
			wasSecondaryMagPresent = (Object)(object)magazine != (Object)null;
		}
		else
		{
			wasSecondaryMagPresent = true;
		}
	}
}
public class SAFA_BoltController : MonoBehaviour
{
	private enum BoltState
	{
		semiAuto,
		fullAuto,
		safe,
		uncocked
	}

	public OpenBoltReceiver weapon;

	public int semiAuto;

	public int fullAuto;

	public Transform closedBoltSearPosition;

	private OpenBoltReceiverBolt bolt;

	private Transform sear;

	private Vector3 uncockedPos;

	private Transform openBoltSearPosition;

	private string lastMessage = "";

	private bool waitForShot;

	private BoltState boltState;

	public void Start()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		bolt = weapon.Bolt;
		sear = weapon.Bolt.Point_Bolt_LockPoint;
		uncockedPos = weapon.Bolt.Point_Bolt_Forward.localPosition;
		openBoltSearPosition = sear;
	}

	public void Update()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: 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_0045: 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_0078: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: 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_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		if (((Component)bolt).transform.localPosition == uncockedPos)
		{
			boltState = BoltState.uncocked;
		}
		else if (((Component)bolt).transform.localPosition == openBoltSearPosition.localPosition)
		{
			boltState = BoltState.fullAuto;
		}
		else if (((Component)bolt).transform.localPosition == closedBoltSearPosition.localPosition)
		{
			boltState = BoltState.semiAuto;
		}
		if (boltState == BoltState.uncocked && weapon.m_fireSelectorMode == fullAuto)
		{
			bolt.m_boltZ_lock = openBoltSearPosition.localPosition.z;
		}
		else if (boltState == BoltState.uncocked && weapon.m_fireSelectorMode == semiAuto)
		{
			bolt.m_boltZ_lock = closedBoltSearPosition.localPosition.z;
		}
		else if (boltState == BoltState.semiAuto && weapon.m_fireSelectorMode == fullAuto)
		{
			waitForShot = true;
		}
		else if (boltState == BoltState.fullAuto && weapon.m_fireSelectorMode == semiAuto)
		{
			bolt.m_boltZ_lock = closedBoltSearPosition.localPosition.z;
			bolt.LastPos = (BoltPos)4;
			bolt.CurPos = (BoltPos)3;
		}
		if (waitForShot && (int)bolt.LastPos == 0)
		{
			bolt.m_boltZ_lock = openBoltSearPosition.localPosition.z;
			waitForShot = false;
		}
	}

	public void DebugOnce(string message)
	{
		if (message != lastMessage)
		{
			Debug.Log((object)message);
		}
		lastMessage = message;
	}
}
namespace Volks.Jericho942FS;

[BepInPlugin("Volks.Jericho942FS", "Jericho942FS", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class Jericho942FSPlugin : 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(), "Volks.Jericho942FS");
		OtherLoader.RegisterDirectLoad(BasePath, "Volks.Jericho942FS", "", "", "jericho942fs", "");
	}
}