Decompiled source of StupidCollectionOfRandomArticlesForPlayers v1.3.2

Zeldahu.ZeldaScraps.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using ZeldaScraps.Configuration;
using Zeldahu.ZeldaScraps.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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: AssemblyCompany("Zeldahu.ZeldaScraps")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+53ffdf325b7a67de616af9629f3472e465ac0133")]
[assembly: AssemblyProduct("ZeldaScraps")]
[assembly: AssemblyTitle("Zeldahu.ZeldaScraps")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ZeldaScraps
{
	internal class ChristmasBauble : GrabbableObject
	{
		[CompilerGenerated]
		private sealed class <BreakBaubleCoroutine>d__22 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ChristmasBauble <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <BreakBaubleCoroutine>d__22(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_012d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0137: Expected O, but got Unknown
				//IL_0107: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.breakingAudioSource.Play();
					((Component)<>4__this.breakingParticles).GetComponent<Renderer>().materials[0].color = Color.HSVToRGB(<>4__this.targetHSV, <>4__this.materialColorSaturation, <>4__this.material2ColorValue);
					<>4__this.breakingParticles.Play();
					((Component)((GrabbableObject)<>4__this).mainObjectRenderer).gameObject.SetActive(false);
					((Component)((Component)<>4__this).GetComponentInChildren<ScanNodeProperties>()).gameObject.SetActive(false);
					((Collider)((Component)<>4__this).GetComponent<BoxCollider>()).enabled = false;
					if (<>4__this.isRare)
					{
						<>4__this.rareLight.SetActive(false);
						<>4__this.rareParticles.SetActive(false);
						Landmine.SpawnExplosion(((Component)<>4__this).transform.position, true, 0f, 1f, 20, 20f, (GameObject)null, false);
					}
					<>2__current = (object)new WaitForSeconds(15f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (((NetworkBehaviour)<>4__this).IsServer)
					{
						((Component)<>4__this).GetComponent<NetworkObject>().Despawn(true);
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private float targetHSV = 0f;

		private float targetHSV2 = 0f;

		public bool isFancy = false;

		public float materialColorSaturation = 0.9f;

		public float materialColorValue = 0.7f;

		public float material2ColorSaturation = 0.9f;

		public float material2ColorValue = 0.7f;

		private bool isRare = false;

		public GameObject rareParticles = null;

		public GameObject rareLight = null;

		public float chanceOfBreaking = 20f;

		public AudioSource breakingAudioSource = null;

		public ParticleSystem breakingParticles = null;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			if (((NetworkBehaviour)this).IsServer)
			{
				targetHSV = Random.Range(0f, 1f);
				targetHSV2 = Random.Range(0f, 1f);
				ChangeColorClientRpc(targetHSV, targetHSV2);
				if (Random.RandomRangeInt(1, 101) <= Plugin.BoundConfig.RareBaubleChance.Value)
				{
					BecomeRareClientRpc();
				}
			}
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			rareLight.SetActive(false);
			rareParticles.SetActive(false);
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			rareLight.SetActive(isRare);
			rareParticles.SetActive(isRare);
		}

		public override void OnHitGround()
		{
			((GrabbableObject)this).OnHitGround();
			if ((float)Random.Range(0, 100) < chanceOfBreaking && ((NetworkBehaviour)this).IsServer)
			{
				BreakBaubleClientRpc();
			}
		}

		public override int GetItemDataToSave()
		{
			return isRare ? 1 : 0;
		}

		public override void LoadItemSaveData(int saveData)
		{
			isRare = saveData == 1;
		}

		[ClientRpc]
		public void ChangeColorClientRpc(float HSV, float HSV2)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2022893355u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref HSV, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref HSV2, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2022893355u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				((Renderer)base.mainObjectRenderer).materials[0].color = Color.HSVToRGB(HSV, materialColorSaturation, materialColorValue);
				if (isFancy)
				{
					((Renderer)base.mainObjectRenderer).materials[2].color = Color.HSVToRGB(HSV2, material2ColorSaturation, material2ColorValue);
				}
			}
		}

		[ClientRpc]
		public void BecomeRareClientRpc()
		{
			//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_00c1: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3791962986u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3791962986u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					isRare = true;
					((GrabbableObject)this).SetScrapValue(base.scrapValue * 4);
					rareLight.SetActive(true);
					rareParticles.SetActive(true);
				}
			}
		}

		[ClientRpc]
		public void BreakBaubleClientRpc()
		{
			//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_00c1: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2702732910u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2702732910u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					((MonoBehaviour)this).StartCoroutine(BreakBaubleCoroutine());
				}
			}
		}

		[IteratorStateMachine(typeof(<BreakBaubleCoroutine>d__22))]
		private IEnumerator BreakBaubleCoroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <BreakBaubleCoroutine>d__22(0)
			{
				<>4__this = this
			};
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2022893355u, new RpcReceiveHandler(__rpc_handler_2022893355), "ChangeColorClientRpc");
			((NetworkBehaviour)this).__registerRpc(3791962986u, new RpcReceiveHandler(__rpc_handler_3791962986), "BecomeRareClientRpc");
			((NetworkBehaviour)this).__registerRpc(2702732910u, new RpcReceiveHandler(__rpc_handler_2702732910), "BreakBaubleClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_2022893355(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float hSV = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref hSV, default(ForPrimitives));
				float hSV2 = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref hSV2, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ChristmasBauble)(object)target).ChangeColorClientRpc(hSV, hSV2);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3791962986(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;
				((ChristmasBauble)(object)target).BecomeRareClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2702732910(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;
				((ChristmasBauble)(object)target).BreakBaubleClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "ChristmasBauble";
		}
	}
	internal class DancingCactus : GrabbableObject
	{
		[CompilerGenerated]
		private sealed class <MakeNoiseCoroutine>d__8 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public int noiseID;

			public DancingCactus <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <MakeNoiseCoroutine>d__8(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.isMakingNoise = true;
					if (Plugin.BoundConfig.DancingCactusMode.Value != "Feliz Navidad")
					{
						<>4__this.songSource.clip = <>4__this.alternateClips[noiseID];
					}
					<>4__this.songSource.Play();
					<>4__this.animator.Play("Dance");
					RoundManager.Instance.PlayAudibleNoise(((Component)<>4__this).transform.position, 15f, 0.5f, 0, ((GrabbableObject)<>4__this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
					<>2__current = (object)new WaitForSeconds(13f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.isMakingNoise = false;
					<>4__this.animator.Play("Nothing");
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private bool isMakingNoise = false;

		private float timeTillNextNoise = 0f;

		public AudioSource songSource = null;

		public Animator animator = null;

		public List<AudioClip> alternateClips = new List<AudioClip>();

		private int noiseID = 0;

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			if (timeTillNextNoise <= 0f)
			{
				if (Random.RandomRangeInt(1, 101) <= 10)
				{
					timeTillNextNoise = Random.Range(13f, 15f);
				}
				else
				{
					timeTillNextNoise = Random.Range(23f, 43f);
				}
				switch (Plugin.BoundConfig.DancingCactusMode.Value)
				{
				case "Copyright Free":
					noiseID = 0;
					if (Random.Range(0, 4) == 0)
					{
						noiseID = 1;
						if (Random.Range(0, 10) == 0)
						{
							noiseID = 2;
						}
					}
					break;
				case "Happy Birthday (French)":
					noiseID = Random.RandomRangeInt(3, 6);
					break;
				}
				Debug.Log((object)("noise ID : " + noiseID));
				MakeNoiseClientRpc(noiseID);
			}
			timeTillNextNoise -= Time.deltaTime;
		}

		[ClientRpc]
		public void MakeNoiseClientRpc(int noiseID)
		{
			//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)
			//IL_00ce: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2924079186u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, noiseID);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2924079186u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					((MonoBehaviour)this).StartCoroutine(MakeNoiseCoroutine(noiseID));
				}
			}
		}

		[IteratorStateMachine(typeof(<MakeNoiseCoroutine>d__8))]
		private IEnumerator MakeNoiseCoroutine(int noiseID)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <MakeNoiseCoroutine>d__8(0)
			{
				<>4__this = this,
				noiseID = noiseID
			};
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2924079186u, new RpcReceiveHandler(__rpc_handler_2924079186), "MakeNoiseClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_2924079186(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 num = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref num);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DancingCactus)(object)target).MakeNoiseClientRpc(num);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "DancingCactus";
		}
	}
	internal class FrogPlushie : GrabbableObject
	{
		[CompilerGenerated]
		private sealed class <LightAnimationCoroutine>d__7 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public FrogPlushie <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LightAnimationCoroutine>d__7(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.lightIntensityTarget = 100f;
					<>4__this.squeezeSound.Play();
					<>2__current = (object)new WaitForSeconds(12f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.lightIntensityTarget = 0f;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public Light starLight = null;

		public AudioSource squeezeSound = null;

		private float lightIntensityTarget = 0f;

		public override void Update()
		{
			((GrabbableObject)this).Update();
			starLight.intensity = Mathf.Lerp(starLight.intensity, lightIntensityTarget, 0.005f);
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			StartEmittingLightServerRpc();
		}

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

		[ClientRpc]
		public void StartEmittingLightClientRpc()
		{
			//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_00c1: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(80108231u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 80108231u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					((MonoBehaviour)this).StartCoroutine(LightAnimationCoroutine());
				}
			}
		}

		[IteratorStateMachine(typeof(<LightAnimationCoroutine>d__7))]
		private IEnumerator LightAnimationCoroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LightAnimationCoroutine>d__7(0)
			{
				<>4__this = this
			};
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(99540821u, new RpcReceiveHandler(__rpc_handler_99540821), "StartEmittingLightServerRpc");
			((NetworkBehaviour)this).__registerRpc(80108231u, new RpcReceiveHandler(__rpc_handler_80108231), "StartEmittingLightClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_99540821(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;
				((FrogPlushie)(object)target).StartEmittingLightServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_80108231(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;
				((FrogPlushie)(object)target).StartEmittingLightClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "FrogPlushie";
		}
	}
	internal class GrosMichel : GrabbableObject
	{
		public AudioSource valueUpSource = null;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			GrosMichelUsedServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		public void GrosMichelUsedServerRpc()
		{
			//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_00c1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(355146952u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 355146952u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (Random.RandomRangeInt(0, 6) == 0)
				{
					BreakGrosMichelClientRpc();
				}
				else
				{
					IncreaseValueGrosMichelClientRpc();
				}
			}
		}

		[ClientRpc]
		public void BreakGrosMichelClientRpc()
		{
			//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_00c1: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2894166886u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2894166886u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					Debug.LogError((object)"GROS MICHEL CHEL CHEL");
				}
			}
		}

		[ClientRpc]
		public void IncreaseValueGrosMichelClientRpc()
		{
			//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_00c1: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2259812051u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2259812051u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					valueUpSource.Play();
					AudioSource obj = valueUpSource;
					obj.pitch += 0.05f;
					((GrabbableObject)this).SetScrapValue(base.scrapValue += 15);
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(355146952u, new RpcReceiveHandler(__rpc_handler_355146952), "GrosMichelUsedServerRpc");
			((NetworkBehaviour)this).__registerRpc(2894166886u, new RpcReceiveHandler(__rpc_handler_2894166886), "BreakGrosMichelClientRpc");
			((NetworkBehaviour)this).__registerRpc(2259812051u, new RpcReceiveHandler(__rpc_handler_2259812051), "IncreaseValueGrosMichelClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_355146952(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;
				((GrosMichel)(object)target).GrosMichelUsedServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2894166886(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;
				((GrosMichel)(object)target).BreakGrosMichelClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2259812051(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;
				((GrosMichel)(object)target).IncreaseValueGrosMichelClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "GrosMichel";
		}
	}
	internal class NamedPresent : GrabbableObject
	{
		[CompilerGenerated]
		private sealed class <ForceDropPresentCoroutine>d__19 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public NamedPresent <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ForceDropPresentCoroutine>d__19(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Expected O, but got Unknown
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (GameNetworkManager.Instance.localPlayerController.isGrabbingObjectAnimation)
				{
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 1;
					return true;
				}
				GameNetworkManager.Instance.localPlayerController.DiscardHeldObject(true, (NetworkObject)null, ((Component)((GrabbableObject)<>4__this).playerHeldBy).transform.position + new Vector3(0f, 0.4f, 0f), true);
				HUDManager.Instance.DisplayTip("Thief!", "This present is not for you! Only " + <>4__this.chosenPlayer.playerUsername + " may take it", false, false, "LC_Tip1");
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <SyncItem>d__20 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public NetworkObjectReference reference;

			public int intValue;

			public bool isLast;

			public NamedPresent <>4__this;

			private NetworkObject <itemNetObject>5__1;

			private float <startTime>5__2;

			private GrabbableObject <component>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <SyncItem>d__20(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<itemNetObject>5__1 = null;
				<component>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Expected O, but got Unknown
				//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Expected O, but got Unknown
				//IL_0153: Unknown result type (might be due to invalid IL or missing references)
				//IL_015d: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					((GrabbableObject)<>4__this).EnableItemMeshes(false);
					<itemNetObject>5__1 = null;
					<startTime>5__2 = Time.realtimeSinceStartup;
					goto IL_007a;
				case 1:
					<>1__state = -1;
					goto IL_007a;
				case 2:
					<>1__state = -1;
					<component>5__3 = ((Component)<itemNetObject>5__1).GetComponent<GrabbableObject>();
					<component>5__3.fallTime = 0f;
					if (<component>5__3.itemProperties.isScrap)
					{
						<component>5__3.SetScrapValue(intValue);
					}
					if (!isLast || !((NetworkBehaviour)<>4__this).IsOwner)
					{
						break;
					}
					if (((NetworkBehaviour)<>4__this).IsServer)
					{
						<>2__current = (object)new WaitForSeconds(0.5f);
						<>1__state = 3;
						return true;
					}
					goto IL_016e;
				case 3:
					{
						<>1__state = -1;
						goto IL_016e;
					}
					IL_016e:
					((GrabbableObject)<>4__this).playerHeldBy.DestroyItemInSlotAndSync(((GrabbableObject)<>4__this).playerHeldBy.currentItemSlot);
					break;
					IL_007a:
					if (Time.realtimeSinceStartup - <startTime>5__2 < 8f && !((NetworkObjectReference)(ref reference)).TryGet(ref <itemNetObject>5__1, (NetworkManager)null))
					{
						<>2__current = (object)new WaitForSeconds(0.03f);
						<>1__state = 1;
						return true;
					}
					if ((Object)(object)<itemNetObject>5__1 == (Object)null)
					{
						return false;
					}
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 2;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public GameObject lingeringEffectObject = null;

		private PlayerControllerB chosenPlayer = null;

		private List<Item> itemsInPresent = new List<Item>();

		private bool hasUsedPresent = false;

		private NamedPresentHandler.AssignedMaterial currentAssignedMaterial = null;

		private float boxColorHue = 0f;

		private float boxKnothue = 0f;

		private PlayerControllerB previousPlayerHeldBy = null;

		private NamedPresentHandler presentHandler = null;

		private bool selectRandomPlayer = false;

		private List<PlayerControllerB> overrideValidPlayers = new List<PlayerControllerB>();

		public override void Start()
		{
			((GrabbableObject)this).Start();
			if (((NetworkBehaviour)this).IsServer)
			{
				List<int> list = new List<int>(RoundManager.Instance.currentLevel.spawnableScrap.Count);
				for (int i = 0; i < RoundManager.Instance.currentLevel.spawnableScrap.Count; i++)
				{
					if (RoundManager.Instance.currentLevel.spawnableScrap[i].spawnableItem.itemId == 152767 || RoundManager.Instance.currentLevel.spawnableScrap[i].spawnableItem.itemName == "Named Present")
					{
						list.Add(0);
					}
					else
					{
						list.Add(RoundManager.Instance.currentLevel.spawnableScrap[i].rarity);
					}
				}
				for (int j = 0; j < Plugin.BoundConfig.ItemAmountInNamedPresent.Value; j++)
				{
					Random random = new Random(Random.RandomRangeInt(1, 1000000));
					int randomWeightedIndexList = RoundManager.Instance.GetRandomWeightedIndexList(list, random);
					itemsInPresent.Add(RoundManager.Instance.currentLevel.spawnableScrap[randomWeightedIndexList].spawnableItem);
				}
				selectRandomPlayer = Plugin.BoundConfig.PresentRecieversOverride.Value == "";
				if (!selectRandomPlayer)
				{
					List<string> list2 = Plugin.BoundConfig.PresentRecieversOverride.Value.Split(',').ToList();
					PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
					foreach (PlayerControllerB val in allPlayerScripts)
					{
						if (list2.Contains(val.playerUsername))
						{
							overrideValidPlayers.Add(val);
						}
					}
					foreach (string item in list2)
					{
						Debug.Log((object)item);
					}
				}
			}
			SyncChosenPlayerServerRpc();
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			if (!Plugin.BoundConfig.CanAllPlayersGrabPresents.Value && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)chosenPlayer && ((NetworkBehaviour)this).IsOwner)
			{
				((MonoBehaviour)this).StartCoroutine(ForceDropPresentCoroutine());
			}
			previousPlayerHeldBy = base.playerHeldBy;
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)chosenPlayer)
			{
				HUDManager.Instance.DisplayTip("Thief!", "This present is not for you! Only " + chosenPlayer.playerUsername + " may open it", false, false, "LC_Tip1");
			}
			else if (!((Object)(object)base.playerHeldBy == (Object)null) && !hasUsedPresent)
			{
				hasUsedPresent = true;
				base.playerHeldBy.activatingItem = true;
				OpenPresentServerRpc();
			}
		}

		public override void SetControlTipsForItem()
		{
			if (((NetworkBehaviour)this).IsOwner)
			{
				HUDManager.Instance.ChangeControlTipMultiple(new string[1] { ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)chosenPlayer) ? "Open Present: [LMB]" : ("This present is for " + chosenPlayer.playerUsername) }, true, base.itemProperties);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SyncChosenPlayerServerRpc()
		{
			//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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1226110669u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1226110669u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if ((Object)(object)chosenPlayer == (Object)null)
			{
				if (selectRandomPlayer || overrideValidPlayers.Count == 0)
				{
					List<PlayerControllerB> list = new List<PlayerControllerB>();
					PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
					foreach (PlayerControllerB val3 in allPlayerScripts)
					{
						if (((NetworkBehaviour)val3).IsSpawned && val3.isPlayerControlled)
						{
							list.Add(val3);
						}
					}
					chosenPlayer = list[Random.RandomRangeInt(0, list.Count)];
				}
				else
				{
					chosenPlayer = overrideValidPlayers[Random.RandomRangeInt(0, overrideValidPlayers.Count)];
				}
			}
			currentAssignedMaterial = NamedPresentHandler.GetPlayerAssignedMaterial(chosenPlayer);
			if (currentAssignedMaterial == null)
			{
				currentAssignedMaterial = NamedPresentHandler.CreateNewAssignedMat(chosenPlayer);
			}
			SyncChosenPlayerClientRpc(new NetworkObjectReference(((Component)chosenPlayer).gameObject), currentAssignedMaterial.boxColorHue, currentAssignedMaterial.boxKnotHue);
		}

		[ClientRpc]
		public void SyncChosenPlayerClientRpc(NetworkObjectReference playerToSync, float boxColor, float boxKnotColor)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4288697832u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerToSync, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref boxColor, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref boxKnotColor, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4288697832u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					GameObject val3 = NetworkObjectReference.op_Implicit(playerToSync);
					chosenPlayer = val3.GetComponent<PlayerControllerB>();
					((Component)this).GetComponentInChildren<ScanNodeProperties>().subText = "For " + chosenPlayer.playerUsername;
					((Renderer)base.mainObjectRenderer).materials[0].color = Color.HSVToRGB(boxColor, 0.8f, 0.95f);
					((Renderer)base.mainObjectRenderer).materials[1].color = Color.HSVToRGB(boxKnotColor, 0.8f, 0.9f);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void OpenPresentServerRpc()
		{
			//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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1704050253u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1704050253u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				for (int i = 0; i < itemsInPresent.Count; i++)
				{
					Utilities.NetworkReference networkReference = Utilities.Spawn(itemsInPresent[i], ((Component)base.playerHeldBy).transform.position + new Vector3(Random.Range(-1f, 1f), 0.4f, Random.Range(-1f, 1f)));
					OpenPresentClientRpc(networkReference.netObjectRef, networkReference.value, i == itemsInPresent.Count - 1);
				}
			}
		}

		[ClientRpc]
		public void OpenPresentClientRpc(NetworkObjectReference reference, int intValue, bool isLast)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_007d: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2692686629u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref reference, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, intValue);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isLast, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2692686629u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					Object.Instantiate<GameObject>(lingeringEffectObject, ((Component)this).transform.position, Quaternion.identity);
					((MonoBehaviour)this).StartCoroutine(SyncItem(reference, intValue, isLast));
				}
			}
		}

		[IteratorStateMachine(typeof(<ForceDropPresentCoroutine>d__19))]
		private IEnumerator ForceDropPresentCoroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ForceDropPresentCoroutine>d__19(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<SyncItem>d__20))]
		public IEnumerator SyncItem(NetworkObjectReference reference, int intValue, bool isLast = false)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SyncItem>d__20(0)
			{
				<>4__this = this,
				reference = reference,
				intValue = intValue,
				isLast = isLast
			};
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1226110669u, new RpcReceiveHandler(__rpc_handler_1226110669), "SyncChosenPlayerServerRpc");
			((NetworkBehaviour)this).__registerRpc(4288697832u, new RpcReceiveHandler(__rpc_handler_4288697832), "SyncChosenPlayerClientRpc");
			((NetworkBehaviour)this).__registerRpc(1704050253u, new RpcReceiveHandler(__rpc_handler_1704050253), "OpenPresentServerRpc");
			((NetworkBehaviour)this).__registerRpc(2692686629u, new RpcReceiveHandler(__rpc_handler_2692686629), "OpenPresentClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_1226110669(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;
				((NamedPresent)(object)target).SyncChosenPlayerServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4288697832(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference playerToSync = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref playerToSync, default(ForNetworkSerializable));
				float boxColor = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref boxColor, default(ForPrimitives));
				float boxKnotColor = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref boxKnotColor, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NamedPresent)(object)target).SyncChosenPlayerClientRpc(playerToSync, boxColor, boxKnotColor);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1704050253(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;
				((NamedPresent)(object)target).OpenPresentServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2692686629(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference reference = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref reference, default(ForNetworkSerializable));
				int intValue = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref intValue);
				bool isLast = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isLast, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NamedPresent)(object)target).OpenPresentClientRpc(reference, intValue, isLast);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "NamedPresent";
		}
	}
	public class NamedPresentHandler
	{
		public class AssignedMaterial
		{
			public PlayerControllerB player;

			public float boxColorHue;

			public float boxKnotHue;

			public AssignedMaterial(PlayerControllerB player, float boxColorHue, float boxKnotHue)
			{
				this.player = player;
				this.boxColorHue = boxColorHue;
				this.boxKnotHue = boxKnotHue;
			}
		}

		public static List<AssignedMaterial> assignedMaterials = new List<AssignedMaterial>();

		public static AssignedMaterial CreateNewAssignedMat(PlayerControllerB player)
		{
			AssignedMaterial assignedMaterial = new AssignedMaterial(player, Random.Range(0f, 1f), Random.Range(0f, 1f));
			assignedMaterials.Add(assignedMaterial);
			return assignedMaterial;
		}

		public static AssignedMaterial GetPlayerAssignedMaterial(PlayerControllerB player)
		{
			foreach (AssignedMaterial assignedMaterial in assignedMaterials)
			{
				if ((Object)(object)assignedMaterial.player == (Object)(object)player)
				{
					return assignedMaterial;
				}
			}
			return null;
		}
	}
	internal class OpenPresentLingeringEffect : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <Despawn>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public OpenPresentLingeringEffect <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Despawn>d__3(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					Object.Destroy((Object)(object)((Component)<>4__this).gameObject);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public AudioSource audioSource = null;

		public ParticleSystem particleSystem = null;

		public void Start()
		{
			audioSource.Play();
			particleSystem.Play();
			((MonoBehaviour)this).StartCoroutine(Despawn());
		}

		[IteratorStateMachine(typeof(<Despawn>d__3))]
		private IEnumerator Despawn()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Despawn>d__3(0)
			{
				<>4__this = this
			};
		}
	}
	[BepInPlugin("Zeldahu.ZeldaScraps", "Stupid Collection of Random Articles for the Players", "1.3.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private const string PLUGIN_GUID = "Zeldahu.ZeldaScraps";

		private const string PLUGIN_NAME = "Stupid Collection of Random Articles for the Players";

		private const string PLUGIN_VERSION = "1.3.1";

		internal static ManualLogSource Logger;

		public static AssetBundle? ModAssets;

		private readonly Harmony harmony = new Harmony("Zeldahu.ZeldaScraps");

		internal static PluginConfig BoundConfig { get; private set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config);
			InitializeNetworkBehaviours();
			string path = "zeldascraps";
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path));
			if ((Object)(object)ModAssets == (Object)null)
			{
				Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			Item val = ModAssets.LoadAsset<Item>("MegaFlashlight");
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("MFITerminalNode");
			Items.RegisterShopItem(val, (TerminalNode)null, (TerminalNode)null, val2, BoundConfig.MegaFlashlightStorePrice.Value);
			Item val3 = ModAssets.LoadAsset<Item>("DancingCactus");
			NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
			Items.RegisterScrap(val3, BoundConfig.DancingCactusSpawnWeight.Value, (LevelTypes)(-1));
			Item val4 = ModAssets.LoadAsset<Item>("PlainBauble");
			NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
			Items.RegisterScrap(val4, BoundConfig.PlainBaubleSpawnWeight.Value, (LevelTypes)(-1));
			Item val5 = ModAssets.LoadAsset<Item>("FacetedBauble");
			NetworkPrefabs.RegisterNetworkPrefab(val5.spawnPrefab);
			Items.RegisterScrap(val5, BoundConfig.FacetedbaubleSpawnWeight.Value, (LevelTypes)(-1));
			Item val6 = ModAssets.LoadAsset<Item>("FancyBauble");
			NetworkPrefabs.RegisterNetworkPrefab(val6.spawnPrefab);
			Items.RegisterScrap(val6, BoundConfig.FancyBaubleSpawnWeight.Value, (LevelTypes)(-1));
			Item val7 = ModAssets.LoadAsset<Item>("SnowGlobe");
			NetworkPrefabs.RegisterNetworkPrefab(val7.spawnPrefab);
			Items.RegisterScrap(val7, BoundConfig.SnowGlobeSpawnWeight.Value, (LevelTypes)(-1));
			Item val8 = ModAssets.LoadAsset<Item>("NamedPresent");
			NetworkPrefabs.RegisterNetworkPrefab(val8.spawnPrefab);
			Items.RegisterScrap(val8, BoundConfig.NamedPresentSpawnWeight.Value, (LevelTypes)(-1));
			Item val9 = ModAssets.LoadAsset<Item>("FrogPlushie");
			NetworkPrefabs.RegisterNetworkPrefab(val9.spawnPrefab);
			Items.RegisterScrap(val9, BoundConfig.FrogPlushieSpawnWeight.Value, (LevelTypes)(-1));
			harmony.PatchAll();
			Logger.LogInfo((object)"Plugin Zeldahu.ZeldaScraps is loaded!");
		}

		private static void InitializeNetworkBehaviours()
		{
			IEnumerable<Type> enumerable;
			try
			{
				enumerable = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				enumerable = ex.Types.Where((Type t) => t != null);
			}
			foreach (Type item in enumerable)
			{
				MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array = methods;
				foreach (MethodInfo methodInfo in array)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	internal class SnowGlobe : GrabbableObject
	{
		public GameObject insideParticles = null;

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			insideParticles.SetActive(true);
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			insideParticles.SetActive(false);
		}

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

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

		protected internal override string __getTypeName()
		{
			return "SnowGlobe";
		}
	}
	internal class Utilities
	{
		public class NetworkReference
		{
			public NetworkObjectReference netObjectRef;

			public int value;

			public NetworkReference(NetworkObjectReference netObjectRef, int value)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				this.netObjectRef = netObjectRef;
				this.value = value;
			}
		}

		public static NetworkReference Spawn(Item scrap, Vector3 position)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			Transform val = (((Object)(object)RoundManager.Instance.spawnedScrapContainer == (Object)null) ? StartOfRound.Instance.elevatorTransform : RoundManager.Instance.spawnedScrapContainer);
			GameObject val2 = Object.Instantiate<GameObject>(scrap.spawnPrefab, position + Vector3.up * 0.25f, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer);
			GrabbableObject component = val2.GetComponent<GrabbableObject>();
			((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
			component.fallTime = 1f;
			component.hasHitGround = true;
			component.reachedFloorTarget = true;
			component.scrapValue = (int)((float)Random.Range(scrap.minValue, scrap.maxValue) * RoundManager.Instance.scrapValueMultiplier);
			((NetworkBehaviour)component).NetworkObject.Spawn(false);
			return new NetworkReference(NetworkObjectReference.op_Implicit(val2.GetComponent<NetworkObject>()), component.scrapValue);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Zeldahu.ZeldaScraps";

		public const string PLUGIN_NAME = "ZeldaScraps";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ZeldaScraps.Configuration
{
	public class PluginConfig
	{
		public ConfigEntry<int> MegaFlashlightStorePrice;

		public ConfigEntry<int> DancingCactusSpawnWeight;

		public ConfigEntry<int> PlainBaubleSpawnWeight;

		public ConfigEntry<int> FacetedbaubleSpawnWeight;

		public ConfigEntry<int> FancyBaubleSpawnWeight;

		public ConfigEntry<int> SnowGlobeSpawnWeight;

		public ConfigEntry<int> NamedPresentSpawnWeight;

		public ConfigEntry<int> FrogPlushieSpawnWeight;

		public ConfigEntry<int> RareBaubleChance;

		public ConfigEntry<string> DancingCactusMode;

		public ConfigEntry<int> ItemAmountInNamedPresent;

		public ConfigEntry<bool> CanAllPlayersGrabPresents;

		public ConfigEntry<string> PresentRecieversOverride;

		public PluginConfig(ConfigFile cfg)
		{
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Expected O, but got Unknown
			DancingCactusSpawnWeight = cfg.Bind<int>("Spawn Weights", "Dancing Cactus", 20, "The spawn weight for the dancing cactus, higher value means the item will spawn more often");
			PlainBaubleSpawnWeight = cfg.Bind<int>("Spawn Weights", "Plain Christmas Bauble", 20, "The spawn weight for the plain christmas bauble, higher value means the item will spawn more often");
			FacetedbaubleSpawnWeight = cfg.Bind<int>("Spawn Weights", "Faceted Christmas Bauble", 20, "The spawn weight for the faceted christmas bauble, higher value means the item will spawn more often");
			FancyBaubleSpawnWeight = cfg.Bind<int>("Spawn Weights", "Fancy Christmas Bauble", 20, "The spawn weight for the fancy christmas bauble, higher value means the item will spawn more often");
			SnowGlobeSpawnWeight = cfg.Bind<int>("Spawn Weights", "Snow Globe", 20, "The spawn weight for the snow globe, higher value means the item will spawn more often");
			NamedPresentSpawnWeight = cfg.Bind<int>("Spawn Weights", "Named Present", 20, "The spawn weight for the named present, higher value means the item will spawn more often");
			FrogPlushieSpawnWeight = cfg.Bind<int>("Spawn Weights", "Frog Plushie", 20, "The spawn weight for the frog plushie, higher value means the item will spawn more often");
			MegaFlashlightStorePrice = cfg.Bind<int>("Store Items", "10k lumen flashlight", 75, "The price of the 10k lumen flashlight in the store");
			RareBaubleChance = cfg.Bind<int>("Christmas Items", "Rare Bauble Chance", 15, new ConfigDescription("How likely it is for a bauble to spawn as 'rare', quadrupling its value", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			DancingCactusMode = cfg.Bind<string>("Christmas Items", "Dancing Cactus mode", "Feliz Navidad", new ConfigDescription("Choose which set of sounds the dancing cactus makes", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[3] { "Feliz Navidad", "Copyright Free", "Happy Birthday (French)" }), Array.Empty<object>()));
			ItemAmountInNamedPresent = cfg.Bind<int>("Christmas Items", "Amount of items in named presents", 3, "How many items are spawned when opening a named present");
			CanAllPlayersGrabPresents = cfg.Bind<bool>("Christmas Items", "All players can grab named presents", false, "If true, allows players to grab any named present, even if it's not theirs (they still won't be able to open it)");
			PresentRecieversOverride = cfg.Bind<string>("Christmas Items", "Set present recievers", "", "Forces all presents to be for whoever you enter here. Use the players' usernames, separated by ','");
			ClearUnusedEntries(cfg);
		}

		private void ClearUnusedEntries(ConfigFile cfg)
		{
			PropertyInfo property = ((object)cfg).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(cfg, null);
			dictionary.Clear();
			cfg.Save();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace Zeldahu.ZeldaScraps.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}