Decompiled source of ImprovedScoop v0.1.2

ImprovedScoop.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CG;
using CG.Game;
using CG.Network;
using CG.Objects;
using CG.Ship.Hull;
using CG.Ship.Modules;
using CG.Space;
using Gameplay.Carryables;
using Gameplay.Utilities;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using RSG;
using ResourceAssets;
using UnityEngine;
using VoidManager;
using VoidManager.CustomGUI;
using VoidManager.MPModChecks;
using VoidManager.Utilities;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ImprovedScoop")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Template")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ImprovedScoop")]
[assembly: AssemblyTitle("ImprovedScoop")]
[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 ImprovedScoop
{
	internal static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "improvedscoop";

		public const string PLUGIN_NAME = "Improved Scoop";

		public const string PLUGIN_VERSION = "0.1.2";
	}
	[BepInPlugin("improvedscoop", "Improved Scoop", "0.1.2")]
	[BepInProcess("Void Crew.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BepinPlugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "improvedscoop");
			ScoopConfig.BindConfigs(this);
			GUIDManager.GenerateDictionaries();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin improvedscoop is loaded!");
		}
	}
	[HarmonyPatch(typeof(CarryableAttractorLink), "TryInsertIntoSocket")]
	internal class CarryableAttractorLinkPatch
	{
		private static List<AbstractCarryableObject> shardQueue = new List<AbstractCarryableObject>();

		private static bool Prefix(CarryableAttractorLink __instance, Action<CarryableAttractorLink> OnInsertCompleted)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			string name = ((Object)__instance.carryable).name;
			if (ScoopConfig.ProcessAlloys.Value && name.Contains("Item_Alloy"))
			{
				int.TryParse(name.Substring(name.Length - 1), out var result);
				OnInsertCompleted(__instance);
				GameSessionProgressTracker.Instance.ModifyAlloyCount(result * 3, (ResourceChangeAlloy)0, ((AbstractCloneStarObject)__instance.carryable).assetGuid);
				ObjectFactory.DestroyCloneStarObject((AbstractCloneStarObject)(object)__instance.carryable);
				return false;
			}
			if (ScoopConfig.ProcessBiomass.Value && name.Contains("Item_Biomass"))
			{
				int.TryParse(name.Substring(name.Length - 1), out var result2);
				if (1 == 0)
				{
				}
				int num = result2 switch
				{
					1 => 25, 
					2 => 75, 
					3 => 150, 
					_ => 0, 
				};
				if (1 == 0)
				{
				}
				int num2 = num;
				OnInsertCompleted(__instance);
				GameSessionProgressTracker.Instance.ModifyBiomassCount(num2, (ResourceChangeBiomass)1, ((AbstractCloneStarObject)__instance.carryable).assetGuid);
				ObjectFactory.DestroyCloneStarObject((AbstractCloneStarObject)(object)__instance.carryable);
				return false;
			}
			if (ScoopConfig.ProcessShards.Value)
			{
				bool flag = false;
				bool flag2 = false;
				CsTag[] csTags = ((OrbitObject)__instance.carryable).CsTags;
				foreach (CsTag val in csTags)
				{
					if (((Object)val).name == "Tag_DataShard_Generic")
					{
						flag = true;
					}
					if (((Object)val).name == "Tag_DataShard_Escort" || ((Object)val).name == "Tag_DataShard_Minefield")
					{
						flag2 = true;
					}
				}
				if (flag && (!flag2 || ScoopConfig.ProcessSummonShards.Value))
				{
					CarryablesSocket val2 = ((IEnumerable<CarryablesSocketProvider>)((Component)ClientGame.Current.PlayerShip).GetComponentsInChildren<CarryablesSocketProvider>()).FirstOrDefault((Func<CarryablesSocketProvider, bool>)((CarryablesSocketProvider provider) => ((Object)provider).name == "Module_Ship_Terminal_AstralMap")).Sockets[0];
					if (TryInsertShard(__instance.carryable))
					{
						return false;
					}
					if (shardQueue.Count == 0)
					{
						Events.Instance.LateUpdate += TryShards;
					}
					shardQueue.Add(__instance.carryable);
				}
			}
			if (ScoopConfig.MoveToShelf.Value)
			{
				CarryablesShelf[] componentsInChildren = ((Component)ClientGame.Current.PlayerShip).GetComponentsInChildren<CarryablesShelf>();
				CarryablesShelf[] array = componentsInChildren;
				foreach (CarryablesShelf val3 in array)
				{
					foreach (CarryablesSocket carryablesSocket in ((CellModule)val3).CarryablesSockets)
					{
						if (!carryablesSocket.IsFull && carryablesSocket.DoesAccept(__instance.carryable))
						{
							OnInsertCompleted(__instance);
							carryablesSocket.TryInsertCarryable(__instance.carryable);
							return false;
						}
					}
				}
			}
			return true;
		}

		private static void TryShards(object sender, EventArgs e)
		{
			if (TryInsertShard(shardQueue.First()))
			{
				shardQueue.RemoveAt(0);
			}
			if (shardQueue.Count == 0)
			{
				Events.Instance.LateUpdate -= TryShards;
			}
		}

		private static bool TryInsertShard(AbstractCarryableObject shard)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Invalid comparison between Unknown and I4
			CarryablesSocket val = ((IEnumerable<CarryablesSocketProvider>)((Component)ClientGame.Current.PlayerShip).GetComponentsInChildren<CarryablesSocketProvider>()).FirstOrDefault((Func<CarryablesSocketProvider, bool>)((CarryablesSocketProvider provider) => ((Object)provider).name == "Module_Ship_Terminal_AstralMap")).Sockets[0];
			if ((int)val.CurrentState == 0 || val.IsFull || !val.IsInput || (Object)(object)val.Payload != (Object)null)
			{
				return false;
			}
			Promise val2 = (Promise)val.TryInsertCarryable(shard);
			if ((int)val2.CurState != 1)
			{
				return true;
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(CarryableAttractor))]
	internal class CarryableAttractorPatch
	{
		internal static List<GUIDUnion> dotNotAttract = ScoopConfig.HexToGUIDs(ScoopConfig.ItemBlacklist.Value);

		private static readonly FieldInfo carryablesSocketProviderField = AccessTools.Field(typeof(CarryableAttractor), "_carryablesSocketProvider");

		[HarmonyPrefix]
		[HarmonyPatch("Awake")]
		private static void Awake(CarryableAttractor __instance, ref float ____catchRadius, ref ModifiableFloat ___MaxRange, ref ModifiableFloat ____pullVelocity)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			____catchRadius = 3f * ScoopConfig.CatchRadiusMultiplier.Value;
			___MaxRange = ModifiableFloat.op_Implicit(200f * ScoopConfig.MaxRangeMultiplier.Value);
			____pullVelocity = ModifiableFloat.op_Implicit(10f * TierModifier(__instance) * ScoopConfig.PullVelocityMultiplier.Value);
			foreach (CarryablesSocket socket in ((CarryablesSocketProvider)carryablesSocketProviderField.GetValue(__instance)).Sockets)
			{
				socket.OnAcquireCarryable += GravityScoopEject.SocketItemInserted;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnDestroy")]
		private static void OnDestroy(CarryableAttractor __instance)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			foreach (CarryablesSocket socket in ((CarryablesSocketProvider)carryablesSocketProviderField.GetValue(__instance)).Sockets)
			{
				socket.OnAcquireCarryable -= GravityScoopEject.SocketItemInserted;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("GetPossibleItemsToAttrack")]
		private static void GetPossibleItemsToAttrack(ref List<AbstractCarryableObject> __result)
		{
			if (PhotonNetwork.IsMasterClient)
			{
				__result.RemoveAll((AbstractCarryableObject item) => dotNotAttract.Contains(((AbstractCloneStarObject)item).assetGuid));
			}
		}

		public static float TierModifier(CarryableAttractor attractor)
		{
			if (attractor != null && ((Object)attractor).name?.Contains("_02") == true)
			{
				return 2f;
			}
			if (attractor != null && ((Object)attractor).name?.Contains("_03") == true)
			{
				return 4f;
			}
			return 1f;
		}
	}
	internal class GravityScoopEject
	{
		internal static List<GUIDUnion> eject = ScoopConfig.HexToGUIDs(ScoopConfig.ItemEjectlist.Value);

		private static Dictionary<CarryablesSocket, DateTime> toEject = new Dictionary<CarryablesSocket, DateTime>();

		private const long EjectWaitTimeMs = 1000L;

		private const float distance = 4f;

		private const float speed = 100f;

		private static readonly FieldInfo attractPointField = AccessTools.Field(typeof(CarryableAttractor), "_attractPoint");

		internal static void CheckAndEject(object sender, EventArgs e)
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			for (int num = toEject.Count - 1; num >= 0; num--)
			{
				KeyValuePair<CarryablesSocket, DateTime> keyValuePair = toEject.ElementAt(num);
				CarryablesSocket key = keyValuePair.Key;
				DateTime value = keyValuePair.Value;
				if ((Object)(object)key.Payload == (Object)null)
				{
					toEject.Remove(key);
				}
				else if ((DateTime.Now - value).TotalMilliseconds > 1000.0)
				{
					toEject.Remove(key);
					Transform val = (Transform)attractPointField.GetValue(((AbstractCloneStarObject)key).GameObject.GetComponentInParent<CarryableAttractor>());
					Transform transform = ((Component)key.Payload).transform;
					transform.position += val.rotation * (Vector3.back * 4f);
					key.CarryableHandler.TryEjectCarryable(val.rotation * (Vector3.back * 100f));
				}
			}
			if (toEject.Count == 0)
			{
				Events.Instance.LateUpdate -= CheckAndEject;
			}
		}

		internal static void SocketItemInserted(ICarrier carrier, AbstractCarryableObject carryable, ICarrier previousCarrier)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			if (PhotonNetwork.IsMasterClient && eject.Contains(((AbstractCloneStarObject)carryable).assetGuid) && carrier is CarryablesSocket)
			{
				if (toEject.Count == 0)
				{
					Events.Instance.LateUpdate += CheckAndEject;
				}
				toEject.Add((CarryablesSocket)carrier, DateTime.Now);
			}
		}
	}
	internal class GUI : ModSettingsMenu
	{
		private readonly FieldInfo PullVelocityField = AccessTools.Field(typeof(CarryableAttractor), "_pullVelocity");

		private readonly FieldInfo CatchRadiusField = AccessTools.Field(typeof(CarryableAttractor), "_catchRadius");

		private string ItemBlacklistString;

		private string ItemEjectlistString;

		private string MaxRangeMultiplierString = $"{ScoopConfig.MaxRangeMultiplier.Value}";

		private string PullVelocityMultiplierString = $"{ScoopConfig.PullVelocityMultiplier.Value}";

		private string CatchRadiusMultiplierString = $"{ScoopConfig.CatchRadiusMultiplier.Value}";

		public override string Name()
		{
			return "Improved Scoop";
		}

		public override void OnOpen()
		{
			ItemBlacklistString = GUIDManager.GetDisplayNameList(CarryableAttractorPatch.dotNotAttract);
			ItemEjectlistString = GUIDManager.GetDisplayNameList(GravityScoopEject.eject);
		}

		public override void Draw()
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Ignore these items:", Array.Empty<GUILayoutOption>());
			ItemBlacklistString = GUILayout.TextField(ItemBlacklistString, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) });
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Apply", Array.Empty<GUILayoutOption>()))
			{
				CarryableAttractorPatch.dotNotAttract = GUIDManager.GetGUIDs(ItemBlacklistString);
				ItemBlacklistString = GUIDManager.GetDisplayNameList(CarryableAttractorPatch.dotNotAttract);
				ScoopConfig.ItemBlacklist.Value = ScoopConfig.GUIDsToHex(GUIDManager.GetGUIDs(ItemBlacklistString));
			}
			if (GUILayout.Button("Reset", Array.Empty<GUILayoutOption>()))
			{
				CarryableAttractorPatch.dotNotAttract = ScoopConfig.ItemBlacklistDefault;
				ScoopConfig.ItemBlacklist.Value = ScoopConfig.GUIDsToHex(CarryableAttractorPatch.dotNotAttract);
				ItemBlacklistString = GUIDManager.GetDisplayNameList(CarryableAttractorPatch.dotNotAttract);
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Eject these items:", Array.Empty<GUILayoutOption>());
			ItemEjectlistString = GUILayout.TextField(ItemEjectlistString, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) });
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Apply", Array.Empty<GUILayoutOption>()))
			{
				GravityScoopEject.eject = GUIDManager.GetGUIDs(ItemEjectlistString);
				ItemEjectlistString = GUIDManager.GetDisplayNameList(GravityScoopEject.eject);
				ScoopConfig.ItemEjectlist.Value = ScoopConfig.GUIDsToHex(GUIDManager.GetGUIDs(ItemEjectlistString));
			}
			if (GUILayout.Button("Reset", Array.Empty<GUILayoutOption>()))
			{
				GravityScoopEject.eject = ScoopConfig.ItemEjectlistDefault;
				ScoopConfig.ItemEjectlist.Value = ScoopConfig.GUIDsToHex(GravityScoopEject.eject);
				ItemEjectlistString = GUIDManager.GetDisplayNameList(GravityScoopEject.eject);
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Max range multiplier:", Array.Empty<GUILayoutOption>());
			MaxRangeMultiplierString = GUILayout.TextField(MaxRangeMultiplierString, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) });
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Apply", Array.Empty<GUILayoutOption>()) && float.TryParse(MaxRangeMultiplierString, out var maxRangeMultiplier))
			{
				ScoopConfig.MaxRangeMultiplier.Value = maxRangeMultiplier;
				IterateAttractors(delegate(CarryableAttractor attractor)
				{
					((ModifiablePrimitive<float, FloatModifier>)(object)attractor.MaxRange).SetBaseValue(200f * maxRangeMultiplier);
				});
			}
			if (GUILayout.Button("Reset", Array.Empty<GUILayoutOption>()))
			{
				ScoopConfig.MaxRangeMultiplier.Value = (float)((ConfigEntryBase)ScoopConfig.MaxRangeMultiplier).DefaultValue;
				MaxRangeMultiplierString = $"{ScoopConfig.MaxRangeMultiplier.Value}";
				IterateAttractors(delegate(CarryableAttractor attractor)
				{
					((ModifiablePrimitive<float, FloatModifier>)(object)attractor.MaxRange).SetBaseValue(200f * ScoopConfig.MaxRangeMultiplier.Value);
				});
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Pull velocity multiplier:", Array.Empty<GUILayoutOption>());
			PullVelocityMultiplierString = GUILayout.TextField(PullVelocityMultiplierString, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) });
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Apply", Array.Empty<GUILayoutOption>()) && float.TryParse(PullVelocityMultiplierString, out var pullVelocityMultiplier))
			{
				ScoopConfig.PullVelocityMultiplier.Value = pullVelocityMultiplier;
				IterateAttractors(delegate(CarryableAttractor attractor)
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_002e: Expected O, but got Unknown
					((ModifiablePrimitive<float, FloatModifier>)(ModifiableFloat)PullVelocityField.GetValue(attractor)).SetBaseValue(10f * CarryableAttractorPatch.TierModifier(attractor) * pullVelocityMultiplier);
				});
			}
			if (GUILayout.Button("Reset", Array.Empty<GUILayoutOption>()))
			{
				ScoopConfig.PullVelocityMultiplier.Value = (float)((ConfigEntryBase)ScoopConfig.PullVelocityMultiplier).DefaultValue;
				PullVelocityMultiplierString = $"{ScoopConfig.PullVelocityMultiplier.Value}";
				IterateAttractors(delegate(CarryableAttractor attractor)
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Expected O, but got Unknown
					((ModifiablePrimitive<float, FloatModifier>)(ModifiableFloat)PullVelocityField.GetValue(attractor)).SetBaseValue(10f * CarryableAttractorPatch.TierModifier(attractor) * ScoopConfig.PullVelocityMultiplier.Value);
				});
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Catch radius multiplier:", Array.Empty<GUILayoutOption>());
			CatchRadiusMultiplierString = GUILayout.TextField(CatchRadiusMultiplierString, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) });
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Apply", Array.Empty<GUILayoutOption>()) && float.TryParse(CatchRadiusMultiplierString, out var catchRadiusMultiplier))
			{
				ScoopConfig.CatchRadiusMultiplier.Value = catchRadiusMultiplier;
				IterateAttractors(delegate(CarryableAttractor attractor)
				{
					CatchRadiusField.SetValue(attractor, 3f * catchRadiusMultiplier);
				});
			}
			if (GUILayout.Button("Reset", Array.Empty<GUILayoutOption>()))
			{
				ScoopConfig.CatchRadiusMultiplier.Value = (float)((ConfigEntryBase)ScoopConfig.CatchRadiusMultiplier).DefaultValue;
				CatchRadiusMultiplierString = $"{ScoopConfig.CatchRadiusMultiplier.Value}";
				IterateAttractors(delegate(CarryableAttractor attractor)
				{
					CatchRadiusField.SetValue(attractor, 3f * ScoopConfig.CatchRadiusMultiplier.Value);
				});
			}
			GUILayout.EndHorizontal();
			bool value = ScoopConfig.ProcessAlloys.Value;
			if (GUITools.DrawCheckbox("Process Alloys", ref value))
			{
				ScoopConfig.ProcessAlloys.Value = value;
			}
			bool value2 = ScoopConfig.ProcessBiomass.Value;
			if (GUITools.DrawCheckbox("Process Biomass", ref value2))
			{
				ScoopConfig.ProcessBiomass.Value = value2;
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			bool value3 = ScoopConfig.ProcessShards.Value;
			if (GUITools.DrawCheckbox("Process data shards", ref value3))
			{
				ScoopConfig.ProcessShards.Value = value3;
			}
			GUILayout.Space(10f);
			bool value4 = ScoopConfig.ProcessSummonShards.Value;
			if (GUITools.DrawCheckbox("Include Minefield and Escort shards", ref value4))
			{
				ScoopConfig.ProcessSummonShards.Value = value4;
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			bool value5 = ScoopConfig.MoveToShelf.Value;
			if (GUITools.DrawCheckbox("Put items in shelves", ref value5))
			{
				ScoopConfig.MoveToShelf.Value = value5;
			}
		}

		private void IterateAttractors(Action<CarryableAttractor> action)
		{
			ClientGame current = ClientGame.Current;
			object obj;
			if (current == null)
			{
				obj = null;
			}
			else
			{
				AbstractPlayerControlledShip playerShip = current.PlayerShip;
				obj = ((playerShip != null) ? ((Component)playerShip).GetComponentsInChildren<CarryableAttractor>() : null);
			}
			CarryableAttractor[] array = (CarryableAttractor[])obj;
			if (array != null)
			{
				CarryableAttractor[] array2 = array;
				foreach (CarryableAttractor obj2 in array2)
				{
					action(obj2);
				}
			}
		}
	}
	internal class GUIDManager
	{
		private static Dictionary<GUIDUnion, string> DisplayNames;

		public static void GenerateDictionaries()
		{
			List<CarryableDef> list = ((ResourceAssetContainer<CarryableContainer, AbstractCarryableObject, CarryableDef>)(object)ResourceAssetContainer<CarryableContainer, AbstractCarryableObject, CarryableDef>.Instance)?.AssetDescriptions;
			if (list == null || list.Count == 0)
			{
				BepinPlugin.Log.LogInfo((object)"GenerateDictionaries could not load AssetDescriptions");
				return;
			}
			DisplayNames = list.ToDictionary((CarryableDef item) => ((ResourceAssetDef<AbstractCarryableObject>)(object)item).AssetGuid, (CarryableDef item) => ((AbstractCloneStarObject)((ResourceAssetDef<AbstractCarryableObject>)(object)item).Asset).DisplayName);
		}

		public static List<GUIDUnion> GetGUIDs(string displayNameCSV)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(displayNameCSV))
			{
				return new List<GUIDUnion>();
			}
			string[] array = displayNameCSV.Split(new char[1] { ',' });
			List<GUIDUnion> list = new List<GUIDUnion>();
			string[] array2 = array;
			foreach (string displayName in array2)
			{
				KeyValuePair<GUIDUnion, string> keyValuePair = DisplayNames.FirstOrDefault((KeyValuePair<GUIDUnion, string> kvp) => kvp.Value.ToLower().Contains(displayName.Trim().ToLower()));
				if (!string.IsNullOrEmpty(keyValuePair.Value))
				{
					list.Add(keyValuePair.Key);
				}
			}
			return list;
		}

		public static string GetDisplayNameList(List<GUIDUnion> guids)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			List<string> list = new List<string>();
			foreach (GUIDUnion guid in guids)
			{
				if (DisplayNames.ContainsKey(guid))
				{
					list.Add(DisplayNames[guid]);
				}
			}
			return string.Join(", ", list);
		}
	}
	internal class ScoopConfig
	{
		internal static readonly List<GUIDUnion> ItemBlacklistDefault = new List<GUIDUnion>
		{
			new GUIDUnion("ee69440bbce371e458daeba6eee12a49"),
			new GUIDUnion("6c37b5363f7ef7844881a301dca76572"),
			new GUIDUnion("ec0fc0790a706ef4facab39da5d9de04"),
			new GUIDUnion("e1bdce573e8182b4d95aacb841301d7c")
		};

		internal static readonly List<GUIDUnion> ItemEjectlistDefault = new List<GUIDUnion>
		{
			new GUIDUnion("ee69440bbce371e458daeba6eee12a49")
		};

		internal const float maxRangeBase = 200f;

		internal const float pullVelocityBase = 10f;

		internal const float catchRadiusBase = 3f;

		internal static ConfigEntry<string> ItemBlacklist;

		internal static ConfigEntry<string> ItemEjectlist;

		internal static ConfigEntry<float> MaxRangeMultiplier;

		internal static ConfigEntry<float> PullVelocityMultiplier;

		internal static ConfigEntry<float> CatchRadiusMultiplier;

		internal static ConfigEntry<bool> ProcessAlloys;

		internal static ConfigEntry<bool> ProcessBiomass;

		internal static ConfigEntry<bool> ProcessShards;

		internal static ConfigEntry<bool> ProcessSummonShards;

		internal static ConfigEntry<bool> MoveToShelf;

		internal static void BindConfigs(BepinPlugin plugin)
		{
			ItemBlacklist = ((BaseUnityPlugin)plugin).Config.Bind<string>("GravityScoop", "ItemBlacklist", GUIDsToHex(ItemBlacklistDefault), (ConfigDescription)null);
			ItemEjectlist = ((BaseUnityPlugin)plugin).Config.Bind<string>("GravityScoop", "ItemEjectlist", GUIDsToHex(ItemEjectlistDefault), (ConfigDescription)null);
			MaxRangeMultiplier = ((BaseUnityPlugin)plugin).Config.Bind<float>("GravityScoop", "MaxRangeMultiplier", 2f, (ConfigDescription)null);
			PullVelocityMultiplier = ((BaseUnityPlugin)plugin).Config.Bind<float>("GravityScoop", "PullVelocityMultiplier", 3f, (ConfigDescription)null);
			CatchRadiusMultiplier = ((BaseUnityPlugin)plugin).Config.Bind<float>("GravityScoop", "CatchRadiusMultiplier", 1.5f, (ConfigDescription)null);
			ProcessAlloys = ((BaseUnityPlugin)plugin).Config.Bind<bool>("GravityScoop", "ProcessAlloys", false, (ConfigDescription)null);
			ProcessBiomass = ((BaseUnityPlugin)plugin).Config.Bind<bool>("GravityScoop", "ProcessBiomass", false, (ConfigDescription)null);
			ProcessShards = ((BaseUnityPlugin)plugin).Config.Bind<bool>("GravityScoop", "ProcessShards", false, (ConfigDescription)null);
			ProcessSummonShards = ((BaseUnityPlugin)plugin).Config.Bind<bool>("GravityScoop", "ProcessSummonShards", false, (ConfigDescription)null);
			MoveToShelf = ((BaseUnityPlugin)plugin).Config.Bind<bool>("GravityScoop", "MoveToShelf", false, (ConfigDescription)null);
		}

		internal static List<GUIDUnion> HexToGUIDs(string str)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(str))
			{
				return new List<GUIDUnion>();
			}
			string[] array = str.Split(new char[1] { ',' });
			List<GUIDUnion> list = new List<GUIDUnion>();
			string[] array2 = array;
			foreach (string text in array2)
			{
				list.Add(new GUIDUnion(text));
			}
			return list;
		}

		internal static string GUIDsToHex(List<GUIDUnion> guids)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if (guids.Count == 0)
			{
				return "";
			}
			StringBuilder stringBuilder = new StringBuilder();
			foreach (GUIDUnion guid in guids)
			{
				GUIDUnion current = guid;
				stringBuilder.Append(((GUIDUnion)(ref current)).AsHex());
				stringBuilder.Append(",");
			}
			stringBuilder.Remove(stringBuilder.Length - 1, 1);
			return stringBuilder.ToString();
		}
	}
	public class VoidManagerPlugin : VoidPlugin
	{
		public override MultiplayerType MPType => (MultiplayerType)4;

		public override string Author => "18107, Dragon";

		public override string Description => "Increases Range, Radius, and Pull speed of gravity scoops. Ignores Mission Items, Configurable in-game. \n\nInspired by Maverik's BetterScoop";
	}
}