Decompiled source of InfinityTools v1.0.0

InfinityTools.dll

Decompiled a year ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("JotunnModStub")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JotunnModStub")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
namespace JotunnModStub;

[BepInPlugin("blumaye.infinitytools", "InfinityTools", "1.0.0")]
public class JotunnModStub : BaseUnityPlugin
{
	[HarmonyPatch(typeof(ItemDrop), "Awake")]
	public static class ItemDrop_Awake_Patch
	{
		public static void Prefix(ref ItemDrop __instance)
		{
			if (toolsList.Contains(__instance.m_itemData.m_shared.m_name))
			{
				__instance.m_itemData.m_shared.m_useDurability = false;
				__instance.m_itemData.m_shared.m_useDurabilityDrain = 0f;
				__instance.m_itemData.m_shared.m_attack.m_attackStamina = 0f;
				__instance.m_itemData.m_shared.m_maxQuality = 1;
			}
		}
	}

	public const string PluginGUID = "blumaye.infinitytools";

	public const string PluginName = "InfinityTools";

	public const string PluginVersion = "1.0.0";

	private Harmony harmony = new Harmony("blumaye.infinitytools");

	public static List<string> toolsList = new List<string>(new string[3] { "$item_hammer", "$item_hoe", "$item_cultivator" });

	public void Awake()
	{
		Harmony obj = harmony;
		if (obj != null)
		{
			obj.PatchAll();
		}
	}

	public void OnDestroy()
	{
		Harmony obj = harmony;
		if (obj != null)
		{
			obj.UnpatchSelf();
		}
	}
}