Decompiled source of Slope Combat Fix v1.3.0

HitboxFix.dll

Decompiled a year ago
using System.Diagnostics;
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 BepInEx.Configuration;
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("HitboxFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HitboxFix")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("80be22f3-e3d0-466e-84ee-64331552c255")]
[assembly: AssemblyFileVersion("1.3.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.0.0")]
[module: UnverifiableCode]
namespace Hitbox_Fix;

[BepInPlugin("hitbox.fix", "Hitbox Fix", "1.3.0")]
[BepInProcess("valheim.exe")]
public class HitboxFix : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Attack), "DoMeleeAttack")]
	private class Hitbox_Patch
	{
		private static void Prefix(ref float ___m_maxYAngle, ref float ___m_attackOffset, ref float ___m_attackHeight)
		{
			___m_maxYAngle = 180f;
			___m_attackOffset = offset.Value;
			___m_attackHeight = height.Value;
		}
	}

	private readonly Harmony harmony = new Harmony("hitbox.fix");

	private static ConfigEntry<float> offset;

	private static ConfigEntry<float> height;

	private static ConfigEntry<int> nexusID;

	private void Awake()
	{
		nexusID = ((BaseUnityPlugin)this).Config.Bind<int>("General", "NexusID", 727, "Nexus mod ID for updates");
		offset = ((BaseUnityPlugin)this).Config.Bind<float>("Modify offset", "offset", 0f, "Offset");
		height = ((BaseUnityPlugin)this).Config.Bind<float>("Modify height (0.6 default, 1 mod default)", "height", 1f, "Height");
		harmony.PatchAll();
	}

	private void OnDestroy()
	{
		harmony.UnpatchSelf();
	}
}