Decompiled source of EasyAdjust v1.0.0

EasyAdjust.dll

Decompiled a day 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 BepInEx.Logging;
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("ValheimMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ValheimMod")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("26183afb-8ab0-4846-8a06-afd8a4cdf53b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace EasyAdjust
{
	public class ModConfig
	{
		public static ConfigEntry<float> StaminaMultiplier;

		public static ConfigEntry<float> CarryWeightMultiplier;

		public static ConfigEntry<float> FoodDurationMultiplier;

		public static ConfigEntry<float> ChopDamageMultiplier;

		public static ConfigEntry<float> JumpForceMultiplier;

		public static ConfigEntry<float> HealthMaxMultiplier;

		public static void Init(ConfigFile Config)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			StaminaMultiplier = Config.Bind<float>("Stamina", "Stamina Multiplier", 1f, new ConfigDescription("Stamina consumption. Lower values reduce stamina usage, higher values increase it", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			CarryWeightMultiplier = Config.Bind<float>("Carry Weight", "Carry Weight", 1f, new ConfigDescription("Increments your maximum carry weight. Higher values allow you to carry more", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100000f), Array.Empty<object>()));
			FoodDurationMultiplier = Config.Bind<float>("Food", "Food Duration Multiplier", 1f, new ConfigDescription("How fast food duration decreases. 0 freezes food duration, higher values make it expire faster)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			ChopDamageMultiplier = Config.Bind<float>("Chop damage", "Chop damage", 1f, new ConfigDescription("Multiplies damage dealt to trees and buildings using axes (chop damage)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 50f), Array.Empty<object>()));
			JumpForceMultiplier = Config.Bind<float>("Jump", "Jump Force", 8f, new ConfigDescription("Jump Force. Higher values increase jump force. Warning: Doesn't prevent from fall damage.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 50f), Array.Empty<object>()));
			HealthMaxMultiplier = Config.Bind<float>("Health", "Health Increment", 0f, new ConfigDescription("Multiplies maximum health", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1000f), Array.Empty<object>()));
		}
	}
	[BepInPlugin("EasyAdjustConf", "EasyAdjust", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource Log;

		private void Awake()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			ModConfig.Init(((BaseUnityPlugin)this).Config);
			Log.LogInfo((object)"Ready to go!");
			Harmony val = new Harmony("EasyAdjust");
			val.PatchAll();
		}
	}
}
namespace EasyAdjust.Patches
{
	[HarmonyPatch(typeof(Player), "SetMaxHealth")]
	public class PlayerMaxHealthPatch
	{
		private static void Prefix(ref float health)
		{
			health += ModConfig.HealthMaxMultiplier.Value;
		}
	}
	[HarmonyPatch(typeof(Player), "UseStamina")]
	public class StaminaPatch
	{
		private static void Prefix(ref float v)
		{
			v *= ModConfig.StaminaMultiplier.Value;
		}
	}
	[HarmonyPatch(typeof(Player), "UpdateFood")]
	public class FoodDurationPatch
	{
		private static void Prefix(Player __instance, float dt, ref float ___m_foodUpdateTimer)
		{
			float num = dt * (1f - ModConfig.FoodDurationMultiplier.Value);
			___m_foodUpdateTimer -= num;
		}
	}
	[HarmonyPatch(typeof(Character), "Jump")]
	public class JumpPatch
	{
		private static void Prefix(Character __instance)
		{
			if (__instance.IsPlayer())
			{
				__instance.m_jumpForce = ModConfig.JumpForceMultiplier.Value;
			}
		}
	}
	[HarmonyPatch(typeof(Player), "GetMaxCarryWeight")]
	public class CarryWeight
	{
		private static void Postfix(ref float __result)
		{
			__result += ModConfig.CarryWeightMultiplier.Value;
		}
	}
	[HarmonyPatch(typeof(ItemData), "GetDamage", new Type[]
	{
		typeof(int),
		typeof(float)
	})]
	public class WeaponChopPatch
	{
		private static void Postfix(ref DamageTypes __result)
		{
			__result.m_chop *= ModConfig.ChopDamageMultiplier.Value;
		}
	}
}