Decompiled source of InfiniteStamina v1.0.2

InfiniteStamina.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("InfiniteStamina")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("InfiniteStamina")]
[assembly: AssemblyTitle("InfiniteStamina")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace InfiniteStamina;

[BepInPlugin("WDWE.InfiniteStamina", "infinite stamina", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
	private readonly Harmony harmony = new Harmony("infinite stamina");

	internal ManualLogSource mls;

	private void Awake()
	{
		mls = Logger.CreateLogSource("infinite stamina");
		mls.LogWarning((object)"this is a warning bro and it's working goodd");
		harmony.PatchAll(typeof(Plugin));
		harmony.PatchAll(typeof(CurrentStaminaPatch));
	}
}
[HarmonyPatch(typeof(PlayerController))]
internal class CurrentStaminaPatch
{
	[HarmonyPatch("Update")]
	[HarmonyPostfix]
	private static void infiniteStamina(ref PlayerController __instance)
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Expected O, but got Unknown
		FieldInfo field = typeof(PlayerController).GetField("player", BindingFlags.Instance | BindingFlags.NonPublic);
		Player val = (Player)field.GetValue(__instance);
		if ((Object)(object)val != (Object)null)
		{
			val.data.currentStamina = __instance.maxStamina;
		}
	}
}