Decompiled source of BiggerItemStack v1.3.0

BiggerItemStack.dll

Decompiled 3 weeks ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("BiggerItemStack")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BiggerItemStack")]
[assembly: AssemblyTitle("BiggerItemStack")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace BiggerItemStack;

[BepInPlugin("org.bepinex.plugins.bigger_item_Stack", "Bigger Item Stack", "0.1.2.1")]
internal class ValheimMultipliersPlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(ItemDrop), "Awake")]
	public static class ModifyItemProperties
	{
		private static void Prefix(ref ItemDrop __instance)
		{
			__instance.m_itemData.m_shared.m_weight = __instance.m_itemData.m_shared.m_weight * _itemWeightMultiplier.Value;
			if (__instance.m_itemData.m_shared.m_maxStackSize > 1)
			{
				__instance.m_itemData.m_shared.m_maxStackSize = (int)((double)__instance.m_itemData.m_shared.m_maxStackSize * _stackMultiplier.Value);
			}
		}
	}

	[HarmonyPatch(typeof(Player), "Awake")]
	public static class ModifyPlayerMaxWeight
	{
		private static void Prefix(ref Player __instance)
		{
			Player obj = __instance;
			obj.m_maxCarryWeight *= _playerWeightMultiplier.Value;
		}
	}

	private static ConfigEntry<double> _stackMultiplier;

	private static ConfigEntry<float> _itemWeightMultiplier;

	private static ConfigEntry<float> _playerWeightMultiplier;

	private void Awake()
	{
		initConfigFile();
		((BaseUnityPlugin)this).Logger.LogMessage((object)"This mod is Created by Sixefyle!");
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
	}

	private void initConfigFile()
	{
		_stackMultiplier = ((BaseUnityPlugin)this).Config.Bind<double>("Multiplier", "ItemMaxStackMultiplier", 2.0, "The maximum item stack multplier (Can be float value like 1.5)");
		_itemWeightMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Multiplier", "ItemWeightMultiplier", 1f, "The item weight multiplier (Can be float value like 0.5)");
		_playerWeightMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Multiplier", "PlayerWeightMultiplier", 1f, "The max player weight multiplier (Can be float value like 1.5)");
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "BiggerItemStack";

	public const string PLUGIN_NAME = "BiggerItemStack";

	public const string PLUGIN_VERSION = "1.0.0";
}