Decompiled source of UsualScrap v1.8.3

UsualScrap.dll

Decompiled a week 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 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.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.3")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "Emil.UsualScrap";

		public const string PLUGIN_NAME = "UsualScrap";

		public const string PLUGIN_VERSION = "1.8.3";

		public static Plugin instance;

		internal static UsualScrapConfigs BoundConfig { get; private set; }

		public void RegisterStoreItem(GrabbableObject itemScript, Item itemProperties, string description = " ", int price = 0)
		{
			itemScript.isInFactory = false;
			TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
			val.clearPreviousText = true;
			val.displayText = description + "\n\n";
			Items.RegisterShopItem(itemProperties, (TerminalNode)null, (TerminalNode)null, val, price);
		}

		public void RegisterScrapItem(GrabbableObject itemScript, Item itemProperties, int spawnWeight = 0, LevelTypes levels = -1)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			itemScript.isInFactory = true;
			Items.RegisterScrap(itemProperties, spawnWeight, levels);
		}

		public void FixItemInteraction(GrabbableObject itemScript, bool grabbable, bool grabbableToEnemies, Item itemProperties)
		{
			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;
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "usualscrapassetbundle"));
			Item val2 = val.LoadAsset<Item>("Assets/Items/UnstableFuelCylinderAssets/UnstableFuelCylinder_Item.asset");
			Item val3 = val.LoadAsset<Item>("Assets/Items/HandlampAssets/Handlamp_Item.asset");
			Item val4 = val.LoadAsset<Item>("Assets/Items/BandagesAssets/Bandages_Item.asset");
			Item val5 = val.LoadAsset<Item>("Assets/Items/MedicalKitAssets/MedicalKit_Item.asset");
			Item val6 = val.LoadAsset<Item>("Assets/Items/DefibrillatorAssets/Defibrillator_Item.asset");
			Item val7 = val.LoadAsset<Item>("Assets/Items/ToolboxAssets/Toolbox_Item.asset");
			Item val8 = val.LoadAsset<Item>("Assets/Items/WalkingCaneAssets/WalkingCane_Item.asset");
			Item val9 = val.LoadAsset<Item>("Assets/Items/RadioactiveCellAssets/RadioactiveCell_Item.asset");
			Item val10 = val.LoadAsset<Item>("Assets/Items/ScissorsAssets/Scissors_Item.asset");
			Item val11 = val.LoadAsset<Item>("Assets/Items/RoseAssets/Rose_Item.asset");
			Item val12 = val.LoadAsset<Item>("Assets/Items/GoldenTicketAssets/GoldenTicket_Item.asset");
			Item val13 = val.LoadAsset<Item>("Assets/Items/TicketAssets/Ticket_Item.asset");
			Item val14 = val.LoadAsset<Item>("Assets/Items/PadlockAssets/Padlock_Item.asset");
			Item val15 = val.LoadAsset<Item>("Assets/Items/PocketWatchAssets/PocketWatch_Item.asset");
			Item val16 = val.LoadAsset<Item>("Assets/Items/CrowbarAssets/Crowbar_Item.asset");
			Item val17 = val.LoadAsset<Item>("Assets/Items/CandyDispenserAssets/CandyDispenser_Item.asset");
			Item val18 = val.LoadAsset<Item>("Assets/Items/LollipopAssets/Lollipop_Item.asset");
			Item val19 = val.LoadAsset<Item>("Assets/Items/EmergencyInjectorAssets/EmergencyInjector_Item.asset");
			Item val20 = val.LoadAsset<Item>("Assets/Items/ShiftControllerAssets/ShiftController_Item.asset");
			Item val21 = val.LoadAsset<Item>("Assets/Items/GloomyCapsuleAssets/GloomyCapsule_Item.asset");
			Item val22 = val.LoadAsset<Item>("Assets/Items/FrigidCapsuleAssets/FrigidCapsule_Item.asset");
			Item val23 = val.LoadAsset<Item>("Assets/Items/SanguineCapsuleAssets/SanguineCapsule_Item.asset");
			List<Item> list = new List<Item>
			{
				val2, val3, val4, val5, val6, val19, val20, val7, val9, val21,
				val22, val23, val15, val14, val16, val8, val10, val11, val12, val13,
				val17, val18
			};
			foreach (Item item in list)
			{
				if ((Object)(object)item != (Object)null)
				{
					NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
					Utilities.FixMixerGroups(item.spawnPrefab);
				}
			}
			BoundConfig = new UsualScrapConfigs(((BaseUnityPlugin)this).Config);
			HandlampScript itemScript = val3.spawnPrefab.AddComponent<HandlampScript>();
			if (BoundConfig.HandlampLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript, grabbable: true, grabbableToEnemies: true, val3);
				if (BoundConfig.HandlampIsStoreItem.Value)
				{
					RegisterStoreItem((GrabbableObject)(object)itemScript, val3, "The Handlamp is perfect for illuminating your surroundings..and possibly blinding you.", BoundConfig.HandlampStorePrice.Value);
				}
				if (!BoundConfig.HandlampIsStoreItem.Value)
				{
					Items.RegisterItem(val3);
				}
			}
			EmergencyInjectorScript itemScript2 = val19.spawnPrefab.AddComponent<EmergencyInjectorScript>();
			if (BoundConfig.EmergencyInjectorLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript2, grabbable: true, grabbableToEnemies: true, val19);
				if (BoundConfig.EmergencyInjectorSpawnsAsScrap.Value)
				{
					val19.isScrap = true;
					val19.minValue = 30;
					val19.maxValue = 50;
					RegisterScrapItem((GrabbableObject)(object)itemScript2, val19, BoundConfig.EmergencyInjectorSpawnWeight.Value, (LevelTypes)(-1));
				}
				if (BoundConfig.EmergencyInjectorIsStoreItem.Value)
				{
					RegisterStoreItem((GrabbableObject)(object)itemScript2, val19, "The Emergency Injector boosts your movement capabilities for a while and gives a small amount of health, don't take too much!", BoundConfig.EmergencyInjectorStorePrice.Value);
				}
				if (!BoundConfig.EmergencyInjectorSpawnsAsScrap.Value && !BoundConfig.EmergencyInjectorIsStoreItem.Value)
				{
					Items.RegisterItem(val19);
				}
			}
			BandagesScript bandagesScript = val4.spawnPrefab.AddComponent<BandagesScript>();
			if (BoundConfig.BandagesLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)bandagesScript, grabbable: true, grabbableToEnemies: true, val4);
				((GrabbableObject)bandagesScript).useCooldown = 0.5f;
				if (BoundConfig.BandagesIsStoreItem.Value)
				{
					RegisterStoreItem((GrabbableObject)(object)bandagesScript, val4, "The Bandages will get you up and going in no time at all!", BoundConfig.BandagesStorePrice.Value);
				}
				if (!BoundConfig.BandagesIsStoreItem.Value)
				{
					Items.RegisterItem(val4);
				}
			}
			MedicalKitScript itemScript3 = val5.spawnPrefab.AddComponent<MedicalKitScript>();
			if (BoundConfig.MedicalKitLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript3, grabbable: true, grabbableToEnemies: true, val5);
				if (BoundConfig.MedicalKitIsStoreItem.Value)
				{
					RegisterStoreItem((GrabbableObject)(object)itemScript3, val5, "The Medical Kit can heal anything if given time!", BoundConfig.MedicalKitStorePrice.Value);
				}
				if (!BoundConfig.MedicalKitIsStoreItem.Value)
				{
					Items.RegisterItem(val5);
				}
			}
			DefibrillatorScript itemScript4 = val6.spawnPrefab.AddComponent<DefibrillatorScript>();
			if (BoundConfig.DefibrillatorLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript4, grabbable: true, grabbableToEnemies: true, val6);
				if (BoundConfig.DefibrillatorSpawnsAsScrap.Value)
				{
					val6.isScrap = true;
					val6.minValue = 225;
					val6.maxValue = 300;
					RegisterScrapItem((GrabbableObject)(object)itemScript4, val6, BoundConfig.DefibrillatorSpawnWeight.Value, (LevelTypes)(-1));
				}
				if (BoundConfig.DefibrillatorIsStoreItem.Value)
				{
					RegisterStoreItem((GrabbableObject)(object)itemScript4, val6, "The Defibrillator can revive those employees lost to stupidity.", BoundConfig.DefibrillatorStorePrice.Value);
				}
				if (!BoundConfig.DefibrillatorSpawnsAsScrap.Value && !BoundConfig.DefibrillatorIsStoreItem.Value)
				{
					Items.RegisterItem(val6);
				}
			}
			PadlockScript itemScript5 = val14.spawnPrefab.AddComponent<PadlockScript>();
			if (BoundConfig.PadlockLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript5, grabbable: true, grabbableToEnemies: true, val14);
				if (BoundConfig.PadlockSpawnsAsScrap.Value)
				{
					RegisterScrapItem((GrabbableObject)(object)itemScript5, val14, BoundConfig.PadlockSpawnWeight.Value, (LevelTypes)(-1));
				}
				if (BoundConfig.PadlockIsStoreItem.Value)
				{
					RegisterStoreItem((GrabbableObject)(object)itemScript5, val14, "The Padlock can be used to lock doors on your enemies..or fellow employees.", BoundConfig.PadlockStorePrice.Value);
				}
				if (!BoundConfig.PadlockSpawnsAsScrap.Value && !BoundConfig.PadlockIsStoreItem.Value)
				{
					Items.RegisterItem(val14);
				}
			}
			CrowbarScript itemScript6 = val16.spawnPrefab.AddComponent<CrowbarScript>();
			if (BoundConfig.CrowbarLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript6, grabbable: true, grabbableToEnemies: true, val16);
				if (BoundConfig.CrowbarSpawnsAsScrap.Value)
				{
					RegisterScrapItem((GrabbableObject)(object)itemScript6, val16, BoundConfig.CrowbarSpawnWeight.Value, (LevelTypes)(-1));
				}
				if (BoundConfig.CrowbarIsStoreItem.Value)
				{
					RegisterStoreItem((GrabbableObject)(object)itemScript6, val16, "The Crowbar is a light melee weapon that can be used to pry open doors.", BoundConfig.CrowbarStorePrice.Value);
				}
				if (!BoundConfig.CrowbarSpawnsAsScrap.Value && !BoundConfig.CrowbarIsStoreItem.Value)
				{
					Items.RegisterItem(val16);
				}
			}
			ShiftControllerScript itemScript7 = val20.spawnPrefab.AddComponent<ShiftControllerScript>();
			if (BoundConfig.ShiftControllerLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript7, grabbable: true, grabbableToEnemies: true, val20);
				if (BoundConfig.ShiftControllerIsStoreItem.Value)
				{
					RegisterStoreItem((GrabbableObject)(object)itemScript7, val20, "The Shift Controller is a portable teleporter that allows you to set the teleport position.", BoundConfig.ShiftControllerStorePrice.Value);
				}
				if (!BoundConfig.ShiftControllerIsStoreItem.Value)
				{
					Items.RegisterItem(val20);
				}
			}
			ToolboxScript toolboxScript = val7.spawnPrefab.AddComponent<ToolboxScript>();
			if (BoundConfig.ToolboxLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)toolboxScript, grabbable: true, grabbableToEnemies: true, val7);
				((GrabbableObject)toolboxScript).useCooldown = 0.1f;
				if (BoundConfig.ToolboxIsStoreItem.Value)
				{
					RegisterStoreItem((GrabbableObject)(object)toolboxScript, val7, "The Toolbox can deconstruct some traps for a fine reward.", BoundConfig.ToolboxStorePrice.Value);
				}
				if (!BoundConfig.ToolboxIsStoreItem.Value)
				{
					Items.RegisterItem(val7);
				}
			}
			UnstableFuelCylinderScript itemScript8 = val2.spawnPrefab.AddComponent<UnstableFuelCylinderScript>();
			if (BoundConfig.UnstableFuelCylinderLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript8, grabbable: true, grabbableToEnemies: true, val2);
				if (BoundConfig.UnstableFuelCylinderSpawnsAsScrap.Value)
				{
					RegisterScrapItem((GrabbableObject)(object)itemScript8, val2, BoundConfig.UnstableFuelCylinderSpawnWeight.Value, (LevelTypes)(-1));
				}
				if (!BoundConfig.UnstableFuelCylinderSpawnsAsScrap.Value)
				{
					Items.RegisterItem(val2);
				}
			}
			RadioactiveCellScript itemScript9 = val9.spawnPrefab.AddComponent<RadioactiveCellScript>();
			if (BoundConfig.RadioactiveCellLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript9, grabbable: true, grabbableToEnemies: true, val9);
				if (BoundConfig.RadioactiveCellSpawnsAsScrap.Value)
				{
					RegisterScrapItem((GrabbableObject)(object)itemScript9, val9, BoundConfig.RadioactiveCellSpawnWeight.Value, (LevelTypes)(-1));
				}
				if (!BoundConfig.RadioactiveCellSpawnsAsScrap.Value)
				{
					Items.RegisterItem(val9);
				}
			}
			RoseScript itemScript10 = val11.spawnPrefab.AddComponent<RoseScript>();
			if (BoundConfig.RoseLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript10, grabbable: true, grabbableToEnemies: true, val11);
				if (BoundConfig.RoseSpawnsAsScrap.Value)
				{
					RegisterScrapItem((GrabbableObject)(object)itemScript10, val11, BoundConfig.RoseSpawnWeight.Value, (LevelTypes)(-1));
				}
				if (!BoundConfig.RoseSpawnsAsScrap.Value)
				{
					Items.RegisterItem(val11);
				}
			}
			WalkingCaneScript itemScript11 = val8.spawnPrefab.AddComponent<WalkingCaneScript>();
			if (BoundConfig.WalkingCaneLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript11, grabbable: true, grabbableToEnemies: true, val8);
				if (BoundConfig.WalkingCaneSpawnsAsScrap.Value)
				{
					RegisterScrapItem((GrabbableObject)(object)itemScript11, val8, BoundConfig.WalkingCaneSpawnWeight.Value, (LevelTypes)(-1));
				}
				if (!BoundConfig.WalkingCaneSpawnsAsScrap.Value)
				{
					Items.RegisterItem(val8);
				}
			}
			ScissorsScript itemScript12 = val10.spawnPrefab.AddComponent<ScissorsScript>();
			if (BoundConfig.ScissorsLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript12, grabbable: true, grabbableToEnemies: true, val10);
				if (BoundConfig.ScissorsSpawnsAsScrap.Value)
				{
					RegisterScrapItem((GrabbableObject)(object)itemScript12, val10, BoundConfig.ScissorsSpawnWeight.Value, (LevelTypes)(-1));
				}
				if (!BoundConfig.ScissorsSpawnsAsScrap.Value)
				{
					Items.RegisterItem(val10);
				}
			}
			TicketScript itemScript13 = val13.spawnPrefab.AddComponent<TicketScript>();
			if (BoundConfig.TicketLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript13, grabbable: true, grabbableToEnemies: true, val13);
				if (BoundConfig.TicketSpawnsAsScrap.Value)
				{
					RegisterScrapItem((GrabbableObject)(object)itemScript13, val13, BoundConfig.TicketSpawnWeight.Value, (LevelTypes)(-1));
				}
				if (!BoundConfig.TicketSpawnsAsScrap.Value)
				{
					Items.RegisterItem(val13);
				}
			}
			GoldenTicketScript itemScript14 = val12.spawnPrefab.AddComponent<GoldenTicketScript>();
			if (BoundConfig.GoldenTicketLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript14, grabbable: true, grabbableToEnemies: true, val12);
				if (BoundConfig.GoldenTicketSpawnsAsScrap.Value)
				{
					RegisterScrapItem((GrabbableObject)(object)itemScript14, val12, BoundConfig.GoldenTicketSpawnWeight.Value, (LevelTypes)(-1));
				}
				if (!BoundConfig.GoldenTicketSpawnsAsScrap.Value)
				{
					Items.RegisterItem(val12);
				}
			}
			CandyDispenserScript itemScript15 = val17.spawnPrefab.AddComponent<CandyDispenserScript>();
			LollipopScript itemScript16 = val18.spawnPrefab.AddComponent<LollipopScript>();
			if (BoundConfig.CandyDispenserLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript15, grabbable: true, grabbableToEnemies: true, val17);
				FixItemInteraction((GrabbableObject)(object)itemScript16, grabbable: true, grabbableToEnemies: true, val18);
				if (BoundConfig.CandyDispenserSpawnsAsScrap.Value)
				{
					RegisterScrapItem((GrabbableObject)(object)itemScript15, val17, BoundConfig.CandyDispenserSpawnWeight.Value, (LevelTypes)(-1));
					RegisterScrapItem((GrabbableObject)(object)itemScript16, val18, 0, (LevelTypes)1);
				}
				if (!BoundConfig.CandyDispenserSpawnsAsScrap.Value)
				{
					Items.RegisterItem(val17);
					Items.RegisterItem(val18);
				}
			}
			PhysicsProp itemScript17 = val15.spawnPrefab.AddComponent<PhysicsProp>();
			if (BoundConfig.PocketWatchLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript17, grabbable: true, grabbableToEnemies: true, val15);
				if (BoundConfig.PocketWatchSpawnsAsScrap.Value)
				{
					RegisterScrapItem((GrabbableObject)(object)itemScript17, val15, BoundConfig.PocketWatchSpawnWeight.Value, (LevelTypes)(-1));
				}
				if (!BoundConfig.PocketWatchSpawnsAsScrap.Value)
				{
					Items.RegisterItem(val15);
				}
			}
			GloomyCapsuleScript itemScript18 = val21.spawnPrefab.AddComponent<GloomyCapsuleScript>();
			if (BoundConfig.GloomyCapsuleLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript18, grabbable: true, grabbableToEnemies: true, val21);
				if (BoundConfig.GloomyCapsuleSpawnsAsScrap.Value)
				{
					RegisterScrapItem((GrabbableObject)(object)itemScript18, val21, BoundConfig.GloomyCapsuleSpawnWeight.Value, (LevelTypes)(-1));
				}
				if (!BoundConfig.GloomyCapsuleSpawnsAsScrap.Value)
				{
					Items.RegisterItem(val21);
				}
			}
			FrigidCapsuleScript itemScript19 = val22.spawnPrefab.AddComponent<FrigidCapsuleScript>();
			if (BoundConfig.FrigidCapsuleLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript19, grabbable: true, grabbableToEnemies: true, val22);
				if (BoundConfig.FrigidCapsuleSpawnsAsScrap.Value)
				{
					RegisterScrapItem((GrabbableObject)(object)itemScript19, val22, BoundConfig.FrigidCapsuleSpawnWeight.Value, (LevelTypes)(-1));
				}
				if (!BoundConfig.FrigidCapsuleSpawnsAsScrap.Value)
				{
					Items.RegisterItem(val22);
				}
			}
			SanguineCapsuleScript itemScript20 = val23.spawnPrefab.AddComponent<SanguineCapsuleScript>();
			if (BoundConfig.FrigidCapsuleLoaded.Value)
			{
				FixItemInteraction((GrabbableObject)(object)itemScript20, grabbable: true, grabbableToEnemies: true, val23);
				if (BoundConfig.FrigidCapsuleSpawnsAsScrap.Value)
				{
					RegisterScrapItem((GrabbableObject)(object)itemScript20, val23, BoundConfig.SanguineCapsuleSpawnWeight.Value, (LevelTypes)(-1));
				}
				if (!BoundConfig.FrigidCapsuleSpawnsAsScrap.Value)
				{
					Items.RegisterItem(val23);
				}
			}
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Emil.UsualScrap");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Emil.UsualScrap is loaded!");
		}
	}
	internal class UsualScrapConfigs
	{
		public readonly ConfigEntry<bool> UnstableFuelCylinderLoaded;

		public readonly ConfigEntry<bool> UnstableFuelCylinderSpawnsAsScrap;

		public readonly ConfigEntry<int> UnstableFuelCylinderSpawnWeight;

		public readonly ConfigEntry<bool> RadioactiveCellLoaded;

		public readonly ConfigEntry<bool> RadioactiveCellSpawnsAsScrap;

		public readonly ConfigEntry<int> RadioactiveCellSpawnWeight;

		public readonly ConfigEntry<bool> CrowbarLoaded;

		public readonly ConfigEntry<bool> CrowbarSpawnsAsScrap;

		public readonly ConfigEntry<int> CrowbarSpawnWeight;

		public readonly ConfigEntry<bool> CrowbarIsStoreItem;

		public readonly ConfigEntry<int> CrowbarStorePrice;

		public readonly ConfigEntry<bool> PadlockLoaded;

		public readonly ConfigEntry<bool> PadlockSpawnsAsScrap;

		public readonly ConfigEntry<int> PadlockSpawnWeight;

		public readonly ConfigEntry<bool> PadlockIsStoreItem;

		public readonly ConfigEntry<int> PadlockStorePrice;

		public readonly ConfigEntry<bool> WalkingCaneLoaded;

		public readonly ConfigEntry<bool> WalkingCaneSpawnsAsScrap;

		public readonly ConfigEntry<int> WalkingCaneSpawnWeight;

		public readonly ConfigEntry<bool> ScissorsLoaded;

		public readonly ConfigEntry<bool> ScissorsSpawnsAsScrap;

		public readonly ConfigEntry<int> ScissorsSpawnWeight;

		public readonly ConfigEntry<bool> RoseLoaded;

		public readonly ConfigEntry<bool> RoseSpawnsAsScrap;

		public readonly ConfigEntry<int> RoseSpawnWeight;

		public readonly ConfigEntry<bool> TicketLoaded;

		public readonly ConfigEntry<bool> TicketSpawnsAsScrap;

		public readonly ConfigEntry<int> TicketSpawnWeight;

		public readonly ConfigEntry<bool> GoldenTicketLoaded;

		public readonly ConfigEntry<bool> GoldenTicketSpawnsAsScrap;

		public readonly ConfigEntry<int> GoldenTicketSpawnWeight;

		public readonly ConfigEntry<bool> CandyDispenserLoaded;

		public readonly ConfigEntry<bool> CandyDispenserSpawnsAsScrap;

		public readonly ConfigEntry<int> CandyDispenserSpawnWeight;

		public readonly ConfigEntry<bool> GloomyCapsuleLoaded;

		public readonly ConfigEntry<bool> GloomyCapsuleSpawnsAsScrap;

		public readonly ConfigEntry<int> GloomyCapsuleSpawnWeight;

		public readonly ConfigEntry<bool> FrigidCapsuleLoaded;

		public readonly ConfigEntry<bool> FrigidCapsuleSpawnsAsScrap;

		public readonly ConfigEntry<int> FrigidCapsuleSpawnWeight;

		public readonly ConfigEntry<bool> SanguineCapsuleLoaded;

		public readonly ConfigEntry<bool> SanguineCapsuleSpawnsAsScrap;

		public readonly ConfigEntry<int> SanguineCapsuleSpawnWeight;

		public readonly ConfigEntry<bool> PocketWatchLoaded;

		public readonly ConfigEntry<bool> PocketWatchSpawnsAsScrap;

		public readonly ConfigEntry<int> PocketWatchSpawnWeight;

		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> BandagesSpawnsAsScrap;

		public readonly ConfigEntry<int> BandagesSpawnWeight;

		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> DefibrillatorSpawnsAsScrap;

		public readonly ConfigEntry<int> DefibrillatorSpawnWeight;

		public readonly ConfigEntry<bool> DefibrillatorUsesLimited;

		public readonly ConfigEntry<int> DefibrillatorUseLimit;

		public readonly ConfigEntry<bool> DefibrillatorPermaDeathRule;

		public readonly ConfigEntry<bool> DefibrillatorRefillsOnLanding;

		public readonly ConfigEntry<bool> ShiftControllerLoaded;

		public readonly ConfigEntry<bool> ShiftControllerIsStoreItem;

		public readonly ConfigEntry<int> ShiftControllerStorePrice;

		public readonly ConfigEntry<bool> EmergencyInjectorLoaded;

		public readonly ConfigEntry<bool> EmergencyInjectorIsStoreItem;

		public readonly ConfigEntry<int> EmergencyInjectorStorePrice;

		public readonly ConfigEntry<bool> EmergencyInjectorSpawnsAsScrap;

		public readonly ConfigEntry<int> EmergencyInjectorSpawnWeight;

		public readonly ConfigEntry<bool> ToolboxLoaded;

		public readonly ConfigEntry<bool> ToolboxIsStoreItem;

		public readonly ConfigEntry<int> ToolboxStorePrice;

		public readonly ConfigEntry<int> ShiftControllerGreatRange;

		public readonly ConfigEntry<int> ShiftControllerPoorRange;

		public readonly ConfigEntry<bool> CapsulesDisabledOnTheShip;

		public UsualScrapConfigs(ConfigFile cfg)
		{
			cfg.SaveOnConfigSet = false;
			UnstableFuelCylinderLoaded = cfg.Bind<bool>("Scrap Item - Unstable Fuel Cylinder", "Unstable Fuel Cylinder is Loaded", true, "Whether or not the Unstable Fuel Cylinder is loaded.");
			UnstableFuelCylinderSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Unstable Fuel Cylinder", "Unstable Fuel Cylinder is a scrap item", true, "Whether or not the Unstable Fuel Cylinder spawns as scrap.");
			UnstableFuelCylinderSpawnWeight = cfg.Bind<int>("Scrap Item - Unstable Fuel Cylinder", "Unstable Fuel Cylinder spawn weight", 25, "How often the Unstable Fuel Cylinder spawns as scrap.");
			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.");
			RadioactiveCellSpawnWeight = cfg.Bind<int>("Scrap Item - Radioactive Cell", "Radioactive Cell spawn weight", 15, "How often the Radioactive Cell spawns as scrap.");
			CrowbarLoaded = cfg.Bind<bool>("Scrap Item - Crowbar", "Crowbar is loaded", true, "Whether or not the Crowbar is loaded.");
			CrowbarSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Crowbar", "Crowbar is a scrap item", true, "Whether or not the Crowbar spawns as scrap.");
			CrowbarSpawnWeight = cfg.Bind<int>("Scrap Item - Crowbar", "Crowbar spawn weight", 30, "How often the Crowbar spawns as scrap.");
			CrowbarIsStoreItem = cfg.Bind<bool>("Scrap Item - Crowbar", "Crowbar is a store item", false, "Whether or not the Crowbar is a store item.");
			CrowbarStorePrice = cfg.Bind<int>("Scrap Item - Crowbar", "Crowbar store price", 55, "The store price of the Crowbar.");
			PadlockLoaded = cfg.Bind<bool>("Scrap Item - Padlock", "Padlock is loaded", true, "Whether or not the Padlock is loaded.");
			PadlockSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Padlock", "Padlock is a scrap item", true, "Whether or not the Padlock spawns as scrap.");
			PadlockSpawnWeight = cfg.Bind<int>("Scrap Item - Padlock", "Padlock spawn weight", 30, "How often the Padlock spawns as scrap.");
			PadlockIsStoreItem = cfg.Bind<bool>("Scrap Item - Padlock", "Padlock is a store item", false, "Whether or not the Padlock is a store item.");
			PadlockStorePrice = cfg.Bind<int>("Scrap Item - Padlock", "Padlock store price", 20, "The store price of the Padlock.");
			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.");
			WalkingCaneSpawnWeight = cfg.Bind<int>("Scrap Item - Walking Cane", "Walking Cane spawn weight", 20, "How often the Walking Cane spawns as scrap.");
			ScissorsLoaded = cfg.Bind<bool>("Scrap Item - Scissors", "Scissors are loaded", true, "Whether or not the Scissors are loaded.");
			ScissorsSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Scissors", "Scissors are a scrap item", true, "Whether or not the Scissors spawn as scrap.");
			ScissorsSpawnWeight = cfg.Bind<int>("Scrap Item - Scissors", "Scissors spawn weight", 30, "How often the Scissors spawn as scrap.");
			RoseLoaded = cfg.Bind<bool>("Scrap Item - Rose", "Rose is loaded", true, "Whether or not the Rose is loaded.");
			RoseSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Rose", "Rose is scrap item", true, "Whether or not the Rose spawns as scrap.");
			RoseSpawnWeight = cfg.Bind<int>("Scrap Item - Rose", "Rose spawn weight", 30, "How often the Rose spawns as scrap.");
			TicketLoaded = cfg.Bind<bool>("Scrap Item - Ticket", "Ticket is loaded", true, "Whether or not the Ticket is loaded.");
			TicketSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Ticket", "Ticket is a scrap item", true, "Whether or not the Ticket spawns as scrap.");
			TicketSpawnWeight = cfg.Bind<int>("Scrap Item - Ticket", "Ticket spawn weight", 40, "How often the Ticket spawns as scrap.");
			GoldenTicketLoaded = cfg.Bind<bool>("Scrap Item - Golden Ticket", "Golden Ticket is loaded", true, "Whether or not the Golden Ticket is loaded.");
			GoldenTicketSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Golden Ticket", "Golden Ticket is a scrap item", true, "Whether or not the Golden Ticket spawns as scrap.");
			GoldenTicketSpawnWeight = cfg.Bind<int>("Scrap Item - Golden Ticket", "Golden Ticket spawn weight", 10, "How often the Golden Ticket spawns as scrap.");
			CandyDispenserLoaded = cfg.Bind<bool>("Scrap Item - Candy Dispenser", "Candy Dispenser is loaded", true, "Whether or not the Candy Dispenser and its drops are 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.");
			CandyDispenserSpawnWeight = cfg.Bind<int>("Scrap Item - Candy Dispenser", "Candy Dispenser spawn weight", 30, "How often the Candy Dispenser spawns as scrap.");
			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.");
			GloomyCapsuleSpawnWeight = cfg.Bind<int>("Scrap Item - Gloomy Capsule", "Gloomy Capsule spawn weight", 25, "How often the Gloomy Capsule spawns as scrap.");
			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.");
			FrigidCapsuleSpawnWeight = cfg.Bind<int>("Scrap Item - Frigid Capsule", "Frigid Capsule spawn weight", 25, "How often the Frigid Capsule spawns as scrap.");
			SanguineCapsuleLoaded = cfg.Bind<bool>("Scrap Item - Sanguine Capsule", "Sanguine Capsule is loaded", true, "Whether or not the Sanguine Capsule is loaded.");
			SanguineCapsuleSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Sanguine Capsule", "Sanguine Capsule is a scrap item", true, "Whether or not the Sanguine Capsule spawns as scrap.");
			SanguineCapsuleSpawnWeight = cfg.Bind<int>("Scrap Item - Sanguine Capsule", "Sanguine Capsule spawn weight", 25, "How often the Sanguine Capsule spawns as scrap.");
			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.");
			BandagesLoaded = cfg.Bind<bool>("Store Item - Bandages", "Bandages are loaded", true, "Whether or not the Bandages are loaded.");
			BandagesIsStoreItem = cfg.Bind<bool>("Store Item - Bandages", "Bandages are a store item", true, "Whether or not the Bandages are a store item.");
			BandagesStorePrice = cfg.Bind<int>("Store Item - Bandages", "Bandages store price", 20, "The store price of the Bandages.");
			BandagesSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Bandages", "Bandages is a scrap item", true, "Whether or not the Bandages spawns as scrap.");
			BandagesSpawnWeight = cfg.Bind<int>("Scrap Item - Bandages", "Bandages spawn weight", 30, "How often the Bandages spawns as scrap.");
			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.");
			DefibrillatorLoaded = cfg.Bind<bool>("Store Item - Defibrillator", "Defibrillator is loaded", true, "Whether or not the Defibrillator is loaded.");
			DefibrillatorIsStoreItem = cfg.Bind<bool>("Store Item - Defibrillator", "Defibrillator is a store item", true, "Whether or not the Defibrillator is a store item.");
			DefibrillatorStorePrice = cfg.Bind<int>("Store Item - Defibrillator", "Defibrillator store price", 375, "The store price of the Defibrillator.");
			DefibrillatorSpawnsAsScrap = cfg.Bind<bool>("Store Item - Defibrillator", "Defibrillator is a scrap item", false, "Whether or not the Defibrillator spawns as scrap.");
			DefibrillatorSpawnWeight = cfg.Bind<int>("Store Item - Defibrillator", "Defibrillator spawn weight", 5, "How often the Defibrillator spawns as scrap.");
			DefibrillatorUsesLimited = cfg.Bind<bool>("Store Item - Defibrillator", "Defibrillators savedUses are limited", true, "Whether or not Defibrillators have limited savedUses.");
			DefibrillatorUseLimit = cfg.Bind<int>("Store Item - Defibrillator", "Defibrillators savedUses", 4, "The number of savedUses each Defibrillator has (Uses have a minimum of 1, savedUses are based on the amount of players the defib has successfully revived).");
			DefibrillatorRefillsOnLanding = cfg.Bind<bool>("Store Item - Defibrillator", "Defibrillator refills every moon landing", true, "Whether or not existing Defibrillators will refill upon landing on a moon");
			DefibrillatorPermaDeathRule = cfg.Bind<bool>("Store Item - Defibrillator", "Defibrillator follows perma-death rules", true, "Whether or not specific circumstances of death will prevent the defibrillator from reviving corpses. Ex - Corpses/Players decapitated by CoilHeads would be perma-dead");
			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)");
			EmergencyInjectorLoaded = cfg.Bind<bool>("Store Item - Emergency Injector", "Emergency Injector is loaded", true, "Whether or not the Emergency Injector is loaded.");
			EmergencyInjectorIsStoreItem = cfg.Bind<bool>("Store Item - Emergency Injector", "Emergency Injector is a store item", true, "Whether or not the Emergency Injector is a store item.");
			EmergencyInjectorStorePrice = cfg.Bind<int>("Store Item - Emergency Injector", "Emergency Injector store price", 45, "The store price of the Emergency Injector.");
			EmergencyInjectorSpawnsAsScrap = cfg.Bind<bool>("Store Item - Emergency Injector", "Emergency Injector is a scrap item", false, "Whether or not the Emergency Injector spawns as scrap.");
			EmergencyInjectorSpawnWeight = cfg.Bind<int>("Store Item - Emergency Injector", "Emergency Injector spawn weight", 10, "How often the Emergency Injector spawns as scrap.");
			ToolboxLoaded = cfg.Bind<bool>("Store Item - Toolbox", "Toolbox is loaded", true, "Whether or not the Toolbox is loaded.");
			ToolboxIsStoreItem = cfg.Bind<bool>("Store Item - Toolbox", "Toolbox is a store item", true, "Whether or not the Toolbox is a store item.");
			ToolboxStorePrice = cfg.Bind<int>("Store Item - Toolbox", "Toolbox store price", 115, "The store price of the Toolbox.");
			PocketWatchLoaded = cfg.Bind<bool>("General Items", "PocketWatch is loaded", true, "Whether or not the PocketWatch is loaded.");
			PocketWatchSpawnsAsScrap = cfg.Bind<bool>("General Items", "PocketWatch is a scrap item", true, "Whether or not the PocketWatch spawns as scrap.");
			PocketWatchSpawnWeight = cfg.Bind<int>("General Items", "PocketWatch spawn weight", 20, "How often the PocketWatch spawns as scrap.");
			CapsulesDisabledOnTheShip = cfg.Bind<bool>("General Mechanic Changes", "Capsules Disabled On The Ship", true, "Whether or not capsules are disabled on the ship when landed regardless of their individual mechanics (Capsules are disabled in orbit always).");
			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 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_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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))
				{
					float num = new Random().Next(2, 11);
					float num2 = new Random().Next(2, 11);
					float num3 = new Random().Next(2, 11);
					float num4 = 0.9f / num;
					float num5 = 0.9f / num2;
					float num6 = 0.9f / num3;
					setColor = new Color(num4, num5, num6, 1f);
					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: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: 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_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)previousPlayerHeldBy == (Object)null)
			{
				return;
			}
			previousPlayerHeldBy.activatingItem = false;
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			int num = -1;
			if (!cancel)
			{
				previousPlayerHeldBy.twoHanded = false;
				objectsHitByMeleeWeapon = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, meleeWeaponMask, (QueryTriggerInteraction)2);
				objectsHitByMeleeWeaponList = objectsHitByMeleeWeapon.OrderBy(delegate(RaycastHit x)
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					RaycastHit val4 = x;
					return ((RaycastHit)(ref val4)).distance;
				}).ToList();
				List<EnemyAI> list = new List<EnemyAI>();
				IHittable val2 = default(IHittable);
				RaycastHit val3 = default(RaycastHit);
				for (int i = 0; i < objectsHitByMeleeWeaponList.Count; i++)
				{
					RaycastHit val = objectsHitByMeleeWeaponList[i];
					if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8)
					{
						val = objectsHitByMeleeWeaponList[i];
						if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
						{
							val = objectsHitByMeleeWeaponList[i];
							if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2))
							{
								continue;
							}
							val = objectsHitByMeleeWeaponList[i];
							if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)
							{
								continue;
							}
							val = objectsHitByMeleeWeaponList[i];
							if (!(((RaycastHit)(ref val)).point == Vector3.zero))
							{
								Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position;
								val = objectsHitByMeleeWeaponList[i];
								if (Physics.Linecast(position, ((RaycastHit)(ref val)).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
								{
									continue;
								}
							}
							flag = true;
							Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
							try
							{
								val = objectsHitByMeleeWeaponList[i];
								EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<EnemyAICollisionDetect>();
								if ((Object)(object)component != (Object)null)
								{
									if ((Object)(object)component.mainScript == (Object)null || list.Contains(component.mainScript))
									{
										continue;
									}
									goto IL_0369;
								}
								val = objectsHitByMeleeWeaponList[i];
								if (!((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<PlayerControllerB>() != (Object)null))
								{
									goto IL_0369;
								}
								if (flag3)
								{
									continue;
								}
								flag3 = true;
								goto IL_0369;
								IL_0369:
								bool flag4 = val2.Hit(meleeWeaponHitForce, forward, previousPlayerHeldBy, true, 1);
								if (flag4 && (Object)(object)component != (Object)null)
								{
									list.Add(component.mainScript);
								}
								if (!flag2)
								{
									flag2 = flag4;
								}
							}
							catch (Exception arg)
							{
								MonoBehaviour.print((object)$"Error hitting object with Candy Dispenser {arg}, caused by playerInital: {previousPlayerHeldBy.playerClientId}");
							}
							continue;
						}
					}
					val = objectsHitByMeleeWeaponList[i];
					if (((RaycastHit)(ref val)).collider.isTrigger)
					{
						continue;
					}
					flag = true;
					val = objectsHitByMeleeWeaponList[i];
					string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag;
					for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++)
					{
						if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag)
						{
							num = j;
							dispenserAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[j].hitSurfaceSFX);
							break;
						}
					}
				}
				float num2 = new Random().Next(1, 25);
				if (num2 == 1f)
				{
					if (StartOfRound.Instance.inShipPhase || !StartOfRound.Instance.shipHasLanded || !TimeOfDay.Instance.currentLevel.planetHasTime)
					{
						MonoBehaviour.print((object)"US - Candy spawning disabled here, land at a moon with a time cycle!");
						return;
					}
					dispenserAudio.PlayOneShot(Dispense);
					SpawnScrapServerRpc();
				}
			}
			if (flag)
			{
				int num3 = RoundManager.PlayRandomClip(dispenserAudio, hitSFX, true, 1f, 0, 1000);
				Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
				if (num != -1)
				{
					dispenserAudio.PlayOneShot(hitSFX[num3]);
					WalkieTalkie.TransmitOneShotAudio(dispenserAudio, hitSFX[num3], 1f);
				}
				base.playerHeldBy.playerBodyAnimator.SetTrigger("shovelHit");
				HitMeleeWeaponServerRpc(num3);
			}
		}

		[ServerRpc]
		public void HitMeleeWeaponServerRpc(int sound)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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
			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(2363479380u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, sound);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2363479380u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				HitMeleeWeaponClientRpc(sound);
			}
		}

		[ClientRpc]
		public void HitMeleeWeaponClientRpc(int sound)
		{
			//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_0071: 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)
			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(823714643u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, sound);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 823714643u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					HitSurfaceWithMeleeWeapon(sound);
				}
			}
		}

		private void HitSurfaceWithMeleeWeapon(int sound)
		{
			if (!((NetworkBehaviour)this).IsOwner)
			{
				dispenserAudio.PlayOneShot(hitSFX[sound]);
			}
			WalkieTalkie.TransmitOneShotAudio(dispenserAudio, hitSFX[sound], 1f);
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnScrapServerRpc()
		{
			//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(2364265404u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2364265404u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SpawnCandy();
				}
			}
		}

		public void SpawnCandy()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			Item val = PullLollipopItem();
			GameObject val2 = Object.Instantiate<GameObject>(val.spawnPrefab, ((Component)base.playerHeldBy).transform.position + Vector3.up, Quaternion.identity);
			GrabbableObject component = val2.GetComponent<GrabbableObject>();
			component.fallTime = 0f;
			((NetworkBehaviour)component).NetworkObject.Spawn(false);
			component.SetScrapValue(5);
			if ((Object)(object)previousPlayerHeldBy != (Object)null && previousPlayerHeldBy.isInHangarShipRoom)
			{
				previousPlayerHeldBy.SetItemInElevator(true, true, val2.GetComponent<GrabbableObject>());
			}
		}

		public static Item PullLollipopItem()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			if ((Object)_candyItem == (Object)null)
			{
				_candyItem = StartOfRound.Instance.allItemsList.itemsList.First((Item i) => ((Object)i).name == "Lollipop_Item");
			}
			return _candyItem;
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_CandyDispenserScript()
		{
			//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
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3606619266u, new RpcReceiveHandler(__rpc_handler_3606619266));
			NetworkManager.__rpc_func_table.Add(809217553u, new RpcReceiveHandler(__rpc_handler_809217553));
			NetworkManager.__rpc_func_table.Add(2363479380u, new RpcReceiveHandler(__rpc_handler_2363479380));
			NetworkManager.__rpc_func_table.Add(823714643u, new RpcReceiveHandler(__rpc_handler_823714643));
			NetworkManager.__rpc_func_table.Add(2364265404u, new RpcReceiveHandler(__rpc_handler_2364265404));
		}

		private static void __rpc_handler_3606619266(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;
				((CandyDispenserScript)(object)target).SetColorServerRPC();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_809217553(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Color colorClientRPC = default(Color);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref colorClientRPC);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((CandyDispenserScript)(object)target).SetColorClientRPC(colorClientRPC);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2363479380(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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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
			{
				int sound = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref sound);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CandyDispenserScript)(object)target).HitMeleeWeaponServerRpc(sound);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_823714643(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int sound = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref sound);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((CandyDispenserScript)(object)target).HitMeleeWeaponClientRpc(sound);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2364265404(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;
				((CandyDispenserScript)(object)target).SpawnScrapServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "CandyDispenserScript";
		}
	}
	internal class CrowbarScript : GrabbableObject
	{
		private PlayerControllerB previousPlayerHeldBy;

		private DoorLock viewedDoorLock;

		private int hitsToOpen = new Random().Next(2, 3);

		private AudioSource crowbarAudio;

		private AudioClip swing;

		private AudioClip[] hitSFX;

		public int meleeWeaponHitForce = 1;

		private bool isHoldingButton;

		private bool reelingUp;

		private Coroutine reelingUpCoroutine;

		private RaycastHit[] objectsHitByMeleeWeapon;

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

		public int meleeWeaponMask = 1084754248;

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

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

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if ((Object)(object)base.playerHeldBy == (Object)null)
			{
				return;
			}
			isHoldingButton = buttonDown;
			if (!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)
			{
				crowbarAudio.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: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0561: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: 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_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)previousPlayerHeldBy == (Object)null)
			{
				return;
			}
			previousPlayerHeldBy.activatingItem = false;
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			int num = -1;
			if (!cancel)
			{
				previousPlayerHeldBy.twoHanded = false;
				objectsHitByMeleeWeapon = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, meleeWeaponMask, (QueryTriggerInteraction)2);
				objectsHitByMeleeWeaponList = objectsHitByMeleeWeapon.OrderBy(delegate(RaycastHit x)
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					RaycastHit val5 = x;
					return ((RaycastHit)(ref val5)).distance;
				}).ToList();
				List<EnemyAI> list = new List<EnemyAI>();
				IHittable val2 = default(IHittable);
				RaycastHit val3 = default(RaycastHit);
				for (int i = 0; i < objectsHitByMeleeWeaponList.Count; i++)
				{
					RaycastHit val = objectsHitByMeleeWeaponList[i];
					if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8)
					{
						val = objectsHitByMeleeWeaponList[i];
						if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
						{
							val = objectsHitByMeleeWeaponList[i];
							if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2))
							{
								continue;
							}
							val = objectsHitByMeleeWeaponList[i];
							if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)
							{
								continue;
							}
							val = objectsHitByMeleeWeaponList[i];
							if (!(((RaycastHit)(ref val)).point == Vector3.zero))
							{
								Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position;
								val = objectsHitByMeleeWeaponList[i];
								if (Physics.Linecast(position, ((RaycastHit)(ref val)).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
								{
									continue;
								}
							}
							flag = true;
							Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
							try
							{
								val = objectsHitByMeleeWeaponList[i];
								EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<EnemyAICollisionDetect>();
								if ((Object)(object)component != (Object)null)
								{
									if ((Object)(object)component.mainScript == (Object)null || list.Contains(component.mainScript))
									{
										continue;
									}
									goto IL_0369;
								}
								val = objectsHitByMeleeWeaponList[i];
								if (!((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<PlayerControllerB>() != (Object)null))
								{
									goto IL_0369;
								}
								if (flag3)
								{
									continue;
								}
								flag3 = true;
								goto IL_0369;
								IL_0369:
								bool flag4 = val2.Hit(meleeWeaponHitForce, forward, previousPlayerHeldBy, true, 1);
								if (flag4 && (Object)(object)component != (Object)null)
								{
									list.Add(component.mainScript);
								}
								if (!flag2)
								{
									flag2 = flag4;
								}
							}
							catch (Exception arg)
							{
								MonoBehaviour.print((object)$"Error hitting object with crowbar {arg}, caused by playerInital: {previousPlayerHeldBy.playerClientId}");
							}
							continue;
						}
					}
					val = objectsHitByMeleeWeaponList[i];
					if (((RaycastHit)(ref val)).collider.isTrigger)
					{
						continue;
					}
					flag = true;
					val = objectsHitByMeleeWeaponList[i];
					string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag;
					for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++)
					{
						if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag)
						{
							num = j;
							crowbarAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[j].hitSurfaceSFX);
							break;
						}
					}
				}
				RaycastHit val4 = default(RaycastHit);
				if (Physics.Raycast(new Ray(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward), ref val4, 3f, LayerMask.GetMask(new string[1] { "InteractableObject" })))
				{
					viewedDoorLock = ((Component)((RaycastHit)(ref val4)).transform).GetComponent<DoorLock>();
					if ((Object)(object)viewedDoorLock != (Object)null && viewedDoorLock.isLocked && hitsToOpen > 0)
					{
						hitsToOpen--;
					}
					else if ((Object)(object)viewedDoorLock != (Object)null && viewedDoorLock.isLocked && hitsToOpen == 0)
					{
						UnlockDoorServerRpc();
						OpenDoorServerRpc();
						hitsToOpen = new Random().Next(2, 3);
					}
					if ((Object)(object)viewedDoorLock != (Object)null && !viewedDoorLock.isLocked)
					{
						OpenDoorServerRpc();
					}
				}
			}
			if (flag)
			{
				int num2 = RoundManager.PlayRandomClip(crowbarAudio, hitSFX, true, 1f, 0, 1000);
				Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
				if (num != -1)
				{
					crowbarAudio.PlayOneShot(hitSFX[num2]);
					WalkieTalkie.TransmitOneShotAudio(crowbarAudio, hitSFX[num2], 1f);
				}
				base.playerHeldBy.playerBodyAnimator.SetTrigger("shovelHit");
				HitMeleeWeaponServerRpc(num2);
			}
		}

		[ServerRpc]
		public void HitMeleeWeaponServerRpc(int sound)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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
			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(18646315u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, sound);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 18646315u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				HitMeleeWeaponClientRpc(sound);
			}
		}

		[ClientRpc]
		public void HitMeleeWeaponClientRpc(int sound)
		{
			//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_0071: 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)
			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(292927352u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, sound);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 292927352u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					HitSurfaceWithMeleeWeapon(sound);
				}
			}
		}

		private void HitSurfaceWithMeleeWeapon(int sound)
		{
			if (!((NetworkBehaviour)this).IsOwner && sound != -1)
			{
				crowbarAudio.PlayOneShot(hitSFX[sound]);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void OpenDoorServerRpc()
		{
			//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(121767703u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 121767703u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					OpenDoorClientRpc();
				}
			}
		}

		[ClientRpc]
		public void OpenDoorClientRpc()
		{
			//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(4047106965u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4047106965u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					viewedDoorLock.OpenOrCloseDoor(base.playerHeldBy);
					viewedDoorLock.SetDoorAsOpen(true);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void UnlockDoorServerRpc()
		{
			//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(1016317823u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1016317823u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					UnlockDoorClientRpc();
				}
			}
		}

		[ClientRpc]
		public void UnlockDoorClientRpc()
		{
			//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(3693078860u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3693078860u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					viewedDoorLock.UnlockDoor();
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_CrowbarScript()
		{
			//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
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(18646315u, new RpcReceiveHandler(__rpc_handler_18646315));
			NetworkManager.__rpc_func_table.Add(292927352u, new RpcReceiveHandler(__rpc_handler_292927352));
			NetworkManager.__rpc_func_table.Add(121767703u, new RpcReceiveHandler(__rpc_handler_121767703));
			NetworkManager.__rpc_func_table.Add(4047106965u, new RpcReceiveHandler(__rpc_handler_4047106965));
			NetworkManager.__rpc_func_table.Add(1016317823u, new RpcReceiveHandler(__rpc_handler_1016317823));
			NetworkManager.__rpc_func_table.Add(3693078860u, new RpcReceiveHandler(__rpc_handler_3693078860));
		}

		private static void __rpc_handler_18646315(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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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
			{
				int sound = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref sound);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CrowbarScript)(object)target).HitMeleeWeaponServerRpc(sound);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_292927352(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int sound = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref sound);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((CrowbarScript)(object)target).HitMeleeWeaponClientRpc(sound);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_121767703(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;
				((CrowbarScript)(object)target).OpenDoorServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4047106965(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;
				((CrowbarScript)(object)target).OpenDoorClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1016317823(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;
				((CrowbarScript)(object)target).UnlockDoorServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3693078860(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;
				((CrowbarScript)(object)target).UnlockDoorClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "CrowbarScript";
		}
	}
	internal class DefibrillatorScript : GrabbableObject
	{
		private Coroutine coroutine;

		private bool ReadyingDefib = false;

		private Renderer[] displayRenderers;

		private GameObject ChargeDisplayOne;

		private GameObject ChargeDisplayTwo;

		private GameObject ChargeDisplayThree;

		private GameObject ChargeDisplayFour;

		private GameObject ChargeDisplayFive;

		private Renderer DisplayOneRenderer;

		private Renderer DisplayTwoRenderer;

		private Renderer DisplayThreeRenderer;

		private Renderer DisplayFourRenderer;

		private Renderer DisplayFiveRenderer;

		private AudioSource ChargedAudio;

		private AudioSource ShockAudio;

		private int timeToHold;

		private float batteryCost;

		private bool UsesLimited;

		private bool PermaDeathRule;

		private bool DefibrillatorRefillsOnLanding;

		private int useLimit;

		internal static UsualScrapConfigs BoundConfig { get; private set; }

		public void Awake()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			BoundConfig = Plugin.BoundConfig;
			base.insertedBattery = new Battery(false, 1f);
			batteryCost = base.insertedBattery.charge / 2f;
			AudioSource[] components = ((Component)((Component)this).transform.Find("DefibrillatorSounds")).gameObject.GetComponents<AudioSource>();
			ChargedAudio = components[0];
			ShockAudio = components[1];
			ChargeDisplayOne = ((Component)((Component)((Component)this).transform.Find("DefibrillatorModel")).gameObject.transform.Find("ChargeDisplayOne")).gameObject;
			ChargeDisplayTwo = ((Component)((Component)((Component)this).transform.Find("DefibrillatorModel")).gameObject.transform.Find("ChargeDisplayTwo")).gameObject;
			ChargeDisplayThree = ((Component)((Component)((Component)this).transform.Find("DefibrillatorModel")).gameObject.trans