Decompiled source of StupidCollectionOfRandomArticlesForPlayers v1.5.2

Zeldahu.ZeldaScraps.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using ZeldaScraps.Configuration;
using Zeldahu.ZeldaScraps.NetcodePatcher;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: AssemblyCompany("Zeldahu.ZeldaScraps")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.5.2.0")]
[assembly: AssemblyInformationalVersion("1.5.2+53ffdf325b7a67de616af9629f3472e465ac0133")]
[assembly: AssemblyProduct("ZeldaScraps")]
[assembly: AssemblyTitle("Zeldahu.ZeldaScraps")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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 BlueprintItem : GrabbableObject
	{
		public LayerMask itemsToCollideWith = LayerMask.op_Implicit(0);

		public bool isBrainstorm = false;

		public Animator animator = null;

		public GameObject lingeringEffectObject = null;

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

		[ServerRpc(RequireOwnership = false)]
		public void DuplicateItemServerRpc()
		{
			//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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: 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 val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2803771076u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 2803771076u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			Camera gameplayCamera = base.playerHeldBy.gameplayCamera;
			RaycastHit val3 = default(RaycastHit);
			if (Physics.Raycast(((Component)gameplayCamera).transform.position, ((Component)gameplayCamera).transform.forward, ref val3, 5f, LayerMask.op_Implicit(itemsToCollideWith)))
			{
				GrabbableObject componentInChildren = ((Component)((RaycastHit)(ref val3)).collider).gameObject.GetComponentInChildren<GrabbableObject>();
				if ((Object)(object)componentInChildren != (Object)null && ((componentInChildren.itemProperties.isScrap && !isBrainstorm) || (!componentInChildren.itemProperties.isScrap && isBrainstorm)))
				{
					Utilities.NetworkReference networkReference = Utilities.Spawn(componentInChildren.itemProperties, ((Component)base.playerHeldBy).transform.position);
					SyncItemClientRpc(networkReference.netObjectRef, componentInChildren.scrapValue);
				}
			}
		}

		[ClientRpc]
		public void SyncItemClientRpc(NetworkObjectReference reference, int intValue)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00a4: 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_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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 val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4222638112u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref reference, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val, intValue);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 4222638112u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					Object.Instantiate<GameObject>(lingeringEffectObject, ((Component)base.playerHeldBy).transform.position, Quaternion.identity);
					((MonoBehaviour)this).StartCoroutine(SyncItem(reference, intValue));
				}
			}
		}

		public IEnumerator SyncItem(NetworkObjectReference reference, int intValue)
		{
			//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)
			animator.Play("ShakeCard");
			NetworkObject itemNetObject = null;
			float startTime = Time.realtimeSinceStartup;
			while (Time.realtimeSinceStartup - startTime < 8f && !((NetworkObjectReference)(ref reference)).TryGet(ref itemNetObject, (NetworkManager)null))
			{
				yield return (object)new WaitForSeconds(0.03f);
			}
			if ((Object)(object)itemNetObject == (Object)null)
			{
				yield break;
			}
			yield return (object)new WaitForEndOfFrame();
			GrabbableObject component = ((Component)itemNetObject).GetComponent<GrabbableObject>();
			component.fallTime = 0f;
			if (component.itemProperties.isScrap)
			{
				component.SetScrapValue(intValue);
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				if (((NetworkBehaviour)this).IsServer)
				{
					yield return (object)new WaitForSeconds(0.5f);
				}
				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
			((NetworkBehaviour)this).__registerRpc(2803771076u, new RpcReceiveHandler(__rpc_handler_2803771076), "DuplicateItemServerRpc");
			((NetworkBehaviour)this).__registerRpc(4222638112u, new RpcReceiveHandler(__rpc_handler_4222638112), "SyncItemClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_2803771076(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;
				((BlueprintItem)(object)target).DuplicateItemServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4222638112(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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BlueprintItem)(object)target).SyncItemClientRpc(reference, intValue);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "BlueprintItem";
		}
	}
	internal class ChristmasBauble : GrabbableObject
	{
		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 val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2022893355u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref HSV, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref HSV2, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2022893355u, val2, (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 val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3791962986u, val2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 3791962986u, val2, (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 val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2702732910u, val2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 2702732910u, val2, (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());
				}
			}
		}

		private IEnumerator BreakBaubleCoroutine()
		{
			breakingAudioSource.Play();
			((Component)breakingParticles).GetComponent<Renderer>().materials[0].color = Color.HSVToRGB(targetHSV, materialColorSaturation, material2ColorValue);
			breakingParticles.Play();
			((Component)base.mainObjectRenderer).gameObject.SetActive(false);
			((Component)((Component)this).GetComponentInChildren<ScanNodeProperties>()).gameObject.SetActive(false);
			((Collider)((Component)this).GetComponent<BoxCollider>()).enabled = false;
			if (isRare)
			{
				rareLight.SetActive(false);
				rareParticles.SetActive(false);
				Landmine.SpawnExplosion(((Component)this).transform.position, true, 0f, 1f, 20, 20f, (GameObject)null, false);
			}
			yield return (object)new WaitForSeconds(15f);
			if (((NetworkBehaviour)this).IsServer)
			{
				((Component)this).GetComponent<NetworkObject>().Despawn(true);
			}
		}

		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
	{
		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 val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2924079186u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, noiseID);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 2924079186u, val2, (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));
				}
			}
		}

		private IEnumerator MakeNoiseCoroutine(int noiseID)
		{
			isMakingNoise = true;
			if (Plugin.BoundConfig.DancingCactusMode.Value != "Feliz Navidad")
			{
				songSource.clip = alternateClips[noiseID];
			}
			songSource.Play();
			animator.Play("Dance");
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 15f, 0.5f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
			yield return (object)new WaitForSeconds(13f);
			isMakingNoise = false;
			animator.Play("Nothing");
		}

		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
	{
		public List<GameObject> fireworkVisualsRef;

		public List<(string, int)> fireworkTypeNamesWithWeights = new List<(string, int)>
		{
			("Massive", 10),
			("Air Bomb", 0)
		};

		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 val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2226962440u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 2226962440u, val2, (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 val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2332764054u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref reference, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val, intValue);
				bool flag = type != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(type, false);
				}
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isLast, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2332764054u, val2, (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));
			}
		}

		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)
			((GrabbableObject)this).EnableItemMeshes(false);
			NetworkObject itemNetObject = null;
			float startTime = Time.realtimeSinceStartup;
			while (Time.realtimeSinceStartup - startTime < 8f && !((NetworkObjectReference)(ref reference)).TryGet(ref itemNetObject, (NetworkManager)null))
			{
				yield return (object)new WaitForSeconds(0.03f);
			}
			if ((Object)(object)itemNetObject == (Object)null)
			{
				yield break;
			}
			yield return (object)new WaitForEndOfFrame();
			GrabbableObject component = ((Component)itemNetObject).GetComponent<GrabbableObject>();
			component.fallTime = 0f;
			if (component.itemProperties.isScrap)
			{
				component.SetScrapValue(intValue);
			}
			FireworkRocketItem rocketItem = ((Component)itemNetObject).GetComponent<FireworkRocketItem>();
			rocketItem.fireworkType = fireworkVisualsRef[fireworkTypeNamesWithWeights.FindIndex(((string, int) f) => f.Item1 == type)];
			if (isLast && ((NetworkBehaviour)this).IsOwner)
			{
				if (((NetworkBehaviour)this).IsServer)
				{
					yield return (object)new WaitForSeconds(0.5f);
				}
				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
			((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
	{
		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 val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3741365143u, val2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 3741365143u, val2, (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 val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1829501817u, val2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 1829501817u, val2, (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());
				}
			}
		}

		private IEnumerator DisplayShowCoroutine()
		{
			yield return (object)new WaitForSeconds(10f);
			for (int i = 0; i < 15; i++)
			{
				GameObject firework = Object.Instantiate<GameObject>(fireworksInCrate[i], ((Component)this).transform.position + new Vector3(0f, 0.5f, 0f), Quaternion.Euler(new Vector3(-90f, 0f, 0f)));
				firework.GetComponent<FireworkRocketVisual>().LaunchRocket();
				yield return (object)new WaitForSeconds(0.5f);
			}
			for (int j = 0; j < 20; j++)
			{
				GameObject firework2 = Object.Instantiate<GameObject>(fireworksInCrate[j + 15], ((Component)this).transform.position + new Vector3(0f, 0.5f, 0f), Quaternion.Euler(new Vector3(-90f, 0f, 0f)));
				firework2.GetComponent<FireworkRocketVisual>().LaunchRocket();
				yield return (object)new WaitForSeconds(0.25f);
			}
			for (int k = 0; k < 7; k++)
			{
				GameObject firework3 = Object.Instantiate<GameObject>(fireworksInCrate[k + 35], ((Component)this).transform.position + new Vector3(0f, 0.5f, 0f), Quaternion.Euler(new Vector3(-90f, 0f, 0f)));
				firework3.GetComponent<FireworkRocketVisual>().LaunchRocket();
				GameObject firework4 = Object.Instantiate<GameObject>(fireworksInCrate[k + 41], ((Component)this).transform.position + new Vector3(0f, 0.5f, 0f), Quaternion.Euler(new Vector3(-90f, 0f, 0f)));
				firework4.GetComponent<FireworkRocketVisual>().LaunchRocket();
				GameObject firework5 = Object.Instantiate<GameObject>(fireworksInCrate[k + 48], ((Component)this).transform.position + new Vector3(0f, 0.5f, 0f), Quaternion.Euler(new Vector3(-90f, 0f, 0f)));
				firework5.GetComponent<FireworkRocketVisual>().LaunchRocket();
				yield return (object)new WaitForSeconds(0.25f);
			}
		}

		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 val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2618891377u, val2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 2618891377u, val2, (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 val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(816378916u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 816378916u, val2, (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 val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3004192897u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3004192897u, val2, (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
	{
		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());
		}

		private IEnumerator FireworkExplosionTimer()
		{
			yield return (object)new WaitForSeconds(selectedLifeTime);
			isFlying = false;
			((Component)this).GetComponent<Rigidbody>().velocity = Vector3.zero;
			audioSource.clip = explosionSound;
			audioSource.Play();
			explosionParticles.Play();
			smokeParticles.Stop();
			flashLightSource.intensity = flashIntensity;
			if (lightOnlyAppearsOnExplosion)
			{
				lingeringLightSource.color = gradientColor1;
				lingeringLightSource.intensity = flashIntensity;
			}
			float nonLethalDamageRange = explosionRange + explosionRange * 0.5f;
			Landmine.SpawnExplosion(((Component)this).transform.position, false, explosionRange, nonLethalDamageRange, 50, 10f, (GameObject)null, false);
			yield return (object)new WaitForSeconds(despawnTime);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private IEnumerator FireworkVisualRandomOffset()
		{
			while (isFlying)
			{
				targetOffsetX = offsetsList[currentOffset].x;
				targetOffsetY = offsetsList[currentOffset].y;
				((Component)this).transform.Rotate(new Vector3(selectedDragX, selectedDragY, 0f));
				yield return (object)new WaitForSeconds(0.15f);
				currentOffset++;
				if (((Collider)colliderRef).isTrigger)
				{
					((Collider)colliderRef).isTrigger = false;
				}
			}
		}

		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
	{
		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 val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(99540821u, val2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 99540821u, val2, (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 val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(80108231u, val2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 80108231u, val2, (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());
				}
			}
		}

		private IEnumerator LightAnimationCoroutine()
		{
			lightIntensityTarget = 100f;
			squeezeSound.Play();
			yield return (object)new WaitForSeconds(12f);
			lightIntensityTarget = 0f;
		}

		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 Animator animatorController = null;

		public GameObject lingeringEffectObject = 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 val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(355146952u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 355146952u, val2, (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)
			//IL_00de: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2894166886u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2894166886u, val2, (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");
				Object.Instantiate<GameObject>(lingeringEffectObject, ((Component)this).transform.position, Quaternion.identity);
				if (((NetworkBehaviour)this).IsOwner)
				{
					base.playerHeldBy.DestroyItemInSlotAndSync(base.playerHeldBy.currentItemSlot);
				}
			}
		}

		[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)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: 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 val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2259812051u, val2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 2259812051u, val2, (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);
					animatorController.Play("ShakeThatGrosMichel");
					base.originalScale *= 1.1f;
					Transform transform = ((Component)this).gameObject.transform;
					transform.localScale *= 1.1f;
				}
			}
		}

		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
	{
		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 val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1226110669u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 1226110669u, val2, (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 val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4288697832u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref playerToSync, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref boxColor, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref boxKnotColor, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 4288697832u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					GameObject val3 = NetworkObjectReference.op_Implicit(playerToSync);
					chosenPlayer = val3.GetComponent<PlayerControllerB>();
					((Component)this).GetComponentInChildren<ScanNodeProperties>().subText = "For " + chosenPlayer.playerUsername;
					((Renderer)base.mainObjectRenderer).materials[0].color = Color.HSVToRGB(boxColor, 0.8f, 0.95f);
					((Renderer)base.mainObjectRenderer).materials[1].color = Color.HSVToRGB(boxKnotColor, 0.8f, 0.9f);
				}
			}
		}

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

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

		private IEnumerator ForceDropPresentCoroutine()
		{
			while (GameNetworkManager.Instance.localPlayerController.isGrabbingObjectAnimation)
			{
				yield return (object)new WaitForEndOfFrame();
			}
			GameNetworkManager.Instance.localPlayerController.DiscardHeldObject(true, (NetworkObject)null, ((Component)base.playerHeldBy).transform.position + new Vector3(0f, 0.4f, 0f), true);
			HUDManager.Instance.DisplayTip("Thief!", "This present is not for you! Only " + chosenPlayer.playerUsername + " may take it", false, false, "LC_Tip1");
		}

		public IEnumerator SyncItem(NetworkObjectReference reference, int intValue, bool isLast = false)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).EnableItemMeshes(false);
			NetworkObject itemNetObject = null;
			float startTime = Time.realtimeSinceStartup;
			while (Time.realtimeSinceStartup - startTime < 8f && !((NetworkObjectReference)(ref reference)).TryGet(ref itemNetObject, (NetworkManager)null))
			{
				yield return (object)new WaitForSeconds(0.03f);
			}
			if ((Object)(object)itemNetObject == (Object)null)
			{
				yield break;
			}
			yield return (object)new WaitForEndOfFrame();
			GrabbableObject component = ((Component)itemNetObject).GetComponent<GrabbableObject>();
			component.fallTime = 0f;
			if (component.itemProperties.isScrap)
			{
				component.SetScrapValue(intValue);
			}
			if (isLast && ((NetworkBehaviour)this).IsOwner)
			{
				if (((NetworkBehaviour)this).IsServer)
				{
					yield return (object)new WaitForSeconds(0.5f);
				}
				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
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1226110669u, new RpcReceiveHandler(__rpc_handler_1226110669), "SyncChosenPlayerServerRpc");
			((NetworkBehaviour)this).__registerRpc(4288697832u, new RpcReceiveHandler(__rpc_handler_4288697832), "SyncChosenPlayerClientRpc");
			((NetworkBehaviour)this).__registerRpc(1704050253u, new RpcReceiveHandler(__rpc_handler_1704050253), "OpenPresentServerRpc");
			((NetworkBehaviour)this).__registerRpc(2692686629u, new RpcReceiveHandler(__rpc_handler_2692686629), "OpenPresentClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

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

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

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

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

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

			public float boxColorHue;

			public float boxKnotHue;

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

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

		public static AssignedMaterial Cre