Decompiled source of McCarryWeight v1.0.0

McCarryWeight.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("McCarryWeight")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("McCarryWeight")]
[assembly: AssemblyTitle("McCarryWeight")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace McCarryWeight
{
	[BepInPlugin("joaorodrigues.valheim.mccarryweight", "McCarryWeight", "1.0.0")]
	[BepInProcess("valheim.exe")]
	public class McCarryWeightPlugin : BaseUnityPlugin
	{
		public const string Guid = "joaorodrigues.valheim.mccarryweight";

		public const string Name = "McCarryWeight";

		public const string Version = "1.0.0";

		internal static ManualLogSource Log;

		internal static ConfigEntry<bool> ModEnabled;

		internal static ConfigEntry<float> CarryWeight;

		private void Awake()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - General", "Enabled", true, "Set how much the character can carry on its own.");
			CarryWeight = ((BaseUnityPlugin)this).Config.Bind<float>("1 - General", "CarryWeight", 1500f, new ConfigDescription("Carry weight the character has with no belt equipped. Vanilla is 300. A belt, if worn, still adds its own bonus on top of this.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(50f, 100000f), Array.Empty<object>()));
			new Harmony("joaorodrigues.valheim.mccarryweight").PatchAll();
			Log.LogInfo((object)string.Format("{0} {1} loaded. Carry weight: {2}.", "McCarryWeight", "1.0.0", CarryWeight.Value));
		}
	}
	[HarmonyPatch(typeof(Player), "GetMaxCarryWeight")]
	internal static class Patch_GetMaxCarryWeight
	{
		private static void Prefix(Player __instance)
		{
			if (McCarryWeightPlugin.ModEnabled.Value)
			{
				__instance.m_maxCarryWeight = McCarryWeightPlugin.CarryWeight.Value;
			}
		}
	}
}