Decompiled source of BetterTwoHandedWeapons v1.0.1

balance_fixer.dll

Decompiled 3 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
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("balance_fixer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("balance_fixer")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d2a67589-e695-4640-b93c-13d4aa6250e4")]
[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 balance_fixer;

[BepInPlugin("ynel.balance_fixer", "Balance Fixer", "0.0.1")]
[BepInProcess("valheim.exe")]
public class BalanceFixer : BaseUnityPlugin
{
	[HarmonyPatch(typeof(ObjectDB), "Awake")]
	public class ObjectDBPatch
	{
		[HarmonyPostfix]
		private static void Postfix(ObjectDB __instance)
		{
			float num = 10f;
			float attackForce = 0f;
			float movementModifier = -0.05f;
			float deflectionForce = 0f;
			float num2 = -4f;
			float attackAdrenaline = 4f;
			float speedFactor = 0.3f;
			ItemDrop val = null;
			foreach (GameObject item in __instance.m_items)
			{
				if (((Object)item).name == "Battleaxe" || ((Object)item).name == "BattleaxeCrystal" || ((Object)item).name == "BattleaxeSkullSplittur" || ((Object)item).name == "BattleaxeBlackmetal" || ((Object)item).name == "THSwordKrom" || ((Object)item).name == "THSwordSlayer" || ((Object)item).name == "THSwordSlayerBlood" || ((Object)item).name == "THSwordSlayerLightning" || ((Object)item).name == "THSwordSlayerNature")
				{
					val = item.GetComponent<ItemDrop>();
					val.m_itemData.m_shared.m_damages.m_slash += num;
					val.m_itemData.m_shared.m_attackForce = attackForce;
					val.m_itemData.m_shared.m_movementModifier = movementModifier;
					val.m_itemData.m_shared.m_deflectionForce = deflectionForce;
					Attack attack = val.m_itemData.m_shared.m_attack;
					attack.m_attackStamina += num2;
					val.m_itemData.m_shared.m_attack.m_attackAdrenaline = attackAdrenaline;
					val.m_itemData.m_shared.m_attack.m_speedFactor = speedFactor;
				}
			}
		}
	}

	private readonly Harmony harmony = new Harmony("ynel.balance_fixer");

	internal static ManualLogSource Log;

	private void Awake()
	{
		Log = ((BaseUnityPlugin)this).Logger;
		harmony.PatchAll();
	}
}