Decompiled source of MassPickup v1.0.0

MassPickup.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
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("MassPickup")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MassPickup")]
[assembly: AssemblyTitle("MassPickup")]
[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 MassPickupGrizzzly
{
	[BepInPlugin("com.grizzzly.masspickup", "MassPickup", "1.0.0")]
	public class MassFarming : BaseUnityPlugin
	{
		private static ConfigEntry<KeyboardShortcut> MassActionHotkey;

		private static ConfigEntry<float> MassInteractRange;

		private void Awake()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			MassActionHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "MassActionHotkey", new KeyboardShortcut((KeyCode)304, Array.Empty<KeyCode>()), "Hotkey untuk multi-pickup.");
			MassInteractRange = ((BaseUnityPlugin)this).Config.Bind<float>("Pickup", "MassInteractRange", 5f, "Radius pickup.");
			Harmony.CreateAndPatchAll(typeof(MassFarming), (string)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"MassFarming 1.0.0 Loaded. Press LeftShift while interacting to mass pickup.");
		}

		[HarmonyPatch(typeof(Player), "Interact")]
		[HarmonyPrefix]
		private static bool InteractPrefix(Player __instance, GameObject go, bool hold, bool alt)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if (hold)
			{
				return true;
			}
			IInputSystem current = UnityInput.Current;
			KeyboardShortcut value = MassActionHotkey.Value;
			if (!current.GetKey(((KeyboardShortcut)(ref value)).MainKey))
			{
				return true;
			}
			Collider[] array = Physics.OverlapSphere(go.transform.position, MassInteractRange.Value);
			HashSet<Interactable> hashSet = new HashSet<Interactable>();
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				Interactable componentInParent = ((Component)val).GetComponentInParent<Interactable>();
				if (componentInParent != null && !hashSet.Contains(componentInParent))
				{
					if ((Object)(object)((Component)val).gameObject == (Object)(object)go || (Object)(object)((Component)((Component)val).transform.root).gameObject == (Object)(object)go)
					{
						hashSet.Add(componentInParent);
						continue;
					}
					componentInParent.Interact((Humanoid)(object)__instance, false, alt);
					hashSet.Add(componentInParent);
				}
			}
			return true;
		}
	}
}