Decompiled source of NoStaminaTools v1.0.0

NoStaminaTools.dll

Decompiled 8 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("NoStaminaTools")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+735dbadc5949489f66760f3788a6fb2d614458f9")]
[assembly: AssemblyProduct("NoStaminaTools")]
[assembly: AssemblyTitle("NoStaminaTools")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
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;
		}
	}
}
[BepInPlugin("zopthemop.nostaminatools", "No Stamina Tools", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(ObjectDB), "Awake")]
	public static class ObjectDB_Awake_Patch
	{
		private static void Postfix(ObjectDB __instance)
		{
			RemoveWeaponStamina(__instance, "Hammer");
			RemoveWeaponStamina(__instance, "Hoe");
			RemoveWeaponStamina(__instance, "Cultivator");
		}

		private static void RemoveWeaponStamina(ObjectDB db, string prefabName)
		{
			GameObject itemPrefab = db.GetItemPrefab(prefabName);
			if (!((Object)(object)itemPrefab == (Object)null))
			{
				ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
				if (!((Object)(object)component == (Object)null))
				{
					component.m_itemData.m_shared.m_attack.m_attackStamina = 0f;
				}
			}
		}
	}

	public const string ModGUID = "zopthemop.nostaminatools";

	public const string ModName = "No Stamina Tools";

	public const string ModVersion = "1.0.0";

	public const string ModDescription = "Remove stamina cost of Hammer, Hoe and Cultivator";

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("zopthemop.nostaminatools");
		val.PatchAll();
	}
}