Decompiled source of AxeComboWhenChoppingTree v1.0.2

AxeComboWhenChoppingTree.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AxeComboWhenChoppingTree")]
[assembly: AssemblyDescription("https://valheim.thunderstore.io/package/blacks7ar/AxeComboWhenChoppingTree/")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("blacks7ar")]
[assembly: AssemblyProduct("AxeComboWhenChoppingTree")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("F25E5ADE-933C-463F-A79D-90E5DA136E52")]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
namespace AxeComboWhenChoppingTree;

[BepInPlugin("blacks7ar.AxeComboWhenChoppingTree", "AxeComboWhenChoppingTree", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(ObjectDB), "Awake")]
	public static class Patch
	{
		public static void Postfix(ObjectDB __instance)
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)null || __instance.m_items.Count <= 0 || (Object)(object)__instance.GetItemPrefab("Wood") == (Object)null)
			{
				return;
			}
			foreach (ItemDrop item in from item in __instance.m_items
				select item.GetComponent<ItemDrop>() into axe
				where (Object)(object)axe != (Object)null && ((Object)((Component)axe).gameObject).name.ToLower().Contains("axe")
				select axe)
			{
				item.m_itemData.m_shared.m_attack.m_resetChainIfHit = (DestructibleType)0;
			}
		}
	}

	private const string modGUID = "blacks7ar.AxeComboWhenChoppingTree";

	public const string modName = "AxeComboWhenChoppingTree";

	public const string modAuthor = "blacks7ar";

	public const string modVersion = "1.0.2";

	public const string modLink = "https://valheim.thunderstore.io/package/blacks7ar/AxeComboWhenChoppingTree/";

	private static readonly Harmony _harmony = new Harmony("blacks7ar.AxeComboWhenChoppingTree");

	public void Awake()
	{
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		_harmony.PatchAll(executingAssembly);
	}
}