Decompiled source of Customizable Camera v1.3.4

CustomizableCamera.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CustomizableCamera")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomizableCamera")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cfd27921-9ad6-427d-a748-71ab108e1747")]
[assembly: AssemblyFileVersion("1.3.4")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.4.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace CustomizableCamera
{
	public class CustomizeableCameraBase
	{
		public enum interpolationTypes
		{
			Linear,
			SmoothStep
		}

		public enum characterState
		{
			standing,
			walking,
			sprinting,
			crouching,
			sailing,
			bowequipped,
			bowaiming
		}

		public static bool characterStateChanged;

		public static bool characterControlledShip;

		public static bool characterStoppedShipControl;

		public static bool characterCrouched;

		public static bool characterAiming;

		public static bool characterSprinting;

		public static bool characterWalking;

		public static bool characterEquippedBow;

		public static bool playerIsMoving;

		public static bool playerInShelter;

		public static bool playerInInterior;

		public static bool isFirstPerson;

		public static bool onSwappedShoulder;

		public static bool canChangeCameraDistance;

		public static float cameraZoomSensitivityTemp = 10f;

		public static characterState __characterState;

		public static characterState __characterStatePrev;
	}
	[HarmonyPatch(typeof(GameCamera), "UpdateCamera")]
	public class GameCamera_UpdateCamera_Patch : CustomizeableCameraBase
	{
		public static bool targetDistanceHasBeenReached;

		public static float timeDuration = CustomizableCamera.smoothZoomSpeed;

		public static float timePos = 0f;

		public static float targetDistance = CustomizableCamera.cameraDistance.Value;

		public static float lastSetDistance;

		public static float camDistance;

		public static float zoomSens;

		private static bool checkLerpDuration(float timeElapsed)
		{
			if (lastSetDistance == targetDistance || timeElapsed >= timeDuration)
			{
				timePos = 0f;
				return true;
			}
			return false;
		}

		private static void checkInteriorChange(Player player)
		{
			if (CustomizeableCameraBase.playerInInterior != ((Character)player).InInterior())
			{
				CustomizeableCameraBase.playerInInterior = ((Character)player).InInterior();
				CustomizeableCameraBase.canChangeCameraDistance = true;
			}
			else if (CustomizeableCameraBase.playerInShelter != player.InShelter())
			{
				CustomizeableCameraBase.playerInShelter = player.InShelter();
				CustomizeableCameraBase.canChangeCameraDistance = true;
			}
		}

		private static void moveToNewCameraDistance(float time, ref float ___m_distance)
		{
			if ((double)___m_distance <= 0.1 && targetDistance == 0f)
			{
				___m_distance = targetDistance;
			}
			else
			{
				___m_distance = Mathf.Lerp(lastSetDistance, targetDistance, time);
			}
			lastSetDistance = ___m_distance;
		}

		public static void Postfix(GameCamera __instance, ref float ___m_distance, ref float ___m_zoomSens)
		{
			if (!CustomizableCamera.isEnabled.Value || GameCamera.InFreeFly())
			{
				return;
			}
			Player localPlayer = Player.m_localPlayer;
			if (!Object.op_Implicit((Object)(object)localPlayer))
			{
				return;
			}
			checkInteriorChange(localPlayer);
			___m_zoomSens = CustomizableCamera.cameraZoomSensitivity.Value;
			if (CustomizeableCameraBase.canChangeCameraDistance)
			{
				if (CustomizableCamera.cameraDistanceInteriorsEnabled.Value && CustomizeableCameraBase.playerInInterior)
				{
					targetDistance = CustomizableCamera.cameraDistanceInteriors.Value;
				}
				else if (CustomizableCamera.cameraDistanceShelterEnabled.Value && CustomizeableCameraBase.playerInShelter)
				{
					targetDistance = CustomizableCamera.cameraDistanceShelter.Value;
				}
				else if (CustomizableCamera.cameraDistanceBoatEnabled.Value && CustomizeableCameraBase.characterControlledShip)
				{
					targetDistance = CustomizableCamera.cameraDistanceBoat.Value;
				}
				else if (CustomizableCamera.cameraDistanceBoatEnabled.Value && CustomizeableCameraBase.characterStoppedShipControl)
				{
					targetDistance = CustomizableCamera.cameraDistance.Value;
				}
				else if (CustomizableCamera.cameraDistanceExteriorsEnabled.Value && !CustomizeableCameraBase.playerInShelter && !CustomizeableCameraBase.playerInInterior)
				{
					targetDistance = CustomizableCamera.cameraDistance.Value;
				}
				CustomizeableCameraBase.canChangeCameraDistance = false;
			}
			if (!CustomizableCamera.smoothZoomEnabled.Value)
			{
				return;
			}
			___m_zoomSens = 0f;
			if ((!Object.op_Implicit((Object)(object)Chat.instance) || !Chat.instance.HasFocus()) && !Console.IsVisible() && !InventoryGui.IsVisible() && !StoreGui.IsVisible() && !Menu.IsVisible() && !Minimap.IsOpen() && !((Character)localPlayer).InCutscene() && ((!((Character)localPlayer).InPlaceMode()) ? true : false))
			{
				float minDistance = __instance.m_minDistance;
				float num = (((Object)(object)localPlayer.GetControlledShip() != (Object)null) ? CustomizableCamera.cameraMaxDistanceBoat.Value : CustomizableCamera.cameraMaxDistance.Value);
				float num2 = targetDistance;
				targetDistance -= Input.GetAxis("Mouse ScrollWheel") * CustomizableCamera.cameraZoomSensitivity.Value;
				targetDistance = Mathf.Clamp(targetDistance, minDistance, num);
				if (num2 != targetDistance)
				{
					timePos = 0f;
				}
			}
			targetDistanceHasBeenReached = checkLerpDuration(timePos);
			if (!targetDistanceHasBeenReached)
			{
				timePos += Time.deltaTime;
				moveToNewCameraDistance(timePos / timeDuration, ref ___m_distance);
			}
		}
	}
	[HarmonyPatch(typeof(Player), "SetControls")]
	public class Player_SetControls_Patch : CustomizeableCameraBase
	{
		public static bool isPlayerAbleToCrouch;

		public static void Prefix(Player __instance, ref bool block, ref bool blockHold)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Invalid comparison between Unknown and I4
			//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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: 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_00e8: 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)
			if (!CustomizableCamera.isEnabled.Value || !Object.op_Implicit((Object)(object)__instance))
			{
				return;
			}
			ItemData currentWeapon = ((Humanoid)__instance).GetCurrentWeapon();
			if (currentWeapon != null && (int)currentWeapon.m_shared.m_itemType == 4)
			{
				CustomizeableCameraBase.characterEquippedBow = true;
			}
			else
			{
				CustomizeableCameraBase.characterEquippedBow = false;
			}
			if (!CustomizableCamera.bowZoomEnabled.Value)
			{
				return;
			}
			if (((Character)__instance).InAttack() && CustomizeableCameraBase.characterEquippedBow)
			{
				KeyboardShortcut value = CustomizableCamera.bowCancelDrawKey.Value;
				if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
				{
					block = true;
					blockHold = true;
					CustomizeableCameraBase.characterAiming = false;
				}
				else if (CustomizableCamera.bowZoomOnDraw.Value)
				{
					CustomizeableCameraBase.characterAiming = true;
				}
				else
				{
					block = false;
					blockHold = false;
					if (CustomizableCamera.bowZoomKeyToggle.Value)
					{
						value = CustomizableCamera.bowZoomKey.Value;
						if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
						{
							CustomizeableCameraBase.characterAiming = !CustomizeableCameraBase.characterAiming;
						}
					}
					else
					{
						value = CustomizableCamera.bowZoomKey.Value;
						if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
						{
							CustomizeableCameraBase.characterAiming = true;
						}
						else
						{
							CustomizeableCameraBase.characterAiming = false;
						}
					}
				}
			}
			else
			{
				CustomizeableCameraBase.characterAiming = false;
			}
			if (CustomizableCamera.bowZoomSensitivityEnabled.Value)
			{
				if (CustomizeableCameraBase.characterAiming)
				{
					PlayerController.m_mouseSens = CustomizableCamera.playerMouseSensitivity * CustomizableCamera.bowZoomSensitivity.Value;
				}
				else
				{
					PlayerController.m_mouseSens = CustomizableCamera.playerMouseSensitivity;
				}
			}
		}

		public static void Postfix(Player __instance, Vector3 movedir, bool blockHold, bool crouch, bool run, bool autoRun)
		{
			if (!Object.op_Implicit((Object)(object)__instance))
			{
				return;
			}
			if (((Vector3)(ref movedir)).magnitude != 0f)
			{
				CustomizeableCameraBase.playerIsMoving = true;
			}
			else
			{
				CustomizeableCameraBase.playerIsMoving = false;
			}
			if (CustomizeableCameraBase.characterCrouched && crouch)
			{
				CustomizeableCameraBase.characterCrouched = false;
				return;
			}
			CustomizeableCameraBase.characterWalking = ((Character)__instance).GetWalk();
			if (run || autoRun || blockHold)
			{
				isPlayerAbleToCrouch = false;
				CustomizeableCameraBase.characterCrouched = false;
			}
			else
			{
				isPlayerAbleToCrouch = true;
			}
			if (CustomizeableCameraBase.playerIsMoving && run && !blockHold)
			{
				CustomizeableCameraBase.characterSprinting = true;
			}
			else
			{
				CustomizeableCameraBase.characterSprinting = false;
			}
			if (isPlayerAbleToCrouch && crouch)
			{
				CustomizeableCameraBase.characterCrouched = true;
			}
		}
	}
	[HarmonyPatch(typeof(GameCamera), "GetCameraPosition")]
	public class GameCamera_GetCameraPosition_Patch : CustomizeableCameraBase
	{
		private static void resetCameraSettings(GameCamera __instance)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			__instance.m_fov = CustomizableCamera.defaultFOV;
			__instance.m_3rdOffset = CustomizableCamera.defaultPosition;
		}

		private static void moveToNewCameraPosition(GameCamera __instance, Vector3 targetVector, float time)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			__instance.m_3rdOffset = Vector3.Lerp(__instance.m_3rdOffset, targetVector, time / CustomizableCamera.timeCameraPosDuration.Value);
			CustomizableCamera.lastSetPos = __instance.m_3rdOffset;
		}

		private static void moveToNewCameraFOV(GameCamera __instance, float targetFOV, float time)
		{
			__instance.m_fov = Mathf.Lerp(CustomizableCamera.lastSetFOV, targetFOV, time / CustomizableCamera.timeFOVDuration.Value);
			CustomizableCamera.lastSetFOV = __instance.m_fov;
		}

		private static void moveToNewCameraFOVBowZoom(GameCamera __instance, float targetFOV, float time, interpolationTypes interpType)
		{
			if (interpType == interpolationTypes.SmoothStep)
			{
				__instance.m_fov = Mathf.SmoothStep(CustomizableCamera.lastSetFOV, targetFOV, time / CustomizableCamera.timeBowZoomFOVDuration.Value);
			}
			else
			{
				__instance.m_fov = Mathf.Lerp(CustomizableCamera.lastSetFOV, targetFOV, time / CustomizableCamera.timeBowZoomFOVDuration.Value);
			}
			CustomizableCamera.lastSetFOV = __instance.m_fov;
		}

		private static bool checkBowZoomFOVLerpDuration(GameCamera __instance, float timeElapsed)
		{
			if (CustomizableCamera.lastSetFOV == CustomizableCamera.targetFOV || timeElapsed >= CustomizableCamera.timeFOVDuration.Value)
			{
				__instance.m_fov = CustomizableCamera.targetFOV;
				return true;
			}
			return false;
		}

		private static bool checkFOVLerpDuration(GameCamera __instance, float timeElapsed)
		{
			if (CustomizableCamera.lastSetFOV == CustomizableCamera.targetFOV)
			{
				__instance.m_fov = CustomizableCamera.targetFOV;
				return true;
			}
			if (timeElapsed >= CustomizableCamera.timeFOVDuration.Value)
			{
				CustomizableCamera.timeFOV = 0f;
				return true;
			}
			return false;
		}

		private static bool checkCameraLerpDuration(GameCamera __instance, float timeElapsed)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			if (CustomizableCamera.lastSetPos == CustomizableCamera.targetPos)
			{
				__instance.m_3rdOffset = CustomizableCamera.targetPos;
				return true;
			}
			if (timeElapsed >= CustomizableCamera.timeCameraPosDuration.Value)
			{
				CustomizableCamera.timeCameraPos = 0f;
				return true;
			}
			return false;
		}

		private static void setValuesBasedOnCharacterState(Player __instance, bool isFirstPerson)
		{
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: 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)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: 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_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_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			CustomizeableCameraBase.__characterStatePrev = CustomizeableCameraBase.__characterState;
			if (isFirstPerson)
			{
				if (CustomizeableCameraBase.characterAiming && CustomizableCamera.bowZoomFirstPersonEnabled.Value)
				{
					CustomizableCamera.targetFOV = CustomizableCamera.cameraBowZoomFirstPersonFOV.Value;
					CustomizeableCameraBase.__characterState = characterState.bowaiming;
				}
				else
				{
					CustomizableCamera.targetFOV = CustomizableCamera.cameraFirstPersonFOV.Value;
					CustomizeableCameraBase.__characterState = characterState.standing;
				}
			}
			else if (CustomizeableCameraBase.characterAiming && CustomizableCamera.bowZoomEnabled.Value)
			{
				CustomizableCamera.targetFOV = CustomizableCamera.cameraBowZoomFOV.Value;
				if (CustomizeableCameraBase.characterEquippedBow && CustomizableCamera.cameraBowSettingsEnabled.Value)
				{
					CustomizableCamera.targetPos = new Vector3(CustomizableCamera.cameraBowX.Value, CustomizableCamera.cameraBowY.Value, CustomizableCamera.cameraBowZ.Value);
				}
				else
				{
					CustomizableCamera.targetPos = new Vector3(CustomizableCamera.cameraX.Value, CustomizableCamera.cameraY.Value, CustomizableCamera.cameraZ.Value);
				}
				CustomizeableCameraBase.__characterState = characterState.bowaiming;
			}
			else if (CustomizeableCameraBase.characterControlledShip)
			{
				CustomizableCamera.targetFOV = CustomizableCamera.cameraBoatFOV.Value;
				CustomizableCamera.targetPos = new Vector3(CustomizableCamera.cameraBoatX.Value, CustomizableCamera.cameraBoatY.Value, CustomizableCamera.cameraBoatZ.Value);
				CustomizeableCameraBase.__characterState = characterState.sailing;
			}
			else if (CustomizeableCameraBase.characterEquippedBow && CustomizableCamera.cameraBowSettingsEnabled.Value)
			{
				CustomizableCamera.targetFOV = CustomizableCamera.cameraFOV.Value;
				CustomizableCamera.targetPos = new Vector3(CustomizableCamera.cameraBowX.Value, CustomizableCamera.cameraBowY.Value, CustomizableCamera.cameraBowZ.Value);
				CustomizeableCameraBase.__characterState = characterState.bowequipped;
			}
			else if (CustomizeableCameraBase.characterSprinting)
			{
				CustomizableCamera.targetFOV = CustomizableCamera.cameraSprintFOV.Value;
				CustomizableCamera.targetPos = new Vector3(CustomizableCamera.cameraSprintX.Value, CustomizableCamera.cameraSprintY.Value, CustomizableCamera.cameraSprintZ.Value);
				CustomizeableCameraBase.__characterState = characterState.sprinting;
			}
			else if (CustomizeableCameraBase.characterCrouched)
			{
				CustomizableCamera.targetFOV = CustomizableCamera.cameraSneakFOV.Value;
				CustomizableCamera.targetPos = new Vector3(CustomizableCamera.cameraSneakX.Value, CustomizableCamera.cameraSneakY.Value, CustomizableCamera.cameraSneakZ.Value);
				CustomizeableCameraBase.__characterState = characterState.crouching;
			}
			else if (CustomizeableCameraBase.characterWalking)
			{
				CustomizableCamera.targetFOV = CustomizableCamera.cameraWalkFOV.Value;
				CustomizableCamera.targetPos = new Vector3(CustomizableCamera.cameraWalkX.Value, CustomizableCamera.cameraWalkY.Value, CustomizableCamera.cameraWalkZ.Value);
				CustomizeableCameraBase.__characterState = characterState.walking;
			}
			else
			{
				CustomizableCamera.targetFOV = CustomizableCamera.cameraFOV.Value;
				CustomizableCamera.targetPos = new Vector3(CustomizableCamera.cameraX.Value, CustomizableCamera.cameraY.Value, CustomizableCamera.cameraZ.Value);
				CustomizeableCameraBase.__characterState = characterState.standing;
			}
			float x = CustomizableCamera.targetPos.x * -1f;
			KeyboardShortcut value = CustomizableCamera.swapShoulderViewKey.Value;
			if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey) && !isFirstPerson)
			{
				CustomizableCamera.timeCameraPos = 0f;
				CustomizeableCameraBase.onSwappedShoulder = !CustomizeableCameraBase.onSwappedShoulder;
			}
			if (CustomizeableCameraBase.onSwappedShoulder)
			{
				CustomizableCamera.targetPos.x = x;
			}
			if (CustomizeableCameraBase.__characterState != CustomizeableCameraBase.__characterStatePrev)
			{
				CustomizeableCameraBase.characterStateChanged = true;
				CustomizeableCameraBase.__characterStatePrev = CustomizeableCameraBase.__characterState;
			}
			else
			{
				CustomizeableCameraBase.characterStateChanged = false;
			}
		}

		private static bool checkIfFirstPerson(float ___m_distance)
		{
			if ((double)___m_distance <= 0.0)
			{
				return true;
			}
			return false;
		}

		public static void Postfix(GameCamera __instance, ref Vector3 pos, ref float ___m_distance)
		{
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			Player localPlayer = Player.m_localPlayer;
			if (!CustomizableCamera.isEnabled.Value || !Object.op_Implicit((Object)(object)__instance) || !Object.op_Implicit((Object)(object)localPlayer))
			{
				return;
			}
			CustomizeableCameraBase.isFirstPerson = checkIfFirstPerson(___m_distance);
			setValuesBasedOnCharacterState(localPlayer, CustomizeableCameraBase.isFirstPerson);
			if (CustomizeableCameraBase.characterAiming)
			{
				CustomizableCamera.targetFOVHasBeenReached = checkBowZoomFOVLerpDuration(__instance, ((Humanoid)localPlayer).GetAttackDrawPercentage());
				if (!CustomizableCamera.targetFOVHasBeenReached)
				{
					moveToNewCameraFOVBowZoom(__instance, CustomizableCamera.targetFOV, ((Humanoid)localPlayer).GetAttackDrawPercentage(), CustomizableCamera.timeBowZoomInterpolationType.Value);
				}
			}
			else
			{
				CustomizableCamera.targetFOVHasBeenReached = checkFOVLerpDuration(__instance, CustomizableCamera.timeFOV);
				if (!CustomizableCamera.targetFOVHasBeenReached)
				{
					if (CustomizeableCameraBase.characterStateChanged)
					{
						CustomizableCamera.timeFOV = 0f;
					}
					else
					{
						CustomizableCamera.timeFOV += Time.deltaTime;
					}
					moveToNewCameraFOV(__instance, CustomizableCamera.targetFOV, CustomizableCamera.timeFOV);
				}
			}
			if (CustomizeableCameraBase.isFirstPerson)
			{
				return;
			}
			if (CustomizableCamera.cameraLockedBoatYEnabled.Value && CustomizeableCameraBase.characterControlledShip)
			{
				pos.y = CustomizableCamera.cameraLockedBoatY.Value;
			}
			CustomizableCamera.targetPosHasBeenReached = checkCameraLerpDuration(__instance, CustomizableCamera.timeCameraPos);
			if (!CustomizableCamera.targetPosHasBeenReached)
			{
				if (CustomizeableCameraBase.characterStateChanged)
				{
					CustomizableCamera.timeCameraPos = 0f;
				}
				else
				{
					CustomizableCamera.timeCameraPos += Time.deltaTime;
				}
				moveToNewCameraPosition(__instance, CustomizableCamera.targetPos, CustomizableCamera.timeCameraPos);
			}
		}
	}
	[HarmonyPatch(typeof(Hud), "UpdateCrosshair")]
	public class Hud_UpdateCrosshair_Patch : CustomizeableCameraBase
	{
		public static bool targetCrosshairHasBeenReached;

		public static float timeDuration = CustomizableCamera.timeCameraPosDuration.Value;

		public static float timePos = 0f;

		public static bool crosshairStateChanged;

		public static characterState crosshairStatePrev = characterState.standing;

		public static characterState crosshairState = characterState.standing;

		private static bool checkLerpDuration(float timeElapsed)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (CustomizableCamera.lastSetCrosshairPos == CustomizableCamera.targetCrosshairPos || timeElapsed >= timeDuration)
			{
				timePos = 0f;
				return true;
			}
			return false;
		}

		private static void moveToNewCrosshairPosition(Hud __instance, float time)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_002d: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_0095: 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)
			//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_00bc: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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)
			((Component)__instance.m_crosshair).transform.position = Vector3.Lerp(CustomizableCamera.lastSetCrosshairPos, CustomizableCamera.targetCrosshairPos, time);
			((Component)__instance.m_crosshairBow).transform.position = Vector3.Lerp(CustomizableCamera.lastSetCrosshairPos, CustomizableCamera.targetCrosshairPos, time);
			__instance.m_hidden.transform.position = Vector3.Lerp(CustomizableCamera.lastSetCrosshairPos, CustomizableCamera.targetCrosshairPos, time);
			__instance.m_targeted.transform.position = Vector3.Lerp(CustomizableCamera.lastSetCrosshairPos, CustomizableCamera.targetCrosshairPos, time);
			__instance.m_targetedAlert.transform.position = Vector3.Lerp(CustomizableCamera.lastSetCrosshairPos, CustomizableCamera.targetCrosshairPos, time);
			((Component)__instance.m_stealthBar).transform.position = Vector3.Lerp(CustomizableCamera.lastSetStealthBarPos, CustomizableCamera.targetStealthBarPos, time);
			CustomizableCamera.lastSetCrosshairPos = ((Component)__instance.m_crosshair).transform.position;
			CustomizableCamera.lastSetStealthBarPos = ((Component)__instance.m_crosshairBow).transform.position;
		}

		private static void setTargetPositions()
		{
			//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_009e: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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)
			if (crosshairState == characterState.bowequipped)
			{
				CustomizableCamera.targetCrosshairPos = new Vector3(CustomizableCamera.playerInitialCrosshairX + CustomizableCamera.playerBowCrosshairX.Value, CustomizableCamera.playerInitialCrosshairY + CustomizableCamera.playerBowCrosshairY.Value, 0f);
				CustomizableCamera.targetStealthBarPos = new Vector3(CustomizableCamera.playerInitialStealthBarX + CustomizableCamera.playerBowCrosshairX.Value, CustomizableCamera.playerInitialStealthBarY + CustomizableCamera.playerBowCrosshairY.Value * 3f, 0f);
			}
			else
			{
				CustomizableCamera.targetCrosshairPos = new Vector3(CustomizableCamera.playerInitialCrosshairX, CustomizableCamera.playerInitialCrosshairY, 0f);
				CustomizableCamera.targetStealthBarPos = new Vector3(CustomizableCamera.playerInitialStealthBarX, CustomizableCamera.playerInitialStealthBarY, 0f);
			}
		}

		private static void setCrosshairState()
		{
			crosshairStatePrev = crosshairState;
			if ((CustomizeableCameraBase.characterAiming || CustomizeableCameraBase.characterEquippedBow) && !CustomizeableCameraBase.isFirstPerson)
			{
				crosshairState = characterState.bowequipped;
			}
			else
			{
				crosshairState = characterState.standing;
			}
			if (crosshairState != crosshairStatePrev)
			{
				timePos = 0f;
				crosshairStateChanged = true;
				crosshairStatePrev = crosshairState;
			}
			else
			{
				crosshairStateChanged = false;
			}
		}

		public static void Postfix(Hud __instance)
		{
			if (CustomizableCamera.isEnabled.Value && Object.op_Implicit((Object)(object)__instance) && CustomizableCamera.playerBowCrosshairEditsEnabled.Value)
			{
				setCrosshairState();
				setTargetPositions();
				targetCrosshairHasBeenReached = checkLerpDuration(timePos);
				if (!targetCrosshairHasBeenReached)
				{
					timePos += Time.deltaTime;
					moveToNewCrosshairPosition(__instance, timePos / CustomizableCamera.timeCameraPosDuration.Value);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Player), "StartDoodadControl")]
	public class Player_StartShipControl_Patch : CustomizeableCameraBase
	{
		public static void Postfix(Player __instance)
		{
			if (CustomizableCamera.isEnabled.Value && Object.op_Implicit((Object)(object)__instance))
			{
				CustomizeableCameraBase.characterControlledShip = true;
				CustomizeableCameraBase.characterStoppedShipControl = false;
				CustomizeableCameraBase.canChangeCameraDistance = true;
			}
		}
	}
	[HarmonyPatch(typeof(Player), "StopDoodadControl")]
	public class Player_StopShipControl_Patch : CustomizeableCameraBase
	{
		public static void Postfix(Player __instance)
		{
			if (CustomizableCamera.isEnabled.Value && Object.op_Implicit((Object)(object)__instance))
			{
				CustomizeableCameraBase.characterControlledShip = false;
				CustomizeableCameraBase.characterStoppedShipControl = true;
				CustomizeableCameraBase.canChangeCameraDistance = true;
			}
		}
	}
	[BepInPlugin("manfredo52.CustomizableCamera", "Customizable Camera Mod", "1.3.4")]
	[BepInProcess("valheim.exe")]
	public class CustomizableCamera : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(GameCamera), "Awake")]
		public static class GameCamera_Awake_Patch
		{
			public static void Postfix(GameCamera __instance, ref float ___m_distance, ref float ___m_zoomSens)
			{
				if (isEnabled.Value)
				{
					setMiscCameraSettings(__instance);
					___m_distance = cameraDistance.Value;
					___m_zoomSens = cameraZoomSensitivity.Value;
					CustomizeableCameraBase.cameraZoomSensitivityTemp = cameraZoomSensitivity.Value;
				}
			}
		}

		[HarmonyPatch(typeof(GameCamera), "ApplySettings")]
		public static class GameCamera_ApplySettings_Patch
		{
			public static void Postfix(GameCamera __instance)
			{
				if (isEnabled.Value)
				{
					setMiscCameraSettings(__instance);
				}
			}
		}

		[HarmonyPatch(typeof(Hud), "Awake")]
		public static class Hud_CrosshairAwake_Patch
		{
			public static void Postfix(Hud __instance)
			{
				//IL_000c: 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_0040: 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_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: 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_009e: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				playerInitialCrosshairX = ((Component)__instance.m_crosshair).transform.position.x;
				playerInitialCrosshairY = ((Component)__instance.m_crosshair).transform.position.y;
				playerInitialStealthBarX = ((Component)__instance.m_stealthBar).transform.position.x;
				playerInitialStealthBarY = ((Component)__instance.m_stealthBar).transform.position.y;
				lastSetCrosshairPos = ((Component)__instance.m_crosshair).transform.position;
				lastSetStealthBarPos = ((Component)__instance.m_stealthBar).transform.position;
				targetCrosshairPos = ((Component)__instance.m_crosshair).transform.position;
				targetStealthBarPos = ((Component)__instance.m_stealthBar).transform.position;
			}
		}

		[HarmonyPatch(typeof(PlayerController), "Awake")]
		public static class PlayerController_SetSensAwake_Patch
		{
			public static void Postfix()
			{
				playerMouseSensitivity = PlayerPrefs.GetFloat("MouseSensitivity", PlayerController.m_mouseSens);
			}
		}

		public static ConfigEntry<bool> isEnabled;

		public static ConfigEntry<int> nexusID;

		public static float defaultValue = 0f;

		public static int defaultCameraDistance = 4;

		public static int defaultCameraMaxDistance = 8;

		public static int defaultCameraMaxDistanceBoat = 16;

		public static int defaultZoomSensitivity = 10;

		public static float defaultSmoothness = 0.1f;

		public static float defaultFOV = 65f;

		public static float defaultFPFOV = 65f;

		public static float defaultBowZoomFOV = 55f;

		public static float defaultBowZoomFPFOV = 55f;

		public static float defaultTimeDuration = 5f;

		public static float defaultBowZoomTimeDuration = 3f;

		public static Vector3 defaultPosition = new Vector3(0.25f, 0.25f, 0f);

		public static float smoothZoomSpeed = 3f;

		public static float playerMouseSensitivity;

		public static ConfigEntry<bool> bowZoomSensitivityEnabled;

		public static ConfigEntry<float> bowZoomSensitivity;

		public static float playerInitialCrosshairX;

		public static float playerInitialCrosshairY;

		public static Vector3 lastSetCrosshairPos;

		public static Vector3 lastSetStealthBarPos;

		public static Vector3 targetCrosshairPos;

		public static Vector3 targetStealthBarPos;

		public static float playerInitialStealthBarX;

		public static float playerInitialStealthBarY;

		public static ConfigEntry<bool> playerBowCrosshairEditsEnabled;

		public static ConfigEntry<float> playerBowCrosshairX;

		public static ConfigEntry<float> playerBowCrosshairY;

		public static ConfigEntry<float> cameraFOV;

		public static ConfigEntry<float> cameraX;

		public static ConfigEntry<float> cameraY;

		public static ConfigEntry<float> cameraZ;

		public static ConfigEntry<bool> bowZoomFirstPersonEnabled;

		public static ConfigEntry<float> cameraFirstPersonFOV;

		public static ConfigEntry<float> cameraBowZoomFirstPersonFOV;

		public static ConfigEntry<float> cameraSneakFOV;

		public static ConfigEntry<float> cameraSneakX;

		public static ConfigEntry<float> cameraSneakY;

		public static ConfigEntry<float> cameraSneakZ;

		public static ConfigEntry<float> cameraSprintFOV;

		public static ConfigEntry<float> cameraSprintX;

		public static ConfigEntry<float> cameraSprintY;

		public static ConfigEntry<float> cameraSprintZ;

		public static ConfigEntry<float> cameraWalkFOV;

		public static ConfigEntry<float> cameraWalkX;

		public static ConfigEntry<float> cameraWalkY;

		public static ConfigEntry<float> cameraWalkZ;

		public static ConfigEntry<float> cameraBoatFOV;

		public static ConfigEntry<float> cameraBoatX;

		public static ConfigEntry<float> cameraBoatY;

		public static ConfigEntry<float> cameraBoatZ;

		public static ConfigEntry<bool> cameraLockedBoatYEnabled;

		public static ConfigEntry<float> cameraLockedBoatY;

		public static ConfigEntry<bool> cameraBowSettingsEnabled;

		public static ConfigEntry<float> cameraBowX;

		public static ConfigEntry<float> cameraBowY;

		public static ConfigEntry<float> cameraBowZ;

		public static ConfigEntry<bool> bowZoomEnabled;

		public static ConfigEntry<bool> bowZoomOnDraw;

		public static ConfigEntry<bool> bowZoomKeyToggle;

		public static ConfigEntry<KeyboardShortcut> bowZoomKey;

		public static ConfigEntry<KeyboardShortcut> bowCancelDrawKey;

		public static ConfigEntry<float> cameraBowZoomFOV;

		public static ConfigEntry<float> timeFOVDuration;

		public static ConfigEntry<float> timeBowZoomFOVDuration;

		public static ConfigEntry<CustomizeableCameraBase.interpolationTypes> timeBowZoomInterpolationType;

		public static ConfigEntry<float> timeCameraPosDuration;

		public static ConfigEntry<float> cameraSmoothness;

		public static ConfigEntry<float> cameraZoomSensitivity;

		public static ConfigEntry<KeyboardShortcut> swapShoulderViewKey;

		public static ConfigEntry<bool> smoothZoomEnabled;

		public static ConfigEntry<float> cameraDistance;

		public static ConfigEntry<float> cameraDistanceBoat;

		public static ConfigEntry<bool> cameraDistanceBoatEnabled;

		public static ConfigEntry<bool> cameraDistanceExteriorsEnabled;

		public static ConfigEntry<float> cameraDistanceInteriors;

		public static ConfigEntry<bool> cameraDistanceInteriorsEnabled;

		public static ConfigEntry<float> cameraDistanceShelter;

		public static ConfigEntry<bool> cameraDistanceShelterEnabled;

		public static ConfigEntry<float> cameraMaxDistance;

		public static ConfigEntry<float> cameraMaxDistanceBoat;

		public static float timeFOV = 0f;

		public static float targetFOV;

		public static float lastSetFOV;

		public static bool targetFOVHasBeenReached;

		public static float timeCameraPos = 0f;

		public static Vector3 targetPos;

		public static Vector3 lastSetPos;

		public static bool targetPosHasBeenReached;

		public void Awake()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Expected O, but got Unknown
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Expected O, but got Unknown
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Expected O, but got Unknown
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Expected O, but got Unknown
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Expected O, but got Unknown
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Expected O, but got Unknown
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Expected O, but got Unknown
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Expected O, but got Unknown
			//IL_0855: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c1: Expected O, but got Unknown
			//IL_08e0: Unknown result type (might be due to invalid IL or missing references)
			isEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("- General -", "Enable Mod", true, "Enable or disable the mod");
			nexusID = ((BaseUnityPlugin)this).Config.Bind<int>("- General -", "NexusID", 396, "Nexus mod ID for updates");
			cameraSmoothness = ((BaseUnityPlugin)this).Config.Bind<float>("- Misc -", "cameraSmoothness", defaultSmoothness, new ConfigDescription("Camera smoothing. Determines how smoothly/quickly the camera will follow your player.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 20f), Array.Empty<object>()));
			cameraZoomSensitivity = ((BaseUnityPlugin)this).Config.Bind<float>("- Misc -", "cameraZoomSensitivity", (float)defaultZoomSensitivity, new ConfigDescription("How much the camera zooms in or out when changing camera distance with the scroll wheel. Takes effect on game restart.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 25f), Array.Empty<object>()));
			swapShoulderViewKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("- Misc -", "swapShoulderViewKey", new KeyboardShortcut((KeyCode)98, Array.Empty<KeyCode>()), "Keyboard shortcut or mouse button to swap shoulder views.");
			smoothZoomEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("- Misc -", "smoothZoomEnabled", true, "Enable if the zooming in and out to be smooth instead of an instant change.");
			cameraDistance = ((BaseUnityPlugin)this).Config.Bind<float>("- Misc Camera Distance -", "cameraDistance", (float)defaultCameraDistance, new ConfigDescription("Default camera distance from the player.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			cameraDistanceBoat = ((BaseUnityPlugin)this).Config.Bind<float>("- Misc Camera Distance -", "cameraDistanceBoat", (float)defaultCameraDistance, new ConfigDescription("Default camera distance when you start control of a ship.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			cameraDistanceBoatEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("- Misc Camera Distance -", "cameraDistanceBoatEnabled", false, "Enable separate distance edit for boats.");
			cameraDistanceInteriors = ((BaseUnityPlugin)this).Config.Bind<float>("- Misc Camera Distance -", "cameraDistanceInteriors", (float)defaultCameraDistance, new ConfigDescription("Default camera distance when you go into an interior such as a dungeon.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			cameraDistanceInteriorsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("- Misc Camera Distance -", "cameraDistanceInteriorsEnabled", false, "Enable separate distance edit for interiors.");
			cameraDistanceExteriorsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("- Misc Camera Distance -", "cameraDistanceExteriorsEnabled", false, "Enable separate distance edit for exteriors. Uses cameraDistance value. This is used if you want to automatically go to the set camera distance when you move to an exterior.");
			cameraDistanceShelter = ((BaseUnityPlugin)this).Config.Bind<float>("- Misc Camera Distance -", "cameraDistanceShelter", (float)defaultCameraDistance, new ConfigDescription("Default camera distance when you are under shelter.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			cameraDistanceShelterEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("- Misc Camera Distance -", "cameraDistanceShelterEnabled", false, "Enable separate distance edit for shelter.");
			cameraMaxDistance = ((BaseUnityPlugin)this).Config.Bind<float>("- Misc Camera Distance -", "cameraMaxDistance", (float)defaultCameraMaxDistance, new ConfigDescription("Maximum distance you can zoom out.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100f), Array.Empty<object>()));
			cameraMaxDistanceBoat = ((BaseUnityPlugin)this).Config.Bind<float>("- Misc Camera Distance -", "cameraMaxDistanceBoat", (float)defaultCameraMaxDistanceBoat, new ConfigDescription("Maximum distance you can zoom out when on a boat.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100f), Array.Empty<object>()));
			timeFOVDuration = ((BaseUnityPlugin)this).Config.Bind<float>("- Misc Time Values -", "timeFOVDuration", defaultTimeDuration, new ConfigDescription("How quickly the fov changes.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.001f, 50f), Array.Empty<object>()));
			timeBowZoomFOVDuration = ((BaseUnityPlugin)this).Config.Bind<float>("- Misc Time Values -", "timeBowZoomFOVDuration", defaultBowZoomTimeDuration, new ConfigDescription("How quickly the bow zooms in.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.001f, 50f), Array.Empty<object>()));
			timeBowZoomInterpolationType = ((BaseUnityPlugin)this).Config.Bind<CustomizeableCameraBase.interpolationTypes>("- Misc Time Values -", "timeBowZoomInterpolationType", CustomizeableCameraBase.interpolationTypes.Linear, new ConfigDescription("Interpolation method for the bow zoom.", (AcceptableValueBase)null, Array.Empty<object>()));
			timeCameraPosDuration = ((BaseUnityPlugin)this).Config.Bind<float>("- Misc Time Values -", "timeCameraPosDuration", defaultTimeDuration, new ConfigDescription("How quickly the camera moves to the new camera position", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.001f, 50f), Array.Empty<object>()));
			cameraFOV = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings", "cameraFOV", defaultFOV, "The camera fov.");
			cameraX = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings", "cameraX", defaultPosition.x, "The third person camera x position.");
			cameraY = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings", "cameraY", defaultPosition.y, "The third person camera y position.");
			cameraZ = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings", "cameraZ", defaultPosition.z, "The third person camera z position.");
			cameraSneakFOV = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Sneak", "cameraSneakFOV", defaultFOV, "Camera fov when sneaking.");
			cameraSneakX = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Sneak", "cameraSneakX", defaultPosition.x, "Camera X position when sneaking.");
			cameraSneakY = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Sneak", "cameraSneakY", defaultPosition.y, "Camera Y position when sneaking.");
			cameraSneakZ = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Sneak", "cameraSneakZ", defaultPosition.z, "Camera Z position when sneaking.");
			cameraSprintFOV = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Sprinting", "cameraSprintFOV", defaultFOV, "Camera fov when sprinting.");
			cameraSprintX = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Sprinting", "cameraSprintX", defaultPosition.x, "Camera X position when sprinting.");
			cameraSprintY = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Sprinting", "cameraSprintY", defaultPosition.y, "Camera Y position when sprinting.");
			cameraSprintZ = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Sprinting", "cameraSprintZ", defaultPosition.z, "Camera Z position when sprinting.");
			cameraWalkFOV = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Walk", "cameraWalkFOV", defaultFOV, "Camera fov when walking.");
			cameraWalkX = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Walk", "cameraWalkX", defaultPosition.x, "Camera X position when walking.");
			cameraWalkY = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Walk", "cameraWalkY", defaultPosition.y, "Camera Y position when walking.");
			cameraWalkZ = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Walk", "cameraWalkZ", defaultPosition.z, "Camera Z position when walking.");
			cameraBoatFOV = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Boat", "cameraBoatFOV", defaultFOV, "Camera fov when sailing.");
			cameraBoatX = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Boat", "cameraBoatX", defaultPosition.x, "Camera X position when sailing.");
			cameraBoatY = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Boat", "cameraBoatY", defaultPosition.y, "Camera Y position when sailing.");
			cameraBoatZ = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Boat", "cameraBoatZ", defaultPosition.z, "Camera Z position when sailing.");
			cameraLockedBoatYEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera Settings - Boat", "cameraLockedBoatYEnabled", false, "Enable or disable the y axis being locked to a specific value when sailing. Reduces motion sickness.");
			cameraLockedBoatY = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Boat", "cameraLockedBoatY", 33f, "The y axis value that the camera should be locked to when enabled. Clipping with the ocean/waves can occur if set too low.");
			cameraBowSettingsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera Settings - Bow", "bowSettingsEnable", false, "Enable or disable if there should be separate camera settings when holding a bow.");
			cameraBowX = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Bow", "cameraBowX", defaultPosition.x, "Camera X position when holding a bow.");
			cameraBowY = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Bow", "cameraBowY", defaultPosition.y, "Camera Y position when holding a bow.");
			cameraBowZ = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Bow", "cameraBowZ", defaultPosition.z, "Camera Z position when holding a bow.");
			bowZoomEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera Settings - Bow Zoom", "bowZoomEnable", false, "Enable or disable bow zoom");
			bowZoomOnDraw = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera Settings - Bow Zoom", "bowZoomOnDraw", true, "Zoom in automatically when drawing the bow.");
			bowZoomKeyToggle = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera Settings - Bow Zoom", "bowZoomKeyToggle", true, "Zoom key toggles zoom if enabled, otherwise hold the zoom key.");
			bowZoomKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Camera Settings - Bow Zoom", "bowZoomKey", new KeyboardShortcut((KeyCode)324, Array.Empty<KeyCode>()), "Keyboard shortcut or mouse button for zooming in with the bow.");
			bowZoomSensitivityEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera Settings - Bow Zoom", "bowZoomSensitivityEnable", false, "Enable or disable bow zoom sensitivity.");
			bowZoomSensitivity = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Bow Zoom", "bowZoomSensitivity", 0.5f, new ConfigDescription("Mouse sensitivity multiplier when zooming in with the bow.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			bowCancelDrawKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Camera Settings - Bow Zoom", "bowCancelDrawKey", new KeyboardShortcut((KeyCode)327, Array.Empty<KeyCode>()), "Keyboard shortcut or mouse button to cancel bow draw. This is only necessary when your zoom key interferes with the block key.");
			cameraBowZoomFOV = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - Bow Zoom", "cameraBowZoomFOV", defaultBowZoomFOV, "FOV when zooming in with the bow.");
			bowZoomFirstPersonEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera Settings - First Person Mod Compatibility", "bowZoomFirstPersonEnable", false, "Enable or disable bow zoom when in first person. Ensures compatibility with first person mods.");
			cameraFirstPersonFOV = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - First Person Mod Compatibility", "cameraFirstPersonFOV", defaultFPFOV, "The camera fov when you are in first person. This is only used to ensure compatibility for first person mods and first person bow zoom.");
			cameraBowZoomFirstPersonFOV = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings - First Person Mod Compatibility", "cameraBowZoomFirstPersonFOV", defaultBowZoomFPFOV, "FOV when zooming in with the bow when in first person.");
			playerBowCrosshairEditsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Crosshair Settings", "bowCrosshairEditsEnable", true, "Enable or disable crosshair edits when using a bow.");
			playerBowCrosshairX = ((BaseUnityPlugin)this).Config.Bind<float>("Crosshair Settings", "bowCrosshairX", defaultValue, "Bow crosshair x position.");
			playerBowCrosshairY = ((BaseUnityPlugin)this).Config.Bind<float>("Crosshair Settings", "bowCrosshairY", defaultValue, "Bow crosshair y position.");
			DoPatching();
		}

		private static void setMiscCameraSettings(GameCamera __instance)
		{
			__instance.m_smoothness = cameraSmoothness.Value;
			__instance.m_maxDistance = cameraMaxDistance.Value;
			__instance.m_maxDistanceBoat = cameraMaxDistanceBoat.Value;
		}

		public static void DoPatching()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("CustomizableCamera").PatchAll();
		}
	}
}