Decompiled source of TrueCamera v0.9.0

BepInEx/plugins/TrueCamera.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using TrueCamera.Features;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace TrueCamera
{
	internal sealed class ConfigurationManagerAttributes
	{
		public bool? ReadOnly;

		public bool? ShowRangeAsPercent;

		public int? Order;

		public bool? IsAdvanced;

		public string Category;

		public string Subcategory;

		public Action<ConfigEntryBase> CustomDrawer;

		public bool? Browsable;

		public bool? HideSettingName;
	}
	[BepInPlugin("truecamera", "True Camera", "0.9.0")]
	public sealed class TrueCameraPlugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <ReEnableAfterRespawnCoroutine>d__9 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public TrueCameraPlugin <>4__this;

			private int <frames>5__2;

			private bool <canTakeInput>5__3;

			private MethodInfo <miTakeInput>5__4;

			private Camera <cam>5__5;

			private float <startYaw>5__6;

			private Vector3 <startPos>5__7;

			private bool <moved>5__8;

			private int <i>5__9;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<miTakeInput>5__4 = null;
				<cam>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f0: Expected O, but got Unknown
				//IL_01d8: 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_0235: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_025e: Unknown result type (might be due to invalid IL or missing references)
				//IL_024d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0263: Unknown result type (might be due to invalid IL or missing references)
				//IL_0414: Unknown result type (might be due to invalid IL or missing references)
				//IL_0419: Unknown result type (might be due to invalid IL or missing references)
				//IL_0423: Unknown result type (might be due to invalid IL or missing references)
				//IL_0428: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0403: Unknown result type (might be due to invalid IL or missing references)
				//IL_027e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0283: Unknown result type (might be due to invalid IL or missing references)
				//IL_042d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0436: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				TrueCameraPlugin trueCameraPlugin = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<frames>5__2 = 0;
					goto IL_0061;
				case 1:
					<>1__state = -1;
					goto IL_0061;
				case 2:
					<>1__state = -1;
					<i>5__9++;
					goto IL_0170;
				case 3:
					<>1__state = -1;
					<i>5__9++;
					goto IL_02c1;
				case 4:
					{
						<>1__state = -1;
						<i>5__9++;
						break;
					}
					IL_0061:
					if (<frames>5__2 < 600 && ((Object)(object)Player.m_localPlayer == (Object)null || ((Character)Player.m_localPlayer).IsDead()))
					{
						<frames>5__2++;
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					<canTakeInput>5__3 = false;
					<miTakeInput>5__4 = ReflectionCache.GetMethod(typeof(Player), "TakeInput", Type.EmptyTypes);
					<i>5__9 = 0;
					goto IL_0170;
					IL_0180:
					<cam>5__5 = Camera.main;
					<startYaw>5__6 = (Object.op_Implicit((Object)(object)<cam>5__5) ? ((Component)<cam>5__5).transform.eulerAngles.y : 0f);
					<startPos>5__7 = (Object.op_Implicit((Object)(object)Player.m_localPlayer) ? ((Component)Player.m_localPlayer).transform.position : Vector3.zero);
					<moved>5__8 = false;
					<i>5__9 = 0;
					goto IL_02c1;
					IL_02c1:
					if (<i>5__9 < 300)
					{
						<cam>5__5 = (Object.op_Implicit((Object)(object)<cam>5__5) ? <cam>5__5 : Camera.main);
						float num2 = (Object.op_Implicit((Object)(object)<cam>5__5) ? ((Component)<cam>5__5).transform.eulerAngles.y : <startYaw>5__6);
						Vector3 val = (Object.op_Implicit((Object)(object)Player.m_localPlayer) ? ((Component)Player.m_localPlayer).transform.position : <startPos>5__7);
						if (!(Mathf.Abs(Mathf.DeltaAngle(<startYaw>5__6, num2)) > 1f) && !(Vector3.Distance(<startPos>5__7, val) > 0.1f))
						{
							<>2__current = null;
							<>1__state = 3;
							return true;
						}
						<moved>5__8 = true;
					}
					try
					{
						Suspended = true;
						if (trueCameraPlugin._harmony == null)
						{
							trueCameraPlugin._harmony = new Harmony("truecamera");
						}
						trueCameraPlugin._harmony.UnpatchSelf();
						trueCameraPlugin._harmony.PatchAll(Assembly.GetExecutingAssembly());
						ManualLogSource log = Log;
						if (log != null)
						{
							log.LogInfo((object)"TrueCamera: patches applied, warming up...");
						}
					}
					catch (Exception ex)
					{
						ManualLogSource log2 = Log;
						if (log2 != null)
						{
							log2.LogDebug((object)("ReEnableAfterRespawnCoroutine repatch failed: " + ex.Message));
						}
					}
					<i>5__9 = 0;
					break;
					IL_0170:
					if (<i>5__9 < 600)
					{
						if ((!Object.op_Implicit((Object)(object)Chat.instance) || !Chat.instance.HasFocus()) && !Console.IsVisible() && !InventoryGui.IsVisible() && !StoreGui.IsVisible() && !Menu.IsVisible() && !Minimap.IsOpen() && !Hud.IsPieceSelectionVisible() && (Object)(object)Player.m_localPlayer != (Object)null && <miTakeInput>5__4 != null)
						{
							try
							{
								<canTakeInput>5__3 = (bool)<miTakeInput>5__4.Invoke(Player.m_localPlayer, null);
							}
							catch
							{
								<canTakeInput>5__3 = false;
							}
							if (<canTakeInput>5__3)
							{
								goto IL_0180;
							}
						}
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					goto IL_0180;
				}
				if (<i>5__9 < 10)
				{
					<>2__current = null;
					<>1__state = 4;
					return true;
				}
				try
				{
					Camera main = Camera.main;
					float num3 = default(float);
					if (Object.op_Implicit((Object)(object)main) && Object.op_Implicit((Object)(object)ZoneSystem.instance) && ZoneSystem.instance.GetGroundHeight(((Component)main).transform.position, ref num3))
					{
						Vector3 position = ((Component)main).transform.position;
						if (position.y < num3 - 0.5f)
						{
							Vector3 position2 = (Vector3)(Object.op_Implicit((Object)(object)Player.m_localPlayer) ? (((Component)Player.m_localPlayer).transform.position + Vector3.up * 1.6f) : new Vector3(position.x, num3 + 0.2f, position.z));
							((Component)main).transform.position = position2;
						}
					}
					CameraSettings_Patches.ApplyCameraConfig();
					Suspended = false;
					ManualLogSource log3 = Log;
					if (log3 != null)
					{
						log3.LogInfo((object)("TrueCamera: re-enabled after respawn (input ready=" + <canTakeInput>5__3 + ", moved=" + <moved>5__8 + ")"));
					}
				}
				catch (Exception ex2)
				{
					ManualLogSource log4 = Log;
					if (log4 != null)
					{
						log4.LogDebug((object)("Warmup/apply config failed: " + ex2.Message));
					}
				}
				return false;
			}

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

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

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

			private object <>2__current;

			public TrueCameraPlugin <>4__this;

			private int <i>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Expected O, but got Unknown
				int num = <>1__state;
				TrueCameraPlugin trueCameraPlugin = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<i>5__2 = 0;
					break;
				case 1:
					<>1__state = -1;
					<i>5__2++;
					break;
				}
				if (<i>5__2 < 10)
				{
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				try
				{
					if (trueCameraPlugin._harmony == null)
					{
						trueCameraPlugin._harmony = new Harmony("truecamera");
					}
					trueCameraPlugin._harmony.PatchAll(Assembly.GetExecutingAssembly());
					Suspended = false;
					CameraSettings_Patches.ApplyCameraConfig();
				}
				catch (Exception ex)
				{
					ManualLogSource log = Log;
					if (log != null)
					{
						log.LogDebug((object)("SuspendAndRestoreCoroutine repatch failed: " + ex.Message));
					}
				}
				return false;
			}

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

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

		public const string PluginGuid = "truecamera";

		public const string PluginName = "True Camera";

		public const string PluginVersion = "0.9.0";

		internal static ManualLogSource Log;

		internal static ConfigEntry<float> FoV_FP;

		internal static ConfigEntry<float> FoV_TP;

		internal static ConfigEntry<float> FoV_TP_Combat;

		internal static ConfigEntry<float> FoV_TP_Vehicle;

		internal static ConfigEntry<float> MaxDistance;

		internal static ConfigEntry<float> MaxDistanceBoat;

		internal static ConfigEntry<bool> AlwaysFaceCamera;

		internal static ConfigEntry<bool> HideHUD;

		internal static ConfigEntry<float> Camera_SideAngle;

		internal static ConfigEntry<KeyboardShortcut> HideHUD_Hotkey;

		internal static ConfigEntry<KeyboardShortcut> Hotkey_AngleLeft;

		internal static ConfigEntry<KeyboardShortcut> Hotkey_AngleRight;

		internal static ConfigEntry<KeyboardShortcut> ToggleBuildCameraHotkey;

		internal static ConfigEntry<KeyboardShortcut> Hotkey_FovIncrease;

		internal static ConfigEntry<KeyboardShortcut> Hotkey_FovDecrease;

		internal static ConfigEntry<bool> FP_Enabled;

		internal static ConfigEntry<bool> FP_Mode_NoBody;

		internal static ConfigEntry<bool> FP_Mode_NoHair;

		internal static ConfigEntry<bool> FP_Mode_NoHelmet;

		internal static ConfigEntry<float> FP_HeadOffsetX;

		internal static ConfigEntry<float> FP_HeadOffsetY;

		internal static ConfigEntry<float> FP_HeadOffsetZ;

		internal static ConfigEntry<float> FP_HeadOffsetMultiplier;

		internal static ConfigEntry<bool> FP_Rotate_LockNearShoulders;

		internal static ConfigEntry<bool> FP_Rotate_SnapRotate;

		internal static ConfigEntry<bool> FP_Rotate_ForceRotate;

		internal static ConfigEntry<float> FP_MaxShoulderAngle;

		internal static ConfigEntry<float> FP_ForceRotateSpeed;

		internal static ConfigEntry<KeyboardShortcut> FP_FreeLookKey;

		internal static ConfigEntry<float> FP_FreeLookHeightOffset;

		internal static ConfigEntry<bool> FP_StabilizerEnabled;

		internal static ConfigEntry<float> FP_StabilizerTime;

		internal static ConfigEntry<bool> FP_StabilizerZeroRoll;

		internal static ConfigEntry<bool> FP_AimYawDriven;

		internal static ConfigEntry<KeyboardShortcut> FP_ToggleHotkey;

		internal static ConfigEntry<bool> BuildCamera_MoveWorldSpace;

		internal static ConfigEntry<float> BuildCamera_MoveSpeedMultiplier;

		internal static ConfigEntry<float> BuildCamera_RangeMultiplier;

		internal static ConfigEntry<float> BuildCamera_SphericalRadius;

		internal static ConfigEntry<bool> BuildCamera_RequireStation;

		internal static ConfigEntry<bool> BuildCamera_SmoothFly;

		internal static ConfigEntry<float> BuildCamera_SmoothTime;

		internal static ConfigEntry<float> BuildCamera_SmoothSpeedMultiplier;

		internal static ConfigEntry<bool> TP_Enabled;

		internal static ConfigEntry<KeyboardShortcut> TP_ToggleHotkey;

		internal static ConfigEntry<float> TP_HeightOffset;

		internal static ConfigEntry<float> TP_SideOffset;

		internal static ConfigEntry<float> TP_Vehicle_HeightOffset;

		internal static ConfigEntry<float> TP_Vehicle_SideOffset;

		internal static ConfigEntry<bool> TP_HeadBobFromHead;

		internal static ConfigEntry<float> TP_HeadBobStrength;

		internal static ConfigEntry<bool> TP_HeadBobVerticalOnly;

		internal static ConfigEntry<float> TP_HeadBobSmoothing;

		internal static ConfigEntry<bool> TP_Combat_Enabled;

		internal static ConfigEntry<bool> TP_Combat_WhileWeaponDrawn;

		internal static ConfigEntry<float> TP_Combat_HeightOffset;

		internal static ConfigEntry<float> TP_Combat_SideOffset;

		internal static ConfigEntry<float> TP_Combat_SearchRadius;

		internal static ConfigEntry<float> TP_Combat_HoldTime;

		private Harmony _harmony;

		internal static bool Suspended;

		private Coroutine _suspendRoutine;

		internal static ConfigEntry<bool> DOF_Enabled;

		internal static ConfigEntry<bool> DOF_Autofocus;

		internal static ConfigEntry<float> DOF_FocusDistance;

		internal static ConfigEntry<float> DOF_BlurStrength;

		internal static ConfigEntry<float> DOF_MaxBlurSize;

		internal static ConfigEntry<bool> DOF_InvertNear;

		internal static ConfigEntry<KeyboardShortcut> DOF_FocusIncreaseHotkey;

		internal static ConfigEntry<KeyboardShortcut> DOF_FocusDecreaseHotkey;

		internal static ConfigEntry<KeyboardShortcut> DOF_ToggleAutofocusHotkey;

		internal static ConfigEntry<KeyboardShortcut> DOF_ToggleEnabledHotkey;

		internal static ConfigEntry<bool> Camera_ModeTransition_Enable;

		internal static ConfigEntry<float> Camera_ModeTransition_Time;

		internal static ConfigEntry<float> Camera_CombatTransition_Time;

		internal static TrueCameraPlugin Instance { get; private set; }

		private static int PlatformPrefs_GetInt(string key, int def)
		{
			try
			{
				Type type = AccessTools.TypeByName("PlatformPrefs");
				if (type != null)
				{
					MethodInfo methodInfo = AccessTools.Method(type, "GetInt", new Type[2]
					{
						typeof(string),
						typeof(int)
					}, (Type[])null);
					if (methodInfo != null)
					{
						object obj = methodInfo.Invoke(null, new object[2] { key, def });
						int result = 0;
						bool flag;
						if (obj is int)
						{
							result = (int)obj;
							flag = true;
						}
						else
						{
							flag = false;
						}
						if (flag)
						{
							return result;
						}
					}
				}
			}
			catch
			{
			}
			return def;
		}

		private void Awake()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Expected O, but got Unknown
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Expected O, but got Unknown
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Expected O, but got Unknown
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Expected O, but got Unknown
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Expected O, but got Unknown
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Expected O, but got Unknown
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Expected O, but got Unknown
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Expected O, but got Unknown
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Expected O, but got Unknown
			//IL_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0426: Expected O, but got Unknown
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Expected O, but got Unknown
			//IL_0498: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cb: Expected O, but got Unknown
			//IL_0512: Unknown result type (might be due to invalid IL or missing references)
			//IL_051c: Expected O, but got Unknown
			//IL_0556: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Expected O, but got Unknown
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Expected O, but got Unknown
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Expected O, but got Unknown
			//IL_0658: Unknown result type (might be due to invalid IL or missing references)
			//IL_0662: Expected O, but got Unknown
			//IL_069c: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a6: Expected O, but got Unknown
			//IL_06c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f5: Expected O, but got Unknown
			//IL_0711: Unknown result type (might be due to invalid IL or missing references)
			//IL_073a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0744: Expected O, but got Unknown
			//IL_0760: Unknown result type (might be due to invalid IL or missing references)
			//IL_0789: Unknown result type (might be due to invalid IL or missing references)
			//IL_0793: Expected O, but got Unknown
			//IL_07af: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e2: Expected O, but got Unknown
			//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0827: Unknown result type (might be due to invalid IL or missing references)
			//IL_0831: Expected O, but got Unknown
			//IL_084d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0876: Unknown result type (might be due to invalid IL or missing references)
			//IL_0880: Expected O, but got Unknown
			//IL_089c: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cf: Expected O, but got Unknown
			//IL_0909: Unknown result type (might be due to invalid IL or missing references)
			//IL_0913: Expected O, but got Unknown
			//IL_095f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0969: Expected O, but got Unknown
			//IL_09b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_09bf: Expected O, but got Unknown
			//IL_0a0b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a15: Expected O, but got Unknown
			//IL_0a4f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a59: Expected O, but got Unknown
			//IL_0a93: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9d: Expected O, but got Unknown
			//IL_0ae9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af3: Expected O, but got Unknown
			//IL_0b3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b49: Expected O, but got Unknown
			//IL_0b83: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b8d: Expected O, but got Unknown
			//IL_0bc7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd1: Expected O, but got Unknown
			//IL_0c0b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c15: Expected O, but got Unknown
			//IL_0c4f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c59: Expected O, but got Unknown
			//IL_0ca5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0caf: Expected O, but got Unknown
			//IL_0cfb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d05: Expected O, but got Unknown
			//IL_0d24: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d4d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d57: Expected O, but got Unknown
			//IL_0da3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dad: Expected O, but got Unknown
			//IL_0de7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0df1: Expected O, but got Unknown
			//IL_0e0c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e35: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e3f: Expected O, but got Unknown
			//IL_0e79: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e83: Expected O, but got Unknown
			//IL_0ebd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ec7: Expected O, but got Unknown
			//IL_0f01: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f0b: Expected O, but got Unknown
			//IL_0f57: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f61: Expected O, but got Unknown
			//IL_0fad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fb7: Expected O, but got Unknown
			//IL_1003: Unknown result type (might be due to invalid IL or missing references)
			//IL_100d: Expected O, but got Unknown
			//IL_1059: Unknown result type (might be due to invalid IL or missing references)
			//IL_1063: Expected O, but got Unknown
			//IL_109d: Unknown result type (might be due to invalid IL or missing references)
			//IL_10a7: Expected O, but got Unknown
			//IL_10f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_10fd: Expected O, but got Unknown
			//IL_1137: Unknown result type (might be due to invalid IL or missing references)
			//IL_1141: Expected O, but got Unknown
			//IL_117b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1185: Expected O, but got Unknown
			//IL_11a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_11cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_11d7: Expected O, but got Unknown
			//IL_1223: Unknown result type (might be due to invalid IL or missing references)
			//IL_122d: Expected O, but got Unknown
			//IL_1279: Unknown result type (might be due to invalid IL or missing references)
			//IL_1283: Expected O, but got Unknown
			//IL_12cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_12d9: Expected O, but got Unknown
			//IL_1325: Unknown result type (might be due to invalid IL or missing references)
			//IL_132f: Expected O, but got Unknown
			//IL_1369: Unknown result type (might be due to invalid IL or missing references)
			//IL_1373: Expected O, but got Unknown
			//IL_13bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_13c9: Expected O, but got Unknown
			//IL_1403: Unknown result type (might be due to invalid IL or missing references)
			//IL_140d: Expected O, but got Unknown
			//IL_1459: Unknown result type (might be due to invalid IL or missing references)
			//IL_1463: Expected O, but got Unknown
			//IL_149d: Unknown result type (might be due to invalid IL or missing references)
			//IL_14a7: Expected O, but got Unknown
			//IL_14e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_14eb: Expected O, but got Unknown
			//IL_1537: Unknown result type (might be due to invalid IL or missing references)
			//IL_1541: Expected O, but got Unknown
			//IL_158d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1597: Expected O, but got Unknown
			//IL_15e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_15ed: Expected O, but got Unknown
			//IL_1639: Unknown result type (might be due to invalid IL or missing references)
			//IL_1643: Expected O, but got Unknown
			//IL_16c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_16d3: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			AlwaysFaceCamera = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera", "AlwaysFaceCamera", false, new ConfigDescription("Player character always faces crosshair direction when a weapon is readied.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 1000
				}
			}));
			HideHUD = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera", "HideHUD", false, new ConfigDescription("Hide full HUD (crosshair, hotbar, minimap, etc)", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 999
				}
			}));
			Camera_SideAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "SideAngle", 0f, new ConfigDescription("Horizontal camera yaw offset (degrees)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-180f, 180f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 998
				}
			}));
			Hotkey_AngleLeft = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "AngleLeft", new KeyboardShortcut((KeyCode)59, Array.Empty<KeyCode>()), new ConfigDescription("Rotate camera left (S-curve speed)", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 980
				}
			}));
			Hotkey_AngleRight = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "AngleRight", new KeyboardShortcut((KeyCode)39, Array.Empty<KeyCode>()), new ConfigDescription("Rotate camera right (S-curve speed)", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 979
				}
			}));
			FoV_FP = ((BaseUnityPlugin)this).Config.Bind<float>("Camera.FOV", "FP", 65f, new ConfigDescription("First Person FOV.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 120f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 904
				}
			}));
			FoV_TP = ((BaseUnityPlugin)this).Config.Bind<float>("Camera.FOV", "TP", 65f, new ConfigDescription("Third Person (on foot) FOV.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 120f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 903
				}
			}));
			FoV_TP_Combat = ((BaseUnityPlugin)this).Config.Bind<float>("Camera.FOV", "TP_Combat", 65f, new ConfigDescription("Third Person Combat FOV.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 120f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 902
				}
			}));
			FoV_TP_Vehicle = ((BaseUnityPlugin)this).Config.Bind<float>("Camera.FOV", "TP_Vehicle", 65f, new ConfigDescription("Third Person Vehicle FOV.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 120f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 901
				}
			}));
			MaxDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "MaxDistance", 6f, new ConfigDescription("Max camera zoom distance on foot.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 120f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 895
				}
			}));
			MaxDistanceBoat = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "MaxDistanceBoat", 12f, new ConfigDescription("Max camera zoom distance on boat.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 120f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 890
				}
			}));
			Camera_ModeTransition_Enable = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera", "ModeTransitionEnable", true, new ConfigDescription("Enable S-curve position transition when switching FP/TP/TP Combat/TP Vehicle.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 870
				}
			}));
			Camera_ModeTransition_Time = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "ModeTransitionTime", 0.35f, new ConfigDescription("Duration (seconds) of S-curve transition between camera modes.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 1.5f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 869
				}
			}));
			Camera_CombatTransition_Time = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "CombatTransitionTime", 0.45f, new ConfigDescription("Duration (seconds) for S-curve when entering/leaving Combat.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 2f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 868
				}
			}));
			HideHUD_Hotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Camera", "HideHUD_Hotkey", new KeyboardShortcut((KeyCode)104, Array.Empty<KeyCode>()), new ConfigDescription("Toggle HideHUD on/off", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 997
				}
			}));
			DOF_Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DOF", "Enabled", PlatformPrefs_GetInt("DOF", 1) == 1, new ConfigDescription("Enable Depth of Field post-effect (game setting DOF)", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 1000
				}
			}));
			DOF_Autofocus = ((BaseUnityPlugin)this).Config.Bind<bool>("DOF", "Autofocus", true, new ConfigDescription("Auto-focus by raycast to target", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 995
				}
			}));
			DOF_FocusDistance = ((BaseUnityPlugin)this).Config.Bind<float>("DOF", "FocusDistance", 50f, new ConfigDescription("Manual focus distance when Autofocus is disabled (meters)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 990
				}
			}));
			DOF_BlurStrength = ((BaseUnityPlugin)this).Config.Bind<float>("DOF", "BlurStrength", 1f, new ConfigDescription("Blur strength multiplier (applies to aperture/blur size parameters)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 975
				}
			}));
			DOF_MaxBlurSize = ((BaseUnityPlugin)this).Config.Bind<float>("DOF", "MaxBlurSize", 2f, new ConfigDescription("Max blur size for DepthOfField effect", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 4f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 970
				}
			}));
			DOF_InvertNear = ((BaseUnityPlugin)this).Config.Bind<bool>("DOF", "InvertNear", false, new ConfigDescription("Invert focus: blur near and keep far in focus", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 969
				}
			}));
			DOF_FocusIncreaseHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("DOF.Hotkeys", "FocusIncrease", new KeyboardShortcut((KeyCode)93, Array.Empty<KeyCode>()), new ConfigDescription("Increase manual focus distance", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 960
				}
			}));
			DOF_FocusDecreaseHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("DOF.Hotkeys", "FocusDecrease", new KeyboardShortcut((KeyCode)91, Array.Empty<KeyCode>()), new ConfigDescription("Decrease manual focus distance", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 959
				}
			}));
			DOF_ToggleAutofocusHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("DOF.Hotkeys", "ToggleAutofocus", new KeyboardShortcut((KeyCode)92, Array.Empty<KeyCode>()), new ConfigDescription("Toggle DOF Autofocus on/off", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 958
				}
			}));
			DOF_ToggleEnabledHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("DOF.Hotkeys", "ToggleEnabled", new KeyboardShortcut((KeyCode)39, Array.Empty<KeyCode>()), new ConfigDescription("Toggle DOF effect on/off", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 957
				}
			}));
			Hotkey_FovDecrease = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "FovDecrease", new KeyboardShortcut((KeyCode)45, Array.Empty<KeyCode>()), new ConfigDescription("Decrease FOV", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 1000
				}
			}));
			Hotkey_FovIncrease = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "FovIncrease", new KeyboardShortcut((KeyCode)61, Array.Empty<KeyCode>()), new ConfigDescription("Increase FOV", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 995
				}
			}));
			ToggleBuildCameraHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("BuildCamera", "ToggleHotkey", new KeyboardShortcut((KeyCode)98, Array.Empty<KeyCode>()), new ConfigDescription("Toggle Build Camera mode", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 1000
				}
			}));
			BuildCamera_MoveWorldSpace = ((BaseUnityPlugin)this).Config.Bind<bool>("BuildCamera", "MoveWorldSpace", false, new ConfigDescription("Move independent from camera orientation (world space). If false, move relative to camera.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 995
				}
			}));
			BuildCamera_MoveSpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("BuildCamera", "MoveSpeedMultiplier", 3f, new ConfigDescription("Camera pan speed multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 10f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 900
				}
			}));
			BuildCamera_RangeMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("BuildCamera", "RangeMultiplier", 1f, new ConfigDescription("Max distance from build station.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 5f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 895
				}
			}));
			BuildCamera_SphericalRadius = ((BaseUnityPlugin)this).Config.Bind<float>("BuildCamera", "SphericalRadius", 30f, new ConfigDescription("Spherical radius around player within which camera can move in Build Mode (meters).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 120f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 890
				}
			}));
			BuildCamera_RequireStation = ((BaseUnityPlugin)this).Config.Bind<bool>("BuildCamera", "RequireStation", false, new ConfigDescription("If true, clamp camera to nearest crafting station range; if false, build camera works anywhere.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 985
				}
			}));
			BuildCamera_SmoothFly = ((BaseUnityPlugin)this).Config.Bind<bool>("BuildCamera", "SmoothFly", true, new ConfigDescription("Enable smooth flight (interpolated position/rotation)", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 980
				}
			}));
			BuildCamera_SmoothTime = ((BaseUnityPlugin)this).Config.Bind<float>("BuildCamera", "SmoothTime", 0.12f, new ConfigDescription("Smoothing time (seconds) for build camera flight", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 1f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 975
				}
			}));
			BuildCamera_SmoothSpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("BuildCamera", "SmoothSpeedMultiplier", 3f, new ConfigDescription("Speed multiplier used when SmoothFly is enabled (compensate smoothing slow-down)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 974
				}
			}));
			FP_Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("FirstPerson", "Enabled", true, new ConfigDescription("Enable first person camera.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 1000
				}
			}));
			FP_Rotate_LockNearShoulders = ((BaseUnityPlugin)this).Config.Bind<bool>("FirstPerson.Rotation", "LockNearShoulders", true, new ConfigDescription("Clamp body/camera yaw within shoulder angle", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 990
				}
			}));
			FP_Rotate_SnapRotate = ((BaseUnityPlugin)this).Config.Bind<bool>("FirstPerson.Rotation", "SnapRotate", false, new ConfigDescription("Snap body to camera yaw when exceeding shoulder angle", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 985
				}
			}));
			FP_Rotate_ForceRotate = ((BaseUnityPlugin)this).Config.Bind<bool>("FirstPerson.Rotation", "ForceRotate", false, new ConfigDescription("Continuously rotate body towards camera yaw", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 980
				}
			}));
			FP_MaxShoulderAngle = ((BaseUnityPlugin)this).Config.Bind<float>("FirstPerson.Rotation", "MaxShoulderAngle", 80f, new ConfigDescription("Max shoulder yaw angle in degrees", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 120f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 900
				}
			}));
			FP_ForceRotateSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("FirstPerson.Rotation", "ForceRotateSpeed", 180f, new ConfigDescription("Degrees/second for forced rotation", (AcceptableValueBase)(object)new AcceptableValueRange<float>(30f, 720f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 895
				}
			}));
			FP_FreeLookKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("FirstPerson.FreeLook", "Key", new KeyboardShortcut((KeyCode)308, Array.Empty<KeyCode>()), new ConfigDescription("Hold to free look without rotating body (ARMA-style)", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 970
				}
			}));
			FP_FreeLookHeightOffset = ((BaseUnityPlugin)this).Config.Bind<float>("FirstPerson.FreeLook", "HeightOffset", 0.1f, new ConfigDescription("Vertical offset above anchor while free looking (meters)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-0.5f, 0.5f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 880
				}
			}));
			FP_AimYawDriven = ((BaseUnityPlugin)this).Config.Bind<bool>("FirstPerson", "YawDriven", true, new ConfigDescription("Use 360° yaw/pitch driven by mouse for FP (cam rotation independent of head animations)", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 995
				}
			}));
			FP_ToggleHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("FirstPerson", "ToggleHotkey", new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>()), new ConfigDescription("Toggle First Person mode", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 990
				}
			}));
			FP_Mode_NoHair = ((BaseUnityPlugin)this).Config.Bind<bool>("FirstPerson", "NoHair", false, new ConfigDescription("Hide hair/beard (local only)", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 985
				}
			}));
			FP_Mode_NoHelmet = ((BaseUnityPlugin)this).Config.Bind<bool>("FirstPerson", "NoHelmet", false, new ConfigDescription("Hide helmet (local only)", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 980
				}
			}));
			FP_Mode_NoBody = ((BaseUnityPlugin)this).Config.Bind<bool>("FirstPerson", "NoBody", false, new ConfigDescription("Hide body and hand items (local only)", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 975
				}
			}));
			FP_HeadOffsetMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("FirstPerson", "HeadLocalOffsetMultiplier", 0.4f, new ConfigDescription("Sensitivity multiplier for head offsets (use smaller to move slower)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.001f, 2f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 900
				}
			}));
			FP_HeadOffsetX = ((BaseUnityPlugin)this).Config.Bind<float>("FirstPerson", "HeadLocalOffsetX", 0f, new ConfigDescription("Head local offset X (right + / left -)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-5f, 5f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 895
				}
			}));
			FP_HeadOffsetY = ((BaseUnityPlugin)this).Config.Bind<float>("FirstPerson", "HeadLocalOffsetY", 0.4f, new ConfigDescription("Head local offset Y (up + / down -)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-5f, 5f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 890
				}
			}));
			FP_HeadOffsetZ = ((BaseUnityPlugin)this).Config.Bind<float>("FirstPerson", "HeadLocalOffsetZ", 0.3f, new ConfigDescription("Head local offset Z (forward + / backward -)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-5f, 5f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 885
				}
			}));
			FP_StabilizerEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("FirstPerson.NonJawDriven", "StabilizerEnabled", false, new ConfigDescription("Non Jaw Driven Options: enable camera rotation smoothing when YawDriven is off", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 860
				}
			}));
			FP_StabilizerTime = ((BaseUnityPlugin)this).Config.Bind<float>("FirstPerson.NonJawDriven", "StabilizerLerpTime", 0.06f, new ConfigDescription("Time constant (seconds) for rotation smoothing (0 = off)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.5f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 855
				}
			}));
			FP_StabilizerZeroRoll = ((BaseUnityPlugin)this).Config.Bind<bool>("FirstPerson.NonJawDriven", "ZeroRoll", true, new ConfigDescription("Zero out camera roll from head when YawDriven is off", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 850
				}
			}));
			TP_Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("ThirdPerson", "Enabled", true, new ConfigDescription("Enable third person custom offsets.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 1000
				}
			}));
			TP_ToggleHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("ThirdPerson", "ToggleHotkey", new KeyboardShortcut((KeyCode)271, Array.Empty<KeyCode>()), new ConfigDescription("Toggle Third Person mode (custom offsets)", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 995
				}
			}));
			TP_HeightOffset = ((BaseUnityPlugin)this).Config.Bind<float>("ThirdPerson", "HeightOffset", 0f, new ConfigDescription("Vertical offset (meters).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-5f, 5f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 900
				}
			}));
			TP_SideOffset = ((BaseUnityPlugin)this).Config.Bind<float>("ThirdPerson", "SideOffset", 0f, new ConfigDescription("Horizontal offset (meters). Positive moves camera to the right.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-5f, 5f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 895
				}
			}));
			TP_Vehicle_HeightOffset = ((BaseUnityPlugin)this).Config.Bind<float>("ThirdPersonVehicle", "HeightOffset", 0.2f, new ConfigDescription("Vertical offset in vehicles (meters).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-5f, 5f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 890
				}
			}));
			TP_Vehicle_SideOffset = ((BaseUnityPlugin)this).Config.Bind<float>("ThirdPersonVehicle", "SideOffset", 0f, new ConfigDescription("Horizontal offset in vehicles (meters).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-5f, 5f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 885
				}
			}));
			TP_HeadBobFromHead = ((BaseUnityPlugin)this).Config.Bind<bool>("ThirdPerson", "HeadBobFromHead", false, new ConfigDescription("Add subtle head animation bobbing to third-person camera (position-only add-on)", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 880
				}
			}));
			TP_HeadBobStrength = ((BaseUnityPlugin)this).Config.Bind<float>("ThirdPerson", "HeadBobStrength", 1f, new ConfigDescription("Head bob strength (0..1.5)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1.5f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 875
				}
			}));
			TP_HeadBobVerticalOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("ThirdPerson", "HeadBobVerticalOnly", true, new ConfigDescription("Use only vertical component for head bob", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 874
				}
			}));
			TP_HeadBobSmoothing = ((BaseUnityPlugin)this).Config.Bind<float>("ThirdPerson", "HeadBobSmoothing", 0.08f, new ConfigDescription("Smoothing time (seconds) for bobbing delta", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.5f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 873
				}
			}));
			TP_Combat_Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("ThirdPerson.Combat", "Enabled", true, new ConfigDescription("Enable Combat stance offsets when enemies are alerted or weapon is drawn.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 1000
				}
			}));
			TP_Combat_WhileWeaponDrawn = ((BaseUnityPlugin)this).Config.Bind<bool>("ThirdPerson.Combat", "WhileWeaponDrawn", true, new ConfigDescription("Also activate Combat stance if a weapon is actively equipped.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 995
				}
			}));
			TP_Combat_HeightOffset = ((BaseUnityPlugin)this).Config.Bind<float>("ThirdPerson.Combat", "HeightOffset", 0f, new ConfigDescription("Combat stance vertical offset (meters)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-5f, 5f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 900
				}
			}));
			TP_Combat_SideOffset = ((BaseUnityPlugin)this).Config.Bind<float>("ThirdPerson.Combat", "SideOffset", 0f, new ConfigDescription("Combat stance horizontal offset (meters). Positive moves camera to the right.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-5f, 5f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 895
				}
			}));
			TP_Combat_SearchRadius = ((BaseUnityPlugin)this).Config.Bind<float>("ThirdPerson.Combat", "SearchRadius", 25f, new ConfigDescription("Radius to look for alerted enemies targeting the player (meters). 0 to disable scanning and rely only on alerts.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 880
				}
			}));
			TP_Combat_HoldTime = ((BaseUnityPlugin)this).Config.Bind<float>("ThirdPerson.Combat", "HoldTime", 4f, new ConfigDescription("Time in seconds to keep Combat stance after the last alert/sighting.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 15f), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 875
				}
			}));
			MaxDistance.SettingChanged += delegate
			{
				CameraSettings_Patches.ApplyCameraConfig();
			};
			MaxDistanceBoat.SettingChanged += delegate
			{
				CameraSettings_Patches.ApplyCameraConfig();
			};
			AlwaysFaceCamera.SettingChanged += delegate
			{
				CameraSettings_Patches.ApplyCameraConfig();
			};
			_harmony = new Harmony("truecamera");
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
		}

		private void OnDestroy()
		{
			try
			{
				if (_harmony != null)
				{
					_harmony.UnpatchSelf();
				}
			}
			catch
			{
			}
			((BaseUnityPlugin)this).Config.Save();
		}

		internal static void Restore()
		{
			if ((Object)(object)Instance == (Object)null || Suspended)
			{
				return;
			}
			Suspended = true;
			ManualLogSource log = Log;
			if (log != null)
			{
				log.LogInfo((object)"TrueCamera: Restore invoked — suspending and unpatching");
			}
			Instance.SafeCleanupVisuals();
			try
			{
				Harmony harmony = Instance._harmony;
				if (harmony != null)
				{
					harmony.UnpatchSelf();
				}
			}
			catch
			{
			}
			if (Instance._suspendRoutine != null)
			{
				((MonoBehaviour)Instance).StopCoroutine(Instance._suspendRoutine);
			}
			Instance._suspendRoutine = ((MonoBehaviour)Instance).StartCoroutine(Instance.SuspendAndRestoreCoroutine());
		}

		internal static void ScheduleReenableAfterRespawn()
		{
			try
			{
				if (!((Object)(object)Instance == (Object)null))
				{
					((MonoBehaviour)Instance).StartCoroutine(Instance.ReEnableAfterRespawnCoroutine());
					ManualLogSource log = Log;
					if (log != null)
					{
						log.LogInfo((object)"TrueCamera: OnRespawn detected, scheduling re-enable");
					}
				}
			}
			catch
			{
			}
		}

		[IteratorStateMachine(typeof(<ReEnableAfterRespawnCoroutine>d__9))]
		private IEnumerator ReEnableAfterRespawnCoroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ReEnableAfterRespawnCoroutine>d__9(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<SuspendAndRestoreCoroutine>d__10))]
		private IEnumerator SuspendAndRestoreCoroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SuspendAndRestoreCoroutine>d__10(0)
			{
				<>4__this = this
			};
		}

		private void SafeCleanupVisuals()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Camera main = Camera.main;
				if (Object.op_Implicit((Object)(object)main))
				{
					if (main.nearClipPlane < 0.01f)
					{
						main.nearClipPlane = 0.3f;
					}
					CameraLocalCuller component = ((Component)main).GetComponent<CameraLocalCuller>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.ForceRestore();
					}
					NativeCullingController component2 = ((Component)main).GetComponent<NativeCullingController>();
					if (Object.op_Implicit((Object)(object)component2))
					{
						component2.RestoreAll();
					}
					try
					{
						float num = default(float);
						if (Object.op_Implicit((Object)(object)ZoneSystem.instance) && ZoneSystem.instance.GetGroundHeight(((Component)main).transform.position, ref num))
						{
							Vector3 position = ((Component)main).transform.position;
							if (position.y < num - 0.1f)
							{
								Vector3 position2 = (Vector3)(Object.op_Implicit((Object)(object)Player.m_localPlayer) ? (((Component)Player.m_localPlayer).transform.position + Vector3.up * 1.8f) : new Vector3(position.x, num + 0.2f, position.z));
								((Component)main).transform.position = position2;
							}
						}
					}
					catch
					{
					}
				}
				if (Object.op_Implicit((Object)(object)Hud.instance))
				{
					Hud.instance.m_userHidden = false;
				}
				ModeManager.OnModeDisabled("Build");
				try
				{
					CameraViewModes.ResetState();
				}
				catch
				{
				}
			}
			catch
			{
			}
		}
	}
}
namespace TrueCamera.Features
{
	[HarmonyPatch]
	internal static class BuildCamera_EnableDisable
	{
		private static bool _enabled;

		private static float _yaw;

		private static float _pitch;

		private static Vector3 _posVel;

		private static Vector3 _targetPos;

		private static Quaternion _targetRot;

		private static bool _boneLockActive;

		private static Transform _boneLock;

		private static Vector3 _boneLockLocalOffset;

		private static Quaternion _boneLockLocalRotation = Quaternion.identity;

		private static bool _bonePreviewActive;

		private static Action<bool> _setVisible;

		private static Character _setVisibleOwner;

		public static bool Enabled => _enabled;

		internal static bool BoneDrivenActive => _boneLockActive;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "SetLocalPlayer")]
		private static void Initialize()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			_enabled = false;
			_boneLockActive = false;
			_boneLock = null;
			_boneLockLocalRotation = Quaternion.identity;
			_bonePreviewActive = false;
		}

		internal static void Toggle(Player player)
		{
			//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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)player))
			{
				return;
			}
			_enabled = !_enabled;
			if (_enabled)
			{
				ModeManager.DisableAllExcept("Build");
				CameraViewModes.ResetState();
				Transform val = (Object.op_Implicit((Object)(object)GameCamera.instance) ? ((Component)GameCamera.instance).transform : ((Object.op_Implicit((Object)(object)player) && Object.op_Implicit((Object)(object)((Character)player).m_eye)) ? ((Component)((Character)player).m_eye).transform : null));
				if (!Object.op_Implicit((Object)(object)val))
				{
					val = ((Component)player).transform;
				}
				Quaternion rotation = val.rotation;
				Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
				float num = eulerAngles.x;
				if (num > 180f)
				{
					num -= 360f;
				}
				_pitch = Mathf.Clamp(num, -89f, 89f);
				_yaw = eulerAngles.y;
				_posVel = Vector3.zero;
				_targetPos = val.position;
				_targetRot = val.rotation;
				((Character)player).Message((MessageType)2, "Build Camera enabled.", 0, (Sprite)null);
			}
			else
			{
				_boneLockActive = false;
				_boneLock = null;
				_boneLockLocalRotation = Quaternion.identity;
				_bonePreviewActive = false;
				ModeManager.OnModeDisabled("Build");
				((Character)player).Message((MessageType)2, "Build Camera disabled.", 0, (Sprite)null);
			}
		}

		internal static bool ExitBoneDrivenMode(Player player)
		{
			//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)
			if (!_enabled || !_boneLockActive)
			{
				return false;
			}
			_boneLockActive = false;
			_boneLock = null;
			_boneLockLocalRotation = Quaternion.identity;
			_bonePreviewActive = false;
			if (Object.op_Implicit((Object)(object)player))
			{
				((Character)player).Message((MessageType)2, "BoneDriven mode disabled (Build Camera).", 0, (Sprite)null);
			}
			return true;
		}

		internal static Quaternion UpdateView(float dt)
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			_yaw += PlayerController.m_mouseSens * Input.GetAxis("Mouse X") + InputCompat.GetJoyRightStickX(abs: true) * 110f * dt;
			float num = (PlayerController.m_invertMouse ? (-1f) : 1f);
			_pitch = Mathf.Clamp(_pitch - num * (PlayerController.m_mouseSens * Input.GetAxis("Mouse Y") - InputCompat.GetJoyRightStickY(abs: true) * 110f * dt), -89f, 89f);
			return Quaternion.Euler(0f, _yaw, 0f) * Quaternion.Euler(_pitch, 0f, 0f);
		}

		private static void UpdateBoneDrivenPlayerTurn(Player player, float dt)
		{
			//IL_003d: 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_0045: 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)
			if (Object.op_Implicit((Object)(object)player))
			{
				float num = PlayerController.m_mouseSens * Input.GetAxis("Mouse X") + InputCompat.GetJoyRightStickX(abs: true) * 110f * dt;
				if (!(Mathf.Abs(num) <= 0.0001f))
				{
					Quaternion rotation = ((Component)player).transform.rotation;
					float num2 = ((Quaternion)(ref rotation)).eulerAngles.y + num;
					((Component)player).transform.rotation = Quaternion.Euler(0f, num2, 0f);
				}
			}
		}

		internal static Vector3 UntransformedMove(float dt)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_002b: 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_0035: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//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_005a: 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_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_0072: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: 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)
			Vector3 val = Vector3.zero;
			Player localPlayer = Player.m_localPlayer;
			if (!Object.op_Implicit((Object)(object)localPlayer))
			{
				return val;
			}
			if (InputCompat.GetButton("Left"))
			{
				val -= Vector3.right;
			}
			if (InputCompat.GetButton("Right"))
			{
				val += Vector3.right;
			}
			if (InputCompat.GetButton("Forward"))
			{
				val += Vector3.forward;
			}
			if (InputCompat.GetButton("Backward"))
			{
				val -= Vector3.forward;
			}
			if (InputCompat.GetButton("Jump") || InputCompat.GetButtonDown("JoyJump"))
			{
				val += Vector3.up;
			}
			if (InputCompat.GetButton("Crouch") || InputCompat.GetButtonDown("JoyCrouch"))
			{
				val -= Vector3.up;
			}
			((Vector3)(ref val)).Normalize();
			val += Vector3.right * InputCompat.GetJoyLeftStickX(abs: false);
			val += -Vector3.forward * InputCompat.GetJoyLeftStickY(abs: true);
			float num = (InputCompat.GetButton("Run") ? ((Character)localPlayer).m_runSpeed : ((Character)localPlayer).m_walkSpeed);
			return val * (dt * num * TrueCameraPlugin.BuildCamera_MoveSpeedMultiplier.Value);
		}

		internal static void ClampToPlayerSphere(GameCamera cam)
		{
			//IL_0025: 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_0031: 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_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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			Player localPlayer = Player.m_localPlayer;
			if (Object.op_Implicit((Object)(object)localPlayer))
			{
				float value = TrueCameraPlugin.BuildCamera_SphericalRadius.Value;
				Vector3 position = ((Component)localPlayer).transform.position;
				Vector3 val = ((Component)cam).transform.position - position;
				if (((Vector3)(ref val)).magnitude > value)
				{
					((Component)cam).transform.position = position + ((Vector3)(ref val)).normalized * value;
				}
			}
		}

		internal static void ClampToBuildRange(GameCamera cam)
		{
			//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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)cam).transform.position;
			FieldInfo fieldInfo = AccessTools.Field(typeof(CraftingStation), "m_allStations");
			IEnumerable enumerable = null;
			try
			{
				enumerable = ((fieldInfo != null) ? fieldInfo.GetValue(null) : null) as IEnumerable;
			}
			catch (Exception ex)
			{
				ManualLogSource log = TrueCameraPlugin.Log;
				if (log != null)
				{
					log.LogDebug((object)("ClampToBuildRange reflection: " + ex.Message));
				}
			}
			float num = float.MaxValue;
			CraftingStation val = null;
			if (enumerable != null)
			{
				foreach (CraftingStation item in enumerable)
				{
					CraftingStation val2 = item;
					float num2 = Vector3.Distance(((Component)val2).transform.position, position);
					if (num2 < num)
					{
						val = val2;
						num = num2;
					}
				}
			}
			if (Object.op_Implicit((Object)(object)val))
			{
				float num3 = val.m_rangeBuild * TrueCameraPlugin.BuildCamera_RangeMultiplier.Value;
				if (num > num3)
				{
					float num4 = num - num3;
					Vector3 val3 = ((Component)val).transform.position - position;
					Vector3 normalized = ((Vector3)(ref val3)).normalized;
					((Component)cam).transform.position = position + normalized * num4;
				}
			}
			else
			{
				_enabled = false;
			}
		}

		internal static void StayAboveGround(GameCamera cam)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			float num = default(float);
			if (Object.op_Implicit((Object)(object)ZoneSystem.instance) && ZoneSystem.instance.GetGroundHeight(((Component)cam).transform.position, ref num) && ((Component)cam).transform.position.y < num - 2f)
			{
				Vector3 position = ((Component)cam).transform.position;
				position.y = num - 2f;
				((Component)cam).transform.position = position;
			}
		}

		internal static void UpdateBuildCamera(float dt, GameCamera cam)
		{
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: 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_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: 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)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: 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_011a: 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)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: 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_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: 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_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: 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_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			Player localPlayer = Player.m_localPlayer;
			Camera val = (Object.op_Implicit((Object)(object)cam) ? ((Component)cam).GetComponent<Camera>() : null);
			if (Object.op_Implicit((Object)(object)val) && val.nearClipPlane > 0.003f)
			{
				val.nearClipPlane = 0.003f;
			}
			bool flag = (Object.op_Implicit((Object)(object)Chat.instance) && Chat.instance.HasFocus()) || Console.IsVisible() || InventoryGui.IsVisible() || StoreGui.IsVisible() || Menu.IsVisible() || Minimap.IsOpen();
			if (!flag && Object.op_Implicit((Object)(object)localPlayer) && Input.GetKeyDown((KeyCode)112))
			{
				_bonePreviewActive = !_bonePreviewActive;
				if (_bonePreviewActive)
				{
					((Character)localPlayer).Message((MessageType)2, "Bones overlay ON. Click LMB on a bone to enter BoneDriven mode.", 0, (Sprite)null);
				}
				else
				{
					((Character)localPlayer).Message((MessageType)2, "Bones overlay OFF.", 0, (Sprite)null);
				}
			}
			if (_bonePreviewActive && !flag && Object.op_Implicit((Object)(object)localPlayer))
			{
				DrawBoneOverlay(cam, localPlayer);
				if (Input.GetMouseButtonDown(0))
				{
					Transform val2 = PickBoneInCrosshair(cam, localPlayer);
					if (Object.op_Implicit((Object)(object)val2))
					{
						_boneLock = val2;
						_boneLockLocalOffset = val2.InverseTransformPoint(((Component)cam).transform.position);
						_boneLockLocalRotation = Quaternion.Inverse(val2.rotation) * ((Component)cam).transform.rotation;
						_boneLockActive = true;
						_bonePreviewActive = false;
						_posVel = Vector3.zero;
						((Character)localPlayer).Message((MessageType)2, "BoneDriven mode: " + ((Object)val2).name, 0, (Sprite)null);
					}
					else
					{
						((Character)localPlayer).Message((MessageType)2, "No bone selected. Aim at a bone and click LMB.", 0, (Sprite)null);
					}
				}
			}
			EnsureLocalPlayerVisible(localPlayer);
			bool flag2 = (!Object.op_Implicit((Object)(object)Chat.instance) || !Chat.instance.HasFocus()) && !Console.IsVisible() && !InventoryGui.IsVisible() && !StoreGui.IsVisible() && !Menu.IsVisible() && !Minimap.IsOpen();
			bool flag3 = false;
			try
			{
				flag3 = Traverse.Create((object)localPlayer).Method("TakeInput", Array.Empty<object>()).GetValue<bool>();
			}
			catch
			{
				flag3 = false;
			}
			if (_boneLockActive && flag2 && flag3)
			{
				UpdateBoneDrivenPlayerTurn(localPlayer, dt);
			}
			bool num = flag2 && !Hud.IsPieceSelectionVisible() && flag3;
			Vector3 val3 = ((Component)cam).transform.position;
			Quaternion val4 = ((Component)cam).transform.rotation;
			if (flag2 && !_boneLockActive)
			{
				val4 = UpdateView(dt);
			}
			if (num && !_boneLockActive)
			{
				Vector3 val5 = UntransformedMove(dt);
				Vector3 val6 = (TrueCameraPlugin.BuildCamera_MoveWorldSpace.Value ? val5 : ((Component)cam).transform.TransformVector(val5));
				float num2 = (TrueCameraPlugin.BuildCamera_SmoothFly.Value ? Mathf.Max(0.1f, TrueCameraPlugin.BuildCamera_SmoothSpeedMultiplier.Value) : 1f);
				val3 += val6 * num2;
				Vector3 position = ((Component)cam).transform.position;
				Quaternion rotation = ((Component)cam).transform.rotation;
				((Component)cam).transform.position = val3;
				ClampToPlayerSphere(cam);
				if (TrueCameraPlugin.BuildCamera_RequireStation.Value)
				{
					ClampToBuildRange(cam);
				}
				StayAboveGround(cam);
				val3 = ((Component)cam).transform.position;
				((Component)cam).transform.position = position;
				((Component)cam).transform.rotation = rotation;
			}
			if (_boneLockActive)
			{
				if ((Object)(object)_boneLock == (Object)null)
				{
					_boneLockActive = false;
				}
				else
				{
					val3 = _boneLock.TransformPoint(_boneLockLocalOffset);
					val4 = _boneLock.rotation * _boneLockLocalRotation;
				}
			}
			if (TrueCameraPlugin.Camera_SideAngle != null)
			{
				val4 = Quaternion.AngleAxis(TrueCameraPlugin.Camera_SideAngle.Value, Vector3.up) * val4;
			}
			if (TrueCameraPlugin.BuildCamera_SmoothFly.Value && !_boneLockActive)
			{
				float num3 = Mathf.Clamp(TrueCameraPlugin.BuildCamera_SmoothTime.Value, 0.01f, 1f);
				((Component)cam).transform.position = Vector3.SmoothDamp(((Component)cam).transform.position, val3, ref _posVel, num3, float.PositiveInfinity, dt);
				((Component)cam).transform.rotation = Quaternion.Slerp(((Component)cam).transform.rotation, val4, Mathf.Clamp01(dt / num3));
			}
			else
			{
				((Component)cam).transform.position = val3;
				((Component)cam).transform.rotation = val4;
			}
		}

		private static Transform PickBoneInCrosshair(GameCamera cam, Player player)
		{
			//IL_0058: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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)
			try
			{
				if (!Object.op_Implicit((Object)(object)cam) || !Object.op_Implicit((Object)(object)player))
				{
					return null;
				}
				Transform val = FirstPerson_Modes.GetHead(player) ?? ((Character)player).m_eye;
				Transform val2 = (Object.op_Implicit((Object)(object)val) ? val.root : ((Component)player).transform);
				if (!Object.op_Implicit((Object)(object)val2))
				{
					return null;
				}
				Ray val3 = default(Ray);
				((Ray)(ref val3))..ctor(((Component)cam).transform.position, ((Component)cam).transform.forward);
				Transform result = null;
				float num = float.MaxValue;
				Transform[] boneCandidates = GetBoneCandidates(player, val2);
				foreach (Transform val4 in boneCandidates)
				{
					if (!Object.op_Implicit((Object)(object)val4))
					{
						continue;
					}
					Vector3 position = val4.position;
					float num2 = Vector3.Dot(position - ((Ray)(ref val3)).origin, ((Ray)(ref val3)).direction);
					if (!(num2 >= 0f) || !(num2 <= 12f))
					{
						continue;
					}
					Vector3 val5 = ((Ray)(ref val3)).origin + ((Ray)(ref val3)).direction * num2;
					float num3 = Vector3.Distance(position, val5);
					if (num3 <= 0.35f)
					{
						float num4 = num3 + num2 * 0.01f;
						if (num4 < num)
						{
							num = num4;
							result = val4;
						}
					}
				}
				return result;
			}
			catch
			{
			}
			return null;
		}

		private static Transform[] GetBoneCandidates(Player player, Transform root)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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)
			List<Transform> list = new List<Transform>(128);
			Vector3 position = ((Component)player).transform.position;
			Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true);
			foreach (Transform val in componentsInChildren)
			{
				if (Object.op_Implicit((Object)(object)val) && (Object)(object)val != (Object)(object)((Component)player).transform && Vector3.Distance(val.position, position) <= 4f)
				{
					list.Add(val);
				}
			}
			return list.ToArray();
		}

		private static void DrawBoneOverlay(GameCamera cam, Player player)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: 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_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: 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_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Transform val = FirstPerson_Modes.GetHead(player) ?? ((Character)player).m_eye;
				Transform val2 = (Object.op_Implicit((Object)(object)val) ? val.root : ((Component)player).transform);
				if (!Object.op_Implicit((Object)(object)val2))
				{
					return;
				}
				Transform[] boneCandidates = GetBoneCandidates(player, val2);
				Ray val3 = default(Ray);
				((Ray)(ref val3))..ctor(((Component)cam).transform.position, ((Component)cam).transform.forward);
				float num = float.MaxValue;
				Transform val4 = null;
				foreach (Transform val5 in boneCandidates)
				{
					if (!Object.op_Implicit((Object)(object)val5))
					{
						continue;
					}
					Vector3 position = val5.position;
					float num2 = Vector3.Dot(position - ((Ray)(ref val3)).origin, ((Ray)(ref val3)).direction);
					if (!(num2 >= 0f) || !(num2 <= 12f))
					{
						continue;
					}
					Vector3 val6 = ((Ray)(ref val3)).origin + ((Ray)(ref val3)).direction * num2;
					float num3 = Vector3.Distance(position, val6);
					if (num3 <= 0.35f)
					{
						float num4 = num3 + num2 * 0.01f;
						if (num4 < num)
						{
							num = num4;
							val4 = val5;
						}
					}
				}
				foreach (Transform val7 in boneCandidates)
				{
					if (Object.op_Implicit((Object)(object)val7))
					{
						Vector3 position2 = val7.position;
						Color val8 = (Color)(((Object)(object)val7 == (Object)(object)val4) ? Color.yellow : new Color(0f, 1f, 1f, 1f));
						float num5 = (((Object)(object)val7 == (Object)(object)val4) ? 0.07f : 0.045f);
						Debug.DrawLine(position2 - Vector3.right * num5, position2 + Vector3.right * num5, val8, 0f, false);
						Debug.DrawLine(position2 - Vector3.up * num5, position2 + Vector3.up * num5, val8, 0f, false);
						Debug.DrawLine(position2 - Vector3.forward * num5, position2 + Vector3.forward * num5, val8, 0f, false);
						Transform parent = val7.parent;
						if (Object.op_Implicit((Object)(object)parent) && (Object)(object)parent != (Object)(object)((Component)player).transform && Vector3.Distance(parent.position, ((Component)player).transform.position) <= 4f)
						{
							Debug.DrawLine(position2, parent.position, new Color(0.2f, 0.9f, 1f, 1f), 0f, false);
						}
					}
				}
			}
			catch
			{
			}
		}

		private static void EnsureLocalPlayerVisible(Player player)
		{
			if (!Object.op_Implicit((Object)(object)player))
			{
				return;
			}
			try
			{
				if ((Object)(object)_setVisibleOwner != (Object)(object)player || _setVisible == null)
				{
					MethodInfo methodInfo = AccessTools.Method(typeof(Character), "SetVisible", new Type[1] { typeof(bool) }, (Type[])null);
					if (methodInfo != null)
					{
						ParameterExpression parameterExpression = Expression.Parameter(typeof(bool), "visible");
						_setVisible = Expression.Lambda<Action<bool>>(Expression.Call(Expression.Constant(player, typeof(Character)), methodInfo, parameterExpression), new ParameterExpression[1] { parameterExpression }).Compile();
						_setVisibleOwner = (Character)(object)player;
					}
				}
				if (_setVisible != null)
				{
					_setVisible(obj: true);
				}
			}
			catch
			{
				_setVisible = null;
				_setVisibleOwner = null;
			}
		}
	}
	[HarmonyPatch]
	internal static class BuildCamera_Input
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "Update")]
		private static void PlayerUpdatePostfix(Player __instance)
		{
			if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer || !BuildCamera_EnableDisable.Enabled)
			{
				return;
			}
			bool flag = false;
			try
			{
				MethodInfo method = ReflectionCache.GetMethod(typeof(Player), "TakeInput");
				if (method != null)
				{
					flag = (bool)method.Invoke(__instance, null);
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = TrueCameraPlugin.Log;
				if (log != null)
				{
					log.LogDebug((object)("BuildCamera_Input.TakeInput: " + ex.Message));
				}
			}
			bool flag2 = Hud.IsPieceSelectionVisible();
			if (flag)
			{
				for (int i = 0; i < 8; i++)
				{
					if (Input.GetKeyDown((KeyCode)(49 + i)))
					{
						__instance.UseHotbarItem(i + 1);
					}
				}
				if (InputCompat.GetButtonDown("Hide") || InputCompat.GetButtonDown("JoyHide"))
				{
					ItemData val = null;
					ItemData val2 = null;
					try
					{
						MethodInfo method2 = ReflectionCache.GetMethod(typeof(Humanoid), "GetRightItem");
						object? obj = ((method2 != null) ? method2.Invoke(__instance, null) : null);
						val = (ItemData)((obj is ItemData) ? obj : null);
					}
					catch (Exception ex2)
					{
						ManualLogSource log2 = TrueCameraPlugin.Log;
						if (log2 != null)
						{
							log2.LogDebug((object)("GetRightItem: " + ex2.Message));
						}
					}
					try
					{
						MethodInfo method3 = ReflectionCache.GetMethod(typeof(Humanoid), "GetLeftItem");
						object? obj2 = ((method3 != null) ? method3.Invoke(__instance, null) : null);
						val2 = (ItemData)((obj2 is ItemData) ? obj2 : null);
					}
					catch (Exception ex3)
					{
						ManualLogSource log3 = TrueCameraPlugin.Log;
						if (log3 != null)
						{
							log3.LogDebug((object)("GetLeftItem: " + ex3.Message));
						}
					}
					if ((val != null || val2 != null) && !((Character)__instance).InAttack())
					{
						((Humanoid)__instance).HideHandItems(false, true);
					}
				}
			}
			if (!(((!Object.op_Implicit((Object)(object)Chat.instance) || !Chat.instance.HasFocus()) && !Console.IsVisible() && !InventoryGui.IsVisible() && !StoreGui.IsVisible() && !Menu.IsVisible() && !Minimap.IsOpen()) || flag2))
			{
				return;
			}
			try
			{
				MethodInfo method4 = ReflectionCache.GetMethod(typeof(Player), "UpdatePlacement", typeof(bool), typeof(float));
				if (method4 != null)
				{
					method4.Invoke(__instance, new object[2]
					{
						true,
						Time.deltaTime
					});
				}
			}
			catch (Exception ex4)
			{
				ManualLogSource log4 = TrueCameraPlugin.Log;
				if (log4 != null)
				{
					log4.LogDebug((object)("UpdatePlacement: " + ex4.Message));
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class BuildCamera_Patches
	{
		[HarmonyPrefix]
		[HarmonyPriority(int.MaxValue)]
		[HarmonyPatch(typeof(PlayerController), "TakeInput")]
		private static bool SuppressPlayerController(ref bool __result)
		{
			if (BuildCamera_EnableDisable.Enabled)
			{
				if (BuildCamera_EnableDisable.BoneDrivenActive)
				{
					return true;
				}
				__result = false;
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPriority(int.MaxValue)]
		[HarmonyPatch(typeof(GameCamera), "UpdateCamera")]
		private static bool UpdateCameraPrefix(float dt, GameCamera __instance)
		{
			if (!BuildCamera_EnableDisable.Enabled)
			{
				return true;
			}
			BuildCamera_EnableDisable.UpdateBuildCamera(dt, __instance);
			return false;
		}
	}
	internal sealed class CameraLocalCuller : MonoBehaviour
	{
		private struct StateEnable
		{
			public Renderer R;

			public bool Prev;
		}

		private struct StateShadow
		{
			public Renderer R;

			public ShadowCastingMode Prev;
		}

		private struct ColorEntry
		{
			public int Index;

			public Color Color;
		}

		private struct StateColor
		{
			public Renderer R;

			public List<ColorEntry> PrevColors;
		}

		private readonly List<Renderer> _head = new List<Renderer>();

		private readonly List<Renderer> _helmet = new List<Renderer>();

		private readonly List<Renderer> _hairBeard = new List<Renderer>();

		private readonly List<Renderer> _jawMouth = new List<Renderer>();

		private readonly List<Renderer> _bodyAndArmor = new List<Renderer>();

		private readonly List<Renderer> _hands = new List<Renderer>();

		private Transform _neckBone;

		private Vector3 _neckOrigScale;

		private bool _neckScaled;

		private Transform _headBone;

		private Vector3 _headOrigScale = Vector3.one;

		private bool _headScaled;

		private Transform _jawBone;

		private Vector3 _jawOrigScale;

		private bool _jawScaled;

		private readonly List<Transform> _eyeBones = new List<Transform>();

		private readonly List<Vector3> _eyeOrigScales = new List<Vector3>();

		private bool _eyesScaled;

		private readonly List<Transform> _headDescBones = new List<Transform>();

		private readonly List<Vector3> _headDescOrigScales = new List<Vector3>();

		private bool _headDescScaled;

		private bool _noHair;

		private bool _noBody;

		private bool _noHelmet;

		private bool _initialized;

		private float _headAlpha = 1f;

		private float _hairAlpha = 1f;

		private float _helmetAlpha = 1f;

		private static FieldInfo _fiBeardInst = AccessTools.Field(typeof(VisEquipment), "m_beardItemInstance");

		private static FieldInfo _fiHairInst = AccessTools.Field(typeof(VisEquipment), "m_hairItemInstance");

		private static FieldInfo _fiRightItemInst = AccessTools.Field(typeof(VisEquipment), "m_rightItemInstance");

		private static FieldInfo _fiLeftItemInst = AccessTools.Field(typeof(VisEquipment), "m_leftItemInstance");

		private static FieldInfo _fiHelmetItemInst = AccessTools.Field(typeof(VisEquipment), "m_helmetItemInstance");

		private readonly List<StateEnable> _disabled = new List<StateEnable>();

		private readonly List<StateShadow> _shadowed = new List<StateShadow>();

		private readonly List<string> _debugVisible = new List<string>();

		private readonly List<StateColor> _colored = new List<StateColor>();

		internal void ForceRestore()
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			EnableAll(_head);
			EnableAll(_helmet);
			EnableAll(_hairBeard);
			EnableAll(_jawMouth);
			EnableAll(_bodyAndArmor);
			EnableAll(_hands);
			_disabled.Clear();
			_shadowed.Clear();
			_colored.Clear();
			if (_headScaled && Object.op_Implicit((Object)(object)_headBone))
			{
				_headBone.localScale = _headOrigScale;
				_headScaled = false;
			}
			if (_headDescScaled && _headDescBones.Count > 0)
			{
				for (int i = 0; i < _headDescBones.Count; i++)
				{
					if (Object.op_Implicit((Object)(object)_headDescBones[i]))
					{
						_headDescBones[i].localScale = _headDescOrigScales[i];
					}
				}
				_headDescScaled = false;
			}
			if (_jawScaled && Object.op_Implicit((Object)(object)_jawBone))
			{
				_jawBone.localScale = _jawOrigScale;
				_jawScaled = false;
			}
			if (_eyesScaled && _eyeBones.Count > 0)
			{
				for (int j = 0; j < _eyeBones.Count; j++)
				{
					if (Object.op_Implicit((Object)(object)_eyeBones[j]))
					{
						_eyeBones[j].localScale = _eyeOrigScales[j];
					}
				}
				_eyesScaled = false;
			}
			if (_neckScaled && Object.op_Implicit((Object)(object)_neckBone))
			{
				_neckBone.localScale = _neckOrigScale;
				_neckScaled = false;
			}
		}

		internal static CameraLocalCuller Ensure(Camera cam)
		{
			CameraLocalCuller cameraLocalCuller = ((Component)cam).GetComponent<CameraLocalCuller>();
			if (!Object.op_Implicit((Object)(object)cameraLocalCuller))
			{
				cameraLocalCuller = ((Component)cam).gameObject.AddComponent<CameraLocalCuller>();
			}
			return cameraLocalCuller;
		}

		internal void InitializeFor(Player p)
		{
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			if (_initialized || !Object.op_Implicit((Object)(object)p))
			{
				return;
			}
			_head.Clear();
			_helmet.Clear();
			_hairBeard.Clear();
			_bodyAndArmor.Clear();
			_hands.Clear();
			Transform val = null;
			try
			{
				FieldInfo fieldInfo = AccessTools.Field(typeof(Character), "m_head");
				if (fieldInfo != null)
				{
					object? value = fieldInfo.GetValue(p);
					val = (Transform)((value is Transform) ? value : null);
				}
			}
			catch
			{
			}
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = FirstPerson_Modes.GetHead(p);
			}
			if (Object.op_Implicit((Object)(object)val))
			{
				_headBone = val;
				Transform parent = val.parent;
				while (Object.op_Implicit((Object)(object)parent) && !((Object)parent).name.ToLower().Contains("neck"))
				{
					parent = parent.parent;
				}
				_neckBone = parent;
				_head.AddRange(((Component)val).GetComponentsInChildren<Renderer>(true));
				Transform val2 = val.Find("Jaw");
				if (Object.op_Implicit((Object)(object)val2))
				{
					_jawMouth.AddRange(((Component)val2).GetComponentsInChildren<Renderer>(true));
					_jawBone = val2;
				}
			}
			VisEquipment componentInChildren = ((Component)p).GetComponentInChildren<VisEquipment>();
			GameObject val3 = null;
			GameObject val4 = null;
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				F