Decompiled source of Camera Orbit Adjuster v1.3.3

CameraOrbitAdjuster.dll

Decompiled 7 months ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API.Utils;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;

[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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("CameraOrbitAdjuster")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CameraOrbitAdjuster")]
[assembly: AssemblyTitle("CameraOrbitAdjuster")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CameraZoomer
{
	internal static class Log
	{
		internal static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void LogDebug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void LogError(object data)
		{
			_logSource.LogError(data);
		}

		internal static void LogFatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void LogInfo(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void LogMessage(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void LogWarning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}
namespace CameraOrbitAdjuster
{
	[BepInPlugin("NiFrozenscale.Camera_Orbit_Adjuster", "Camera_Orbit_Adjuster", "1.3.3")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class CameraOrbitAdjuster : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Awake <>9__84_0;

			public static hook_Start <>9__84_1;

			internal void <Awake>b__84_0(orig_Awake orig, PreGameController self)
			{
				if (ConfigLoggingLevel.Value >= 2)
				{
					Debug.Log((object)"[OrbitAdjust] Resetting adjuster memory.");
				}
				if (Object.op_Implicit((Object)(object)customCameraParams))
				{
					Object.Destroy((Object)(object)customCameraParams);
				}
				orig.Invoke(self);
			}

			internal void <Awake>b__84_1(orig_Start orig, CameraRigController self)
			{
				orig.Invoke(self);
				self.fadeEndDistance = ConfigFadeEnd.Value;
				self.fadeStartDistance = ConfigFadeStart.Value;
				if (ConfigLoggingLevel.Value >= 2)
				{
					Debug.Log((object)"[OrbitAdjust] Adjusted near and far distances for the CameraRigController.");
				}
			}
		}

		public const string PluginGUID = "NiFrozenscale.Camera_Orbit_Adjuster";

		public const string PluginAuthor = "NiFrozenscale";

		public const string PluginName = "Camera_Orbit_Adjuster";

		public const string PluginVersion = "1.3.3";

		public const string LogPrefix = "[OrbitAdjust] ";

		public const string customCameraName = "ccpCameraOrbAdjuster";

		public static CharacterCameraParams customCameraParams;

		public static CharacterCameraParams originalCameraParams;

		public static int lastIDWithAuthority = 0;

		public static bool lockedOut = false;

		public static float menuDelayTime = 2f;

		public static bool menuTempDisableMoveAttempts = false;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		public void Awake()
		{
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Expected O, but got Unknown
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Expected O, but got Unknown
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Expected O, but got Unknown
			string text = "Keybinds";
			string text2 = "Speeds";
			string text3 = "Default Orbit";
			string text4 = "Interaction Range";
			string text5 = "Dither Fade Adjustments";
			string text6 = "Debug";
			ConfigZoomSpeed = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "Zoom Speed", 10f, "How fast the camera moves closer and further to the character. Please note that due to the way Risk of Rain's camera works, moving further can take a moment to visually update, while moving closer is almost always immediately noticable.");
			ConfigShiftSpeed = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "Shift Speed", 6f, "How fast the camera moves when shifting it on the X and Y axes.");
			ConfigDoInteractionChange = ((BaseUnityPlugin)this).Config.Bind<bool>(text4, "Adjust Interaction Distance?", true, "When true, the mod will automatically adjust all characters' interaction ranges to be at least as far as their collision box is high, which should prevent cases where larger characters can't reach interactables at their feet, but may also give characters excessive interaction reach.");
			ConfigDoFadeChange = ((BaseUnityPlugin)this).Config.Bind<bool>(text5, "Adjust Fade Distance?", false, "When true, the mod will tweak CameraRigController to change the distance at which objects fade in/out when getting too close to the camera. Disabled by default in case it causes conflicts with other mods that may adjust the same values.");
			ConfigFadeStart = ((BaseUnityPlugin)this).Config.Bind<float>(text5, "Fade Near", 1f, "The distance where an object fully fades out due to being too close to the camera. Larger values cause objects to fade out completely sooner. At zero, objects will never fully fade out, no matter how close they get. The game's default value is 1.0");
			ConfigFadeEnd = ((BaseUnityPlugin)this).Config.Bind<float>(text5, "Fade Far", 4f, "The distance where an object begins to start fading out due to being too close to the camera. Larger values cause objects to start fading out sooner. At zero, all objects will always be at 100% fade unless Fade Near is also set to zero, in which case all objects will always be at 0% fade. The game's default value is 4.0");
			ConfigUsesDefaultParameters = ((BaseUnityPlugin)this).Config.Bind<bool>(text3, "Apply Default Orbit Parameters?", false, "When true, the values defined in the 'Default Orbit' config section will automatically be applied at the start of a new run, instead of using the character's default camera. You should use the 'orbit_printparams' console command to fetch the current orbit X Y Z values when in-game.");
			ConfigDefaultOrbitX = ((BaseUnityPlugin)this).Config.Bind<float>(text3, "Default Orbit X", 0f, "The default X orbit position to use when 'Apply Default Orbit Parameters?' is set to true. The X is used for moving the camera left and right.");
			ConfigDefaultOrbitY = ((BaseUnityPlugin)this).Config.Bind<float>(text3, "Default Orbit Y", 0f, "The default Y orbit position to use when 'Apply Default Orbit Parameters?' is set to true. The Y is used for moving the camera up and down.");
			ConfigDefaultOrbitZ = ((BaseUnityPlugin)this).Config.Bind<float>(text3, "Default Orbit Z", 0f, "The default Z orbit position to use when 'Apply Default Orbit Parameters?' is set to true. The Z is used for moving the camera closer or further.");
			ConfigKeyReset = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(text, "Reset Orbit Parameters", (KeyCode)290, "When pressed, this key will attempt to reset your camera settings to the current character's default camera settings.");
			ConfigKeyZoomIn = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(text, "Zoom In", (KeyCode)291, "When held, moves the camera closer to the character.");
			ConfigKeyZoomOut = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(text, "Zoom Out", (KeyCode)292, "When held, moves the camera further away from the character.");
			ConfigKeyShiftUp = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(text, "Shift Up", (KeyCode)273, "When held, will move the camera up.");
			ConfigKeyShiftDown = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(text, "Shift Down", (KeyCode)274, "When held, will move the camera down.");
			ConfigKeyShiftLeft = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(text, "Shift Left", (KeyCode)276, "When held, will move the camera to the left.");
			ConfigKeyShiftRight = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(text, "Shift Right", (KeyCode)275, "When held, will move the camera to the right.");
			ConfigLoggingLevel = ((BaseUnityPlugin)this).Config.Bind<int>(text6, "Logging level", 0, "A representation of how much logging the mod will do. 0 = Only errors, 1 = Errors and warnings, 2+ = All. Values under 0 result in no logging being done at all.");
			CommandHelper.AddToConsoleWhenReady();
			object obj = <>c.<>9__84_0;
			if (obj == null)
			{
				hook_Awake val = delegate(orig_Awake orig, PreGameController self)
				{
					if (ConfigLoggingLevel.Value >= 2)
					{
						Debug.Log((object)"[OrbitAdjust] Resetting adjuster memory.");
					}
					if (Object.op_Implicit((Object)(object)customCameraParams))
					{
						Object.Destroy((Object)(object)customCameraParams);
					}
					orig.Invoke(self);
				};
				<>c.<>9__84_0 = val;
				obj = (object)val;
			}
			PreGameController.Awake += (hook_Awake)obj;
			if (ConfigDoFadeChange.Value)
			{
				object obj2 = <>c.<>9__84_1;
				if (obj2 == null)
				{
					hook_Start val2 = delegate(orig_Start orig, CameraRigController self)
					{
						orig.Invoke(self);
						self.fadeEndDistance = ConfigFadeEnd.Value;
						self.fadeStartDistance = ConfigFadeStart.Value;
						if (ConfigLoggingLevel.Value >= 2)
						{
							Debug.Log((object)"[OrbitAdjust] Adjusted near and far distances for the CameraRigController.");
						}
					};
					<>c.<>9__84_1 = val2;
					obj2 = (object)val2;
				}
				CameraRigController.Start += (hook_Start)obj2;
			}
			else if (ConfigLoggingLevel.Value >= 2)
			{
				Debug.Log((object)"[OrbitAdjust] Not hooking into CameraRigController, fade changes are disabled by config.");
			}
			PlayerCharacterMasterController.OnBodyStart += (hook_OnBodyStart)delegate(orig_OnBodyStart orig, PlayerCharacterMasterController self)
			{
				orig.Invoke(self);
				CharacterBody currentBody = LocalUserManager.GetFirstLocalUser().currentNetworkUser.GetCurrentBody();
				((MonoBehaviour)this).StartCoroutine(DelayAction(0.2f));
			};
		}

		private IEnumerator DelayAction(float delayTime)
		{
			lockedOut = true;
			yield return (object)new WaitForSeconds(delayTime);
			TryHandleCameraParams();
			TryFixInteractionDistance();
			lockedOut = false;
		}

		private IEnumerator DelayMenuAction()
		{
			menuTempDisableMoveAttempts = true;
			yield return (object)new WaitForSeconds(menuDelayTime);
			menuTempDisableMoveAttempts = false;
		}

		private void Update()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
			if (firstLocalUser != null)
			{
				if (!firstLocalUser.isUIFocused && !lockedOut)
				{
					if (Input.GetKeyDown(ConfigKeyReset.Value))
					{
						ResetZoomerSettings();
					}
					if (Input.GetKey((KeyCode)291))
					{
						AdjustCameraZValue(ConfigZoomSpeed.Value);
					}
					if (Input.GetKey((KeyCode)292))
					{
						AdjustCameraZValue(0f - ConfigZoomSpeed.Value);
					}
					if (Input.GetKey((KeyCode)273))
					{
						AdjustCameraYValue(ConfigShiftSpeed.Value);
					}
					if (Input.GetKey((KeyCode)274))
					{
						AdjustCameraYValue(0f - ConfigShiftSpeed.Value);
					}
					if (Input.GetKey((KeyCode)275))
					{
						AdjustCameraXValue(ConfigShiftSpeed.Value);
					}
					if (Input.GetKey((KeyCode)276))
					{
						AdjustCameraXValue(0f - ConfigShiftSpeed.Value);
					}
				}
			}
			else if (ConfigLoggingLevel.Value >= 1)
			{
				Debug.LogWarning((object)"[OrbitAdjust] LocalUserManager.GetFirstLocalUser() returned null, mod may not function properly. Potential interference from another mod?");
			}
		}

		private void AssignCameraParamsClone()
		{
			if (menuTempDisableMoveAttempts)
			{
				return;
			}
			GameObject localPlayer = GetLocalPlayer();
			if ((Object)(object)localPlayer != (Object)null)
			{
				CameraTargetParams component = localPlayer.GetComponent<CameraTargetParams>();
				if (Object.op_Implicit((Object)(object)customCameraParams))
				{
					if (ConfigLoggingLevel.Value >= 2)
					{
						Debug.Log((object)"[OrbitAdjust] Old clone found. Destroying.");
					}
					Object.Destroy((Object)(object)customCameraParams);
				}
				if (ConfigLoggingLevel.Value >= 2)
				{
					Debug.Log((object)"[OrbitAdjust] Creating clone of player's camera params.");
				}
				customCameraParams = Object.Instantiate<CharacterCameraParams>(component.cameraParams);
				((Object)customCameraParams).name = "ccpCameraOrbAdjuster";
				localPlayer.GetComponent<CameraTargetParams>().cameraParams = customCameraParams;
			}
			else
			{
				if (ConfigLoggingLevel.Value >= 1)
				{
					Debug.LogWarning((object)"[OrbitAdjust] localPlayer was null in AssignCameraParamsClone");
				}
				((MonoBehaviour)this).StartCoroutine(DelayMenuAction());
			}
		}

		public static string GetGameObjectPath(GameObject obj)
		{
			string text = "/" + ((Object)obj).name;
			while ((Object)(object)obj.transform.parent != (Object)null)
			{
				obj = ((Component)obj.transform.parent).gameObject;
				text = "/" + ((Object)obj).name + text;
			}
			return text;
		}

		private void TryHandleCameraParams()
		{
			GameObject localPlayer = GetLocalPlayer();
			if ((Object)(object)localPlayer != (Object)null)
			{
				GameObject val = null;
				if (NetworkServer.active)
				{
					if (ConfigLoggingLevel.Value >= 2)
					{
						Debug.Log((object)"[OrbitAdjust] NetworkServer is active.");
					}
					foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
					{
						if (((NetworkBehaviour)instance.master.GetBody()).hasAuthority)
						{
							if (ConfigLoggingLevel.Value >= 2)
							{
								Debug.Log((object)("[OrbitAdjust] Authority found! " + (object)instance.master.GetBodyObject()));
							}
							val = instance.master.GetBodyObject();
						}
					}
				}
				else
				{
					if (ConfigLoggingLevel.Value >= 2)
					{
						Debug.Log((object)"[OrbitAdjust] This must be singleplayer?");
					}
					val = PlayerCharacterMasterController.instances[0].master.GetBodyObject();
					if (ConfigLoggingLevel.Value >= 2)
					{
						Debug.Log((object)("[OrbitAdjust] Using player character: " + (object)val));
					}
				}
				if ((Object)(object)val == (Object)null)
				{
					if (ConfigLoggingLevel.Value >= 1)
					{
						Debug.LogWarning((object)"[OrbitAdjust] GetBodyObject is null.");
					}
				}
				else
				{
					if (((Object)val).GetInstanceID() == lastIDWithAuthority)
					{
						return;
					}
					lastIDWithAuthority = ((Object)val).GetInstanceID();
					CameraTargetParams component = localPlayer.GetComponent<CameraTargetParams>();
					originalCameraParams = component.cameraParams;
					if (ConfigLoggingLevel.Value >= 2)
					{
						Debug.Log((object)("[OrbitAdjust] Got original camera params: " + ((Object)originalCameraParams).name));
					}
					if (ConfigUsesDefaultParameters.Value && !Object.op_Implicit((Object)(object)customCameraParams))
					{
						if (ConfigLoggingLevel.Value >= 2)
						{
							Debug.Log((object)"[OrbitAdjust] No custom parameters object yet defined but Default Parameters are enabled. Setting up custom parameters to assign now.");
						}
						AssignCameraParamsClone();
						if (Object.op_Implicit((Object)(object)customCameraParams))
						{
							customCameraParams.data.idealLocalCameraPos.value.x = ConfigDefaultOrbitX.Value;
							customCameraParams.data.idealLocalCameraPos.value.y = ConfigDefaultOrbitY.Value;
							customCameraParams.data.idealLocalCameraPos.value.z = ConfigDefaultOrbitZ.Value;
						}
						else if (ConfigLoggingLevel.Value >= 0)
						{
							Debug.LogError((object)"[OrbitAdjust] Error when setting default parameters, custom camera parameters object is NULL!");
						}
					}
					if (Object.op_Implicit((Object)(object)customCameraParams))
					{
						localPlayer.GetComponent<CameraTargetParams>().cameraParams = customCameraParams;
						if (ConfigLoggingLevel.Value >= 2)
						{
							Debug.Log((object)"[OrbitAdjust] Existing clone assigned to new player object.");
						}
					}
				}
			}
			else if (ConfigLoggingLevel.Value >= 2)
			{
				Debug.LogWarning((object)"[OrbitAdjust] localPlayer was null in OnBodyStart");
			}
		}

		private void AdjustCameraRigControllerFades()
		{
		}

		private void TryFixInteractionDistance()
		{
			if (ConfigDoInteractionChange.Value)
			{
				GameObject bodyObject;
				if (NetworkServer.active)
				{
					if (ConfigLoggingLevel.Value >= 2)
					{
						Debug.Log((object)"[OrbitAdjust] Interaction fix - NetworkServer is active.");
					}
					{
						foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
						{
							bodyObject = instance.master.GetBodyObject();
							if (!Object.op_Implicit((Object)(object)bodyObject))
							{
								continue;
							}
							CapsuleCollider component = bodyObject.GetComponent<CapsuleCollider>();
							Interactor component2 = bodyObject.GetComponent<Interactor>();
							if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2) && component2.maxInteractionDistance < component.height)
							{
								component2.maxInteractionDistance = Math.Max(component2.maxInteractionDistance, component.height);
								if (ConfigLoggingLevel.Value >= 2)
								{
									Debug.Log((object)("[OrbitAdjust] Fixing player character: " + ((object)bodyObject)?.ToString() + ". Interaction distance is now " + component2.maxInteractionDistance));
								}
							}
						}
						return;
					}
				}
				if (ConfigLoggingLevel.Value >= 2)
				{
					Debug.Log((object)"[OrbitAdjust] Using singleplayer interaction distance fixer.");
				}
				bodyObject = PlayerCharacterMasterController.instances[0].master.GetBodyObject();
				if (!Object.op_Implicit((Object)(object)bodyObject))
				{
					return;
				}
				CapsuleCollider component3 = bodyObject.GetComponent<CapsuleCollider>();
				Interactor component4 = bodyObject.GetComponent<Interactor>();
				if (Object.op_Implicit((Object)(object)component3) && Object.op_Implicit((Object)(object)component4) && component4.maxInteractionDistance < component3.height)
				{
					component4.maxInteractionDistance = Math.Max(component4.maxInteractionDistance, component3.height);
					if (ConfigLoggingLevel.Value >= 2)
					{
						Debug.Log((object)("[OrbitAdjust] Fixing player character: " + ((object)bodyObject)?.ToString() + ". Interaction distance is now " + component4.maxInteractionDistance));
					}
				}
			}
			else if (ConfigLoggingLevel.Value >= 2)
			{
				Debug.Log((object)"[OrbitAdjust] Ignoring interaction change fix, config value set to false.");
			}
		}

		private void ResetZoomerSettings()
		{
			if (menuTempDisableMoveAttempts)
			{
				return;
			}
			GameObject localPlayer = GetLocalPlayer();
			if ((Object)(object)localPlayer != (Object)null)
			{
				if (ConfigLoggingLevel.Value >= 2)
				{
					Debug.Log((object)("[OrbitAdjust] We've found that the local player is " + ((object)localPlayer)?.ToString() + ". Resetting camera to " + (object)originalCameraParams));
				}
				if (ConfigUsesDefaultParameters.Value)
				{
					if (Object.op_Implicit((Object)(object)customCameraParams))
					{
						if (ConfigLoggingLevel.Value >= 2)
						{
							Debug.Log((object)"[OrbitAdjust] Using default parameters specified by user instead of RoR2 default character camera for reset.");
						}
						customCameraParams.data.idealLocalCameraPos.value.x = ConfigDefaultOrbitX.Value;
						customCameraParams.data.idealLocalCameraPos.value.y = ConfigDefaultOrbitY.Value;
						customCameraParams.data.idealLocalCameraPos.value.z = ConfigDefaultOrbitZ.Value;
					}
					return;
				}
				if (Object.op_Implicit((Object)(object)customCameraParams))
				{
					if (ConfigLoggingLevel.Value >= 2)
					{
						Debug.Log((object)"[OrbitAdjust] Found clone. Destroying clone.");
					}
					Object.Destroy((Object)(object)customCameraParams);
				}
				localPlayer.GetComponent<CameraTargetParams>().cameraParams = originalCameraParams;
			}
			else
			{
				if (ConfigLoggingLevel.Value >= 1)
				{
					Debug.LogWarning((object)"[OrbitAdjust] localPlayer was null in ResetZoomerSettings");
				}
				((MonoBehaviour)this).StartCoroutine(DelayMenuAction());
			}
		}

		private GameObject GetLocalPlayer()
		{
			try
			{
				return ((Component)LocalUserManager.GetFirstLocalUser().currentNetworkUser.GetCurrentBody()).gameObject;
			}
			catch (NullReferenceException)
			{
				if (ConfigLoggingLevel.Value >= 2)
				{
					Debug.LogWarning((object)"[OrbitAdjust] GetLocalPlayer() caught NullReferenceException. Probably OK!");
				}
			}
			if (ConfigLoggingLevel.Value >= 2)
			{
				Debug.LogWarning((object)"[OrbitAdjust] GetLocalPlayer() returned null.");
			}
			return null;
		}

		private void AdjustCameraXValue(float _delta)
		{
			if (Object.op_Implicit((Object)(object)customCameraParams))
			{
				customCameraParams.data.idealLocalCameraPos.value.x += _delta * Time.deltaTime;
			}
			else
			{
				AssignCameraParamsClone();
			}
		}

		private void AdjustCameraYValue(float _delta)
		{
			if (Object.op_Implicit((Object)(object)customCameraParams))
			{
				customCameraParams.data.idealLocalCameraPos.value.y += _delta * Time.deltaTime;
			}
			else
			{
				AssignCameraParamsClone();
			}
		}

		private void AdjustCameraZValue(float _delta)
		{
			if (Object.op_Implicit((Object)(object)customCameraParams))
			{
				customCameraParams.data.idealLocalCameraPos.value.z += _delta * Time.deltaTime;
			}
			else
			{
				AssignCameraParamsClone();
			}
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CmdPrintCameraParameters(ConCommandArgs args)
		{
			if (Object.op_Implicit((Object)(object)customCameraParams))
			{
				Debug.Log((object)"===== Current orbit parameters =====");
				Debug.Log((object)("X: " + customCameraParams.data.idealLocalCameraPos.value.x));
				Debug.Log((object)("Y: " + customCameraParams.data.idealLocalCameraPos.value.y));
				Debug.Log((object)("Z: " + customCameraParams.data.idealLocalCameraPos.value.z));
				Debug.Log((object)"Use these values in the 'Default Orbit' configuration parameters!");
			}
			else
			{
				Debug.Log((object)"[OrbitAdjust] There is no orbit data to fetch as the default orbit for your character is currently being used. Try moving the orbit first before running this command.");
			}
		}
	}
}