Decompiled source of Camera Additions v1.2.6

CameraAdditions.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
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: AssemblyTitle("CameraAdditions")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CameraAdditions")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c6fd29f0-a888-4b3b-8107-2a1bde68b381")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace CameraAdditions
{
	[BepInPlugin("Distance.CameraAdditions", "Camera Additions", "1.2.6")]
	public sealed class Mod : BaseUnityPlugin
	{
		private const string modGUID = "Distance.CameraAdditions";

		private const string modName = "Camera Additions";

		private const string modVersion = "1.2.6";

		public static string DecreaseFOVShortcutKey = "The Decrease FOV Shortcut";

		public static string DecreaseXShortcutKey = "The Decrease X Offset Shortcut";

		public static string DecreaseYShortcutKey = "The Decrease Y Offset Shortcut";

		public static string DecreaseZShortcutKey = "The Decrease Z or Zoom Offset Shortcut";

		public static string DefaultShortcutKey = "The Shortcut that sets all values to their Defaults";

		public static string EnableFreeCamKey = "Enable Free Cam";

		public static string EnableRotationShortcutKey = "The Shortcut that toggles whether the offset shortcuts affect rotation";

		public static string FOVKey = "The Locked FOV Value";

		public static string FOVOffsetKey = "The current FOV Offset";

		public static string IncreaseFOVShortcutKey = "The Increase FOV Shortcut";

		public static string IncreaseXShortcutKey = "The Increase X Offset Shortcut";

		public static string IncreaseYShortcutKey = "The Increase Y Offset Shortcut";

		public static string IncreaseZShortcutKey = "The Increase Z or Zoom Offset Shortcut";

		public static string LockPositionKey = "Lock the Cameras Position";

		public static string LockFOVKey = "Lock the Cameras FOV";

		public static string XOffsetKey = "The Offset of the Position on the X axis";

		public static string XRotationOffsetKey = "The Offset of the Rotation on the X axis";

		public static string YOffsetKey = "The Offset of the Position on the Y axis";

		public static string YRotationOffsetKey = "The Offset of the Rotation on the Y axis";

		public static string ZoomOffsetKey = "The Offset of the Cameras Zoom";

		public static string ZRotationOffsetKey = "The Offset of the Rotation on the Z axis";

		private bool defaultWasFired;

		private bool rotationWasFired;

		private bool shortcutsAffectRotation;

		private static readonly Harmony harmony = new Harmony("Distance.CameraAdditions");

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

		public static Mod Instance;

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

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

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

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

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

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

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

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

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

		public static ConfigEntry<int> FOV { get; set; }

		public static ConfigEntry<int> FOVOffset { get; set; }

		public static ConfigEntry<KeyboardShortcut> DecreaseFOVShortcut { get; set; }

		public static ConfigEntry<KeyboardShortcut> DecreaseXOffsetShortcut { get; set; }

		public static ConfigEntry<KeyboardShortcut> DecreaseYOffsetShortcut { get; set; }

		public static ConfigEntry<KeyboardShortcut> DecreaseZOffsetShortcut { get; set; }

		public static ConfigEntry<KeyboardShortcut> DefaultsShortcut { get; set; }

		public static ConfigEntry<KeyboardShortcut> EnableRotationShortcut { get; set; }

		public static ConfigEntry<KeyboardShortcut> IncreaseFOVShortcut { get; set; }

		public static ConfigEntry<KeyboardShortcut> IncreaseXOffsetShortcut { get; set; }

		public static ConfigEntry<KeyboardShortcut> IncreaseYOffsetShortcut { get; set; }

		public static ConfigEntry<KeyboardShortcut> IncreaseZOffsetShortcut { get; set; }

		public float maxDistanceLowSpeed { get; private set; }

		public float maxDistanceHighSpeed { get; private set; }

		public float minDistance { get; private set; }

		public float height { get; private set; }

		public float yOffset { get; }

		public float xOffset { get; }

		private void Awake()
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: 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_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Expected O, but got Unknown
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Expected O, but got Unknown
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Expected O, but got Unknown
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Expected O, but got Unknown
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Expected O, but got Unknown
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Expected O, but got Unknown
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Expected O, but got Unknown
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Expected O, but got Unknown
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Expected O, but got Unknown
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Expected O, but got Unknown
			//IL_03df: 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_03fa: Expected O, but got Unknown
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Expected O, but got Unknown
			//IL_0461: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Expected O, but got Unknown
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Expected O, but got Unknown
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Log = Logger.CreateLogSource("Distance.CameraAdditions");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Thanks for using Camera Additions!");
			maxDistanceLowSpeed = 4.5f;
			maxDistanceHighSpeed = 3.25f;
			minDistance = 4f;
			height = 1.3f;
			EnableFreeCam = ((BaseUnityPlugin)this).Config.Bind<bool>("General", EnableFreeCamKey, false, new ConfigDescription("Make Free Cam an available camera while playing (Will not apply until outside gameplay)", (AcceptableValueBase)null, new object[0]));
			LockCameraPosition = ((BaseUnityPlugin)this).Config.Bind<bool>("General", LockPositionKey, false, new ConfigDescription("Lock the cameras position when in Chase Cam mode", (AcceptableValueBase)null, new object[0]));
			FOVOffset = ((BaseUnityPlugin)this).Config.Bind<int>("General", FOVOffsetKey, 0, new ConfigDescription("Adjust the offset of the FOV (Affects all cameras)", (AcceptableValueBase)null, new object[0]));
			LockFOV = ((BaseUnityPlugin)this).Config.Bind<bool>("General", LockFOVKey, false, new ConfigDescription("Lock the FOV of Chase Cam mode", (AcceptableValueBase)null, new object[0]));
			FOV = ((BaseUnityPlugin)this).Config.Bind<int>("General", FOVKey, 125, new ConfigDescription("Adjust the FOV of Chase Cam mode (Affective only when LOCK FOV is toggled on)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 180), new object[0]));
			XOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Position Offsets", XOffsetKey, 0f, new ConfigDescription("Adjust the X axis offset of all Car Camera Modes", (AcceptableValueBase)null, new object[0]));
			YOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Position Offsets", YOffsetKey, 0f, new ConfigDescription("Adjust the Y axis offset of all Car Camera Modes", (AcceptableValueBase)null, new object[0]));
			ZoomOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Position Offsets", ZoomOffsetKey, 0f, new ConfigDescription("Adjust the Z axis offset of all Car Camera Modes (For the Chase Camera it affects the Zoom, not the Z axis)", (AcceptableValueBase)null, new object[0]));
			XRotationOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Rotation Offsets", XRotationOffsetKey, 0f, new ConfigDescription("Adjust the X rotational offset of all Car Camera Modes", (AcceptableValueBase)null, new object[0]));
			YRotationOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Rotation Offsets", YRotationOffsetKey, 0f, new ConfigDescription("Adjust the Y rotational offset of all Car Camera Modes", (AcceptableValueBase)null, new object[0]));
			ZRotationOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Rotation Offsets", ZRotationOffsetKey, 0f, new ConfigDescription("Adjust the Z rotational offset of all Car Camera Modes", (AcceptableValueBase)null, new object[0]));
			DefaultsShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Shortcuts", DefaultShortcutKey, new KeyboardShortcut((KeyCode)108, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), new ConfigDescription("Set the shortcut for setting all values to default", (AcceptableValueBase)null, new object[0]));
			EnableRotationShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Shortcuts", EnableRotationShortcutKey, new KeyboardShortcut((KeyCode)117, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), new ConfigDescription("Set the shortcut toggling if the offset shortcuts affect rotation", (AcceptableValueBase)null, new object[0]));
			IncreaseFOVShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Shortcuts", IncreaseFOVShortcutKey, new KeyboardShortcut((KeyCode)112, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), new ConfigDescription("Set the shortcut for increasing the FOV value", (AcceptableValueBase)null, new object[0]));
			DecreaseFOVShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Shortcuts", DecreaseFOVShortcutKey, new KeyboardShortcut((KeyCode)111, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), new ConfigDescription("Set the shortcut for decreasing the FOV value", (AcceptableValueBase)null, new object[0]));
			IncreaseXOffsetShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Shortcuts", IncreaseXShortcutKey, new KeyboardShortcut((KeyCode)108, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), new ConfigDescription("Set the shortcut increasing the X Offset", (AcceptableValueBase)null, new object[0]));
			DecreaseXOffsetShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Shortcuts", DecreaseXShortcutKey, new KeyboardShortcut((KeyCode)106, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), new ConfigDescription("Set the shortcut decreasing the X Offset", (AcceptableValueBase)null, new object[0]));
			IncreaseYOffsetShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Shortcuts", IncreaseYShortcutKey, new KeyboardShortcut((KeyCode)105, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), new ConfigDescription("Set the shortcut increasing the Y Offset", (AcceptableValueBase)null, new object[0]));
			DecreaseYOffsetShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Shortcuts", DecreaseYShortcutKey, new KeyboardShortcut((KeyCode)107, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), new ConfigDescription("Set the shortcut decreasing the Y Offset", (AcceptableValueBase)null, new object[0]));
			IncreaseZOffsetShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Shortcuts", IncreaseZShortcutKey, new KeyboardShortcut((KeyCode)110, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), new ConfigDescription("Set the shortcut increasing the Z Offset", (AcceptableValueBase)null, new object[0]));
			DecreaseZOffsetShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Shortcuts", DecreaseZShortcutKey, new KeyboardShortcut((KeyCode)109, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), new ConfigDescription("Set the shortcut decreasing the Z Offset", (AcceptableValueBase)null, new object[0]));
			DecreaseFOVShortcut.SettingChanged += OnConfigChanged;
			DecreaseXOffsetShortcut.SettingChanged += OnConfigChanged;
			DecreaseYOffsetShortcut.SettingChanged += OnConfigChanged;
			DecreaseZOffsetShortcut.SettingChanged += OnConfigChanged;
			DefaultsShortcut.SettingChanged += OnConfigChanged;
			EnableFreeCam.SettingChanged += OnConfigChanged;
			EnableRotationShortcut.SettingChanged += OnConfigChanged;
			FOV.SettingChanged += OnConfigChanged;
			FOVOffset.SettingChanged += OnConfigChanged;
			IncreaseFOVShortcut.SettingChanged += OnConfigChanged;
			IncreaseXOffsetShortcut.SettingChanged += OnConfigChanged;
			IncreaseYOffsetShortcut.SettingChanged += OnConfigChanged;
			IncreaseZOffsetShortcut.SettingChanged += OnConfigChanged;
			LockCameraPosition.SettingChanged += OnConfigChanged;
			LockFOV.SettingChanged += OnConfigChanged;
			XOffset.SettingChanged += OnConfigChanged;
			YOffset.SettingChanged += OnConfigChanged;
			ZoomOffset.SettingChanged += OnConfigChanged;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading...");
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded!");
		}

		private void Update()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_0084: 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_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)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: 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_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			if (!Input.anyKey)
			{
				return;
			}
			KeyboardShortcut value = DefaultsShortcut.Value;
			if (((KeyboardShortcut)(ref value)).IsDown())
			{
				SetDefaults();
			}
			value = EnableRotationShortcut.Value;
			if (((KeyboardShortcut)(ref value)).IsDown())
			{
				shortcutsAffectRotation = !shortcutsAffectRotation;
			}
			value = IncreaseFOVShortcut.Value;
			if (((KeyboardShortcut)(ref value)).IsPressed())
			{
				ConfigEntry<int> fOVOffset = FOVOffset;
				int value2 = fOVOffset.Value;
				fOVOffset.Value = value2 + 1;
			}
			value = DecreaseFOVShortcut.Value;
			if (((KeyboardShortcut)(ref value)).IsPressed())
			{
				ConfigEntry<int> fOVOffset2 = FOVOffset;
				int value2 = fOVOffset2.Value;
				fOVOffset2.Value = value2 - 1;
			}
			value = IncreaseXOffsetShortcut.Value;
			if (((KeyboardShortcut)(ref value)).IsPressed())
			{
				if (!shortcutsAffectRotation)
				{
					ConfigEntry<float> obj = XOffset;
					obj.Value += 0.25f;
				}
				else
				{
					ConfigEntry<float> xRotationOffset = XRotationOffset;
					xRotationOffset.Value += 0.5f;
				}
			}
			value = DecreaseXOffsetShortcut.Value;
			if (((KeyboardShortcut)(ref value)).IsPressed())
			{
				if (!shortcutsAffectRotation)
				{
					ConfigEntry<float> obj2 = XOffset;
					obj2.Value -= 0.25f;
				}
				else
				{
					ConfigEntry<float> xRotationOffset2 = XRotationOffset;
					xRotationOffset2.Value -= 0.5f;
				}
			}
			value = IncreaseYOffsetShortcut.Value;
			if (((KeyboardShortcut)(ref value)).IsPressed())
			{
				if (!shortcutsAffectRotation)
				{
					ConfigEntry<float> obj3 = YOffset;
					obj3.Value += 0.25f;
				}
				else
				{
					ConfigEntry<float> yRotationOffset = YRotationOffset;
					yRotationOffset.Value += 0.5f;
				}
			}
			value = DecreaseYOffsetShortcut.Value;
			if (((KeyboardShortcut)(ref value)).IsPressed())
			{
				if (!shortcutsAffectRotation)
				{
					ConfigEntry<float> obj4 = YOffset;
					obj4.Value -= 0.25f;
				}
				else
				{
					ConfigEntry<float> yRotationOffset2 = YRotationOffset;
					yRotationOffset2.Value -= 0.5f;
				}
			}
			value = IncreaseZOffsetShortcut.Value;
			if (((KeyboardShortcut)(ref value)).IsPressed())
			{
				if (!shortcutsAffectRotation)
				{
					ConfigEntry<float> zoomOffset = ZoomOffset;
					zoomOffset.Value += 0.25f;
				}
				else
				{
					ConfigEntry<float> zRotationOffset = ZRotationOffset;
					zRotationOffset.Value += 0.5f;
				}
			}
			value = DecreaseZOffsetShortcut.Value;
			if (((KeyboardShortcut)(ref value)).IsPressed())
			{
				if (!shortcutsAffectRotation)
				{
					ConfigEntry<float> zoomOffset2 = ZoomOffset;
					zoomOffset2.Value -= 0.25f;
				}
				else
				{
					ConfigEntry<float> zRotationOffset2 = ZRotationOffset;
					zRotationOffset2.Value -= 0.5f;
				}
			}
		}

		private void OnConfigChanged(object sender, EventArgs e)
		{
			SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null);
			if (val != null)
			{
			}
		}

		public void SetChaseCamValues(bool isNear)
		{
			if (isNear)
			{
				maxDistanceLowSpeed = 4.5f;
				maxDistanceHighSpeed = 3.25f;
				minDistance = 4f;
				height = 1.3f;
			}
			else
			{
				maxDistanceLowSpeed = 5.625f;
				maxDistanceHighSpeed = 4.0625f;
				minDistance = 4f;
				height = 1.55f;
			}
		}

		private void SetDefaults()
		{
			FOV.Value = 125;
			FOVOffset.Value = 0;
			LockCameraPosition.Value = false;
			LockFOV.Value = false;
			XOffset.Value = 0f;
			XRotationOffset.Value = 0f;
			YOffset.Value = 0f;
			YRotationOffset.Value = 0f;
			ZoomOffset.Value = 0f;
			ZRotationOffset.Value = 0f;
		}
	}
}
namespace CameraAdditions.Patches
{
	[HarmonyPatch(typeof(CarCamera), "IncrementCameraModes")]
	internal static class CarCamera__IncrementCameraModes
	{
		[HarmonyPostfix]
		internal static void SetChaseCamValues(CarCamera __instance)
		{
			if (__instance.userSelectedCameraModeIndex_ == 5)
			{
				Mod.Instance.SetChaseCamValues(isNear: true);
			}
			else if (__instance.userSelectedCameraModeIndex_ == 6)
			{
				Mod.Instance.SetChaseCamValues(isNear: false);
			}
		}
	}
	[HarmonyPatch(typeof(CarCamera), "SetCameraFOV")]
	internal static class CarCamera__SetCameraFOV
	{
		[HarmonyPostfix]
		internal static void FOVPostfix(CarCamera __instance)
		{
			if (__instance.activeCameraMode_ is ChaseCamMode && Mod.LockFOV.Value)
			{
				__instance.fov_ = Mod.FOV.Value;
				__instance.camera_.fieldOfView = Mod.FOV.Value;
			}
			__instance.fov_ += (float)Mod.FOVOffset.Value;
			Camera camera_ = __instance.camera_;
			camera_.fieldOfView += (float)Mod.FOVOffset.Value;
		}
	}
	[HarmonyPatch(typeof(CarCamera), "SetUserSelectedCameraModeIndex")]
	internal static class CarCamera__SetUserSelectedCameraModeIndex
	{
		[HarmonyPostfix]
		internal static void SetChaseCamValues(CarCamera __instance)
		{
			if (__instance.userSelectedCameraModeIndex_ == 5)
			{
				Mod.Instance.SetChaseCamValues(isNear: true);
			}
			else if (__instance.userSelectedCameraModeIndex_ == 6)
			{
				Mod.Instance.SetChaseCamValues(isNear: false);
			}
		}
	}
	[HarmonyPatch(typeof(ChaseCamMode), "CamModeLateUpdate")]
	internal static class ChaseCamMode__CamModeLateUpdate
	{
		[HarmonyPrefix]
		internal static void PositionPrefix(ChaseCamMode __instance)
		{
			float num = ((!(Mod.ZoomOffset.Value < -3f)) ? Mod.ZoomOffset.Value : (-3f));
			__instance.maxDistanceLowSpeed_ = Mod.Instance.maxDistanceLowSpeed + num;
			__instance.maxDistanceHighSpeed_ = Mod.Instance.maxDistanceHighSpeed + num;
			__instance.minDistance_ = Mod.Instance.minDistance + num;
			__instance.height_ = Mod.Instance.height + num / 4.5f;
			if (Mod.LockCameraPosition.Value)
			{
				__instance.maxDistanceLowSpeed_ = __instance.maxDistanceHighSpeed_;
			}
		}

		[HarmonyPostfix]
		internal static void PositionPostfix(ChaseCamMode __instance)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)__instance).transform;
			transform.position += ((Component)__instance).transform.right * Mod.XOffset.Value;
			Transform transform2 = ((Component)__instance).transform;
			transform2.position += ((Component)__instance).transform.up * Mod.YOffset.Value;
			Transform transform3 = ((Component)__instance).transform;
			transform3.rotation *= Quaternion.AngleAxis(Mod.ZRotationOffset.Value, Vector3.forward);
			Transform transform4 = ((Component)__instance).transform;
			transform4.rotation *= Quaternion.AngleAxis(Mod.XRotationOffset.Value, Vector3.right);
			Transform transform5 = ((Component)__instance).transform;
			transform5.rotation *= Quaternion.AngleAxis(Mod.YRotationOffset.Value, Vector3.up);
		}
	}
	[HarmonyPatch(typeof(CockpitCamMode), "CamModeLateUpdate")]
	internal static class CockpitCamMode__CamModeLateUpdate
	{
		[HarmonyPostfix]
		internal static void PositionPostfix(CockpitCamMode __instance)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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_011c: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)__instance).transform;
			transform.position += ((Component)__instance).transform.right * (Mod.XOffset.Value / 10f);
			Transform transform2 = ((Component)__instance).transform;
			transform2.position += ((Component)__instance).transform.up * (Mod.YOffset.Value / 10f);
			Transform transform3 = ((Component)__instance).transform;
			transform3.position += ((Component)__instance).transform.forward * (Mod.ZoomOffset.Value / 10f);
			Transform transform4 = ((Component)__instance).transform;
			transform4.rotation *= Quaternion.AngleAxis(Mod.ZRotationOffset.Value, Vector3.forward);
			Transform transform5 = ((Component)__instance).transform;
			transform5.rotation *= Quaternion.AngleAxis(Mod.XRotationOffset.Value, Vector3.right);
			Transform transform6 = ((Component)__instance).transform;
			transform6.rotation *= Quaternion.AngleAxis(Mod.YRotationOffset.Value, Vector3.up);
		}
	}
	[HarmonyPatch(typeof(MountedCamMode), "CamModeLateUpdate")]
	internal static class MountedCamMode__CamModeLateUpdate
	{
		[HarmonyPostfix]
		internal static void PositionPostfix(CockpitCamMode __instance)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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_011c: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)__instance).transform;
			transform.position += ((Component)__instance).transform.right * (Mod.XOffset.Value / 10f);
			Transform transform2 = ((Component)__instance).transform;
			transform2.position += ((Component)__instance).transform.up * (Mod.YOffset.Value / 10f);
			Transform transform3 = ((Component)__instance).transform;
			transform3.position += ((Component)__instance).transform.forward * (Mod.ZoomOffset.Value / 10f);
			Transform transform4 = ((Component)__instance).transform;
			transform4.rotation *= Quaternion.AngleAxis(Mod.ZRotationOffset.Value, Vector3.forward);
			Transform transform5 = ((Component)__instance).transform;
			transform5.rotation *= Quaternion.AngleAxis(Mod.XRotationOffset.Value, Vector3.right);
			Transform transform6 = ((Component)__instance).transform;
			transform6.rotation *= Quaternion.AngleAxis(Mod.YRotationOffset.Value, Vector3.up);
		}
	}
	[HarmonyPatch(typeof(SpectatorFreeCamera), "CamModeInitialize")]
	internal static class SpectatorFreeCamera__CamModeInitialize
	{
		[HarmonyPrefix]
		internal static void AddFreeCameraToPlayModeCycle(SpectatorFreeCamera __instance)
		{
			if (Mod.EnableFreeCam.Value)
			{
				((AbstractCamMode)__instance).includeInPlayModeCycle_ = true;
			}
		}
	}
}