Decompiled source of Camera Freedom v1.0.1

Atlyss.CameraFreedom.dll

Decompiled 16 hours ago
using System;
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.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
{
	[BepInPlugin("ATLYSS.CameraFreedom", "Camera Freedom", "1.0.1")]
	public sealed class Mod : BaseUnityPlugin
	{
		private const string modGUID = "ATLYSS.CameraFreedom";

		private const string modName = "Camera Freedom";

		private const string modVersion = "1.0.1";

		public static string HeightScrollKey = "Height Modifier Hotkey";

		public static string HorizKey = "Horizontal Modifier Hotkey";

		public static string IncreaseModifierKey = "Increase Modifier Hotkey";

		public static string DecreaseModifierKey = "Decrease Modifier 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 StiffKey = "Stiff Camera";

		public static string ShowHeadKey = "Show Head Hotkey";

		public Vector3 overridePositionAdjust = Vector3.zero;

		public Vector3 playerHeadScale;

		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 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 Vector3 prevPositionAdjust { 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 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_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Expected O, but got Unknown
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Expected O, but got Unknown
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Expected O, but got Unknown
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: 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. Note: You can't adjust the camera's height with this on.", (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>()));
			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)47, 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.", (AcceptableValueBase)null, Array.Empty<object>()));
			Log.LogInfo((object)"Camera Freedom: Patching...");
			harmony.PatchAll();
			Log.LogInfo((object)"Camera Freedom: Active!");
		}

		public void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_0101: Invalid comparison between Unknown and I4
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: 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_049a: 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)
			if (Input.GetKeyDown(IncreaseModifier.Value))
			{
				changeValue *= 2f;
				zoomChangeValue *= 2f;
			}
			if (Input.GetKeyDown(DecreaseModifier.Value))
			{
				changeValue /= 2f;
				zoomChangeValue /= 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 || (Object)(object)CameraFunction._current == (Object)null)
			{
				return;
			}
			heightScale = Player._mainPlayer._pVisual._playerAppearanceStruct._heightWeight;
			ControllingCamera = false;
			if (Player._mainPlayer._inUI)
			{
				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)
					{
						rotationAdjust.z += axis * changeValue;
					}
					else if ((double)axis != 0.0)
					{
						zoomLockedValue += axis * zoomChangeValue;
					}
				}
			}
			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;
		}
	}
}
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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0052: 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_006e: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			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_0084: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: 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)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;
			}
			if ((double)__instance.maxDistance <= -2.0 && !Mod.AllowNegativeZoom.Value)
			{
				__instance.maxDistance = -2f;
			}
			__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;
						if (Mod.Instance.heightScale > 1f)
						{
							CameraCollision obj = __instance;
							obj.maxDistance += num2 * 10f;
						}
						if (Mod.Instance.heightScale < 1f)
						{
							CameraCollision obj2 = __instance;
							obj2.maxDistance += num2 * 10f / Mathf.Clamp(Mod.Instance.heightScale, 0.225f, 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;
					}
				}
			}
		}
	}
	[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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(InputControlManager.current._resetCamera) || (GamepadInput.GetButton((GamepadButton)13, InputControlManager.current._setGamepadInfo) && !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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Invalid comparison between Unknown and I4
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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))
			{
				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
	{
		[HarmonyPostfix]
		internal static void PositionAdjustAffectsOverride(CameraFunction __instance)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			if (__instance._initCameraOverride)
			{
				((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(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(PlayerVisual), "Apply_NetworkedCharacterDisplay")]
	internal static class PlayerVisual__Apply_NetworkedCharacterDisplay
	{
		[HarmonyPrefix]
		internal static bool Bruh(PlayerVisual __instance)
		{
			//IL_004a: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_0094: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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_0128: Expected O, but got Unknown
			//IL_0133: 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_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Expected O, but got Unknown
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)__instance._playerRaceModel))
			{
				return false;
			}
			__instance._playerRaceModel.SetTextureIndex = __instance._playerAppearanceStruct._textureID;
			__instance._playerRaceModel._displayBoobs = __instance._playerAppearanceStruct._displayBoobs;
			ColorAdjustShader_Profile setSkinColorProfile = new ColorAdjustShader_Profile
			{
				_hue = __instance._playerAppearanceStruct._bodyColorHue,
				_brightness = __instance._playerAppearanceStruct._bodyColorBrightness,
				_contrast = __instance._playerAppearanceStruct._bodyColorContrast,
				_saturation = __instance._playerAppearanceStruct._bodyColorSaturation
			};
			ColorAdjustShader_Profile hairColorProfile = new ColorAdjustShader_Profile
			{
				_hue = __instance._playerAppearanceStruct._hairStyleHue,
				_brightness = __instance._playerAppearanceStruct._hairStyleBrightness,
				_contrast = __instance._playerAppearanceStruct._hairStyleContrast,
				_saturation = __instance._playerAppearanceStruct._hairStyleSaturation
			};
			ColorAdjustShader_Profile miscColorProfile = new ColorAdjustShader_Profile
			{
				_hue = __instance._playerAppearanceStruct._miscHue,
				_brightness = __instance._playerAppearanceStruct._miscBrightness,
				_contrast = __instance._playerAppearanceStruct._miscContrast,
				_saturation = __instance._playerAppearanceStruct._miscSaturation
			};
			PlayerAppearance_Profile val = __instance._playerRaceModel._scriptablePlayerRace.Init_ParamsCheck(new PlayerAppearance_Profile
			{
				_armWeight = __instance._playerAppearanceStruct._armWeight,
				_bellyWeight = __instance._playerAppearanceStruct._bellyWeight,
				_displayBoobs = __instance._playerAppearanceStruct._displayBoobs,
				_boobWeight = __instance._playerAppearanceStruct._boobWeight,
				_bottomWeight = __instance._playerAppearanceStruct._bottomWeight,
				_headWidth = __instance._playerAppearanceStruct._headWidth,
				_heightWeight = __instance._playerAppearanceStruct._heightWeight,
				_muzzleWeight = __instance._playerAppearanceStruct._muzzleWeight,
				_torsoWeight = __instance._playerAppearanceStruct._torsoWeight,
				_widthWeight = __instance._playerAppearanceStruct._widthWeight,
				_hairColorProfile = hairColorProfile,
				_miscColorProfile = miscColorProfile,
				_setSkinColorProfile = setSkinColorProfile
			});
			__instance._playerRaceModel._headBoneTransform.localScale = new Vector3(val._headWidth, __instance._playerRaceModel._headBoneTransform.localScale.y, __instance._playerRaceModel._headBoneTransform.localScale.z);
			__instance._playerRaceModel._armatureTransform.localScale = new Vector3(val._widthWeight, val._heightWeight, val._widthWeight);
			__instance._playerRaceModel._bellyWeight = val._bellyWeight;
			__instance._playerRaceModel._boobWeight = val._boobWeight;
			__instance._playerRaceModel._bottomWeight = val._bottomWeight;
			__instance._playerRaceModel._torsoWeight = val._torsoWeight;
			__instance._playerRaceModel._muzzleWeight = val._muzzleWeight;
			__instance._playerRaceModel._armWeight = val._armWeight;
			__instance._playerRaceModel.SetEarIndex = __instance._playerAppearanceStruct._earID;
			__instance._playerRaceModel.SetHairIndex = __instance._playerAppearanceStruct._hairStyleID;
			__instance._playerRaceModel.SetMiscIndex = __instance._playerAppearanceStruct._miscID;
			__instance._playerRaceModel.SetEyeIndex = __instance._playerAppearanceStruct._eyeID;
			__instance._playerRaceModel.SetMouthIndex = __instance._playerAppearanceStruct._mouthID;
			__instance._playerRaceModel.SetTailIndex = __instance._playerAppearanceStruct._tailID;
			__instance._playerRaceModel._setSkinColorProfile = val._setSkinColorProfile;
			__instance._playerRaceModel._setHairColorProfile = val._hairColorProfile;
			__instance._playerRaceModel._setMiscColorProfile = val._miscColorProfile;
			__instance._playerRaceModel._hairHueIsBodyHue = __instance._playerAppearanceStruct._hairIsBodyColor;
			__instance._raceModelED._dyeIndex = __instance._playerAppearanceStruct._dyeIndex;
			__instance._raceModelED._hideHelmVisual = __instance._playerAppearanceStruct._hideHelm;
			__instance._raceModelED._hideCapeVisual = __instance._playerAppearanceStruct._hideCape;
			__instance._raceModelED._hideChestVisual = __instance._playerAppearanceStruct._hideChest;
			__instance._raceModelED._hideLeggingsVisual = __instance._playerAppearanceStruct._hideLeggings;
			__instance._raceModelED._hideVanityHelm = __instance._playerAppearanceStruct._hideVanityHelm;
			__instance._raceModelED._hideVanityCape = __instance._playerAppearanceStruct._hideVanityCape;
			__instance._raceModelED._hideVanityChest = __instance._playerAppearanceStruct._hideVanityChest;
			__instance._raceModelED._hideVanityLeggings = __instance._playerAppearanceStruct._hideVanityLeggings;
			__instance._playerRaceModel.Apply_CharacterDisplay();
			__instance._playerRaceModel._equipDisplay.Reset_EquipDisplayCache();
			__instance._raceModelRenderMod.FindRenders();
			return false;
		}

		[HarmonyPostfix]
		internal static void HeadOverride(PlayerVisual __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(Mod.ShowHeadHotkey.Value) && (Object)(object)__instance._player == (Object)(object)Player._mainPlayer && !Player._mainPlayer._inChat)
			{
				Mod.Instance.displayHead = !Mod.Instance.displayHead;
				if (Mod.Instance.displayHead)
				{
					__instance._playerRaceModel._headBoneTransform.localScale = Mod.Instance.playerHeadScale;
					__instance._playerAppearanceStruct._headWidth = __instance._playerRaceModel._headBoneTransform.localScale.x;
				}
				else
				{
					Mod.Instance.playerHeadScale = __instance._playerRaceModel._headBoneTransform.localScale;
					__instance._playerAppearanceStruct._headWidth = 0f;
					__instance._playerRaceModel._headBoneTransform.localScale = Vector3.zero;
				}
			}
		}
	}
}