Decompiled source of InventoryFix v1.0.1

inventoryFix.dll

Decompiled 3 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using EasyTextEffects.Editor.MyBoxCopy.Extensions;
using GameNetcodeStuff;
using HarmonyLib;
using InventoryFix.Patches;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("inventoryFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("inventoryFix")]
[assembly: AssemblyTitle("inventoryFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 InventoryFix
{
	[BepInPlugin("Madarvadasz.InventoryFix", "InventoryFix", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "Madarvadasz.InventoryFix";

		public const string modName = "InventoryFix";

		public const string modVersion = "1.0.0";

		private static Harmony _harmony = new Harmony("Madarvadasz.InventoryFix");

		internal static ManualLogSource logger = Logger.CreateLogSource("Madarvadasz.InventoryFix");

		private void Awake()
		{
			_harmony.PatchAll(typeof(PlayerControllerBPatch));
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "inventoryFix";

		public const string PLUGIN_NAME = "inventoryFix";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace InventoryFix.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("FirstEmptyItemSlot")]
		[HarmonyPrefix]
		private static bool FirstEmptyItemSlotPatch(ref PlayerControllerB __instance, ref int __result)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				__result = -1;
				return false;
			}
			if (__instance.currentItemSlot < __instance.ItemSlots.Length)
			{
				return true;
			}
			__result = MyCollections.FirstIndex<GrabbableObject>((IList<GrabbableObject>)__instance.ItemSlots, (Predicate<GrabbableObject>)((GrabbableObject item) => (Object)(object)item == (Object)null));
			return false;
		}
	}
}