using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using FistVR;
using Microsoft.CodeAnalysis;
using On.FistVR;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("AccessibilityOptions")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AccessibilityOptions")]
[assembly: AssemblyTitle("AccessibilityOptions")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;
		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}
		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;
		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace AccessibilityOptions
{
	[BepInPlugin("okkim.accessibilityoptions", "Accessibility Options", "1.0.0")]
	[BepInProcess("h3vr.exe")]
	public class AccessibilityOptionsBase : BaseUnityPlugin
	{
		public static ConfigEntry<bool> oneHandedWristMenuEnabled;
		public static ConfigEntry<float> verticalPointerOffset;
		public static ConfigEntry<Color> pointerColor;
		public static ConfigEntry<float> pointerScale;
		public static ConfigEntry<bool> lockPanelsAutomatically;
		public static ConfigEntry<string> autoLockPanelWhitelist;
		public static ConfigEntry<bool> weaponPoseLockingEnabled;
		public static ConfigEntry<float> weaponPoseLockingTriggerDuration;
		public static ConfigEntry<bool> gripAngleOverrideEnabled;
		public static ConfigEntry<float> overrideGripAngle;
		public static ConfigEntry<bool> overrideRecoil;
		public static ConfigEntry<bool> oneHandedHoverBench;
		public static ConfigEntry<bool> miscWeaponTweaksEnabled;
		public static ConfigEntry<bool> oneHandedSAREnabled;
		public static ConfigEntry<bool> oneHandedGrenadesEnabled;
		public static ConfigEntry<float> pinnedGrenadePinPullDuration;
		public static ConfigEntry<bool> oneHandedPumpReleaseEnabled;
		public static ConfigEntry<bool> RPG7MainHandControlsEnabled;
		public static ConfigEntry<bool> oneHandedMinigunEnabled;
		private const string ASSET_BUNDLE_NAME = "accessibilityoptions";
		public static AssetBundle pointerAssetBundle;
		private OneHandedWristMenu oneHandedWristMenu;
		private AutoLockingPanels autoLockingPanels;
		private WeaponPoseLock weaponPoseLock;
		private GripAngleOverride gripAngleOverride;
		private OneHandedMiscWeaponTweaks oneHandedMiscWeaponTweaks;
		public AccessibilityOptionsBase()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			pointerAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "accessibilityoptions"));
			oneHandedWristMenuEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Wrist Menu", "Enable One-Handed Wrist Menu", true, "Enabled/disables one-handed wrist menu (requires game restart)");
			verticalPointerOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Wrist Menu", "Vertical Pointer Offset", -10f, "How far up or down (in degrees) the wrist menu pointer is from the center of your view");
			pointerColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Wrist Menu", "Pointer Color", Color.green, "Color of the wrist menu pointer (RGBA)");
			pointerScale = ((BaseUnityPlugin)this).Config.Bind<float>("Wrist Menu", "Pointer Scale", 0.01f, "How large (in meters) the pointer is");
			weaponPoseLockingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Weapon Pose Locking", "Enable Weapon Pose Locking", true, "Lock weapons in mid-air by holding down the trigger on a safe or empty chamber");
			weaponPoseLockingTriggerDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Weapon Pose Locking", "Pose Locking Trigger Hold Duration", 0.35f, "How long the trigger needs to be held down for the weapon to get locked");
			overrideRecoil = ((BaseUnityPlugin)this).Config.Bind<bool>("Quality Of Life", "Force Two-Handed Recoil", true, "Force weapons to always recoil like they're being two-handed");
			oneHandedHoverBench = ((BaseUnityPlugin)this).Config.Bind<bool>("Quality Of Life", "Enable One-Handed Hoverbench", true, "Allow locking items into the Hoverbench without requiring two hands");
			gripAngleOverrideEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Quality Of Life", "Enable Grip Angle Override", true, "Override the angle weapons are held at, to make one-handed aiming easier");
			overrideGripAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Quality Of Life", "Override Grip Angle", -75f, "Determines the up/down angle of a weapon's hold pose");
			lockPanelsAutomatically = ((BaseUnityPlugin)this).Config.Bind<bool>("Quality Of Life", "Automatically Lock Option Panels", true, "Option panels lock automatically when spawned");
			autoLockPanelWhitelist = ((BaseUnityPlugin)this).Config.Bind<string>("Quality Of Life", "(Advanced) Auto-Locking Panel Whitelist", "OptionsPanel_Screenmanager AmmoSpawnerV2", "Add a panel class name here (case-sensitive, separated by a space) to lock it automatically upon spawning");
			miscWeaponTweaksEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Miscellaneous Weapon Tweaks", "Enable Miscellaneous One-Handed Weapon Tweaks", true, "Toggle all miscellaneous weapon tweaks on or off");
			oneHandedSAREnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Miscellaneous Weapon Tweaks", "Enable One-Handed Single-Action Revolvers", true, "Automatically advance single-action revolver cylinders upon inserting a round");
			oneHandedGrenadesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Miscellaneous Weapon Tweaks", "Enable One-Handed Grenades", true, "Pull pins by holding the touchpad or AX face buttons");
			pinnedGrenadePinPullDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Miscellaneous Weapon Tweaks", "Pinned Grenade Pin Pull Duration", 0.5f, "How long (in seconds) the button needs to be held down to pull out a grenade pin (set to 0 for instant)");
			oneHandedPumpReleaseEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Miscellaneous Weapon Tweaks", "Enable One-Handed Pump Release", true, "Unlock pump-action weapon pumps by pulling the trigger while holding the pump");
			RPG7MainHandControlsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Miscellaneous Weapon Tweaks", "Enable RPG7 Main Hand Controls", true, "Cock the hammer and pull the trigger on an RPG7 through the main grip");
			oneHandedMinigunEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Miscellaneous Weapon Tweaks", "Enable One-Handed Minigun", true, "Shoot the minigun without it flying out of your hand");
		}
		private void Awake()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			if (oneHandedWristMenuEnabled.Value)
			{
				oneHandedWristMenu = ((Component)this).gameObject.AddComponent<OneHandedWristMenu>();
			}
			if (lockPanelsAutomatically.Value)
			{
				autoLockingPanels = ((Component)this).gameObject.AddComponent<AutoLockingPanels>();
			}
			if (weaponPoseLockingEnabled.Value)
			{
				weaponPoseLock = ((Component)this).gameObject.AddComponent<WeaponPoseLock>();
			}
			if (gripAngleOverrideEnabled.Value)
			{
				gripAngleOverride = ((Component)this).gameObject.AddComponent<GripAngleOverride>();
			}
			if (overrideRecoil.Value)
			{
				FVRFireArm.Recoil += new hook_Recoil(FVRFireArm_Recoil);
			}
			if (oneHandedHoverBench.Value)
			{
				FVRPivotLocker.TryToLockObject += new hook_TryToLockObject(FVRPivotLocker_TryToLockObject);
			}
			if (miscWeaponTweaksEnabled.Value)
			{
				oneHandedMiscWeaponTweaks = ((Component)this).gameObject.AddComponent<OneHandedMiscWeaponTweaks>();
			}
		}
		private void FVRFireArm_Recoil(orig_Recoil orig, FVRFireArm self, bool twoHandStabilized, bool foregripStabilized, bool shoulderStabilized, FVRFireArmRecoilProfile overrideprofile, float VerticalRecoilMult)
		{
			orig.Invoke(self, true, true, shoulderStabilized, overrideprofile, VerticalRecoilMult);
		}
		private void FVRPivotLocker_TryToLockObject(orig_TryToLockObject orig, FVRPivotLocker self)
		{
			//IL_001c: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if ((Object)(object)self.m_obj != (Object)null)
			{
				return;
			}
			Collider[] array = Physics.OverlapBox(self.TestingBox.position, self.TestingBox.localScale / 1.9f, self.TestingBox.rotation);
			for (int i = 0; i < array.Length; i++)
			{
				FVRPhysicalObject component = ((Component)array[i]).GetComponent<FVRPhysicalObject>();
				if ((Object)(object)component != (Object)null)
				{
					if ((Object)(object)weaponPoseLock.currentlyLockedWeapon != (Object)null && (Object)(object)weaponPoseLock.currentlyLockedWeapon.thisFirearm == (Object)(object)component)
					{
						weaponPoseLock.currentlyLockedWeapon.UnlockWeapon();
					}
					self.LockObject(component);
					break;
				}
			}
		}
	}
	internal class AutoLockingPanels : MonoBehaviour
	{
		private string[] panelWhitelist = new string[0];
		public void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			FVRPhysicalObject.Awake += new hook_Awake(FVRPhysicalObject_Awake);
			panelWhitelist = AccessibilityOptionsBase.autoLockPanelWhitelist.Value.Split(new char[1] { ' ' });
			for (int i = 0; i < panelWhitelist.Length; i++)
			{
				panelWhitelist[i].Trim();
			}
		}
		private void FVRPhysicalObject_Awake(orig_Awake orig, FVRPhysicalObject self)
		{
			orig.Invoke(self);
			string[] array = panelWhitelist;
			foreach (string text in array)
			{
				Component[] components = ((Component)self).GetComponents(typeof(Component));
				for (int j = 0; j < components.Length; j++)
				{
					if (((object)components[j]).GetType().Name == text)
					{
						if ((Object)(object)((Component)self).GetComponent<Rigidbody>() != (Object)null)
						{
							self.SetIsKinematicLocked(true);
						}
						return;
					}
				}
			}
		}
	}
	internal class GripAngleOverride : MonoBehaviour
	{
		private float overrideGripAngle;
		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			overrideGripAngle = AccessibilityOptionsBase.overrideGripAngle.Value;
			FVRFireArm.Awake += new hook_Awake(FVRFireArm_Awake);
		}
		private void FVRFireArm_Awake(orig_Awake orig, FVRFireArm self)
		{
			//IL_0029: 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_0061: 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)
			if ((Object)(object)((FVRInteractiveObject)self).PoseOverride != (Object)null)
			{
				((Component)((FVRInteractiveObject)self).PoseOverride).transform.localRotation = Quaternion.Euler(new Vector3(overrideGripAngle, 0f, 0f));
			}
			if ((Object)(object)((FVRInteractiveObject)self).PoseOverride_Touch != (Object)null)
			{
				((Component)((FVRInteractiveObject)self).PoseOverride_Touch).transform.localRotation = Quaternion.Euler(new Vector3(overrideGripAngle, 0f, 0f));
			}
			orig.Invoke(self);
		}
	}
	internal class OneHandedCappedGrenade : MonoBehaviour
	{
		private FVRCappedGrenadeCap primaryCap;
		private FVRCappedGrenadeCap secondaryCap;
		private void Awake()
		{
			FVRCappedGrenadeCap[] componentsInChildren = ((Component)this).GetComponentsInChildren<FVRCappedGrenadeCap>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				if (i > 1)
				{
					Debug.LogError((object)"Too many caps found!");
					break;
				}
				if (componentsInChildren[i].IsPrimaryCap)
				{
					primaryCap = componentsInChildren[i];
				}
				else
				{
					secondaryCap = componentsInChildren[i];
				}
			}
		}
		public void FVRFixedUpdate_Hooked(FVRCappedGrenade _self)
		{
			//IL_0028: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			FVRViveHand hand = ((FVRInteractiveObject)_self).m_hand;
			if (hand.IsInStreamlinedMode)
			{
				if (hand.Input.BYButtonDown)
				{
					flag = true;
				}
			}
			else
			{
				Vector2 touchpadAxes = hand.Input.TouchpadAxes;
				if (hand.Input.TouchpadDown && ((Vector2)(ref touchpadAxes)).magnitude > 0.2f && Vector2.Angle(touchpadAxes, Vector2.up) <= 45f)
				{
					flag = true;
				}
			}
			if (!flag)
			{
				return;
			}
			if (!_self.IsPrimaryCapRemoved)
			{
				if ((Object)(object)primaryCap != (Object)null)
				{
					RemoteCapRemoved(_isPrimary: true, _self, primaryCap);
				}
			}
			else if (_self.UsesSecondaryCap && !_self.IsSecondaryCapRemoved && (Object)(object)secondaryCap != (Object)null)
			{
				RemoteCapRemoved(_isPrimary: false, _self, secondaryCap);
			}
		}
		private void RemoteCapRemoved(bool _isPrimary, FVRCappedGrenade _self, FVRCappedGrenadeCap _cap)
		{
			//IL_004c: 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_00a4: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
			if (_isPrimary)
			{
				SM.PlayCoreSound((FVRPooledAudioType)10, _self.AudEvent_CapRemovePrimary, ((Component)this).transform.position);
				_self.IsPrimaryCapRemoved = true;
				if ((Object)(object)_self.AudOnUncapped != (Object)null)
				{
					_self.AudOnUncapped.Play();
				}
			}
			else
			{
				SM.PlayCoreSound((FVRPooledAudioType)10, _self.AudEvent_CapRemoveSecondary, ((Component)this).transform.position);
				_self.IsSecondaryCapRemoved = true;
			}
			if ((_self.UsesSecondaryCap && _self.IsPrimaryCapRemoved && _self.IsSecondaryCapRemoved) || (!_self.UsesSecondaryCap && _self.IsPrimaryCapRemoved))
			{
				_self.m_IsFuseActive = true;
			}
			Object.Instantiate<GameObject>(_isPrimary ? _self.Cap_Primary_Prefab : _self.Cap_Secondary_Prefab, ((Component)_cap).transform.position, ((Component)_cap).transform.rotation).GetComponent<FVRPhysicalObject>().RecoverRigidbody();
			Object.Destroy((Object)(object)((Component)_cap).gameObject);
			if (_self.HasPopOutShell)
			{
				for (int i = 0; i < _self.ShellPieces.Count; i++)
				{
					_self.ShellPieces[i].localPosition = _self.ShellPoses[i];
				}
			}
		}
	}
	internal class OneHandedMiscWeaponTweaks : MonoBehaviour
	{
		private void Awake()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Expected O, but got Unknown
			if (AccessibilityOptionsBase.oneHandedSAREnabled.Value)
			{
				FVRFireArmRound.Chamber += new hook_Chamber(FVRFireArmRound_Chamber);
			}
			if (AccessibilityOptionsBase.oneHandedGrenadesEnabled.Value)
			{
				PinnedGrenade.Awake += new hook_Awake(PinnedGrenade_Awake);
				PinnedGrenade.UpdateInteraction += new hook_UpdateInteraction(PinnedGrenade_UpdateInteraction);
				PinnedGrenade.ReleaseLever += new hook_ReleaseLever(PinnedGrenade_ReleaseLever);
				PinnedGrenade.IncreaseFuseSetting += new hook_IncreaseFuseSetting(PinnedGrenade_IncreaseFuseSetting);
				FVRCappedGrenade.Start += new hook_Start(FVRCappedGrenade_Start);
				FVRCappedGrenade.FVRFixedUpdate += new hook_FVRFixedUpdate(FVRCappedGrenade_FVRFixedUpdate);
			}
			if (AccessibilityOptionsBase.oneHandedPumpReleaseEnabled.Value)
			{
				TubeFedShotgunHandle.UpdateHandle += new hook_UpdateHandle(TubeFedShotgunHandle_UpdateHandle);
				ClosedBoltForeHandle.UpdateInteraction += new hook_UpdateInteraction(ClosedBoltForeHandle_UpdateInteraction);
			}
			if (AccessibilityOptionsBase.RPG7MainHandControlsEnabled.Value)
			{
				RPG7.UpdateInteraction += new hook_UpdateInteraction(RPG7_UpdateInteraction);
				FVRAlternateGrip.BeginInteraction += new hook_BeginInteraction(FVRAlternateGrip_BeginInteraction);
			}
			if (AccessibilityOptionsBase.oneHandedMinigunEnabled.Value)
			{
				Minigun.Fire += new hook_Fire(Minigun_Fire);
			}
		}
		private void ClosedBoltForeHandle_UpdateInteraction(orig_UpdateInteraction orig, ClosedBoltForeHandle self, FVRViveHand hand)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			Vector2 touchpadAxes = hand.Input.TouchpadAxes;
			if (!((FVRPhysicalObject)self.Weapon).IsAltHeld)
			{
				return;
			}
			bool flag = false;
			if (hand.IsInStreamlinedMode)
			{
				if (hand.Input.BYButtonDown)
				{
					flag = true;
				}
			}
			else if (hand.Input.TouchpadDown && Vector2.Angle(Vector2.up, touchpadAxes) < 45f && ((Vector2)(ref touchpadAxes)).magnitude > 0.2f)
			{
				flag = true;
			}
			if (flag && self.CanSwap)
			{
				self.AttemptToToggleMode();
			}
		}
		private void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			FVRFireArmRound.Chamber -= new hook_Chamber(FVRFireArmRound_Chamber);
			PinnedGrenade.Awake -= new hook_Awake(PinnedGrenade_Awake);
			PinnedGrenade.UpdateInteraction -= new hook_UpdateInteraction(PinnedGrenade_UpdateInteraction);
			PinnedGrenade.ReleaseLever -= new hook_ReleaseLever(PinnedGrenade_ReleaseLever);
			PinnedGrenade.IncreaseFuseSetting -= new hook_IncreaseFuseSetting(PinnedGrenade_IncreaseFuseSetting);
			FVRCappedGrenade.Start -= new hook_Start(FVRCappedGrenade_Start);
			FVRCappedGrenade.FVRFixedUpdate -= new hook_FVRFixedUpdate(FVRCappedGrenade_FVRFixedUpdate);
			TubeFedShotgunHandle.UpdateHandle -= new hook_UpdateHandle(TubeFedShotgunHandle_UpdateHandle);
			ClosedBoltForeHandle.UpdateInteraction -= new hook_UpdateInteraction(ClosedBoltForeHandle_UpdateInteraction);
			RPG7.UpdateInteraction -= new hook_UpdateInteraction(RPG7_UpdateInteraction);
			FVRAlternateGrip.BeginInteraction -= new hook_BeginInteraction(FVRAlternateGrip_BeginInteraction);
			Minigun.Fire -= new hook_Fire(Minigun_Fire);
		}
		private void FVRFireArmRound_Chamber(orig_Chamber orig, FVRFireArmRound self, FVRFireArmChamber c, bool makeChamberingSound)
		{
			orig.Invoke(self, c, makeChamberingSound);
			FVRFireArm firearm = c.Firearm;
			SingleActionRevolver val = (SingleActionRevolver)(object)((firearm is SingleActionRevolver) ? firearm : null);
			if (val != null)
			{
				val.AdvanceCylinder();
				val.UpdateCylinderRot();
			}
		}
		private void PinnedGrenade_Awake(orig_Awake orig, PinnedGrenade self)
		{
			((Component)self).gameObject.AddComponent<OneHandedPinnedGrenade>();
			orig.Invoke(self);
		}
		private void PinnedGrenade_UpdateInteraction(orig_UpdateInteraction orig, PinnedGrenade self, FVRViveHand hand)
		{
			((Component)self).GetComponent<OneHandedPinnedGrenade>().UpdateInteraction_Hooked(self, hand);
			orig.Invoke(self, hand);
		}
		private void PinnedGrenade_ReleaseLever(orig_ReleaseLever orig, PinnedGrenade self)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (((FVRInteractiveObject)self).IsHeld)
			{
				FVRViveHand hand = ((FVRInteractiveObject)self).m_hand;
				if (!hand.IsInStreamlinedMode)
				{
					Vector2 touchpadAxes = hand.Input.TouchpadAxes;
					if (hand.Input.TouchpadDown && (((Vector2)(ref touchpadAxes)).magnitude < 0.2f || Vector2.Angle(touchpadAxes, Vector2.up) > 45f))
					{
						return;
					}
				}
			}
			orig.Invoke(self);
		}
		private void PinnedGrenade_IncreaseFuseSetting(orig_IncreaseFuseSetting orig, PinnedGrenade self)
		{
		}
		private void FVRCappedGrenade_Start(orig_Start orig, FVRCappedGrenade self)
		{
			orig.Invoke(self);
			((Component)self).gameObject.AddComponent<OneHandedCappedGrenade>();
		}
		private void FVRCappedGrenade_FVRFixedUpdate(orig_FVRFixedUpdate orig, FVRCappedGrenade self)
		{
			if (((FVRInteractiveObject)self).IsHeld && !self.m_IsFuseActive)
			{
				((Component)self).GetComponent<OneHandedCappedGrenade>().FVRFixedUpdate_Hooked(self);
			}
			orig.Invoke(self);
		}
		private void TubeFedShotgunHandle_UpdateHandle(orig_UpdateHandle orig, TubeFedShotgunHandle self)
		{
			if ((Object)(object)WeaponPoseLock.instance.currentlyLockedWeapon != (Object)null && ((FVRPhysicalObject)self.Shotgun).IsAltHeld && (Object)(object)WeaponPoseLock.instance.currentlyLockedWeapon.thisFirearm == (Object)(object)self.Shotgun)
			{
				FVRViveHand[] hands = GM.CurrentMovementManager.Hands;
				foreach (FVRViveHand val in hands)
				{
					if ((Object)(object)val.CurrentInteractable == (Object)(object)self.Shotgun && (Object)(object)val.OtherHand.CurrentInteractable != (Object)(object)self.Shotgun)
					{
						if (val.Input.TriggerFloat >= 0.6f)
						{
							self.UnlockHandle();
						}
						break;
					}
				}
			}
			orig.Invoke(self);
		}
		private void RPG7_UpdateInteraction(orig_UpdateInteraction orig, RPG7 self, FVRViveHand hand)
		{
			orig.Invoke(self, hand);
			bool flag = false;
			if ((hand.IsInStreamlinedMode && hand.Input.AXButtonDown) || (!hand.IsInStreamlinedMode && hand.Input.TouchpadDown))
			{
				flag = true;
			}
			if (flag)
			{
				self.CockHammer();
			}
			if (hand.Input.TriggerDown)
			{
				self.Fire();
			}
			self.UpdateTriggerRot(hand.Input.TriggerFloat);
			if ((Object)(object)((FVRInteractiveObject)self).m_hand != (Object)null && (Object)(object)((FVRInteractiveObject)self).m_hand.CurrentInteractable == (Object)null)
			{
				Debug.Log((object)"a");
				((FVRInteractiveObject)self).EndInteraction(((FVRInteractiveObject)self).m_hand);
			}
		}
		private void FVRAlternateGrip_BeginInteraction(orig_BeginInteraction orig, FVRAlternateGrip self, FVRViveHand hand)
		{
			if (self is RPG7Foregrip)
			{
				RPG7Foregrip val = (RPG7Foregrip)(object)((self is RPG7Foregrip) ? self : null);
				if ((Object)(object)val != (Object)null && !((FVRInteractiveObject)val.RPG).IsHeld)
				{
					hand.CurrentInteractable = (FVRInteractiveObject)(object)val.RPG;
					((FVRInteractiveObject)val.RPG).BeginInteraction(hand);
					return;
				}
			}
			orig.Invoke(self, hand);
		}
		private void Minigun_Fire(orig_Fire orig, Minigun self)
		{
			orig.Invoke(self);
			self.DestabilizedShots = 0;
		}
	}
	internal class OneHandedPinnedGrenade : MonoBehaviour
	{
		private float pinPullDuration;
		private bool pinBeingPulled;
		private float pinPullDistance;
		private PinnedGrenadeRing? curRing;
		private bool hasPinPullReset = true;
		private void Awake()
		{
			pinPullDuration = AccessibilityOptionsBase.pinnedGrenadePinPullDuration.Value;
		}
		public void UpdateInteraction_Hooked(PinnedGrenade self, FVRViveHand hand)
		{
			//IL_0032: 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_0053: 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_0067: 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)
			bool flag = false;
			bool flag2 = false;
			if (hand.IsInStreamlinedMode)
			{
				if (hand.Input.BYButtonDown)
				{
					flag = true;
				}
				if (hand.Input.AXButtonDown)
				{
					flag2 = true;
				}
			}
			else
			{
				Vector2 touchpadAxes = hand.Input.TouchpadAxes;
				if (hand.Input.TouchpadDown && ((Vector2)(ref touchpadAxes)).magnitude > 0.2f)
				{
					if (Vector2.Angle(touchpadAxes, Vector2.up) <= 45f)
					{
						flag = true;
					}
					if (Vector2.Angle(touchpadAxes, Vector2.down) <= 45f)
					{
						flag2 = true;
					}
				}
			}
			if (flag)
			{
				for (int i = 0; i < self.m_rings.Count; i++)
				{
					if (!self.m_rings[i].HasPinDetached() && !((FVRInteractiveObject)self.m_rings[i]).IsHeld && hasPinPullReset)
					{
						curRing = self.m_rings[i];
						pinPullDistance = curRing.m_posMax - curRing.m_posMin;
						pinBeingPulled = true;
						break;
					}
				}
			}
			if (((hand.IsInStreamlinedMode && hand.Input.BYButtonUp) || (!hand.IsInStreamlinedMode && hand.Input.TouchpadUp)) && (Object)(object)curRing != (Object)null)
			{
				hasPinPullReset = true;
				pinBeingPulled = false;
				curRing = null;
			}
			if (pinBeingPulled)
			{
				RemoteUpdatePinPos();
			}
			if (flag2 && (Object)(object)self.FuseCylinder != (Object)null && !self.m_isPinPulled)
			{
				OneHandedIncreaseFuseSetting(self);
			}
		}
		private void OneHandedIncreaseFuseSetting(PinnedGrenade grenade)
		{
			if (grenade.m_fuseCylinderSetting < 4)
			{
				grenade.m_fuseCylinderSetting++;
			}
			else
			{
				grenade.m_fuseCylinderSetting = 0;
			}
			grenade.m_fuseTarYRotation = (float)grenade.m_fuseCylinderSetting * 24f - 48f;
		}
		private void RemoteUpdatePinPos()
		{
			//IL_00b2: 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_00dc: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)curRing != (Object)null) || curRing.HasPinDetached())
			{
				return;
			}
			if (curRing.UsesSwapPin && !curRing.m_hasSwapped)
			{
				curRing.m_hasSwapped = true;
				((Component)curRing.Pin).GetComponent<MeshFilter>().mesh = curRing.SwapPin;
			}
			if (pinPullDuration > 0f)
			{
				PinnedGrenadeRing? obj = curRing;
				obj.m_posCurrent += pinPullDistance * (Time.deltaTime / pinPullDuration);
				((Component)curRing).transform.localPosition = new Vector3(((Component)curRing).transform.localPosition.x, ((Component)curRing).transform.localPosition.y, curRing.m_posCurrent);
				((Component)curRing.Pin).transform.localPosition = new Vector3(((Component)curRing.Pin).transform.localPosition.x, ((Component)curRing.Pin).transform.localPosition.y, curRing.m_posCurrent);
				if (curRing.m_posCurrent > curRing.m_posMax)
				{
					RemoteDetachPin(curRing);
				}
			}
			else
			{
				RemoteDetachPin(curRing);
			}
		}
		private void RemoteDetachPin(PinnedGrenadeRing _ring)
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			if (!_ring.m_hasPinDetached)
			{
				pinBeingPulled = false;
				hasPinPullReset = false;
				_ring.m_hasPinDetached = true;
				_ring.Pin.RootRigidbody = ((Component)_ring.Pin).gameObject.AddComponent<Rigidbody>();
				_ring.Pin.RootRigidbody.mass = 0.02f;
				((Component)_ring).transform.SetParent(((Component)_ring.Pin).transform);
				((Behaviour)_ring.Pin).enabled = true;
				SM.PlayCoreSound((FVRPooledAudioType)10, _ring.G.AudEvent_Pinpull, ((Component)_ring.G).transform.position);
				((Component)_ring).GetComponent<Collider>().enabled = false;
				((Behaviour)_ring).enabled = false;
			}
		}
	}
	internal class OneHandedWristMenu : MonoBehaviour
	{
		private GameObject pointerPrefab;
		private Material pointerMat;
		private float verticalPointerOffset;
		private Color pointerColor;
		private float pointerScale;
		private FVRViveHand curHand;
		private IEnumerator pointerCoroutine;
		private GameObject spawnedPointer;
		private FVRPointableButton curPointable;
		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//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)
			FVRWristMenu2.ActivateOnHand += new hook_ActivateOnHand(FVRWristMenu2_ActivateOnHand);
			FVRWristMenu2.Deactivate += new hook_Deactivate(FVRWristMenu2_Deactivate);
			verticalPointerOffset = AccessibilityOptionsBase.verticalPointerOffset.Value;
			pointerColor = AccessibilityOptionsBase.pointerColor.Value;
			pointerScale = AccessibilityOptionsBase.pointerScale.Value;
			pointerPrefab = AccessibilityOptionsBase.pointerAssetBundle.LoadAsset<GameObject>("WristMenuPointer");
			pointerMat = ((Renderer)pointerPrefab.GetComponent<MeshRenderer>()).material;
			pointerCoroutine = PointWithHead();
		}
		private void FVRWristMenu2_ActivateOnHand(orig_ActivateOnHand orig, FVRWristMenu2 self, FVRViveHand hand)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			Vector3 localPosition = ((Component)hand).transform.localPosition;
			if (!(((Vector3)(ref localPosition)).magnitude < 0.01f))
			{
				orig.Invoke(self, hand);
				curHand = hand;
				if ((Object)(object)spawnedPointer == (Object)null)
				{
					spawnedPointer = Object.Instantiate<GameObject>(pointerPrefab);
					spawnedPointer.transform.localScale = new Vector3(pointerScale, pointerScale, pointerScale);
					pointerMat.color = pointerColor;
				}
				((MonoBehaviour)this).StartCoroutine(pointerCoroutine);
			}
		}
		private void FVRWristMenu2_Deactivate(orig_Deactivate orig, FVRWristMenu2 self)
		{
			orig.Invoke(self);
			((MonoBehaviour)this).StopCoroutine(pointerCoroutine);
			if ((Object)(object)curPointable != (Object)null && (Object)(object)curHand != (Object)null)
			{
				((FVRPointable)curPointable).EndPoint(curHand);
			}
			if ((Object)(object)spawnedPointer != (Object)null)
			{
				Object.Destroy((Object)(object)spawnedPointer);
			}
		}
		private IEnumerator PointWithHead()
		{
			RaycastHit val2 = default(RaycastHit);
			while (true)
			{
				_ = GM.CurrentPlayerBody.headRotationFiltered;
				Vector3 val = Quaternion.AngleAxis(verticalPointerOffset * -1f, GM.CurrentPlayerBody.Head.right) * GM.CurrentPlayerBody.Head.forward;
				if (Physics.Raycast(GM.CurrentPlayerBody.headPositionFiltered, val, ref val2, 1f, LayerMask.op_Implicit(curHand.PointingLayerMask), (QueryTriggerInteraction)2))
				{
					if ((Object)(object)((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<FVRWristMenu2>() != (Object)null)
					{
						spawnedPointer.SetActive(true);
						spawnedPointer.transform.position = ((RaycastHit)(ref val2)).point;
						if ((Object)(object)((Component)((RaycastHit)(ref val2)).collider).GetComponent<FVRPointableButton>() != (Object)null)
						{
							FVRPointableButton component = ((Component)((RaycastHit)(ref val2)).collider).GetComponent<FVRPointableButton>();
							if ((Object)(object)curPointable != (Object)null && (Object)(object)component != (Object)(object)curPointable)
							{
								((FVRPointable)curPointable).EndPoint(curHand);
							}
							curPointable = component;
							((FVRPointable)curPointable).OnPoint(curHand);
						}
					}
				}
				else
				{
					if ((Object)(object)curPointable != (Object)null)
					{
						((FVRPointable)curPointable).EndPoint(curHand);
					}
					spawnedPointer.SetActive(false);
				}
				yield return null;
			}
		}
	}
	internal static class PluginInfo
	{
		internal const string NAME = "Accessibility Options";
		internal const string GUID = "okkim.accessibilityoptions";
		internal const string VERSION = "1.0.0";
	}
	public static class ReflectiveEnumerator
	{
		static ReflectiveEnumerator()
		{
		}
		public static IEnumerable<T> GetEnumerableOfType<T>(params object[] constructorArgs) where T : LockableWeapon, IComparable<T>
		{
			List<T> list = new List<T>();
			foreach (Type item in from myType in Assembly.GetAssembly(typeof(T)).GetTypes()
				where myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(T))
				select myType)
			{
				list.Add((T)Activator.CreateInstance(item, constructorArgs));
			}
			list.Sort();
			return list;
		}
	}
	public abstract class LockableWeapon<T> : LockableWeapon where T : MonoBehaviour
	{
		protected T Target { get; private set; }
		protected virtual void Awake()
		{
			Target = ((Component)this).GetComponent<T>();
			thisFirearm = ((Component)this).GetComponent<FVRFireArm>();
			chambers = thisFirearm.GetChambers();
			durationForPoseLock = WeaponPoseLock.instance.triggerDuration;
		}
		private void OnDestroy()
		{
			if ((Object)(object)WeaponPoseLock.instance.currentlyLockedWeapon == (Object)(object)this)
			{
				UnlockWeapon();
			}
		}
	}
	public abstract class LockableWeapon : MonoBehaviour
	{
		private enum WeaponLockState
		{
			Unlocked,
			Locking,
			Locked
		}
		public FVRFireArm thisFirearm;
		protected List<FVRFireArmChamber> chambers;
		public float durationForPoseLock;
		private float curTriggerDuration;
		private bool isValidForPoseLock;
		private WeaponLockState lockState;
		public bool unlocksAfterFiring { get; protected set; } = true;
		public bool skipChamberCheck { get; protected set; }
		public abstract bool CanFire();
		public virtual bool IsBoltMoving()
		{
			return false;
		}
		public void CheckChamberTriggerAmt(bool _isFiring)
		{
			FVRViveHand hand = ((FVRInteractiveObject)thisFirearm).m_hand;
			if (hand != null && hand.Input.TriggerFloat >= 0.6f)
			{
				if (!_isFiring)
				{
					isValidForPoseLock = true;
					return;
				}
				if (!skipChamberCheck)
				{
					bool flag = true;
					foreach (FVRFireArmChamber chamber in chambers)
					{
						if (chamber.IsFull && !chamber.IsSpent)
						{
							flag = false;
							break;
						}
					}
					isValidForPoseLock = flag;
					return;
				}
			}
			isValidForPoseLock = false;
		}
		private void Update()
		{
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			switch (lockState)
			{
			case WeaponLockState.Unlocked:
				curTriggerDuration = 0f;
				if (isValidForPoseLock)
				{
					lockState = WeaponLockState.Locking;
				}
				break;
			case WeaponLockState.Locking:
				if (isValidForPoseLock)
				{
					FVRViveHand hand = ((FVRInteractiveObject)thisFirearm).m_hand;
					if ((hand == null || !(hand.Input.TriggerFloat < 0.6f)) && !IsBoltMoving())
					{
						curTriggerDuration += Time.deltaTime;
						if (curTriggerDuration > durationForPoseLock)
						{
							lockState = WeaponLockState.Locked;
						}
						break;
					}
				}
				lockState = WeaponLockState.Unlocked;
				break;
			case WeaponLockState.Locked:
				if ((Object)(object)WeaponPoseLock.instance.currentlyLockedWeapon != (Object)null && (Object)(object)WeaponPoseLock.instance.currentlyLockedWeapon != (Object)(object)this)
				{
					WeaponPoseLock.instance.currentlyLockedWeapon.UnlockWeapon();
				}
				if ((Object)(object)WeaponPoseLock.instance.currentlyLockedWeapon == (Object)null)
				{
					LockWeapon();
					break;
				}
				if (!((FVRPhysicalObject)thisFirearm).RootRigidbody.isKinematic)
				{
					((FVRPhysicalObject)thisFirearm).RootRigidbody.isKinematic = true;
				}
				if ((Object)(object)((Component)thisFirearm).transform.parent != (Object)null)
				{
					((Component)thisFirearm).transform.SetParent((Transform)null);
				}
				((Component)thisFirearm).gameObject.transform.position = WeaponPoseLock.instance.lockedWeaponProxy.transform.position;
				((Component)thisFirearm).gameObject.transform.rotation = WeaponPoseLock.instance.lockedWeaponProxy.transform.rotation;
				break;
			}
		}
		public virtual void LockWeapon()
		{
			//IL_0058: 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_0069: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)thisFirearm).m_hand.Buzz(((FVRInteractiveObject)thisFirearm).m_hand.Buzzer.Buzz_BeginInteraction);
			WeaponPoseLock.instance.currentlyLockedWeapon = this;
			((FVRPhysicalObject)thisFirearm).IsKinematicLocked = true;
			((FVRPhysicalObject)thisFirearm).RootRigidbody.isKinematic = true;
			WeaponPoseLock.instance.lockedWeaponSize = ((FVRPhysicalObject)thisFirearm).Size;
			((FVRPhysicalObject)thisFirearm).Size = (FVRPhysicalObjectSize)5;
			WeaponPoseLock.instance.lockedWeaponProxy.transform.position = ((Component)thisFirearm).transform.position;
			WeaponPoseLock.instance.lockedWeaponProxy.transform.rotation = ((Component)thisFirearm).transform.rotation;
		}
		public virtual void UnlockWeapon()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			isValidForPoseLock = false;
			WeaponPoseLock.instance.currentlyLockedWeapon = null;
			lockState = WeaponLockState.Unlocked;
			((FVRPhysicalObject)thisFirearm).IsKinematicLocked = false;
			((FVRPhysicalObject)thisFirearm).RootRigidbody.isKinematic = false;
			((FVRPhysicalObject)thisFirearm).Size = WeaponPoseLock.instance.lockedWeaponSize;
		}
	}
	public class LockableAirgun : LockableWeapon<Airgun>
	{
		private Airgun AG;
		protected override void Awake()
		{
			base.Awake();
			ref Airgun aG = ref AG;
			FVRFireArm obj = thisFirearm;
			aG = (Airgun)(object)((obj is Airgun) ? obj : null);
		}
		public override bool CanFire()
		{
			if ((Object)(object)AG != (Object)null && (!AG.Chamber.IsFull || AG.Abarrel.m_isBreachOpen || !AG.m_isHammerCocked))
			{
				return false;
			}
			return true;
		}
	}
	public class LockableBAP : LockableWeapon<BAP>
	{
		private BAP bap;
		protected override void Awake()
		{
			base.Awake();
			ref BAP reference = ref bap;
			FVRFireArm obj = thisFirearm;
			reference = (BAP)(object)((obj is BAP) ? obj : null);
		}
		public override bool CanFire()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)bap != (Object)null && (int)bap.FireSelector_Modes[bap.m_fireSelectorMode].ModeType == 0)
			{
				return false;
			}
			return true;
		}
	}
	public class LockableBoltActionRifle : LockableWeapon<BoltActionRifle>
	{
		private BoltActionRifle BAR;
		protected override void Awake()
		{
			base.Awake();
			ref BoltActionRifle bAR = ref BAR;
			FVRFireArm obj = thisFirearm;
			bAR = (BoltActionRifle)(object)((obj is BoltActionRifle) ? obj : null);
		}
		public override bool CanFire()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)BAR != (Object)null && (int)BAR.FireSelector_Modes[BAR.m_fireSelectorMode].ModeType == 0)
			{
				return false;
			}
			return true;
		}
	}
	public class LockableBreakActionWeapon : LockableWeapon<BreakActionWeapon>
	{
		private BreakActionWeapon BAW;
		protected override void Awake()
		{
			base.Awake();
			ref BreakActionWeapon bAW = ref BAW;
			FVRFireArm obj = thisFirearm;
			bAW = (BreakActionWeapon)(object)((obj is BreakActionWeapon) ? obj : null);
		}
		public override bool CanFire()
		{
			if ((Object)(object)BAW != (Object)null && (!BAW.IsLatched || !BAW.HasTriggerReset))
			{
				return false;
			}
			return true;
		}
	}
	public class LockableCarlGustaf : LockableWeapon<CarlGustaf>
	{
		private CarlGustaf CG;
		protected override void Awake()
		{
			base.Awake();
			ref CarlGustaf cG = ref CG;
			FVRFireArm obj = thisFirearm;
			cG = (CarlGustaf)(object)((obj is CarlGustaf) ? obj : null);
		}
		public override bool CanFire()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)CG != (Object)null && (!CG.Chamber.IsFull || CG.Chamber.IsSpent || (int)CG.CHState != 0 || (int)CG.TailLatch.LState != 0))
			{
				return false;
			}
			return true;
		}
	}
	public class LockableClosedBoltWeapon : LockableWeapon<ClosedBoltWeapon>
	{
		private ClosedBoltWeapon CBW;
		private FireSelectorModeType fireMode;
		protected override void Awake()
		{
			base.Awake();
			ref ClosedBoltWeapon cBW = ref CBW;
			FVRFireArm obj = thisFirearm;
			cBW = (ClosedBoltWeapon)(object)((obj is ClosedBoltWeapon) ? obj : null);
		}
		public override bool CanFire()
		{
			//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_0031: 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_0041: Invalid comparison between Unknown and I4
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Invalid comparison between Unknown and I4
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Invalid comparison between Unknown and I4
			if ((Object)(object)CBW != (Object)null)
			{
				fireMode = CBW.FireSelector_Modes[CBW.m_fireSelectorMode].ModeType;
				if ((int)fireMode == 0)
				{
					return false;
				}
				if ((int)fireMode == 1 && !CBW.m_hasTriggerReset)
				{
					return false;
				}
				if (((int)fireMode == 2 && CBW.m_CamBurst == 0) || (int)fireMode == 4)
				{
					return false;
				}
			}
			return true;
		}
		public override bool IsBoltMoving()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Invalid comparison between Unknown and I4
			if ((int)CBW.Bolt.CurPos == 0 || (int)CBW.Bolt.CurPos == 2)
			{
				return false;
			}
			return true;
		}
	}
	public class LockableDerringer : LockableWeapon<Derringer>
	{
		private Derringer derringer;
		protected override void Awake()
		{
			base.Awake();
			ref Derringer reference = ref derringer;
			FVRFireArm obj = thisFirearm;
			reference = (Derringer)(object)((obj is Derringer) ? obj : null);
		}
		public override bool CanFire()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Invalid comparison between Unknown and I4
			if ((Object)(object)derringer != (Object)null && ((derringer.HasExternalHammer && !derringer.IsExternalHammerCocked()) || !derringer.m_hasTriggerReset || (int)derringer.GetHingeState() == 2))
			{
				return false;
			}
			return true;
		}
	}
	public class LockableFlaregun : LockableWeapon<Flaregun>
	{
		private Flaregun FG;
		protected override void Awake()
		{
			base.Awake();
			ref Flaregun fG = ref FG;
			FVRFireArm obj = thisFirearm;
			fG = (Flaregun)(object)((obj is Flaregun) ? obj : null);
		}
		public override bool CanFire()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Invalid comparison between Unknown and I4
			if ((Object)(object)FG != (Object)null && (!FG.m_isHammerCocked || !FG.m_isTriggerReset || (int)FG.m_hingeState == 2))
			{
				return false;
			}
			return true;
		}
	}
	public class LockableHandgun : LockableWeapon<Handgun>
	{
		private Handgun HG;
		private FireSelectorModeType fireMode;
		protected override void Awake()
		{
			base.Awake();
			ref Handgun hG = ref HG;
			FVRFireArm obj = thisFirearm;
			hG = (Handgun)(object)((obj is Handgun) ? obj : null);
		}
		public override bool CanFire()
		{
			//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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Invalid comparison between Unknown and I4
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Invalid comparison between Unknown and I4
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Invalid comparison between Unknown and I4
			if ((Object)(object)HG != (Object)null)
			{
				fireMode = HG.FireSelectorModes[HG.m_fireSelectorMode].ModeType;
				if ((int)fireMode == 3)
				{
					return false;
				}
				if ((int)fireMode == 1 && !HG.HasTriggerReset)
				{
					return false;
				}
				if ((int)fireMode == 4 && HG.m_CamBurst == 0)
				{
					return false;
				}
			}
			return true;
		}
		public override bool IsBoltMoving()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Invalid comparison between Unknown and I4
			if ((int)HG.Slide.CurPos == 0 || (int)HG.Slide.CurPos == 2)
			{
				return false;
			}
			return true;
		}
	}
	public class LockableLeverActionFirearm : LockableWeapon<LeverActionFirearm>
	{
		private LeverActionFirearm LAF;
		protected override void Awake()
		{
			base.Awake();
			ref LeverActionFirearm lAF = ref LAF;
			FVRFireArm obj = thisFirearm;
			lAF = (LeverActionFirearm)(object)((obj is LeverActionFirearm) ? obj : null);
		}
		public override bool CanFire()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Invalid comparison between Unknown and I4
			if ((Object)(object)LAF != (Object)null && (LAF.m_isSpinning || (int)LAF.m_curLeverPos != 2 || !LAF.m_isHammerCocked || (LAF.UsesSecondChamber && !LAF.m_isHammerCocked2)))
			{
				return false;
			}
			return true;
		}
		public override void LockWeapon()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			base.LockWeapon();
			LAF.m_curLeverPos = (ZPos)0;
			LAF.m_tarLeverRot = LAF.LeverAngleRange.x;
		}
		public override void UnlockWeapon()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			base.UnlockWeapon();
			LAF.m_curLeverPos = (ZPos)2;
			LAF.m_tarLeverRot = LAF.LeverAngleRange.y;
		}
	}
	public class LockableM72 : LockableWeapon<M72>
	{
		private M72 m72;
		protected override void Awake()
		{
			base.Awake();
			ref M72 reference = ref m72;
			FVRFireArm obj = thisFirearm;
			reference = (M72)(object)((obj is M72) ? obj : null);
		}
		public override bool CanFire()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Invalid comparison between Unknown and I4
			if ((Object)(object)m72 != (Object)null && (m72.m_isSafetyEngaged || (int)m72.TState != 2 || !m72.Chamber.IsFull))
			{
				return false;
			}
			return true;
		}
	}
	public class LockableMinigun : LockableWeapon<Minigun>
	{
		private Minigun MG;
		protected override void Awake()
		{
			base.Awake();
			ref Minigun mG = ref MG;
			FVRFireArm obj = thisFirearm;
			mG = (Minigun)(object)((obj is Minigun) ? obj : null);
			base.skipChamberCheck = true;
		}
		public override bool CanFire()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			if ((Object)(object)MG != (Object)null)
			{
				MinigunBox val = (MinigunBox)((FVRFireArm)MG).Magazine;
				if ((Object)(object)val == (Object)null || ((Object)(object)val != (Object)null && !val.HasAmmo()))
				{
					return false;
				}
			}
			return true;
		}
	}
	public class LockableOpenBoltReceiver : LockableWeapon<OpenBoltReceiver>
	{
		private OpenBoltReceiver OBR;
		private FireSelectorModeType fireMode;
		protected override void Awake()
		{
			base.Awake();
			ref OpenBoltReceiver oBR = ref OBR;
			FVRFireArm obj = thisFirearm;
			oBR = (OpenBoltReceiver)(object)((obj is OpenBoltReceiver) ? obj : null);
		}
		public override bool CanFire()
		{
			//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_0031: 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_0041: Invalid comparison between Unknown and I4
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Invalid comparison between Unknown and I4
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Invalid comparison between Unknown and I4
			if ((Object)(object)OBR != (Object)null)
			{
				fireMode = OBR.FireSelector_Modes[OBR.m_fireSelectorMode].ModeType;
				if ((int)fireMode == 0)
				{
					return false;
				}
				if ((int)fireMode == 1 && OBR.m_hasTriggerCycled)
				{
					return false;
				}
				if (((int)fireMode == 4 && OBR.m_CamBurst == 0) || (int)fireMode == 3)
				{
					return false;
				}
			}
			return true;
		}
		public override bool IsBoltMoving()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Invalid comparison between Unknown and I4
			if ((int)OBR.Bolt.CurPos == 0 || (int)OBR.Bolt.CurPos == 2)
			{
				return false;
			}
			return true;
		}
	}
	public class LockableRailTater : LockableWeapon<RailTater>
	{
		private RailTater RT;
		protected override void Awake()
		{
			base.Awake();
			ref RailTater rT = ref RT;
			FVRFireArm obj = thisFirearm;
			rT = (RailTater)(object)((obj is RailTater) ? obj : null);
		}
		public override bool CanFire()
		{
			//IL_002b: 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_0043: Invalid comparison between Unknown and I4
			if ((Object)(object)RT != (Object)null && (!RT.Chamber.IsFull || (int)RT.BoltHandle.HandleState != 0 || (int)RT.BoltHandle.HandleRot != 2))
			{
				return false;
			}
			return true;
		}
	}
	public class LockableRevolver : LockableWeapon<Revolver>
	{
		private Revolver revolver;
		protected override void Awake()
		{
			base.Awake();
			ref Revolver reference = ref revolver;
			FVRFireArm obj = thisFirearm;
			reference = (Revolver)(object)((obj is Revolver) ? obj : null);
		}
		public override bool CanFire()
		{
			if ((Object)(object)revolver != (Object)null && (revolver.m_hasTriggerCycled || !revolver.isCylinderArmLocked))
			{
				return false;
			}
			return true;
		}
	}
	public class LockableRevolvingShotgun : LockableWeapon<RevolvingShotgun>
	{
		private RevolvingShotgun RS;
		private FireSelectorModeType fireMode;
		protected override void Awake()
		{
			base.Awake();
			ref RevolvingShotgun rS = ref RS;
			FVRFireArm obj = thisFirearm;
			rS = (RevolvingShotgun)(object)((obj is RevolvingShotgun) ? obj : null);
		}
		public override bool CanFire()
		{
			//IL_0029: 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_0034: 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)
			//IL_0044: Invalid comparison between Unknown and I4
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Invalid comparison between Unknown and I4
			if ((Object)(object)RS != (Object)null)
			{
				fireMode = RS.FireSelector_Modes[RS.m_fireSelectorMode].ModeType;
				if ((int)fireMode == 0)
				{
					return false;
				}
				if ((int)fireMode == 1 && RS.m_hasTriggerCycled)
				{
					return false;
				}
				if ((int)fireMode == 2 && RS.m_hasTriggerCycled && (!RS.Chambers[RS.CurChamber].IsFull || RS.Chambers[RS.CurChamber].IsSpent))
				{
					return false;
				}
			}
			return true;
		}
	}
	public class LockableRollingBlock : LockableWeapon<RollingBlock>
	{
		private RollingBlock RB;
		protected override void Awake()
		{
			base.Awake();
			ref RollingBlock rB = ref RB;
			FVRFireArm obj = thisFirearm;
			rB = (RollingBlock)(object)((obj is RollingBlock) ? obj : null);
		}
		public override bool CanFire()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			if ((Object)(object)RB != (Object)null && ((int)RB.m_state != 1 || !RB.Chamber.IsFull || RB.Chamber.IsSpent))
			{
				return false;
			}
			return true;
		}
	}
	public class LockableRPG7 : LockableWeapon<RPG7>
	{
		private RPG7 RPG;
		protected override void Awake()
		{
			base.Awake();
			ref RPG7 rPG = ref RPG;
			FVRFireArm obj = thisFirearm;
			rPG = (RPG7)(object)((obj is RPG7) ? obj : null);
		}
		public override bool CanFire()
		{
			if ((Object)(object)RPG != (Object)null && !RPG.m_isHammerCocked)
			{
				return false;
			}
			return true;
		}
	}
	public class LockableSimpleLauncher : LockableWeapon<SimpleLauncher>
	{
		private SimpleLauncher SL;
		protected override void Awake()
		{
			base.Awake();
			ref SimpleLauncher sL = ref SL;
			FVRFireArm obj = thisFirearm;
			sL = (SimpleLauncher)(object)((obj is SimpleLauncher) ? obj : null);
			base.unlocksAfterFiring = false;
		}
		public override bool CanFire()
		{
			return false;
		}
	}
	public class LockableSimpleLauncher2 : LockableWeapon<SimpleLauncher2>
	{
		private SimpleLauncher2 SL2;
		protected override void Awake()
		{
			base.Awake();
			ref SimpleLauncher2 sL = ref SL2;
			FVRFireArm obj = thisFirearm;
			sL = (SimpleLauncher2)(object)((obj is SimpleLauncher2) ? obj : null);
			base.unlocksAfterFiring = false;
		}
		public override bool CanFire()
		{
			return false;
		}
	}
	public class LockableSingleActionRevolver : LockableWeapon<SingleActionRevolver>
	{
		private SingleActionRevolver SAR;
		protected override void Awake()
		{
			base.Awake();
			ref SingleActionRevolver sAR = ref SAR;
			FVRFireArm obj = thisFirearm;
			sAR = (SingleActionRevolver)(object)((obj is SingleActionRevolver) ? obj : null);
		}
		public override bool CanFire()
		{
			if ((Object)(object)SAR != (Object)null && (!SAR.m_isHammerCocked || SAR.m_isStateToggled))
			{
				return false;
			}
			return true;
		}
	}
	public class LockableSRG : LockableWeapon<SRG>
	{
		private SRG srg;
		protected override void Awake()
		{
			base.Awake();
			ref SRG reference = ref srg;
			FVRFireArm obj = thisFirearm;
			reference = (SRG)(object)((obj is SRG) ? obj : null);
		}
		public override bool CanFire()
		{
			if ((Object)(object)srg != (Object)null && ((Object)(object)((FVRFireArm)srg).Magazine == (Object)null || !srg.Chamber.IsFull || !srg.m_canFire))
			{
				return false;
			}
			return true;
		}
	}
	public class LockableTubeFedShotgun : LockableWeapon<TubeFedShotgun>
	{
		private TubeFedShotgun? TFS;
		protected override void Awake()
		{
			base.Awake();
			ref TubeFedShotgun? tFS = ref TFS;
			FVRFireArm obj = thisFirearm;
			tFS = (TubeFedShotgun?)(object)((obj is TubeFedShotgun) ? obj : null);
		}
		public override bool CanFire()
		{
			if ((Object)(object)TFS != (Object)null && TFS.HasSafety && TFS.IsSafetyEngaged)
			{
				return false;
			}
			return true;
		}
		public override bool IsBoltMoving()
		{
			//IL_0006: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Invalid comparison between Unknown and I4
			if ((int)TFS.Mode == 0)
			{
				return false;
			}
			if ((int)TFS.Bolt.CurPos == 0 || (int)TFS.Bolt.CurPos == 2)
			{
				return false;
			}
			return true;
		}
	}
	internal class WeaponPoseLock : MonoBehaviour
	{
		public static WeaponPoseLock instance;
		public Dictionary<Type, Type> LockableWeaponDict = new Dictionary<Type, Type>();
		public float triggerDuration;
		public LockableWeapon currentlyLockedWeapon;
		public FVRPhysicalObjectSize lockedWeaponSize;
		public GameObject lockedWeaponProxy;
		private void Awake()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			instance = this;
			triggerDuration = AccessibilityOptionsBase.weaponPoseLockingTriggerDuration.Value;
			GM.InitScene += new hook_InitScene(GM_InitScene);
			FVRFireArm.Awake += new hook_Awake(FVRFireArm_Awake);
			FVRFireArm.FVRUpdate += new hook_FVRUpdate(FVRFireArm_FVRUpdate);
			FVRFireArm.BeginInteraction += new hook_BeginInteraction(FVRFireArm_BeginInteraction);
			FVRQuickBeltSlot.MoveContentsInstant += new hook_MoveContentsInstant(FVRQuickBeltSlot_MoveContentsInstant);
			FVRQuickBeltSlot.MoveContents += new hook_MoveContents(FVRQuickBeltSlot_MoveContents);
			FVRQuickBeltSlot.MoveContentsCheap += new hook_MoveContentsCheap(FVRQuickBeltSlot_MoveContentsCheap);
			LockableWeaponDict[typeof(BoltActionRifle)] = typeof(LockableBoltActionRifle);
			LockableWeaponDict[typeof(TubeFedShotgun)] = typeof(LockableTubeFedShotgun);
			LockableWeaponDict[typeof(ClosedBoltWeapon)] = typeof(LockableClosedBoltWeapon);
			LockableWeaponDict[typeof(OpenBoltReceiver)] = typeof(LockableOpenBoltReceiver);
			LockableWeaponDict[typeof(Handgun)] = typeof(LockableHandgun);
			LockableWeaponDict[typeof(BAP)] = typeof(LockableBAP);
			LockableWeaponDict[typeof(Revolver)] = typeof(LockableRevolver);
			LockableWeaponDict[typeof(SingleActionRevolver)] = typeof(LockableSingleActionRevolver);
			LockableWeaponDict[typeof(Flaregun)] = typeof(LockableFlaregun);
			LockableWeaponDict[typeof(BreakActionWeapon)] = typeof(LockableBreakActionWeapon);
			LockableWeaponDict[typeof(Derringer)] = typeof(LockableDerringer);
			LockableWeaponDict[typeof(RevolvingShotgun)] = typeof(LockableRevolvingShotgun);
			LockableWeaponDict[typeof(RollingBlock)] = typeof(LockableRollingBlock);
			LockableWeaponDict[typeof(LeverActionFirearm)] = typeof(LockableLeverActionFirearm);
			LockableWeaponDict[typeof(RPG7)] = typeof(LockableRPG7);
			LockableWeaponDict[typeof(RailTater)] = typeof(LockableRailTater);
			LockableWeaponDict[typeof(CarlGustaf)] = typeof(LockableCarlGustaf);
			LockableWeaponDict[typeof(Airgun)] = typeof(LockableAirgun);
			LockableWeaponDict[typeof(SRG)] = typeof(LockableSRG);
			LockableWeaponDict[typeof(SimpleLauncher)] = typeof(LockableSimpleLauncher);
			LockableWeaponDict[typeof(SimpleLauncher2)] = typeof(LockableSimpleLauncher2);
			LockableWeaponDict[typeof(M72)] = typeof(LockableM72);
			LockableWeaponDict[typeof(Minigun)] = typeof(LockableMinigun);
		}
		private void GM_InitScene(orig_InitScene orig, GM self)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			orig.Invoke(self);
			lockedWeaponProxy = Object.Instantiate<GameObject>(new GameObject(), ((Component)GM.CurrentPlayerBody).gameObject.transform);
			((Object)lockedWeaponProxy).name = "lockedWeaponProxy";
			GM.CurrentSceneSettings.ShotFiredEvent -= new ShotFired(OnShotFired);
			GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(OnShotFired);
		}
		private void FVRFireArm_Awake(orig_Awake orig, FVRFireArm self)
		{
			orig.Invoke(self);
			Type type = ((object)self).GetType();
			do
			{
				if ((object)type != null)
				{
					LockableWeaponDict.TryGetValue(type, out Type value);
					if ((object)value != null)
					{
						((Component)self).gameObject.AddComponent(value);
						break;
					}
					type = type.BaseType;
				}
			}
			while ((object)type != null);
		}
		private void FVRFireArm_BeginInteraction(orig_BeginInteraction orig, FVRFireArm self, FVRViveHand hand)
		{
			orig.Invoke(self, hand);
			if ((Object)(object)currentlyLockedWeapon != (Object)null)
			{
				LockableWeapon component = ((Component)self).gameObject.GetComponent<LockableWeapon>();
				if ((Object)(object)component != (Object)null && (Object)(object)component == (Object)(object)currentlyLockedWeapon && (!((FVRPhysicalObject)component.thisFirearm).IsAltHeld || !((Object)(object)((FVRInteractiveObject)component.thisFirearm).m_hand.OtherHand.m_currentInteractable != (Object)(object)component.thisFirearm)))
				{
					component.UnlockWeapon();
				}
			}
		}
		private void FVRFireArm_FVRUpdate(orig_FVRUpdate orig, FVRFireArm self)
		{
			orig.Invoke(self);
			if ((Object)(object)((FVRInteractiveObject)self).m_hand != (Object)null && !((FVRPhysicalObject)self).IsAltHeld)
			{
				LockableWeapon component = ((Component)self).GetComponent<LockableWeapon>();
				if ((Object)(object)component != (Object)null)
				{
					component.CheckChamberTriggerAmt(component.CanFire());
				}
			}
		}
		private void OnShotFired(FVRFireArm _firearm)
		{
			if ((Object)(object)currentlyLockedWeapon != (Object)null && (Object)(object)_firearm == (Object)(object)currentlyLockedWeapon.thisFirearm && currentlyLockedWeapon.unlocksAfterFiring)
			{
				currentlyLockedWeapon.UnlockWeapon();
			}
		}
		private void FVRQuickBeltSlot_MoveContentsInstant(orig_MoveContentsInstant orig, FVRQuickBeltSlot self, Vector3 dir)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			if (!IsQBWeaponLocked(self))
			{
				orig.Invoke(self, dir);
			}
		}
		private void FVRQuickBeltSlot_MoveContents(orig_MoveContents orig, FVRQuickBeltSlot self, Vector3 dir)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			if (!IsQBWeaponLocked(self))
			{
				orig.Invoke(self, dir);
			}
		}
		private void FVRQuickBeltSlot_MoveContentsCheap(orig_MoveContentsCheap orig, FVRQuickBeltSlot self, Vector3 dir)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			if (!IsQBWeaponLocked(self))
			{
				orig.Invoke(self, dir);
			}
		}
		private bool IsQBWeaponLocked(FVRQuickBeltSlot slot)
		{
			if ((Object)(object)slot.CurObject != (Object)null && (Object)(object)((Component)slot.CurObject).GetComponent<LockableWeapon>() != (Object)null && (Object)(object)currentlyLockedWeapon == (Object)(object)((Component)slot).GetComponent<LockableWeapon>())
			{
				return true;
			}
			return false;
		}
	}
}