Decompiled source of jombobombo v1.1.2

jombobombo.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CoddingCat.PartyBuddies")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PartyBuddies")]
[assembly: AssemblyTitle("CoddingCat.PartyBuddies")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace PartyBuddies
{
	[BepInPlugin("CoddingCat.PartyBuddies", "PartyBuddies", "1.0.0")]
	public class PartyBuddies : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(StartOfRound), "Start")]
		private class ShipStartPatch
		{
			private static void Postfix()
			{
				SpawnBalloonsInShip();
			}
		}

		public static AssetBundle MyCustomAssets;

		public static AssetBundle MyCustomAssets2;

		private static AssetBundle bundle;

		public static PartyBuddies Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Patch();
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			MyCustomAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "pictureframe"));
			if (!((Object)(object)MyCustomAssets == (Object)null))
			{
				MyCustomAssets2 = AssetBundle.LoadFromFile(Path.Combine(directoryName, "additional"));
				Register(MyCustomAssets, "Szampon.asset", 5);
				Register(MyCustomAssets, "SzamponZamkniety.asset", 0);
				Register(MyCustomAssets, "cyborg.asset", 5);
				Register(MyCustomAssets, "PanKubeczek.asset", 5);
				Register(MyCustomAssets, "FigurkaBirdiego.asset", 5);
				Register(MyCustomAssets, "PrezentBirdie.asset", 0);
				Register(MyCustomAssets, "gra.asset", 5);
				Register(MyCustomAssets, "PrezentHoovie.asset", 0);
				Register(MyCustomAssets, "cyborgpresent.asset", 0);
				Register(MyCustomAssets, "ytgdItem.asset", 5);
				Register(MyCustomAssets, "ytgdItemPresent.asset", 0);
				Register(MyCustomAssets, "ottpakowanie.asset", 0);
				Register(MyCustomAssets, "PrezentColowsky.asset", 0);
				Register(MyCustomAssets2, "afryka.asset", 5);
				Register(MyCustomAssets2, "afrykapakuje.asset", 0);
				Register(MyCustomAssets, "ott.asset", 5);
				Register(MyCustomAssets2, "vocalloop.asset", 5);
				Register(MyCustomAssets2, "vocalPresent.asset", 0);
				Register(MyCustomAssets, "ParapcioPluszak.asset", 25);
				Register(MyCustomAssets, "PrezentSzymkabymka.asset", 0);
				Register(MyCustomAssets2, "mydlo.asset", 195);
				Register(MyCustomAssets2, "Buty.asset", 195);
				Register(MyCustomAssets, "JezusPainting.asset", 135);
				Register(MyCustomAssets, "KotletItem.asset", 195);
				Register(MyCustomAssets, "Picture Frame.asset", 255);
				Register(MyCustomAssets, "Pizza.asset", 195);
				Register(MyCustomAssets2, "Kon.asset", 45);
				Register(MyCustomAssets2, "Noz.asset", 165);
				Register(MyCustomAssets2, "Picie.asset", 150);
				LoadBundle();
				Logger.LogInfo((object)"CoddingCat.PartyBuddies v1.0.0 loaded");
			}
		}

		private void Register(AssetBundle bundle, string assetName, int rarity)
		{
			Item val = bundle.LoadAsset<Item>(assetName);
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Items.RegisterScrap(val, rarity, (LevelTypes)(-1));
		}

		internal static void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("CoddingCat.PartyBuddies");
			}
			Harmony.PatchAll();
		}

		private void LoadBundle()
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			bundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "bombel"));
			if ((Object)(object)bundle == (Object)null)
			{
				Logger.LogError((object)"Failed to load AssetBundle: bombel");
				return;
			}
			GameObject val = bundle.LoadAsset<GameObject>("PartyPoopers");
			if ((Object)(object)val != (Object)null)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val);
				Logger.LogInfo((object)"PartyPoopers prefab registered with NetworkManager");
			}
			else
			{
				Logger.LogError((object)"Failed to load PartyPoopers prefab from bundle");
			}
		}

		public static void SpawnBalloonsInShip()
		{
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			if ((!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) || (Object)(object)bundle == (Object)null)
			{
				return;
			}
			GameObject val = GameObject.Find("Environment/HangarShip");
			if ((Object)(object)val == (Object)null || (Object)(object)val.transform.Find("PartyPoopers(Clone)") != (Object)null)
			{
				return;
			}
			GameObject val2 = bundle.LoadAsset<GameObject>("PartyPoopers");
			if ((Object)(object)val2 == (Object)null)
			{
				Logger.LogError((object)"Failed to load PartyPoopers prefab");
				return;
			}
			GameObject val3 = Object.Instantiate<GameObject>(val2, val.transform);
			val3.transform.SetParent(val.gameObject.transform, false);
			val3.transform.localPosition = new Vector3(0.0575f, -0.1934f, -6.642f);
			NetworkObject val4 = default(NetworkObject);
			if (val3.TryGetComponent<NetworkObject>(ref val4))
			{
				val4.Spawn(false);
				Logger.LogInfo((object)"PartyPoopers spawned and networked successfully");
			}
			else
			{
				Logger.LogWarning((object)"PartyPoopers does not have a NetworkObject component!");
			}
		}
	}
	[HarmonyPatch(typeof(Items), "ValidateItemProperties")]
	public class BypassWeightValidation
	{
		[HarmonyPrefix]
		public static bool Prefix(Item item)
		{
			if (item.itemName == "kon wazy 500")
			{
				return false;
			}
			return true;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CoddingCat.PartyBuddies";

		public const string PLUGIN_NAME = "PartyBuddies";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace PartyBuddies.Patches
{
	public class ShotgunDropShake : GrabbableObject
	{
		[Header("Shake Settings")]
		[Tooltip("Maximum distance at which players will feel the shake")]
		public float shakeRadius = 15f;

		[Tooltip("Shake intensity for players close to the drop")]
		public ScreenShakeType shakeType = (ScreenShakeType)1;

		public override void OnHitGround()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).OnHitGround();
			if (((NetworkBehaviour)this).IsOwner)
			{
				Debug.Log((object)"Shotgun hit ground! Triggering shake.");
				ShakeNearbyPlayersServerRpc(((Component)this).transform.position);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void ShakeNearbyPlayersServerRpc(Vector3 dropPosition)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ShakeNearbyPlayersClientRpc(dropPosition);
		}

		[ClientRpc]
		private void ShakeNearbyPlayersClientRpc(Vector3 dropPosition)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_008f: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController;
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			float num = Vector3.Distance(((Component)val).transform.position, dropPosition);
			if (num <= shakeRadius)
			{
				ScreenShakeType val2 = shakeType;
				if (num > shakeRadius * 0.66f)
				{
					val2 = (ScreenShakeType)0;
				}
				else if (num > shakeRadius * 0.33f)
				{
					val2 = (ScreenShakeType)1;
				}
				Debug.Log((object)$"Shaking camera for player at distance {num:F2}m with {val2} shake");
				HUDManager.Instance.ShakeCamera(val2);
			}
		}
	}
	public class LightsOffAnimationTrigger : NetworkBehaviour
	{
		[CompilerGenerated]
		private sealed class <LightsOffSequenceCoroutine>d__8 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public LightsOffAnimationTrigger <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.shipLights.SetShipLightsServerRpc(false);
					<>2__current = (object)new WaitForSeconds(<>4__this.delayBeforeAnimation);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.TriggerAnimationClientRpc();
					return false;
				}
			}

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

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

		[Header("References")]
		public ShipLights shipLights;

		public Animator targetAnimator;

		[Header("Animation Settings")]
		public string animationTriggerName = "StartAnimation";

		public bool useAnimationTrigger = true;

		public float delayBeforeAnimation = 3f;

		[Header("Audio")]
		public AudioSource audioSource;

		public AudioClip animationClip;

		public void TriggerLightsOffSequence()
		{
			if (((NetworkBehaviour)this).IsServer || ((NetworkBehaviour)this).IsHost)
			{
				((MonoBehaviour)this).StartCoroutine(LightsOffSequenceCoroutine());
			}
		}

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

		[ClientRpc]
		private void TriggerAnimationClientRpc()
		{
			if ((Object)(object)targetAnimator != (Object)null)
			{
				if (useAnimationTrigger)
				{
					targetAnimator.SetTrigger(animationTriggerName);
				}
				else
				{
					targetAnimator.SetBool(animationTriggerName, true);
				}
			}
			if ((Object)(object)audioSource != (Object)null && (Object)(object)animationClip != (Object)null)
			{
				audioSource.PlayOneShot(animationClip);
			}
		}

		public void ResetSequence()
		{
			if (((NetworkBehaviour)this).IsServer || ((NetworkBehaviour)this).IsHost)
			{
				shipLights.SetShipLightsServerRpc(true);
				ResetAnimationClientRpc();
			}
		}

		[ClientRpc]
		private void ResetAnimationClientRpc()
		{
			if ((Object)(object)targetAnimator != (Object)null && !useAnimationTrigger)
			{
				targetAnimator.SetBool(animationTriggerName, false);
			}
		}
	}
	[HarmonyPatch(typeof(TVScript))]
	public class ExampleTVPatch
	{
		[HarmonyPatch("SwitchTVLocalClient")]
		[HarmonyPrefix]
		private static void SwitchTVPrefix(TVScript __instance)
		{
			StartOfRound.Instance.shipRoomLights.SetShipLightsBoolean(__instance.tvOn);
		}
	}
	public class GuaranteedGiftBoxItem : GrabbableObject
	{
		[CompilerGenerated]
		private sealed class <SetObjectToHitGroundSFX>d__20 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public GrabbableObject g;

			public GuaranteedGiftBoxItem <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					g.reachedFloorTarget = false;
					g.hasHitGround = false;
					g.fallTime = 0f;
					return false;
				}
			}

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

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

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

			private object <>2__current;

			public NetworkObjectReference netRef;

			public int value;

			public Vector3 startPos;

			public GuaranteedGiftBoxItem <>4__this;

			private NetworkObject <netObj>5__1;

			private float <start>5__2;

			private GrabbableObject <g>5__3;

			private Transform <parent>5__4;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<netObj>5__1 = null;
				<g>5__3 = null;
				<parent>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0111: Unknown result type (might be due to invalid IL or missing references)
				//IL_0116: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Expected O, but got Unknown
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<netObj>5__1 = null;
					<start>5__2 = Time.realtimeSinceStartup;
					goto IL_0062;
				case 1:
					<>1__state = -1;
					goto IL_0062;
				case 2:
					{
						<>1__state = -1;
						<g>5__3 = ((Component)<netObj>5__1).GetComponent<GrabbableObject>();
						<g>5__3.SetScrapValue(value);
						<parent>5__4 = <>4__this.GetParentOfGiftObject();
						((Component)<g>5__3).transform.SetParent(<parent>5__4, true);
						<g>5__3.startFallingPosition = startPos;
						<g>5__3.fallTime = 0f;
						<g>5__3.hasHitGround = false;
						<g>5__3.reachedFloorTarget = false;
						if ((Object)(object)<>4__this.previousPlayerHeldBy != (Object)null && <>4__this.previousPlayerHeldBy.isInHangarShipRoom)
						{
							<>4__this.previousPlayerHeldBy.SetItemInElevator(true, true, <g>5__3);
						}
						return false;
					}
					IL_0062:
					if (Time.realtimeSinceStartup - <start>5__2 < 8f && !((NetworkObjectReference)(ref netRef)).TryGet(ref <netObj>5__1, (NetworkManager)null))
					{
						<>2__current = (object)new WaitForSeconds(0.03f);
						<>1__state = 1;
						return true;
					}
					if ((Object)(object)<netObj>5__1 == (Object)null)
					{
						return false;
					}
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 2;
					return true;
				}
			}

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

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

		[Header("Guaranteed Drop")]
		public Item guaranteedItem;

		private GameObject objectInPresent;

		private int objectInPresentValue;

		private Item objectInPresentItem;

		public ParticleSystem PoofParticle;

		public AudioSource presentAudio;

		public AudioClip openGiftAudio;

		private PlayerControllerB previousPlayerHeldBy;

		private bool hasUsedGift;

		private bool loadedItemFromSave;

		public override void LoadItemSaveData(int saveData)
		{
			((GrabbableObject)this).LoadItemSaveData(saveData);
			objectInPresentItem = guaranteedItem;
			objectInPresent = guaranteedItem.spawnPrefab;
			Random random = new Random((int)base.targetFloorPosition.x + (int)base.targetFloorPosition.y);
			objectInPresentValue = (int)((float)random.Next(guaranteedItem.minValue + 25, guaranteedItem.maxValue + 35) * RoundManager.Instance.scrapValueMultiplier);
			loadedItemFromSave = true;
		}

		public override int GetItemDataToSave()
		{
			((GrabbableObject)this).GetItemDataToSave();
			return guaranteedItem.itemId;
		}

		public override void InitializeAfterPositioning()
		{
			((GrabbableObject)this).InitializeAfterPositioning();
			if (!loadedItemFromSave && ((NetworkBehaviour)this).IsServer)
			{
				objectInPresentItem = guaranteedItem;
				objectInPresent = guaranteedItem.spawnPrefab;
				Random random = new Random((int)base.targetFloorPosition.x + (int)base.targetFloorPosition.y);
				objectInPresentValue = (int)((float)random.Next(guaranteedItem.minValue + 25, guaranteedItem.maxValue + 35) * RoundManager.Instance.scrapValueMultiplier);
			}
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			previousPlayerHeldBy = base.playerHeldBy;
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!((Object)(object)base.playerHeldBy == (Object)null) && !hasUsedGift)
			{
				hasUsedGift = true;
				base.playerHeldBy.activatingItem = true;
				OpenGiftBoxServerRpc();
			}
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				base.playerHeldBy.activatingItem = false;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void OpenGiftBoxServerRpc()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_00fe: 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)
			GameObject val = null;
			Vector3 val2 = ((Component)this).transform.position + Vector3.up * 0.25f;
			if ((Object)(object)objectInPresent == (Object)null)
			{
				Debug.LogError((object)"GuaranteedGiftBox: Missing guaranteed item!");
			}
			else
			{
				Transform parentOfGiftObject = GetParentOfGiftObject();
				val = Object.Instantiate<GameObject>(objectInPresent, val2, Quaternion.identity, parentOfGiftObject);
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				component.startFallingPosition = val2;
				component.targetFloorPosition = component.GetItemFloorPosition(((Component)this).transform.position);
				component.SetScrapValue(objectInPresentValue);
				((MonoBehaviour)this).StartCoroutine(SetObjectToHitGroundSFX(component));
				if ((Object)(object)previousPlayerHeldBy != (Object)null && previousPlayerHeldBy.isInHangarShipRoom)
				{
					previousPlayerHeldBy.SetItemInElevator(true, true, component);
				}
				((NetworkBehaviour)component).NetworkObject.Spawn(false);
			}
			if ((Object)(object)val != (Object)null)
			{
				OpenGiftBoxClientRpc(NetworkObjectReference.op_Implicit(val.GetComponent<NetworkObject>()), objectInPresentValue, val2);
			}
			OpenGiftBoxNoPresentClientRpc();
		}

		[ClientRpc]
		public void OpenGiftBoxNoPresentClientRpc()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			PoofParticle.Play();
			presentAudio.PlayOneShot(openGiftAudio);
			WalkieTalkie.TransmitOneShotAudio(presentAudio, openGiftAudio, 1f);
			RoundManager.Instance.PlayAudibleNoise(((Component)presentAudio).transform.position, 8f, 0.5f, 0, base.isInShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0);
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				base.playerHeldBy.activatingItem = false;
				((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy);
			}
		}

		[ClientRpc]
		public void OpenGiftBoxClientRpc(NetworkObjectReference netRef, int value, Vector3 startPos)
		{
			//IL_0070: 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)
			PoofParticle.Play();
			presentAudio.PlayOneShot(openGiftAudio);
			WalkieTalkie.TransmitOneShotAudio(presentAudio, openGiftAudio, 1f);
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				base.playerHeldBy.activatingItem = false;
				((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy);
			}
			if (!((NetworkBehaviour)this).IsServer)
			{
				((MonoBehaviour)this).StartCoroutine(waitForGiftPresentToSpawnOnClient(netRef, value, startPos));
			}
		}

		[IteratorStateMachine(typeof(<waitForGiftPresentToSpawnOnClient>d__19))]
		private IEnumerator waitForGiftPresentToSpawnOnClient(NetworkObjectReference netRef, int value, Vector3 startPos)
		{
			//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)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <waitForGiftPresentToSpawnOnClient>d__19(0)
			{
				<>4__this = this,
				netRef = netRef,
				value = value,
				startPos = startPos
			};
		}

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

		private Transform GetParentOfGiftObject()
		{
			if (((Object)(object)previousPlayerHeldBy != (Object)null && previousPlayerHeldBy.isInElevator) || StartOfRound.Instance.inShipPhase)
			{
				return StartOfRound.Instance.elevatorTransform;
			}
			return null;
		}
	}
	public class PartyPopper : GrabbableObject
	{
		[Header("Particles (preloaded on prefab)")]
		public ParticleSystem particleSystemToPlay;

		private bool hasBeenUsed;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (used && !hasBeenUsed && !((Object)(object)base.playerHeldBy == (Object)null))
			{
				hasBeenUsed = true;
				base.playerHeldBy.activatingItem = true;
				ActivateParticlesServerRpc();
			}
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				base.playerHeldBy.activatingItem = false;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void ActivateParticlesServerRpc()
		{
			ActivateParticlesClientRpc();
		}

		[ClientRpc]
		private void ActivateParticlesClientRpc()
		{
			if ((Object)(object)particleSystemToPlay != (Object)null)
			{
				particleSystemToPlay.Stop(true, (ParticleSystemStopBehavior)0);
				particleSystemToPlay.Play();
			}
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				base.playerHeldBy.activatingItem = false;
			}
		}
	}
}