Decompiled source of ChaseMechanic v1.0.1

BepInEx Adrenaline/plugins/AdrenalineRush.dll

Decompiled 4 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Hypick.AdrenalineRush.NetcodePatcher;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Hypick.AdrenalineRush")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+72a3a75c61550d06466a210a2037d9c74edca775")]
[assembly: AssemblyProduct("AdrenalineRush")]
[assembly: AssemblyTitle("Hypick.AdrenalineRush")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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 Hypick
{
	[BepInPlugin("Hypick.AdrenalineRush", "AdrenalineRush", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static PluginConfig Config;

		private readonly Harmony _harmony = new Harmony("Hypick.AdrenalineRush");

		public static Plugin Instance { get; set; }

		public static ManualLogSource Log => ((BaseUnityPlugin)Instance).Logger;

		public Plugin()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Instance = this;
		}

		private void Awake()
		{
			Config = new PluginConfig(((BaseUnityPlugin)this).Config);
			Log.LogInfo((object)"Applying patches...");
			_harmony.PatchAll();
			Log.LogInfo((object)"Patches applied");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Hypick.AdrenalineRush is fully loaded!");
		}
	}
	public static class Category
	{
		public const string General = "1 >> General << 1";
	}
	public class PluginConfig
	{
		public float Multiplier { get; }

		public bool ChangeSpeed { get; }

		public float MaxSpeed { get; }

		public bool ChangeFOV { get; }

		public float MaxFOV { get; }

		public PluginConfig(ConfigFile cfg)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			Multiplier = cfg.Bind<float>("1 >> General << 1", "Multiplier", 200f, new ConfigDescription("multiplier to increase the player's speed and FOV (formula: fearLevel * (multiplier / 100))", (AcceptableValueBase)(object)new AcceptableValueRange<float>(150f, 999f), Array.Empty<object>())).Value;
			ChangeSpeed = cfg.Bind<bool>("1 >> General << 1", "ChangeSpeed", true, "Should the player's running speed increase when entering fear?").Value;
			MaxSpeed = cfg.Bind<float>("1 >> General << 1", "MaxSpeed", 2.5f, "Maximum speed to increase").Value;
			ChangeFOV = cfg.Bind<bool>("1 >> General << 1", "ChangeFOV", true, "Should the player's FOV increase when entering fear?").Value;
			MaxFOV = cfg.Bind<float>("1 >> General << 1", "MaxFOV", 130f, new ConfigDescription("Maximum FOV to increase", (AcceptableValueBase)(object)new AcceptableValueRange<float>(66f, 130f), Array.Empty<object>())).Value;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Hypick.AdrenalineRush";

		public const string PLUGIN_NAME = "AdrenalineRush";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace Hypick.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void Update(PlayerControllerB __instance, ref StartOfRound ___playersManager)
		{
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: 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_0147: Unknown result type (might be due to invalid IL or missing references)
			if (!(___playersManager.fearLevel >= 0.4f))
			{
				return;
			}
			float num = ___playersManager.fearLevel * (Plugin.Config.Multiplier / 100f);
			if (Plugin.Config.ChangeSpeed)
			{
				__instance.sprintMultiplier = Mathf.Lerp(__instance.sprintMultiplier, 1f + num, Time.deltaTime * 0.25f);
			}
			if (Plugin.Config.ChangeFOV)
			{
				float num2 = Mathf.Clamp(66f * num, 66f, Plugin.Config.MaxFOV);
				__instance.gameplayCamera.fieldOfView = Mathf.Lerp(__instance.gameplayCamera.fieldOfView, num2, 0.25f);
				if (__instance.gameplayCamera.fieldOfView > 67f)
				{
					float num3 = (__instance.gameplayCamera.fieldOfView - 66f) / (Plugin.Config.MaxFOV - 66f);
					num3 = Mathf.Lerp(num3, Mathf.Sin(num3 * MathF.PI / 2f), 0.6f);
					__instance.localVisor.localScale = Vector3.LerpUnclamped(new Vector3(0.68f, 0.8f, 0.95f), new Vector3(0.68f, 0.35f, 0.99f), num3);
				}
				else
				{
					__instance.localVisor.localScale = new Vector3(0.36f, 0.49f, 0.49f);
				}
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace Hypick.AdrenalineRush.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}