Decompiled source of BetterTakeAll v0.1.3

BetterTakeAll.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BetterTakeAll")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BetterTakeAll")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0C759F64-2939-4977-B934-DBA0B8B32FDD")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace BetterTakeAll
{
	[BepInPlugin("spboyle7.BetterTakeAll", "Better Take All", "0.1.0")]
	public class BetterTakeAllPlugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Inventory), "MoveAll")]
		public static class MoveAll_Patch
		{
			private static bool Prefix(Inventory __instance, Inventory fromInventory)
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				List<ItemData> list = new List<ItemData>(fromInventory.GetAllItems());
				List<ItemData> list2 = new List<ItemData>();
				foreach (ItemData item in list)
				{
					if (__instance.AddItem(item, new Vector2i(item.m_gridPos.x, item.m_gridPos.y)))
					{
						fromInventory.RemoveItem(item);
					}
					else
					{
						list2.Add(item);
					}
				}
				foreach (ItemData item2 in list2)
				{
					if (__instance.AddItem(item2))
					{
						fromInventory.RemoveItem(item2);
					}
				}
				__instance.Changed();
				fromInventory.Changed();
				return false;
			}
		}

		private const string pluginGUID = "spboyle7.BetterTakeAll";

		private const string pluginName = "Better Take All";

		private const string pluginVersion = "0.1.0";

		public static ManualLogSource logger = Logger.CreateLogSource("Better Take All");

		public void Awake()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		}
	}
}