Decompiled source of ConfigurableMaxCarryWeight v1.0.0

WeightChanger.dll

Decompiled 13 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("WeightChanger")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WeightChanger")]
[assembly: AssemblyTitle("WeightChanger")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 WeightChanger
{
	[BepInPlugin("br.fefo.configurablemaxcarryweight", "Configurable Max Carry Weight", "1.0.0")]
	public sealed class WeightChangerPlugin : BaseUnityPlugin
	{
		public const string PluginGuid = "br.fefo.configurablemaxcarryweight";

		public const string PluginName = "Configurable Max Carry Weight";

		public const string PluginVersion = "1.0.0";

		internal static ConfigEntry<float> MaxCarryWeight;

		private void Awake()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			MaxCarryWeight = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MaxCarryWeight", 9999f, "Maximum carry weight for the player.");
			new Harmony("br.fefo.configurablemaxcarryweight").PatchAll();
		}
	}
	[HarmonyPatch]
	internal static class PlayerMaxCarryWeightPatch
	{
		private static MethodBase TargetMethod()
		{
			return AccessTools.Method(typeof(Player), "UpdateStats", (Type[])null, (Type[])null) ?? AccessTools.Method(typeof(Player), "Update", (Type[])null, (Type[])null);
		}

		private static void Postfix(Player __instance)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				float value = WeightChangerPlugin.MaxCarryWeight.Value;
				if (value > 0f)
				{
					__instance.m_maxCarryWeight = value;
				}
			}
		}
	}
}