Decompiled source of StupidCollectionOfRandomArticlesForPlayers v1.4.0

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 FireworkCrate : GrabbableObject
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass9_0
		{
			public string type;

			internal bool <SyncItem>b__0((string, int) f)
			{
				return f.Item1 == type;
			}
		}

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

			private object <>2__current;

			public NetworkObjectReference reference;

			public int intValue;

			public string type;

			public bool isLast;

			public FireworkCrate <>4__this;

			private <>c__DisplayClass9_0 <>8__1;

			private NetworkObject <itemNetObject>5__2;

			private float <startTime>5__3;

			private GrabbableObject <component>5__4;

			private FireworkRocketItem <rocketItem>5__5;

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

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

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

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

			private bool MoveNext()
			{
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Expected O, but got Unknown
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e3: Expected O, but got Unknown
				//IL_01be: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c8: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass9_0();
					<>8__1.type = type;
					((GrabbableObject)<>4__this).EnableItemMeshes(false);
					<itemNetObject>5__2 = null;
					<startTime>5__3 = Time.realtimeSinceStartup;
					goto IL_0096;
				case 1:
					<>1__state = -1;
					goto IL_0096;
				case 2:
					<>1__state = -1;
					<component>5__4 = ((Component)<itemNetObject>5__2).GetComponent<GrabbableObject>();
					<component>5__4.fallTime = 0f;
					if (<component>5__4.itemProperties.isScrap)
					{
						<component>5__4.SetScrapValue(intValue);
					}
					<rocketItem>5__5 = ((Component)<itemNetObject>5__2).GetComponent<FireworkRocketItem>();
					<rocketItem>5__5.fireworkType = <>4__this.fireworkVisualsRef[<>4__this.fireworkTypeNamesWithWeights.FindIndex(((string, int) f) => f.Item1 == <>8__1.type)];
					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_01d9;
				case 3:
					{
						<>1__state = -1;
						goto IL_01d9;
					}
					IL_01d9:
					((GrabbableObject)<>4__this).playerHeldBy.DestroyItemInSlotAndSync(((GrabbableObject)<>4__this).playerHeldBy.currentItemSlot);
					break;
					IL_0096:
					if (Time.realtimeSinceStartup - <startTime>5__3 < 8f && !((NetworkObjectReference)(ref reference)).TryGet(ref <itemNetObject>5__2, (NetworkManager)null))
					{
						<>2__current = (object)new WaitForSeconds(0.03f);
						<>1__state = 1;
						return true;
					}
					if ((Object)(object)<itemNetObject>5__2 == (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 List<GameObject> fireworkVisualsRef;

		public List<(string, int)> fireworkTypeNamesWithWeights = new List<(string, int)> { ("Massive", 1000) };

		public List<string> fireworksInCrate = new List<string>();

		public bool hasBeenOpened = false;

		public Item fireworkItemRef = null;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			int num = 0;
			foreach (var fireworkTypeNamesWithWeight in fireworkTypeNamesWithWeights)
			{
				int item = fireworkTypeNamesWithWeight.Item2;
				num += item;
			}
			for (int i = 0; i < Plugin.BoundConfig.FireworksInCrate.Value; i++)
			{
				int num2 = Random.RandomRangeInt(0, num);
				foreach (var fireworkTypeNamesWithWeight2 in fireworkTypeNamesWithWeights)
				{
					string item2 = fireworkTypeNamesWithWeight2.Item1;
					int item3 = fireworkTypeNamesWithWeight2.Item2;
					num2 -= item3;
					if (num2 <= 0)
					{
						fireworksInCrate.Add(item2);
						break;
					}
				}
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!hasBeenOpened)
			{
				hasBeenOpened = true;
				base.playerHeldBy.activatingItem = true;
				OpenCrateServerRpc();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void OpenCrateServerRpc()
		{
			//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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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)
			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(2226962440u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2226962440u, 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 < fireworksInCrate.Count; i++)
				{
					Utilities.NetworkReference networkReference = Utilities.Spawn(fireworkItemRef, ((Component)base.playerHeldBy).transform.position + new Vector3(Random.Range(-1f, 1f), 0.4f, Random.Range(-1f, 1f)));
					SyncItemClientRpc(networkReference.netObjectRef, networkReference.value, fireworksInCrate[i], i == fireworksInCrate.Count - 1);
				}
			}
		}

		[ClientRpc]
		public void SyncItemClientRpc(NetworkObjectReference reference, int intValue, string type, 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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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(2332764054u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref reference, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, intValue);
				bool flag = type != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(type, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isLast, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2332764054u, 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(SyncItem(reference, intValue, type, isLast));
			}
		}

		[IteratorStateMachine(typeof(<SyncItem>d__9))]
		public IEnumerator SyncItem(NetworkObjectReference reference, int intValue, string type, 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__9(0)
			{
				<>4__this = this,
				reference = reference,
				intValue = intValue,
				type = type,
				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
			((NetworkBehaviour)this).__registerRpc(2226962440u, new RpcReceiveHandler(__rpc_handler_2226962440), "OpenCrateServerRpc");
			((NetworkBehaviour)this).__registerRpc(2332764054u, new RpcReceiveHandler(__rpc_handler_2332764054), "SyncItemClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_2226962440(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;
				((FireworkCrate)(object)target).OpenCrateServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2332764054(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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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 flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string type = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref type, false);
				}
				bool isLast = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isLast, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((FireworkCrate)(object)target).SyncItemClientRpc(reference, intValue, type, isLast);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "FireworkCrate";
		}
	}
	internal class FireworkDisplay : GrabbableObject
	{
		[CompilerGenerated]
		private sealed class <DisplayShowCoroutine>d__9 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public FireworkDisplay <>4__this;

			private int <i>5__1;

			private GameObject <firework>5__2;

			private int <i>5__3;

			private GameObject <firework>5__4;

			private int <i>5__5;

			private GameObject <firework>5__6;

			private GameObject <firework2>5__7;

			private GameObject <firework3>5__8;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<firework>5__2 = null;
				<firework>5__4 = null;
				<firework>5__6 = null;
				<firework2>5__7 = null;
				<firework3>5__8 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Expected O, but got Unknown
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f1: Expected O, but got Unknown
				//IL_015c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0170: Unknown result type (might be due to invalid IL or missing references)
				//IL_0175: Unknown result type (might be due to invalid IL or missing references)
				//IL_0189: Unknown result type (might be due to invalid IL or missing references)
				//IL_018e: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01be: Expected O, but got Unknown
				//IL_0229: Unknown result type (might be due to invalid IL or missing references)
				//IL_023d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0242: Unknown result type (might be due to invalid IL or missing references)
				//IL_0256: Unknown result type (might be due to invalid IL or missing references)
				//IL_025b: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0317: Unknown result type (might be due to invalid IL or missing references)
				//IL_032b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0330: Unknown result type (might be due to invalid IL or missing references)
				//IL_0344: Unknown result type (might be due to invalid IL or missing references)
				//IL_0349: Unknown result type (might be due to invalid IL or missing references)
				//IL_036f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0379: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(10f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<i>5__1 = 0;
					goto IL_0119;
				case 2:
					<>1__state = -1;
					<firework>5__2 = null;
					<i>5__1++;
					goto IL_0119;
				case 3:
					<>1__state = -1;
					<firework>5__4 = null;
					<i>5__3++;
					goto IL_01e6;
				case 4:
					{
						<>1__state = -1;
						<firework>5__6 = null;
						<firework2>5__7 = null;
						<firework3>5__8 = null;
						<i>5__5++;
						break;
					}
					IL_0119:
					if (<i>5__1 < 15)
					{
						<firework>5__2 = Object.Instantiate<GameObject>(<>4__this.fireworksInCrate[<i>5__1], ((Component)<>4__this).transform.position + new Vector3(0f, 0.5f, 0f), Quaternion.Euler(new Vector3(-90f, 0f, 0f)));
						<firework>5__2.GetComponent<FireworkRocketVisual>().LaunchRocket();
						<>2__current = (object)new WaitForSeconds(0.5f);
						<>1__state = 2;
						return true;
					}
					<i>5__3 = 0;
					goto IL_01e6;
					IL_01e6:
					if (<i>5__3 < 20)
					{
						<firework>5__4 = Object.Instantiate<GameObject>(<>4__this.fireworksInCrate[<i>5__3 + 15], ((Component)<>4__this).transform.position + new Vector3(0f, 0.5f, 0f), Quaternion.Euler(new Vector3(-90f, 0f, 0f)));
						<firework>5__4.GetComponent<FireworkRocketVisual>().LaunchRocket();
						<>2__current = (object)new WaitForSeconds(0.25f);
						<>1__state = 3;
						return true;
					}
					<i>5__5 = 0;
					break;
				}
				if (<i>5__5 < 7)
				{
					<firework>5__6 = Object.Instantiate<GameObject>(<>4__this.fireworksInCrate[<i>5__5 + 35], ((Component)<>4__this).transform.position + new Vector3(0f, 0.5f, 0f), Quaternion.Euler(new Vector3(-90f, 0f, 0f)));
					<firework>5__6.GetComponent<FireworkRocketVisual>().LaunchRocket();
					<firework2>5__7 = Object.Instantiate<GameObject>(<>4__this.fireworksInCrate[<i>5__5 + 41], ((Component)<>4__this).transform.position + new Vector3(0f, 0.5f, 0f), Quaternion.Euler(new Vector3(-90f, 0f, 0f)));
					<firework2>5__7.GetComponent<FireworkRocketVisual>().LaunchRocket();
					<firework3>5__8 = Object.Instantiate<GameObject>(<>4__this.fireworksInCrate[<i>5__5 + 48], ((Component)<>4__this).transform.position + new Vector3(0f, 0.5f, 0f), Quaternion.Euler(new Vector3(-90f, 0f, 0f)));
					<firework3>5__8.GetComponent<FireworkRocketVisual>().LaunchRocket();
					<>2__current = (object)new WaitForSeconds(0.25f);
					<>1__state = 4;
					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 List<GameObject> fireworkVisualsRef;

		public List<(string, int)> fireworkTypeNamesWithWeights = new List<(string, int)>
		{
			("Classic", 1),
			("Massive", 1000),
			("AirBomb", 1),
			("GoldenRibbons", 1),
			("Gerb", 1),
			("Screamer", 1),
			("LPC", 1)
		};

		public List<GameObject> fireworksInCrate = new List<GameObject>();

		public bool hasBeenActivated = false;

		public Item fireworkItemRef = null;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			int num = 0;
			foreach (var fireworkTypeNamesWithWeight in fireworkTypeNamesWithWeights)
			{
				int item = fireworkTypeNamesWithWeight.Item2;
				num += item;
			}
			for (int i = 0; i < 56; i++)
			{
				int num2 = Random.RandomRangeInt(0, num);
				foreach (var fireworkTypeNamesWithWeight2 in fireworkTypeNamesWithWeights)
				{
					string type = fireworkTypeNamesWithWeight2.Item1;
					int item2 = fireworkTypeNamesWithWeight2.Item2;
					num2 -= item2;
					if (num2 <= 0)
					{
						fireworksInCrate.Add(fireworkVisualsRef[fireworkTypeNamesWithWeights.FindIndex(((string, int) f) => f.Item1 == type)]);
						break;
					}
				}
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!hasBeenActivated)
			{
				hasBeenActivated = true;
				UseDisplayServerRpc();
			}
		}

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

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

		[IteratorStateMachine(typeof(<DisplayShowCoroutine>d__9))]
		private IEnumerator DisplayShowCoroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DisplayShowCoroutine>d__9(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(3741365143u, new RpcReceiveHandler(__rpc_handler_3741365143), "UseDisplayServerRpc");
			((NetworkBehaviour)this).__registerRpc(1829501817u, new RpcReceiveHandler(__rpc_handler_1829501817), "UseDisplayClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_3741365143(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;
				((FireworkDisplay)(object)target).UseDisplayServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1829501817(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;
				((FireworkDisplay)(object)target).UseDisplayClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "FireworkDisplay";
		}
	}
	internal class FireworkRocketItem : GrabbableObject
	{
		public GameObject fireworkType = null;

		private int chargesUsed = 0;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (StartOfRound.Instance.gameStats.daysSpent == 0 && StartOfRound.Instance.inShipPhase)
			{
				Debug.Log((object)"Game hasn't started yet! Can't use fireworks");
			}
			else
			{
				LaunchRocketServerRpc();
			}
		}

		public override void SetControlTipsForItem()
		{
			if (((NetworkBehaviour)this).IsOwner)
			{
				HUDManager.Instance.ChangeControlTipMultiple(new string[1] { "This firework has " + (Plugin.BoundConfig.ChargesPerFirework.Value - chargesUsed) + " uses left" }, true, base.itemProperties);
			}
		}

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

		[ClientRpc]
		public void LaunchRocketClientRpc()
		{
			//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_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: 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(816378916u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 816378916u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				Transform val3 = ((Component)base.playerHeldBy).transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/spine.004_end");
				if ((Object)(object)val3 != (Object)null)
				{
					GameObject val4 = Object.Instantiate<GameObject>(fireworkType, val3.position, val3.rotation);
					val4.GetComponent<FireworkRocketVisual>().LaunchRocket();
				}
			}
		}

		[ClientRpc]
		public void UpdateChargesClientRpc()
		{
			//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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3004192897u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3004192897u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				chargesUsed++;
				((GrabbableObject)this).SetControlTipsForItem();
				if (chargesUsed >= Plugin.BoundConfig.ChargesPerFirework.Value)
				{
					base.playerHeldBy.DestroyItemInSlotAndSync(base.playerHeldBy.currentItemSlot);
				}
			}
		}

		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(2618891377u, new RpcReceiveHandler(__rpc_handler_2618891377), "LaunchRocketServerRpc");
			((NetworkBehaviour)this).__registerRpc(816378916u, new RpcReceiveHandler(__rpc_handler_816378916), "LaunchRocketClientRpc");
			((NetworkBehaviour)this).__registerRpc(3004192897u, new RpcReceiveHandler(__rpc_handler_3004192897), "UpdateChargesClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_2618891377(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;
				((FireworkRocketItem)(object)target).LaunchRocketServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_816378916(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;
				((FireworkRocketItem)(object)target).LaunchRocketClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3004192897(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;
				((FireworkRocketItem)(object)target).UpdateChargesClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "FireworkRocketItem";
		}
	}
	internal class FireworkRocketVisual : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <FireworkExplosionTimer>d__36 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public FireworkRocketVisual <>4__this;

			private float <nonLethalDamageRange>5__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Expected O, but got Unknown
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0158: Unknown result type (might be due to invalid IL or missing references)
				//IL_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0194: Expected O, but got Unknown
				//IL_0102: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(<>4__this.selectedLifeTime);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.isFlying = false;
					((Component)<>4__this).GetComponent<Rigidbody>().velocity = Vector3.zero;
					<>4__this.audioSource.clip = <>4__this.explosionSound;
					<>4__this.audioSource.Play();
					<>4__this.explosionParticles.Play();
					<>4__this.smokeParticles.Stop();
					<>4__this.flashLightSource.intensity = <>4__this.flashIntensity;
					if (<>4__this.lightOnlyAppearsOnExplosion)
					{
						<>4__this.lingeringLightSource.color = <>4__this.gradientColor1;
						<>4__this.lingeringLightSource.intensity = <>4__this.flashIntensity;
					}
					<nonLethalDamageRange>5__1 = <>4__this.explosionRange + <>4__this.explosionRange * 0.5f;
					Landmine.SpawnExplosion(((Component)<>4__this).transform.position, false, <>4__this.explosionRange, <nonLethalDamageRange>5__1, 50, 10f, (GameObject)null, false);
					<>2__current = (object)new WaitForSeconds(<>4__this.despawnTime);
					<>1__state = 2;
					return true;
				case 2:
					<>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();
			}
		}

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

			private object <>2__current;

			public FireworkRocketVisual <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					<>4__this.currentOffset++;
					if (((Collider)<>4__this.colliderRef).isTrigger)
					{
						((Collider)<>4__this.colliderRef).isTrigger = false;
					}
					break;
				}
				if (<>4__this.isFlying)
				{
					<>4__this.targetOffsetX = <>4__this.offsetsList[<>4__this.currentOffset].x;
					<>4__this.targetOffsetY = <>4__this.offsetsList[<>4__this.currentOffset].y;
					((Component)<>4__this).transform.Rotate(new Vector3(<>4__this.selectedDragX, <>4__this.selectedDragY, 0f));
					<>2__current = (object)new WaitForSeconds(0.15f);
					<>1__state = 1;
					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 visibleFireworkRef = null;

		public ParticleSystem smokeParticles = null;

		public ParticleSystem explosionParticles = null;

		public static Random? random;

		private bool isFlyingRandomly = false;

		private bool isFlying = false;

		private float timeSinceLastRandomOffset = 0f;

		public BoxCollider colliderRef = null;

		public Vector2 lifeTime = Vector2.zero;

		private float selectedLifeTime = 0f;

		public Vector2 flightSpeed = Vector2.zero;

		private float selectedFlightSpeed = 0f;

		public Vector2 maxOffset = Vector2.zero;

		private float selectedMaxOffset = 0f;

		private List<Vector2> offsetsList = new List<Vector2>();

		private int currentOffset = 0;

		private float targetOffsetX = 0f;

		private float targetOffsetY = 0f;

		public float maxDrag = 0f;

		private float selectedDragX = 0f;

		private float selectedDragY = 0f;

		private Color gradientColor1 = Color.white;

		private Color gradientColor2 = Color.white;

		public AudioSource audioSource = null;

		public AudioClip launchSound = null;

		public AudioClip explosionSound = null;

		public Light flashLightSource = null;

		public bool lightOnlyAppearsOnExplosion = true;

		public float flashIntensity = 40000f;

		private float flashIntensityTarget = 0f;

		public Light lingeringLightSource = null;

		private float lingeringLightIntensityTarget = 0f;

		public float explosionRange = 0f;

		public float despawnTime = 15f;

		private Gradient gradient = new Gradient();

		public void LaunchRocket()
		{
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: 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)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			if (random == null)
			{
				random = new Random(StartOfRound.Instance.randomMapSeed);
			}
			selectedMaxOffset = Mathf.Lerp(maxOffset.x, maxOffset.y, (float)random.NextDouble());
			selectedLifeTime = Mathf.Lerp(lifeTime.x, lifeTime.y, (float)random.NextDouble());
			selectedFlightSpeed = Mathf.Lerp(flightSpeed.x, flightSpeed.y, (float)random.NextDouble());
			selectedDragX = Mathf.Lerp(0f - maxDrag, maxDrag, (float)random.NextDouble());
			selectedDragY = Mathf.Lerp(0f - maxDrag, maxDrag, (float)random.NextDouble());
			gradientColor1 = Color.HSVToRGB((float)random.NextDouble(), 1f, 1f);
			gradientColor2 = Color.HSVToRGB((float)random.NextDouble(), 1f, 1f);
			GradientColorKey[] array = (GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(gradientColor1, 0f),
				new GradientColorKey(gradientColor2, 0.8f)
			};
			GradientAlphaKey[] array2 = (GradientAlphaKey[])(object)new GradientAlphaKey[2]
			{
				new GradientAlphaKey(1f, 0.8f),
				new GradientAlphaKey(0f, 1f)
			};
			gradient.SetKeys(array, array2);
			ColorOverLifetimeModule colorOverLifetime = explosionParticles.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(gradient);
			int num = (int)MathF.Round(selectedLifeTime / 0.15f) + 1;
			for (int i = 0; i < num; i++)
			{
				offsetsList.Add(new Vector2(Mathf.Lerp(0f - selectedMaxOffset, selectedMaxOffset, (float)random.NextDouble()), Mathf.Lerp(0f - selectedMaxOffset, selectedMaxOffset, (float)random.NextDouble())));
			}
			isFlyingRandomly = true;
			isFlying = true;
			audioSource.clip = launchSound;
			audioSource.Play();
			((MonoBehaviour)this).StartCoroutine(FireworkExplosionTimer());
			((MonoBehaviour)this).StartCoroutine(FireworkVisualRandomOffset());
		}

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

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

		public void FixedUpdate()
		{
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_005b: 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)
			if (isFlying)
			{
				((Component)this).GetComponent<Rigidbody>().AddForce(((Component)this).transform.forward * selectedFlightSpeed, (ForceMode)2);
				visibleFireworkRef.transform.localPosition = Vector3.Lerp(visibleFireworkRef.transform.localPosition, new Vector3(targetOffsetX, targetOffsetY, 0f), 0.15f);
			}
			flashLightSource.intensity = Mathf.Lerp(flashLightSource.intensity, flashIntensityTarget, 0.1f);
			lingeringLightSource.intensity = Mathf.Lerp(lingeringLightSource.intensity, lingeringLightIntensityTarget, 0.025f);
			lingeringLightSource.color = Color.Lerp(gradientColor1, gradientColor2, 0.1f);
		}
	}
	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