Decompiled source of PilotCinematika v1.0.2

PilotCinematika.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Bossa.Cinematika;
using Bossa.Cinematika.Controllers;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;
using WildSkies.Service;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("PilotCinematika")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Nines (Natives)")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("PilotCinematika")]
[assembly: AssemblyTitle("PilotCinematika")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.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 PilotCinematika
{
	[BepInPlugin("PilotCinematika", "PilotCinematika", "1.0.2")]
	public class Plugin : BasePlugin
	{
		internal static ManualLogSource Log;

		internal static Harmony harmonyInstance;

		private static ConfigEntry<float> PilotCinematika_ScrollMultiplier;

		private static ConfigEntry<float> PilotCinematika_thirdPersonOffsetZ;

		private static ConfigEntry<float> PilotCinematika_targetAngleX;

		private static ConfigEntry<float> PilotCinematika_targetAngleY;

		private static InputService _inputService;

		public override void Load()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Log = ((BasePlugin)this).Log;
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("PilotCinematika");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val);
			PilotCinematika_ScrollMultiplier = ((BasePlugin)this).Config.Bind<float>("PilotCinematika", "ScrollMultiplier", 5f, "PilotCinematika.ScrollMultiplier");
			PilotCinematika_thirdPersonOffsetZ = ((BasePlugin)this).Config.Bind<float>("PilotCinematika", "thirdPersonOffsetZ", -20f, "PilotCinematika.thirdPersonOffsetZ");
			PilotCinematika_targetAngleX = ((BasePlugin)this).Config.Bind<float>("PilotCinematika", "targetAngleX", 0f, "PilotCinematika.targetAngleX");
			PilotCinematika_targetAngleY = ((BasePlugin)this).Config.Bind<float>("PilotCinematika", "targetAngleY", 0f, "PilotCinematika.targetAngleY");
			harmonyInstance = Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
		}

		public override bool Unload()
		{
			Harmony obj = harmonyInstance;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
			return true;
		}

		[HarmonyPatch(typeof(PilotCinematikaController), "UpdateInput")]
		[HarmonyPrefix]
		public static void PilotCinematikaController_UpdateInput(PilotCinematikaController __instance)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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)
			if (!__instance.ThirdPerson)
			{
				return;
			}
			InputService inputService = _inputService;
			if (inputService == null || ((Enum)inputService._inputMode).HasFlag((Enum)(object)(InputMode)4))
			{
				Vector2 val = ((InputControl<Vector2>)(object)Mouse.current.scroll).ReadValue();
				if (val.y != 0f)
				{
					ConfigEntry<float> pilotCinematika_thirdPersonOffsetZ = PilotCinematika_thirdPersonOffsetZ;
					pilotCinematika_thirdPersonOffsetZ.Value += val.y * PilotCinematika_ScrollMultiplier.Value;
					Settings currentSettings = __instance.CurrentSettings;
					currentSettings._thirdPersonOffset.z = PilotCinematika_thirdPersonOffsetZ.Value;
					__instance.CurrentSettings = currentSettings;
				}
				if (Mouse.current.middleButton.wasPressedThisFrame)
				{
					PilotCinematika_thirdPersonOffsetZ.Value = (float)((ConfigEntryBase)PilotCinematika_thirdPersonOffsetZ).DefaultValue;
					Settings currentSettings2 = __instance.CurrentSettings;
					currentSettings2._thirdPersonOffset.z = PilotCinematika_thirdPersonOffsetZ.Value;
					__instance.CurrentSettings = currentSettings2;
					PilotCinematika_targetAngleX.Value = (float)((ConfigEntryBase)PilotCinematika_targetAngleX).DefaultValue;
					PilotCinematika_targetAngleY.Value = (float)((ConfigEntryBase)PilotCinematika_targetAngleY).DefaultValue;
				}
			}
		}

		[HarmonyPatch(typeof(PilotCinematikaController), "UpdateInput")]
		[HarmonyPostfix]
		public static void PilotCinematikaController_UpdateInput_Postfix(PilotCinematikaController __instance, ICameraInputState iState)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if (!((Il2CppObjectBase)iState).Cast<CameraInputState>().LookEnable)
			{
				__instance._targetAngles = Vector2.Lerp(__instance._targetAngles, (Vector2)(__instance.ThirdPerson ? new Vector2(PilotCinematika_targetAngleX.Value, PilotCinematika_targetAngleY.Value) : Vector2.zero), 4f * Time.deltaTime);
			}
			else if (Keyboard.current.shiftKey.isPressed)
			{
				PilotCinematika_targetAngleX.Value = __instance._targetAngles.x;
				PilotCinematika_targetAngleY.Value = __instance._targetAngles.y;
			}
		}

		[HarmonyPatch(typeof(PilotCinematikaController), "Enable")]
		[HarmonyPostfix]
		public static void PilotCinematikaController_Enable(PilotCinematikaController __instance)
		{
			_inputService = ProjectContextInstaller.ResolveObject<InputService>();
			__instance._backToCenterSpeed = 0f;
		}

		[HarmonyPatch(typeof(PilotCinematikaController), "ThirdPersonToggle")]
		[HarmonyPostfix]
		public static void PilotCinematikaController_ThirdPersonToggle(PilotCinematikaController __instance)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.ThirdPerson)
			{
				Settings currentSettings = __instance.CurrentSettings;
				currentSettings._thirdPersonOffset.z = PilotCinematika_thirdPersonOffsetZ.Value;
				__instance.CurrentSettings = currentSettings;
				__instance._targetAngles = new Vector2(PilotCinematika_targetAngleX.Value, PilotCinematika_targetAngleY.Value);
				__instance._currentAngles = __instance._targetAngles;
			}
			else
			{
				__instance._targetAngles = Vector2.zero;
				__instance._currentAngles = __instance._targetAngles;
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "PilotCinematika";

		public const string PLUGIN_NAME = "PilotCinematika";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}