Decompiled source of Stamina Enhancements v1.0.0

StaminaControl.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("StaminaControl")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StaminaControl")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("98E0D1D9-CE32-4E44-9822-B32615CBCB39")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace StaminaControl;

[BepInPlugin("CW-MoreStamina", "2.5x Stamina Mod", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static Harmony HARMONY;

	private void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Expected O, but got Unknown
		HARMONY = new Harmony("CW-MoreStamina");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Patching CW-MoreStamina!");
		HARMONY.PatchAll(typeof(Plugin));
	}

	[HarmonyPatch(typeof(PlayerController), "Start")]
	[HarmonyPostfix]
	private static void PatchStamina(PlayerController __instance)
	{
		__instance.maxStamina *= 3f;
	}

	[HarmonyPatch(typeof(PlayerController), "Update")]
	[HarmonyPostfix]
	private static void PatchStaminaRegenRate(PlayerController __instance)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		PlayerData data = ((Player)AccessTools.Field(typeof(PlayerController), "player").GetValue(__instance)).data;
		if ((double)data.sinceSprint > 1.0 && data.currentStamina < __instance.maxStamina)
		{
			data.currentStamina += 2f * Time.deltaTime;
			data.currentStamina = Mathf.Clamp(data.currentStamina, 0f, __instance.maxStamina);
		}
	}
}
public static class MyPluginInfo
{
	public const string PLUGIN_GUID = "StaminaControl";

	public const string PLUGIN_NAME = "";

	public const string PLUGIN_VERSION = "1.0.0.0";
}