Decompiled source of FasterGathering v1.0.0

FasterGathering.dll

Decompiled 5 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("FasterGathering")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FasterGathering")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("E93419A6-F2AA-40C0-8DAA-0E52F6356EA4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = "")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FasterGathering;

[BepInPlugin("spectral.fastergathering", "Faster Gathering", "1.0")]
public class FasterGathering : BaseUnityPlugin
{
	public const string pluginGuid = "spectral.fastergathering";

	public const string pluginName = "Faster Gathering";

	public const string pluginVersion = "1.0";

	private static ConfigEntry<double> damageMult;

	public void Awake()
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading Faster Gathering");
		damageMult = ((BaseUnityPlugin)this).Config.Bind<double>("General", "DamageMultiplier", 2.0, "Damage multiplier applied to resource nodes");
		Harmony val = new Harmony("spectral.fastergathering");
		MethodInfo methodInfo = AccessTools.Method(typeof(HitableResource), "Hit", (Type[])null, (Type[])null);
		MethodInfo methodInfo2 = AccessTools.Method(typeof(FasterGathering), "OnResourceHit", (Type[])null, (Type[])null);
		val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
	}

	public static bool OnResourceHit(ref int damage)
	{
		damage = Mathf.RoundToInt((float)damage * (float)damageMult.Value);
		return true;
	}
}