Decompiled source of LumberjackByBazzak81 v1.0.0

ValheimModLumberjack.dll

Decompiled a month ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
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: AssemblyTitle("ValheimLumberjack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ValheimLumberjack")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6cdf9bdd-206b-45b4-a498-13a566b2a9df")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ValheimLumberjack;

[BepInPlugin("jimbob.ValheimLumberjack", "Valheim Lumberjack", "1.1.0")]
[BepInProcess("valheim.exe")]
public class ValheimLumberjack : BaseUnityPlugin
{
	[HarmonyPatch(typeof(TreeLog), "Damage")]
	private class TreeLogPatch
	{
		private static void Prefix(ref HitData hit)
		{
			List<Character> allCharacters = Character.GetAllCharacters();
			foreach (Character item in allCharacters)
			{
				if (item.IsPlayer())
				{
					hit.m_damage.m_chop = 1000f;
				}
			}
		}
	}

	[HarmonyPatch(typeof(Destructible), "Damage")]
	private class TreeStumpPatch
	{
		private static void Prefix(Destructible __instance, ref HitData hit)
		{
			if (((Object)__instance).name.Contains("Stub"))
			{
				hit.m_damage.m_chop = 1000f;
			}
		}
	}

	private const string PLUGINGUID = "jimbob.ValheimLumberjack";

	private const string PLUGINNAME = "Valheim Lumberjack";

	private const string PLUGINVERSION = "1.1.0";

	private readonly Harmony harmony = new Harmony("jimbob.ValheimLumberjack");

	private static readonly bool isDebug = true;

	public static void Dbgl(string str = "", bool pref = true)
	{
		if (isDebug)
		{
			Debug.Log((object)((pref ? (typeof(ValheimLumberjack).Namespace + " ") : "") + str));
		}
	}

	private void Awake()
	{
		harmony.PatchAll();
	}
}