Decompiled source of H3TVR v1.0.0

H3TVR.dll

Decompiled 5 days ago
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 HarmonyLib;
using UnityEngine;
using Valve.VR;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("H3TVR")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+857dbeb93856c9134bb927f944b3fff65f03af0f")]
[assembly: AssemblyProduct("H3TVR")]
[assembly: AssemblyTitle("H3TVR")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace H3TVR;

public class Hooks
{
	public void Hook()
	{
	}

	public void Unhook()
	{
	}
}
internal static class PluginInfo
{
	internal const string NAME = "H3TVR";

	internal const string GUID = "com.MrBeam.h3tvr";

	internal const string VERSION = "1.0.0";
}
[BepInPlugin("com.MrBeam.h3tvr", "H3TVR", "1.0.0")]
[BepInProcess("h3vr.exe")]
public class H3TVR : BaseUnityPlugin
{
	[CompilerGenerated]
	private sealed class <RealisticFallWait>d__56 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public H3TVR <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <RealisticFallWait>d__56(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSecondsRealtime(1f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.ZeroGravityBumpUp();
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <SlomoWait>d__54 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public H3TVR <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <SlomoWait>d__54(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSecondsRealtime(2f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.SlomoStatus = "Return";
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <ZeroGWait>d__55 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public H3TVR <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ZeroGWait>d__55(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(6f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.ZeroGStatus = "Falling";
				<>4__this.RealisticFall();
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private const float SlowdownFactor = 0.001f;

	private const float SlowdownLength = 6f;

	public string SlomoStatus = "Off";

	private const float MaxSlomo = 0.1f;

	private const float SlomoWaitTime = 2f;

	private const float ZeroGWaitTime = 6f;

	private const float RealisticFallTime = 1f;

	private string ZeroGStatus = "Off";

	private readonly Hooks _hooks;

	public readonly string filePath = string.Empty;

	public ConfigEntry<string> GunList;

	public ConfigEntry<string> MagazineList;

	private ConfigEntry<KeyCode> Key0;

	private ConfigEntry<KeyCode> Key1;

	private ConfigEntry<KeyCode> Key2;

	private ConfigEntry<KeyCode> Key3;

	private ConfigEntry<KeyCode> Key4;

	private ConfigEntry<KeyCode> Key5;

	private ConfigEntry<KeyCode> Key6;

	private ConfigEntry<KeyCode> Key7;

	private ConfigEntry<KeyCode> Key8;

	private ConfigEntry<KeyCode> Key9;

	private ConfigEntry<KeyCode> Key10;

	private ConfigEntry<KeyCode> Key11;

	private ConfigEntry<KeyCode> Key12;

	private ConfigEntry<KeyCode> Key13;

	private ConfigEntry<KeyCode> Key14;

	private ConfigEntry<KeyCode> Key15;

	private ConfigEntry<KeyCode> KeyToggleFireMode;

	private ConfigEntry<KeyCode> KeyRandomizeHeldGun;

	private ConfigEntry<KeyCode> KeyEmptyChamber;

	private ConfigEntry<KeyCode> KeyBoostMalfunction;

	private bool _malfunctionBoostActive;

	private float _malfunctionBoostEndTime;

	private ConfigEntry<float> MalfunctionBoostDurationSeconds;

	private ConfigEntry<float> MalfunctionBoostDurationMinutes;

	private const float ForcedMalfunctionChance = 0.75f;

	private ConfigEntry<float> ShurikenScaleMultiplier;

	public ConfigFile FilePath { get; set; }

	public H3TVR()
	{
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Expected O, but got Unknown
		_hooks = new Hooks();
		_hooks.Hook();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading H3TVR");
		FilePath = new ConfigFile("configPath.cfg", true);
		GunList = ((BaseUnityPlugin)this).Config.Bind<string>("General", "GunList", "DefaultGunList", "List of guns");
		MagazineList = ((BaseUnityPlugin)this).Config.Bind<string>("General", "MagazineList", "DefaultMagazineList", "List of magazines");
		Key0 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForWonderToy", (KeyCode)256, "The key used to spawn WonderToy");
		Key1 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForPillow", (KeyCode)257, "The key used to spawn Pillow");
		Key2 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForFlash", (KeyCode)258, "The key used to spawn Flash");
		Key3 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForShuri", (KeyCode)259, "The key used to spawn Shuri");
		Key4 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForNadeRain", (KeyCode)260, "The key used to spawn Nade Rain");
		Key5 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForHydration", (KeyCode)261, "The key used to spawn Hydration");
		Key6 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForJeditToy", (KeyCode)262, "The key used to spawn Jedit Toy");
		Key7 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForSlomo", (KeyCode)263, "The key used to trigger Slomo");
		Key8 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForDestroyHeld", (KeyCode)264, "The key used to destroy held object");
		Key9 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForSkittySubGun", (KeyCode)265, "The key used to spawn Skitty Sub Gun");
		Key10 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForZeroGravity", (KeyCode)269, "The key used to toggle Zero Gravity");
		Key11 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForMeatHands", (KeyCode)270, "The key used to enable Meat Hands");
		Key12 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForDangerClose", (KeyCode)282, "The key used for Danger Close Barrage");
		Key13 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForFlash2", (KeyCode)283, "The key used to spawn Flash2");
		Key14 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForDestroyQuickbelt", (KeyCode)284, "The key used to destroy Quickbelt");
		Key15 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForSkittyBigGun", (KeyCode)285, "The key used to spawn Skitty Big Gun");
		KeyToggleFireMode = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForToggleHeldGunFireMode", (KeyCode)287, "Key used to toggle fire mode of currently held gun");
		KeyRandomizeHeldGun = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForRandomizeHeldGun", (KeyCode)288, "Key used to replace currently held gun with a random one from GunList");
		KeyEmptyChamber = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForEmptyHeldGunChamber", (KeyCode)289, "Key used to eject / empty the chambered round of the currently held gun");
		KeyBoostMalfunction = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "KeyBindForMeatyceiverMalfunctionBoost", (KeyCode)290, "Redeem: Boost Meatyceiver malfunction chance (uses configured seconds/minutes)");
		MalfunctionBoostDurationSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MeatyceiverMalfunctionBoostSeconds", 600f, "Fallback duration in seconds (ignored if minutes > 0). Clamped 5 - 3600.");
		MalfunctionBoostDurationMinutes = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MeatyceiverMalfunctionBoostMinutes", 10f, "Primary duration in minutes (set to 0 to use seconds). Clamped 0.0833 - 60.");
		ShurikenScaleMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ShurikenScaleMultiplier", 10f, "Scale multiplier applied to spawned shuriken (min 0.1, max 200).");
	}

	public void Awake()
	{
		Harmony.CreateAndPatchAll(((object)this).GetType(), (string)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully loaded H3TVR!");
	}

	public void Update()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: 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_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0290: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0318: Unknown result type (might be due to invalid IL or missing references)
		//IL_0337: Unknown result type (might be due to invalid IL or missing references)
		//IL_0356: Unknown result type (might be due to invalid IL or missing references)
		//IL_0375: Unknown result type (might be due to invalid IL or missing references)
		//IL_0394: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyDown(Key0.Value))
		{
			SpawnWonderfulToy();
		}
		if (Input.GetKeyDown(Key1.Value))
		{
			SpawnPillow();
		}
		if (Input.GetKeyDown(Key2.Value))
		{
			SpawnFlash();
		}
		if (Input.GetKey(Key3.Value))
		{
			SpawnShuri();
		}
		if (Input.GetKeyDown(Key4.Value))
		{
			SpawnNadeRain();
		}
		if (Input.GetKeyDown(Key5.Value))
		{
			SpawnHydration();
		}
		if (Input.GetKeyDown(Key6.Value))
		{
			SpawnJeditToy();
		}
		if (((Object)(object)GM.CurrentMovementManager != (Object)null && GM.CurrentMovementManager.Hands != null && GM.CurrentMovementManager.Hands.Length != 0 && GM.CurrentMovementManager.Hands[0].Input.AXButtonDown) || Input.GetKeyDown(Key7.Value))
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Detected Left X Button Press!");
			SlomoStatus = "Slowing";
		}
		if (SlomoStatus == "Slowing")
		{
			if ((Object)(object)GM.CurrentMovementManager != (Object)null && GM.CurrentMovementManager.Hands != null && GM.CurrentMovementManager.Hands.Length != 0 && (GM.CurrentMovementManager.Hands[0].Input.AXButtonDown || Input.GetKeyDown(Key7.Value)))
			{
				SlomoStatus = "Slowing";
			}
			SlomoScaleDown();
		}
		if (SlomoStatus == "Wait")
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Waiting!");
			SlomoStatus = "Paused";
			((MonoBehaviour)this).StartCoroutine(SlomoWait());
		}
		if (SlomoStatus == "Return")
		{
			SlomoReturn();
		}
		if (Time.timeScale == 1f)
		{
			SlomoStatus = "Off";
		}
		if (Input.GetKeyDown(Key8.Value))
		{
			DestroyHeld();
		}
		if (Input.GetKeyDown(Key9.Value))
		{
			SpawnSkittySubGun();
		}
		if (Input.GetKeyDown(Key10.Value))
		{
			ZeroGravityBumpDown();
		}
		if (ZeroGStatus == "On")
		{
			((MonoBehaviour)this).StartCoroutine(ZeroGWait());
		}
		if (ZeroGStatus == "Falling")
		{
			((MonoBehaviour)this).StartCoroutine(RealisticFallWait());
		}
		if (Input.GetKeyDown(Key11.Value))
		{
			EnableMeatHands();
		}
		if (Input.GetKey(Key12.Value))
		{
			DangerCloseBarrage();
		}
		if (Input.GetKeyDown(Key13.Value))
		{
			SpawnFlash2();
		}
		if (Input.GetKeyDown(Key14.Value))
		{
			DestroyQuickbelt();
		}
		if (Input.GetKeyDown(Key15.Value))
		{
			SpawnSkittyBigGun();
		}
		if (Input.GetKeyDown(KeyToggleFireMode.Value))
		{
			ToggleHeldGunFireMode();
		}
		if (Input.GetKeyDown(KeyRandomizeHeldGun.Value))
		{
			RandomizeHeldGun();
		}
		if (Input.GetKeyDown(KeyEmptyChamber.Value))
		{
			EmptyHeldGunChamber();
		}
		if (Input.GetKeyDown(KeyBoostMalfunction.Value))
		{
			ActivateMalfunctionBoost();
		}
		if (_malfunctionBoostActive)
		{
			if (Time.time >= _malfunctionBoostEndTime)
			{
				_malfunctionBoostActive = false;
			}
			else
			{
				ApplyMalfunctionLogic();
			}
		}
	}

	public void SpawnWonderfulToy()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: 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_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		FVRObject val = IM.OD["TippyToyAnton"];
		GameObject val2 = Object.Instantiate<GameObject>(((AnvilAsset)val).GetGameObject(), new Vector3(0f, 0.25f, 0f) + GM.CurrentPlayerBody.Head.position, GM.CurrentPlayerBody.Head.rotation);
		val2.GetComponent<Rigidbody>().AddTorque(new Vector3(0.25f, 0.25f, 0.25f));
		val2.GetComponent<Rigidbody>().AddForce(GM.CurrentPlayerBody.Head.forward * 25f);
	}

	public void SpawnJeditToy()
	{
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		string text = null;
		if (IM.OD.ContainsKey("JediTippyToy") && (Object)(object)IM.OD["JediTippyToy"] != (Object)null)
		{
			text = "JediTippyToy";
		}
		else
		{
			text = IM.OD.Keys.FirstOrDefault((string k) => string.Equals(k, "JediTippyToy", StringComparison.OrdinalIgnoreCase) && (Object)(object)IM.OD[k] != (Object)null);
			if (text == null)
			{
				text = IM.OD.Keys.FirstOrDefault((string k) => k.StartsWith("Jedi", StringComparison.OrdinalIgnoreCase) && (Object)(object)IM.OD[k] != (Object)null);
			}
			if (text == null)
			{
				text = IM.OD.Keys.FirstOrDefault((string k) => k.IndexOf("Tippy", StringComparison.OrdinalIgnoreCase) >= 0 && (Object)(object)IM.OD[k] != (Object)null);
			}
		}
		if (text == null)
		{
			string text2 = string.Join(", ", IM.OD.Keys.Take(15).ToArray());
			return;
		}
		FVRObject val = IM.OD[text];
		GameObject val2 = Object.Instantiate<GameObject>(((AnvilAsset)val).GetGameObject(), GM.CurrentPlayerBody.Head.position + new Vector3(0f, 0.25f, 0f), GM.CurrentPlayerBody.Head.rotation);
		Rigidbody component = val2.GetComponent<Rigidbody>();
		if ((Object)(object)component != (Object)null)
		{
			component.AddTorque(new Vector3(0.25f, 0.25f, 0.25f));
			component.AddForce(GM.CurrentPlayerBody.Head.forward * 25f);
		}
	}

	public void SpawnPillow()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: 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_0064: 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)
		FVRObject val = IM.OD["BodyPillow"];
		GameObject val2 = Object.Instantiate<GameObject>(((AnvilAsset)val).GetGameObject(), new Vector3(0f, 0.25f, 0f) + GM.CurrentPlayerBody.Head.position, GM.CurrentPlayerBody.Head.rotation);
		val2.GetComponent<Rigidbody>().AddForce(GM.CurrentPlayerBody.Head.forward * 4000f);
	}

	public void SpawnFlash()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: 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_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		FVRObject val = IM.OD["PinnedGrenadeXM84"];
		GameObject val2 = Object.Instantiate<GameObject>(((AnvilAsset)val).GetGameObject(), new Vector3(0f, 0.25f, 0f) + GM.CurrentPlayerBody.Head.position, GM.CurrentPlayerBody.Head.rotation);
		PinnedGrenade componentInChildren = val2.GetComponentInChildren<PinnedGrenade>();
		componentInChildren.ReleaseLever();
		val2.GetComponent<Rigidbody>().AddForce(GM.CurrentPlayerBody.Head.forward * 500f);
	}

	public void SpawnNadeRain()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//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_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: 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_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		float num = 15f;
		float num2 = 4f;
		Transform transform = ((Component)this).transform;
		Vector2 insideUnitCircle = Random.insideUnitCircle;
		int num3 = Random.Range(1, 20);
		FVRObject val = IM.OD["PinnedGrenadeM67"];
		Vector3 val2 = GM.CurrentPlayerBody.Head.position + GM.CurrentPlayerBody.Head.up * 0.02f;
		GameObject val3 = Object.Instantiate<GameObject>(((AnvilAsset)val).GetGameObject(), val2, Quaternion.LookRotation(GM.CurrentPlayerBody.Head.up));
		val3.transform.Rotate(new Vector3(insideUnitCircle.x * num2, insideUnitCircle.y * num2, 0f), (Space)1);
		val3.GetComponent<Rigidbody>().velocity = val3.transform.forward * num;
		if (num3 == 10)
		{
			PinnedGrenade componentInChildren = val3.GetComponentInChildren<PinnedGrenade>();
			componentInChildren.ReleaseLever();
		}
	}

	public void SpawnShuri()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: 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_0058: 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_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: 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_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		float num = 30f;
		float num2 = 4f;
		Transform transform = ((Component)this).transform;
		Vector2 insideUnitCircle = Random.insideUnitCircle;
		FVRObject val = IM.OD["Shuriken"];
		Vector3 val2 = GM.CurrentPlayerBody.Head.position + GM.CurrentPlayerBody.Head.forward * 0.02f;
		GameObject val3 = Object.Instantiate<GameObject>(((AnvilAsset)val).GetGameObject(), val2, Quaternion.LookRotation(GM.CurrentPlayerBody.Head.forward));
		val3.transform.Rotate(new Vector3(insideUnitCircle.x * num2, insideUnitCircle.y * num2, 0f), (Space)1);
		float num3 = Mathf.Clamp(ShurikenScaleMultiplier.Value, 0.1f, 200f);
		val3.transform.localScale = Vector3.one * num3;
		val3.GetComponent<Rigidbody>().velocity = val3.transform.forward * num;
		Object.Destroy((Object)(object)val3, 20f);
	}

	public void DangerCloseBarrage()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: 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_0058: 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_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: 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_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		float num = 30f;
		float num2 = 2f;
		Transform transform = ((Component)this).transform;
		Vector2 insideUnitCircle = Random.insideUnitCircle;
		FVRObject val = IM.OD["Cartridge50mmFlareDangerClose"];
		Vector3 val2 = GM.CurrentPlayerBody.Head.position + GM.CurrentPlayerBody.Head.forward * 0.02f;
		GameObject val3 = Object.Instantiate<GameObject>(((AnvilAsset)val).GetGameObject(), val2, Quaternion.LookRotation(GM.CurrentPlayerBody.Head.forward));
		val3.transform.Rotate(new Vector3(insideUnitCircle.x * num2, insideUnitCircle.y * num2, 0f), (Space)1);
		val3.GetComponent<Rigidbody>().velocity = val3.transform.forward * num;
		FVRFireArmRound component = val3.GetComponent<FVRFireArmRound>();
		component.Splode(0.5f, false, true);
	}

	public void SlomoScaleDown()
	{
		if (Time.timeScale > 0.1f)
		{
			Time.timeScale -= 1f * Time.unscaledDeltaTime;
			Time.fixedDeltaTime = Time.timeScale / SteamVR.instance.hmd_DisplayFrequency;
			Time.timeScale = Mathf.Clamp(Time.timeScale, 0f, 1f);
		}
		if (Time.timeScale <= 0.1f)
		{
			SlomoStatus = "Wait";
		}
	}

	public void SlomoReturn()
	{
		if (Time.timeScale != 1f)
		{
			Time.timeScale += 1f / 3f * Time.unscaledDeltaTime;
			Time.fixedDeltaTime = Time.timeScale / SteamVR.instance.hmd_DisplayFrequency;
			Time.timeScale = Mathf.Clamp(Time.timeScale, 0f, 1f);
		}
	}

	private IEnumerator SlomoWait()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <SlomoWait>d__54(0)
		{
			<>4__this = this
		};
	}

	private IEnumerator ZeroGWait()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ZeroGWait>d__55(0)
		{
			<>4__this = this
		};
	}

	private IEnumerator RealisticFallWait()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <RealisticFallWait>d__56(0)
		{
			<>4__this = this
		};
	}

	public void SpawnHydration()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: 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_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		FVRObject val = IM.OD["SuppressorBottle"];
		GameObject val2 = Object.Instantiate<GameObject>(((AnvilAsset)val).GetGameObject(), new Vector3(0f, 0.25f, 0f) + GM.CurrentPlayerBody.Head.position, GM.CurrentPlayerBody.Head.rotation);
		val2.GetComponent<Rigidbody>().AddTorque(new Vector3(0.25f, 0.25f, 0.25f));
		val2.GetComponent<Rigidbody>().AddForce(GM.CurrentPlayerBody.Head.forward * 25f);
	}

	public void DestroyHeld()
	{
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)GM.CurrentMovementManager.Hands[1].CurrentInteractable != (Object)null && GM.CurrentMovementManager.Hands[1].CurrentInteractable is FVRPhysicalObject)
		{
			Object.Destroy((Object)(object)((Component)GM.CurrentMovementManager.Hands[1].CurrentInteractable).gameObject);
		}
		float num = 4f;
		Transform transform = ((Component)this).transform;
		Vector2 insideUnitCircle = Random.insideUnitCircle;
		FVRObject val = IM.OD["12GaugeShellFreedomfetti"];
		Vector3 val2 = GM.CurrentPlayerBody.RightHand.position + GM.CurrentPlayerBody.RightHand.forward * 0.02f;
		GameObject val3 = Object.Instantiate<GameObject>(((AnvilAsset)val).GetGameObject(), val2, Quaternion.LookRotation(GM.CurrentPlayerBody.RightHand.forward));
		val3.transform.Rotate(new Vector3(insideUnitCircle.x * num, insideUnitCircle.y * num, 0f), (Space)1);
		FVRFireArmRound component = val3.GetComponent<FVRFireArmRound>();
		component.Splode(0.01f, false, true);
	}

	public void SpawnSkittySubGun()
	{
		//IL_026b: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_027f: Unknown result type (might be due to invalid IL or missing references)
		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0316: Unknown result type (might be due to invalid IL or missing references)
		//IL_0332: Unknown result type (might be due to invalid IL or missing references)
		//IL_033c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0358: Unknown result type (might be due to invalid IL or missing references)
		//IL_0362: Unknown result type (might be due to invalid IL or missing references)
		string text;
		if (File.Exists(GunList.Value))
		{
			using StreamReader streamReader = new StreamReader(GunList.Value);
			text = streamReader.ReadToEnd();
		}
		else
		{
			text = GunList.Value;
		}
		string[] array = (from g in text.Split(new char[6] { '\r', '\n', ',', ';', '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries)
			select g.Trim() into g
			where g.Length > 0
			select g).ToArray();
		if (array.Length == 0)
		{
			return;
		}
		int num = Random.Range(0, array.Length);
		string text2 = array[num];
		string selectedGunTruncated = new string(text2.Take(5).ToArray());
		string text3;
		if (File.Exists(MagazineList.Value))
		{
			using StreamReader streamReader2 = new StreamReader(MagazineList.Value);
			text3 = streamReader2.ReadToEnd();
		}
		else
		{
			text3 = MagazineList.Value;
		}
		string[] source = (from m in text3.Split(new char[6] { '\r', '\n', ',', ';', '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries)
			select m.Trim() into m
			where m.Length > 0
			select m).ToArray();
		string[] array2 = source.Where((string o) => o.Contains(selectedGunTruncated)).ToArray();
		string text4 = string.Empty;
		if (array2.Length != 0)
		{
			int num2 = Random.Range(0, array2.Length);
			text4 = array2[num2];
		}
		if (IM.OD.ContainsKey(text2) && !string.IsNullOrEmpty(text4) && IM.OD.ContainsKey(text4))
		{
			FVRObject val = IM.OD[text2];
			FVRObject val2 = IM.OD[text4];
			GameObject val3 = Object.Instantiate<GameObject>(((AnvilAsset)val).GetGameObject(), new Vector3(0f, 0.25f, 0f) + GM.CurrentPlayerBody.Head.position, GM.CurrentPlayerBody.Head.rotation);
			GameObject val4 = Object.Instantiate<GameObject>(((AnvilAsset)val2).GetGameObject(), new Vector3(0f, 0.25f, 0f) + GM.CurrentPlayerBody.Head.position, GM.CurrentPlayerBody.Head.rotation);
			val3.GetComponent<Rigidbody>().AddTorque(new Vector3(0.25f, 0.25f, 0.25f));
			val4.GetComponent<Rigidbody>().AddTorque(new Vector3(0.25f, 0.25f, 0.25f));
			val3.GetComponent<Rigidbody>().AddForce(GM.CurrentPlayerBody.Head.forward * 100f);
			val4.GetComponent<Rigidbody>().AddForce(GM.CurrentPlayerBody.Head.forward * 100f);
		}
	}

	public void SpawnFlash2()
	{
		//IL_0037: 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)
		//IL_004b: 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_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		FVRObject val = IM.OD["PinnedGrenadeXM84"];
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Spawned Object");
		GameObject val2 = Object.Instantiate<GameObject>(((AnvilAsset)val).GetGameObject(), new Vector3(0f, 0.25f, 0f) + GM.CurrentPlayerBody.Head.position, GM.CurrentPlayerBody.Head.rotation);
		PinnedGrenade componentInChildren = val2.GetComponentInChildren<PinnedGrenade>();
		componentInChildren.ReleaseLever();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Adding Force");
		val2.GetComponent<Rigidbody>().AddForce(GM.CurrentPlayerBody.Head.forward * 500f);
	}

	public void ZeroGravityBumpDown()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		GM.Options.SimulationOptions.ObjectGravityMode = (GravityMode)3;
		GM.CurrentSceneSettings.RefreshGravity();
		((MonoBehaviour)this).StartCoroutine(ZeroGWait());
	}

	public void ZeroGravityBumpUp()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		GM.Options.SimulationOptions.ObjectGravityMode = (GravityMode)1;
		GM.CurrentSceneSettings.RefreshGravity();
		ZeroGStatus = "Off";
	}

	public void RealisticFall()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		GM.Options.SimulationOptions.ObjectGravityMode = (GravityMode)0;
		GM.CurrentSceneSettings.RefreshGravity();
	}

	public void EnableMeatHands()
	{
		GM.CurrentMovementManager.Hands[0].SpawnSausageFingers();
		GM.CurrentMovementManager.Hands[1].SpawnSausageFingers();
	}

	public void DestroyQuickbelt()
	{
		//IL_0098: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			FVRQuickBeltSlot[] array = Object.FindObjectsOfType<FVRQuickBeltSlot>();
			if (array == null || array.Length == 0)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"No quickbelt slots found in scene.");
				return;
			}
			int num = 0;
			FVRQuickBeltSlot[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				FVRPhysicalObject val = array2[i]?.CurObject;
				if (!((Object)(object)val == (Object)null))
				{
					val.SetQuickBeltSlot((FVRQuickBeltSlot)null);
					Rigidbody component = ((Component)val).GetComponent<Rigidbody>();
					if ((Object)(object)component != (Object)null)
					{
						component.isKinematic = false;
						component.velocity = GM.CurrentPlayerBody.Head.forward * 1.5f + Random.insideUnitSphere * 0.25f;
						component.angularVelocity = Random.insideUnitSphere * 2f;
					}
					num++;
				}
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"Dropped {num} quickbelt object(s).");
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("DestroyQuickbelt drop failed: " + ex));
		}
	}

	public void SpawnSkittyBigGun()
	{
		//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0402: Unknown result type (might be due to invalid IL or missing references)
		//IL_0407: Unknown result type (might be due to invalid IL or missing references)
		//IL_0413: Unknown result type (might be due to invalid IL or missing references)
		//IL_0418: Unknown result type (might be due to invalid IL or missing references)
		//IL_0421: Unknown result type (might be due to invalid IL or missing references)
		//IL_0423: Unknown result type (might be due to invalid IL or missing references)
		//IL_0499: Unknown result type (might be due to invalid IL or missing references)
		//IL_0455: Unknown result type (might be due to invalid IL or missing references)
		//IL_046c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0476: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_0540: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0513: Unknown result type (might be due to invalid IL or missing references)
		//IL_051d: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			string text = (File.Exists(GunList.Value) ? File.ReadAllText(GunList.Value) : GunList.Value);
			string[] array = (from g in text.Split(new char[6] { '\r', '\n', ',', ';', '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries)
				select g.Trim() into g
				where g.Length > 0
				select g).ToArray();
			if (array.Length == 0)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"SpawnSkittyBigGun: Gun list empty.");
				return;
			}
			string[] array2 = array.Where((string k) => IM.OD.ContainsKey(k)).ToArray();
			if (array2.Length == 0)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"SpawnSkittyBigGun: None of the provided gun keys exist in IM.OD.");
				return;
			}
			string text2 = array2[Random.Range(0, array2.Length)];
			string truncated = new string(text2.Take(5).ToArray());
			((BaseUnityPlugin)this).Logger.LogInfo((object)("SpawnSkittyBigGun PickedGun: " + text2 + " (Trunc: " + truncated + ")"));
			string text3 = (File.Exists(MagazineList.Value) ? File.ReadAllText(MagazineList.Value) : MagazineList.Value);
			string[] array3 = (from m in text3.Split(new char[6] { '\r', '\n', ',', ';', '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries)
				select m.Trim() into m
				where m.Length > 0
				select m).ToArray();
			string text4 = string.Empty;
			if (array3.Length != 0)
			{
				string[] arr2 = array3.Where((string m) => m.Contains(truncated)).ToArray();
				string[] arr3 = array3.Where((string m) => m.StartsWith(truncated)).ToArray();
				string short4 = ((truncated.Length >= 4) ? truncated.Substring(0, 4) : truncated);
				string[] arr4 = array3.Where((string m) => m.Contains(short4)).ToArray();
				string short3 = ((truncated.Length >= 3) ? truncated.Substring(0, 3) : truncated);
				string[] arr5 = array3.Where((string m) => m.StartsWith(short3) && IM.OD.ContainsKey(m)).ToArray();
				text4 = PickRandom(arr2) ?? PickRandom(arr3) ?? PickRandom(arr4) ?? PickRandom(arr5) ?? array3.FirstOrDefault((string m) => IM.OD.ContainsKey(m));
			}
			if (!IM.OD.ContainsKey(text2))
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("SpawnSkittyBigGun: Gun key '" + text2 + "' not in IM.OD."));
				return;
			}
			if (string.IsNullOrEmpty(text4) || !IM.OD.ContainsKey(text4))
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("SpawnSkittyBigGun: No matching magazine found for gun '" + text2 + ". Spawning gun only."));
				text4 = null;
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("SpawnSkittyBigGun MatchingMagazine: " + text4));
			}
			FVRObject val = IM.OD[text2];
			Vector3 val2 = GM.CurrentPlayerBody.Head.position + new Vector3(0f, 0.25f, 0f);
			Quaternion rotation = GM.CurrentPlayerBody.Head.rotation;
			GameObject val3 = Object.Instantiate<GameObject>(((AnvilAsset)val).GetGameObject(), val2, rotation);
			Rigidbody component = val3.GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null)
			{
				component.AddTorque(new Vector3(0.25f, 0.25f, 0.25f));
				component.AddForce(GM.CurrentPlayerBody.Head.forward * 100f, (ForceMode)2);
			}
			val3.transform.localScale = new Vector3(5f, 5f, 5f);
			if (text4 != null)
			{
				FVRObject val4 = IM.OD[text4];
				GameObject val5 = Object.Instantiate<GameObject>(((AnvilAsset)val4).GetGameObject(), val2, rotation);
				Rigidbody component2 = val5.GetComponent<Rigidbody>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.AddTorque(new Vector3(0.25f, 0.25f, 0.25f));
					component2.AddForce(GM.CurrentPlayerBody.Head.forward * 100f, (ForceMode)2);
				}
				val5.transform.localScale = new Vector3(5f, 5f, 5f);
			}
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("SpawnSkittyBigGun failed: " + ex));
		}
		static string PickRandom(string[] arr)
		{
			return (arr.Length == 0) ? null : arr[Random.Range(0, arr.Length)];
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPrefix]
	public static void FixPitch(ref float value)
	{
		if (Time.timeScale != 1f)
		{
			value *= Time.timeScale;
		}
		else
		{
			value *= 1f;
		}
	}

	private void OnDestroy()
	{
		_hooks.Unhook();
	}

	private void ToggleHeldGunFireMode()
	{
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Expected O, but got Unknown
		try
		{
			FVRViveHand[] array = (((Object)(object)GM.CurrentMovementManager != (Object)null) ? GM.CurrentMovementManager.Hands : null);
			if (array == null || array.Length == 0)
			{
				return;
			}
			FVRInteractiveObject val = null;
			if (array.Length > 1 && (Object)(object)array[1] != (Object)null && (Object)(object)array[1].CurrentInteractable != (Object)null)
			{
				val = array[1].CurrentInteractable;
			}
			if ((Object)(object)val == (Object)null && (Object)(object)array[0] != (Object)null && (Object)(object)array[0].CurrentInteractable != (Object)null)
			{
				val = array[0].CurrentInteractable;
			}
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			FVRFireArm val2 = (FVRFireArm)(object)((val is FVRFireArm) ? val : null);
			if ((Object)(object)val2 == (Object)null && ((object)val).GetType().IsSubclassOf(typeof(FVRFireArm)))
			{
				val2 = (FVRFireArm)val;
			}
			if ((Object)(object)val2 == (Object)null)
			{
				return;
			}
			MethodInfo methodInfo = ((object)val2).GetType().GetMethod("CycleFireMode", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? ((object)val2).GetType().GetMethod("CycleFireSelector", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if ((object)methodInfo != null)
			{
				methodInfo.Invoke(val2, null);
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Toggled fire mode via method reflection.");
				return;
			}
			FieldInfo fieldInfo = ((object)val2).GetType().GetField("m_fireSelector", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? ((object)val2).GetType().GetField("FireSelector", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? ((object)val2).GetType().GetField("m_selector", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if ((object)fieldInfo != null)
			{
				object value = fieldInfo.GetValue(val2);
				if (value != null && value.GetType().IsEnum)
				{
					Array values = Enum.GetValues(value.GetType());
					int num = Array.IndexOf(values, value);
					int index = (num + 1) % values.Length;
					object value2 = values.GetValue(index);
					fieldInfo.SetValue(val2, value2);
					MethodInfo methodInfo2 = ((object)val2).GetType().GetMethod("SetFireSelector", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? ((object)val2).GetType().GetMethod("UpdateFireSelector", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					if ((object)methodInfo2 != null)
					{
						ParameterInfo[] parameters = methodInfo2.GetParameters();
						if (parameters.Length == 1 && (object)parameters[0].ParameterType == value.GetType())
						{
							methodInfo2.Invoke(val2, new object[1] { value2 });
						}
						else if (parameters.Length == 0)
						{
							methodInfo2.Invoke(val2, null);
						}
					}
					((BaseUnityPlugin)this).Logger.LogInfo((object)("Toggled fire mode via enum field reflection to: " + value2));
					return;
				}
			}
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not toggle fire mode: no suitable method or field found.");
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("ToggleHeldGunFireMode failed: " + ex));
		}
	}

	private void RandomizeHeldGun()
	{
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Expected O, but got Unknown
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0267: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0291: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0402: Unknown result type (might be due to invalid IL or missing references)
		//IL_0407: Unknown result type (might be due to invalid IL or missing references)
		//IL_0434: Unknown result type (might be due to invalid IL or missing references)
		//IL_043e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0419: Unknown result type (might be due to invalid IL or missing references)
		//IL_0423: Unknown result type (might be due to invalid IL or missing references)
		//IL_0443: Unknown result type (might be due to invalid IL or missing references)
		//IL_0448: Unknown result type (might be due to invalid IL or missing references)
		//IL_0451: Unknown result type (might be due to invalid IL or missing references)
		//IL_0453: Unknown result type (might be due to invalid IL or missing references)
		//IL_0476: Unknown result type (might be due to invalid IL or missing references)
		//IL_0483: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			FVRViveHand[] array = (((Object)(object)GM.CurrentMovementManager != (Object)null) ? GM.CurrentMovementManager.Hands : null);
			if (array == null || array.Length == 0)
			{
				return;
			}
			FVRInteractiveObject val = null;
			if (array.Length > 1 && (Object)(object)array[1] != (Object)null && (Object)(object)array[1].CurrentInteractable != (Object)null)
			{
				val = array[1].CurrentInteractable;
			}
			if ((Object)(object)val == (Object)null && (Object)(object)array[0] != (Object)null && (Object)(object)array[0].CurrentInteractable != (Object)null)
			{
				val = array[0].CurrentInteractable;
			}
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			FVRFireArm val2 = (FVRFireArm)(object)((val is FVRFireArm) ? val : null);
			if ((Object)(object)val2 == (Object)null && ((object)val).GetType().IsSubclassOf(typeof(FVRFireArm)))
			{
				val2 = (FVRFireArm)val;
			}
			if ((Object)(object)val2 == (Object)null)
			{
				return;
			}
			string text = (File.Exists(GunList.Value) ? File.ReadAllText(GunList.Value) : GunList.Value);
			string[] array2 = (from g in text.Split(new char[6] { '\r', '\n', ',', ';', '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries)
				select g.Trim() into g
				where g.Length > 0
				select g).ToArray();
			if (array2.Length == 0)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"RandomizeHeldGun: Gun list empty.");
				return;
			}
			string currentKey = (((Object)(object)((FVRPhysicalObject)val2).ObjectWrapper != (Object)null) ? ((FVRPhysicalObject)val2).ObjectWrapper.ItemID : null);
			string[] array3 = ((currentKey != null) ? array2.Where((string k) => k != currentKey).ToArray() : array2);
			if (array3.Length == 0)
			{
				array3 = array2;
			}
			string text2 = array3[Random.Range(0, array3.Length)];
			if (!IM.OD.ContainsKey(text2))
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("RandomizeHeldGun: Key '" + text2 + "' not found in IM.OD."));
				return;
			}
			Vector3 position = ((Component)val).transform.position;
			Quaternion rotation = ((Component)val).transform.rotation;
			Object.Destroy((Object)(object)((Component)val).gameObject);
			FVRObject val3 = IM.OD[text2];
			GameObject val4 = Object.Instantiate<GameObject>(((AnvilAsset)val3).GetGameObject(), position, rotation);
			Rigidbody component = val4.GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null)
			{
				component.velocity = Vector3.zero;
				component.angularVelocity = Vector3.zero;
			}
			try
			{
				string text3 = (File.Exists(MagazineList.Value) ? File.ReadAllText(MagazineList.Value) : MagazineList.Value);
				string[] array4 = (from m in text3.Split(new char[6] { '\r', '\n', ',', ';', '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries)
					select m.Trim() into m
					where m.Length > 0
					select m).ToArray();
				if (array4.Length != 0)
				{
					string truncated = new string(text2.Take(5).ToArray());
					string[] array5 = array4.Where((string m) => m.Contains(truncated)).ToArray();
					if (array5.Length != 0)
					{
						string text4 = array5[Random.Range(0, array5.Length)];
						if (IM.OD.ContainsKey(text4))
						{
							FVRObject val5 = IM.OD[text4];
							Vector3 val6 = position + Vector3.up * 0.05f + (((Object)(object)GM.CurrentPlayerBody != (Object)null) ? (GM.CurrentPlayerBody.Head.forward * 0.1f) : (Vector3.forward * 0.1f));
							GameObject val7 = Object.Instantiate<GameObject>(((AnvilAsset)val5).GetGameObject(), val6, rotation);
							Rigidbody component2 = val7.GetComponent<Rigidbody>();
							if ((Object)(object)component2 != (Object)null)
							{
								component2.velocity = Vector3.zero;
								component2.angularVelocity = Vector3.zero;
							}
							((BaseUnityPlugin)this).Logger.LogInfo((object)("Spawned matching magazine: " + text4));
						}
						else
						{
							((BaseUnityPlugin)this).Logger.LogWarning((object)("RandomizeHeldGun: Matching mag key not in IM.OD: " + text4));
						}
					}
					else
					{
						((BaseUnityPlugin)this).Logger.LogWarning((object)("RandomizeHeldGun: No matching magazines found for truncated key: " + truncated));
					}
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)"RandomizeHeldGun: Magazine list empty.");
				}
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("RandomizeHeldGun: Magazine spawn failed: " + ex));
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Replaced held gun with random gun: " + text2));
		}
		catch (Exception ex2)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("RandomizeHeldGun failed: " + ex2));
		}
	}

	private void EmptyHeldGunChamber()
	{
		//IL_0549: Unknown result type (might be due to invalid IL or missing references)
		//IL_0553: Unknown result type (might be due to invalid IL or missing references)
		//IL_055e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0568: Unknown result type (might be due to invalid IL or missing references)
		//IL_056d: Unknown result type (might be due to invalid IL or missing references)
		//IL_057a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0584: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Expected O, but got Unknown
		try
		{
			FVRMovementManager currentMovementManager = GM.CurrentMovementManager;
			if ((Object)(object)currentMovementManager == (Object)null || currentMovementManager.Hands == null)
			{
				return;
			}
			FVRInteractiveObject val = null;
			if (currentMovementManager.Hands.Length > 1 && (Object)(object)currentMovementManager.Hands[1] != (Object)null && (Object)(object)currentMovementManager.Hands[1].CurrentInteractable != (Object)null)
			{
				val = currentMovementManager.Hands[1].CurrentInteractable;
			}
			if ((Object)(object)val == (Object)null && currentMovementManager.Hands.Length != 0 && (Object)(object)currentMovementManager.Hands[0] != (Object)null && (Object)(object)currentMovementManager.Hands[0].CurrentInteractable != (Object)null)
			{
				val = currentMovementManager.Hands[0].CurrentInteractable;
			}
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			FVRFireArm val2 = (FVRFireArm)(object)((val is FVRFireArm) ? val : null);
			if ((Object)(object)val2 == (Object)null && ((object)val).GetType().IsSubclassOf(typeof(FVRFireArm)))
			{
				val2 = (FVRFireArm)val;
			}
			if ((Object)(object)val2 == (Object)null)
			{
				return;
			}
			string[] array = new string[5] { "EjectChamberedRound", "EjectRound", "EjectChambered", "ExtractRound", "DumpChamber" };
			MethodInfo[] methods = ((object)val2).GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			string[] array2 = array;
			foreach (string mn2 in array2)
			{
				MethodInfo methodInfo = methods.FirstOrDefault((MethodInfo m) => m.Name == mn2 && m.GetParameters().Length == 0);
				if ((object)methodInfo != null)
				{
					try
					{
						methodInfo.Invoke(val2, null);
						((BaseUnityPlugin)this).Logger.LogInfo((object)("EmptyHeldGunChamber: Firearm method invoked: " + mn2));
						return;
					}
					catch (Exception ex)
					{
						((BaseUnityPlugin)this).Logger.LogWarning((object)("EmptyHeldGunChamber: Firearm method '" + mn2 + "' threw: " + ex.Message));
					}
				}
			}
			object obj = ((object)val2).GetType().GetField("Chamber", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(val2) ?? ((object)val2).GetType().GetField("m_chamber", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(val2) ?? ((object)val2).GetType().GetField("PrimaryChamber", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(val2);
			if (obj == null)
			{
				PropertyInfo propertyInfo = ((object)val2).GetType().GetProperty("Chamber", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? ((object)val2).GetType().GetProperty("PrimaryChamber", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if ((object)propertyInfo != null)
				{
					obj = propertyInfo.GetValue(val2, null);
				}
			}
			if (obj == null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"EmptyHeldGunChamber: No chamber object found.");
				return;
			}
			Type type = obj.GetType();
			string[] array3 = new string[6] { "EjectRound", "EjectChamberedRound", "ExtractRound", "PopRound", "DumpRound", "ReleaseRound" };
			MethodInfo[] methods2 = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			string[] array4 = array3;
			foreach (string mn in array4)
			{
				MethodInfo methodInfo2 = methods2.FirstOrDefault((MethodInfo m) => m.Name == mn && m.GetParameters().Length == 0);
				if ((object)methodInfo2 != null)
				{
					try
					{
						methodInfo2.Invoke(obj, null);
						((BaseUnityPlugin)this).Logger.LogInfo((object)("EmptyHeldGunChamber: Chamber method invoked: " + mn));
						return;
					}
					catch (Exception ex2)
					{
						((BaseUnityPlugin)this).Logger.LogWarning((object)("EmptyHeldGunChamber: Chamber method '" + mn + "' threw: " + ex2.Message));
					}
				}
			}
			string[] array5 = new string[5] { "Round", "m_round", "ChamberedRound", "m_chamberedRound", "LoadedRound" };
			FVRFireArmRound val3 = null;
			FieldInfo fieldInfo = null;
			string[] array6 = array5;
			foreach (string name in array6)
			{
				FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if ((object)field != null && typeof(FVRFireArmRound).IsAssignableFrom(field.FieldType))
				{
					object? value = field.GetValue(obj);
					FVRFireArmRound val4 = (FVRFireArmRound)((value is FVRFireArmRound) ? value : null);
					if ((Object)(object)val4 != (Object)null)
					{
						val3 = val4;
						fieldInfo = field;
						break;
					}
				}
				PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if ((object)property != null && typeof(FVRFireArmRound).IsAssignableFrom(property.PropertyType))
				{
					object? value2 = property.GetValue(obj, null);
					FVRFireArmRound val5 = (FVRFireArmRound)((value2 is FVRFireArmRound) ? value2 : null);
					if ((Object)(object)val5 != (Object)null)
					{
						val3 = val5;
						break;
					}
				}
			}
			if ((Object)(object)val3 == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"EmptyHeldGunChamber: No round present (manual path).");
				return;
			}
			Transform transform = ((Component)val3).transform;
			transform.SetParent((Transform)null, true);
			Rigidbody component = ((Component)val3).GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null)
			{
				component.isKinematic = false;
				component.velocity = ((Component)val2).transform.forward * 1.5f + ((Component)val2).transform.up * 0.25f;
				component.angularVelocity = Random.insideUnitSphere * 4f;
			}
			if ((object)fieldInfo != null)
			{
				fieldInfo.SetValue(obj, null);
			}
			else
			{
				string[] array7 = array5;
				foreach (string name2 in array7)
				{
					PropertyInfo property2 = type.GetProperty(name2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					if ((object)property2 != null && property2.CanWrite && typeof(FVRFireArmRound).IsAssignableFrom(property2.PropertyType))
					{
						property2.SetValue(obj, null, null);
					}
				}
			}
			string[] array8 = new string[6] { "IsFull", "m_isFull", "IsLoaded", "m_isLoaded", "HasRound", "m_hasRound" };
			string[] array9 = array8;
			foreach (string name3 in array9)
			{
				FieldInfo field2 = type.GetField(name3, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if ((object)field2 != null && (object)field2.FieldType == typeof(bool))
				{
					field2.SetValue(obj, false);
				}
				PropertyInfo property3 = type.GetProperty(name3, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if ((object)property3 != null && property3.CanWrite && (object)property3.PropertyType == typeof(bool))
				{
					property3.SetValue(obj, false, null);
				}
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"EmptyHeldGunChamber: Manually detached round (fallback path).");
		}
		catch (Exception ex3)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("EmptyHeldGunChamber (reworked) failed: " + ex3));
		}
	}

	private void ActivateMalfunctionBoost()
	{
		_malfunctionBoostActive = true;
		float num = MalfunctionBoostDurationMinutes.Value;
		if (num > 0f)
		{
			num = Mathf.Clamp(num, 0.0833f, 60f);
		}
		float value = MalfunctionBoostDurationSeconds.Value;
		value = Mathf.Clamp(value, 5f, 3600f);
		float num2 = ((num > 0f) ? (num * 60f) : value);
		_malfunctionBoostEndTime = Time.time + num2;
		((BaseUnityPlugin)this).Logger.LogInfo((object)$"Meatyceiver malfunction boost activated for {num2:F1} seconds (configured Minutes={MalfunctionBoostDurationMinutes.Value}, Seconds={MalfunctionBoostDurationSeconds.Value}).");
	}

	private void ApplyMalfunctionLogic()
	{
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Expected O, but got Unknown
		try
		{
			FVRMovementManager currentMovementManager = GM.CurrentMovementManager;
			if ((Object)(object)currentMovementManager == (Object)null || currentMovementManager.Hands == null)
			{
				return;
			}
			FVRViveHand[] hands = currentMovementManager.Hands;
			foreach (FVRViveHand val in hands)
			{
				if ((Object)(object)val == (Object)null || (Object)(object)val.CurrentInteractable == (Object)null)
				{
					continue;
				}
				FVRInteractiveObject currentInteractable = val.CurrentInteractable;
				FVRFireArm val2 = (FVRFireArm)(object)((currentInteractable is FVRFireArm) ? currentInteractable : null);
				if ((Object)(object)val2 == (Object)null && ((object)val.CurrentInteractable).GetType().IsSubclassOf(typeof(FVRFireArm)))
				{
					val2 = (FVRFireArm)val.CurrentInteractable;
				}
				if ((Object)(object)val2 == (Object)null)
				{
					continue;
				}
				string text = null;
				try
				{
					if ((Object)(object)((FVRPhysicalObject)val2).ObjectWrapper != (Object)null)
					{
						text = ((FVRPhysicalObject)val2).ObjectWrapper.ItemID;
					}
				}
				catch
				{
				}
				string text2 = (((Object)(object)((Component)val2).gameObject != (Object)null) ? ((Object)((Component)val2).gameObject).name : string.Empty);
				if (((!string.IsNullOrEmpty(text) && text.IndexOf("meaty", StringComparison.OrdinalIgnoreCase) >= 0) || (!string.IsNullOrEmpty(text2) && text2.IndexOf("meaty", StringComparison.OrdinalIgnoreCase) >= 0)) && val.Input.TriggerDown && Random.value < 0.75f)
				{
					ForceMalfunction(val2);
				}
			}
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("ApplyMalfunctionLogic failed: " + ex));
		}
	}

	private void ForceMalfunction(FVRFireArm firearm)
	{
		try
		{
			string[] array = new string[5] { "ForceMalfunction", "DoMalfunction", "AttemptMalfunction", "Jam", "CauseMalfunction" };
			string[] array2 = array;
			foreach (string text in array2)
			{
				MethodInfo method = ((object)firearm).GetType().GetMethod(text, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if ((object)method != null && method.GetParameters().Length == 0)
				{
					method.Invoke(firearm, null);
					((BaseUnityPlugin)this).Logger.LogInfo((object)("Forced malfunction via method: " + text));
					return;
				}
			}
			string[] array3 = new string[4] { "MalfunctionChance", "m_malfunctionChance", "JamChance", "m_jamChance" };
			string[] array4 = array3;
			foreach (string text2 in array4)
			{
				FieldInfo field = ((object)firearm).GetType().GetField(text2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if ((object)field != null && ((object)field.FieldType == typeof(float) || (object)field.FieldType == typeof(double)))
				{
					if ((object)field.FieldType == typeof(float))
					{
						field.SetValue(firearm, 1f);
					}
					else
					{
						field.SetValue(firearm, 1.0);
					}
					((BaseUnityPlugin)this).Logger.LogInfo((object)("Set high malfunction/jam chance via field: " + text2));
				}
			}
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("ForceMalfunction reflection failed: " + ex));
		}
	}
}