Decompiled source of LSIIC v1.6.0

monomod/Assembly-CSharp.LSIIC.mm.dll

Decompiled 2 months ago
using System;
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 System.Text;
using FistVR;
using HarmonyLib;
using LSIIC.Core;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using Valve.VR;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace LSIIC
{
	public class MeatTrak : MonoBehaviour
	{
		public float NumberTarget;

		public float NumberDisplay;

		public char BlankChar;

		public bool UseWideCharacters;

		public GameObject[] Displays;

		[Header("Use ASCII for these!")]
		public Sprite[] DefaultCharacters;

		public Sprite[] WideCharacters;

		private Texture2D[] m_defaultTextures;

		private Texture2D[] m_wideTextures;

		private bool m_hasStarted;

		public void Awake()
		{
			if (m_hasStarted)
			{
				InitDisplay();
			}
		}

		public void InitDisplay()
		{
			m_defaultTextures = (Texture2D[])(object)new Texture2D[DefaultCharacters.Length];
			for (int i = 0; i < DefaultCharacters.Length; i++)
			{
				m_defaultTextures[i] = ConvertSpriteToTexture(DefaultCharacters[i]);
			}
			m_wideTextures = (Texture2D[])(object)new Texture2D[WideCharacters.Length];
			for (int j = 0; j < WideCharacters.Length; j++)
			{
				m_wideTextures[j] = ConvertSpriteToTexture(WideCharacters[j]);
			}
			NumberDisplay = NumberTarget;
			SetDisplays(NumberTarget);
		}

		public static Texture2D ConvertSpriteToTexture(Sprite sprite)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			if ((Object)(object)sprite != (Object)null)
			{
				Rect val = sprite.rect;
				int num = (int)((Rect)(ref val)).width;
				val = sprite.rect;
				Texture2D val2 = new Texture2D(num, (int)((Rect)(ref val)).height);
				Texture2D texture = sprite.texture;
				val = sprite.textureRect;
				int num2 = (int)((Rect)(ref val)).x;
				val = sprite.textureRect;
				int num3 = (int)((Rect)(ref val)).y;
				val = sprite.textureRect;
				int num4 = (int)((Rect)(ref val)).width;
				val = sprite.textureRect;
				Color[] pixels = texture.GetPixels(num2, num3, num4, (int)((Rect)(ref val)).height);
				((Texture)val2).filterMode = (FilterMode)0;
				val2.SetPixels(pixels);
				val2.Apply();
				return val2;
			}
			return null;
		}

		public void Update()
		{
			if (NumberDisplay != NumberTarget)
			{
				if (NumberDisplay < NumberTarget)
				{
					NumberDisplay += 1f;
				}
				else
				{
					NumberDisplay -= 1f;
				}
				SetDisplays(NumberDisplay);
			}
		}

		public void SetDisplays(float number)
		{
			char[] array = number.ToString().ToCharArray();
			Array.Reverse((Array)array);
			for (int i = 0; i < Displays.Length; i++)
			{
				if (i < array.Length)
				{
					if (!UseWideCharacters && DefaultCharacters != null && DefaultCharacters.Length != 0)
					{
						((Renderer)Displays[i].GetComponent<MeshRenderer>()).material.mainTexture = (Texture)(object)m_defaultTextures[(uint)array[i]];
					}
					else if (WideCharacters != null && WideCharacters.Length != 0)
					{
						((Renderer)Displays[i].GetComponent<MeshRenderer>()).material.mainTexture = (Texture)(object)m_wideTextures[(uint)array[i]];
					}
				}
				else if (!UseWideCharacters && DefaultCharacters != null && DefaultCharacters.Length != 0)
				{
					((Renderer)Displays[i].GetComponent<MeshRenderer>()).material.mainTexture = (Texture)(object)m_defaultTextures[(uint)BlankChar];
				}
				else if (WideCharacters != null && WideCharacters.Length != 0)
				{
					((Renderer)Displays[i].GetComponent<MeshRenderer>()).material.mainTexture = (Texture)(object)m_wideTextures[(uint)BlankChar];
				}
			}
		}
	}
	public class MeatTrakAttachment : FVRFireArmAttachment
	{
		public void Awake()
		{
			((FVRFireArmAttachment)this).Awake();
			MeatTrakAttachmentInterface meatTrakAttachmentInterface = base.AttachmentInterface as MeatTrakAttachmentInterface;
			if ((Object)(object)meatTrakAttachmentInterface != (Object)null && (Object)(object)meatTrakAttachmentInterface.MeatTrak != (Object)null)
			{
				meatTrakAttachmentInterface.InitInterface();
				meatTrakAttachmentInterface.MeatTrak.InitDisplay();
			}
		}

		public override void ConfigureFromFlagDic(Dictionary<string, string> f)
		{
			if (f == null)
			{
				return;
			}
			MeatTrakAttachmentInterface meatTrakAttachmentInterface = base.AttachmentInterface as MeatTrakAttachmentInterface;
			if ((Object)(object)meatTrakAttachmentInterface != (Object)null)
			{
				meatTrakAttachmentInterface.TrackingMode = (MeatTrakAttachmentInterface.TrackingModes)Enum.Parse(typeof(MeatTrakAttachmentInterface.TrackingModes), f["TrackingMode"]);
				meatTrakAttachmentInterface.UpdateMode();
				if ((Object)(object)meatTrakAttachmentInterface.MeatTrak != (Object)null)
				{
					meatTrakAttachmentInterface.MeatTrak.NumberTarget = float.Parse(f["NumberTarget"]);
					meatTrakAttachmentInterface.MeatTrak.NumberDisplay = meatTrakAttachmentInterface.MeatTrak.NumberTarget;
				}
			}
		}

		public override Dictionary<string, string> GetFlagDic()
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			MeatTrakAttachmentInterface meatTrakAttachmentInterface = base.AttachmentInterface as MeatTrakAttachmentInterface;
			if ((Object)(object)meatTrakAttachmentInterface != (Object)null)
			{
				dictionary.Add("TrackingMode", meatTrakAttachmentInterface.TrackingMode.ToString());
				if ((Object)(object)meatTrakAttachmentInterface.MeatTrak != (Object)null)
				{
					dictionary.Add("NumberTarget", meatTrakAttachmentInterface.MeatTrak.NumberTarget.ToString());
				}
			}
			return dictionary;
		}
	}
	public class MeatTrakAttachmentInterface : FVRFireArmAttachmentInterface
	{
		public enum TrackingModes
		{
			None,
			Kills,
			Shots,
			Reloads,
			Bullets
		}

		[Header("MeatTrak Interface")]
		public MeatTrak MeatTrak;

		public TrackingModes TrackingMode;

		public Sprite[] ModeSprites;

		public Renderer ModeDiplayRenderer;

		public AudioEvent Aud_ModeSwitch;

		public AudioEvent Aud_ClearRequestConfirmation;

		public AudioEvent Aud_ClearComplete;

		private bool m_waitingForConfirmation;

		private Texture2D[] m_modeTextures;

		public void InitInterface()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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
			m_modeTextures = (Texture2D[])(object)new Texture2D[ModeSprites.Length];
			for (int i = 0; i < ModeSprites.Length; i++)
			{
				m_modeTextures[i] = MeatTrak.ConvertSpriteToTexture(ModeSprites[i]);
			}
			UpdateMode();
			GM.CurrentSceneSettings.KillEvent += new BotKill(wwBotKillEvent);
			GM.CurrentSceneSettings.SosigKillEvent += new SosigKill(SosigKillEvent);
			GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(ShotFiredEvent);
			GM.CurrentSceneSettings.FireArmReloadedEvent += new FireArmReloaded(FireArmReloadedEvent);
		}

		public void Update()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			if (TrackingMode == TrackingModes.Bullets && (Object)(object)base.Attachment != (Object)null && (Object)(object)base.Attachment.GetRootObject() != (Object)null && base.Attachment.GetRootObject() is FVRFireArm)
			{
				UpdateBulletMode((FVRFireArm)base.Attachment.GetRootObject());
			}
		}

		public void OnDestroy()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			GM.CurrentSceneSettings.KillEvent -= new BotKill(wwBotKillEvent);
			GM.CurrentSceneSettings.SosigKillEvent -= new SosigKill(SosigKillEvent);
			GM.CurrentSceneSettings.ShotFiredEvent -= new ShotFired(ShotFiredEvent);
			GM.CurrentSceneSettings.FireArmReloadedEvent -= new FireArmReloaded(FireArmReloadedEvent);
			((FVRInteractiveObject)this).OnDestroy();
		}

		public override void OnAttach()
		{
			((FVRFireArmAttachmentInterface)this).OnAttach();
			if ((Object)(object)base.Attachment != (Object)null && (Object)(object)base.Attachment.GetRootObject() != (Object)null && base.Attachment.GetRootObject() is FVRFireArm && (Object)(object)MeatTrak != (Object)null && MeatTrak.NumberTarget == 0f && TrackingMode == TrackingModes.None)
			{
				TrackingMode = TrackingModes.Bullets;
				UpdateMode();
			}
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			((FVRFireArmAttachmentInterface)this).UpdateInteraction(hand);
			if (!hand.Input.TouchpadDown || !(((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.25f) || !((Object)(object)MeatTrak != (Object)null))
			{
				return;
			}
			Vector2 touchpadAxes = hand.Input.TouchpadAxes;
			if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) <= 45f)
			{
				if (m_waitingForConfirmation)
				{
					MeatTrak.NumberTarget = 0f;
					if (Aud_ClearComplete.Clips.Count > 0)
					{
						SM.PlayCoreSound((FVRPooledAudioType)20, Aud_ClearComplete, ((Component)this).transform.position);
					}
				}
				else if (Aud_ClearRequestConfirmation.Clips.Count > 0)
				{
					SM.PlayCoreSound((FVRPooledAudioType)20, Aud_ClearRequestConfirmation, ((Component)this).transform.position);
				}
				m_waitingForConfirmation = !m_waitingForConfirmation;
			}
			if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) <= 45f || Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) <= 45f)
			{
				int num = (int)Mathf.Sign(touchpadAxes.x);
				TrackingMode = (TrackingModes)Mathf.Repeat((float)TrackingMode + (float)num, (float)ModeSprites.Length);
				UpdateMode();
				if (Aud_ModeSwitch.Clips.Count > 0)
				{
					SM.PlayCoreSound((FVRPooledAudioType)20, Aud_ModeSwitch, ((Component)this).transform.position);
				}
			}
		}

		public override void EndInteraction(FVRViveHand hand)
		{
			((FVRInteractiveObject)this).EndInteraction(hand);
			m_waitingForConfirmation = false;
		}

		[ContextMenu("UpdateMode")]
		public void UpdateMode()
		{
			if ((Object)(object)ModeDiplayRenderer != (Object)null && ModeDiplayRenderer.materials.Length <= 2 && m_modeTextures.Length != 0 && m_modeTextures.Length >= (int)TrackingMode)
			{
				ModeDiplayRenderer.materials[1].SetTexture("_MainTex", (Texture)(object)m_modeTextures[(int)TrackingMode]);
			}
		}

		private void FireArmReloadedEvent(FVRObject obj)
		{
			if (!((Object)(object)obj == (Object)null) && (Object)(object)base.Attachment != (Object)null && (Object)(object)base.Attachment.GetRootObject() != (Object)null && (Object)(object)base.Attachment.GetRootObject().ObjectWrapper == (Object)(object)obj && (Object)(object)MeatTrak != (Object)null && TrackingMode == TrackingModes.Reloads)
			{
				MeatTrak.NumberTarget += 1f;
			}
		}

		private void ShotFiredEvent(FVRFireArm firearm)
		{
			if (!((Object)(object)firearm == (Object)null) && (Object)(object)base.Attachment != (Object)null && (Object)(object)base.Attachment.GetRootObject() != (Object)null && (Object)(object)base.Attachment.GetRootObject() == (Object)(object)firearm)
			{
				if ((Object)(object)MeatTrak != (Object)null && TrackingMode == TrackingModes.Shots)
				{
					MeatTrak.NumberTarget += 1f;
				}
				else if (TrackingMode == TrackingModes.Bullets)
				{
					UpdateBulletMode(firearm);
				}
			}
		}

		private void SosigKillEvent(Sosig sosig)
		{
			if (!((Object)(object)sosig == (Object)null) && (Object)(object)base.Attachment != (Object)null && (Object)(object)base.Attachment.GetRootObject() != (Object)null && base.Attachment.GetRootObject() is FVRFireArm && (Object)(object)((FVRInteractiveObject)base.Attachment.GetRootObject()).m_hand != (Object)null && sosig.E.IFFCode != sosig.GetDiedFromIFF() && (Object)(object)MeatTrak != (Object)null && TrackingMode == TrackingModes.Kills)
			{
				MeatTrak.NumberTarget += 1f;
			}
		}

		private void wwBotKillEvent(Damage dam)
		{
			if (dam != null && (Object)(object)base.Attachment != (Object)null && (Object)(object)base.Attachment.GetRootObject() != (Object)null && base.Attachment.GetRootObject() is FVRFireArm && (Object)(object)((FVRInteractiveObject)base.Attachment.GetRootObject()).m_hand != (Object)null && dam.Source_IFF == GM.CurrentPlayerBody.GetPlayerIFF() && (Object)(object)MeatTrak != (Object)null && TrackingMode == TrackingModes.Kills)
			{
				MeatTrak.NumberTarget += 1f;
			}
		}

		private void UpdateBulletMode(FVRFireArm firearm)
		{
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Expected O, but got Unknown
			if (!((Object)(object)base.Attachment != (Object)null) || !((Object)(object)base.Attachment.GetRootObject() != (Object)null) || !((Object)(object)base.Attachment.GetRootObject() == (Object)(object)firearm))
			{
				return;
			}
			MeatTrak.NumberTarget = 0f;
			FVRFireArmMagazine componentInChildren = ((Component)firearm).GetComponentInChildren<FVRFireArmMagazine>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				MeatTrak.NumberTarget = componentInChildren.m_numRounds;
			}
			FVRFireArmClip componentInChildren2 = ((Component)firearm).GetComponentInChildren<FVRFireArmClip>();
			if ((Object)(object)componentInChildren2 != (Object)null)
			{
				MeatTrak.NumberTarget = componentInChildren2.m_numRounds;
			}
			if (firearm == null)
			{
				return;
			}
			if (firearm is BreakActionWeapon)
			{
				BreakActionWeapon val = (BreakActionWeapon)(object)((firearm is BreakActionWeapon) ? firearm : null);
				for (int i = 0; i < val.Barrels.Length; i++)
				{
					if (val.Barrels[i].Chamber.IsFull && !val.Barrels[i].Chamber.IsSpent)
					{
						MeatTrak.NumberTarget += 1f;
					}
				}
			}
			else if (firearm is Derringer)
			{
				Derringer val2 = (Derringer)(object)((firearm is Derringer) ? firearm : null);
				for (int j = 0; j < val2.Barrels.Count; j++)
				{
					if (val2.Barrels[j].Chamber.IsFull && !val2.Barrels[j].Chamber.IsSpent)
					{
						MeatTrak.NumberTarget += 1f;
					}
				}
			}
			else if (firearm is SingleActionRevolver)
			{
				SingleActionRevolver val3 = (SingleActionRevolver)(object)((firearm is SingleActionRevolver) ? firearm : null);
				for (int k = 0; k < val3.Cylinder.Chambers.Length; k++)
				{
					if (val3.Cylinder.Chambers[k].IsFull && !val3.Cylinder.Chambers[k].IsSpent)
					{
						MeatTrak.NumberTarget += 1f;
					}
				}
			}
			if ((object)((object)firearm).GetType().GetField("Chamber") != null)
			{
				FVRFireArmChamber val4 = (FVRFireArmChamber)((object)firearm).GetType().GetField("Chamber").GetValue(firearm);
				if (val4.IsFull && !val4.IsSpent)
				{
					MeatTrak.NumberTarget += 1f;
				}
			}
			if ((object)((object)firearm).GetType().GetField("Chambers") == null)
			{
				return;
			}
			FVRFireArmChamber[] array = (FVRFireArmChamber[])((object)firearm).GetType().GetField("Chambers").GetValue(firearm);
			for (int l = 0; l < array.Length; l++)
			{
				if (array[l].IsFull && !array[l].IsSpent)
				{
					MeatTrak.NumberTarget += 1f;
				}
			}
		}
	}
	public class PortableGrabPoint : FVRPhysicalObject
	{
		[Header("PortableGrabPoint")]
		public FVRHandGrabPoint GrabPoint;

		public Renderer GeoRenderer;

		[ColorUsage(false, true, 0f, 8f, 0.125f, 3f)]
		public Color RingColorInactive = Color.black;

		[ColorUsage(false, true, 0f, 8f, 0.125f, 3f)]
		public Color RingColorActive = Color.white;

		private FVRViveHand m_lastHand;

		private bool m_grabPointActive;

		private float m_timeSincePickup;

		public override void BeginInteraction(FVRViveHand hand)
		{
			((FVRPhysicalObject)this).BeginInteraction(hand);
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			((FVRPhysicalObject)this).UpdateInteraction(hand);
			m_timeSincePickup += Time.deltaTime;
			if (m_timeSincePickup >= 0.1f && hand.Input.TouchpadDown && (Object)(object)GrabPoint != (Object)null && !m_grabPointActive)
			{
				((FVRPhysicalObject)this).SetIsKinematicLocked(true);
				hand.ForceSetInteractable((FVRInteractiveObject)(object)GrabPoint);
				((FVRInteractiveObject)GrabPoint).BeginInteraction(hand);
				m_lastHand = hand;
				m_grabPointActive = true;
			}
		}

		public override void FVRUpdate()
		{
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			((FVRPhysicalObject)this).FVRUpdate();
			if ((Object)(object)((FVRPhysicalObject)this).QuickbeltSlot != (Object)null)
			{
				m_grabPointActive = false;
			}
			if (m_grabPointActive && (Object)(object)m_lastHand != (Object)null && (Object)(object)m_lastHand.CurrentInteractable != (Object)(object)GrabPoint && (Object)(object)((FVRInteractiveObject)GrabPoint).m_hand == (Object)null && base.IsKinematicLocked)
			{
				((FVRPhysicalObject)this).SetIsKinematicLocked(false);
				if ((Object)(object)m_lastHand != (Object)null)
				{
					m_lastHand.ForceSetInteractable((FVRInteractiveObject)(object)this);
					((FVRInteractiveObject)this).BeginInteraction(m_lastHand);
				}
				m_grabPointActive = false;
			}
			if (m_timeSincePickup > 0f && !m_grabPointActive && !((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null))
			{
				m_timeSincePickup = Mathf.Clamp(m_timeSincePickup - Time.deltaTime, 0f, 1f);
			}
			if ((Object)(object)GeoRenderer != (Object)null && (Object)(object)GeoRenderer.material != (Object)null)
			{
				GeoRenderer.material.SetColor("_EmissionColor", Color.Lerp(RingColorInactive, RingColorActive, m_timeSincePickup));
			}
		}
	}
	public class RotateAroundRootAxis : FVRInteractiveObject
	{
		public enum RotationAxis
		{
			X,
			Y
		}

		public enum State
		{
			Min,
			Max,
			Between
		}

		[Header("Rotate Around Root Axis")]
		public Transform Root;

		public Transform ObjectToRotate;

		[Header("Axes and Angles")]
		public RotationAxis Axis = RotationAxis.Y;

		public bool InvertZRoot;

		[Tooltip("x = min, y = max")]
		public Vector2 RotationLimit;

		public Vector3 TargetRotation;

		[Range(0f, 360f)]
		public float AutoComplete = 5f;

		[Tooltip("This might be in rad/s?")]
		public float CompletionRate = 6f;

		private float m_targetAngle;

		[Header("Events")]
		public UnityEvent OnCompleteMin;

		public UnityEvent OnCompleteMax;

		public UnityEvent OnStartedBetween;

		public State m_curState;

		public State m_prevState;

		public void Update()
		{
			//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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			Vector3 localEulerAngles = ObjectToRotate.localEulerAngles;
			if (localEulerAngles != TargetRotation)
			{
				ObjectToRotate.localEulerAngles = new Vector3(Mathf.LerpAngle(localEulerAngles.x, TargetRotation.x, Time.deltaTime * CompletionRate), Mathf.LerpAngle(localEulerAngles.y, TargetRotation.y, Time.deltaTime * CompletionRate), Mathf.LerpAngle(localEulerAngles.z, TargetRotation.z, Time.deltaTime * CompletionRate));
			}
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: 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_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_0062: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).UpdateInteraction(hand);
			Vector3 val2;
			if (Axis == RotationAxis.X)
			{
				Vector3 val = ((Component)hand).transform.position - Root.position;
				val2 = Vector3.ProjectOnPlane(val, Root.right);
				val = ((Vector3)(ref val2)).normalized;
				Vector3 val3 = ObjectToRotate.forward;
				if (InvertZRoot)
				{
					val3 = -ObjectToRotate.forward;
				}
				float num = Mathf.Atan2(Vector3.Dot(Root.right, Vector3.Cross(val3, val)), Vector3.Dot(val3, val)) * 57.29578f;
				num = Mathf.Clamp(num, -10f, 10f);
				m_targetAngle += num;
				m_targetAngle = Mathf.Clamp(m_targetAngle, RotationLimit.x, RotationLimit.y);
			}
			else if (Axis == RotationAxis.Y)
			{
				Vector3 val4 = ((Component)hand).transform.position - Root.position;
				val2 = Vector3.ProjectOnPlane(val4, Root.up);
				val4 = ((Vector3)(ref val2)).normalized;
				Vector3 val5 = -((Component)Root).transform.forward;
				m_targetAngle = Mathf.Atan2(Vector3.Dot(Root.up, Vector3.Cross(val5, val4)), Vector3.Dot(val5, val4)) * 57.29578f;
			}
			if (Mathf.Abs(m_targetAngle - RotationLimit.x) < 3f)
			{
				m_targetAngle = RotationLimit.x;
			}
			if (Mathf.Abs(m_targetAngle - RotationLimit.y) < 3f)
			{
				m_targetAngle = RotationLimit.y;
			}
			if (!(m_targetAngle >= RotationLimit.x) || !(m_targetAngle <= RotationLimit.y))
			{
				return;
			}
			if (Axis == RotationAxis.X)
			{
				TargetRotation = new Vector3(m_targetAngle, 0f, 0f);
			}
			else if (Axis == RotationAxis.Y)
			{
				TargetRotation = new Vector3(0f, m_targetAngle, 0f);
			}
			float num2 = Mathf.InverseLerp(RotationLimit.x, RotationLimit.y, m_targetAngle);
			if (num2 > 1f - AutoComplete / 360f)
			{
				m_curState = State.Max;
			}
			else if (num2 < AutoComplete / 360f)
			{
				m_curState = State.Min;
			}
			else
			{
				m_curState = State.Between;
				if (m_prevState != State.Between && OnStartedBetween != null)
				{
					OnStartedBetween.Invoke();
				}
			}
			if (m_curState == State.Min && m_prevState != 0 && OnCompleteMin != null)
			{
				OnCompleteMin.Invoke();
			}
			if (m_curState == State.Max && m_prevState != State.Max && OnCompleteMax != null)
			{
				OnCompleteMax.Invoke();
			}
			m_prevState = m_curState;
		}
	}
	public class SpectatorCamera : FVRPhysicalObject
	{
		[Header("Spectator Camera")]
		public Camera DisplayCam;

		public Camera RenderTargetCam;

		public RotateAroundRootAxis Screen;

		[Header("Rendering Settings")]
		public Material ScreenOn;

		public Material ScreenOff;

		public Renderer LEDRenderer;

		public Color LEDColorOn;

		public Color LEDEmissOn;

		public Color LEDColorOff;

		public Color LEDEmissOff;

		[Header("Audio Events")]
		public AudioEvent CamOn;

		public AudioEvent CamOff;

		public AudioEvent FOVChange;

		public AudioEvent KinematicToggle;

		public bool CameraOn { get; private set; }

		public override void BeginInteraction(FVRViveHand hand)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			((FVRPhysicalObject)this).BeginInteraction(hand);
			if ((object)AccessTools.Field(typeof(FVRSceneSettings), "m_previewCam") != null)
			{
				Camera val = (Camera)AccessTools.Field(typeof(FVRSceneSettings), "m_previewCam").GetValue(GM.CurrentSceneSettings);
				if ((Object)(object)ScreenOn != (Object)null && (Object)(object)val != (Object)null)
				{
					ScreenOn.SetTexture("_MainTex", (Texture)(object)val.targetTexture);
				}
			}
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_0037: 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)
			//IL_003d: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			((FVRPhysicalObject)this).UpdateInteraction(hand);
			if (!hand.Input.TouchpadDown || !(((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.25f))
			{
				return;
			}
			Vector2 touchpadAxes = hand.Input.TouchpadAxes;
			if (Vector2.Angle(touchpadAxes, Vector2.down) <= 45f)
			{
				((FVRPhysicalObject)this).ToggleKinematicLocked();
				if (KinematicToggle.Clips.Count > 0)
				{
					SM.PlayCoreSound((FVRPooledAudioType)20, KinematicToggle, ((Component)this).transform.position);
				}
			}
			if (!((Object)(object)DisplayCam != (Object)null))
			{
				return;
			}
			if (Vector2.Angle(touchpadAxes, Vector2.up) <= 45f)
			{
				ToggleCameraState();
				if ((Object)(object)Screen != (Object)null)
				{
					Screen.TargetRotation = new Vector3(0f, CameraOn ? 0f : (-90f), 0f);
				}
			}
			if (CameraOn && (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) <= 45f || Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) <= 45f))
			{
				int num = (int)Mathf.Sign(touchpadAxes.x) * 10;
				GM.Options.ControlOptions.CamFOV = Mathf.Clamp(GM.Options.ControlOptions.CamFOV + (float)num, 10f, 180f);
				if (FOVChange.Clips.Count > 0)
				{
					SM.PlayCoreSound((FVRPooledAudioType)20, FOVChange, ((Component)this).transform.position);
				}
			}
		}

		public override void FVRUpdate()
		{
			((FVRPhysicalObject)this).FVRUpdate();
			if (CameraOn && (Object)(object)GM.CurrentSceneSettings.GetCamObjectPoint() != (Object)(object)((Component)DisplayCam).transform)
			{
				UpdateCameraState(isOn: false);
			}
		}

		[ContextMenu("Toggle Camera")]
		public void ToggleCameraState()
		{
			UpdateCameraState(!CameraOn);
			if (!CameraOn && (Object)(object)GM.CurrentSceneSettings.GetCamObjectPoint() == (Object)(object)((Component)DisplayCam).transform)
			{
				GM.CurrentSceneSettings.SetCamObjectPoint((Transform)null);
			}
		}

		public void UpdateCameraState(bool isOn)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: 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)
			//IL_00d2: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			((Component)DisplayCam).gameObject.SetActive(isOn);
			if (isOn)
			{
				if (Object.op_Implicit((Object)(object)DisplayCam))
				{
					GM.CurrentSceneSettings.SetCamObjectPoint(((Component)DisplayCam).transform);
				}
				GM.Options.ControlOptions.PCamMode = (PreviewCamMode)1;
			}
			if ((Object)(object)LEDRenderer != (Object)null)
			{
				LEDRenderer.material.SetColor("_Color", isOn ? LEDColorOn : LEDColorOff);
				LEDRenderer.material.SetColor("_EmissionColor", isOn ? LEDEmissOn : LEDEmissOff);
			}
			if ((Object)(object)Screen != (Object)null)
			{
				Screen.TargetRotation = new Vector3(0f, isOn ? 0f : (-90f), 0f);
				Material[] materials = ((Component)Screen).gameObject.GetComponent<Renderer>().materials;
				if (materials.Length > 1)
				{
					materials[1] = (isOn ? ScreenOn : ScreenOff);
				}
				((Component)Screen).gameObject.GetComponent<Renderer>().materials = materials;
			}
			if (isOn && CamOn.Clips.Count > 0)
			{
				SM.PlayCoreSound((FVRPooledAudioType)20, CamOn, ((Component)this).transform.position);
			}
			else if (CamOff.Clips.Count > 0)
			{
				SM.PlayCoreSound((FVRPooledAudioType)20, CamOff, ((Component)this).transform.position);
			}
			CameraOn = isOn;
		}
	}
	public class SpectatorCameraAttachmentInterface : FVRFireArmAttachmentInterface
	{
		[Header("Spectator Camera")]
		public Camera DisplayCam;

		[Header("Rendering Settings")]
		public Renderer LEDRenderer;

		public Color LEDColorOn;

		public Color LEDEmissOn;

		public Color LEDColorOff;

		public Color LEDEmissOff;

		[Header("Audio Events")]
		public AudioEvent CamOn;

		public AudioEvent CamOff;

		public AudioEvent FOVChange;

		public bool CameraOn { get; private set; }

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_0037: 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)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			((FVRFireArmAttachmentInterface)this).UpdateInteraction(hand);
			if (!hand.Input.TouchpadDown || !(((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.25f))
			{
				return;
			}
			Vector2 touchpadAxes = hand.Input.TouchpadAxes;
			if (!((Object)(object)DisplayCam != (Object)null))
			{
				return;
			}
			if (Vector2.Angle(touchpadAxes, Vector2.up) <= 45f)
			{
				ToggleCameraState();
			}
			if (CameraOn && (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) <= 45f || Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) <= 45f))
			{
				int num = (int)Mathf.Sign(touchpadAxes.x) * 10;
				GM.Options.ControlOptions.CamFOV = Mathf.Clamp(GM.Options.ControlOptions.CamFOV + (float)num, 10f, 180f);
				if (FOVChange.Clips.Count > 0)
				{
					SM.PlayCoreSound((FVRPooledAudioType)20, FOVChange, ((Component)this).transform.position);
				}
			}
		}

		public override void FVRUpdate()
		{
			((FVRInteractiveObject)this).FVRUpdate();
			if (CameraOn && (Object)(object)GM.CurrentSceneSettings.GetCamObjectPoint() != (Object)(object)((Component)DisplayCam).transform)
			{
				UpdateCameraState(isOn: false);
			}
		}

		[ContextMenu("Toggle Camera")]
		public void ToggleCameraState()
		{
			UpdateCameraState(!CameraOn);
			if (!CameraOn && (Object)(object)GM.CurrentSceneSettings.GetCamObjectPoint() == (Object)(object)((Component)DisplayCam).transform)
			{
				GM.CurrentSceneSettings.SetCamObjectPoint((Transform)null);
			}
		}

		public void UpdateCameraState(bool isOn)
		{
			//IL_0060: 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_00e2: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			((Component)DisplayCam).gameObject.SetActive(isOn);
			if ((Object)(object)DisplayCam != (Object)null && isOn)
			{
				GM.CurrentSceneSettings.SetCamObjectPoint(((Component)DisplayCam).transform);
			}
			if ((Object)(object)LEDRenderer != (Object)null)
			{
				LEDRenderer.material.SetColor("_Color", isOn ? LEDColorOn : LEDColorOff);
				LEDRenderer.material.SetColor("_EmissionColor", isOn ? LEDEmissOn : LEDEmissOff);
			}
			if (isOn && CamOn.Clips.Count > 0)
			{
				SM.PlayCoreSound((FVRPooledAudioType)20, CamOn, ((Component)this).transform.position);
			}
			else if (CamOff.Clips.Count > 0)
			{
				SM.PlayCoreSound((FVRPooledAudioType)20, CamOff, ((Component)this).transform.position);
			}
			CameraOn = isOn;
		}
	}
	public class ToggleGameObject : MonoBehaviour
	{
		public GameObject TargetObject;

		public void Toggle()
		{
			TargetObject.SetActive(!TargetObject.activeSelf);
		}
	}
}
namespace LSIIC.ModPanel
{
	public class ModPanelV2 : FVRPhysicalObject, IFVRDamageable
	{
		public delegate void EventDamage(Damage dam);

		[Header("ModPanelV2")]
		public Canvas Canvas;

		public Text BackgroundText;

		public Text HeldObjectsText;

		[Header("Pages")]
		public Text PageNameText;

		public List<GameObject> PagePrefabs;

		[HideInInspector]
		public List<ModPanelV2Page> Pages = new List<ModPanelV2Page>();

		public Dictionary<Type, ModPanelV2Page> PagesByType = new Dictionary<Type, ModPanelV2Page>();

		public List<GameObject> ControlPrefabs;

		private ModPanelV2Page m_curPage;

		private int m_pageIndex;

		public event EventDamage DamageEvent;

		public void Awake()
		{
			((FVRPhysicalObject)this).Awake();
			foreach (GameObject pagePrefab in PagePrefabs)
			{
				ModPanelV2Page component = Object.Instantiate<GameObject>(pagePrefab, ((Component)Canvas).transform).GetComponent<ModPanelV2Page>();
				((Component)component).gameObject.SetActive(false);
				component.Panel = this;
				component.PageInit();
				Pages.Add(component);
				if (!PagesByType.ContainsKey(((object)component).GetType()))
				{
					PagesByType[((object)component).GetType()] = component;
				}
			}
			SwitchPage(0);
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//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)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			((FVRPhysicalObject)this).UpdateInteraction(hand);
			if (hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.25f)
			{
				Vector2 touchpadAxes = hand.Input.TouchpadAxes;
				if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) <= 45f)
				{
					PrevPage();
				}
				else if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) <= 45f)
				{
					NextPage();
				}
				if (Vector2.Angle(touchpadAxes, Vector2.down) <= 45f)
				{
					((FVRPhysicalObject)this).ToggleKinematicLocked();
				}
			}
		}

		public void Update()
		{
			//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)
			if ((Object)(object)GM.CurrentPlayerBody.Head != (Object)null && Vector3.Dot(GM.CurrentPlayerBody.Head.position, ((Component)this).transform.position) > 0f && Pages.Count > m_pageIndex && (Object)(object)Pages[m_pageIndex] != (Object)null)
			{
				Pages[m_pageIndex].PageTick();
			}
			if ((Object)(object)BackgroundText != (Object)null)
			{
				BackgroundText.text = Helpers.H3InfoPrint((H3Info)int.MaxValue, true);
			}
			if (!((Object)(object)HeldObjectsText != (Object)null))
			{
				return;
			}
			bool flag = false;
			FVRViveHand[] hands = GM.CurrentMovementManager.Hands;
			for (int i = 0; i < hands.Length; i++)
			{
				if ((Object)(object)hands[i].CurrentInteractable != (Object)null)
				{
					flag = true;
					break;
				}
			}
			if (flag)
			{
				HeldObjectsText.text = Helpers.GetHeldObjects();
			}
			else if (!string.IsNullOrEmpty(HeldObjectsText.text))
			{
				HeldObjectsText.text = "";
			}
		}

		public void SwitchPage(int index)
		{
			index = (int)Mathf.Repeat((float)index, (float)Pages.Count);
			if ((Object)(object)m_curPage != (Object)null)
			{
				m_curPage.PageClose();
				((Component)m_curPage).gameObject.SetActive(false);
			}
			m_curPage = Pages[index];
			((Component)m_curPage).gameObject.SetActive(true);
			m_curPage.PageOpen();
			if ((Object)(object)PageNameText != (Object)null)
			{
				PageNameText.text = m_curPage.PageTitle;
			}
			m_pageIndex = index;
		}

		public void SwitchPage(ModPanelV2Page page)
		{
			int num = Pages.IndexOf(page);
			if (num == -1)
			{
				Debug.LogError((object)"Page does not exist to panel");
			}
			else
			{
				SwitchPage(num);
			}
		}

		public void SwitchPage(Type pagetype)
		{
			if (!PagesByType.ContainsKey(pagetype))
			{
				Debug.LogError((object)"Page type does not exist in dictionary");
				return;
			}
			if ((Object)(object)m_curPage != (Object)null)
			{
				m_curPage.PageClose();
				((Component)m_curPage).gameObject.SetActive(false);
			}
			m_curPage = PagesByType[pagetype];
			((Component)m_curPage).gameObject.SetActive(true);
			m_curPage.PageOpen();
			if ((Object)(object)PageNameText != (Object)null)
			{
				PageNameText.text = m_curPage.PageTitle;
			}
			m_pageIndex = Pages.IndexOf(m_curPage);
		}

		public void PrevPage()
		{
			SwitchPage(m_pageIndex - 1);
		}

		public void NextPage()
		{
			SwitchPage(m_pageIndex + 1);
		}

		public void Damage(Damage dam)
		{
			OnDamage(dam);
		}

		public void OnDamage(Damage dam)
		{
			if (this.DamageEvent != null)
			{
				this.DamageEvent(dam);
			}
		}
	}
	public class ModPanelV2ObjectControl : MonoBehaviour
	{
		public enum ObjectType
		{
			Int32,
			Single,
			Boolean,
			Enum,
			Method,
			Vectors,
			Message
		}

		public ObjectType Type;

		public object Instance;

		public FieldInfo Field;

		public MethodInfo Method;

		public bool UpdatesOnTick;

		public object[] MethodParameters;

		private Text m_display;

		private string m_message;

		public void Awake()
		{
			if ((Object)(object)m_display == (Object)null)
			{
				m_display = ((Component)this).GetComponent<Text>();
			}
		}

		public void Update()
		{
			if (UpdatesOnTick)
			{
				UpdateDisplay();
			}
		}

		public void UpdateDisplay()
		{
			if (Instance != null && (Object)(object)m_display != (Object)null)
			{
				if ((object)Field != null)
				{
					m_display.text = string.Format(string.IsNullOrEmpty(m_message) ? "{1} {2}: {3}" : m_message, Field.FieldType.BaseType.Name, Field.FieldType.Name, Field.Name, Field.GetValue(Instance));
				}
				else if ((object)Method != null)
				{
					string text = "";
					for (int i = 0; i < Method.GetParameters().Length; i++)
					{
						ParameterInfo parameterInfo = Method.GetParameters()[i];
						text = text + parameterInfo.ParameterType.Name + " " + parameterInfo.Name;
						text += ((i == Method.GetParameters().Length - 1) ? "" : ", ");
					}
					m_display.text = string.Format(string.IsNullOrEmpty(m_message) ? "{1} {0}.{2}({3})" : m_message, Method.DeclaringType.Name, Method.ReturnType.Name, Method.Name, text);
				}
				else
				{
					m_display.text = m_message;
				}
			}
			else if ((Object)(object)m_display != (Object)null)
			{
				Type = ObjectType.Message;
				m_display.text = "\nInstance is null!\n";
			}
			else
			{
				Debug.LogError((object)"Something is really wrong considering Instance and m_display are both null");
			}
		}

		public void InitObjectControl(object instance, FieldInfo field, MethodInfo method, string message = null, bool updateOnTick = false, object[] parameters = null)
		{
			Instance = instance;
			Field = field;
			Method = method;
			UpdatesOnTick = updateOnTick;
			m_message = message;
			MethodParameters = parameters;
			Awake();
			UpdateDisplay();
		}

		public void DeltaValue(int value)
		{
			if ((object)Field != null)
			{
				int num = (int)Field.GetValue(Instance);
				if (Field.FieldType.IsEnum)
				{
					object value2 = Field.GetValue(Instance);
					Array values = Enum.GetValues(value2.GetType());
					int num2 = Array.IndexOf(values, value2);
					Field.SetValue(Instance, values.GetValue((int)Mathf.Repeat((float)(num2 + value), (float)values.Length)));
				}
				else
				{
					Field.SetValue(Instance, num + value);
				}
				UpdateDisplay();
			}
		}

		public void DeltaValue(float value)
		{
			if ((object)Field != null)
			{
				float num = (float)Field.GetValue(Instance);
				Field.SetValue(Instance, num + value);
				UpdateDisplay();
			}
		}

		public void SetValue(int value)
		{
			if ((object)Field != null)
			{
				Field.SetValue(Instance, Convert.ChangeType(value, Field.FieldType));
				UpdateDisplay();
			}
		}

		public void SetValue(float value)
		{
			if ((object)Field != null)
			{
				Field.SetValue(Instance, value);
				UpdateDisplay();
			}
		}

		public void SetMaxValue()
		{
			if ((object)Field != null)
			{
				if ((object)Field.FieldType.GetField("MaxValue") != null)
				{
					Field.SetValue(Instance, Field.FieldType.GetField("MaxValue").GetValue(null));
				}
				UpdateDisplay();
			}
		}

		public void OpenKeyboard()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			if ((object)Field == null)
			{
				return;
			}
			((UnityEventBase)SteamVR_Events.System((EVREventType)1202)).RemoveAllListeners();
			SteamVR_Events.System((EVREventType)1202).Listen((UnityAction<VREvent_t>)delegate
			{
				//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				StringBuilder stringBuilder = new StringBuilder(256);
				SteamVR.instance.overlay.GetKeyboardText(stringBuilder, 256u);
				string text = stringBuilder.ToString();
				object value = Field.GetValue(Instance);
				if (Type != ObjectType.Vectors)
				{
					value = Convert.ChangeType(text, Field.FieldType);
				}
				else
				{
					text = text.Replace("(", "").Replace(")", "");
					string[] array = text.Split(new char[1] { ',' });
					value = (((object)Field.FieldType != typeof(Vector3)) ? ((object)new Vector2(float.Parse(array[0]), float.Parse(array[1]))) : ((object)new Vector3(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]))));
				}
				Field.SetValue(Instance, value);
				UpdateDisplay();
			});
			SteamVR.instance.overlay.ShowKeyboard(0, 0, "Enter the name of an asset.", 256u, Field.GetValue(Instance).ToString(), false, 0uL);
		}

		public void CallMethod()
		{
			if ((object)Method != null)
			{
				Method.Invoke(Instance, MethodParameters);
			}
		}
	}
	public class ModPanelV2Page : MonoBehaviour
	{
		public string PageTitle;

		public Vector2 ObjectControlStart = new Vector2(20f, -16f);

		public static float ObjectControlSpacing = -14f;

		[HideInInspector]
		public List<ModPanelV2ObjectControl> ObjectControls = new List<ModPanelV2ObjectControl>();

		[HideInInspector]
		public List<ModPanelV2ObjectControl> UpdatingObjectControls = new List<ModPanelV2ObjectControl>();

		[HideInInspector]
		public List<ModPanelV2ObjectControl> SavedObjectControls = new List<ModPanelV2ObjectControl>();

		protected Dictionary<string, GameObject> Elements = new Dictionary<string, GameObject>();

		[HideInInspector]
		public ModPanelV2 Panel;

		public virtual void PageInit()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			foreach (Transform item in ((Component)this).transform)
			{
				Transform val = item;
				Elements.Add(((Object)((Component)val).gameObject).name, ((Component)val).gameObject);
			}
		}

		public virtual void PageOpen()
		{
		}

		public virtual void PageTick()
		{
		}

		public virtual void PageClose(bool destroy = false)
		{
		}

		public void OnDestroy()
		{
			PageClose(destroy: true);
		}

		public ModPanelV2ObjectControl AddObjectControl(Vector2 startOffset, int startIndex, object instance, string memberName, string message = null, bool updateOnTick = false, bool isMethod = false, object[] methodParameters = null)
		{
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: 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)
			if ((Object)(object)Panel != (Object)null)
			{
				FieldInfo fieldInfo = null;
				MethodInfo methodInfo = null;
				ModPanelV2ObjectControl.ObjectType index = ModPanelV2ObjectControl.ObjectType.Message;
				if (!string.IsNullOrEmpty(memberName))
				{
					if (instance != null)
					{
						if (!isMethod)
						{
							fieldInfo = AccessTools.Field(instance.GetType(), memberName);
						}
						else
						{
							if (methodParameters != null)
							{
								Type[] array = new Type[methodParameters.Length];
								for (int i = 0; i < methodParameters.Length; i++)
								{
									array[i] = methodParameters[i].GetType();
								}
							}
							methodInfo = AccessTools.Method(instance.GetType(), memberName, (Type[])null, (Type[])null);
						}
					}
					if ((object)fieldInfo != null)
					{
						index = (fieldInfo.FieldType.IsEnum ? ModPanelV2ObjectControl.ObjectType.Enum : (((object)fieldInfo.FieldType != typeof(Vector2) && (object)fieldInfo.FieldType != typeof(Vector3)) ? ((ModPanelV2ObjectControl.ObjectType)Enum.Parse(typeof(ModPanelV2ObjectControl.ObjectType), fieldInfo.FieldType.Name)) : ModPanelV2ObjectControl.ObjectType.Vectors));
					}
					else if ((object)methodInfo != null)
					{
						index = ModPanelV2ObjectControl.ObjectType.Method;
					}
					else
					{
						index = ModPanelV2ObjectControl.ObjectType.Message;
						message = "No member of the instance was found with the name\n" + memberName;
						message += (isMethod ? "\nIt was said to be a method." : "\nIt was said to be a field.");
					}
				}
				ModPanelV2ObjectControl component = Object.Instantiate<GameObject>(Panel.ControlPrefabs[(int)index], ((Component)this).transform).GetComponent<ModPanelV2ObjectControl>();
				((Component)component).transform.localPosition = Vector2.op_Implicit(startOffset + new Vector2(0f, ObjectControlSpacing * (float)startIndex));
				GameObject gameObject = ((Component)component).gameObject;
				((Object)gameObject).name = ((Object)gameObject).name + memberName;
				component.InitObjectControl(instance, fieldInfo, methodInfo, message, updateOnTick, methodParameters);
				ObjectControls.Add(component);
				if (updateOnTick)
				{
					UpdatingObjectControls.Add(component);
				}
				return component;
			}
			return null;
		}

		public int AddObjectControls(Vector2 startOffset, int startIndex, object instance, string[] memberNames, string[] messages = null, ulong updatesOnTick = 0uL, ulong methods = 0uL, object[][] methodParams = null)
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < memberNames.Length; i++)
			{
				if (!string.IsNullOrEmpty(memberNames[i]) || (messages != null && messages.Length > i && !string.IsNullOrEmpty(messages[i])))
				{
					string message = ((messages != null && messages.Length > i) ? messages[i] : "");
					bool isMethod = ((methods >> i) & 1) != 0;
					bool updateOnTick = ((updatesOnTick >> i) & 1) != 0;
					object[] methodParameters = ((methodParams != null && methodParams.Length > i) ? methodParams[i] : null);
					AddObjectControl(startOffset, startIndex + i, instance, memberNames[i], message, updateOnTick, isMethod, methodParameters);
				}
			}
			return startIndex + memberNames.Length;
		}

		public void ClearObjectControls()
		{
			foreach (ModPanelV2ObjectControl objectControl in ObjectControls)
			{
				if (!((Object)(object)objectControl == (Object)null) && (SavedObjectControls == null || !SavedObjectControls.Contains(objectControl)))
				{
					Object.Destroy((Object)(object)((Component)objectControl).gameObject);
				}
			}
			ObjectControls.Clear();
			foreach (ModPanelV2ObjectControl savedObjectControl in SavedObjectControls)
			{
				if (!((Object)(object)savedObjectControl == (Object)null))
				{
					ObjectControls.Add(savedObjectControl);
				}
			}
		}
	}
	public class ModPanelV2Page_Damage : ModPanelV2Page
	{
		[Header("Damage Page")]
		public Text FieldValues;

		public bool AverageDamages;

		public Dictionary<float, Damage> AllDamages = new Dictionary<float, Damage>();

		private Damage m_dmg;

		public override void PageInit()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			base.PageInit();
			AddObjectControl(new Vector2(20f, 16f), 0, this, "AverageDamages", "Do we averages damages together? Currently {3}");
		}

		public override void PageOpen()
		{
			base.PageOpen();
			if ((Object)(object)Panel != (Object)null)
			{
				Panel.DamageEvent += Panel_DamageEvent;
			}
		}

		public override void PageClose(bool destroy = false)
		{
			base.PageClose(destroy);
			if ((Object)(object)Panel != (Object)null)
			{
				Panel.DamageEvent -= Panel_DamageEvent;
			}
		}

		public void UpdateDamageDisplay()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: 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 (m_dmg != null)
			{
				FieldValues.text = $"{m_dmg.Class}\n{m_dmg.Source_IFF}\n\n{m_dmg.Dam_Blunt}\n{m_dmg.Dam_Piercing}\n{m_dmg.Dam_Cutting}\n{m_dmg.Dam_TotalKinetic}\n{m_dmg.Dam_Thermal}\n{m_dmg.Dam_Chilling}\n{m_dmg.Dam_EMP}\n{m_dmg.Dam_TotalEnergetic}\n{m_dmg.Dam_Stunning}\n{m_dmg.Dam_Blinding}\n\n{m_dmg.point:F3}\n{m_dmg.hitNormal:F3}\n{m_dmg.strikeDir:F3}\n{m_dmg.damageSize}\n\n{AllDamages.Count}";
				if (AllDamages != null && AllDamages.Count > 1)
				{
					Text fieldValues = FieldValues;
					fieldValues.text += $"\n{(float)AllDamages.Count / (AllDamages.Last().Key - AllDamages.First().Key) * 60f}";
				}
				else
				{
					Text fieldValues2 = FieldValues;
					fieldValues2.text += "\n-";
				}
			}
			else
			{
				Debug.LogError((object)"[ModPanelV2Page_Damage] m_dmg == null!");
			}
		}

		public void ClearDamages()
		{
			if (AllDamages != null)
			{
				AllDamages.Clear();
			}
			FieldValues.text = "-\n-\n\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n\n-\n-\n-\n-\n\n-\n-";
		}

		public void Panel_DamageEvent(Damage dam)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: 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_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: 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_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ab: Expected O, but got Unknown
			if (!AverageDamages)
			{
				ClearDamages();
			}
			if (AllDamages != null && !AllDamages.ContainsKey(Time.time))
			{
				AllDamages.Add(Time.time, dam);
			}
			if (AllDamages != null && AllDamages.Count > 0)
			{
				m_dmg = new Damage
				{
					Class = AllDamages.Last().Value.Class,
					Source_IFF = AllDamages.Last().Value.Source_IFF,
					Dam_Blunt = AllDamages.Values.Average((Damage x) => x.Dam_Blunt),
					Dam_Piercing = AllDamages.Values.Average((Damage x) => x.Dam_Piercing),
					Dam_Cutting = AllDamages.Values.Average((Damage x) => x.Dam_Cutting),
					Dam_TotalKinetic = AllDamages.Values.Average((Damage x) => x.Dam_TotalKinetic),
					Dam_Thermal = AllDamages.Values.Average((Damage x) => x.Dam_Thermal),
					Dam_Chilling = AllDamages.Values.Average((Damage x) => x.Dam_Chilling),
					Dam_EMP = AllDamages.Values.Average((Damage x) => x.Dam_EMP),
					Dam_TotalEnergetic = AllDamages.Values.Average((Damage x) => x.Dam_TotalEnergetic),
					Dam_Stunning = AllDamages.Values.Average((Damage x) => x.Dam_Stunning),
					Dam_Blinding = AllDamages.Values.Average((Damage x) => x.Dam_Blinding),
					point = new Vector3(AllDamages.Values.Average((Damage x) => x.point.x), AllDamages.Values.Average((Damage x) => x.point.y), AllDamages.Values.Average((Damage x) => x.point.z)),
					hitNormal = new Vector3(AllDamages.Values.Average((Damage x) => x.hitNormal.x), AllDamages.Values.Average((Damage x) => x.hitNormal.y), AllDamages.Values.Average((Damage x) => x.hitNormal.z)),
					strikeDir = new Vector3(AllDamages.Values.Average((Damage x) => x.strikeDir.x), AllDamages.Values.Average((Damage x) => x.strikeDir.y), AllDamages.Values.Average((Damage x) => x.strikeDir.z)),
					damageSize = AllDamages.Values.Average((Damage x) => x.damageSize)
				};
			}
			UpdateDamageDisplay();
		}
	}
	public class ModPanelV2Page_Debug : ModPanelV2Page
	{
		[Header("Debug Page")]
		public Transform RaycastCylinder;

		public Transform CylinderBack;

		public Transform CylinderForward;

		[Space]
		public Text RaycastHitPath;

		public Text RaycastHitInfo;

		public Text RaycastObjectInfo;

		[Space]
		public Text ButtonSelectText;

		public GameObject SelectedControls;

		private Vector3 m_cylinderTarget;

		private RaycastHit m_raycastHit;

		private Collider m_raycastHitLastCollider;

		private GameObject m_selection;

		private Transform m_selectionParent;

		private LayerMask m_layerMask;

		private const int LAYERMASK_H3 = 532481;

		private const int LAYERMASK_ALL = int.MaxValue;

		public void Awake()
		{
			((LayerMask)(ref m_layerMask)).value = int.MaxValue;
			if ((Object)(object)Panel != (Object)null)
			{
				m_raycastHitLastCollider = ((Component)Panel).GetComponentInChildren<Collider>();
			}
		}

		public override void PageTick()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: 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_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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)
			base.PageTick();
			if ((Object)(object)RaycastCylinder == (Object)null || (Object)(object)RaycastCylinder.parent == (Object)null)
			{
				return;
			}
			Vector3 val;
			if ((Object)(object)m_selection == (Object)null)
			{
				if (Physics.Raycast(RaycastCylinder.parent.position, RaycastCylinder.parent.forward, ref m_raycastHit, 99999f, LayerMask.op_Implicit(m_layerMask), (QueryTriggerInteraction)2))
				{
					m_cylinderTarget = ((RaycastHit)(ref m_raycastHit)).point;
					if ((Object)(object)RaycastHitInfo != (Object)null)
					{
						Text raycastHitInfo = RaycastHitInfo;
						string[] obj = new string[6] { "Hit at ", null, null, null, null, null };
						val = ((RaycastHit)(ref m_raycastHit)).point;
						obj[1] = ((Vector3)(ref val)).ToString("F2");
						obj[2] = ", ";
						obj[3] = ((RaycastHit)(ref m_raycastHit)).distance.ToString("F2");
						obj[4] = "m away. LayerMask of ";
						obj[5] = ((LayerMask)(ref m_layerMask)).value.ToString();
						raycastHitInfo.text = string.Concat(obj);
					}
					if ((Object)(object)m_raycastHitLastCollider != (Object)(object)((RaycastHit)(ref m_raycastHit)).collider)
					{
						m_raycastHitLastCollider = ((RaycastHit)(ref m_raycastHit)).collider;
						if ((Object)(object)RaycastHitPath != (Object)null)
						{
							RaycastHitPath.text = Helpers.GetObjectHierarchyPath(((Component)((RaycastHit)(ref m_raycastHit)).collider).transform);
						}
						if ((Object)(object)RaycastObjectInfo != (Object)null)
						{
							RaycastObjectInfo.text = Helpers.GetObjectInfo(((Component)((RaycastHit)(ref m_raycastHit)).collider).gameObject, ((RaycastHit)(ref m_raycastHit)).collider.attachedRigidbody);
						}
						if ((Object)(object)ButtonSelectText != (Object)null)
						{
							((Component)ButtonSelectText).gameObject.SetActive(true);
						}
					}
				}
				else if ((Object)(object)m_raycastHitLastCollider != (Object)null)
				{
					m_raycastHitLastCollider = null;
					m_cylinderTarget = Vector3.zero;
					if ((Object)(object)RaycastHitInfo != (Object)null)
					{
						RaycastHitInfo.text = string.Empty;
					}
					if ((Object)(object)RaycastHitPath != (Object)null)
					{
						RaycastHitPath.text = string.Empty;
					}
					if ((Object)(object)RaycastObjectInfo != (Object)null)
					{
						RaycastObjectInfo.text = string.Empty;
					}
					if ((Object)(object)ButtonSelectText != (Object)null)
					{
						((Component)ButtonSelectText).gameObject.SetActive(false);
					}
				}
				RaycastCylinder.localRotation = Quaternion.identity;
			}
			else
			{
				if ((Object)(object)RaycastHitInfo != (Object)null)
				{
					Text raycastHitInfo2 = RaycastHitInfo;
					val = m_selection.transform.position;
					raycastHitInfo2.text = "Selection at " + ((Vector3)(ref val)).ToString("F2") + ". LayerMask of " + ((LayerMask)(ref m_layerMask)).value;
				}
				m_cylinderTarget = m_selection.transform.position;
				RaycastCylinder.LookAt(m_selection.transform);
			}
			((Component)RaycastCylinder).gameObject.SetActive(m_cylinderTarget != Vector3.zero);
			RaycastCylinder.localScale = new Vector3(5f, 5f, Vector3.Distance(m_cylinderTarget, ((Component)this).transform.position) * (RaycastCylinder.localScale.x / RaycastCylinder.lossyScale.x));
		}

		public void SelectOrReleaseObject()
		{
			if ((Object)(object)m_selection == (Object)null && (Object)(object)m_raycastHitLastCollider != (Object)null)
			{
				SelectObject(((Component)m_raycastHitLastCollider).transform);
			}
			else
			{
				ReleaseObject();
			}
		}

		public void SelectObject(Transform obj)
		{
			if ((Object)(object)m_selection != (Object)null)
			{
				ReleaseObject();
			}
			if ((Object)(object)obj != (Object)null)
			{
				m_selection = ((Component)obj).gameObject;
				m_selectionParent = obj.parent;
				if ((Object)(object)ButtonSelectText != (Object)null)
				{
					ButtonSelectText.text = "Release Object";
				}
				if ((Object)(object)SelectedControls != (Object)null)
				{
					SelectedControls.SetActive(true);
				}
				if ((Object)(object)RaycastHitPath != (Object)null)
				{
					RaycastHitPath.text = Helpers.GetObjectHierarchyPath(((Component)obj).transform);
				}
				if ((Object)(object)RaycastObjectInfo != (Object)null)
				{
					RaycastObjectInfo.text = Helpers.GetObjectInfo(((Component)obj).gameObject, m_raycastHitLastCollider.attachedRigidbody);
				}
			}
		}

		public void SelectObjectParent()
		{
			if ((Object)(object)m_selectionParent != (Object)null)
			{
				SelectObject(m_selectionParent);
			}
		}

		public void ReleaseObject()
		{
			if ((Object)(object)m_selection != (Object)null && (Object)(object)m_selection.transform.parent != (Object)(object)m_selectionParent)
			{
				m_selection.transform.SetParent(m_selectionParent);
			}
			m_selection = null;
			m_selectionParent = null;
			((Component)RaycastCylinder).gameObject.SetActive(false);
			if ((Object)(object)((FVRPhysicalObject)Panel).RootRigidbody != (Object)null)
			{
				((FVRPhysicalObject)Panel).RootRigidbody.ResetCenterOfMass();
			}
			if ((Object)(object)ButtonSelectText != (Object)null)
			{
				ButtonSelectText.text = "Select Object";
			}
			if ((Object)(object)SelectedControls != (Object)null)
			{
				SelectedControls.SetActive(false);
			}
		}

		public void ToggleRaycastMask()
		{
			((LayerMask)(ref m_layerMask)).value = ((((LayerMask)(ref m_layerMask)).value == int.MaxValue) ? 532481 : int.MaxValue);
		}

		public void ToggleRaycastDirection()
		{
			if ((Object)(object)RaycastCylinder.parent == (Object)(object)CylinderBack)
			{
				RaycastCylinder.SetParent(CylinderForward);
			}
			else
			{
				RaycastCylinder.SetParent(CylinderBack);
			}
		}

		public void DeleteObject()
		{
			if (!((Object)(object)m_selection != (Object)null))
			{
				return;
			}
			if ((Object)(object)m_selection.GetComponent<FVRInteractiveObject>() != (Object)null)
			{
				FVRInteractiveObject component = m_selection.GetComponent<FVRInteractiveObject>();
				if (component.IsHeld)
				{
					component.EndInteraction(component.m_hand);
					component.m_hand.ForceSetInteractable((FVRInteractiveObject)null);
				}
			}
			Object.Destroy((Object)(object)m_selection.gameObject);
			ReleaseObject();
		}

		public void GrabOrReleaseObject()
		{
			if ((Object)(object)m_selection != (Object)null)
			{
				m_selection.transform.SetParent(((Object)(object)m_selection.transform.parent == (Object)(object)((Component)Panel).transform) ? m_selectionParent : ((Component)Panel).transform);
				if ((Object)(object)m_raycastHitLastCollider != (Object)null && (Object)(object)m_raycastHitLastCollider.attachedRigidbody != (Object)null)
				{
					m_raycastHitLastCollider.attachedRigidbody.isKinematic = (Object)(object)m_selection.transform.parent == (Object)(object)((Component)Panel).transform;
				}
			}
		}

		public void OpenObjectInPanelSpawnerPage()
		{
			if ((Object)(object)m_selection != (Object)null && (Object)(object)Panel != (Object)null)
			{
				ModPanelV2Page_Spawner modPanelV2Page_Spawner = (ModPanelV2Page_Spawner)Panel.PagesByType[typeof(ModPanelV2Page_Spawner)];
				Panel.SwitchPage(modPanelV2Page_Spawner);
				modPanelV2Page_Spawner.UpdateCurrentGameObj(m_selection);
			}
		}
	}
	public class ModPanelV2Page_HeldObject : ModPanelV2Page
	{
		[Header("Held Object Page")]
		public Vector2[] Columns = (Vector2[])(object)new Vector2[3]
		{
			new Vector2(20f, -16f),
			new Vector2(130f, -16f),
			new Vector2(240f, -16f)
		};

		public bool ClearObjectControlsOnRelease = true;

		private FVRInteractiveObject m_object;

		private FVRInteractiveObject m_prevObject;

		private Type[] m_allowedInteractables = new Type[1] { typeof(FVRFireArmAttachmentInterface) };

		private ModPanelV2ObjectControl m_clearObjectControl;

		private int[] m_columnStarts;

		private FVRFireArmChamber m_curChamber;

		private int m_curChamberIndex = -1;

		public FVRInteractiveObject Object
		{
			get
			{
				return m_object;
			}
			set
			{
				m_prevObject = m_object;
				m_object = value;
			}
		}

		public override void PageInit()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			base.PageInit();
			if ((Object)(object)m_clearObjectControl == (Object)null)
			{
				m_clearObjectControl = AddObjectControl(new Vector2(20f, 16f), 0, this, "ClearObjectControlsOnRelease", "Clear object controls on release? Currently {3}");
				SavedObjectControls.Add(m_clearObjectControl);
			}
		}

		public override void PageOpen()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			base.PageOpen();
			GM.CurrentSceneSettings.ObjectPickedUpEvent += new FVRObjectPickedUp(RefreshObjectControls);
		}

		public override void PageTick()
		{
			base.PageTick();
			if (ClearObjectControlsOnRelease)
			{
				if ((Object)(object)Object != (Object)null && (Object)(object)Object.m_hand == (Object)null)
				{
					Object = null;
					CleanupHeldObject();
				}
				FVRViveHand[] hands = GM.CurrentMovementManager.Hands;
				foreach (FVRViveHand val in hands)
				{
					if (!((Object)(object)val.CurrentInteractable != (Object)null))
					{
						continue;
					}
					if ((Object)(object)Object != (Object)null && (Object)(object)Object != (Object)(object)val.CurrentInteractable)
					{
						if (!(val.CurrentInteractable is FVRPhysicalObject))
						{
							bool flag = false;
							for (int j = 0; j < m_allowedInteractables.Length; j++)
							{
								Type type = ((object)val.CurrentInteractable).GetType();
								Type type2 = m_allowedInteractables[j];
								if (!type.IsSubclassOf(type2) && (object)type != type2)
								{
									flag = true;
								}
							}
							if (flag)
							{
								continue;
							}
						}
						if ((Object)(object)Object == (Object)(object)val.OtherHand.CurrentInteractable && (Object)(object)m_prevObject != (Object)(object)val.CurrentInteractable)
						{
							Object = val.CurrentInteractable;
							RefreshObjectControls();
							break;
						}
						if ((Object)(object)Object != (Object)(object)val.OtherHand.CurrentInteractable)
						{
							Object = val.CurrentInteractable;
							RefreshObjectControls();
							break;
						}
					}
					else if ((Object)(object)Object == (Object)null)
					{
						Object = val.CurrentInteractable;
						RefreshObjectControls();
						break;
					}
				}
			}
			if (m_curChamberIndex != -1)
			{
				TryToGetCurrentChamber();
			}
		}

		public override void PageClose(bool destroy)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			base.PageClose();
			GM.CurrentSceneSettings.ObjectPickedUpEvent -= new FVRObjectPickedUp(RefreshObjectControls);
		}

		public void CleanupHeldObject()
		{
			ClearObjectControls();
			if ((Object)(object)Panel != (Object)null && (Object)(object)Panel.PageNameText != (Object)null)
			{
				Panel.PageNameText.text = PageTitle;
			}
			m_curChamber = null;
			m_curChamberIndex = -1;
		}

		public void TryToGetCurrentChamber()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			if (!((Object)(object)Object != (Object)null) || !((Object)(object)((Component)Object).GetComponent<FVRFireArm>() != (Object)null))
			{
				return;
			}
			if ((object)AccessTools.Field(((object)Object).GetType(), "Chamber") != null)
			{
				m_curChamber = (FVRFireArmChamber)AccessTools.Field(((object)Object).GetType(), "Chamber").GetValue(Object);
				m_curChamberIndex = -1;
			}
			else
			{
				if ((object)AccessTools.Field(((object)Object).GetType(), "m_curChamber") == null)
				{
					return;
				}
				int num = (int)AccessTools.Field(((object)Object).GetType(), "m_curChamber").GetValue(Object);
				if ((num == m_curChamberIndex && !((Object)(object)m_curChamber == (Object)null)) || (object)((object)Object).GetType().GetField("Chambers") == null)
				{
					return;
				}
				m_curChamberIndex = num;
				FVRFireArmChamber[] array = (FVRFireArmChamber[])((object)Object).GetType().GetField("Chambers").GetValue(Object);
				m_curChamber = array[m_curChamberIndex];
				foreach (ModPanelV2ObjectControl updatingObjectControl in UpdatingObjectControls)
				{
					if ((object)updatingObjectControl.Instance.GetType() == typeof(FVRFireArmChamber))
					{
						updatingObjectControl.Instance = m_curChamber;
					}
				}
			}
		}

		public void RefreshObjectControls(FVRInteractiveObject obj = null)
		{
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e32: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ee6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f45: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0504: Unknown result type (might be due to invalid IL or missing references)
			//IL_0573: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fdc: Unknown result type (might be due to invalid IL or missing references)
			//IL_106d: Unknown result type (might be due to invalid IL or missing references)
			//IL_10b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0650: Unknown result type (might be due to invalid IL or missing references)
			//IL_06af: Unknown result type (might be due to invalid IL or missing references)
			//IL_110a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0712: Unknown result type (might be due to invalid IL or missing references)
			//IL_119f: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_120f: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0907: Unknown result type (might be due to invalid IL or missing references)
			//IL_0767: Unknown result type (might be due to invalid IL or missing references)
			//IL_127c: Unknown result type (might be due to invalid IL or missing references)
			//IL_09da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0978: Unknown result type (might be due to invalid IL or missing references)
			//IL_0839: Unknown result type (might be due to invalid IL or missing references)
			//IL_12e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5f: Unknown result type (might be due to invalid IL or missing references)
			//IL_13e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_138d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b29: Unknown result type (might be due to invalid IL or missing references)
			//IL_143f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c28: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c98: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d1c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d97: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de2: Unknown result type (might be due to invalid IL or missing references)
			CleanupHeldObject();
			if ((Object)(object)obj != (Object)null)
			{
				Object = obj;
			}
			m_columnStarts = new int[3];
			if (!((Object)(object)Object != (Object)null))
			{
				return;
			}
			if ((Object)(object)Panel != (Object)null && (Object)(object)Panel.PageNameText != (Object)null)
			{
				if (Object != null)
				{
					m_columnStarts[0] = AddObjectControls(Columns[0], m_columnStarts[0], Object, new string[3] { "ControlType", "UseGrabPointChild", "UseGripRotInterp" }, null, 0uL, 0uL);
					Panel.PageNameText.text = PageTitle + " - " + ((Object)((Component)Object).gameObject).name;
				}
				if (Object is FVRPhysicalObject)
				{
					FVRInteractiveObject @object = Object;
					FVRPhysicalObject val = (FVRPhysicalObject)(object)((@object is FVRPhysicalObject) ? @object : null);
					if ((Object)(object)val.ObjectWrapper != (Object)null)
					{
						Panel.PageNameText.text = PageTitle + " - " + val.ObjectWrapper.DisplayName;
					}
					m_columnStarts[0] = AddObjectControls(Columns[0], m_columnStarts[0], Object, new string[10] { "SpawnLockable", "Harnessable", "Size", "ThrowVelMultiplier", "ThrowAngMultiplier", "UsesGravity", "DistantGrabbable", "DoesQuickbeltSlotFollowHead", "IsPickUpLocked", "m_doesDirectParent" }, null, 0uL, 0uL);
					m_columnStarts[0] = AddObjectControls(Columns[0], m_columnStarts[0], Object, new string[1] { "ToggleKinematicLocked" }, null, 0uL, 1uL);
				}
			}
			if ((Object)(object)((Component)Object).GetComponentInChildren<FVRFireArmMagazine>() != (Object)null)
			{
				m_columnStarts[2] = AddObjectControls(Columns[2], m_columnStarts[2], ((Component)Object).GetComponentInChildren<FVRFireArmMagazine>(), new string[6] { "m_capacity", "IsInfinite", "MagazineType", "RoundType", "FuelAmountLeft", "CanManuallyEjectRounds" }, null, 0uL, 0uL);
			}
			if ((Object)(object)((Component)Object).GetComponentInChildren<FVRFireArmClip>() != (Object)null)
			{
				m_columnStarts[2] = AddObjectControls(Columns[2], m_columnStarts[2], ((Component)Object).GetComponentInChildren<FVRFireArmClip>(), new string[5] { "m_capacity", "IsInfinite", "ClipType", "RoundType", "CanManuallyEjectRounds" }, null, 0uL, 0uL);
			}
			if (Object is FVRPhysicalObject)
			{
				if (Object is FVRFireArm)
				{
					Vector2 startOffset = Columns[0];
					FVRInteractiveObject object2 = Object;
					AddObjectControl(startOffset, 15, (object2 is FVRFireArm) ? object2 : null, "RoundType");
					TryToGetCurrentChamber();
					if ((Object)(object)m_curChamber != (Object)null)
					{
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], m_curChamber, new string[2] { "ChamberVelocityMultiplier", "IsManuallyExtractable" }, null, 0uL, 0uL);
					}
					if (Object is Handgun)
					{
						FVRInteractiveObject object3 = Object;
						Handgun val2 = (Handgun)(object)((object3 is Handgun) ? object3 : null);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, val2, new string[6] { "HasSlideRelease", "HasSlideReleaseControl", "HasSlideLockFunctionality", "HasManualDecocker", "HasMagReleaseInput", "CanPhysicsSlideRack" }, null, 0uL, 0uL);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, val2.Slide, new string[5] { "Speed_Forward", "Speed_Rearward", "Speed_Held", "SpringStiffness", "HasLastRoundSlideHoldOpen" }, null, 0uL, 0uL);
						AddObjectControls(Columns[2], 14, val2.FireSelectorModes[val2.FireSelectorModeIndex], new string[2] { "ModeType", "BurstAmount" }, null, 1uL, 0uL);
					}
					else if (Object is OpenBoltReceiver)
					{
						FVRInteractiveObject object4 = Object;
						OpenBoltReceiver val3 = (OpenBoltReceiver)(object)((object4 is OpenBoltReceiver) ? object4 : null);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, val3, new string[1] { "HasMagReleaseButton" }, null, 0uL, 0uL);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, val3.Bolt, new string[8] { "BoltSpeed_Forward", "BoltSpeed_Rearward", "BoltSpeed_Held", "BoltSpringStiffness", "HasLastRoundBoltHoldOpen", "BoltRot_Standard", "BoltRot_Safe", "BoltRot_SlipDistance" }, null, 0uL, 0uL);
						AddObjectControls(Columns[2], 14, val3.FireSelector_Modes[val3.FireSelectorModeIndex], new string[1] { "ModeType" }, null, 1uL, 0uL);
						AddObjectControls(Columns[2], 15, val3, new string[1] { "SuperBurstAmount" }, null, 0uL, 0uL);
					}
					else if (Object is ClosedBoltWeapon)
					{
						FVRInteractiveObject object5 = Object;
						ClosedBoltWeapon val4 = (ClosedBoltWeapon)(object)((object5 is ClosedBoltWeapon) ? object5 : null);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, val4, new string[5] { "EjectsMagazineOnEmpty", "BoltLocksWhenNoMagazineFound", "DoesClipEntryRequireBoltBack", "HasMagReleaseButton", "HasBoltReleaseButton" }, null, 0uL, 0uL);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, val4.Bolt, new string[6] { "Speed_Forward", "Speed_Rearward", "Speed_Held", "SpringStiffness", "HasLastRoundBoltHoldOpen", "DoesClipHoldBoltOpen" }, null, 0uL, 0uL);
						AddObjectControls(Columns[2], 14, val4.FireSelector_Modes[val4.FireSelectorModeIndex], new string[2] { "ModeType", "BurstAmount" }, null, 1uL, 0uL);
					}
					else if (Object is BreakActionWeapon)
					{
						FVRInteractiveObject object6 = Object;
						BreakActionWeapon val5 = (BreakActionWeapon)(object)((object6 is BreakActionWeapon) ? object6 : null);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], val5, new string[4] { "m_isLatched", "UsesManuallyCockedHammers", "FireAllBarrels", "PopOutEmpties" }, null, 0uL, 8uL);
						for (int i = 0; i < Math.Min(val5.Barrels.Length, 14); i++)
						{
							m_columnStarts[2] = AddObjectControls(Columns[2], m_columnStarts[2], val5.Barrels[i].Chamber, new string[1] { "ChamberVelocityMultiplier" }, null, 0uL, 0uL);
						}
					}
					else if (Object is Derringer)
					{
						FVRInteractiveObject object7 = Object;
						Derringer val6 = (Derringer)(object)((object7 is Derringer) ? object7 : null);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], val6, new string[4] { "HingeValues", "DoesAutoEjectRounds", "IsTriggerDoubleAction", "DeletesCartridgeOnFire" }, null, 0uL, 0uL);
						for (int j = 0; j < Math.Min(val6.Barrels.Count, 14); j++)
						{
							m_columnStarts[2] = AddObjectControls(Columns[2], m_columnStarts[2], val6.Barrels[j].Chamber, new string[1] { "ChamberVelocityMultiplier" }, null, 0uL, 0uL);
						}
					}
					else if (Object is TubeFedShotgun)
					{
						FVRInteractiveObject object8 = Object;
						TubeFedShotgun val7 = (TubeFedShotgun)(object)((object8 is TubeFedShotgun) ? object8 : null);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, val7, new string[3] { "m_isHammerCocked", "UsesSlamFireTrigger", "CanModeSwitch" }, null, 0uL, 0uL);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, val7.Bolt, new string[5] { "Speed_Forward", "Speed_Rearward", "Speed_Held", "SpringStiffness", "HasLastRoundBoltHoldOpen" }, null, 0uL, 0uL);
						if ((Object)(object)val7.Handle != (Object)null)
						{
							m_columnStarts[2] = AddObjectControls(Columns[2], m_columnStarts[2] + 1, val7.Handle, new string[2] { "Speed_Held", "m_isHandleLocked" }, null, 0uL, 0uL);
						}
					}
					else if (Object is Flaregun)
					{
						FVRInteractiveObject object9 = Object;
						Flaregun instance = (Flaregun)(object)((object9 is Flaregun) ? object9 : null);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, instance, new string[7] { "HingeAxis", "RotOut", "CanUnlatch", "IsHighPressureTolerant", "m_isHammerCocked", "m_isDestroyed", "CocksOnOpen" }, null, 0uL, 0uL);
					}
					else if (Object is SimpleLauncher)
					{
						FVRInteractiveObject object10 = Object;
						SimpleLauncher instance2 = (SimpleLauncher)(object)((object10 is SimpleLauncher) ? object10 : null);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, instance2, new string[5] { "HasTrigger", "AlsoPlaysSuppressedSound", "DeletesCartridgeOnFire", "FireOnCol", "ColThresh" }, null, 0uL, 0uL);
					}
					else if (Object is BoltActionRifle)
					{
						FVRInteractiveObject object11 = Object;
						BoltActionRifle val8 = (BoltActionRifle)(object)((object11 is BoltActionRifle) ? object11 : null);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, val8, new string[4] { "HasMagEjectionButton", "m_isHammerCocked", "EjectsMagazineOnEmpty", "HasMagEjectionButton" }, null, 0uL, 0uL);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, val8.BoltHandle, new string[5] { "UsesQuickRelease", "BaseRotOffset", "MinRot", "MaxRot", "UnlockThreshold" }, null, 0uL, 0uL);
					}
					else if (Object is Revolver)
					{
						FVRInteractiveObject object12 = Object;
						Revolver instance3 = (Revolver)(object)((object12 is Revolver) ? object12 : null);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, instance3, new string[7] { "AllowsSuppressor", "CanManuallyCockHammer", "m_isHammerLocked", "m_isCylinderArmLocked", "CylinderRotRange", "IsCylinderArmZ", "GravityRotsCylinderPositive" }, null, 0uL, 0uL);
					}
					else if (Object is SingleActionRevolver)
					{
						FVRInteractiveObject object13 = Object;
						SingleActionRevolver instance4 = (SingleActionRevolver)(object)((object13 is SingleActionRevolver) ? object13 : null);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, instance4, new string[4] { "AllowsSuppressor", "DoesCylinderTranslateForward", "DoesHalfCockHalfRotCylinder", "HasTransferBarSafety" }, null, 0uL, 0uL);
					}
					else if (Object is LAPD2019)
					{
						FVRInteractiveObject object14 = Object;
						LAPD2019 val9 = (LAPD2019)(object)((object14 is LAPD2019) ? object14 : null);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, val9, new string[10] { "m_isCylinderArmLocked", "CylinderRotRange", "GravityRotsCylinderPositive", "m_isAutoChargeEnabled", "m_hasBattery", "m_batteryCharge", "m_hasThermalClip", "m_heatThermalClip", "m_heatSystem", "m_barrelHeatDamage" }, null, 0uL, 0uL);
						m_columnStarts[2] = AddObjectControls(Columns[2], m_columnStarts[2], val9.BoltHandle, new string[5] { "UsesQuickRelease", "BaseRotOffset", "MinRot", "MaxRot", "UnlockThreshold" }, null, 0uL, 0uL);
					}
					else if (Object is RevolvingShotgun)
					{
						FVRInteractiveObject object15 = Object;
						RevolvingShotgun val10 = (RevolvingShotgun)(object)((object15 is RevolvingShotgun) ? object15 : null);
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1] + 1, val10, new string[4] { "DoesFiringRecock", "CylinderLoaded", "IsCylinderRotClockwise", "EjectCylinder" }, null, 0uL, 8uL);
						AddObjectControls(Columns[2], 15, val10.FireSelector_Modes[val10.FireSelectorModeIndex], new string[1] { "ModeType" }, null, 1uL, 0uL);
					}
				}
				else if (Object is FVRFireArmRound)
				{
					ref int reference = ref m_columnStarts[1];
					Vector2 startOffset2 = Columns[1];
					int startIndex = m_columnStarts[1];
					FVRInteractiveObject object16 = Object;
					reference = AddObjectControls(startOffset2, startIndex, (object16 is FVRFireArmRound) ? object16 : null, new string[13]
					{
						"RoundType", "RoundClass", "IsHighPressure", "NumProjectiles", "ProjectileSpread", "IsDestroyedAfterCounter", "m_isKillCounting", "isCookingOff", "isManuallyChamberable", "IsCaseless",
						"isMagazineLoadable", "isPalmable", "MaxPalmedAmount"
					}, null, 0uL, 0uL);
				}
				else if (Object is PinnedGrenade)
				{
					ref int reference2 = ref m_columnStarts[1];
					Vector2 startOffset3 = Columns[1];
					int startIndex2 = m_columnStarts[1];
					FVRInteractiveObject object17 = Object;
					reference2 = AddObjectControls(startOffset3, startIndex2, (object17 is FVRGrenade) ? object17 : null, new string[3] { "ReleaseLever", "DefaultFuse", "HasImpactFuse" }, null, 0uL, 1uL);
				}
				else if (Object is MF2_Medigun)
				{
					ref int reference3 = ref m_columnStarts[1];
					Vector2 startOffset4 = Columns[1];
					int startIndex3 = m_columnStarts[1];
					FVRInteractiveObject object18 = Object;
					reference3 = AddObjectControls(startOffset4, startIndex3, (object18 is MF2_Medigun) ? object18 : null, new string[7] { "EngageRange", "MaxRange", "TryEngageBeam", "EngageUber", "DisEngageBeam", "m_uberChargeUp", "m_uberChargeOut" }, null, 96uL, 28uL);
				}
				else if ((Object)(object)((Component)Object).GetComponent<SosigLink>() != (Object)null)
				{
					SosigLink component = ((Component)Object).GetComponent<SosigLink>();
					m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], component.S, new string[11]
					{
						"ClearSosig", "", "BodyState", "CurrentOrder", "Mustard", "BleedDamageMult", "BleedRateMult", "Speed_Crawl", "Speed_Sneak", "Speed_Walk",
						"Speed_Run"
					}, null, 28uL, 1uL);
					m_columnStarts[2] = AddObjectControls(Columns[2], m_columnStarts[2], component, new string[3] { "m_integrity", "StaggerMagnitude", "DamMult" }, null, 1uL, 0uL);
					m_columnStarts[2] = AddObjectControls(Columns[2], m_columnStarts[2] + 1, component.S.E, new string[1] { "IFFCode" }, null, 0uL, 0uL);
				}
				else if (Object is SosigWeaponPlayerInterface)
				{
					ref int reference4 = ref m_columnStarts[1];
					Vector2 startOffset5 = Columns[1];
					int startIndex4 = m_columnStarts[1];
					FVRInteractiveObject object19 = Object;
					reference4 = AddObjectControls(startOffset5, startIndex4, ((SosigWeaponPlayerInterface)((object19 is SosigWeaponPlayerInterface) ? object19 : null)).W, new string[9] { "CycleSpeedForward", "CycleSpeedBackward", "ShotsPerLoad", "m_shotsLeft", "ProjectilesPerShot", "ProjectileSpread", "isFullAuto", "ReloadTime", "BurstLimit" }, null, 0uL, 0uL);
				}
				else if (Object is RW_Powerup)
				{
					ref int reference5 = ref m_columnStarts[1];
					Vector2 startOffset6 = Columns[1];
					int startIndex5 = m_columnStarts[1];
					FVRInteractiveObject object20 = Object;
					reference5 = AddObjectControls(startOffset6, startIndex5, (object20 is RW_Powerup) ? object20 : null, new string[5] { "PowerupType", "PowerupIntensity", "PowerupDuration", "Cooked", "UpdateSymbols" }, null, 0uL, 16uL);
				}
				else if (Object is ShatterablePhysicalObject)
				{
					ref int reference6 = ref m_columnStarts[1];
					Vector2 startOffset7 = Columns[1];
					int startIndex6 = m_columnStarts[1];
					FVRInteractiveObject object21 = Object;
					reference6 = AddObjectControls(startOffset7, startIndex6, (object21 is ShatterablePhysicalObject) ? object21 : null, new string[4] { "currentToughness", "TransfersVelocityExplosively", "DamageReceivedMultiplier", "CollisionShatterThreshold" }, null, 0uL, 0uL);
				}
				else if ((Object)(object)((Component)Object).GetComponent<RotrwBangerJunk>() != (Object)null)
				{
					m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], ((Component)Object).GetComponent<RotrwBangerJunk>(), new string[2] { "Type", "ContainerSize" }, null, 0uL, 0uL);
				}
				else if (Object is Banger)
				{
					FVRInteractiveObject object22 = Object;
					Banger val11 = (Banger)(object)((object22 is Banger) ? object22 : null);
					m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], val11, new string[12]
					{
						"BType", "BSize", "m_isArmed", "m_timeToPayload", "ProxRange", "m_timeSinceArmed", "m_shrapnelVel", "m_isSticky", "m_isSilent", "m_isHoming",
						"m_canbeshot", "SetToBouncy"
					}, null, 0uL, 2048uL);
					if ((Object)(object)val11.BDial != (Object)null)
					{
						m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], val11.BDial, new string[3] { "DialTick", "m_isPrimed", "m_hasDinged" }, null, 0uL, 0uL);
					}
				}
				else if (Object is BangerDetonator)
				{
					ref int reference7 = ref m_columnStarts[1];
					Vector2 startOffset8 = Columns[1];
					int startIndex7 = m_columnStarts[1];
					FVRInteractiveObject object23 = Object;
					reference7 = AddObjectControls(startOffset8, startIndex7, (object23 is BangerDetonator) ? object23 : null, new string[2] { "Detonate", "TriggerRange" }, null, 0uL, 1uL);
				}
				else if (Object is GronchHatCase)
				{
					ref int reference8 = ref m_columnStarts[1];
					Vector2 startOffset9 = Columns[1];
					int startIndex8 = m_columnStarts[1];
					FVRInteractiveObject object24 = Object;
					reference8 = AddObjectControls(startOffset9, startIndex8, (object24 is GronchHatCase) ? object24 : null, new string[2] { "m_isOpen", "HID" }, null, 0uL, 0uL);
				}
				else if ((Object)(object)((Component)Object).GetComponent<FVRFireArmAttachment>() != (Object)null && (Object)(object)((Component)Object).GetComponent<FVRFireArmAttachment>().AttachmentInterface != (Object)null)
				{
					RefreshObjectControls_AttachmentInterfaces(((Component)Object).GetComponent<FVRFireArmAttachment>().AttachmentInterface);
				}
			}
			else if (Object != null && Object is FVRFireArmAttachmentInterface)
			{
				FVRInteractiveObject object25 = Object;
				RefreshObjectControls_AttachmentInterfaces((FVRFireArmAttachmentInterface)(object)((object25 is FVRFireArmAttachmentInterface) ? object25 : null));
			}
		}

		public void RefreshObjectControls_AttachmentInterfaces(FVRFireArmAttachmentInterface attachInterface)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (attachInterface is Amplifier && (Object)(object)((Amplifier)((attachInterface is Amplifier) ? attachInterface : null)).ScopeCam != (Object)null)
			{
				m_columnStarts[1] = AddObjectControls(Columns[1], m_columnStarts[1], ((Amplifier)((attachInterface is Amplifier) ? attachInterface : null)).ScopeCam, new string[10] { "OnEnable", "Magnification", "Resolution", "AngleBlurStrength", "CutoffSoftness", "AngularOccludeSensitivity", "ReticuleScale", "MagnificationEnabledAtStart", "LensSpaceDistortion", "LensChromaticDistortion" }, null, 0uL, 1uL);
			}
		}
	}
	public class ModPanelV2Page_Index : ModPanelV2Page
	{
		[Header("Index Page")]
		public Text H3InfoText;

		public Text[] PageButtons;

		public override void PageOpen()
		{
			base.PageOpen();
			if ((Object)(object)Panel != (Object)null)
			{
				Text[] pageButtons = PageButtons;
				for (int i = 0; i < pageButtons.Length; i++)
				{
					((Component)pageButtons[i]).gameObject.SetActive(false);
				}
				for (int j = 0; j < Panel.Pages.Count; j++)
				{
					PageButtons[j].text = Panel.Pages[j].PageTitle;
					((Component)PageButtons[j]).gameObject.SetActive(true);
				}
			}
		}

		public override void PageTick()
		{
			base.PageTick();
			if ((Object)(object)H3InfoText != (Object)null)
			{
				H3InfoText.text = Helpers.H3InfoPrint((H3Info)int.MaxValue, true);
			}
		}

		public void GotoPanelPage(int page)
		{
			if ((Object)(object)Panel != (Object)null)
			{
				Panel.SwitchPage(page);
			}
		}
	}
	public class ModPanelV2Page_Scene : ModPanelV2Page
	{
		[Header("Scene Page")]
		public Vector2[] Columns = (Vector2[])(object)new Vector2[3]
		{
			new Vector2(20f, -16f),
			new Vector2(130f, -16f),
			new Vector2(240f, -16f)
		};

		private int[] m_columnStarts = new int[3];

		private int m_playerIFF = -3;

		private PowerupType m_powerupType = (PowerupType)2;

		private PowerUpIntensity m_powerupIntensity;

		private PowerUpDuration m_powerupDuration = (PowerUpDuration)4;

		private bool m_powerupInverted;

		private float m_powerupDurationOverride = -1f;

		private FVRSoundEnvironment m_soundEnv = (FVRSoundEnvironment)1;

		public override void PageInit()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			base.PageInit();
			if ((Object)(object)GM.CurrentSceneSettings != (Object)null)
			{
				m_soundEnv = GM.CurrentSceneSettings.DefaultSoundEnvironment;
			}
		}

		public override void PageOpen()
		{
			//IL_0036: 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)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			base.PageOpen();
			if (ObjectControls.Count <= 0)
			{
				if ((Object)(object)GM.CurrentSceneSettings != (Object)null)
				{
					m_columnStarts[0] = AddObjectControls(Columns[0], m_columnStarts[0], GM.CurrentSceneSettings, new string[14]
					{
						"IsSpawnLockingEnabled", "DoesDamageGetRegistered", "MaxProjectileRange", "ForcesCasingDespawn", "DoesTeleportUseCooldown", "DoesAllowAirControl", "UsesPlayerCatcher", "CatchHeight", "DefaultPlayerIFF", "IsQuickbeltSwappingAllowed",
						"IsSceneLowLight", "IsAmmoInfinite", "AllowsInfiniteAmmoMags", "UsesUnlockSystem"
					}, null, 0uL, 0uL);
				}
				if ((Object)(object)GM.CurrentPla

plugins/LSIIC.Core.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using Alloy;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using RUST.Steamworks;
using Sodalite;
using Sodalite.Api;
using Steamworks;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Valve.VR;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.6.0.0")]
[module: UnverifiableCode]
namespace LSIIC.Core;

[BepInPlugin("net.block57.lsiic.core", "LSIIC - Core", "1.6.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class CorePlugin : BaseUnityPlugin
{
	public static ConfigEntry<bool> _pilotPlayerSosigBodyHead;

	public static ConfigEntry<KeyboardShortcut> _shortcutDeleteFVRPhysicalObjects;

	public static ConfigEntry<KeyboardShortcut> _shortcutPrintLayerAndTagsInfo;

	public static ConfigEntry<KeyboardShortcut> _shortcutPrintAllStreamingAssetsBundles;

	public static ConfigEntry<KeyboardShortcut> _shortcutTelePlayerToOrigin;

	public static ConfigEntry<KeyboardShortcut> _shortcutTelePlayerToReset;

	public static ConfigEntry<KeyboardShortcut> _shortcutTelePlayer2mForward;

	public static ConfigEntry<KeyboardShortcut> _shortcutSpawnModPanelV2;

	public static ConfigEntry<KeyboardShortcut> _shortcutScrambleMaterials;

	public static ConfigEntry<KeyboardShortcut> _shortcutScrambleMeshes;

	public static ManualLogSource Logger { get; set; }

	public CorePlugin()
	{
		//IL_0062: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0289: 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_029c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
		Logger = ((BaseUnityPlugin)this).Logger;
		Logger.Log((LogLevel)32, (object)"Core pre");
		_pilotPlayerSosigBodyHead = ((BaseUnityPlugin)this).Config.Bind<bool>("Functionality", "Pilot PlayerSosigBody Head", true, "Pilot the PlayerSosigBody's head with your actual head rotation instead of the head's physics joint.");
		_shortcutDeleteFVRPhysicalObjects = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds - Debug", "Delete FVRPhysicalObjects", new KeyboardShortcut((KeyCode)112, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), "Deletes all FVRPhysicalObjects that aren't in quickbelts in the scene.");
		_shortcutPrintLayerAndTagsInfo = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds - Debug", "Print Layer and Tags Info", new KeyboardShortcut((KeyCode)108, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), "Prints all Layers and Tags.");
		_shortcutPrintAllStreamingAssetsBundles = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds - Debug", "Print All StreamingAssets Bundles", new KeyboardShortcut((KeyCode)97, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), "Prints all prefabs in StreamingAssets, and every ItemSpawnerID.");
		_shortcutTelePlayerToOrigin = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds - Player", "Teleport Player to Origin", new KeyboardShortcut((KeyCode)122, (KeyCode[])(object)new KeyCode[0]), "Teleports the player rig to the origin of the level.");
		_shortcutTelePlayerToReset = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds - Player", "Teleport Player to Reset", new KeyboardShortcut((KeyCode)114, (KeyCode[])(object)new KeyCode[0]), "Teleports the player rig to the reset point of the level.");
		_shortcutTelePlayer2mForward = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds - Player", "Teleport Player 2m Forward", new KeyboardShortcut((KeyCode)102, (KeyCode[])(object)new KeyCode[0]), "Teleports the player rig 2 meters in whatever direction the player is looking in.");
		_shortcutSpawnModPanelV2 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds - Misc", "Spawn ModPanelV2", new KeyboardShortcut((KeyCode)109, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), "Spawns ModPanelV2 in an empty quickbelt slot, or on the floor if none are free.");
		_shortcutScrambleMaterials = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds - Misc", "Scramble Materials", new KeyboardShortcut((KeyCode)116, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), "WARNING: SLOW AND DUMB\nScrambles all materials in the scene.");
		_shortcutScrambleMeshes = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds - Misc", "Scramble Meshes", new KeyboardShortcut((KeyCode)121, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), "WARNING: SLOW AND DUMB\nScrambles all meshes in the scene.");
		Harmony val = Harmony.CreateAndPatchAll(typeof(HarmonyPatches), (string)null);
		MethodInfo methodInfo = AccessTools.Method(typeof(FVRWristMenu), "Update", (Type[])null, (Type[])null);
		if ((object)methodInfo != null)
		{
			foreach (Patch postfix in Harmony.GetPatchInfo((MethodBase)methodInfo).Postfixes)
			{
				if (postfix.owner != val.Id)
				{
					val.Unpatch((MethodBase)methodInfo, (HarmonyPatchType)0, postfix.owner);
				}
			}
		}
		SceneManager.sceneLoaded += SceneManager_sceneLoaded;
		Scene activeScene = SceneManager.GetActiveScene();
		Helpers.CachedSceneIndex = ((Scene)(ref activeScene)).buildIndex;
		activeScene = SceneManager.GetActiveScene();
		Helpers.CachedSceneName = ((Scene)(ref activeScene)).name;
		Helpers.CachedLaunchTime = DateTime.Now.AddSeconds(0f - Time.realtimeSinceStartup);
		Logger.Log((LogLevel)32, (object)"Core post");
	}

	public void Start()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		WristMenuAPI.Buttons.Add(new WristMenuButton("Spawn ModPanelV2", 0, new ButtonClickEvent(SpawnModPanel)));
	}

	public void Update()
	{
		//IL_0005: 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_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_0276: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: 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_02e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_030c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fa: 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_046e: Unknown result type (might be due to invalid IL or missing references)
		//IL_034f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0359: Unknown result type (might be due to invalid IL or missing references)
		//IL_035e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0363: Unknown result type (might be due to invalid IL or missing references)
		//IL_0427: Unknown result type (might be due to invalid IL or missing references)
		//IL_0493: Unknown result type (might be due to invalid IL or missing references)
		if (Helpers.BepInExGetKeyDown(_shortcutDeleteFVRPhysicalObjects.Value))
		{
			FVRPhysicalObject[] array = Object.FindObjectsOfType<FVRPhysicalObject>();
			foreach (FVRPhysicalObject val in array)
			{
				if (!((Object)(object)val.QuickbeltSlot != (Object)null) && !val.m_isHardnessed && !((FVRInteractiveObject)val).IsHeld)
				{
					Object.Destroy((Object)(object)((Component)val).gameObject);
				}
			}
		}
		else if (Helpers.BepInExGetKeyDown(_shortcutPrintLayerAndTagsInfo.Value))
		{
			string text = "Layers:";
			for (int j = 0; j < 32; j++)
			{
				text += $"\n{j} - {LayerMask.LayerToName(j)}";
			}
			Debug.Log((object)text);
			string text2 = "Layer Collisions: (+ for ignoring)\n";
			text2 += "   |  0|  1|  2|  3|  4|  5|  6|  7|  8|  9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31|";
			for (int k = 0; k < 32; k++)
			{
				text2 += $"\n{k,3}|";
				for (int l = 0; l < 32; l++)
				{
					text2 += ((!Physics.GetIgnoreLayerCollision(2 ^ k, 2 ^ l)) ? " + |" : "   |");
				}
			}
			Debug.Log((object)text2);
		}
		else if (Helpers.BepInExGetKeyDown(_shortcutPrintAllStreamingAssetsBundles.Value))
		{
			string text3 = "";
			string[] files = Directory.GetFiles(Application.streamingAssetsPath);
			foreach (string text4 in files)
			{
				if (!text4.Contains("."))
				{
					AssetBundle result = AnvilManager.GetBundleAsync(Path.GetFileName(text4)).Result;
					if ((Object)(object)result != (Object)null)
					{
						string text5 = Path.GetFileName(text4).Split(new string[1] { "_" }, StringSplitOptions.None)[^1];
						text3 = text3 + text5 + ": " + string.Join("\n" + text5 + ": ", result.GetAllAssetNames()) + "\n\n\n";
					}
				}
			}
			foreach (KeyValuePair<string, ItemSpawnerID> item in (Dictionary<string, ItemSpawnerID>)AccessTools.Field(typeof(IM), "SpawnerIDDic").GetValue(ManagerSingleton<IM>.Instance))
			{
				text3 += $"{item.Key} - {item.Value}\n";
			}
			Debug.Log((object)text3);
		}
		else if (Helpers.BepInExGetKeyDown(_shortcutTelePlayerToReset.Value))
		{
			GM.CurrentMovementManager.TeleportToPoint(GM.CurrentSceneSettings.DeathResetPoint.position, true);
		}
		else if (Helpers.BepInExGetKeyDown(_shortcutTelePlayer2mForward.Value))
		{
			GM.CurrentMovementManager.TeleportToPoint(GM.CurrentPlayerRoot.position + GM.CurrentPlayerBody.Head.forward * 2f, true);
		}
		else if (Helpers.BepInExGetKeyDown(_shortcutTelePlayerToOrigin.Value))
		{
			GM.CurrentMovementManager.TeleportToPoint(Vector3.zero, true);
		}
		else if (Helpers.BepInExGetKeyDown(_shortcutSpawnModPanelV2.Value))
		{
			ItemSpawnerID spawnerID = IM.GetSpawnerID("MiscUtModPanelV2");
			if ((Object)(object)spawnerID != (Object)null)
			{
				GameObject val2 = Object.Instantiate<GameObject>(((AnvilAsset)spawnerID.MainObject).GetGameObject(), new Vector3(0f, 0.25f, 0f) + GM.CurrentPlayerRoot.position, Quaternion.identity);
				if (GM.CurrentPlayerBody.QuickbeltSlots.Count <= 0)
				{
					return;
				}
				{
					foreach (FVRQuickBeltSlot quickbeltSlot in GM.CurrentPlayerBody.QuickbeltSlots)
					{
						if ((Object)(object)quickbeltSlot.HeldObject == (Object)null && (Object)(object)quickbeltSlot.CurObject == (Object)null)
						{
							val2.GetComponent<FVRPhysicalObject>().SetQuickBeltSlot(quickbeltSlot);
							break;
						}
					}
					return;
				}
			}
			Logger.LogError((object)"ModPanelV2 was null?");
		}
		else if (Helpers.BepInExGetKeyDown(_shortcutScrambleMaterials.Value))
		{
			Object[] array2 = Object.FindObjectsOfType(typeof(Renderer));
			for (int i = 0; i < array2.Length; i++)
			{
				Renderer val3 = (Renderer)array2[i];
				Object obj = Resources.FindObjectsOfTypeAll(typeof(Material))[Random.Range(0, Resources.FindObjectsOfTypeAll(typeof(Material)).Length)];
				val3.material = (Material)(object)((obj is Material) ? obj : null);
			}
		}
		else if (Helpers.BepInExGetKeyDown(_shortcutScrambleMeshes.Value))
		{
			Object[] array2 = Object.FindObjectsOfType(typeof(MeshFilter));
			for (int i = 0; i < array2.Length; i++)
			{
				MeshFilter val4 = (MeshFilter)array2[i];
				Object obj2 = Resources.FindObjectsOfTypeAll(typeof(Mesh))[Random.Range(0, Resources.FindObjectsOfTypeAll(typeof(Mesh)).Length)];
				val4.mesh = (Mesh)(object)((obj2 is Mesh) ? obj2 : null);
			}
		}
	}

	private void SceneManager_sceneLoaded(Scene scene, LoadSceneMode loadMode)
	{
		Helpers.CachedSceneName = ((Scene)(ref scene)).name;
		Helpers.CachedSceneIndex = ((Scene)(ref scene)).buildIndex;
	}

	private void SpawnModPanel(object sender, ButtonClickEventArgs e)
	{
		//IL_002a: 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)
		ItemSpawnerID spawnerID = IM.GetSpawnerID("MiscUtModPanelV2");
		if ((Object)(object)spawnerID != (Object)null)
		{
			GameObject val = Object.Instantiate<GameObject>(((AnvilAsset)spawnerID.MainObject).GetGameObject(), ((HandInput)(ref e.Hand.Input)).Pos, ((HandInput)(ref e.Hand.Input)).Rot);
			FVRWristMenu instance = WristMenuAPI.Instance;
			if (instance != null)
			{
				instance.m_currentHand.RetrieveObject(val.GetComponent<FVRPhysicalObject>());
			}
		}
	}

	[HarmonyPatch(typeof(HighScoreManager), "UpdateScore", new Type[]
	{
		typeof(string),
		typeof(int),
		typeof(Action<int, int>)
	})]
	[HarmonyPatch(typeof(HighScoreManager), "UpdateScore", new Type[]
	{
		typeof(SteamLeaderboard_t),
		typeof(int)
	})]
	[HarmonyPrefix]
	public static bool HSM_UpdateScore()
	{
		return false;
	}
}
public class HarmonyPatches
{
	[HarmonyPatch(typeof(FVRFireArmMagazine), "Awake")]
	[HarmonyPatch(typeof(FVRFireArmClip), "Awake")]
	[HarmonyTranspiler]
	public static IEnumerable<CodeInstruction> IncreaseLoadedRoundsArrayLengthForMagazinesAndClips(IEnumerable<CodeInstruction> instrs)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Expected O, but got Unknown
		return new CodeMatcher(instrs, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
		{
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldfld && ((FieldInfo)i.operand).Name == "m_capacity"), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Newarr), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Stfld && ((FieldInfo)i.operand).Name == "LoadedRounds"), (string)null)
		}).Repeat((Action<CodeMatcher>)delegate(CodeMatcher m)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			m.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Ldc_I4, (object)1024)
			}).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Mul, (object)null)
			});
		}, (Action<string>)null).InstructionEnumeration();
	}

	[HarmonyPatch(typeof(SteamVR_Action_In_Source), "UpdateOriginTrackedDeviceInfo")]
	[HarmonyTranspiler]
	public static IEnumerable<CodeInstruction> RemoveAnnoyingLogSpam(IEnumerable<CodeInstruction> instrs)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		return new CodeMatcher(instrs, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
		{
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldloc_0), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Brfalse), (string)null)
		}).Repeat((Action<CodeMatcher>)delegate(CodeMatcher m)
		{
			m.SetOpcodeAndAdvance(OpCodes.Ldc_I4_0);
		}, (Action<string>)null).InstructionEnumeration();
	}

	[HarmonyPatch(typeof(MainMenuScreen), "Awake")]
	[HarmonyPrefix]
	public static bool AddUnusedPostsToMainMenu(MainMenuScreen __instance)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Expected O, but got Unknown
		foreach (Transform item in GameObject.Find("MainMenuSceneProto1").transform)
		{
			Transform val = item;
			if (((Object)((Component)val).gameObject).name.StartsWith("Post"))
			{
				((Component)val).gameObject.SetActive(true);
			}
		}
		return true;
	}

	[HarmonyPatch(typeof(FVRViveHand), "GetThrowLinearVelWorld")]
	[HarmonyPatch(typeof(FVRViveHand), "GetThrowAngularVelWorld")]
	[HarmonyPostfix]
	public static void AccountForPlayerScaleInBothVelWorld(FVRViveHand __instance, ref Vector3 __result)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		if (GM.CurrentPlayerRoot.localScale != Vector3.one)
		{
			__result = new Vector3(__result.x * GM.CurrentPlayerRoot.localScale.x, __result.y * GM.CurrentPlayerRoot.localScale.y, __result.z * GM.CurrentPlayerRoot.localScale.z);
		}
	}

	[HarmonyPatch(typeof(GM), "Awake")]
	[HarmonyPostfix]
	public static void ChangeNearClipOfSpectatorCamera(GM __instance)
	{
		if ((Object)(object)__instance.SpectatorCamPrefab != (Object)null && (Object)(object)__instance.SpectatorCamPrefab.GetComponent<Camera>() != (Object)null)
		{
			__instance.SpectatorCamPrefab.GetComponent<Camera>().nearClipPlane = 0.001f;
		}
		if ((Object)(object)__instance.SpectatorCamPreviewPrefab != (Object)null && (Object)(object)__instance.SpectatorCamPreviewPrefab.GetComponent<Camera>() != (Object)null)
		{
			__instance.SpectatorCamPreviewPrefab.GetComponent<Camera>().nearClipPlane = 0.001f;
		}
	}

	[HarmonyPatch(typeof(Handgun), "UpdateComponents")]
	[HarmonyTranspiler]
	public static IEnumerable<CodeInstruction> HandgunIgnoreHasSlideRelease(IEnumerable<CodeInstruction> instrs, ILGenerator il)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Expected O, but got Unknown
		return new CodeMatcher(instrs, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
		{
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldarg_0), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldfld && ((FieldInfo)i.operand).Name == "HasSlideRelease"), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Brfalse || i.opcode == OpCodes.Brfalse_S), (string)null)
		}).Repeat((Action<CodeMatcher>)delegate(CodeMatcher m)
		{
			m.Advance(1).SetAndAdvance(OpCodes.Call, (object)AccessTools.Method(typeof(HarmonyPatches), "HandgunIgnoreHasSlideRelease_Check", (Type[])null, (Type[])null));
		}, (Action<string>)null).InstructionEnumeration();
	}

	public static bool HandgunIgnoreHasSlideRelease_Check(Handgun handgun)
	{
		if (handgun.HasSlideRelease)
		{
			return (Object)(object)handgun.SlideRelease != (Object)null;
		}
		return false;
	}

	[HarmonyPatch(typeof(FVRPivotLocker), "FVRUpdate")]
	[HarmonyTranspiler]
	public static IEnumerable<CodeInstruction> PivotLockerCheckObjectParentNotLocker(IEnumerable<CodeInstruction> instrs)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Expected O, but got Unknown
		return new CodeMatcher(instrs, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
		{
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Callvirt && ((MethodInfo)i.operand).Name == "get_parent"), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldnull), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Call && ((MethodInfo)i.operand).Name == "op_Inequality"), (string)null)
		}).Repeat((Action<CodeMatcher>)delegate(CodeMatcher m)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			m.Advance(1).SetOpcodeAndAdvance(OpCodes.Ldarg_0).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(Component), "transform"))
			});
		}, (Action<string>)null).InstructionEnumeration();
	}

	[HarmonyPatch(typeof(FVRPivotLocker), "FVRUpdate")]
	[HarmonyTranspiler]
	public static IEnumerable<CodeInstruction> PivotLockerSetObjectParentToLocker(IEnumerable<CodeInstruction> instrs)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		return new CodeMatcher(instrs, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
		{
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldnull), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Callvirt && ((MethodInfo)i.operand).Name == "SetParent"), (string)null)
		}).Repeat((Action<CodeMatcher>)delegate(CodeMatcher m)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			m.SetOpcodeAndAdvance(OpCodes.Ldarg_0).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(Component), "transform"))
			});
		}, (Action<string>)null).InstructionEnumeration();
	}

	[HarmonyPatch(typeof(FVRPivotLocker), "IsInteractable")]
	[HarmonyPrefix]
	public static bool PivotLockerInteractableEvenWithObject(FVRPivotLocker __instance, ref bool __result)
	{
		__result = !((FVRPhysicalObject)__instance).IsPickUpLocked;
		return false;
	}

	[HarmonyPatch(typeof(FVRPivotLocker), "UnlockObject")]
	[HarmonyPrefix]
	public static bool PivotLockerClearObjectParentOnUnlock(FVRPivotLocker __instance, FVRPhysicalObject ___m_obj)
	{
		((Component)___m_obj).transform.SetParent((Transform)null);
		return true;
	}

	[HarmonyPatch(typeof(Banger), "Complete")]
	[HarmonyPostfix]
	public static void BangerSpawnLockableOnComplete(Banger __instance)
	{
		((FVRPhysicalObject)__instance).SpawnLockable = true;
	}

	[HarmonyPatch(typeof(ClosedBoltWeapon), "UpdateInputAndAnimate")]
	[HarmonyTranspiler]
	public static IEnumerable<CodeInstruction> ClosedBoltWeaponStickyFireSelector(IEnumerable<CodeInstruction> instrs)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Expected O, but got Unknown
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Expected O, but got Unknown
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Expected O, but got Unknown
		return new CodeMatcher(instrs, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[5]
		{
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.IsLdarg(i, (int?)null)), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldfld && ((FieldInfo)i.operand).Name == "UsesStickyDetonation"), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Brfalse || i.opcode == OpCodes.Brfalse_S), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.IsLdarg(i, (int?)null)), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldfld && ((FieldInfo)i.operand).Name == "Bolt"), (string)null)
		}).Repeat((Action<CodeMatcher>)delegate(CodeMatcher m)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			m.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Ldloc_1, (object)null)
			}).Advance(2).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Convert), "ToInt32", new Type[1] { typeof(bool) }, (Type[])null))
			})
				.SetOpcodeAndAdvance(OpCodes.Bne_Un);
		}, (Action<string>)null).InstructionEnumeration();
	}

	[HarmonyPatch(typeof(PlayerSosigBody), "SosigPhys")]
	[HarmonyPrefix]
	public static bool PilotPlayerSosigBodyHead(PlayerSosigBody __instance)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		if (CorePlugin._pilotPlayerSosigBodyHead.Value && (Object)(object)GM.CurrentPlayerBody != (Object)null)
		{
			__instance.Sosig_Head.rotation = GM.CurrentPlayerBody.Head.rotation;
		}
		return true;
	}

	[HarmonyPatch(typeof(FVRWristMenu), "Awake")]
	[HarmonyPostfix]
	public static void OverflowClockText(FVRWristMenu __instance)
	{
		__instance.SetSelectedButton(0);
		__instance.Clock.verticalOverflow = (VerticalWrapMode)1;
		__instance.Clock.horizontalOverflow = (HorizontalWrapMode)1;
	}

	[HarmonyPatch(typeof(FVRWristMenu), "Update")]
	[HarmonyPostfix]
	public static void UpdateEnhancedWristMenu(FVRWristMenu __instance, bool ___m_isActive, bool ___m_hasHands, FVRViveHand ___m_currentHand)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Invalid comparison between Unknown and I4
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		if (___m_isActive)
		{
			if ((int)__instance.Clock.alignment != 7)
			{
				((Graphic)__instance.Clock).rectTransform.anchoredPosition = new Vector2(0f, 7.8f);
				__instance.Clock.alignment = (TextAnchor)7;
			}
			Helpers.H3Info h3Info = Helpers.H3Info.FPS | Helpers.H3Info.DateTime | Helpers.H3Info.Transform | Helpers.H3Info.Health | Helpers.H3Info.Scene;
			if (___m_hasHands)
			{
				h3Info |= (___m_currentHand.IsThisTheRightHand ? Helpers.H3Info.ControllerR : Helpers.H3Info.ControllerL);
			}
			__instance.Clock.text = Helpers.H3InfoPrint(h3Info, controllerDirection: false) + "\nH3 Enhanced Wrist Menu";
		}
	}
}
public class Helpers
{
	[Flags]
	public enum H3Info
	{
		FPS = 1,
		DateTime = 2,
		Transform = 4,
		Health = 8,
		Scene = 0x10,
		SAUCE = 0x20,
		Headset = 0x40,
		ControllerL = 0x80,
		ControllerR = 0x100,
		All = int.MaxValue,
		None = 0
	}

	public static string CachedSceneName;

	public static int CachedSceneIndex;

	public static DateTime CachedLaunchTime;

	private static string m_cachedDateTime;

	private static string m_cachedHeld;

	private static float m_lastCachedDateTime;

	private static int m_lastFrameCachedHeld;

	private static int m_maxControllerStringSize;

	private static ETrackedPropertyError m_errorDummy;

	public static string H3InfoPrint(H3Info options, bool controllerDirection = true)
	{
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: 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_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_02df: Unknown result type (might be due to invalid IL or missing references)
		if (Time.time - m_lastCachedDateTime > 1f)
		{
			m_cachedDateTime = CachedLaunchTime.AddSeconds(Time.realtimeSinceStartup).ToString("s");
			m_lastCachedDateTime = Time.time;
		}
		string text = "";
		if (EnumExtension.HasFlag((Enum)options, (Enum)H3Info.FPS))
		{
			text += $"\n{Time.timeScale / Time.smoothDeltaTime:F0} FPS ({1f / Time.timeScale * Time.deltaTime * 1000f:F2}ms) ({Time.timeScale}x)";
		}
		if (EnumExtension.HasFlag((Enum)options, (Enum)H3Info.DateTime))
		{
			text = text + "\n" + m_cachedDateTime;
		}
		if (EnumExtension.HasFlag((Enum)options, (Enum)H3Info.Transform))
		{
			string text2 = text;
			Vector3 position = ((Component)GM.CurrentPlayerRoot).transform.position;
			text = text2 + string.Format("\nTransform: {0}@{1}°", ((Vector3)(ref position)).ToString("F2"), Mathf.RoundToInt(GM.CurrentPlayerRoot.eulerAngles.y));
		}
		if (EnumExtension.HasFlag((Enum)options, (Enum)H3Info.Health))
		{
			text += $"\nHealth: {GM.CurrentPlayerBody.GetPlayerHealthRaw()}/{GM.CurrentPlayerBody.GetMaxHealthPlayerRaw()} ({GM.CurrentPlayerBody.GetPlayerHealth() * 100f:F0}%)";
		}
		if (EnumExtension.HasFlag((Enum)options, (Enum)H3Info.Scene))
		{
			text += $"\nScene: {CachedSceneName} - level{CachedSceneIndex}";
		}
		if (EnumExtension.HasFlag((Enum)options, (Enum)H3Info.SAUCE))
		{
			text += $"\n{GM.Omni.OmniUnlocks.SaucePackets} S.A.U.C.E.";
		}
		if (EnumExtension.HasFlag((Enum)options, (Enum)H3Info.Headset))
		{
			text = text + "\nHeadset: " + SteamVR.instance.hmd_ModelNumber;
		}
		if (EnumExtension.HasFlag((Enum)options, (Enum)H3Info.ControllerL))
		{
			FVRViveHand component = ((Component)GM.CurrentPlayerBody.LeftHand).GetComponent<FVRViveHand>();
			text = text + "\n" + (controllerDirection ? " Left " : "") + "Controller: " + H3InfoPrint_Controllers(((SteamVR_Action_In_Source)((SteamVR_Action<SteamVR_Action_Pose_Source_Map<SteamVR_Action_Pose_Source>, SteamVR_Action_Pose_Source>)(object)component.Pose)[component.HandSource]).trackedDeviceIndex);
		}
		if (EnumExtension.HasFlag((Enum)options, (Enum)H3Info.ControllerR))
		{
			FVRViveHand component2 = ((Component)GM.CurrentPlayerBody.RightHand).GetComponent<FVRViveHand>();
			text = text + "\n" + (controllerDirection ? "Right " : "") + "Controller: " + H3InfoPrint_Controllers(((SteamVR_Action_In_Source)((SteamVR_Action<SteamVR_Action_Pose_Source_Map<SteamVR_Action_Pose_Source>, SteamVR_Action_Pose_Source>)(object)component2.Pose)[component2.HandSource]).trackedDeviceIndex);
		}
		if (text[0] == '\n')
		{
			text = text.Substring(1);
		}
		return text;
	}

	public static string H3InfoPrint_Controllers(uint index)
	{
		string text = GetStringTrackedDeviceProperty(index, (ETrackedDeviceProperty)1001);
		if (GetBoolTrackedDeviceProperty(index, (ETrackedDeviceProperty)1026))
		{
			bool boolTrackedDeviceProperty = GetBoolTrackedDeviceProperty(index, (ETrackedDeviceProperty)1011);
			text += string.Format(" ({0:F0}%{1})", GetFloatTrackedDeviceProperty(index, (ETrackedDeviceProperty)1012) * 100f, boolTrackedDeviceProperty ? " +" : "");
		}
		if (text.Length > m_maxControllerStringSize)
		{
			m_maxControllerStringSize = text.Length;
		}
		return text;
	}

	public static string GetHeldObjects()
	{
		if (Time.frameCount == m_lastFrameCachedHeld)
		{
			return m_cachedHeld;
		}
		string text = "";
		FVRViveHand[] hands = GM.CurrentMovementManager.Hands;
		foreach (FVRViveHand val in hands)
		{
			if ((Object)(object)val.CurrentInteractable != (Object)null)
			{
				text = text + "Holding: " + GetObjectHierarchyPath(((Component)val.CurrentInteractable).transform) + "\n" + GetObjectInfo(((Component)val.CurrentInteractable).gameObject) + "\n\n";
			}
		}
		m_lastFrameCachedHeld = Time.frameCount;
		m_cachedHeld = text;
		return text;
	}

	public static string GetObjectInfo(GameObject targetObject, Rigidbody attachedRigidbody = null)
	{
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		string text = "";
		Component[] components = targetObject.GetComponents<Component>();
		for (int i = 0; i < components.Length; i++)
		{
			Type type = ((object)components[i]).GetType();
			bool flag = true;
			while (type?.Namespace != "UnityEngine")
			{
				text += (flag ? ("\nType: " + type.ToString()) : (" : " + type.ToString()));
				type = type.BaseType;
				flag = false;
			}
		}
		text = text + "\nLayer(s): " + LayerMask.LayerToName(targetObject.layer);
		text = text + "\nTag: " + targetObject.tag;
		if ((Object)(object)targetObject.GetComponent<FVRFireArmRound>() != (Object)null)
		{
			text += GetObjectInfo_RoundInfo(targetObject.GetComponent<FVRFireArmRound>());
		}
		if ((Object)(object)targetObject.GetComponentInChildren<FVRFireArmMagazine>() != (Object)null)
		{
			text += $"\n[Mag Type]: {targetObject.GetComponentInChildren<FVRFireArmMagazine>().RoundType}\n[Mag Rounds]: {targetObject.GetComponentInChildren<FVRFireArmMagazine>().m_numRounds}/{targetObject.GetComponentInChildren<FVRFireArmMagazine>().m_capacity}";
		}
		if ((Object)(object)targetObject.GetComponentInChildren<FVRFireArmClip>() != (Object)null)
		{
			text += $"\n[Clip Type]: {targetObject.GetComponentInChildren<FVRFireArmClip>().RoundType}\n[Clip Rounds]: {targetObject.GetComponentInChildren<FVRFireArmClip>().m_numRounds}/{targetObject.GetComponentInChildren<FVRFireArmClip>().m_capacity}";
		}
		if ((Object)(object)targetObject.GetComponent<FVRFireArm>() != (Object)null)
		{
			text += $"\n[Round Type]: {targetObject.GetComponent<FVRFireArm>().RoundType}";
		}
		if ((Object)(object)attachedRigidbody != (Object)null && (Object)(object)((Component)attachedRigidbody).transform != (Object)(object)targetObject.transform)
		{
			text += $"\n\nAttached Rigidbody: {GetObjectHierarchyPath(((Component)attachedRigidbody).transform)}";
			components = ((Component)attachedRigidbody).GetComponents<Component>();
			for (int i = 0; i < components.Length; i++)
			{
				Type type2 = ((object)components[i]).GetType();
				bool flag2 = true;
				while (type2?.Namespace != "UnityEngine")
				{
					text += (flag2 ? ("\n  Type: " + type2.ToString()) : (" : " + type2.ToString()));
					type2 = type2.BaseType;
					flag2 = false;
				}
			}
			text += $"\n  Layer(s): {LayerMask.LayerToName(((Component)attachedRigidbody).gameObject.layer)}";
			text += $"\n  Tag: {((Component)attachedRigidbody).gameObject.tag}";
		}
		return text;
	}

	public static string GetObjectInfo_RoundInfo(FVRFireArmRound round)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		string text = "";
		text += $"\n[Round Type]: {round.RoundType}\n[Round Class]: {round.RoundClass}\n[Round Projectile Count:] {round.NumProjectiles}*{round.ProjectileSpread}s";
		text += $"\n[Round Manually Chamberable]: {round.isManuallyChamberable}\n[Round Loadable]: {round.isMagazineLoadable}";
		text += $"\n[Round Palmable]: {round.isPalmable}\n[Round Palm Amount]: {round.ProxyRounds.Count + 1}/{round.MaxPalmedAmount + 1}";
		if (round.IsSpent)
		{
			return text + "\n[Round Status]: Spent\n";
		}
		return text + "\n[Round Status]: Ready\n";
	}

	public static string GetObjectHierarchyPath(Transform obj)
	{
		string text = ((Object)obj).name;
		Transform parent = obj.parent;
		while ((Object)(object)parent != (Object)null)
		{
			text = ((Object)parent).name + "/" + text;
			parent = parent.parent;
		}
		return text;
	}

	public static bool BepInExGetKeyDown(KeyboardShortcut shortcut)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyDown(((KeyboardShortcut)(ref shortcut)).MainKey))
		{
			return ((KeyboardShortcut)(ref shortcut)).Modifiers.All((KeyCode c) => Input.GetKey(c));
		}
		return false;
	}

	public static bool BepInExGetKey(KeyboardShortcut shortcut)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKey(((KeyboardShortcut)(ref shortcut)).MainKey))
		{
			return ((KeyboardShortcut)(ref shortcut)).Modifiers.All((KeyCode c) => Input.GetKey(c));
		}
		return false;
	}

	public static bool BepInExGetKeyUp(KeyboardShortcut shortcut)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyUp(((KeyboardShortcut)(ref shortcut)).MainKey))
		{
			return ((KeyboardShortcut)(ref shortcut)).Modifiers.All((KeyCode c) => Input.GetKey(c));
		}
		return false;
	}

	public static bool GetBoolTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		return SteamVR.instance.hmd.GetBoolTrackedDeviceProperty(unDeviceIndex, prop, ref m_errorDummy);
	}

	public static float GetFloatTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		return SteamVR.instance.hmd.GetFloatTrackedDeviceProperty(unDeviceIndex, prop, ref m_errorDummy);
	}

	public static int GetInt32TrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		return SteamVR.instance.hmd.GetInt32TrackedDeviceProperty(unDeviceIndex, prop, ref m_errorDummy);
	}

	public static ulong GetUint64TrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		return SteamVR.instance.hmd.GetUint64TrackedDeviceProperty(unDeviceIndex, prop, ref m_errorDummy);
	}

	public static string GetStringTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return SteamVR.instance.GetStringProperty(prop, unDeviceIndex);
	}
}