Decompiled source of UsualScrap v1.8.6

UsualScrap.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using Dawn;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UsualScrap.Behaviors;
using UsualScrap.Behaviors.Effects;
using UsualScrap.NetcodePatcher;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("UsualScrap")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds 15+ unique equipment and scrap items that try to keep the vanilla tone")]
[assembly: AssemblyFileVersion("1.8.0.0")]
[assembly: AssemblyInformationalVersion("1.8.0")]
[assembly: AssemblyProduct("UsualScrap")]
[assembly: AssemblyTitle("UsualScrap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.8.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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;
		}
	}
	[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 UsualScrap
{
	[BepInPlugin("Emil.UsualScrap", "UsualScrap", "1.8.6")]
	public class Plugin : BaseUnityPlugin
	{
		public static class ScrapPackKeys
		{
			public static readonly NamespacedKey<DawnItemInfo> US_PocketWatch = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Pocket_Watch");

			public static readonly NamespacedKey<DawnItemInfo> US_ServantBell = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Servant_Bell");

			public static readonly NamespacedKey<DawnItemInfo> US_TrafficCone = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Traffic_Cone");

			public static readonly NamespacedKey<DawnItemInfo> US_LargeGear = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Large_Gear");
		}

		public static class ScrapItemKeys
		{
			public static readonly NamespacedKey<DawnItemInfo> US_Ticket = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Ticket");

			public static readonly NamespacedKey<DawnItemInfo> US_GoldenTicket = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Golden_Ticket");

			public static readonly NamespacedKey<DawnItemInfo> US_Rose = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Rose");

			public static readonly NamespacedKey<DawnItemInfo> US_Scissors = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Scissors");

			public static readonly NamespacedKey<DawnItemInfo> US_WalkingCane = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Walking_Cane");

			public static readonly NamespacedKey<DawnItemInfo> US_CandyDispenser = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Candy_Dispenser");

			public static readonly NamespacedKey<DawnItemInfo> US_PieceofCandy = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Piece_of_Candy");

			public static readonly NamespacedKey<DawnItemInfo> US_FuelCylinder = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Fuel_Cylinder");

			public static readonly NamespacedKey<DawnItemInfo> US_RadioactiveCell = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Radioactive_Cell");

			public static readonly NamespacedKey<DawnItemInfo> US_GloomyCapsule = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Gloomy_Capsule");

			public static readonly NamespacedKey<DawnItemInfo> US_FrigidCapsule = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Frigid_Capsule");

			public static readonly NamespacedKey<DawnItemInfo> US_NoxiousCapsule = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Noxious_Capsule");

			public static readonly NamespacedKey<DawnItemInfo> US_BloodyCapsule = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Bloody_Capsule");

			public static readonly NamespacedKey<DawnItemInfo> US_Padlock = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Padlock");

			public static readonly NamespacedKey<DawnItemInfo> US_SalvagedPadlock = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Salvaged_Padlock");

			public static readonly NamespacedKey<DawnItemInfo> US_Crowbar = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Crowbar");

			public static readonly NamespacedKey<DawnItemInfo> US_SalvagedCrowbar = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Salvaged_Crowbar");

			public static readonly NamespacedKey<DawnItemInfo> US_DoomsayerBell = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Doomsayer_Bell");
		}

		public static class StoreItemKeys
		{
			public static readonly NamespacedKey<DawnItemInfo> US_HandLamp = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Hand_Lamp");

			public static readonly NamespacedKey<DawnItemInfo> US_Bandages = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Bandages");

			public static readonly NamespacedKey<DawnItemInfo> US_MedicalKit = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Medical_Kit");

			public static readonly NamespacedKey<DawnItemInfo> US_Defibrillator = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Defibrillator");

			public static readonly NamespacedKey<DawnItemInfo> US_ProductivityAutoinjector = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Productivity_Autoinjector");

			public static readonly NamespacedKey<DawnItemInfo> US_ShiftController = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Shift_Controller");

			public static readonly NamespacedKey<DawnItemInfo> US_Toolbox = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Toolbox");
		}

		public const string PLUGIN_GUID = "Emil.UsualScrap";

		public const string PLUGIN_NAME = "UsualScrap";

		public const string PLUGIN_VERSION = "1.8.6";

		public static Plugin instance;

		internal static UsualScrapConfigs BoundConfig { get; private set; }

		public void InitializeItem(GrabbableObject itemScript, bool grabbable, bool grabbableToEnemies, Item itemProperties)
		{
			NetworkPrefabs.RegisterNetworkPrefab(itemProperties.spawnPrefab);
			Utilities.FixMixerGroups(itemProperties.spawnPrefab);
			itemScript.grabbable = grabbable;
			itemScript.grabbableToEnemies = grabbableToEnemies;
			itemScript.itemProperties = itemProperties;
		}

		public void Awake()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			instance = this;
			BoundConfig = new UsualScrapConfigs(((BaseUnityPlugin)this).Config);
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "usualscrapassetbundle"));
			if (BoundConfig.MansionScrapPackEnabled.Value)
			{
				try
				{
					Item val2 = val.LoadAsset<Item>("Assets/UsualScrapContent/ScrapPackItems/PocketWatchAssets/US_PocketWatchItem.asset");
					PhysicsProp itemScript = val2.spawnPrefab.AddComponent<PhysicsProp>();
					InitializeItem((GrabbableObject)(object)itemScript, grabbable: true, grabbableToEnemies: true, val2);
					DawnLib.DefineItem(ScrapPackKeys.US_PocketWatch, val2, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
					{
						builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
						{
							scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
							{
								weightBuilder.SetGlobalWeight(20);
							});
						});
					});
				}
				catch
				{
					Debug.LogError((object)"USUAL SCRAP - US_PocketWatch scrap pack item experienced an error while loading. Skipping...");
				}
				try
				{
					Item val3 = val.LoadAsset<Item>("Assets/UsualScrapContent/ScrapPackItems/ServantBellAssets/US_ServantBellItem.asset");
					NoiseMakerItemScript itemScript2 = val3.spawnPrefab.AddComponent<NoiseMakerItemScript>();
					InitializeItem((GrabbableObject)(object)itemScript2, grabbable: true, grabbableToEnemies: true, val3);
					DawnLib.DefineItem(ScrapPackKeys.US_ServantBell, val3, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
					{
						builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
						{
							scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
							{
								weightBuilder.SetGlobalWeight(20);
							});
						});
					});
				}
				catch
				{
					Debug.LogError((object)"USUAL SCRAP - Servant Bell scrap pack item experienced an error while loading. Skipping...");
				}
			}
			if (BoundConfig.FacilityScrapPackEnabled.Value)
			{
				try
				{
					Item val4 = val.LoadAsset<Item>("Assets/UsualScrapContent/ScrapPackItems/TrafficConeAssets/US_TrafficConeItem.asset");
					PhysicsProp itemScript3 = val4.spawnPrefab.AddComponent<PhysicsProp>();
					InitializeItem((GrabbableObject)(object)itemScript3, grabbable: true, grabbableToEnemies: true, val4);
					DawnLib.DefineItem(ScrapPackKeys.US_TrafficCone, val4, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
					{
						builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
						{
							scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
							{
								weightBuilder.SetGlobalWeight(20);
							});
						});
					});
				}
				catch
				{
					Debug.LogError((object)"USUAL SCRAP - Traffic Cone scrap pack item experienced an error while loading. Skipping...");
				}
				try
				{
					Item val5 = val.LoadAsset<Item>("Assets/UsualScrapContent/ScrapPackItems/LargeGearAssets/US_LargeGearItem.asset");
					PhysicsProp itemScript4 = val5.spawnPrefab.AddComponent<PhysicsProp>();
					InitializeItem((GrabbableObject)(object)itemScript4, grabbable: true, grabbableToEnemies: true, val5);
					DawnLib.DefineItem(ScrapPackKeys.US_LargeGear, val5, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
					{
						builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
						{
							scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
							{
								weightBuilder.SetGlobalWeight(30);
							});
						});
					});
				}
				catch
				{
					Debug.LogError((object)"USUAL SCRAP - US_PocketWatch scrap pack item experienced an error while loading. Skipping...");
				}
			}
			try
			{
				if (BoundConfig.TicketLoaded.Value)
				{
					Item US_Ticket = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/TicketAssets/US_TicketItem.asset");
					TicketScript itemScript5 = US_Ticket.spawnPrefab.AddComponent<TicketScript>();
					InitializeItem((GrabbableObject)(object)itemScript5, grabbable: true, grabbableToEnemies: true, US_Ticket);
					if (BoundConfig.TicketSpawnsAsScrap.Value)
					{
						string[] ticketMoonStrings = BoundConfig.TicketMoonSpawnWeights.Value.Split(',');
						DawnLib.DefineItem(ScrapItemKeys.US_Ticket, US_Ticket, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									buildweights(weightBuilder, ticketMoonStrings, BoundConfig.TicketGlobalSpawnWeight.Value, US_Ticket);
								});
							});
						});
					}
					else
					{
						Items.RegisterItem(US_Ticket);
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - US_Ticket experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.GoldenTicketLoaded.Value)
				{
					Item US_GoldenTicket = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/GoldenTicketAssets/US_GoldenTicketItem.asset");
					GoldenTicketScript itemScript6 = US_GoldenTicket.spawnPrefab.AddComponent<GoldenTicketScript>();
					InitializeItem((GrabbableObject)(object)itemScript6, grabbable: true, grabbableToEnemies: true, US_GoldenTicket);
					if (BoundConfig.GoldenTicketSpawnsAsScrap.Value)
					{
						string[] goldenTicketMoonStrings = BoundConfig.GoldenTicketMoonSpawnWeights.Value.Split(',');
						DawnLib.DefineItem(ScrapItemKeys.US_GoldenTicket, US_GoldenTicket, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									buildweights(weightBuilder, goldenTicketMoonStrings, BoundConfig.GoldenTicketGlobalSpawnWeight.Value, US_GoldenTicket);
								});
							});
						});
					}
					else
					{
						Items.RegisterItem(US_GoldenTicket);
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - Golden US_Ticket experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.RoseLoaded.Value)
				{
					Item US_Rose = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/RoseAssets/US_RoseItem.asset");
					RoseScript itemScript7 = US_Rose.spawnPrefab.AddComponent<RoseScript>();
					InitializeItem((GrabbableObject)(object)itemScript7, grabbable: true, grabbableToEnemies: true, US_Rose);
					if (BoundConfig.RoseSpawnsAsScrap.Value)
					{
						string[] roseMoonStrings = BoundConfig.RoseMoonSpawnWeights.Value.Split(',');
						DawnLib.DefineItem(ScrapItemKeys.US_Rose, US_Rose, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									buildweights(weightBuilder, roseMoonStrings, BoundConfig.RoseGlobalSpawnWeight.Value, US_Rose);
								});
							});
						});
					}
					else
					{
						Items.RegisterItem(US_Rose);
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - US_Rose experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.ScissorsLoaded.Value)
				{
					Item US_Scissors = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/ScissorsAssets/US_ScissorsItem.asset");
					ScissorsScript itemScript8 = US_Scissors.spawnPrefab.AddComponent<ScissorsScript>();
					InitializeItem((GrabbableObject)(object)itemScript8, grabbable: true, grabbableToEnemies: true, US_Scissors);
					if (BoundConfig.ScissorsSpawnsAsScrap.Value)
					{
						string[] scissorsMoonStrings = BoundConfig.ScissorsMoonSpawnWeights.Value.Split(',');
						DawnLib.DefineItem(ScrapItemKeys.US_Scissors, US_Scissors, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									buildweights(weightBuilder, scissorsMoonStrings, BoundConfig.ScissorsGlobalSpawnWeight.Value, US_Scissors);
								});
							});
						});
					}
					else
					{
						Items.RegisterItem(US_Scissors);
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - US_Scissors experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.WalkingCaneLoaded.Value)
				{
					Item US_WalkingCane = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/WalkingCaneAssets/US_WalkingCaneItem.asset");
					WalkingCaneScript itemScript9 = US_WalkingCane.spawnPrefab.AddComponent<WalkingCaneScript>();
					InitializeItem((GrabbableObject)(object)itemScript9, grabbable: true, grabbableToEnemies: true, US_WalkingCane);
					if (BoundConfig.WalkingCaneSpawnsAsScrap.Value)
					{
						string[] walkingCaneMoonStrings = BoundConfig.WalkingCaneMoonSpawnWeights.Value.Split(',');
						DawnLib.DefineItem(ScrapItemKeys.US_WalkingCane, US_WalkingCane, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									buildweights(weightBuilder, walkingCaneMoonStrings, BoundConfig.WalkingCaneGlobalSpawnWeight.Value, US_WalkingCane);
								});
							});
						});
					}
					else
					{
						Items.RegisterItem(US_WalkingCane);
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - Walking Cane experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.CandyDispenserLoaded.Value)
				{
					Item US_CandyDispenser = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/CandyDispenserAssets/US_CandyDispenserItem.asset");
					CandyDispenserScript itemScript10 = US_CandyDispenser.spawnPrefab.AddComponent<CandyDispenserScript>();
					InitializeItem((GrabbableObject)(object)itemScript10, grabbable: true, grabbableToEnemies: true, US_CandyDispenser);
					Item val6 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/PieceofCandyAssets/US_PieceofCandyItem.asset");
					PieceofCandyScript itemScript11 = val6.spawnPrefab.AddComponent<PieceofCandyScript>();
					InitializeItem((GrabbableObject)(object)itemScript11, grabbable: true, grabbableToEnemies: true, val6);
					if (BoundConfig.CandyDispenserSpawnsAsScrap.Value)
					{
						string[] candyDispenserMoonStrings = BoundConfig.CandyDispenserMoonSpawnWeights.Value.Split(',');
						DawnLib.DefineItem(ScrapItemKeys.US_CandyDispenser, US_CandyDispenser, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									buildweights(weightBuilder, candyDispenserMoonStrings, BoundConfig.CandyDispenserGlobalSpawnWeight.Value, US_CandyDispenser);
								});
							});
						});
						DawnLib.DefineItem(ScrapItemKeys.US_PieceofCandy, val6, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									weightBuilder.SetGlobalWeight(0);
								});
							});
						});
					}
					else
					{
						Items.RegisterItem(US_CandyDispenser);
						Items.RegisterItem(val6);
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - Candy Dispenser experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.FuelCylinderLoaded.Value)
				{
					Item US_FuelCylinder = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/FuelCylinderAssets/US_FuelCylinderItem.asset");
					FuelCylinderScript itemScript12 = US_FuelCylinder.spawnPrefab.AddComponent<FuelCylinderScript>();
					InitializeItem((GrabbableObject)(object)itemScript12, grabbable: true, grabbableToEnemies: true, US_FuelCylinder);
					if (BoundConfig.FuelCylinderSpawnsAsScrap.Value)
					{
						string[] fuelCylinderMoonStrings = BoundConfig.FuelCylinderMoonSpawnWeights.Value.Split(',');
						DawnLib.DefineItem(ScrapItemKeys.US_FuelCylinder, US_FuelCylinder, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									buildweights(weightBuilder, fuelCylinderMoonStrings, BoundConfig.FuelCylinderGlobalSpawnWeight.Value, US_FuelCylinder);
								});
							});
						});
					}
					else
					{
						Items.RegisterItem(US_FuelCylinder);
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - Fuel Cylinder experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.RadioactiveCellLoaded.Value)
				{
					Item US_RadioactiveCell = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/RadioactiveCellAssets/US_RadioactiveCellItem.asset");
					RadioactiveCellScript itemScript13 = US_RadioactiveCell.spawnPrefab.AddComponent<RadioactiveCellScript>();
					InitializeItem((GrabbableObject)(object)itemScript13, grabbable: true, grabbableToEnemies: true, US_RadioactiveCell);
					if (BoundConfig.RadioactiveCellSpawnsAsScrap.Value)
					{
						string[] radioactiveCellMoonStrings = BoundConfig.RadioactiveCellMoonSpawnWeights.Value.Split(',');
						DawnLib.DefineItem(ScrapItemKeys.US_RadioactiveCell, US_RadioactiveCell, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									buildweights(weightBuilder, radioactiveCellMoonStrings, BoundConfig.RadioactiveCellGlobalSpawnWeight.Value, US_RadioactiveCell);
								});
							});
						});
					}
					else
					{
						Items.RegisterItem(US_RadioactiveCell);
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - Radioactive Cell experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.GloomyCapsuleLoaded.Value)
				{
					Item US_GloomyCapsule = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/GloomyCapsuleAssets/US_GloomyCapsuleItem.asset");
					GloomyCapsuleScript itemScript14 = US_GloomyCapsule.spawnPrefab.AddComponent<GloomyCapsuleScript>();
					InitializeItem((GrabbableObject)(object)itemScript14, grabbable: true, grabbableToEnemies: true, US_GloomyCapsule);
					if (BoundConfig.GloomyCapsuleSpawnsAsScrap.Value)
					{
						string[] gloomyCapsuleMoonStrings = BoundConfig.GloomyCapsuleMoonSpawnWeights.Value.Split(',');
						DawnLib.DefineItem(ScrapItemKeys.US_GloomyCapsule, US_GloomyCapsule, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									buildweights(weightBuilder, gloomyCapsuleMoonStrings, BoundConfig.GloomyCapsuleGlobalSpawnWeight.Value, US_GloomyCapsule);
								});
							});
						});
					}
					else
					{
						Items.RegisterItem(US_GloomyCapsule);
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - Gloomy Capsule experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.FrigidCapsuleLoaded.Value)
				{
					Item US_FrigidCapsule = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/FrigidCapsuleAssets/US_FrigidCapsuleItem.asset");
					FrigidCapsuleScript itemScript15 = US_FrigidCapsule.spawnPrefab.AddComponent<FrigidCapsuleScript>();
					InitializeItem((GrabbableObject)(object)itemScript15, grabbable: true, grabbableToEnemies: true, US_FrigidCapsule);
					if (BoundConfig.FrigidCapsuleSpawnsAsScrap.Value)
					{
						string[] frigidCapsuleMoonStrings = BoundConfig.FrigidCapsuleMoonSpawnWeights.Value.Split(',');
						DawnLib.DefineItem(ScrapItemKeys.US_FrigidCapsule, US_FrigidCapsule, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									buildweights(weightBuilder, frigidCapsuleMoonStrings, BoundConfig.FrigidCapsuleGlobalSpawnWeight.Value, US_FrigidCapsule);
								});
							});
						});
					}
					else
					{
						Items.RegisterItem(US_FrigidCapsule);
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - Frigid Capsule experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.NoxiousCapsuleLoaded.Value)
				{
					Item US_NoxiousCapsule = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/NoxiousCapsuleAssets/US_NoxiousCapsuleItem.asset");
					NoxiousCapsuleScript itemScript16 = US_NoxiousCapsule.spawnPrefab.AddComponent<NoxiousCapsuleScript>();
					InitializeItem((GrabbableObject)(object)itemScript16, grabbable: true, grabbableToEnemies: true, US_NoxiousCapsule);
					if (BoundConfig.NoxiousCapsuleSpawnsAsScrap.Value)
					{
						string[] noxiousCapsuleMoonStrings = BoundConfig.NoxiousCapsuleMoonSpawnWeights.Value.Split(',');
						DawnLib.DefineItem(ScrapItemKeys.US_NoxiousCapsule, US_NoxiousCapsule, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									buildweights(weightBuilder, noxiousCapsuleMoonStrings, BoundConfig.NoxiousCapsuleGlobalSpawnWeight.Value, US_NoxiousCapsule);
								});
							});
						});
					}
					else
					{
						Items.RegisterItem(US_NoxiousCapsule);
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - Noxious Capsule experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.BloodyCapsuleLoaded.Value)
				{
					Item US_BloodyCapsule = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/BloodyCapsuleAssets/US_BloodyCapsuleItem.asset");
					BloodyCapsuleScript itemScript17 = US_BloodyCapsule.spawnPrefab.AddComponent<BloodyCapsuleScript>();
					InitializeItem((GrabbableObject)(object)itemScript17, grabbable: true, grabbableToEnemies: true, US_BloodyCapsule);
					if (BoundConfig.BloodyCapsuleSpawnsAsScrap.Value)
					{
						string[] bloodyCapsuleMoonStrings = BoundConfig.BloodyCapsuleMoonSpawnWeights.Value.Split(',');
						DawnLib.DefineItem(ScrapItemKeys.US_BloodyCapsule, US_BloodyCapsule, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									buildweights(weightBuilder, bloodyCapsuleMoonStrings, BoundConfig.BloodyCapsuleGlobalSpawnWeight.Value, US_BloodyCapsule);
								});
							});
						});
					}
					else
					{
						Items.RegisterItem(US_BloodyCapsule);
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - Bloody Capsule experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.PadlockLoaded.Value)
				{
					Item US_Padlock = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/PadlockAssets/US_PadlockItem.asset");
					PadlockScript itemScript18 = US_Padlock.spawnPrefab.AddComponent<PadlockScript>();
					InitializeItem((GrabbableObject)(object)itemScript18, grabbable: true, grabbableToEnemies: true, US_Padlock);
					if (BoundConfig.PadlockSpawnsAsScrap.Value)
					{
						string[] padlockMoonStrings = BoundConfig.PadlockMoonSpawnWeights.Value.Split(',');
						DawnLib.DefineItem(ScrapItemKeys.US_Padlock, US_Padlock, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									buildweights(weightBuilder, padlockMoonStrings, BoundConfig.PadlockGlobalSpawnWeight.Value, US_Padlock);
								});
							});
						});
					}
					else
					{
						Items.RegisterItem(US_Padlock);
					}
					if (BoundConfig.PadlockIsStoreItem.Value && BoundConfig.PadlockStorePrice.Value >= 0)
					{
						Item val7 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/PadlockAssets/US_SalvagedPadlockItem.asset");
						TerminalNode US_PadlockStoreNode = val.LoadAsset<TerminalNode>("Assets/Items/PadlockAssets/US_SalvagedPadlockNode.asset");
						ScanNodeProperties componentInChildren = val7.spawnPrefab.GetComponentInChildren<ScanNodeProperties>();
						componentInChildren.headerText = "Salvaged US_Padlock";
						componentInChildren.nodeType = 3;
						PadlockScript itemScript19 = val7.spawnPrefab.AddComponent<PadlockScript>();
						InitializeItem((GrabbableObject)(object)itemScript19, grabbable: true, grabbableToEnemies: true, val7);
						DawnLib.DefineItem(ScrapItemKeys.US_SalvagedPadlock, val7, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder)
							{
								shopBuilder.OverrideCost(BoundConfig.PadlockStorePrice.Value).OverrideInfoNode(US_PadlockStoreNode);
							});
						});
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - US_Padlock experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.CrowbarLoaded.Value)
				{
					Item US_Crowbar = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/CrowbarAssets/US_CrowbarItem.asset");
					CrowbarScript itemScript20 = US_Crowbar.spawnPrefab.AddComponent<CrowbarScript>();
					InitializeItem((GrabbableObject)(object)itemScript20, grabbable: true, grabbableToEnemies: true, US_Crowbar);
					if (BoundConfig.CrowbarSpawnsAsScrap.Value)
					{
						string[] crowbarMoonStrings = BoundConfig.CrowbarMoonSpawnWeights.Value.Split(',');
						DawnLib.DefineItem(ScrapItemKeys.US_Crowbar, US_Crowbar, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									buildweights(weightBuilder, crowbarMoonStrings, BoundConfig.CrowbarGlobalSpawnWeight.Value, US_Crowbar);
								});
							});
						});
					}
					else
					{
						Items.RegisterItem(US_Crowbar);
					}
					if (BoundConfig.CrowbarIsStoreItem.Value && BoundConfig.CrowbarStorePrice.Value >= 0)
					{
						Item val8 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/CrowbarAssets/US_SalvagedCrowbarItem.asset");
						TerminalNode US_CrowbarStoreNode = val.LoadAsset<TerminalNode>("Assets/Items/CrowbarAssets/US_SalvagedCrowbarNode.asset");
						ScanNodeProperties componentInChildren2 = val8.spawnPrefab.GetComponentInChildren<ScanNodeProperties>();
						componentInChildren2.headerText = "Salvaged US_Crowbar";
						componentInChildren2.nodeType = 3;
						CrowbarScript itemScript21 = val8.spawnPrefab.AddComponent<CrowbarScript>();
						InitializeItem((GrabbableObject)(object)itemScript21, grabbable: true, grabbableToEnemies: true, val8);
						DawnLib.DefineItem(ScrapItemKeys.US_SalvagedCrowbar, val8, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder)
							{
								shopBuilder.OverrideCost(BoundConfig.CrowbarStorePrice.Value).OverrideInfoNode(US_CrowbarStoreNode);
							});
						});
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - US_Crowbar experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.DoomsayerBellLoaded.Value)
				{
					Item US_DoomsayerBell = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/DoomsayerBellAssets/US_DoomsayerBellItem.asset");
					DoomsayerBellScript itemScript22 = US_DoomsayerBell.spawnPrefab.AddComponent<DoomsayerBellScript>();
					InitializeItem((GrabbableObject)(object)itemScript22, grabbable: true, grabbableToEnemies: true, US_DoomsayerBell);
					if (BoundConfig.DoomsayerBellSpawnsAsScrap.Value)
					{
						string[] doomsayerBellMoonStrings = BoundConfig.DoomsayerBellMoonSpawnWeights.Value.Split(',');
						DawnLib.DefineItem(ScrapItemKeys.US_DoomsayerBell, US_DoomsayerBell, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
							{
								scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
								{
									buildweights(weightBuilder, doomsayerBellMoonStrings, BoundConfig.DoomsayerBellGlobalSpawnWeight.Value, US_DoomsayerBell);
								});
							});
						});
					}
					else
					{
						Items.RegisterItem(US_DoomsayerBell);
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - Doomsayer Bell experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.HandlampLoaded.Value)
				{
					Item val9 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/HandlampAssets/US_HandlampItem.asset");
					TerminalNode US_HandlampNode = val.LoadAsset<TerminalNode>("Assets/Items/HandlampAssets/US_HandlampNode.asset");
					HandlampScript itemScript23 = val9.spawnPrefab.AddComponent<HandlampScript>();
					InitializeItem((GrabbableObject)(object)itemScript23, grabbable: true, grabbableToEnemies: true, val9);
					if (BoundConfig.HandlampIsStoreItem.Value && BoundConfig.HandlampStorePrice.Value >= 0)
					{
						DawnLib.DefineItem(StoreItemKeys.US_HandLamp, val9, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder)
							{
								shopBuilder.OverrideCost(BoundConfig.HandlampStorePrice.Value).OverrideInfoNode(US_HandlampNode);
							});
						});
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - Handlamp experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.BandagesLoaded.Value)
				{
					Item val10 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/BandagesAssets/US_BandagesItem.asset");
					TerminalNode US_BandagesNode = val.LoadAsset<TerminalNode>("Assets/Items/BandagesAssets/US_BandagesNode.asset");
					BandagesScript itemScript24 = val10.spawnPrefab.AddComponent<BandagesScript>();
					InitializeItem((GrabbableObject)(object)itemScript24, grabbable: true, grabbableToEnemies: true, val10);
					if (BoundConfig.BandagesIsStoreItem.Value && BoundConfig.BandagesStorePrice.Value >= 0)
					{
						DawnLib.DefineItem(StoreItemKeys.US_Bandages, val10, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder)
							{
								shopBuilder.OverrideCost(BoundConfig.BandagesStorePrice.Value).OverrideInfoNode(US_BandagesNode);
							});
						});
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - US_Bandages experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.MedicalKitLoaded.Value)
				{
					Item val11 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/MedicalKitAssets/US_MedicalKitItem.asset");
					TerminalNode US_MedicalKitNode = val.LoadAsset<TerminalNode>("Assets/Items/MedicalKitAssets/US_MedicalKitNode.asset");
					MedicalKitScript itemScript25 = val11.spawnPrefab.AddComponent<MedicalKitScript>();
					InitializeItem((GrabbableObject)(object)itemScript25, grabbable: true, grabbableToEnemies: true, val11);
					if (BoundConfig.MedicalKitIsStoreItem.Value && BoundConfig.MedicalKitStorePrice.Value >= 0)
					{
						DawnLib.DefineItem(StoreItemKeys.US_MedicalKit, val11, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder)
							{
								shopBuilder.OverrideCost(BoundConfig.MedicalKitStorePrice.Value).OverrideInfoNode(US_MedicalKitNode);
							});
						});
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - Medical Kit experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.DefibrillatorLoaded.Value)
				{
					Item val12 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/DefibrillatorAssets/US_DefibrillatorItem.asset");
					TerminalNode US_DefibrillatorNode = val.LoadAsset<TerminalNode>("Assets/Items/DefibrillatorAssets/US_DefibrillatorNode.asset");
					DefibrillatorScript itemScript26 = val12.spawnPrefab.AddComponent<DefibrillatorScript>();
					InitializeItem((GrabbableObject)(object)itemScript26, grabbable: true, grabbableToEnemies: true, val12);
					if (BoundConfig.DefibrillatorIsStoreItem.Value && BoundConfig.DefibrillatorStorePrice.Value >= 0)
					{
						DawnLib.DefineItem(StoreItemKeys.US_Defibrillator, val12, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder)
							{
								shopBuilder.OverrideCost(BoundConfig.DefibrillatorStorePrice.Value).OverrideInfoNode(US_DefibrillatorNode);
							});
						});
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - US_Defibrillator experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.ProductivityAutoinjectorLoaded.Value)
				{
					Item val13 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/ProductivityAutoinjectorAssets/US_ProductivityAutoinjectorItem.asset");
					TerminalNode US_ProductivityAutoinjectorNode = val.LoadAsset<TerminalNode>("Assets/Items/ProductivityAutoinjectorAssets/US_ProductivityAutoinjectorNode.asset");
					ProductivityAutoinjectorScript itemScript27 = val13.spawnPrefab.AddComponent<ProductivityAutoinjectorScript>();
					InitializeItem((GrabbableObject)(object)itemScript27, grabbable: true, grabbableToEnemies: true, val13);
					if (BoundConfig.ProductivityAutoinjectorIsStoreItem.Value && BoundConfig.ProductivityAutoinjectorStorePrice.Value >= 0)
					{
						DawnLib.DefineItem(StoreItemKeys.US_ProductivityAutoinjector, val13, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder)
							{
								shopBuilder.OverrideCost(BoundConfig.ProductivityAutoinjectorStorePrice.Value).OverrideInfoNode(US_ProductivityAutoinjectorNode);
							});
						});
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - Productivity Autoinjector experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.ToolboxLoaded.Value)
				{
					Item val14 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/ToolboxAssets/US_ToolboxItem.asset");
					TerminalNode US_ToolboxNode = val.LoadAsset<TerminalNode>("Assets/Items/ToolboxAssets/US_ToolboxNode.asset");
					ToolboxScript itemScript28 = val14.spawnPrefab.AddComponent<ToolboxScript>();
					InitializeItem((GrabbableObject)(object)itemScript28, grabbable: true, grabbableToEnemies: true, val14);
					if (BoundConfig.ToolboxIsStoreItem.Value && BoundConfig.ToolboxStorePrice.Value >= 0)
					{
						DawnLib.DefineItem(StoreItemKeys.US_Toolbox, val14, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder)
							{
								shopBuilder.OverrideCost(BoundConfig.ToolboxStorePrice.Value).OverrideInfoNode(US_ToolboxNode);
							});
						});
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - US_Toolbox experienced an error while loading. Skipping...");
			}
			try
			{
				if (BoundConfig.ShiftControllerLoaded.Value)
				{
					Item val15 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/ShiftControllerAssets/US_ShiftControllerItem.asset");
					TerminalNode US_ShiftControllerNode = val.LoadAsset<TerminalNode>("Assets/Items/ShiftControllerAssets/US_ShiftControllerNode.asset");
					ShiftControllerScript itemScript29 = val15.spawnPrefab.AddComponent<ShiftControllerScript>();
					InitializeItem((GrabbableObject)(object)itemScript29, grabbable: true, grabbableToEnemies: true, val15);
					if (BoundConfig.ShiftControllerIsStoreItem.Value && BoundConfig.ShiftControllerStorePrice.Value >= 0)
					{
						DawnLib.DefineItem(StoreItemKeys.US_ShiftController, val15, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
						{
							builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder)
							{
								shopBuilder.OverrideCost(BoundConfig.ShiftControllerStorePrice.Value).OverrideInfoNode(US_ShiftControllerNode);
							});
						});
					}
				}
			}
			catch
			{
				Debug.LogError((object)"USUAL SCRAP - Shift Controller experienced an error while loading. Skipping...");
			}
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Emil.UsualScrap");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Emil.UsualScrap is loaded!");
			static void buildweights(WeightTableBuilder<DawnMoonInfo> builder, string[] pulledString, int globalWeight, Item item)
			{
				if (globalWeight >= 0)
				{
					if (BoundConfig.DebugLogging.Value)
					{
						MonoBehaviour.print((object)$"SETTING GLOBAL SPAWN WEIGHT FOR [{item}] TO [{globalWeight}]");
					}
					builder.SetGlobalWeight(globalWeight);
				}
				else if (BoundConfig.DebugLogging.Value)
				{
					MonoBehaviour.print((object)$"GLOBAL SPAWN WEIGHT DISABLED FOR [{item}]");
				}
				foreach (string text in pulledString)
				{
					try
					{
						string[] array3 = text.Split(':');
						string text2 = array3[0].Trim().ToLowerInvariant();
						string s = array3[1].Trim();
						int num = int.Parse(s);
						if (num <= -1)
						{
							if (BoundConfig.DebugLogging.Value)
							{
								MonoBehaviour.print((object)$"{text2} weight skipped for {item}");
							}
						}
						else
						{
							switch (text2)
							{
							case "experimentation":
								builder.AddWeight(MoonKeys.Experimentation, num);
								if (BoundConfig.DebugLogging.Value)
								{
									MonoBehaviour.print((object)$"Setting {item}'s moonWeight to {num} for experimentation");
								}
								break;
							case "vow":
								builder.AddWeight(MoonKeys.Vow, num);
								if (BoundConfig.DebugLogging.Value)
								{
									MonoBehaviour.print((object)$"Setting {item}'s moonWeight to {num} for vow");
								}
								break;
							case "march":
								builder.AddWeight(MoonKeys.March, num);
								if (BoundConfig.DebugLogging.Value)
								{
									MonoBehaviour.print((object)$"Setting {item}'s moonWeight to {num} for march");
								}
								break;
							case "assurance":
								builder.AddWeight(MoonKeys.Assurance, num);
								if (BoundConfig.DebugLogging.Value)
								{
									MonoBehaviour.print((object)$"Setting {item}'s moonWeight to {num} for assurance");
								}
								break;
							case "offense":
								builder.AddWeight(MoonKeys.Offense, num);
								if (BoundConfig.DebugLogging.Value)
								{
									MonoBehaviour.print((object)$"Setting {item}'s moonWeight to {num} for offense");
								}
								break;
							case "rend":
								builder.AddWeight(MoonKeys.Rend, num);
								if (BoundConfig.DebugLogging.Value)
								{
									MonoBehaviour.print((object)$"Setting {item}'s moonWeight to {num} for rend");
								}
								break;
							case "dine":
								builder.AddWeight(MoonKeys.Dine, num);
								if (BoundConfig.DebugLogging.Value)
								{
									MonoBehaviour.print((object)$"Setting {item}'s moonWeight to {num} for dine");
								}
								break;
							case "titan":
								builder.AddWeight(MoonKeys.Titan, num);
								if (BoundConfig.DebugLogging.Value)
								{
									MonoBehaviour.print((object)$"Setting {item}'s moonWeight to {num} for titan");
								}
								break;
							case "adamance":
								builder.AddWeight(MoonKeys.Adamance, num);
								if (BoundConfig.DebugLogging.Value)
								{
									MonoBehaviour.print((object)$"Setting {item}'s moonWeight to {num} for adamance");
								}
								break;
							case "artifice":
								builder.AddWeight(MoonKeys.Artifice, num);
								if (BoundConfig.DebugLogging.Value)
								{
									MonoBehaviour.print((object)$"Setting {item}'s moonWeight to {num} for artifice");
								}
								break;
							case "embrion":
								builder.AddWeight(MoonKeys.Embrion, num);
								if (BoundConfig.DebugLogging.Value)
								{
									MonoBehaviour.print((object)$"Setting {item}'s moonWeight to {num} for embrion");
								}
								break;
							default:
								Debug.LogWarning((object)$"Config [{text2}] from [{item}] returned a readable format error, please check that the moon you entered is an available option and that it is spelled correctly.");
								break;
							}
						}
					}
					catch
					{
						Debug.LogWarning((object)$"Moon weight config [{text}] from [{item}] is unreadable and returned an error. Check your formatting or report this to the modmaker if you need support, thanks.");
					}
				}
			}
		}
	}
	internal class UsualScrapConfigs
	{
		public readonly ConfigEntry<bool> MansionScrapPackEnabled;

		public readonly ConfigEntry<string> MansionScrapPackMoonSpawns;

		public readonly ConfigEntry<bool> FacilityScrapPackEnabled;

		public readonly ConfigEntry<string> FacilityScrapPackMoonSpawns;

		public readonly ConfigEntry<bool> TicketLoaded;

		public readonly ConfigEntry<bool> TicketSpawnsAsScrap;

		public readonly ConfigEntry<string> TicketMoonSpawnWeights;

		public readonly ConfigEntry<int> TicketGlobalSpawnWeight;

		public readonly ConfigEntry<bool> GoldenTicketLoaded;

		public readonly ConfigEntry<bool> GoldenTicketSpawnsAsScrap;

		public readonly ConfigEntry<string> GoldenTicketMoonSpawnWeights;

		public readonly ConfigEntry<int> GoldenTicketGlobalSpawnWeight;

		public readonly ConfigEntry<bool> RoseLoaded;

		public readonly ConfigEntry<bool> RoseSpawnsAsScrap;

		public readonly ConfigEntry<string> RoseMoonSpawnWeights;

		public readonly ConfigEntry<int> RoseGlobalSpawnWeight;

		public readonly ConfigEntry<bool> ScissorsLoaded;

		public readonly ConfigEntry<bool> ScissorsSpawnsAsScrap;

		public readonly ConfigEntry<string> ScissorsMoonSpawnWeights;

		public readonly ConfigEntry<int> ScissorsGlobalSpawnWeight;

		public readonly ConfigEntry<bool> WalkingCaneLoaded;

		public readonly ConfigEntry<bool> WalkingCaneSpawnsAsScrap;

		public readonly ConfigEntry<string> WalkingCaneMoonSpawnWeights;

		public readonly ConfigEntry<int> WalkingCaneGlobalSpawnWeight;

		public readonly ConfigEntry<bool> CandyDispenserLoaded;

		public readonly ConfigEntry<bool> CandyDispenserSpawnsAsScrap;

		public readonly ConfigEntry<string> CandyDispenserMoonSpawnWeights;

		public readonly ConfigEntry<int> CandyDispenserGlobalSpawnWeight;

		public readonly ConfigEntry<bool> FuelCylinderLoaded;

		public readonly ConfigEntry<bool> FuelCylinderSpawnsAsScrap;

		public readonly ConfigEntry<string> FuelCylinderMoonSpawnWeights;

		public readonly ConfigEntry<int> FuelCylinderGlobalSpawnWeight;

		public readonly ConfigEntry<bool> RadioactiveCellLoaded;

		public readonly ConfigEntry<bool> RadioactiveCellSpawnsAsScrap;

		public readonly ConfigEntry<string> RadioactiveCellMoonSpawnWeights;

		public readonly ConfigEntry<int> RadioactiveCellGlobalSpawnWeight;

		public readonly ConfigEntry<bool> GloomyCapsuleLoaded;

		public readonly ConfigEntry<bool> GloomyCapsuleSpawnsAsScrap;

		public readonly ConfigEntry<string> GloomyCapsuleMoonSpawnWeights;

		public readonly ConfigEntry<int> GloomyCapsuleGlobalSpawnWeight;

		public readonly ConfigEntry<bool> FrigidCapsuleLoaded;

		public readonly ConfigEntry<bool> FrigidCapsuleSpawnsAsScrap;

		public readonly ConfigEntry<string> FrigidCapsuleMoonSpawnWeights;

		public readonly ConfigEntry<int> FrigidCapsuleGlobalSpawnWeight;

		public readonly ConfigEntry<bool> NoxiousCapsuleLoaded;

		public readonly ConfigEntry<bool> NoxiousCapsuleSpawnsAsScrap;

		public readonly ConfigEntry<string> NoxiousCapsuleMoonSpawnWeights;

		public readonly ConfigEntry<int> NoxiousCapsuleGlobalSpawnWeight;

		public readonly ConfigEntry<bool> BloodyCapsuleLoaded;

		public readonly ConfigEntry<bool> BloodyCapsuleSpawnsAsScrap;

		public readonly ConfigEntry<string> BloodyCapsuleMoonSpawnWeights;

		public readonly ConfigEntry<int> BloodyCapsuleGlobalSpawnWeight;

		public readonly ConfigEntry<bool> PadlockLoaded;

		public readonly ConfigEntry<bool> PadlockSpawnsAsScrap;

		public readonly ConfigEntry<string> PadlockMoonSpawnWeights;

		public readonly ConfigEntry<int> PadlockGlobalSpawnWeight;

		public readonly ConfigEntry<bool> PadlockIsStoreItem;

		public readonly ConfigEntry<int> PadlockStorePrice;

		public readonly ConfigEntry<bool> CrowbarLoaded;

		public readonly ConfigEntry<bool> CrowbarSpawnsAsScrap;

		public readonly ConfigEntry<string> CrowbarMoonSpawnWeights;

		public readonly ConfigEntry<int> CrowbarGlobalSpawnWeight;

		public readonly ConfigEntry<bool> CrowbarIsStoreItem;

		public readonly ConfigEntry<int> CrowbarStorePrice;

		public readonly ConfigEntry<bool> DoomsayerBellLoaded;

		public readonly ConfigEntry<bool> DoomsayerBellSpawnsAsScrap;

		public readonly ConfigEntry<string> DoomsayerBellMoonSpawnWeights;

		public readonly ConfigEntry<int> DoomsayerBellGlobalSpawnWeight;

		public readonly ConfigEntry<bool> HandlampLoaded;

		public readonly ConfigEntry<bool> HandlampIsStoreItem;

		public readonly ConfigEntry<int> HandlampStorePrice;

		public readonly ConfigEntry<bool> BandagesLoaded;

		public readonly ConfigEntry<bool> BandagesIsStoreItem;

		public readonly ConfigEntry<int> BandagesStorePrice;

		public readonly ConfigEntry<bool> MedicalKitLoaded;

		public readonly ConfigEntry<bool> MedicalKitIsStoreItem;

		public readonly ConfigEntry<int> MedicalKitStorePrice;

		public readonly ConfigEntry<bool> DefibrillatorLoaded;

		public readonly ConfigEntry<bool> DefibrillatorIsStoreItem;

		public readonly ConfigEntry<int> DefibrillatorStorePrice;

		public readonly ConfigEntry<bool> DefibrillatorUsesLimited;

		public readonly ConfigEntry<int> DefibrillatorUseLimit;

		public readonly ConfigEntry<bool> DefibrillatorPermaDeathRule;

		public readonly ConfigEntry<bool> DefibrillatorRefillsOnLanding;

		public readonly ConfigEntry<bool> ProductivityAutoinjectorLoaded;

		public readonly ConfigEntry<bool> ProductivityAutoinjectorIsStoreItem;

		public readonly ConfigEntry<int> ProductivityAutoinjectorStorePrice;

		public readonly ConfigEntry<bool> ToolboxLoaded;

		public readonly ConfigEntry<bool> ToolboxIsStoreItem;

		public readonly ConfigEntry<int> ToolboxStorePrice;

		public readonly ConfigEntry<bool> ShiftControllerLoaded;

		public readonly ConfigEntry<bool> ShiftControllerIsStoreItem;

		public readonly ConfigEntry<int> ShiftControllerStorePrice;

		public readonly ConfigEntry<int> ShiftControllerGreatRange;

		public readonly ConfigEntry<int> ShiftControllerPoorRange;

		public readonly ConfigEntry<bool> CapsulesDisabledOnTheShip;

		public readonly ConfigEntry<bool> TicketsFunctionOnCheapItems;

		public readonly ConfigEntry<bool> DebugLogging;

		public UsualScrapConfigs(ConfigFile cfg)
		{
			cfg.SaveOnConfigSet = false;
			DebugLogging = cfg.Bind<bool>("1. Debugging", "Log actions for debugging purposes", false, "Whether or not to log actions for debugging purposes");
			CapsulesDisabledOnTheShip = cfg.Bind<bool>("2. General Mechanic Changes", "Capsules Disabled On The Ship", true, "Whether or not capsules are disabled inside the ship when landed (Capsules are disabled in orbit always).");
			TicketsFunctionOnCheapItems = cfg.Bind<bool>("2. General Mechanic Changes", "Tickets function on cheap items", true, "Whether or not tickets function when used on items with a value below 5 (Meaning tickets will no longer work on most equipment whose value is normally 0).");
			MansionScrapPackEnabled = cfg.Bind<bool>("3. Mansion Scrap Pack", "Mansion Scrap Pack Enabled", false, "Whether or not the Mansion Scrap Pack is enabled.");
			FacilityScrapPackEnabled = cfg.Bind<bool>("3. Facility Scrap Pack", "Facility Scrap Pack Enabled", false, "Whether or not the Facility Scrap Pack is enabled.");
			TicketLoaded = cfg.Bind<bool>("Scrap Item - US_Ticket", "US_Ticket is loaded", true, "Whether or not the US_Ticket is loaded.");
			TicketSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - US_Ticket", "US_Ticket is a scrap item", true, "Whether or not the US_Ticket spawns as scrap.");
			TicketMoonSpawnWeights = cfg.Bind<string>("Scrap Item - US_Ticket", "US_Ticket Moon Spawning", "experimentation:-1, vow:-1, march:-1, assurance:-1, offense:-1, rend:-1, dine:-1, titan:-1, adamance:-1, artifice:-1, embrion:-1", "Where and how often the US_Ticket will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 or leave blank to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs.");
			TicketGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - US_Ticket", "US_Ticket Global Spawning", 40, "How often the US_Ticket will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable).");
			GoldenTicketLoaded = cfg.Bind<bool>("Scrap Item - Golden US_Ticket", "Golden US_Ticket is loaded", true, "Whether or not the Golden US_Ticket is loaded.");
			GoldenTicketSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Golden US_Ticket", "Golden US_Ticket is a scrap item", true, "Whether or not the Golden US_Ticket spawns as scrap.");
			GoldenTicketMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Golden US_Ticket", "Golden US_Ticket Moon Spawning", "experimentation:-1, vow:-1, march:-1, assurance:-1, offense:-1, rend:-1, dine:-1, titan:-1, adamance:-1, artifice:-1, embrion:-1", "Where and how often the Golden US_Ticket will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 or leave blank to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs.");
			GoldenTicketGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Golden US_Ticket", "Golden US_Ticket Global Spawning", 5, "How often the Golden US_Ticket will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable).");
			RoseLoaded = cfg.Bind<bool>("Scrap Item - US_Rose", "US_Rose is loaded", true, "Whether or not the US_Rose is loaded.");
			RoseSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - US_Rose", "US_Rose is a scrap item", true, "Whether or not the US_Rose spawns as scrap.");
			RoseMoonSpawnWeights = cfg.Bind<string>("Scrap Item - US_Rose", "US_Rose Moon Spawning", "experimentation:-1, vow:-1, march:-1, assurance:-1, offense:-1, rend:-1, dine:-1, titan:-1, adamance:-1, artifice:-1, embrion:-1", "Where and how often the US_Rose will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 or leave blank to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs.");
			RoseGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - US_Rose", "US_Rose Global Spawning", 30, "How often the US_Rose will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable).");
			ScissorsLoaded = cfg.Bind<bool>("Scrap Item - US_Scissors", "US_Scissors is loaded", true, "Whether or not the US_Scissors is loaded.");
			ScissorsSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - US_Scissors", "US_Scissors is a scrap item", true, "Whether or not the US_Scissors spawns as scrap.");
			ScissorsMoonSpawnWeights = cfg.Bind<string>("Scrap Item - US_Scissors", "US_Scissors Moon Spawning", "experimentation:-1, vow:-1, march:-1, assurance:-1, offense:-1, rend:-1, dine:-1, titan:-1, adamance:-1, artifice:-1, embrion:-1", "Where and how often the US_Scissors will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 or leave blank to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs.");
			ScissorsGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - US_Scissors", "US_Scissors Global Spawning", 30, "How often the US_Scissors will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable).");
			WalkingCaneLoaded = cfg.Bind<bool>("Scrap Item - Walking Cane", "Walking Cane is loaded", true, "Whether or not the Walking Cane is loaded.");
			WalkingCaneSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Walking Cane", "Walking Cane is a scrap item", true, "Whether or not the Walking Cane spawns as scrap.");
			WalkingCaneMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Walking Cane", "Walking Cane Moon Spawning", "experimentation:-1, vow:-1, march:-1, assurance:-1, offense:-1, rend:-1, dine:-1, titan:-1, adamance:-1, artifice:-1, embrion:-1", "Where and how often the Walking Cane will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 or leave blank to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs.");
			WalkingCaneGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Walking Cane", "Walking Cane Global Spawning", 15, "How often the Walking Cane will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable).");
			CandyDispenserLoaded = cfg.Bind<bool>("Scrap Item - Candy Dispenser", "Candy Dispenser is loaded", true, "Whether or not the Candy Dispenser is loaded.");
			CandyDispenserSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Candy Dispenser", "Candy Dispenser is a scrap item", true, "Whether or not the Candy Dispenser spawns as scrap.");
			CandyDispenserMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Candy Dispenser", "Candy Dispenser Moon Spawning", "experimentation:-1, vow:-1, march:-1, assurance:-1, offense:-1, rend:-1, dine:-1, titan:-1, adamance:-1, artifice:-1, embrion:-1", "Where and how often the Candy Dispenser will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 or leave blank to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs.");
			CandyDispenserGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Candy Dispenser", "Candy Dispenser Global Spawning", 30, "How often the Candy Dispenser will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable).");
			FuelCylinderLoaded = cfg.Bind<bool>("Scrap Item - Fuel Cylinder", "Fuel Cylinder is loaded", true, "Whether or not the Fuel Cylinder is loaded.");
			FuelCylinderSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Fuel Cylinder", "Fuel Cylinder is a scrap item", true, "Whether or not the Fuel Cylinder spawns as scrap.");
			FuelCylinderMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Fuel Cylinder", "Fuel Cylinder Moon Spawning", "experimentation:-1, vow:-1, march:-1, assurance:-1, offense:-1, rend:-1, dine:-1, titan:-1, adamance:-1, artifice:-1, embrion:-1", "Where and how often the Fuel Cylinder will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 or leave blank to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs.");
			FuelCylinderGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Fuel Cylinder", "Fuel Cylinder Global Spawning", 20, "How often the Fuel Cylinder will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable).");
			RadioactiveCellLoaded = cfg.Bind<bool>("Scrap Item - Radioactive Cell", "Radioactive Cell is loaded", true, "Whether or not the Radioactive Cell is loaded.");
			RadioactiveCellSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Radioactive Cell", "Radioactive Cell is a scrap item", true, "Whether or not the Radioactive Cell spawns as scrap.");
			RadioactiveCellMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Radioactive Cell", "Radioactive Cell Moon Spawning", "experimentation:-1, vow:-1, march:-1, assurance:-1, offense:-1, rend:-1, dine:-1, titan:-1, adamance:-1, artifice:-1, embrion:-1", "Where and how often the Radioactive Cell will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 or leave blank to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs.");
			RadioactiveCellGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Radioactive Cell", "Radioactive Cell Global Spawning", 20, "How often the Radioactive Cell will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable).");
			GloomyCapsuleLoaded = cfg.Bind<bool>("Scrap Item - Gloomy Capsule", "Gloomy Capsule is loaded", true, "Whether or not the Gloomy Capsule is loaded.");
			GloomyCapsuleSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Gloomy Capsule", "Gloomy Capsule is a scrap item", true, "Whether or not the Gloomy Capsule spawns as scrap.");
			GloomyCapsuleMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Gloomy Capsule", "Gloomy Capsule Moon Spawning", "experimentation:-1, vow:-1, march:-1, assurance:-1, offense:-1, rend:-1, dine:-1, titan:-1, adamance:-1, artifice:-1, embrion:-1", "Where and how often the Gloomy Capsule will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 or leave blank to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs.");
			GloomyCapsuleGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Gloomy Capsule", "Gloomy Capsule Global Spawning", 15, "How often the Gloomy Capsule will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable).");
			FrigidCapsuleLoaded = cfg.Bind<bool>("Scrap Item - Frigid Capsule", "Frigid Capsule is loaded", true, "Whether or not the Frigid Capsule is loaded.");
			FrigidCapsuleSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Frigid Capsule", "Frigid Capsule is a scrap item", true, "Whether or not the Frigid Capsule spawns as scrap.");
			FrigidCapsuleMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Frigid Capsule", "Frigid Capsule Moon Spawning", "experimentation:-1, vow:-1, march:-1, assurance:-1, offense:-1, rend:-1, dine:-1, titan:-1, adamance:-1, artifice:-1, embrion:-1", "Where and how often the Frigid Capsule will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 or leave blank to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs.");
			FrigidCapsuleGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Frigid Capsule", "Frigid Capsule Global Spawning", 15, "How often the Frigid Capsule will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable).");
			NoxiousCapsuleLoaded = cfg.Bind<bool>("Scrap Item - Noxious Capsule", "Noxious Capsule is loaded", true, "Whether or not the Noxious Capsule is loaded.");
			NoxiousCapsuleSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Noxious Capsule", "Noxious Capsule is a scrap item", true, "Whether or not the Noxious Capsule spawns as scrap.");
			NoxiousCapsuleMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Noxious Capsule", "Noxious Capsule Moon Spawning", "experimentation:-1, vow:-1, march:-1, assurance:-1, offense:-1, rend:-1, dine:-1, titan:-1, adamance:-1, artifice:-1, embrion:-1", "Where and how often the Noxious Capsule will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 or leave blank to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs.");
			NoxiousCapsuleGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Noxious Capsule", "Noxious Capsule Global Spawning", 15, "How often the Noxious Capsule will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable).");
			BloodyCapsuleLoaded = cfg.Bind<bool>("Scrap Item - Bloody Capsule", "Bloody Capsule is loaded", true, "Whether or not the Bloody Capsule is loaded.");
			BloodyCapsuleSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Bloody Capsule", "Bloody Capsule is a scrap item", true, "Whether or not the Bloody Capsule spawns as scrap.");
			BloodyCapsuleMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Bloody Capsule", "Bloody Capsule Moon Spawning", "experimentation:-1, vow:-1, march:-1, assurance:-1, offense:-1, rend:-1, dine:-1, titan:-1, adamance:-1, artifice:-1, embrion:-1", "Where and how often the Bloody Capsule will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 or leave blank to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs.");
			BloodyCapsuleGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Bloody Capsule", "Bloody Capsule Global Spawning", 15, "How often the Bloody Capsule will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable).");
			PadlockLoaded = cfg.Bind<bool>("Item - US_Padlock", "US_Padlock is loaded", true, "Whether or not the US_Padlock is loaded.");
			PadlockSpawnsAsScrap = cfg.Bind<bool>("Item - US_Padlock", "US_Padlock is a scrap item", true, "Whether or not the US_Padlock spawns as scrap.");
			PadlockMoonSpawnWeights = cfg.Bind<string>("Item - US_Padlock", "US_Padlock Moon Spawning", "experimentation:-1, vow:-1, march:-1, assurance:-1, offense:-1, rend:-1, dine:-1, titan:-1, adamance:-1, artifice:-1, embrion:-1", "Where and how often the US_Padlock will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 or leave blank to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs.");
			PadlockGlobalSpawnWeight = cfg.Bind<int>("Item - US_Padlock", "US_Padlock Global Spawning", 30, "How often the US_Padlock will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable).");
			PadlockIsStoreItem = cfg.Bind<bool>("Item - US_Padlock", "US_Padlock is a store item", false, "Whether or not the US_Padlock is a store item.");
			PadlockStorePrice = cfg.Bind<int>("Item - US_Padlock", "US_Padlock store price", 15, "The store price of the US_Padlock (Cannot be a negative number).");
			CrowbarLoaded = cfg.Bind<bool>("Item - US_Crowbar", "US_Crowbar is loaded", true, "Whether or not the US_Crowbar is loaded.");
			CrowbarSpawnsAsScrap = cfg.Bind<bool>("Item - US_Crowbar", "US_Crowbar is a scrap item", true, "Whether or not the US_Crowbar spawns as scrap.");
			CrowbarMoonSpawnWeights = cfg.Bind<string>("Item - US_Crowbar", "US_Crowbar Moon Spawning", "experimentation:-1, vow:-1, march:-1, assurance:-1, offense:-1, rend:-1, dine:-1, titan:-1, adamance:-1, artifice:-1, embrion:-1", "Where and how often the US_Crowbar will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 or leave blank to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs.");
			CrowbarGlobalSpawnWeight = cfg.Bind<int>("Item - US_Crowbar", "US_Crowbar Global Spawning", 30, "How often the US_Crowbar will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable).");
			CrowbarIsStoreItem = cfg.Bind<bool>("Item - US_Crowbar", "US_Crowbar is a store item", false, "Whether or not the US_Crowbar is a store item.");
			CrowbarStorePrice = cfg.Bind<int>("Item - US_Crowbar", "US_Crowbar store price", 60, "The store price of the US_Crowbar (Cannot be a negative number).");
			DoomsayerBellLoaded = cfg.Bind<bool>("Scrap Item - Doomsayer Bell", "Doomsayer Bell is loaded", true, "Whether or not the Doomsayer Bell is loaded.");
			DoomsayerBellSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Doomsayer Bell", "Doomsayer Bell is a scrap item", true, "Whether or not the Doomsayer Bell spawns as scrap.");
			DoomsayerBellMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Doomsayer Bell", "Doomsayer Bell Moon Spawning", "experimentation:-1, vow:-1, march:-1, assurance:-1, offense:-1, rend:-1, dine:-1, titan:-1, adamance:-1, artifice:-1, embrion:-1", "Where and how often the Doomsayer Bell will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 or leave blank to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs.");
			DoomsayerBellGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Doomsayer Bell", "Doomsayer Bell Global Spawning", 20, "How often the Doomsayer Bell will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable).");
			HandlampLoaded = cfg.Bind<bool>("Store Item - Handlamp", "Handlamp is loaded", true, "Whether or not the Handlamp is loaded.");
			HandlampIsStoreItem = cfg.Bind<bool>("Store Item - Handlamp", "Handlamp is a store item", true, "Whether or not the Handlamp is a store item.");
			HandlampStorePrice = cfg.Bind<int>("Store Item - Handlamp", "Handlamp store price", 25, "The store price of the Handlamp (Cannot be a negative number).");
			BandagesLoaded = cfg.Bind<bool>("Store Item - US_Bandages", "US_Bandages are loaded", true, "Whether or not the US_Bandages are loaded.");
			BandagesIsStoreItem = cfg.Bind<bool>("Store Item - US_Bandages", "US_Bandages are a store item", true, "Whether or not the US_Bandages are a store item.");
			BandagesStorePrice = cfg.Bind<int>("Store Item - US_Bandages", "US_Bandages store price", 20, "The store price of the US_Bandages (Cannot be a negative number).");
			MedicalKitLoaded = cfg.Bind<bool>("Store Item - Medical Kit", "Medical Kit is loaded", true, "Whether or not the Medical Kit is loaded.");
			MedicalKitIsStoreItem = cfg.Bind<bool>("Store Item - Medical Kit", "Medical Kit is a store item", true, "Whether or not the Medical Kit is a store item.");
			MedicalKitStorePrice = cfg.Bind<int>("Store Item - Medical Kit", "Medical Kit store price", 120, "The store price of the Medical Kit (Cannot be a negative number).");
			DefibrillatorLoaded = cfg.Bind<bool>("Store Item - US_Defibrillator", "US_Defibrillator is loaded", true, "Whether or not the US_Defibrillator is loaded.");
			DefibrillatorIsStoreItem = cfg.Bind<bool>("Store Item - US_Defibrillator", "US_Defibrillator is a store item", true, "Whether or not the US_Defibrillator is a store item.");
			DefibrillatorStorePrice = cfg.Bind<int>("Store Item - US_Defibrillator", "US_Defibrillator store price", 375, "The store price of the US_Defibrillator (Cannot be a negative number).");
			DefibrillatorUsesLimited = cfg.Bind<bool>("Store Item - US_Defibrillator", "US_Defibrillator uses are limited", true, "Whether or not Defibrillators have limited uses.");
			DefibrillatorUseLimit = cfg.Bind<int>("Store Item - US_Defibrillator", "Defibrillators savedUses", 3, "The number of uses each US_Defibrillator has (Uses have a minimum of 1, uses are used up on players successfully revived only).");
			DefibrillatorRefillsOnLanding = cfg.Bind<bool>("Store Item - US_Defibrillator", "US_Defibrillator refills every moon landing", false, "Whether or not existing Defibrillators will refill their uses upon landing on a moon");
			DefibrillatorPermaDeathRule = cfg.Bind<bool>("Store Item - US_Defibrillator", "US_Defibrillator follows perma-death rules", true, "Whether or not specific causes of death will prevent the defibrillator from reviving players (Ex - Corpses decapitated by CoilHeads, Corpses snipped in half by a Barber, Corpses head popped by the Ghost Girl).");
			ProductivityAutoinjectorLoaded = cfg.Bind<bool>("Store Item - Productivity Autoinjector", "Productivity Autoinjector is loaded", true, "Whether or not the Productivity Autoinjector is loaded.");
			ProductivityAutoinjectorIsStoreItem = cfg.Bind<bool>("Store Item - Productivity Autoinjector", "Productivity Autoinjector is a store item", true, "Whether or not the Productivity Autoinjector is a store item.");
			ProductivityAutoinjectorStorePrice = cfg.Bind<int>("Store Item - Productivity Autoinjector", "Productivity Autoinjector store price", 90, "The store price of the Productivity Autoinjector.");
			ToolboxLoaded = cfg.Bind<bool>("Store Item - US_Toolbox", "US_Toolbox is loaded", true, "Whether or not the US_Toolbox is loaded.");
			ToolboxIsStoreItem = cfg.Bind<bool>("Store Item - US_Toolbox", "US_Toolbox is a store item", true, "Whether or not the US_Toolbox is a store item.");
			ToolboxStorePrice = cfg.Bind<int>("Store Item - US_Toolbox", "US_Toolbox store price", 115, "The store price of the US_Toolbox.");
			ShiftControllerLoaded = cfg.Bind<bool>("Store Item - Shift Controller", "Shift Controller is loaded", true, "Whether or not the Shift Controller is loaded.");
			ShiftControllerIsStoreItem = cfg.Bind<bool>("Store Item - Shift Controller", "Shift Controller is a store item", true, "Whether or not the Shift Controller is a store item.");
			ShiftControllerStorePrice = cfg.Bind<int>("Store Item - Shift Controller", "Shift Controller store price", 225, "The store price of the Shift Controller.");
			ShiftControllerGreatRange = cfg.Bind<int>("Store Item - Shift Controller", "Shift Controllers great/first connection range", 50, "The max range of the Shift Controller's great/first connection range. (The great/first connection range starts at 0 and stops at this value, The average/middle connection range starts at this value)");
			ShiftControllerPoorRange = cfg.Bind<int>("Store Item - Shift Controller", "Shift Controllers poor/last connection range", 175, "The range where the Shift Controller enters it's poor/last connection range. (The average/middle connection range stops at this value, The poor/last connection range starts at this value)");
			ClearOrphanedEntries(cfg);
			cfg.Save();
			cfg.SaveOnConfigSet = true;
		}

		private static void ClearOrphanedEntries(ConfigFile cfg)
		{
			PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg);
			dictionary.Clear();
		}
	}
}
namespace UsualScrap.Behaviors
{
	internal class BandagesScript : GrabbableObject
	{
		public NetworkVariable<int> savedUses = new NetworkVariable<int>(3, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private ParticleSystem particle;

		public override int GetItemDataToSave()
		{
			((GrabbableObject)this).GetItemDataToSave();
			return savedUses.Value;
		}

		public override void LoadItemSaveData(int saveData)
		{
			((GrabbableObject)this).LoadItemSaveData(saveData);
			savedUses.Value = saveData;
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown && base.playerHeldBy.health < 100)
			{
				HealServerRpc();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void HealServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(87823207u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 87823207u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					HealClientRpc();
				}
			}
		}

		[ClientRpc]
		public void HealClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2085797069u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2085797069u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Heal();
				}
			}
		}

		public void Heal()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			particle = ((Component)this).GetComponentInChildren<ParticleSystem>();
			ParticleSystem val = Object.Instantiate<ParticleSystem>(particle, ((Component)base.playerHeldBy).transform.position, Quaternion.identity, ((Component)base.playerHeldBy).transform);
			val.Play();
			if (savedUses.Value > 1 && base.playerHeldBy.health < 80)
			{
				base.playerHeldBy.health = base.playerHeldBy.health + 20;
				NetworkVariable<int> obj = savedUses;
				int value = obj.Value;
				obj.Value = value - 1;
			}
			else if (savedUses.Value > 1 && base.playerHeldBy.health >= 80 && base.playerHeldBy.health < 100)
			{
				base.playerHeldBy.health = base.playerHeldBy.health + (100 - base.playerHeldBy.health);
				NetworkVariable<int> obj2 = savedUses;
				int value = obj2.Value;
				obj2.Value = value - 1;
			}
			else if (savedUses.Value <= 1 && base.playerHeldBy.health < 80)
			{
				base.playerHeldBy.health = base.playerHeldBy.health + 20;
				if (base.isHeld)
				{
					base.playerHeldBy.DespawnHeldObject();
				}
			}
			else if (savedUses.Value <= 1 && base.playerHeldBy.health >= 80 && base.playerHeldBy.health < 100)
			{
				base.playerHeldBy.health = base.playerHeldBy.health + (100 - base.playerHeldBy.health);
				if (base.isHeld)
				{
					base.playerHeldBy.DespawnHeldObject();
				}
			}
			if (base.playerHeldBy.health > 20)
			{
				if (base.playerHeldBy.criticallyInjured || base.playerHeldBy.bleedingHeavily)
				{
					base.playerHeldBy.criticallyInjured = false;
					base.playerHeldBy.bleedingHeavily = false;
				}
				if ((Object)(object)base.playerHeldBy.playerBodyAnimator != (Object)null)
				{
					base.playerHeldBy.playerBodyAnimator.SetBool("Limp", false);
				}
				if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)base.playerHeldBy)
				{
					HUDManager.Instance.UpdateHealthUI(base.playerHeldBy.health, false);
				}
			}
		}

		protected override void __initializeVariables()
		{
			if (savedUses == null)
			{
				throw new Exception("BandagesScript.savedUses cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)savedUses).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)savedUses, "savedUses");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)savedUses);
			((GrabbableObject)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_BandagesScript()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(87823207u, new RpcReceiveHandler(__rpc_handler_87823207));
			NetworkManager.__rpc_func_table.Add(2085797069u, new RpcReceiveHandler(__rpc_handler_2085797069));
		}

		private static void __rpc_handler_87823207(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BandagesScript)(object)target).HealServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2085797069(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BandagesScript)(object)target).HealClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "BandagesScript";
		}
	}
	internal class BloodyCapsuleScript : GrabbableObject
	{
		private ParticleSystem chargedParticles;

		private ParticleSystem chargingParticles;

		private ParticleSystem drainingParticles;

		private AudioSource[] sounds;

		private AudioClip pulse;

		private Light light;

		private bool activateCoroutineRunning = false;

		private bool chargingParticlePlaying = false;

		private bool chargedParticlesPlaying = false;

		private int charge = 0;

		private EnemyType maskedPlayer;

		private Vector3 navMeshPosition;

		private bool disabledInShip;

		internal static UsualScrapConfigs BoundConfig { get; private set; }

		public void Awake()
		{
			BoundConfig = Plugin.BoundConfig;
			try
			{
				chargedParticles = ((Component)((Component)this).transform.Find("ChargedParticles")).GetComponent<ParticleSystem>();
				chargingParticles = ((Component)((Component)this).transform.Find("ChargingParticles")).GetComponent<ParticleSystem>();
				drainingParticles = ((Component)((Component)this).transform.Find("DrainingParticles")).GetComponent<ParticleSystem>();
				sounds = ((Component)((Component)this).transform.Find("BloodyCapsuleSounds")).gameObject.GetComponents<AudioSource>();
				light = ((Component)((Component)this).transform.Find("Point Light")).GetComponent<Light>();
				pulse = sounds[0].clip;
			}
			catch
			{
				if ((Object)(object)chargedParticles == (Object)null)
				{
					MonoBehaviour.print((object)"Bloody Capsule missing charged particles! - USUAL SCRAP");
				}
				if ((Object)(object)chargingParticles == (Object)null)
				{
					MonoBehaviour.print((object)"Bloody Capsule missing charging particles! - USUAL SCRAP");
				}
				if ((Object)(object)drainingParticles == (Object)null)
				{
					MonoBehaviour.print((object)"Bloody Capsule missing draining particles! - USUAL SCRAP");
				}
			}
			disabledInShip = BoundConfig.CapsulesDisabledOnTheShip.Value;
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			if (((Behaviour)light).enabled)
			{
				((Behaviour)light).enabled = false;
			}
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			if (!((Behaviour)light).enabled)
			{
				((Behaviour)light).enabled = true;
			}
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			if (!((Behaviour)light).enabled)
			{
				((Behaviour)light).enabled = true;
			}
		}

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if ((StartOfRound.Instance.inShipPhase && activateCoroutineRunning) || (disabledInShip && base.isInShipRoom && activateCoroutineRunning))
			{
				((MonoBehaviour)this).StopAllCoroutines();
				activateCoroutineRunning = false;
				chargingParticlePlaying = false;
				chargedParticlesPlaying = false;
				charge = 0;
				chargedParticles.Stop();
				chargingParticles.Stop();
				drainingParticles.Stop();
			}
			else if (StartOfRound.Instance.shipHasLanded && !activateCoroutineRunning && TimeOfDay.Instance.currentLevel.planetHasTime)
			{
				((MonoBehaviour)this).StartCoroutine(AbsorbBlood());
			}
		}

		private IEnumerator AbsorbBlood()
		{
			activateCoroutineRunning = true;
			if (!StartOfRound.Instance.shipHasLanded || !TimeOfDay.Instance.currentLevel.planetHasTime)
			{
				yield return (object)new WaitUntil((Func<bool>)(() => StartOfRound.Instance.shipHasLanded && TimeOfDay.Instance.currentLevel.planetHasTime));
			}
			while (StartOfRound.Instance.shipHasLanded && TimeOfDay.Instance.currentLevel.planetHasTime)
			{
				yield return (object)new WaitForSeconds(3f);
				Collider[] playerColliderArray = Physics.OverlapSphere(((Component)this).transform.position, 4f, LayerMask.GetMask(new string[1] { "Player" }), (QueryTriggerInteraction)2);
				HashSet<PlayerControllerB> drainedPlayers = new HashSet<PlayerControllerB>();
				if (playerColliderArray.Length != 0)
				{
					Collider[] array = playerColliderArray;
					foreach (Collider collider in array)
					{
						PlayerControllerB targetPlayer = ((Component)collider).gameObject.GetComponent<PlayerControllerB>();
						if (!((Object)(object)targetPlayer != (Object)null) || drainedPlayers.Contains(targetPlayer))
						{
							continue;
						}
						targetPlayer.DamagePlayer(10, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
						drainedPlayers.Add(targetPlayer);
						ParticleSystem DrainingParticle = Object.Instantiate<ParticleSystem>(drainingParticles, ((Component)collider).transform.position, Quaternion.identity, ((Component)targetPlayer).transform);
						DrainingParticle.Play();
						sounds[0].PlayOneShot(pulse);
						charge++;
						int num = charge;
						if (num > 0 && num < 12 && !chargingParticlePlaying && !base.isPocketed)
						{
							chargingParticles.Play();
							chargingParticlePlaying = true;
						}
						if (charge >= 12)
						{
							if (chargingParticlePlaying)
							{
								chargingParticles.Stop();
								chargingParticlePlaying = false;
							}
							chargedParticles.Play();
							chargedParticlesPlaying = true;
							charge = 0;
							yield return (object)new WaitUntil((Func<bool>)(() => !base.isHeld));
							chargedParticles.Stop();
							chargedParticlesPlaying = false;
						}
					}
				}
				else
				{
					chargingParticles.Stop();
					chargingParticlePlaying = false;
				}
				if (base.isPocketed)
				{
					chargingParticles.Stop();
					chargingParticlePlaying = false;
				}
			}
			activateCoroutineRunning = false;
		}

		[ServerRpc]
		public void SpawnMaskedServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4091447056u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4091447056u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			SelectableLevel[] array = levels;
			foreach (SelectableLevel val3 in array)
			{
				foreach (SpawnableEnemyWithRarity enemy in val3.Enemies)
				{
					if (((Object)enemy.enemyType).name.Contains("MaskedPlayerEnemy"))
					{
						maskedPlayer = enemy.enemyType;
						navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)this).transform.position, default(NavMeshHit), 10f, -1);
						break;
					}
				}
			}
			RoundManager.Instance.SpawnEnemyGameObject(navMeshPosition, 0f, 0, maskedPlayer);
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_BloodyCapsuleScript()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(4091447056u, new RpcReceiveHandler(__rpc_handler_4091447056));
		}

		private static void __rpc_handler_4091447056(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BloodyCapsuleScript)(object)target).SpawnMaskedServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "BloodyCapsuleScript";
		}
	}
	internal class CandyDispenserScript : GrabbableObject
	{
		private RaycastHit[] objectsHitByMeleeWeapon;

		private List<RaycastHit> objectsHitByMeleeWeaponList = new List<RaycastHit>();

		private bool isHoldingButton;

		private bool reelingUp;

		private Coroutine reelingUpCoroutine;

		private PlayerControllerB previousPlayerHeldBy;

		private static Item _candyItem;

		private GameObject dispenserBase;

		private MeshRenderer dispenserMesh;

		private int meleeWeaponMask = 1084754248;

		private int meleeWeaponHitForce = 1;

		private AudioSource dispenserAudio;

		private AudioClip swing;

		private AudioClip Dispense;

		private AudioClip[] hitSFX;

		private Color setColor;

		public void Awake()
		{
			dispenserAudio = ((Component)((Component)this).transform.Find("CandyDispenserSounds")).gameObject.GetComponent<AudioSource>();
			AudioSource[] components = ((Component)((Component)this).transform.Find("CandyDispenserSounds")).gameObject.GetComponents<AudioSource>();
			swing = components[1].clip;
			Dispense = components[2].clip;
			hitSFX = (AudioClip[])(object)new AudioClip[1] { dispenserAudio.clip };
		}

		public override void DiscardItem()
		{
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				base.playerHeldBy.activatingItem = false;
			}
			((GrabbableObject)this).DiscardItem();
		}

		public override void Start()
		{
			((GrabbableObject)this).Start();
			SetColorServerRPC();
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetColorServerRPC()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3606619266u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3606619266u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					byte b = (byte)new Random().Next(1, 256);
					byte b2 = (byte)new Random().Next(1, 256);
					byte b3 = (byte)new Random().Next(1, 256);
					setColor = Color32.op_Implicit(new Color32(b, b2, b3, byte.MaxValue));
					SetColorClientRPC(setColor);
				}
			}
		}

		[ClientRpc]
		public void SetColorClientRPC(Color color)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(809217553u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref color);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 809217553u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					dispenserBase = ((Component)((Component)((Component)this).transform.Find("CandyDispenserModel")).gameObject.transform.Find("DispenserBase")).gameObject;
					dispenserMesh = dispenserBase.GetComponent<MeshRenderer>();
					((Renderer)dispenserMesh).material.color = color;
				}
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if ((Object)(object)base.playerHeldBy == (Object)null)
			{
				return;
			}
			isHoldingButton = buttonDown;
			if (!reelingUp && !reelingUp && buttonDown)
			{
				reelingUp = true;
				previousPlayerHeldBy = base.playerHeldBy;
				if (reelingUpCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine);
				}
				reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(reelUpMeleeWeapon());
			}
		}

		private IEnumerator reelUpMeleeWeapon()
		{
			base.playerHeldBy.activatingItem = true;
			base.playerHeldBy.twoHanded = true;
			base.playerHeldBy.playerBodyAnimator.ResetTrigger("shovelHit");
			base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
			yield return (object)new WaitForSeconds(0.35f);
			yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld));
			SwingMeleeWeapon(!base.isHeld);
			yield return (object)new WaitForSeconds(0.13f);
			yield return (object)new WaitForEndOfFrame();
			HitMeleeWeapon(!base.isHeld);
			yield return (object)new WaitForSeconds(0.3f);
			reelingUp = false;
			reelingUpCoroutine = null;
		}

		public void SwingMeleeWeapon(bool cancel = false)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
			if (!cancel)
			{
				dispenserAudio.PlayOneShot(swing);
				previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false);
			}
		}

		public void HitMeleeWeapon(bool cancel = false)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: U