Decompiled source of LCCrashBandicootCratesMod v0.9.0

LCCrashBandicootCratesMod.dll

Decompiled 6 hours ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
internal class <Module>
{
	static <Module>()
	{
	}
}
public class CrateGrabbableObject : GrabbableObject, IHittable
{
	private static ManualLogSource Logger = Plugin.Logger;

	[Space(3f)]
	[Header("General")]
	public AllAssets allAssets;

	public CrateType crateType;

	[Space(3f)]
	[Header("Audiovisual")]
	public AudioSource audioSource;

	public AudioClip audioBreakSFX;

	public AudioClip audioBounceSFX;

	public AudioClip audioSpecialSFX;

	public bool audioPlayOneShot = true;

	public bool noiseAudible = true;

	public float noiseLoudness = 0.5f;

	public float noiseRange = 10f;

	public float noiseInterval = 2f;

	public float noiseTimer;

	[Space]
	public Material[] switchMatOnSpecialInt;

	public int[] switchMatIndex = new int[1] { 2 };

	[Space]
	public ParticleSystem particlesBreak;

	public ParticleSystem particlesSpecial;

	[Space(3f)]
	[Header("Colliders")]
	public bool collideWithCrate = true;

	public string collideOverrideCrate;

	public string collideOverrideBounce;

	public BoxCollider colliderCrate;

	public NavMeshObstacle colliderEnemies;

	public BoxCollider colliderBounce;

	public Transform topOfCrate;

	[Space(3f)]
	[Header("Interactions")]
	public float bounceForce = 15f;

	public float bounceMultiplierThreshold = 3f;

	public AnimationCurve bounceCurve;

	public bool bounceRecalculateHalfway;

	public bool bouncedOffCrate;

	public bool bounceHalfwayPoint;

	public float bounceCeiling = -1f;

	[Space]
	public bool destroyed;

	public int destroyUponSpecialInt = 1;

	[Space]
	public int specialInt;

	[Tooltip("Read like changeSpecialIntTrueOrFalse")]
	public bool changeSpecialIntAddOrSnap = true;

	public int changeSpecialIntPerWalkInto;

	public int changeSpecialIntPerJumpOnto = 1;

	public int changeSpecialIntPerAttack = 99;

	[Space]
	[Tooltip("Falling this distance calls WalkIntoCrate()")]
	public float fallToTriggerWalkInto = -1f;

	[Tooltip("Falling this distance calls JumpOntoCrate()")]
	public float fallToTriggerJumpInto = -1f;

	[Tooltip("Falling this distance calls AttackCrate()")]
	public float fallToTriggerAttack = -1f;

	[Space]
	public bool audioPlayByWalkingInto;

	public bool audioPlayByJumpingOnto;

	public bool audioPlayByAttacking;

	public bool audioPlayOnDestroy;

	[Space]
	public bool particlesPlayByWalkingInto;

	public bool particlesPlayByJumpingOnto;

	public bool particlesPlayByAttacking;

	public bool particlesPlayOnDestroy;

	[Space(3f)]
	[Header("Events")]
	public InteractEvent invokeEventOnStart;

	public InteractEvent invokeEventByWalkingInto;

	public InteractEvent invokeEventByJumpingOnto;

	public InteractEvent invokeEventByAttacking;

	public InteractEvent invokeEventOnDestroy;

	[Space(3f)]
	[Header("Contents")]
	public GameObject spawnPrefab;

	public int spawnAmountLeft = 1;

	[Space]
	public int spawnPerWalkingInto = -1;

	public int spawnPerJumpingOnto = -1;

	public int spawnPerAttacking = -1;

	[Space]
	public bool contentLostByWalkingInto;

	public bool contentLostByJumpingOnto;

	public bool contentLostByAttacking;

	public bool contentLostByNonPlayer = true;

	[Space(3f)]
	[Header("Explosions")]
	public bool explosiveCrate;

	public float explosionKillRange = 2.5f;

	public float explosionDamageRange = 5f;

	[Range(0f, 100f)]
	public int explosionNonLethalDamage = 50;

	public float explosionPhysicsForce;

	public override void Start()
	{
		((GrabbableObject)this).Start();
		EnableColliders(setEnabledTo: true);
		if (((NetworkBehaviour)this).IsServer && base.isInShipRoom)
		{
			spawnAmountLeft = 0;
		}
		if (!base.isInShipRoom && ((UnityEventBase)invokeEventOnStart).GetPersistentEventCount() != 0)
		{
			((UnityEvent<PlayerControllerB>)(object)invokeEventOnStart).Invoke(GameNetworkManager.Instance.localPlayerController);
		}
	}

	public override void Update()
	{
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		((GrabbableObject)this).Update();
		if (!audioPlayOneShot && noiseAudible && (Object)(object)audioSource != (Object)null && audioSource.isPlaying)
		{
			if (noiseTimer >= noiseInterval)
			{
				noiseTimer = 0f;
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, noiseLoudness, 0, base.isInShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0);
			}
			else
			{
				noiseTimer += Time.deltaTime;
			}
		}
	}

	public override void EquipItem()
	{
		((GrabbableObject)this).EquipItem();
		EnableColliders(setEnabledTo: false);
		bouncedOffCrate = false;
	}

	public override void PlayDropSFX()
	{
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: 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_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		if (base.deactivated || destroyed || !base.hasBeenHeld)
		{
			return;
		}
		if (StartOfRound.Instance.currentLevelID == 3 && (Object)(object)((Component)this).GetComponentInParent<DepositItemsDesk>() != (Object)null)
		{
			Logger.LogDebug((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} likely placed on company desk, overriding colliders");
			collideOverrideCrate = "false";
			collideOverrideBounce = "false";
		}
		EnableColliders(setEnabledTo: true);
		RaycastHit val = default(RaycastHit);
		if (Physics.Raycast(((Component)this).transform.position + Vector3.up * 0.25f, Vector3.down, ref val, 0.5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
		{
			CrateGrabbableObject componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<CrateGrabbableObject>();
			if ((Object)(object)componentInParent != (Object)null && (componentInParent.crateType == CrateType.Arrow || (bounceForce > 0f && componentInParent.bounceForce >= bounceForce * bounceMultiplierThreshold)))
			{
				Logger.LogDebug((object)$"#{((NetworkBehaviour)this).NetworkObjectId} hit #{((NetworkBehaviour)componentInParent).NetworkObjectId} with force {componentInParent.bounceForce}");
				StartBounceOffCrate(componentInParent.bounceForce);
				return;
			}
		}
		base.hasHitGround = true;
		bouncedOffCrate = false;
		PlaySFX(base.itemProperties.dropSFX, togglePlay: false, overrideOneShot: true);
		float num;
		if (bounceCeiling != -1f)
		{
			num = bounceCeiling;
			bounceCeiling = -1f;
		}
		else
		{
			num = Mathf.Abs(((Component)this).transform.parent.TransformPoint(base.startFallingPosition).y - ((Component)this).transform.parent.TransformPoint(base.targetFloorPosition).y);
		}
		Logger.LogDebug((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} | fallDistance: {num}");
		if (fallToTriggerWalkInto != -1f && num >= fallToTriggerWalkInto)
		{
			WalkIntoCrate();
		}
		else if (fallToTriggerJumpInto != -1f && num >= fallToTriggerJumpInto)
		{
			JumpOntoCrate();
		}
		else if (fallToTriggerAttack != -1f && num >= fallToTriggerAttack)
		{
			AttackCrate();
		}
	}

	public override void FallWithCurve()
	{
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: 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_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		if (!bouncedOffCrate)
		{
			((GrabbableObject)this).FallWithCurve();
			return;
		}
		base.fallTime += Time.deltaTime;
		if (bounceRecalculateHalfway)
		{
			((Component)this).transform.localPosition = Vector3.Lerp(base.startFallingPosition, new Vector3(base.targetFloorPosition.x, base.targetFloorPosition.y + bounceCeiling, base.targetFloorPosition.z), bounceCurve.Evaluate(base.fallTime));
			if (!bounceHalfwayPoint && base.fallTime > 0.5f)
			{
				bounceHalfwayPoint = true;
				base.startFallingPosition = ((Component)this).transform.localPosition;
				base.targetFloorPosition = ((Component)this).transform.parent.InverseTransformPoint(((GrabbableObject)this).GetItemFloorPosition(((Component)this).transform.position));
			}
		}
		else
		{
			((Component)this).transform.localPosition = Vector3.Lerp(base.targetFloorPosition, new Vector3(base.targetFloorPosition.x, base.targetFloorPosition.y + bounceCeiling, base.targetFloorPosition.z), bounceCurve.Evaluate(base.fallTime));
		}
	}

	public void WalkIntoCrate(PlayerControllerB playerWalkedInto = null)
	{
		if (audioPlayByWalkingInto)
		{
			PlaySFX(audioSpecialSFX, togglePlay: true, overrideOneShot: false, (Object)(object)playerWalkedInto != (Object)null, 0);
		}
		if (particlesPlayByWalkingInto)
		{
			PlayParticles(particlesSpecial, (Object)(object)playerWalkedInto != (Object)null, 0);
		}
		if (spawnPerWalkingInto != 0 && (Object)(object)spawnPrefab != (Object)null && spawnAmountLeft > 0 && !contentLostByWalkingInto)
		{
			int spawnedByID = -1;
			if ((Object)(object)playerWalkedInto != (Object)null)
			{
				spawnedByID = (int)playerWalkedInto.playerClientId;
			}
			Logger.LogDebug((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} spawning {spawnPrefab} by: WalkIntoCrate()");
			SpawnContentsServerRpc(spawnPerWalkingInto, spawnedByID);
		}
		if (((UnityEventBase)invokeEventByWalkingInto).GetPersistentEventCount() != 0)
		{
			((UnityEvent<PlayerControllerB>)(object)invokeEventByWalkingInto).Invoke(playerWalkedInto);
		}
		UpdateSpecialInt(changeSpecialIntPerWalkInto, ((Object)(object)playerWalkedInto != (Object)null && contentLostByWalkingInto) || ((Object)(object)playerWalkedInto == (Object)null && contentLostByNonPlayer), (Object)(object)playerWalkedInto == (Object)null);
	}

	public void JumpOntoCrate(PlayerControllerB playerJumpedOnto = null)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)playerJumpedOnto == (Object)null)
		{
			PerformJumpOntoLogic(playerJumpedOnto);
		}
		else if (((Component)playerJumpedOnto).transform.position.y >= topOfCrate.position.y)
		{
			PerformJumpOntoLogic(playerJumpedOnto);
		}
	}

	private void PerformJumpOntoLogic(PlayerControllerB playerJumpedOnto = null)
	{
		//IL_0058: 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_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_0072: Unknown result type (might be due to invalid IL or missing references)
		if (audioPlayByJumpingOnto)
		{
			PlaySFX(audioSpecialSFX, togglePlay: true, overrideOneShot: false, (Object)(object)playerJumpedOnto != (Object)null, 1);
		}
		if (particlesPlayByJumpingOnto)
		{
			PlayParticles(particlesSpecial, (Object)(object)playerJumpedOnto != (Object)null, 1);
		}
		if (bounceForce > 0f && (Object)(object)playerJumpedOnto != (Object)null)
		{
			playerJumpedOnto.ResetFallGravity();
			playerJumpedOnto.externalForceAutoFade += Vector3.up * bounceForce;
			PlaySFX(audioBounceSFX, togglePlay: false, overrideOneShot: true, sync: true, 3);
		}
		if (spawnPerJumpingOnto != 0 && (Object)(object)spawnPrefab != (Object)null && spawnAmountLeft > 0 && !contentLostByJumpingOnto)
		{
			int spawnedByID = -1;
			if ((Object)(object)playerJumpedOnto != (Object)null)
			{
				spawnedByID = (int)playerJumpedOnto.playerClientId;
			}
			Logger.LogDebug((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} spawning {spawnPrefab} by: JumpOntoCrate()");
			SpawnContentsServerRpc(spawnPerJumpingOnto, spawnedByID);
		}
		if (((UnityEventBase)invokeEventByJumpingOnto).GetPersistentEventCount() != 0)
		{
			((UnityEvent<PlayerControllerB>)(object)invokeEventByJumpingOnto).Invoke(playerJumpedOnto);
		}
		UpdateSpecialInt(changeSpecialIntPerJumpOnto, ((Object)(object)playerJumpedOnto != (Object)null && contentLostByJumpingOnto) || ((Object)(object)playerJumpedOnto == (Object)null && contentLostByNonPlayer), (Object)(object)playerJumpedOnto == (Object)null);
	}

	public void AttackCrate(PlayerControllerB playerAttacked = null)
	{
		if (audioPlayByAttacking)
		{
			PlaySFX(audioSpecialSFX, togglePlay: true, overrideOneShot: false, (Object)(object)playerAttacked != (Object)null, 2);
		}
		if (particlesPlayByAttacking)
		{
			PlayParticles(particlesSpecial, (Object)(object)playerAttacked != (Object)null, 2);
		}
		if (spawnPerAttacking != 0 && (Object)(object)spawnPrefab != (Object)null && spawnAmountLeft > 0 && (!((Object)(object)playerAttacked != (Object)null) || !contentLostByAttacking) && (!((Object)(object)playerAttacked == (Object)null) || !contentLostByNonPlayer))
		{
			int spawnedByID = -1;
			if ((Object)(object)playerAttacked != (Object)null)
			{
				spawnedByID = (int)playerAttacked.playerClientId;
			}
			Logger.LogDebug((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} spawning {spawnPrefab} by: AttackCrate()");
			SpawnContentsServerRpc(spawnPerAttacking, spawnedByID);
		}
		if (((UnityEventBase)invokeEventByAttacking).GetPersistentEventCount() != 0)
		{
			((UnityEvent<PlayerControllerB>)(object)invokeEventByAttacking).Invoke(playerAttacked);
		}
		UpdateSpecialInt(changeSpecialIntPerAttack, ((Object)(object)playerAttacked != (Object)null && contentLostByAttacking) || ((Object)(object)playerAttacked == (Object)null && contentLostByNonPlayer), (Object)(object)playerAttacked == (Object)null);
	}

	bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID)
	{
		if (base.deactivated || destroyed)
		{
			return false;
		}
		AttackCrate(playerWhoHit);
		return true;
	}

	private void StartBounceOffCrate(float bounceForceCrate)
	{
		//IL_0039: 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_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		PlaySFX(audioBounceSFX, togglePlay: false, overrideOneShot: true);
		bouncedOffCrate = true;
		base.hasHitGround = false;
		base.reachedFloorTarget = false;
		base.fallTime = 0f;
		bounceHalfwayPoint = false;
		base.startFallingPosition = base.targetFloorPosition - Vector3.down;
		RaycastHit val = default(RaycastHit);
		if (Physics.Raycast(topOfCrate.position, Vector3.up, ref val, bounceForceCrate / 4f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
		{
			bounceCeiling = ((RaycastHit)(ref val)).distance;
		}
		else
		{
			bounceCeiling = bounceForceCrate / 10f;
		}
		Logger.LogDebug((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} bounceOffCrate {bouncedOffCrate} // bounceCeiling {bounceCeiling}");
	}

	private void CheckMaterialSwitch()
	{
		if (switchMatOnSpecialInt != null && switchMatOnSpecialInt.Length != 0 && specialInt >= 0 && specialInt < switchMatOnSpecialInt.Length)
		{
			for (int i = 0; i < switchMatIndex.Length; i++)
			{
				SwitchMatTo(switchMatOnSpecialInt[specialInt], switchMatIndex[i]);
			}
		}
	}

	private void SwitchMatTo(Material changeToMat, int matIndex = 2)
	{
		Material[] materials = ((Renderer)base.mainObjectRenderer).materials;
		if (matIndex >= materials.Length)
		{
			Logger.LogDebug((object)$"SwitchMatTo() out of bounds: length = {materials.Length} | index = {matIndex}");
			return;
		}
		materials[matIndex] = changeToMat;
		((Renderer)base.mainObjectRenderer).materials = materials;
	}

	public void EnableColliders(bool setEnabledTo)
	{
		Logger.LogDebug((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId}: EnableColliders({setEnabledTo})");
		if (setEnabledTo && (Object)(object)base.playerHeldBy != (Object)null)
		{
			Logger.LogDebug((object)$"#{((NetworkBehaviour)this).NetworkObjectId} trying to turn colliders on while held, returning;");
			return;
		}
		if ((Object)(object)colliderCrate != (Object)null)
		{
			if (!string.IsNullOrEmpty(collideOverrideCrate))
			{
				bool enabled = collideOverrideCrate.ToLower() == "true";
				((Collider)colliderCrate).enabled = enabled;
				Logger.LogDebug((object)$"{colliderCrate} enabled overriden by {collideOverrideCrate} to {((Collider)colliderCrate).enabled}");
			}
			else
			{
				((Collider)colliderCrate).enabled = setEnabledTo;
			}
			((Collider)colliderCrate).isTrigger = !collideWithCrate;
		}
		if ((Object)(object)colliderEnemies != (Object)null)
		{
			((Behaviour)colliderEnemies).enabled = setEnabledTo;
			colliderEnemies.carving = collideWithCrate;
		}
		if ((Object)(object)colliderBounce != (Object)null)
		{
			if (!string.IsNullOrEmpty(collideOverrideBounce))
			{
				bool enabled2 = collideOverrideBounce.ToLower() == "true";
				((Collider)colliderBounce).enabled = enabled2;
				Logger.LogDebug((object)$"{colliderBounce} enabled overriden by {collideOverrideBounce} to {((Collider)colliderBounce).enabled}");
			}
			else
			{
				((Collider)colliderBounce).enabled = setEnabledTo;
			}
		}
	}

	public void PlaySFX(AudioClip clipToPlay, bool togglePlay = true, bool overrideOneShot = false, bool sync = false, int interactionType = -1)
	{
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)clipToPlay == (Object)null)
		{
			return;
		}
		AudioSource component = audioSource;
		if ((Object)(object)component == (Object)null)
		{
			component = ((Component)this).GetComponent<AudioSource>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
		}
		if (audioPlayOneShot || overrideOneShot)
		{
			component.PlayOneShot(clipToPlay);
			WalkieTalkie.TransmitOneShotAudio(component, clipToPlay, 1f);
			if (noiseAudible && ((NetworkBehaviour)this).IsOwner)
			{
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, noiseLoudness, 0, base.isInShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0);
			}
		}
		else if (togglePlay)
		{
			if (!component.isPlaying)
			{
				component.clip = clipToPlay;
				component.Play();
			}
			else if (component.isPlaying)
			{
				component.Stop();
			}
		}
		if (sync && interactionType != -1)
		{
			SyncSFXOrParticlesServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, isSFX: true, interactionType);
		}
	}

	public void PlayParticles(ParticleSystem particlesToPlay, bool sync = false, int interactionType = -1)
	{
		if (!((Object)(object)particlesToPlay == (Object)null))
		{
			particlesToPlay.Play();
			if (sync && interactionType != -1)
			{
				SyncSFXOrParticlesServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, isSFX: false, interactionType);
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	private void SyncSFXOrParticlesServerRpc(int playerID, bool isSFX, int interactionType)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: 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_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3988902864u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isSFX, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, interactionType);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3988902864u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && interactionType != -1)
			{
				SyncSFXOrParticlesClientRpc(playerID, isSFX, interactionType);
			}
		}
	}

	[ClientRpc]
	private void SyncSFXOrParticlesClientRpc(int playerID, bool isSFX, int interactionType)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: 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_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(764530586u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, playerID);
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isSFX, default(ForPrimitives));
			BytePacker.WriteValueBitPacked(val2, interactionType);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 764530586u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || playerID == (int)GameNetworkManager.Instance.localPlayerController.playerClientId)
		{
			return;
		}
		switch (interactionType)
		{
		case 0:
			if (isSFX && audioPlayByWalkingInto)
			{
				PlaySFX(audioSpecialSFX);
			}
			else if (!isSFX && particlesPlayByWalkingInto)
			{
				PlayParticles(particlesSpecial);
			}
			break;
		case 1:
			if (isSFX && audioPlayByJumpingOnto)
			{
				PlaySFX(audioSpecialSFX);
			}
			else if (!isSFX && particlesPlayByJumpingOnto)
			{
				PlayParticles(particlesSpecial);
			}
			break;
		case 2:
			if (isSFX && audioPlayByAttacking)
			{
				PlaySFX(audioSpecialSFX);
			}
			else if (!isSFX && particlesPlayByAttacking)
			{
				PlayParticles(particlesSpecial);
			}
			break;
		case 3:
			PlaySFX(audioBounceSFX);
			break;
		}
	}

	public void UpdateSpecialInt(int change, bool destroyLosesContent, bool syncRequiresOwnerShip = false)
	{
		if ((!changeSpecialIntAddOrSnap || (change != 0 && (specialInt != 0 || change >= 0))) && (change != -99 || changeSpecialIntAddOrSnap) && (!syncRequiresOwnerShip || ((NetworkBehaviour)this).IsOwner))
		{
			UpdateSpecialIntLocal(change, destroyLosesContent);
			UpdateSpecialIntServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, change, destroyLosesContent);
		}
	}

	[ServerRpc(RequireOwnership = false)]
	private void UpdateSpecialIntServerRpc(int playerID, int change, bool destroyLosesContent)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: 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_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1635305508u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				BytePacker.WriteValueBitPacked(val2, change);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref destroyLosesContent, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1635305508u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				UpdateSpecialIntClientRpc(playerID, change, destroyLosesContent);
			}
		}
	}

	[ClientRpc]
	private void UpdateSpecialIntClientRpc(int playerID, int change, bool destroyLosesContent)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: 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_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(118164457u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				BytePacker.WriteValueBitPacked(val2, change);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref destroyLosesContent, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 118164457u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && playerID != (int)GameNetworkManager.Instance.localPlayerController.playerClientId)
			{
				UpdateSpecialIntLocal(change, destroyLosesContent);
			}
		}
	}

	public void UpdateSpecialIntLocal(int change, bool destroyLosesContent)
	{
		if (changeSpecialIntAddOrSnap)
		{
			specialInt += change;
			if (specialInt < 0)
			{
				specialInt = 0;
			}
		}
		else
		{
			specialInt = change;
		}
		Logger.LogDebug((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} specialInt: {specialInt}");
		CheckMaterialSwitch();
		if (destroyUponSpecialInt != -1 && specialInt >= destroyUponSpecialInt)
		{
			((MonoBehaviour)this).StartCoroutine(DestroyCrateLocal(destroyLosesContent));
		}
	}

	private void DestroyCrate(bool destroyContent = false)
	{
		((MonoBehaviour)this).StartCoroutine(DestroyCrateLocal(destroyContent));
		DestroyCrateServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, destroyContent);
	}

	[ServerRpc(RequireOwnership = false)]
	private void DestroyCrateServerRpc(int playerID, bool destroyContent)
	{
		//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_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: 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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3018575139u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref destroyContent, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3018575139u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				DestroyCrateClientRpc(playerID, destroyContent);
			}
		}
	}

	[ClientRpc]
	private void DestroyCrateClientRpc(int playerID, bool destroyContent)
	{
		//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_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: 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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2282446353u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref destroyContent, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2282446353u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && playerID != (int)GameNetworkManager.Instance.localPlayerController.playerClientId)
			{
				((MonoBehaviour)this).StartCoroutine(DestroyCrateLocal(destroyContent));
			}
		}
	}

	private IEnumerator DestroyCrateLocal(bool destroyContent, bool overrideEffects = false, bool shouldDoEffects = false)
	{
		if (destroyed)
		{
			yield break;
		}
		destroyed = true;
		base.itemUsedUp = true;
		yield return (object)new WaitForEndOfFrame();
		if (destroyContent)
		{
			spawnAmountLeft = -1;
		}
		EnableColliders(setEnabledTo: false);
		if (overrideEffects)
		{
			if (shouldDoEffects)
			{
				PlaySFX(audioBreakSFX, togglePlay: false, overrideOneShot: true);
				PlayParticles(particlesBreak);
				if (audioPlayOnDestroy)
				{
					PlaySFX(audioSpecialSFX);
				}
				if (particlesPlayOnDestroy)
				{
					PlayParticles(particlesSpecial);
				}
			}
		}
		else
		{
			PlaySFX(audioBreakSFX, togglePlay: false, overrideOneShot: true);
			PlayParticles(particlesBreak);
			if (audioPlayOnDestroy)
			{
				PlaySFX(audioSpecialSFX);
			}
			if (particlesPlayOnDestroy)
			{
				PlayParticles(particlesSpecial);
			}
		}
		if (overrideEffects)
		{
			if (shouldDoEffects)
			{
				ExplodeCrate();
			}
		}
		else if (explosiveCrate)
		{
			ExplodeCrate();
		}
		if (((NetworkBehaviour)this).IsServer && ((UnityEventBase)invokeEventOnDestroy).GetPersistentEventCount() != 0)
		{
			((UnityEvent<PlayerControllerB>)(object)invokeEventOnDestroy).Invoke(GameNetworkManager.Instance.localPlayerController);
		}
		((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy);
	}

	private void ExplodeCrate()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		Landmine.SpawnExplosion(((Component)this).transform.position, explosiveCrate && (Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null, explosionKillRange, explosionDamageRange, explosionNonLethalDamage, explosionPhysicsForce, (GameObject)null, false);
	}

	[ServerRpc(RequireOwnership = false)]
	private void SpawnContentsServerRpc(int spawnFromAmount, int spawnedByID)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: 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_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2306729523u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, spawnFromAmount);
			BytePacker.WriteValueBitPacked(val2, spawnedByID);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2306729523u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
		{
			return;
		}
		if ((Object)(object)spawnPrefab == (Object)null || (Object)(object)spawnPrefab.GetComponent<NetworkObject>() == (Object)null)
		{
			Logger.LogWarning((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} tried spawning null spawnPrefab or NetworkObject");
			return;
		}
		if (spawnFromAmount == -1)
		{
			spawnFromAmount = spawnAmountLeft;
		}
		((MonoBehaviour)this).StartCoroutine(SpawnContentOnServer(spawnFromAmount, spawnedByID));
	}

	private IEnumerator SpawnContentOnServer(int spawnFromAmount, int spawnedByID)
	{
		for (int i = 0; i < spawnFromAmount; i++)
		{
			if (spawnAmountLeft <= 0)
			{
				break;
			}
			Vector3 spawnPoint = topOfCrate.position + Vector3.up * 0.5f;
			GameObject val = Object.Instantiate<GameObject>(spawnPrefab, spawnPoint, Quaternion.identity);
			NetworkObject netObj = val.GetComponent<NetworkObject>();
			GrabbableObject component = val.GetComponent<GrabbableObject>();
			ICrateSpawnableObject crateObject = val.GetComponent<ICrateSpawnableObject>();
			int intValue = -1;
			if ((Object)(object)component != (Object)null && (Object)(object)component.itemProperties != (Object)null && component.itemProperties.minValue != -1 && component.itemProperties.maxValue != -1)
			{
				intValue = (int)((float)Random.Range(component.itemProperties.minValue, component.itemProperties.maxValue) * RoundManager.Instance.scrapValueMultiplier);
			}
			netObj.Spawn(false);
			if (crateObject != null)
			{
				yield return (object)new WaitForEndOfFrame();
				crateObject.OnSpawnObject(spawnPoint, GetPlayerSpawnedBy(spawnedByID), intValue);
			}
			spawnAmountLeft--;
			Logger.LogDebug((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} spawnAmountLeft: {spawnAmountLeft}");
			SpawnContentClientRpc(NetworkObjectReference.op_Implicit(netObj), spawnedByID, intValue, spawnAmountLeft);
			yield return null;
		}
	}

	[ClientRpc]
	private void SpawnContentClientRpc(NetworkObjectReference prefabNOR, int spawnedByID, int intValue, int hostSpawnAmount)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: 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_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(52806775u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref prefabNOR, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, spawnedByID);
				BytePacker.WriteValueBitPacked(val2, intValue);
				BytePacker.WriteValueBitPacked(val2, hostSpawnAmount);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 52806775u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsServer)
			{
				spawnAmountLeft = hostSpawnAmount;
				Logger.LogDebug((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} spawnAmountLeft: {spawnAmountLeft}");
				((MonoBehaviour)this).StartCoroutine(SpawnContentOnClient(prefabNOR, spawnedByID, intValue));
			}
		}
	}

	private IEnumerator SpawnContentOnClient(NetworkObjectReference prefabNOR, int spawnedByID, 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)
		NetworkObject netObj = null;
		float startTime = Time.realtimeSinceStartup;
		while (Time.realtimeSinceStartup - startTime < 8f && !((NetworkObjectReference)(ref prefabNOR)).TryGet(ref netObj, (NetworkManager)null))
		{
			yield return (object)new WaitForSeconds(0.03f);
		}
		if (!((Object)(object)netObj == (Object)null))
		{
			yield return (object)new WaitForEndOfFrame();
			Vector3 spawnAtPosition = topOfCrate.position + Vector3.up * 0.5f;
			((Component)netObj).GetComponent<ICrateSpawnableObject>()?.OnSpawnObject(spawnAtPosition, GetPlayerSpawnedBy(spawnedByID), intValue);
		}
	}

	private PlayerControllerB GetPlayerSpawnedBy(int playerID)
	{
		PlayerControllerB result = null;
		if (playerID >= 0 && playerID < StartOfRound.Instance.allPlayerScripts.Length)
		{
			result = StartOfRound.Instance.allPlayerScripts[playerID];
		}
		return result;
	}

	[ServerRpc(RequireOwnership = false)]
	public void SyncUponJoinServerRpc(int playerID)
	{
		//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_00e9: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1293327924u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, playerID);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1293327924u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			Logger.LogDebug((object)$"syncing crate {((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} at {((Component)this).transform.position}");
			int indexOfBonusObject = ManagerScript.GetIndexOfBonusObject(spawnPrefab);
			int hostMatLength = -1;
			if ((Object)(object)base.mainObjectRenderer != (Object)null && ((Renderer)base.mainObjectRenderer).materials != null)
			{
				hostMatLength = ((Renderer)base.mainObjectRenderer).materials.Length;
			}
			SyncUponJoinClientRpc(playerID, destroyed, specialInt, spawnAmountLeft, indexOfBonusObject, collideOverrideCrate, collideOverrideBounce, hostMatLength, bounceForce, destroyUponSpecialInt, explosiveCrate);
		}
	}

	[ClientRpc]
	private void SyncUponJoinClientRpc(int playerID, bool hostDestroyed, int hostSpecialInt, int hostSpawnAmountLeft, int hostSpawnPrefab, string hostCollideOverrideCrate, string hostCollideOverrideBounce, int hostMatLength, float hostBounceForce, int hostDestroyUponSpecialInt, bool hostExplosiveCrate)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: 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_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: 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_00d7: 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_0115: 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_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: 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)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1157169220u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, playerID);
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hostDestroyed, default(ForPrimitives));
			BytePacker.WriteValueBitPacked(val2, hostSpecialInt);
			BytePacker.WriteValueBitPacked(val2, hostSpawnAmountLeft);
			BytePacker.WriteValueBitPacked(val2, hostSpawnPrefab);
			bool flag = hostCollideOverrideCrate != null;
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			if (flag)
			{
				((FastBufferWriter)(ref val2)).WriteValueSafe(hostCollideOverrideCrate, false);
			}
			bool flag2 = hostCollideOverrideBounce != null;
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
			if (flag2)
			{
				((FastBufferWriter)(ref val2)).WriteValueSafe(hostCollideOverrideBounce, false);
			}
			BytePacker.WriteValueBitPacked(val2, hostMatLength);
			((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref hostBounceForce, default(ForPrimitives));
			BytePacker.WriteValueBitPacked(val2, hostDestroyUponSpecialInt);
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hostExplosiveCrate, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1157169220u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || playerID != (int)GameNetworkManager.Instance.localPlayerController.playerClientId)
		{
			return;
		}
		if (hostDestroyed)
		{
			((MonoBehaviour)this).StartCoroutine(DestroyCrateLocal(destroyContent: true, overrideEffects: true));
			return;
		}
		specialInt = hostSpecialInt;
		if (hostMatLength > 0)
		{
			Material[] array = (Material[])(object)new Material[hostMatLength];
			for (int i = 0; i < array.Length; i++)
			{
				if (i < ((Renderer)base.mainObjectRenderer).materials.Length)
				{
					array[i] = ((Renderer)base.mainObjectRenderer).materials[i];
				}
			}
			((Renderer)base.mainObjectRenderer).materials = array;
			CheckMaterialSwitch();
		}
		spawnAmountLeft = hostSpawnAmountLeft;
		if (hostSpawnPrefab != -1)
		{
			spawnPrefab = allAssets.allBonusObjects[hostSpawnPrefab];
		}
		collideOverrideCrate = hostCollideOverrideCrate;
		collideOverrideBounce = hostCollideOverrideBounce;
		EnableColliders((Object)(object)base.playerHeldBy == (Object)null);
		bounceForce = hostBounceForce;
		destroyUponSpecialInt = hostDestroyUponSpecialInt;
		explosiveCrate = hostExplosiveCrate;
		Logger.LogDebug((object)$"Locally received data for {((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId}: specialInt = {specialInt} | spawnAmountLeft = {spawnAmountLeft} | spawnPrefab = {spawnPrefab} | collideOverrideCrate = {collideOverrideCrate} | collideOverrideBounce = {collideOverrideBounce} | Length = {hostMatLength} | bounceForce = {bounceForce} | destroyUponSpecialInt = {destroyUponSpecialInt} | explosiveCrate = {explosiveCrate}");
	}

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

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_CrateGrabbableObject()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Expected O, but got Unknown
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Expected O, but got Unknown
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Expected O, but got Unknown
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Expected O, but got Unknown
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Expected O, but got Unknown
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Expected O, but got Unknown
		NetworkManager.__rpc_func_table.Add(3988902864u, new RpcReceiveHandler(__rpc_handler_3988902864));
		NetworkManager.__rpc_func_table.Add(764530586u, new RpcReceiveHandler(__rpc_handler_764530586));
		NetworkManager.__rpc_func_table.Add(1635305508u, new RpcReceiveHandler(__rpc_handler_1635305508));
		NetworkManager.__rpc_func_table.Add(118164457u, new RpcReceiveHandler(__rpc_handler_118164457));
		NetworkManager.__rpc_func_table.Add(3018575139u, new RpcReceiveHandler(__rpc_handler_3018575139));
		NetworkManager.__rpc_func_table.Add(2282446353u, new RpcReceiveHandler(__rpc_handler_2282446353));
		NetworkManager.__rpc_func_table.Add(2306729523u, new RpcReceiveHandler(__rpc_handler_2306729523));
		NetworkManager.__rpc_func_table.Add(52806775u, new RpcReceiveHandler(__rpc_handler_52806775));
		NetworkManager.__rpc_func_table.Add(1293327924u, new RpcReceiveHandler(__rpc_handler_1293327924));
		NetworkManager.__rpc_func_table.Add(1157169220u, new RpcReceiveHandler(__rpc_handler_1157169220));
	}

	private static void __rpc_handler_3988902864(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			bool isSFX = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isSFX, default(ForPrimitives));
			int interactionType = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref interactionType);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((CrateGrabbableObject)(object)target).SyncSFXOrParticlesServerRpc(playerID, isSFX, interactionType);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_764530586(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			bool isSFX = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isSFX, default(ForPrimitives));
			int interactionType = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref interactionType);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((CrateGrabbableObject)(object)target).SyncSFXOrParticlesClientRpc(playerID, isSFX, interactionType);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1635305508(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			int change = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref change);
			bool destroyLosesContent = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref destroyLosesContent, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((CrateGrabbableObject)(object)target).UpdateSpecialIntServerRpc(playerID, change, destroyLosesContent);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_118164457(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			int change = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref change);
			bool destroyLosesContent = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref destroyLosesContent, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((CrateGrabbableObject)(object)target).UpdateSpecialIntClientRpc(playerID, change, destroyLosesContent);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_3018575139(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			bool destroyContent = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref destroyContent, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((CrateGrabbableObject)(object)target).DestroyCrateServerRpc(playerID, destroyContent);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_2282446353(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			bool destroyContent = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref destroyContent, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((CrateGrabbableObject)(object)target).DestroyCrateClientRpc(playerID, destroyContent);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_2306729523(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int spawnFromAmount = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref spawnFromAmount);
			int spawnedByID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref spawnedByID);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((CrateGrabbableObject)(object)target).SpawnContentsServerRpc(spawnFromAmount, spawnedByID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_52806775(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_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: 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_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			NetworkObjectReference prefabNOR = default(NetworkObjectReference);
			((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref prefabNOR, default(ForNetworkSerializable));
			int spawnedByID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref spawnedByID);
			int intValue = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref intValue);
			int hostSpawnAmount = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref hostSpawnAmount);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((CrateGrabbableObject)(object)target).SpawnContentClientRpc(prefabNOR, spawnedByID, intValue, hostSpawnAmount);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1293327924(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 playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((CrateGrabbableObject)(object)target).SyncUponJoinServerRpc(playerID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1157169220(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: 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_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: 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_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			bool hostDestroyed = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hostDestroyed, default(ForPrimitives));
			int hostSpecialInt = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref hostSpecialInt);
			int hostSpawnAmountLeft = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref hostSpawnAmountLeft);
			int hostSpawnPrefab = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref hostSpawnPrefab);
			bool flag = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
			string hostCollideOverrideCrate = null;
			if (flag)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref hostCollideOverrideCrate, false);
			}
			bool flag2 = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
			string hostCollideOverrideBounce = null;
			if (flag2)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref hostCollideOverrideBounce, false);
			}
			int hostMatLength = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref hostMatLength);
			float hostBounceForce = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref hostBounceForce, default(ForPrimitives));
			int hostDestroyUponSpecialInt = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref hostDestroyUponSpecialInt);
			bool hostExplosiveCrate = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hostExplosiveCrate, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((CrateGrabbableObject)(object)target).SyncUponJoinClientRpc(playerID, hostDestroyed, hostSpecialInt, hostSpawnAmountLeft, hostSpawnPrefab, hostCollideOverrideCrate, hostCollideOverrideBounce, hostMatLength, hostBounceForce, hostDestroyUponSpecialInt, hostExplosiveCrate);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "CrateGrabbableObject";
	}
}
public class WumpaFruitProp : GrabbableObject, ICrateSpawnableObject
{
	private static ManualLogSource Logger = Plugin.Logger;

	private bool debugCalculateParent = true;

	public int stackOf;

	public PlayerControllerB spawnedBy;

	public ScanNodeProperties scanNode;

	public override void Start()
	{
		((GrabbableObject)this).Start();
		if (ManagerScript.logDebug)
		{
			Logger.LogDebug((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} Start()");
		}
	}

	public override void EquipItem()
	{
		((GrabbableObject)this).EquipItem();
		if (((NetworkBehaviour)this).IsOwner && stackOf > 1)
		{
			string[] array = new string[1] { $"Stack of: {stackOf} Wumpa's" };
			HUDManager.Instance.ClearControlTips();
			HUDManager.Instance.ChangeControlTipMultiple(array, true, base.itemProperties);
		}
	}

	public override void GrabItem()
	{
		((GrabbableObject)this).GrabItem();
		((MonoBehaviour)this).StartCoroutine(MergeOnDelay());
	}

	private IEnumerator MergeOnDelay()
	{
		PlayerControllerB playerMerging = base.playerHeldBy;
		if ((Object)(object)playerMerging == (Object)null)
		{
			yield break;
		}
		playerMerging.activatingItem = true;
		yield return (object)new WaitForSeconds(0.25f);
		WumpaFruitProp wumpaFruitProp = null;
		for (int i = 0; i < playerMerging.ItemSlots.Length; i++)
		{
			GrabbableObject val = playerMerging.ItemSlots[i];
			if (!((Object)(object)val == (Object)null) && !((Object)(object)val.itemProperties == (Object)null) && !((Object)(object)val == (Object)(object)this) && (Object)(object)val.itemProperties == (Object)(object)base.itemProperties)
			{
				wumpaFruitProp = ((Component)val).GetComponent<WumpaFruitProp>();
				Logger.LogDebug((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} found {((Object)val).name} #{((NetworkBehaviour)val).NetworkObjectId}");
				break;
			}
		}
		if ((Object)(object)wumpaFruitProp != (Object)null)
		{
			MergeWithWumpa(wumpaFruitProp, playerMerging);
			MergeServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)wumpaFruitProp).NetworkObject), (int)playerMerging.playerClientId);
		}
		yield return (object)new WaitForSeconds(0.25f);
		playerMerging.activatingItem = false;
	}

	[ServerRpc(RequireOwnership = false)]
	private void MergeServerRpc(NetworkObjectReference wumpaNOR, int playerID)
	{
		//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_00e4: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(421172516u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref wumpaNOR, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, playerID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 421172516u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				MergeClientRpc(wumpaNOR, playerID);
			}
		}
	}

	[ClientRpc]
	private void MergeClientRpc(NetworkObjectReference wumpaNOR, int playerID)
	{
		//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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(539778929u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref wumpaNOR, default(ForNetworkSerializable));
			BytePacker.WriteValueBitPacked(val2, playerID);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 539778929u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || ((NetworkBehaviour)this).IsOwner)
		{
			return;
		}
		NetworkObject val3 = default(NetworkObject);
		if (((NetworkObjectReference)(ref wumpaNOR)).TryGet(ref val3, (NetworkManager)null))
		{
			WumpaFruitProp component = ((Component)val3).GetComponent<WumpaFruitProp>();
			if ((Object)(object)component == (Object)null)
			{
				Logger.LogError((object)$"Failed to get script from {val3.NetworkObjectId}");
			}
			else
			{
				MergeWithWumpa(component, StartOfRound.Instance.allPlayerScripts[playerID]);
			}
		}
		else
		{
			Logger.LogError((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} Merge(): Failed to get other wumpaNOR");
		}
	}

	private void MergeWithWumpa(WumpaFruitProp mergeWith, PlayerControllerB playerMerging)
	{
		Logger.LogDebug((object)$"merging #{((NetworkBehaviour)this).NetworkObjectId} with #{((NetworkBehaviour)mergeWith).NetworkObjectId}");
		((GrabbableObject)this).DestroyObjectInHand(playerMerging);
		if ((Object)(object)playerMerging == (Object)(object)GameNetworkManager.Instance.localPlayerController)
		{
			playerMerging.activatingItem = true;
		}
		mergeWith.stackOf += stackOf;
		if (mergeWith.stackOf < 100)
		{
			((GrabbableObject)mergeWith).SetScrapValue(((GrabbableObject)mergeWith).scrapValue + base.scrapValue);
			mergeWith.UpdateScanNode();
		}
		else
		{
			Logger.LogDebug((object)$"locally found {mergeWith} #{((NetworkBehaviour)mergeWith).NetworkObjectId} to have a stackOf {mergeWith.stackOf}, trying to spawn oneUp");
			SpawnOneUp(mergeWith, playerMerging);
		}
	}

	private void SpawnOneUp(WumpaFruitProp wumpa, PlayerControllerB player)
	{
		int num = -1;
		for (int i = 0; i < player.ItemSlots.Length; i++)
		{
			if ((Object)(object)player.ItemSlots[i] == (Object)(object)wumpa)
			{
				num = i;
				break;
			}
		}
		if (num == -1)
		{
			Logger.LogError((object)$"failed to find {wumpa} #{((NetworkBehaviour)wumpa).NetworkObjectId} in {player.playerUsername}'s inventory, cannot spawn oneUp!");
			return;
		}
		Logger.LogDebug((object)$"trying to destroy item in slot {num}");
		player.ItemSlots[num] = null;
		((GrabbableObject)wumpa).deactivated = true;
		((GrabbableObject)wumpa).itemUsedUp = true;
		((GrabbableObject)wumpa).grabbable = false;
		((GrabbableObject)wumpa).grabbableToEnemies = false;
		((GrabbableObject)wumpa).playerHeldBy = null;
		((GrabbableObject)wumpa).isHeld = false;
		((GrabbableObject)wumpa).parentObject = null;
		if ((Object)(object)((GrabbableObject)wumpa).radarIcon != (Object)null)
		{
			Object.Destroy((Object)(object)((Component)((GrabbableObject)wumpa).radarIcon).gameObject);
		}
		((GrabbableObject)wumpa).EnableItemMeshes(false);
		((GrabbableObject)wumpa).EnablePhysics(false);
		if (((NetworkBehaviour)this).IsOwner)
		{
			((Behaviour)HUDManager.Instance.itemSlotIcons[num]).enabled = false;
			SpawnOneUpServerRpc((int)player.playerClientId);
		}
	}

	[ServerRpc(RequireOwnership = false)]
	private void SpawnOneUpServerRpc(int playerID)
	{
		//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_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1558547271u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1558547271u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				NetworkObject component = Object.Instantiate<GameObject>(ManagerScript.Instance.allAssets.allBonusObjects[1], StartOfRound.Instance.allPlayerScripts[playerID].serverItemHolder.position, Quaternion.identity).GetComponent<NetworkObject>();
				component.Spawn(false);
				SpawnOneUpClientRpc(NetworkObjectReference.op_Implicit(component), playerID);
			}
		}
	}

	[ClientRpc]
	private void SpawnOneUpClientRpc(NetworkObjectReference oneUpNOR, int playerID)
	{
		//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_015a: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2998662678u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref oneUpNOR, default(ForNetworkSerializable));
			BytePacker.WriteValueBitPacked(val2, playerID);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2998662678u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
		{
			return;
		}
		Logger.LogDebug((object)"SpawnOneUpClientRpc()");
		NetworkObject val3 = default(NetworkObject);
		if (playerID < 0 || playerID >= StartOfRound.Instance.allPlayerScripts.Length)
		{
			Logger.LogError((object)$"playerID [{playerID}] outside array bounds!");
		}
		else if (((NetworkObjectReference)(ref oneUpNOR)).TryGet(ref val3, (NetworkManager)null))
		{
			ICrateSpawnableObject component = ((Component)val3).GetComponent<ICrateSpawnableObject>();
			if (component == null)
			{
				Logger.LogError((object)"Failed to get Script of spawned Wumpa OneUp!");
				return;
			}
			PlayerControllerB val4 = StartOfRound.Instance.allPlayerScripts[playerID];
			component.OnSpawnObject(val4.serverItemHolder.position, val4);
		}
		else
		{
			Logger.LogError((object)"Failed to get NetworkObject of spawned Wumpa OneUp!");
		}
	}

	private void UpdateScanNode()
	{
		if (!((Object)(object)scanNode == (Object)null))
		{
			if (stackOf > 1)
			{
				scanNode.headerText = $"{stackOf} Wumpa Fruits";
			}
			else
			{
				scanNode.headerText = "Wumpa Fruit";
			}
		}
	}

	void ICrateSpawnableObject.OnSpawnObject(Vector3 spawnAtPosition, PlayerControllerB spawnedByPlayer, int spawnWithInt)
	{
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		spawnedBy = spawnedByPlayer;
		base.hasHitGround = false;
		base.reachedFloorTarget = false;
		base.fallTime = 0f;
		if (spawnWithInt != -1)
		{
			((GrabbableObject)this).SetScrapValue(spawnWithInt);
			RoundManager instance = RoundManager.Instance;
			instance.totalScrapValueInLevel += (float)spawnWithInt;
		}
		if ((Object)(object)spawnedBy != (Object)null)
		{
			base.isInFactory = spawnedBy.isInsideFactory;
		}
		HoarderBugAI.grabbableObjectsInMap.Add(((Component)this).gameObject);
		CalculateTargetFloorPosition(spawnAtPosition, debugCalculateParent);
	}

	private void CalculateTargetFloorPosition(Vector3 spawnPos, bool calculateParent = true)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: 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)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: 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_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: 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_0346: Unknown result type (might be due to invalid IL or missing references)
		//IL_0347: Unknown result type (might be due to invalid IL or missing references)
		//IL_034c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0352: Unknown result type (might be due to invalid IL or missing references)
		//IL_0353: Unknown result type (might be due to invalid IL or missing references)
		//IL_035a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0382: Unknown result type (might be due to invalid IL or missing references)
		//IL_0387: Unknown result type (might be due to invalid IL or missing references)
		//IL_038c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02be: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_0316: Unknown result type (might be due to invalid IL or missing references)
		//IL_0321: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
		Bounds bounds;
		if (!calculateParent)
		{
			base.startFallingPosition = spawnPos;
			base.targetFloorPosition = ((GrabbableObject)this).GetItemFloorPosition(spawnPos);
			bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds;
			bool flag = ((Bounds)(ref bounds)).Contains(((Component)this).transform.TransformPoint(base.targetFloorPosition));
			bounds = StartOfRound.Instance.shipBounds.bounds;
			bool flag2 = ((Bounds)(ref bounds)).Contains(((Component)this).transform.TransformPoint(base.targetFloorPosition));
			if ((Object)(object)spawnedBy != (Object)null)
			{
				spawnedBy.SetItemInElevator(flag, flag2, (GrabbableObject)(object)this);
			}
			return;
		}
		if (ManagerScript.logDebug)
		{
			Logger.LogDebug((object)$"A: {spawnPos} | {((Component)this).transform.parent}");
		}
		Vector3 itemFloorPosition = default(Vector3);
		NetworkObject physicsRegionOfDroppedObject = ((GrabbableObject)this).GetPhysicsRegionOfDroppedObject(spawnedBy, ref itemFloorPosition);
		if (ManagerScript.logDebug)
		{
			Logger.LogDebug((object)"B");
		}
		if ((Object)(object)physicsRegionOfDroppedObject == (Object)null)
		{
			if (ManagerScript.logDebug)
			{
				Logger.LogDebug((object)"C");
			}
			itemFloorPosition = ((GrabbableObject)this).GetItemFloorPosition(spawnPos);
			if (ManagerScript.logDebug)
			{
				Logger.LogDebug((object)$"D: {itemFloorPosition}");
			}
			bounds = StartOfRound.Instance.shipBounds.bounds;
			if (((Bounds)(ref bounds)).Contains(itemFloorPosition))
			{
				((Component)this).transform.SetParent(StartOfRound.Instance.elevatorTransform, true);
			}
			else
			{
				((Component)this).transform.SetParent(StartOfRound.Instance.propsContainer, true);
			}
			if (ManagerScript.logDebug)
			{
				Logger.LogDebug((object)$"E: {((Component)this).transform.parent}");
			}
		}
		else
		{
			if (ManagerScript.logDebug)
			{
				Logger.LogDebug((object)"F");
			}
			PlayerPhysicsRegion componentInChildren = ((Component)physicsRegionOfDroppedObject).GetComponentInChildren<PlayerPhysicsRegion>();
			if (ManagerScript.logDebug)
			{
				Logger.LogDebug((object)"G");
			}
			if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.physicsTransform != (Object)null)
			{
				((Component)this).transform.SetParent(componentInChildren.physicsTransform, true);
				if (ManagerScript.logDebug)
				{
					Logger.LogDebug((object)$"H: {((Component)this).transform.parent}");
				}
			}
			else
			{
				((Component)this).transform.SetParent(((Component)physicsRegionOfDroppedObject).transform, true);
				if (ManagerScript.logDebug)
				{
					Logger.LogDebug((object)$"I: {((Component)this).transform.parent}");
				}
			}
			if (ManagerScript.logDebug)
			{
				Logger.LogDebug((object)"J");
			}
		}
		if (ManagerScript.logDebug)
		{
			Logger.LogDebug((object)"K");
		}
		if ((Object)(object)physicsRegionOfDroppedObject == (Object)null)
		{
			base.startFallingPosition = ((Component)this).transform.parent.InverseTransformPoint(spawnPos);
			base.targetFloorPosition = ((Component)this).transform.parent.InverseTransformPoint(itemFloorPosition);
			base.targetFloorPosition += new Vector3(Random.Range(-0.25f, 0.25f), 0f, Random.Range(-0.25f, 0.25f));
			if (ManagerScript.logDebug)
			{
				Logger.LogDebug((object)$"L: {base.startFallingPosition} | {base.targetFloorPosition}");
			}
		}
		else
		{
			base.startFallingPosition = ((Component)this).transform.parent.InverseTransformPoint(spawnPos);
			base.targetFloorPosition = itemFloorPosition;
			base.targetFloorPosition += new Vector3(Random.Range(-0.25f, 0.25f), 0f, Random.Range(-0.25f, 0.25f));
			if (ManagerScript.logDebug)
			{
				Logger.LogDebug((object)$"M: {base.startFallingPosition} | {base.targetFloorPosition}");
			}
		}
		if (ManagerScript.logDebug)
		{
			Logger.LogDebug((object)"N");
		}
		bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds;
		bool flag3 = ((Bounds)(ref bounds)).Contains(((Component)this).transform.parent.TransformPoint(base.targetFloorPosition));
		if (ManagerScript.logDebug)
		{
			Logger.LogDebug((object)$"O: {flag3}");
		}
		bool flag4 = (Object)(object)((Component)this).transform.parent == (Object)(object)StartOfRound.Instance.elevatorTransform;
		if (ManagerScript.logDebug)
		{
			Logger.LogDebug((object)$"P: {flag4}");
		}
		if ((Object)(object)spawnedBy != (Object)null)
		{
			if (ManagerScript.logDebug)
			{
				Logger.LogDebug((object)"Q");
			}
			spawnedBy.SetItemInElevator(flag3, flag4, (GrabbableObject)(object)this);
		}
		if (ManagerScript.logDebug)
		{
			Logger.LogDebug((object)"R");
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void SyncUponJoinServerRpc(int playerID)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2292038240u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2292038240u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (base.deactivated || stackOf > 1))
			{
				SyncUponJoinClientRpc(playerID, base.deactivated, stackOf);
			}
		}
	}

	[ClientRpc]
	private void SyncUponJoinClientRpc(int playerID, bool hostDeactivated, int hostStackOf)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: 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_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2274452113u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, playerID);
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hostDeactivated, default(ForPrimitives));
			BytePacker.WriteValueBitPacked(val2, hostStackOf);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2274452113u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && playerID == (int)GameNetworkManager.Instance.localPlayerController.playerClientId)
		{
			if (hostDeactivated)
			{
				((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy);
				return;
			}
			stackOf = hostStackOf;
			UpdateScanNode();
			Logger.LogDebug((object)$"Locally received data for {((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId}: stackOf = {stackOf}");
		}
	}

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

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_WumpaFruitProp()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Expected O, but got Unknown
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Expected O, but got Unknown
		NetworkManager.__rpc_func_table.Add(421172516u, new RpcReceiveHandler(__rpc_handler_421172516));
		NetworkManager.__rpc_func_table.Add(539778929u, new RpcReceiveHandler(__rpc_handler_539778929));
		NetworkManager.__rpc_func_table.Add(1558547271u, new RpcReceiveHandler(__rpc_handler_1558547271));
		NetworkManager.__rpc_func_table.Add(2998662678u, new RpcReceiveHandler(__rpc_handler_2998662678));
		NetworkManager.__rpc_func_table.Add(2292038240u, new RpcReceiveHandler(__rpc_handler_2292038240));
		NetworkManager.__rpc_func_table.Add(2274452113u, new RpcReceiveHandler(__rpc_handler_2274452113));
	}

	private static void __rpc_handler_421172516(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 wumpaNOR = default(NetworkObjectReference);
			((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref wumpaNOR, default(ForNetworkSerializable));
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((WumpaFruitProp)(object)target).MergeServerRpc(wumpaNOR, playerID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_539778929(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 wumpaNOR = default(NetworkObjectReference);
			((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref wumpaNOR, default(ForNetworkSerializable));
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((WumpaFruitProp)(object)target).MergeClientRpc(wumpaNOR, playerID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1558547271(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 playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((WumpaFruitProp)(object)target).SpawnOneUpServerRpc(playerID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_2998662678(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 oneUpNOR = default(NetworkObjectReference);
			((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref oneUpNOR, default(ForNetworkSerializable));
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((WumpaFruitProp)(object)target).SpawnOneUpClientRpc(oneUpNOR, playerID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_2292038240(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 playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((WumpaFruitProp)(object)target).Syn