Decompiled source of NoJumpStamina v1.0.2

NoJumpStamina.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 NoJumpStamina
{
	[BepInPlugin("NoJumpStamina", "NoJumpStamina", "1.0.2")]
	[BepInProcess("valheim.exe")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "NoJumpStamina";

		public const string PluginName = "NoJumpStamina";

		public const string PluginVersion = "1.0.2";

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("NoJumpStamina").PatchAll(typeof(Plugin).Assembly);
		}
	}
	internal static class JumpScope
	{
		internal static int Depth;
	}
	[HarmonyPatch(typeof(Player), "OnJump")]
	internal static class PlayerOnJumpPatch
	{
		private static void Prefix()
		{
			JumpScope.Depth++;
		}

		private static void Finalizer()
		{
			JumpScope.Depth--;
		}
	}
	[HarmonyPatch(typeof(Character), "Jump")]
	internal static class CharacterJumpPatch
	{
		private static void Prefix()
		{
			JumpScope.Depth++;
		}

		private static void Finalizer()
		{
			JumpScope.Depth--;
		}
	}
	[HarmonyPatch(typeof(Player), "UseStamina")]
	internal static class PlayerUseStaminaPatch
	{
		private static bool Prefix(Player __instance)
		{
			if (JumpScope.Depth != 0)
			{
				return (Object)(object)__instance != (Object)(object)Player.m_localPlayer;
			}
			return true;
		}
	}
}