Decompiled source of Camera Freedom v3.0.0

Atlyss.CameraFreedom.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Atlyss.CameraFreedom")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Atlyss.CameraFreedom")]
[assembly: AssemblyTitle("Atlyss.CameraFreedom")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Atlyss.CameraFreedom
{
	public static class EasySettingsCompatibility
	{
		public static class Settings
		{
		}

		private static bool? _enabled;

		public static bool enabled
		{
			get
			{
				if (!_enabled.HasValue)
				{
					_enabled = Chainloader.PluginInfos.ContainsKey("EasySettings");
				}
				return _enabled.Value;
			}
		}
	}
	[BepInPlugin("ATLYSS.CameraFreedom", "Camera Freedom", "3.0.0")]
	public sealed class Mod : BaseUnityPlugin
	{
		private const string modGUID = "ATLYSS.CameraFreedom";

		private const string modName = "Camera Freedom";

		private const string modVersion = "3.0.0";

		private const string EasySettingsDependency = "EasySettings";

		public static string HeightScrollKey = "Height Modifier Hotkey";

		public static string HorizKey = "Horizontal Modifier Hotkey";

		public static string IncreaseModifierKey = "Increase Sensitivity Hotkey";

		public static string DecreaseModifierKey = "Decrease Sensitivity Hotkey";

		public static string RotationKey = "Rotation Hotkey";

		public static string ShowPlayerKey = "Show Player Hotkey";

		public static string MatchHeightKey = "Match the Player Height";

		public static string AllowNegativeKey = "Allows Negative Zoom Value";

		public static string IgnoreCollisionKey = "Camera Ignores Collision";

		public static string StiffKey = "Stiff Camera";

		public static string ShowHeadKey = "Show Head Hotkey";

		public static string EnableFreeCamKey = "Enable Free Camera Hotkey";

		public static string UpFreeCamKey = "Up Free Camera Input";

		public static string DownFreeCamKey = "Down Free Camera Input";

		public static string RightFreeCamKey = "Right Free Camera Input";

		public static string LeftFreeCamKey = "Left Free Camera Input";

		public static string DisablePlayerControlKey = "Disable Player in Free Cam";

		public static string UsePlayerInputKey = "Use Player Input for Free Cam";

		public static string RenderDistanceKey = "Render Distance";

		public Vector3 overridePositionAdjust = Vector3.zero;

		public Vector3 rotationAdjust = Vector3.zero;

		public float changeValue = 3.2f;

		public float matchHeightAdjust = 0f;

		public float prevDistanceHeightScale = 1f;

		public float zoomChangeValue = 35.5f;

		public float zoomChangeValueDPad = 65.5f;

		public float zoomLockedValue = 30f;

		public bool displayHead = true;

		private bool AdjustingRotation = false;

		private float prevHeightScale;

		private float scaleAdjustMultiplier = 0f;

		private static readonly Harmony harmony = new Harmony("ATLYSS.CameraFreedom");

		public static ManualLogSource Log = new ManualLogSource("Camera Freedom");

		public static Mod Instance;

		public static ConfigEntry<KeyCode> HeightScrollModifier { get; set; }

		public static ConfigEntry<KeyCode> HorizontalModifier { get; set; }

		public static ConfigEntry<KeyCode> IncreaseModifier { get; set; }

		public static ConfigEntry<KeyCode> DecreaseModifier { get; set; }

		public static ConfigEntry<KeyCode> RotationHotkey { get; set; }

		public static ConfigEntry<KeyCode> ShowPlayerHotkey { get; set; }

		public static ConfigEntry<bool> MatchPlayerHeight { get; set; }

		public static ConfigEntry<bool> AllowNegativeZoom { get; set; }

		public static ConfigEntry<bool> StiffCamera { get; set; }

		public static ConfigEntry<KeyCode> ShowHeadHotkey { get; set; }

		public static ConfigEntry<bool> IgnoreCollision { get; set; }

		public static ConfigEntry<KeyCode> EnableFreeCamHotkey { get; set; }

		public static ConfigEntry<KeyCode> UpFreeCamHotkey { get; set; }

		public static ConfigEntry<KeyCode> DownFreeCamHotkey { get; set; }

		public static ConfigEntry<KeyCode> RightFreeCamHotkey { get; set; }

		public static ConfigEntry<KeyCode> LeftFreeCamHotkey { get; set; }

		public static ConfigEntry<bool> DisablePlayerControl { get; set; }

		public static ConfigEntry<bool> UsePlayerInput { get; set; }

		public static ConfigEntry<float> RenderDistance { get; set; }

		public Vector3 prevPositionAdjust { get; set; }

		public Quaternion prevRotation { get; set; }

		public float cachedDistance { get; set; }

		public float cachedDialogueDistance { get; set; }

		public float currentHeight { get; set; }

		public float currentHoriz { get; set; }

		public float heightScale { get; set; }

		public bool ControllingCamera { get; set; }

		public bool AlwaysShowPlayer { get; set; }

		public bool FreeCamera { get; set; }

		public bool LockCamera { get; set; }

		public void Awake()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Expected O, but got Unknown
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Expected O, but got Unknown
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Expected O, but got Unknown
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Expected O, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Expected O, but got Unknown
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Expected O, but got Unknown
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Expected O, but got Unknown
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Expected O, but got Unknown
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Expected O, but got Unknown
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Expected O, but got Unknown
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Expected O, but got Unknown
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Expected O, but got Unknown
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Expected O, but got Unknown
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Log = Logger.CreateLogSource("ATLYSS.CameraFreedom");
			Log.LogInfo((object)"Starting Camera Freedom");
			MatchPlayerHeight = ((BaseUnityPlugin)this).Config.Bind<bool>("General", MatchHeightKey, false, new ConfigDescription("Whether or not the camera tries to match the height of the player.", (AcceptableValueBase)null, Array.Empty<object>()));
			AllowNegativeZoom = ((BaseUnityPlugin)this).Config.Bind<bool>("General", AllowNegativeKey, false, new ConfigDescription("Allows the camera to have negative zoom values. This lets you scroll past the \"First Person\" view", (AcceptableValueBase)null, Array.Empty<object>()));
			StiffCamera = ((BaseUnityPlugin)this).Config.Bind<bool>("General", StiffKey, false, new ConfigDescription("Toggles Stiff Camera Mode. The stiff camera follows the player without smooth movement", (AcceptableValueBase)null, Array.Empty<object>()));
			IgnoreCollision = ((BaseUnityPlugin)this).Config.Bind<bool>("General", IgnoreCollisionKey, false, new ConfigDescription("Toggles whether the camera collides with the environment", (AcceptableValueBase)null, Array.Empty<object>()));
			RenderDistance = ((BaseUnityPlugin)this).Config.Bind<float>("General", RenderDistanceKey, 1000f, new ConfigDescription("Directly control the render distance", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 8000f), Array.Empty<object>()));
			HeightScrollModifier = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", HeightScrollKey, (KeyCode)308, new ConfigDescription("The key to hold in order to change height while scrolling", (AcceptableValueBase)null, Array.Empty<object>()));
			HorizontalModifier = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", HorizKey, (KeyCode)307, new ConfigDescription("The key to hold in order to change horizontal offset while scrolling", (AcceptableValueBase)null, Array.Empty<object>()));
			IncreaseModifier = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", IncreaseModifierKey, (KeyCode)305, new ConfigDescription("The key to increase strength of modifiers", (AcceptableValueBase)null, Array.Empty<object>()));
			DecreaseModifier = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", DecreaseModifierKey, (KeyCode)306, new ConfigDescription("The key to decrease strength of modifiers", (AcceptableValueBase)null, Array.Empty<object>()));
			RotationHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", RotationKey, (KeyCode)110, new ConfigDescription("Press this key to switch position adjust into rotation adjust", (AcceptableValueBase)null, Array.Empty<object>()));
			ShowPlayerHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", ShowPlayerKey, (KeyCode)44, new ConfigDescription("This key toggles whether the player model is always visible or not", (AcceptableValueBase)null, Array.Empty<object>()));
			ShowHeadHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", ShowHeadKey, (KeyCode)46, new ConfigDescription("This key toggles whether the player's head is visible. Note: If you update your character's appearance in a server while your head is hidden everyone will see your headless playermodel!", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableFreeCamHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Free Camera", EnableFreeCamKey, (KeyCode)99, new ConfigDescription("Press this key to toggle free camera", (AcceptableValueBase)null, Array.Empty<object>()));
			UpFreeCamHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Free Camera", UpFreeCamKey, (KeyCode)273, new ConfigDescription("This key will move the free camera up", (AcceptableValueBase)null, Array.Empty<object>()));
			DownFreeCamHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Free Camera", DownFreeCamKey, (KeyCode)274, new ConfigDescription("This key will move the free camera down", (AcceptableValueBase)null, Array.Empty<object>()));
			RightFreeCamHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Free Camera", RightFreeCamKey, (KeyCode)275, new ConfigDescription("This key will move the free camera right", (AcceptableValueBase)null, Array.Empty<object>()));
			LeftFreeCamHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Free Camera", LeftFreeCamKey, (KeyCode)276, new ConfigDescription("This key will move the free camera left", (AcceptableValueBase)null, Array.Empty<object>()));
			DisablePlayerControl = ((BaseUnityPlugin)this).Config.Bind<bool>("Free Camera", DisablePlayerControlKey, true, new ConfigDescription("Toggle whether you can control the player while the free camera is active", (AcceptableValueBase)null, Array.Empty<object>()));
			UsePlayerInput = ((BaseUnityPlugin)this).Config.Bind<bool>("Free Camera", UsePlayerInputKey, false, new ConfigDescription("If enabled, the free camera will use your player's vanilla movement inputs instead of the inputs set by CameraFreedom", (AcceptableValueBase)null, Array.Empty<object>()));
			heightScale = 1f;
			Log.LogInfo((object)"Camera Freedom: Patching...");
			harmony.PatchAll();
			Log.LogInfo((object)"Camera Freedom: Active!");
		}

		private void SettingChanged(object sender, EventArgs e)
		{
			SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null);
			if (val != null && sender == RenderDistance && !((Object)(object)CameraFunction._current == (Object)null))
			{
				CameraFunction._current._mainCamera.farClipPlane = RenderDistance.Value;
				CameraFunction._current._UICamera.farClipPlane = RenderDistance.Value;
			}
		}

		public void Update()
		{
			//IL_0006: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Invalid comparison between Unknown and I4
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: 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_0608: Unknown result type (might be due to invalid IL or missing references)
			//IL_0540: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: 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_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0624: Unknown result type (might be due to invalid IL or missing references)
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: 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_0658: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(IncreaseModifier.Value))
			{
				changeValue *= 2f;
				zoomChangeValue *= 2f;
				zoomChangeValueDPad *= 2f;
			}
			if (Input.GetKeyDown(DecreaseModifier.Value))
			{
				changeValue /= 2f;
				zoomChangeValue /= 2f;
				zoomChangeValueDPad /= 2f;
			}
			if (Input.GetKeyDown(RotationHotkey.Value) && !Player._mainPlayer._inChat)
			{
				AdjustingRotation = !AdjustingRotation;
			}
			if (Input.GetKeyDown(ShowPlayerHotkey.Value) && !Player._mainPlayer._inChat)
			{
				AlwaysShowPlayer = !AlwaysShowPlayer;
			}
			if ((Object)(object)Player._mainPlayer == (Object)null || (int)Player._mainPlayer._currentGameCondition != 1)
			{
				return;
			}
			if (Input.GetKeyDown(ShowHeadHotkey.Value) && !Player._mainPlayer._inChat)
			{
				displayHead = !displayHead;
			}
			if (Input.GetKeyDown(EnableFreeCamHotkey.Value) && !Player._mainPlayer._inChat)
			{
				FreeCamera = !FreeCamera;
				if (FreeCamera && DisablePlayerControl.Value)
				{
					Player._mainPlayer._pMove._movementLockType = (MovementLockType)2;
				}
				if (!FreeCamera)
				{
					Player._mainPlayer._pMove._movementLockType = (MovementLockType)0;
					CameraFunction._current.CameraReset_Lerp();
				}
			}
			if ((Object)(object)CameraFunction._current == (Object)null)
			{
				return;
			}
			heightScale = Player._mainPlayer._pVisual._playerAppearanceStruct._heightWeight;
			ControllingCamera = false;
			if (DialogManager._current._isDialogEnabled)
			{
				if (Input.GetKey(HeightScrollModifier.Value))
				{
					ControllingCamera = true;
					if (Input.mouseScrollDelta.y > 0f)
					{
						if (AdjustingRotation)
						{
							rotationAdjust.y += changeValue;
						}
						else
						{
							overridePositionAdjust.y += changeValue;
						}
					}
					else if (Input.mouseScrollDelta.y < 0f)
					{
						if (AdjustingRotation)
						{
							rotationAdjust.y -= changeValue;
						}
						else
						{
							overridePositionAdjust.y -= changeValue;
						}
					}
				}
				if (Input.GetKey(HorizontalModifier.Value))
				{
					ControllingCamera = true;
					if (Input.mouseScrollDelta.y > 0f)
					{
						if (AdjustingRotation)
						{
							rotationAdjust.x += changeValue;
						}
						else
						{
							overridePositionAdjust.x += changeValue;
						}
					}
					else if (Input.mouseScrollDelta.y < 0f)
					{
						if (AdjustingRotation)
						{
							rotationAdjust.x -= changeValue;
						}
						else
						{
							overridePositionAdjust.x -= changeValue;
						}
					}
				}
				if (!ControllingCamera)
				{
					float axis = Input.GetAxis("Mouse ScrollWheel");
					if (AdjustingRotation)
					{
						if ((double)axis != 0.0)
						{
							rotationAdjust.z += axis * changeValue;
						}
						if (InputControlManager.current.DpadUp((DpadHoldType)1))
						{
							rotationAdjust.z -= changeValue * Time.deltaTime;
						}
						if (InputControlManager.current.DpadDown((DpadHoldType)1))
						{
							rotationAdjust.z += changeValue * Time.deltaTime;
						}
					}
					else
					{
						if ((double)axis != 0.0)
						{
							zoomLockedValue += axis * zoomChangeValue;
						}
						if (InputControlManager.current.DpadUp((DpadHoldType)1))
						{
							zoomLockedValue -= zoomChangeValueDPad * Time.deltaTime;
						}
						if (InputControlManager.current.DpadDown((DpadHoldType)1))
						{
							zoomLockedValue += zoomChangeValueDPad * Time.deltaTime;
						}
					}
				}
			}
			else
			{
				if (Input.GetKey(HeightScrollModifier.Value))
				{
					ControllingCamera = true;
					if (Input.mouseScrollDelta.y > 0f)
					{
						CameraFunction._current.positionAdjust.y += changeValue;
						if (MatchPlayerHeight.Value)
						{
							matchHeightAdjust += changeValue;
						}
					}
					else if (Input.mouseScrollDelta.y < 0f)
					{
						CameraFunction._current.positionAdjust.y -= changeValue;
						if (MatchPlayerHeight.Value)
						{
							matchHeightAdjust -= changeValue;
						}
					}
					currentHeight = CameraFunction._current.positionAdjust.y;
				}
				if (Input.GetKey(HorizontalModifier.Value))
				{
					ControllingCamera = true;
					if (Input.mouseScrollDelta.y > 0f)
					{
						CameraFunction._current.positionAdjust.x += changeValue;
					}
					else if (Input.mouseScrollDelta.y < 0f)
					{
						CameraFunction._current.positionAdjust.x -= changeValue;
					}
					currentHoriz = CameraFunction._current.positionAdjust.x;
				}
			}
			if (!MatchPlayerHeight.Value)
			{
				return;
			}
			float num = heightScale - prevHeightScale;
			if (Mathf.Abs(num) > 0.001f)
			{
				if (num > 0f)
				{
					scaleAdjustMultiplier += 0.0005f;
				}
				else if (num < 0f)
				{
					scaleAdjustMultiplier -= 0.0005f;
				}
			}
			prevHeightScale = heightScale;
			float num2 = heightScale * scaleAdjustMultiplier;
			if (scaleAdjustMultiplier < 0f)
			{
				num2 = 0f;
			}
			if (scaleAdjustMultiplier > 1f)
			{
				num2 = heightScale;
			}
			if (heightScale < 1f)
			{
				num2 = 0f - (1f - heightScale);
			}
			CameraFunction._current.positionAdjust.y = Player._mainPlayer._pVisual._headPos.y * heightScale + num2 + matchHeightAdjust;
		}

		public static IEnumerator FreeCameraReset()
		{
			CameraFunction._current._isLerpingReset = true;
			yield return (object)new WaitForSeconds(0.45f);
			CameraFunction._current._isLerpingReset = false;
		}
	}
}
namespace Atlyss.CameraFreedom.Patches
{
	[HarmonyPatch(typeof(CameraCollision), "Handle_DetectGroundLayer")]
	internal static class Handle_DetectGroundLayer
	{
		[HarmonyPrefix]
		internal static bool CheckRaycast(CameraCollision __instance, ref bool __result)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			if (Mod.IgnoreCollision.Value)
			{
				return false;
			}
			Vector3 val = ((!Player._mainPlayer._inUI) ? CameraFunction._current.positionAdjust : Mod.Instance.overridePositionAdjust);
			LayerMask val2 = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Ground" }));
			__result = Physics.Linecast(((Component)__instance).transform.parent.position + val, ((Component)__instance).transform.parent.TransformPoint(__instance.dollyDir * __instance.maxDistance), ref __instance.hit, LayerMask.op_Implicit(val2), (QueryTriggerInteraction)1);
			return false;
		}
	}
	[HarmonyPatch(typeof(CameraCollision), "LateUpdate")]
	internal static class CameraCollision__LateUpdate
	{
		[HarmonyPrefix]
		internal static bool BeforeHandling(CameraCollision __instance)
		{
			//IL_00ff: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Player._mainPlayer))
			{
				return false;
			}
			if (Mod.Instance.ControllingCamera)
			{
				return false;
			}
			float num = 1f;
			if (Mod.Instance.heightScale < 1f)
			{
				num = Mod.Instance.heightScale;
			}
			PlayerVisual pVisual = Player._mainPlayer._pVisual;
			Handle_DistanceControl();
			if ((double)__instance.maxDistance <= (double)(0.6f * num) && !Mod.AllowNegativeZoom.Value)
			{
				__instance.maxDistance = 0.6f * num;
			}
			else if ((double)__instance.maxDistance <= (double)(0.6f * num) && Mod.Instance.FreeCamera)
			{
				__instance.maxDistance = 0.6f * num;
			}
			if ((double)Vector3.Distance(((Component)CameraFunction._current._mainCamera).transform.position, ((Component)Player._mainPlayer).transform.position + CameraFunction._current.positionAdjust) <= 2.799999952316284 * (double)num && !Mod.Instance.AlwaysShowPlayer)
			{
				pVisual.RenderPlayerModel(false);
				__instance._unhidePlayerModel = true;
			}
			else if (__instance._unhidePlayerModel)
			{
				pVisual.RenderPlayerModel(true);
				__instance._unhidePlayerModel = false;
			}
			__instance.distance = ((!__instance.Handle_DetectGroundLayer()) ? __instance.maxDistance : Mathf.Clamp(((RaycastHit)(ref __instance.hit)).distance * __instance.step, __instance.minDistance, __instance.maxDistance));
			((Component)__instance).transform.localPosition = __instance.dollyDir * __instance.distance;
			return false;
			void Handle_DistanceControl()
			{
				if (!Player._mainPlayer._bufferingStatus && !Player._mainPlayer._inUI && !Player._mainPlayer._inChat)
				{
					if (Mod.Instance.prevDistanceHeightScale != Mod.Instance.heightScale && Mod.MatchPlayerHeight.Value)
					{
						float num2 = Mod.Instance.heightScale - Mod.Instance.prevDistanceHeightScale;
						float num3 = 10f * Mod.Instance.heightScale;
						if (Mod.Instance.heightScale > 1f && __instance.maxDistance > num3)
						{
							CameraCollision obj = __instance;
							obj.maxDistance += num2 * 10f;
						}
						if (Mod.Instance.heightScale < 1f && __instance.maxDistance > num3)
						{
							CameraCollision obj2 = __instance;
							obj2.maxDistance += num2 * 6f / Mathf.Clamp(Mod.Instance.heightScale, 0f, 1f);
						}
						Mod.Instance.prevDistanceHeightScale = Mod.Instance.heightScale;
					}
					float axis = Input.GetAxis("Mouse ScrollWheel");
					if ((double)axis != 0.0)
					{
						CameraCollision obj3 = __instance;
						obj3.maxDistance += axis * Mod.Instance.zoomChangeValue;
						if (!GamepadInput.GetButton((GamepadButton)8))
						{
							if (GamepadInput.GetButton((GamepadButton)11))
							{
								return;
							}
						}
						else if (0 == 0)
						{
							return;
						}
						if (InputControlManager.current.DpadUp((DpadHoldType)1))
						{
							CameraCollision obj4 = __instance;
							obj4.maxDistance -= Mod.Instance.zoomChangeValueDPad * Time.deltaTime;
						}
						if (InputControlManager.current.DpadDown((DpadHoldType)1))
						{
							CameraCollision obj5 = __instance;
							obj5.maxDistance += Mod.Instance.zoomChangeValueDPad * Time.deltaTime;
						}
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(CameraCollision), "Start")]
	internal static class CameraCollision__Start
	{
		[HarmonyPostfix]
		internal static void SetMaxDistance(CameraCollision __instance)
		{
			if (Mod.Instance.cachedDistance != 0f)
			{
				CameraCollision._current.maxDistance = Mod.Instance.cachedDistance;
			}
		}
	}
	[HarmonyPatch(typeof(CameraFunction), "CameraReset_Lerp")]
	internal static class CameraFunction__CameraReset_Lerp
	{
		[HarmonyPostfix]
		internal static void ResetExtraValues(CameraFunction __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(InputControlManager.current._resetCamera) || (GamepadInput.GetButton((GamepadButton)13) && !Object.op_Implicit((Object)(object)Player._mainPlayer._pTargeting._foundEntity)))
			{
				if ((Object)(object)Player._mainPlayer != (Object)null)
				{
					__instance.positionAdjust = Player._mainPlayer._pVisual._headPos;
				}
				Mod.Instance.overridePositionAdjust = Vector3.zero;
				Mod.Instance.rotationAdjust = Vector3.zero;
				Mod.Instance.zoomLockedValue = 30f;
				if (Mod.MatchPlayerHeight.Value)
				{
					Mod.Instance.matchHeightAdjust = 0f;
				}
			}
		}
	}
	[HarmonyPatch(typeof(CameraFunction), "FollowTargetObj")]
	internal static class CameraFunction__FollowTargetObj
	{
		[HarmonyPrefix]
		internal static bool AltFollowTarget(CameraFunction __instance)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_0099: Invalid comparison between Unknown and I4
			//IL_0102: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (!Object.op_Implicit((Object)(object)Player._mainPlayer) || !Object.op_Implicit((Object)(object)__instance._CameraFollowObj) || Mod.Instance.FreeCamera)
			{
				return false;
			}
			bool flag = (int)Player._mainPlayer._currentGameCondition == 0 && (double)__instance._snapLoadCameraBuffer >= 0.30000001192092896;
			if ((int)Player._mainPlayer._currentGameCondition == 0 && (double)__instance._snapLoadCameraBuffer < 0.30000001192092896)
			{
				__instance._snapLoadCameraBuffer += Time.deltaTime;
			}
			if ((int)Player._mainPlayer._currentGameCondition > 0)
			{
				__instance._snapLoadCameraBuffer = 0f;
			}
			if (__instance._initCameraOverride)
			{
				return false;
			}
			if (flag || Mod.StiffCamera.Value)
			{
				((Component)__instance).transform.position = __instance._CameraFollowObj.position + __instance.positionAdjust;
			}
			else
			{
				((Component)__instance).transform.position = Vector3.Lerp(((Component)__instance).transform.position, __instance._CameraFollowObj.position + __instance.positionAdjust, __instance.step * Time.deltaTime);
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(CameraFunction), "Handle_CameraControl")]
	internal static class CameraFunction__Handle_CameraControl
	{
		[HarmonyPrefix]
		internal static bool FreeCamUpdate(CameraFunction __instance)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_009e: Invalid comparison between Unknown and I4
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: 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_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Invalid comparison between Unknown and I4
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_048a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0405: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0503: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_052e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0535: Unknown result type (might be due to invalid IL or missing references)
			//IL_0541: Unknown result type (might be due to invalid IL or missing references)
			if (Mod.Instance.FreeCamera)
			{
				bool flag = Input.GetKeyDown((KeyCode)27) || Input.GetKeyDown(InputControlManager.current._hostConsole) || Input.GetKeyDown(InputControlManager.current._tabMenu);
				if (Object.op_Implicit((Object)(object)TabMenu._current._itemCell._heldItemListDataEntry))
				{
					flag = false;
				}
				if (flag)
				{
					__instance._unlockedCamera = !__instance._unlockedCamera;
				}
				if (__instance._unlockedCamera)
				{
					if (!DialogManager._current._isDialogEnabled)
					{
						if ((int)InputControlManager.current._setGamepadType == 13)
						{
							Cursor.visible = true;
						}
						else
						{
							if (!Cursor.visible && (double)InputControlManager.current._gamepadMouseCursorBuffer > 0.0)
							{
								ToolTipManager._current.Disable_AllTooltips();
							}
							Cursor.visible = (double)InputControlManager.current._gamepadMouseCursorBuffer > 0.0;
						}
						Cursor.lockState = (CursorLockMode)((!Cursor.visible) ? 1 : 0);
					}
				}
				else
				{
					Cursor.lockState = (CursorLockMode)1;
					Cursor.visible = false;
					if ((Input.GetKeyDown(InputControlManager.current._resetCamera) || GamepadInput.GetButton((GamepadButton)13)) && Object.op_Implicit((Object)(object)Player._mainPlayer) && !__instance._isLerpingReset)
					{
						((MonoBehaviour)__instance).StartCoroutine(Mod.FreeCameraReset());
					}
				}
				if ((double)InGameUI._current._escapeMenuBuffer > 0.0)
				{
					Cursor.lockState = (CursorLockMode)1;
					Cursor.visible = false;
					__instance._unlockedCamera = false;
				}
				if (TabMenu._current._isOpen)
				{
					__instance._unlockedCamera = true;
				}
				else if (Input.GetKey(InputControlManager.current._tabMenu))
				{
					__instance._unlockedCamera = false;
				}
				if (Player._mainPlayer._inChat)
				{
					Cursor.lockState = (CursorLockMode)0;
					Cursor.visible = true;
					__instance._unlockedCamera = true;
				}
				__instance.finalInputX = InputControlManager.current._altHoriz_input;
				__instance.finalInputZ = InputControlManager.current._altVert_input;
				if (__instance._unlockedCamera)
				{
					__instance.finalInputX = 0f;
					__instance.finalInputZ = 0f;
				}
				if (__instance._isLerpingReset)
				{
					Vector3 val = __instance._CameraFollowObj.position + __instance.positionAdjust;
					Vector3 val2 = default(Vector3);
					((Vector3)(ref val2))..ctor(0f, ((Component)__instance._CameraFollowObj).transform.eulerAngles.y, 0f);
					((Component)__instance).transform.position = Vector3.Lerp(((Component)__instance).transform.position, val, 12.5f * Time.deltaTime);
					((Component)__instance).transform.rotation = Quaternion.Lerp(((Component)__instance).transform.rotation, Quaternion.Euler(val2), 12.5f * Time.deltaTime);
				}
				else if (!Player._mainPlayer._inChat)
				{
					Vector3 val3 = default(Vector3);
					if (Mod.UsePlayerInput.Value)
					{
						float num;
						float num2;
						if ((int)InputControlManager.current._setGamepadType == 13)
						{
							num = (Input.GetKey(InputControlManager.current._right) ? 1 : 0) - (Input.GetKey(InputControlManager.current._left) ? 1 : 0);
							num2 = (Input.GetKey(InputControlManager.current._up) ? 1 : 0) - (Input.GetKey(InputControlManager.current._down) ? 1 : 0);
						}
						else
						{
							num = InputControlManager.current._horiz_input;
							num2 = InputControlManager.current._vert_input;
						}
						((Vector3)(ref val3))..ctor(num, 0f, num2);
					}
					else
					{
						float num3 = (Input.GetKey(Mod.RightFreeCamHotkey.Value) ? 1 : 0) - (Input.GetKey(Mod.LeftFreeCamHotkey.Value) ? 1 : 0);
						float num4 = (Input.GetKey(Mod.UpFreeCamHotkey.Value) ? 1 : 0) - (Input.GetKey(Mod.DownFreeCamHotkey.Value) ? 1 : 0);
						((Vector3)(ref val3))..ctor(num3, 0f, num4);
					}
					((Component)__instance).transform.Translate(val3 * (Mod.Instance.changeValue * 10f) * Time.deltaTime);
					Quaternion rotation = ((Component)__instance).transform.rotation;
					Vector3 val4 = default(Vector3);
					((Vector3)(ref val4))..ctor(__instance.finalInputZ, __instance.finalInputX, 0f);
					((Component)__instance).transform.Rotate(val4 * __instance.inputSensitivity * Time.deltaTime * 100f);
					Quaternion rotation2 = ((Component)__instance).transform.rotation;
					Vector3 eulerAngles = ((Quaternion)(ref rotation2)).eulerAngles;
					if (eulerAngles.x > 89.95f && eulerAngles.x <= 90f)
					{
						eulerAngles.x = 89.95f;
					}
					if (eulerAngles.x >= 270f && eulerAngles.x < 270.05f)
					{
						eulerAngles.x = 270.05f;
					}
					((Component)__instance).transform.rotation = Quaternion.Euler(eulerAngles.x, eulerAngles.y, 0f);
				}
				return false;
			}
			return true;
		}

		[HarmonyPostfix]
		internal static void PositionAdjustAffectsOverride(CameraFunction __instance)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_005d: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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)
			if (__instance._initCameraOverride && !Mod.Instance.FreeCamera)
			{
				((Component)__instance).transform.SetPositionAndRotation(Vector3.Lerp(((Component)__instance).transform.position, __instance._overridePosition + Mod.Instance.overridePositionAdjust, 3f * Time.deltaTime), Quaternion.Lerp(((Component)__instance).transform.rotation, Quaternion.Euler(__instance._overrideRotation + Mod.Instance.rotationAdjust), 3f * Time.deltaTime));
				CameraCollision._current.maxDistance = Mathf.Lerp(CameraCollision._current.maxDistance, Mod.Instance.zoomLockedValue, 3f * Time.deltaTime);
			}
		}
	}
	[HarmonyPatch(typeof(DialogManager), "End_Dialog")]
	internal static class DialogManager__End_Dialog
	{
		[HarmonyPostfix]
		internal static void ResetMaxDistance()
		{
			if (Mod.Instance.cachedDistance != 0f)
			{
				CameraCollision._current.maxDistance = Mod.Instance.cachedDistance;
			}
		}
	}
	[HarmonyPatch(typeof(DialogManager), "Start_Dialog")]
	internal static class DialogManager__Start_Dialog
	{
		[HarmonyPrefix]
		internal static void SaveCameraDistance()
		{
			Mod.Instance.cachedDistance = CameraCollision._current.maxDistance;
		}
	}
	[HarmonyPatch(typeof(MainMenuManager), "Awake")]
	internal static class MainMenuManager__Awake
	{
		[HarmonyPostfix]
		internal static void Postfix()
		{
			//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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			Mod.Instance.overridePositionAdjust = Vector3.zero;
			Mod.Instance.rotationAdjust = Vector3.zero;
			Mod.Instance.zoomLockedValue = 30f;
			Mod.Instance.matchHeightAdjust = 0f;
			Mod.Instance.cachedDistance = 0f;
			Mod.Instance.cachedDialogueDistance = 0f;
			Mod.Instance.changeValue = 3.2f;
			Mod.Instance.zoomChangeValue = 35.5f;
			Mod.Instance.zoomChangeValueDPad = 65.5f;
			Mod.Instance.prevDistanceHeightScale = 1f;
			Mod.Instance.displayHead = true;
			Mod.Instance.FreeCamera = false;
		}
	}
	[HarmonyPatch(typeof(PlayerMove), "Handle_MovementControl")]
	internal static class PlayerMove__Handle_MovementControl
	{
		[HarmonyPrefix]
		internal static void PreviousRotation(PlayerMove __instance)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			Mod.Instance.prevRotation = ((Component)__instance).transform.rotation;
		}

		[HarmonyPostfix]
		internal static void FirstPersonAdjustments(PlayerMove __instance)
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Invalid comparison between Unknown and I4
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Invalid comparison between Unknown and I4
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Invalid comparison between Unknown and I4
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Invalid comparison between Unknown and I4
			//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_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: 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)
			if (__instance._player._inChat || __instance._player._bufferingStatus || Object.op_Implicit((Object)(object)__instance._pTargeting._targetedEntity) || __instance._player._pProfession._isProfessionAction || (int)__instance._movementLockType != 0 || __instance._lockControl || TabMenu._current._isOpen || ((int)__instance._currentMovementAction == 6 && (int)__instance._currentMovementAction == 7))
			{
				return;
			}
			float num = 1f;
			if (Mod.Instance.heightScale < 1f)
			{
				num = Mod.Instance.heightScale;
			}
			if ((double)CameraCollision._current.maxDistance <= 1.2000000476837158 * (double)num && !Mod.Instance.FreeCamera)
			{
				__instance._strafeToggle = true;
			}
			else
			{
				__instance._strafeToggle = false;
				((Component)__instance).transform.rotation = Mod.Instance.prevRotation;
			}
			if (SettingsManager._current._inputStrafeWhileHoldingWeapon.isOn)
			{
				__instance._strafeToggle = (int)__instance._pCombat._currentSheathCondition == 1;
			}
			if (SettingsManager._current._inputStrafeWhileCastingOffensiveSkill.isOn)
			{
				if (Object.op_Implicit((Object)(object)__instance._pCasting._currentCastSkill) && __instance._pCasting._currentCastSkill._strafeDirection)
				{
					__instance._strafeToggle = true;
				}
				if (__instance._castStrafeLock)
				{
					__instance._strafeToggle = true;
				}
			}
			bool flag = SettingsManager._current._inputStrafeWhileMoveAttack.isOn && ((double)InputControlManager.current._horiz_input != 0.0 || (double)InputControlManager.current._vert_input != 0.0);
			if (((int)__instance._player._currentPlayerAction == 1 || (__instance._pCombat._isChargingWeapon ? true : false)) && (flag ? true : false))
			{
				__instance._strafeToggle = true;
			}
			else if (__instance._strafeToggleWasOn)
			{
				__instance._strafeToggle = false;
			}
			if ((double)__instance._disableStrafeBuffer > 0.0)
			{
				__instance._strafeToggle = false;
			}
			else if (InputControlManager.current.isLockDirectionToggled && __instance._strafeToggleWasOn && !__instance._strafeToggle)
			{
				__instance._strafeToggle = true;
			}
			if (__instance._lockControlMidair)
			{
				return;
			}
			if (!((double)__instance._attackForce <= 0.0) && ((__instance._attackForceInput != Vector3.zero) ? true : false))
			{
				if (!__instance._strafeToggle)
				{
					((Component)__instance).transform.rotation = Quaternion.LookRotation(__instance._attackForceInput);
				}
				else
				{
					Handle_StrafeRotation();
				}
			}
			else if (__instance._strafeToggle)
			{
				Handle_StrafeRotation();
			}
			else if (__instance._worldSpaceInput != Vector3.zero)
			{
				((Component)__instance).transform.rotation = Quaternion.LookRotation(__instance._worldSpaceInput);
			}
			void Handle_StrafeRotation()
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				((Component)__instance).transform.rotation = Quaternion.Euler(0f, CameraFunction._current._RotY, 0f);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerTargeting), "Client_EndTarget")]
	internal static class PlayerTargeting__Client_EndTarget
	{
		[HarmonyPrefix]
		internal static void SaveAdjustedPosition()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Mod.Instance.prevPositionAdjust = CameraFunction._current.positionAdjust;
		}

		[HarmonyPostfix]
		internal static void SetAdjustedPosition()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			CameraFunction._current.positionAdjust = Mod.Instance.prevPositionAdjust;
		}
	}
	[HarmonyPatch(typeof(RaceModelEquipDisplay), "Apply_EquipmentVisualDisplay")]
	internal static class RaceModelEquipDisplay__Apply_EquipmentVisualDisplay
	{
		[HarmonyPostfix]
		internal static void HeadDisplay(RaceModelEquipDisplay __instance)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			if ((Object)(object)Player._mainPlayer == (Object)null || (int)Player._mainPlayer._currentGameCondition != 1 || !((Object)(object)__instance._player == (Object)(object)Player._mainPlayer))
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)__instance._pEquip._equips["Helm"]._scriptableEquip))
			{
				ScriptableHelm val = (ScriptableHelm)__instance._pEquip._equips["Helm"]._scriptableEquip;
				if (val._isFullHelm && !__instance._hideHelmVisual)
				{
					return;
				}
			}
			if (Object.op_Implicit((Object)(object)__instance._pEquip._equips["Helm"]._vanityEquip))
			{
				ScriptableHelm val2 = (ScriptableHelm)__instance._pEquip._equips["Helm"]._vanityEquip;
				if (val2._isFullHelm && !__instance._hideVanityHelm)
				{
					return;
				}
			}
			__instance._playerRaceModel.Init_CullHead(!Mod.Instance.displayHead);
			__instance._playerRaceModel._hideEars = !Mod.Instance.displayHead;
			__instance._playerRaceModel.Apply_CharacterDisplay();
		}
	}
	[HarmonyPatch(typeof(SettingsManager), "Apply_CameraParameters")]
	internal static class SettingsManager__Apply_CameraParameters
	{
		[HarmonyPostfix]
		internal static void RenderDistancePostfix(SettingsManager __instance)
		{
			if (Object.op_Implicit((Object)(object)CameraFunction._current))
			{
				CameraFunction._current._mainCamera.farClipPlane = Mod.RenderDistance.Value;
				CameraFunction._current._UICamera.farClipPlane = Mod.RenderDistance.Value;
			}
		}
	}
}