Decompiled source of AutoParry v0.1.3

ValheimAutoParry.dll

Decompiled 2 months ago
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.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ValheimAutoParry")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ValheimAutoParry")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("da7c6554-ea1d-46a4-b8c3-6c559f8344a8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ValheimAutoParry;

[BepInPlugin("com.username.autoparry", "Client-Side Auto Parry", "1.0.0")]
[BepInProcess("valheim.exe")]
public class AutoParryPlugin : BaseUnityPlugin
{
	private readonly Harmony harmony = new Harmony("com.username.autoparry");

	private void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Auto-Parry Mod successfully loaded (Client-Side Only).");
		harmony.PatchAll();
	}
}
[HarmonyPatch(typeof(Humanoid), "BlockAttack")]
public static class Humanoid_BlockAttack_Patch
{
	private static void Prefix(Humanoid __instance, HitData hit, Character attacker)
	{
		Player val = (Player)(object)((__instance is Player) ? __instance : null);
		if (val != null && (Object)(object)val == (Object)(object)Player.m_localPlayer && ((Character)val).IsBlocking())
		{
			AccessTools.Field(typeof(Humanoid), "m_blockTimer").SetValue(__instance, 0f);
		}
	}
}