Decompiled source of AdrenalineBoost v1.0.0

AdrenalineBoost.dll

Decompiled 11 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AdrenalineBoost.Patches;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
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("AdrenalineBoost")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdrenalineBoost")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ca3cb8a1-4ce7-4b05-a6df-09f4658cc2b0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AdrenalineBoost
{
	[BepInPlugin("LongParsnip.AdrenalineBoost", "AdrenalineBoost", "1.0.0.0")]
	public class AdrenalineBoostBase : BaseUnityPlugin
	{
		private const string modGUID = "LongParsnip.AdrenalineBoost";

		private const string modName = "AdrenalineBoost";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("LongParsnip.AdrenalineBoost");

		private static AdrenalineBoostBase Instance;

		internal ManualLogSource mls;

		public static string MovementSpeedFearFactorKey = "Movement Speed Fear Factor";

		public static string StaminaRegenFearFactorKey = "Stamina Regen Fear Factor";

		public static ConfigEntry<float> MovementSpeedFearFactor;

		public static ConfigEntry<float> StaminaRegenFearFactor;

		private void Awake()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			MovementSpeedFearFactor = ((BaseUnityPlugin)this).Config.Bind<float>("General", MovementSpeedFearFactorKey, 1f, new ConfigDescription("Multiplier for your movement speed based on fear level.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			StaminaRegenFearFactor = ((BaseUnityPlugin)this).Config.Bind<float>("General", StaminaRegenFearFactorKey, 1f, new ConfigDescription("Multiplier for your stamina regen speed when scared.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("LongParsnip.AdrenalineBoost");
			mls.LogInfo((object)"Adrenaline boost is awake and needs coffee.");
			harmony.PatchAll(typeof(PlayerControllerBPatch));
		}
	}
}
namespace AdrenalineBoost.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void adrenalineBoostPatch(ref float ___sprintMeter, ref float ___movementSpeed, ref StartOfRound ___playersManager)
		{
			if (___playersManager.fearLevel > 0.2f)
			{
				___sprintMeter += 0.00011f * AdrenalineBoostBase.StaminaRegenFearFactor.Value;
				___movementSpeed = 5f * (___playersManager.fearLevel * (0.18f * AdrenalineBoostBase.MovementSpeedFearFactor.Value) + 1f);
			}
			else
			{
				___movementSpeed = 5f;
			}
		}
	}
}