Decompiled source of StupidCollectionOfRandomArticlesForPlayers v1.1.0

Zeldahu.ZeldaScraps.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 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__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			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__6(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

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

			private bool MoveNext()
			{
				//IL_0066: 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_00a7: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.isMakingNoise = true;
					<>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 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);
				}
				MakeNoiseClientRpc();
			}
			timeTillNextNoise -= Time.deltaTime;
		}

		[ClientRpc]
		public void MakeNoiseClientRpc()
		{
			//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(542160030u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 542160030u, 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());
				}
			}
		}

		[IteratorStateMachine(typeof(<MakeNoiseCoroutine>d__6))]
		private IEnumerator MakeNoiseCoroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <MakeNoiseCoroutine>d__6(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
			((NetworkBehaviour)this).__registerRpc(542160030u, new RpcReceiveHandler(__rpc_handler_542160030), "MakeNoiseClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_542160030(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;
				((DancingCactus)(object)target).MakeNoiseClientRpc();
				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 NamedPresent : GrabbableObject
	{
		[CompilerGenerated]
		private sealed class <ForceDropPresentCoroutine>d__12 : 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__12(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__13 : 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__13(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 PlayerControllerB previousPlayerHeldBy = null;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			SyncChosenPlayerServerRpc();
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			Random random = new Random(Mathf.RoundToInt(Time.timeSinceLevelLoad));
			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)
				{
					list.Add(0);
				}
				else
				{
					list.Add(RoundManager.Instance.currentLevel.spawnableScrap[i].rarity);
				}
			}
			for (int j = 0; j < Plugin.BoundConfig.ItemAmountInNamedPresent.Value; j++)
			{
				int randomWeightedIndexList = RoundManager.Instance.GetRandomWeightedIndexList(list, random);
				itemsInPresent.Add(RoundManager.Instance.currentLevel.spawnableScrap[randomWeightedIndexList].spawnableItem);
			}
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			if ((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)base.playerHeldBy == (Object)null) && !hasUsedPresent)
			{
				hasUsedPresent = true;
				base.playerHeldBy.activatingItem = true;
				OpenPresentServerRpc();
			}
		}

		[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_0148: 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)
			{
				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)];
			}
			SyncChosenPlayerClientRpc(new NetworkObjectReference(((Component)chosenPlayer).gameObject));
		}

		[ClientRpc]
		public void SyncChosenPlayerClientRpc(NetworkObjectReference playerToSync)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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(3747882847u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerToSync, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3747882847u, 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;
				}
			}
		}

		[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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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(0f, 0.4f, 0f));
					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__12))]
		private IEnumerator ForceDropPresentCoroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ForceDropPresentCoroutine>d__12(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<SyncItem>d__13))]
		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__13(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(3747882847u, new RpcReceiveHandler(__rpc_handler_3747882847), "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_3747882847(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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NamedPresent)(object)target).SyncChosenPlayerClientRpc(playerToSync);
				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";
		}
	}
	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.1.0")]
	[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.1.0";

		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, (string[])null);
			Item val8 = ModAssets.LoadAsset<Item>("NamedPresent");
			NetworkPrefabs.RegisterNetworkPrefab(val8.spawnPrefab);
			Items.RegisterScrap(val8, BoundConfig.NamedPresentSpawnWeight.Value, (LevelTypes)1, (string[])null);
			Item val9 = ModAssets.LoadAsset<Item>("FrogPlushie");
			NetworkPrefabs.RegisterNetworkPrefab(val9.spawnPrefab);
			Items.RegisterScrap(val9, 30, (LevelTypes)1, (string[])null);
			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<int> ItemAmountInNamedPresent;

		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
			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>()));
			ItemAmountInNamedPresent = cfg.Bind<int>("Christmas Items", "Amount of items in named presents", 3, "How many items are spawned when opening a named present");
			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
	{
	}
}