Decompiled source of Lethal Pyrkon v1.2.1

PyrkonScripts.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PyrkonScripts.NetcodePatcher;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.UI;
using UnityEngine.Video;

[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("PyrkonScripts")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PyrkonScripts")]
[assembly: AssemblyTitle("PyrkonScripts")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace PyrkonScripts
{
	public class BananaGunItem : GrabbableObject
	{
		private int ammoLoaded;

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

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			base.playerHeldBy.equippedUsableItemQE = false;
		}

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

		public override int GetItemDataToSave()
		{
			return ammoLoaded;
		}

		public override void LoadItemSaveData(int saveData)
		{
			((GrabbableObject)this).LoadItemSaveData(saveData);
			ammoLoaded = saveData;
		}

		public override void ItemInteractLeftRight(bool right)
		{
			((GrabbableObject)this).ItemInteractLeftRight(right);
			if (right)
			{
				int num = FindAmmoInInventory();
				if (num != -1 && ammoLoaded < 3)
				{
					ammoLoaded++;
					base.playerHeldBy.DestroyItemInSlotAndSync(num);
					SyncAmmoRpc(ammoLoaded);
				}
			}
		}

		private int FindAmmoInInventory()
		{
			for (int i = 0; i < base.playerHeldBy.ItemSlots.Length; i++)
			{
				if (!((Object)(object)base.playerHeldBy.ItemSlots[i] == (Object)null))
				{
					GrabbableObject obj = base.playerHeldBy.ItemSlots[i];
					GunAmmo val = (GunAmmo)(object)((obj is GunAmmo) ? obj : null);
					if ((Object)(object)val != (Object)null && val.ammoType == 102)
					{
						return i;
					}
				}
			}
			if ((Object)(object)base.playerHeldBy.ItemOnlySlot != (Object)null)
			{
				GrabbableObject itemOnlySlot = base.playerHeldBy.ItemOnlySlot;
				GunAmmo val2 = (GunAmmo)(object)((itemOnlySlot is GunAmmo) ? itemOnlySlot : null);
				if ((Object)(object)val2 != (Object)null && val2.ammoType == 102)
				{
					return 50;
				}
			}
			return -1;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SyncAmmoRpc(int ammo)
		{
			//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_0043: 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_0051: 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_0068: 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)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(192557183u, val3, val, (SendTo)6, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, ammo);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 192557183u, val3, val, (SendTo)6, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					ammoLoaded = Mathf.Clamp(ammo, 0, 3);
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(192557183u, new RpcReceiveHandler(__rpc_handler_192557183), "SyncAmmoRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_192557183(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 ammo = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref ammo);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BananaGunItem)(object)target).SyncAmmoRpc(ammo);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "BananaGunItem";
		}
	}
	public class BukaAI : EnemyAI
	{
		private enum State
		{
			SearchingForPlayer,
			AttackingPlayer
		}

		public override void DoAIInterval()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: 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_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead && StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = 2f;
				if (FoundClosestPlayerInRange(50f, 1f) || ((Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 50f && ((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 50, -1f, (Transform)null)))
				{
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					((EnemyAI)this).SwitchToBehaviourState(1);
				}
				break;
			case 1:
				base.agent.speed = 1f;
				if (!FoundClosestPlayerInRange(10f, 1f) || ((Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 10f && !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 10, -1f, (Transform)null)))
				{
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					((EnemyAI)this).SwitchToBehaviourState(0);
				}
				if ((Object)(object)base.targetPlayer != (Object)null)
				{
					((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				}
				break;
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).OnCollideWithPlayer(other);
			PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
			if ((Object)(object)val != (Object)null)
			{
				val.KillPlayer(new Vector3(0f, 100f, 0f), true, (CauseOfDeath)18, 10, default(Vector3), false);
			}
		}

		private bool TargetClosestPlayerInAnyCase()
		{
			//IL_001f: 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)
			base.mostOptimalDistance = 2000f;
			base.targetPlayer = null;
			for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
			{
				base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
				if (base.tempDist < base.mostOptimalDistance)
				{
					base.mostOptimalDistance = base.tempDist;
					base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
				}
			}
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				return false;
			}
			return true;
		}

		private bool FoundClosestPlayerInRange(float range, float senseRange)
		{
			//IL_0054: 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)
			((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f, false, false, true);
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f, false, false, true);
				range = senseRange;
			}
			return (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void JumpToFearLevelWithDistanceRpc(float distance, float fearLevel)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_0043: 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_0051: 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_0074: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2655962002u, val3, val, (SendTo)6, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref distance, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref fearLevel, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2655962002u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position) < distance)
				{
					GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(fearLevel, true);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void SetAnimRpc(bool isBool, int anim, bool boolValue)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Invalid comparison between Unknown and I4
			//IL_0043: 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_0051: 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_0074: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3975890095u, val3, val, (SendTo)6, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isBool, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, anim);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref boolValue, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 3975890095u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (isBool)
				{
					base.creatureAnimator.SetBool(anim, boolValue);
				}
				else
				{
					base.creatureAnimator.SetTrigger(anim);
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2655962002u, new RpcReceiveHandler(__rpc_handler_2655962002), "JumpToFearLevelWithDistanceRpc");
			((NetworkBehaviour)this).__registerRpc(3975890095u, new RpcReceiveHandler(__rpc_handler_3975890095), "SetAnimRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_2655962002(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float distance = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref distance, default(ForPrimitives));
				float fearLevel = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref fearLevel, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BukaAI)(object)target).JumpToFearLevelWithDistanceRpc(distance, fearLevel);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		protected internal override string __getTypeName()
		{
			return "BukaAI";
		}
	}
	[Serializable]
	public class DamageLevel
	{
		public List<Mesh> meshes = new List<Mesh>();

		public List<MeshFilter> meshFilters = new List<MeshFilter>();
	}
	public class DepositableItem : GrabbableObject
	{
		[Space(10f)]
		[Header("DepositableItem")]
		public int depositAmount = 50;

		public ScanNodeProperties? scanNode;

		public int hp = 3;

		public List<DamageLevel> damageLevels = new List<DamageLevel>();

		public GameObject? destructionObject;

		private PlayerControllerB? lastHeldBy;

		public override int GetItemDataToSave()
		{
			return hp;
		}

		public override void LoadItemSaveData(int saveData)
		{
			((GrabbableObject)this).LoadItemSaveData(saveData);
			DamageItemRpc(saveData);
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (!((Object)(object)scanNode == (Object)null))
			{
				scanNode.subText = $"Kaucja: ${depositAmount}";
			}
		}

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

		public override void OnHitGround()
		{
			((GrabbableObject)this).OnHitGround();
			if (!((Object)(object)lastHeldBy == (Object)null) && (!((Object)(object)lastHeldBy != (Object)null) || !lastHeldBy.isInHangarShipRoom) && ((NetworkBehaviour)this).IsServer)
			{
				hp--;
				DamageItemRpc(hp);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void DamageItemRpc(int health)
		{
			//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_0043: 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_0051: 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_0068: 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)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: 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)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1629268537u, val3, val, (SendTo)6, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, health);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1629268537u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			hp = health;
			if (hp > -1 && damageLevels[hp] != null)
			{
				Debug.Log((object)"Changing depositable item mesh");
				if (damageLevels[hp].meshes.Count == damageLevels[hp].meshFilters.Count)
				{
					for (int i = 0; i < damageLevels[hp].meshes.Count; i++)
					{
						damageLevels[hp].meshFilters[i].mesh = damageLevels[hp].meshes[i];
					}
				}
			}
			else if (hp == -1 && (Object)(object)base.playerHeldBy == (Object)null)
			{
				Debug.Log((object)"Depositable item destroyed");
				if ((Object)(object)destructionObject != (Object)null)
				{
					Object.Instantiate<GameObject>(destructionObject, ((Component)this).transform.position, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform);
				}
				if (((NetworkBehaviour)this).IsServer)
				{
					((NetworkBehaviour)this).NetworkObject.Despawn(true);
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1629268537u, new RpcReceiveHandler(__rpc_handler_1629268537), "DamageItemRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_1629268537(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 health = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref health);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DepositableItem)(object)target).DamageItemRpc(health);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string? __getTypeName()
		{
			return "DepositableItem";
		}
	}
	public class DepositMachine : NetworkBehaviour
	{
		public static DepositMachine Instance;

		public TMP_Text? monitorText;

		public AudioSource? audioSource;

		public Animator? animator;

		public PlaceableShipObject? shipObj;

		public AudioClip[]? clips;

		public InteractTrigger? emptyTrigger;

		public int maxCapacity = 10;

		public Transform? bagSpawnPos;

		public NetworkVariable<int> capacity = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		[TextArea]
		public string[] possibleSentences = new string[14]
		{
			"You're a true ecologist\n\nyour deposit: $[AMOUNT]", "Keep the company clean\n\nyour deposit: $[AMOUNT]", "We appreciate you following the rules\n\nyour deposit: $[AMOUNT]", "Thank you for depositing\n\nyour deposit: $[AMOUNT]", "Your work is looked upon\n\nyour deposit: $[AMOUNT]", "What an accomplishment\n\nyour deposit: $[AMOUNT]", "Keep up the pace\n\nyour deposit: $[AMOUNT]", "Sincerely thank you\n\nyour deposit: $[AMOUNT]", "You're the greatest asset\n\nyour deposit: $[AMOUNT]", "We reward your commitment\n\nyour deposit: $[AMOUNT]",
			"Must keep the ship tidy\n\nyour deposit: $[AMOUNT]", "Baboon Hawks are thankful\n\nyour deposit: $[AMOUNT]", "Your job is valued\n\nyour deposit: $[AMOUNT]", "Please pick up the trash\n\nyour deposit: $[AMOUNT]"
		};

		private Coroutine? textDisplay;

		private Coroutine? disableTrigger;

		private Item? emptyBag = Plugin.trash;

		private Terminal? terminal;

		private void Awake()
		{
			terminal = Object.FindObjectOfType<Terminal>();
			Instance = this;
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			NetworkVariable<int> obj = capacity;
			obj.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnCapacityChanged));
			if (ES3.KeyExists("DepositMachineCapacity", GameNetworkManager.Instance.currentSaveFileName) && ((NetworkBehaviour)this).IsServer)
			{
				int value = ES3.Load<int>("DepositMachineCapacity", GameNetworkManager.Instance.currentSaveFileName);
				capacity.Value = value;
			}
		}

		public void OnCapacityChanged(int prevValue, int newValue)
		{
			if (newValue >= maxCapacity && (Object)(object)emptyTrigger != (Object)null)
			{
				emptyTrigger.interactable = true;
			}
		}

		public void EmptyDeposit(PlayerControllerB player)
		{
			EmptyDepositRpc(player.playerClientId);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void EmptyDepositRpc(ulong clientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: 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)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(79017483u, val3, val, (SendTo)6, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 79017483u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			ulong clientId2 = clientId;
			PlayerControllerB val4 = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB plr) => plr.playerClientId == clientId2));
			if ((Object)(object)val4 == (Object)null || (Object)(object)animator == (Object)null || (Object)(object)emptyTrigger == (Object)null || (Object)(object)emptyBag == (Object)null || (Object)(object)bagSpawnPos == (Object)null)
			{
				return;
			}
			emptyTrigger.interactable = false;
			if (disableTrigger != null)
			{
				((MonoBehaviour)this).StopCoroutine(disableTrigger);
			}
			disableTrigger = ((MonoBehaviour)this).StartCoroutine(disablePlaceableTrigger(0.5f));
			if ((Object)(object)audioSource != (Object)null && clips != null)
			{
				audioSource.PlayOneShot(clips[1]);
			}
			DisplayText("Thank you <color=#0DA2FF>" + val4.playerUsername + "</color> for emptying the Company Depositor", 9f);
			if (((NetworkBehaviour)this).IsServer)
			{
				GameObject val5 = Object.Instantiate<GameObject>(emptyBag.spawnPrefab, bagSpawnPos.position, Quaternion.identity, StartOfRound.Instance.elevatorTransform);
				val5.GetComponent<NetworkObject>().Spawn(false);
				capacity.Value = 0;
				if (StartOfRound.Instance.inShipPhase)
				{
					ES3.Save<int>("DepositMachineCapacity", capacity.Value, GameNetworkManager.Instance.currentSaveFileName);
				}
			}
			((MonoBehaviour)this).StartCoroutine(openHatchWithDelay(4f));
		}

		private IEnumerator openHatchWithDelay(float time)
		{
			if (!((Object)(object)animator == (Object)null))
			{
				animator.SetBool("OpenHatch", true);
				yield return (object)new WaitForSeconds(time);
				animator.SetBool("OpenHatch", false);
			}
		}

		private IEnumerator disablePlaceableTrigger(float time)
		{
			if ((Object)(object)shipObj != (Object)null)
			{
				shipObj.placeObjectCollider.enabled = false;
			}
			yield return (object)new WaitForSeconds(time);
			if ((Object)(object)shipObj != (Object)null)
			{
				shipObj.placeObjectCollider.enabled = true;
			}
		}

		public void DepositCurrentItem(PlayerControllerB player)
		{
			GrabbableObject currentlyHeldObjectServer = player.currentlyHeldObjectServer;
			if ((Object)(object)currentlyHeldObjectServer != (Object)null && currentlyHeldObjectServer is DepositableItem)
			{
				DepositableItem depositableItem = (DepositableItem)(object)currentlyHeldObjectServer;
				if (capacity.Value < maxCapacity)
				{
					int index = Random.Range(0, possibleSentences.Length);
					GetRewardRpc(depositableItem.depositAmount, index);
					((GrabbableObject)depositableItem).playerHeldBy.DespawnHeldObject();
				}
				else
				{
					EmptyNotifyRpc();
				}
			}
			else
			{
				HUDManager.Instance.DisplayTip("Company Deposit", "Please insert depositable item", true, false, "LC_Tip1");
			}
		}

		private IEnumerator displayTextAfterDelay(float time, int characters)
		{
			if (!((Object)(object)monitorText == (Object)null))
			{
				while (monitorText.maxVisibleCharacters <= characters)
				{
					yield return (object)new WaitForSeconds(time);
					TMP_Text? obj = monitorText;
					obj.maxVisibleCharacters += 1;
				}
			}
		}

		public void DisplayText(string text, float fontSize = 6f)
		{
			if (!((Object)(object)monitorText == (Object)null))
			{
				monitorText.fontSize = fontSize;
				monitorText.text = text;
				monitorText.maxVisibleCharacters = 0;
				if (textDisplay != null)
				{
					((MonoBehaviour)this).StopCoroutine(textDisplay);
				}
				textDisplay = ((MonoBehaviour)this).StartCoroutine(displayTextAfterDelay(0.05f, text.Length));
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void EmptyNotifyRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2084601195u, val3, val, (SendTo)6, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2084601195u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1)
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				DisplayText("<color=#880808>Depositor is full.</color>\n\nPlease empty using the <color=#50BD15>HATCH</color> located on your right");
				if ((Object)(object)audioSource != (Object)null && clips != null)
				{
					audioSource.PlayOneShot(clips[1]);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void GetRewardRpc(int kaucja, int index)
		{
			//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_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2958306765u, val3, val, (SendTo)6, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, kaucja);
				BytePacker.WriteValueBitPacked(val2, index);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2958306765u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if ((Object)(object)terminal == (Object)null)
			{
				return;
			}
			if (((NetworkBehaviour)this).IsServer)
			{
				NetworkVariable<int> obj = capacity;
				obj.Value += 1;
				if (StartOfRound.Instance.inShipPhase)
				{
					ES3.Save<int>("DepositMachineCapacity", capacity.Value, GameNetworkManager.Instance.currentSaveFileName);
				}
			}
			DisplayText(possibleSentences[index].Replace("[AMOUNT]", kaucja.ToString()));
			Terminal? obj2 = terminal;
			obj2.groupCredits += kaucja;
			if ((Object)(object)audioSource != (Object)null && clips != null)
			{
				audioSource.PlayOneShot(clips[0]);
			}
		}

		protected override void __initializeVariables()
		{
			if (capacity == null)
			{
				throw new Exception("DepositMachine.capacity cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)capacity).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)capacity, "capacity");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)capacity);
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(79017483u, new RpcReceiveHandler(__rpc_handler_79017483), "EmptyDepositRpc");
			((NetworkBehaviour)this).__registerRpc(2084601195u, new RpcReceiveHandler(__rpc_handler_2084601195), "EmptyNotifyRpc");
			((NetworkBehaviour)this).__registerRpc(2958306765u, new RpcReceiveHandler(__rpc_handler_2958306765), "GetRewardRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_79017483(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)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DepositMachine)(object)target).EmptyDepositRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_2958306765(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 kaucja = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref kaucja);
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DepositMachine)(object)target).GetRewardRpc(kaucja, index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string? __getTypeName()
		{
			return "DepositMachine";
		}
	}
	public class JayPhoneItem : GrabbableObject
	{
		private const int SCREEN_MATERIAL_INDEX = 0;

		public Material[] pageMaterials;

		public Material disabledMaterial;

		public MeshRenderer mesh;

		public AudioClip swapArtClip;

		public AudioClip enableClip;

		public AudioClip disableClip;

		public AudioSource phoneAudioSource;

		private int currentIndex = 0;

		private PlayerControllerB lastHeldBy;

		private bool isEnabled = false;

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			lastHeldBy = base.playerHeldBy;
			lastHeldBy.equippedUsableItemQE = true;
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			lastHeldBy.equippedUsableItemQE = false;
			SetState(enabled: false);
			base.isBeingUsed = false;
		}

		public override void UseUpBatteries()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).UseUpBatteries();
			SetState(enabled: false);
			phoneAudioSource.PlayOneShot(disableClip);
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 7f, 0.4f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
		}

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

		public void SetPage(int index)
		{
			if (index >= 0 && index < pageMaterials.Length)
			{
				currentIndex = index;
				if (isEnabled)
				{
					List<Material> list = new List<Material>(((Renderer)mesh).materials);
					list[0] = pageMaterials[currentIndex];
					((Renderer)mesh).materials = list.ToArray();
					phoneAudioSource.PlayOneShot(swapArtClip);
				}
			}
		}

		public void SetState(bool enabled)
		{
			isEnabled = enabled;
			List<Material> list = new List<Material>(((Renderer)mesh).materials);
			list[0] = (isEnabled ? pageMaterials[currentIndex] : disabledMaterial);
			((Renderer)mesh).materials = list.ToArray();
			phoneAudioSource.PlayOneShot(isEnabled ? enableClip : disableClip);
		}

		public override void ItemInteractLeftRight(bool right)
		{
			((GrabbableObject)this).ItemInteractLeftRight(right);
			if (!isEnabled)
			{
				base.isBeingUsed = false;
			}
			else
			{
				base.isBeingUsed = true;
			}
			int num = currentIndex + (right ? 1 : (-1));
			if (num < 0)
			{
				num = pageMaterials.Length - 1;
			}
			else if (num >= pageMaterials.Length)
			{
				num = 0;
			}
			SetPage(num);
		}

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

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

		protected internal override string __getTypeName()
		{
			return "JayPhoneItem";
		}
	}
	public class MaxplaierCapItem : GrabbableObject
	{
		public GameObject? CapHeadModel;

		private GameObject? activeCapModel;

		public override void PocketItem()
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: 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)
			((GrabbableObject)this).PocketItem();
			int num = 0;
			GrabbableObject[] itemSlots = base.playerHeldBy.ItemSlots;
			foreach (GrabbableObject val in itemSlots)
			{
				if (val is MaxplaierCapItem)
				{
					MaxplaierCapItem maxplaierCapItem = (MaxplaierCapItem)(object)val;
					if ((Object)(object)maxplaierCapItem.activeCapModel != (Object)null)
					{
						num++;
					}
				}
			}
			if (num != 0)
			{
				return;
			}
			activeCapModel = Object.Instantiate<GameObject>(CapHeadModel, base.playerHeldBy.headCostumeContainer.parent.Find("HeadPoint"));
			if ((Object)(object)activeCapModel != (Object)null)
			{
				if ((Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					activeCapModel.SetActive(false);
				}
				activeCapModel.transform.localPosition = Vector3.zero;
				activeCapModel.transform.localRotation = Quaternion.identity;
				activeCapModel.transform.localScale = Vector3.one;
			}
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			if ((Object)(object)activeCapModel != (Object)null)
			{
				Object.Destroy((Object)(object)activeCapModel);
			}
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			if ((Object)(object)activeCapModel != (Object)null)
			{
				Object.Destroy((Object)(object)activeCapModel);
			}
		}

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

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

		protected internal override string? __getTypeName()
		{
			return "MaxplaierCapItem";
		}
	}
	public class OiikaBroomItem : GrabbableObject
	{
		public int broomHitForce = 1;

		public bool reelingUp;

		public bool isHoldingButton;

		private RaycastHit rayHit;

		private Coroutine reelingUpCoroutine;

		private RaycastHit[] objectsHitByBroom;

		private List<RaycastHit> objectsHitByBroomList = new List<RaycastHit>();

		public AudioClip reelUp;

		public AudioClip swing;

		public AudioClip[] hitSFX;

		public AudioSource shovelAudio;

		private PlayerControllerB previousPlayerHeldBy;

		private int shovelMask = 1084754248;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if ((Object)(object)base.playerHeldBy == (Object)null)
			{
				return;
			}
			isHoldingButton = buttonDown;
			if (!reelingUp && buttonDown)
			{
				reelingUp = true;
				previousPlayerHeldBy = base.playerHeldBy;
				if (reelingUpCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine);
				}
				reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(reelUpShovel());
			}
		}

		private IEnumerator reelUpShovel()
		{
			base.playerHeldBy.activatingItem = true;
			base.playerHeldBy.twoHanded = true;
			base.playerHeldBy.playerBodyAnimator.ResetTrigger("shovelHit");
			base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
			shovelAudio.PlayOneShot(reelUp);
			ReelUpSFXServerRpc();
			yield return (object)new WaitForSeconds(0.35f);
			yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld));
			SwingShovel(!base.isHeld);
			yield return (object)new WaitForSeconds(0.13f);
			yield return (object)new WaitForEndOfFrame();
			HitShovel(!base.isHeld);
			yield return (object)new WaitForSeconds(0.3f);
			reelingUp = false;
			reelingUpCoroutine = null;
		}

		[ServerRpc]
		public void ReelUpSFXServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(350106391u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 350106391u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				ReelUpSFXClientRpc();
			}
		}

		[ClientRpc]
		public void ReelUpSFXClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1780050249u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1780050249u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (!((NetworkBehaviour)this).IsOwner)
				{
					shovelAudio.PlayOneShot(reelUp);
				}
			}
		}

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

		public void SwingShovel(bool cancel = false)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
			if (!cancel)
			{
				shovelAudio.PlayOneShot(swing);
				previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false);
			}
		}

		public void HitShovel(bool cancel = false)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f9: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: 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_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: 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_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0530: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)previousPlayerHeldBy == (Object)null)
			{
				Debug.LogError((object)"Previousplayerheldby is null on this client when HitShovel is called.");
				return;
			}
			previousPlayerHeldBy.activatingItem = false;
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			int num = -1;
			if (!cancel)
			{
				previousPlayerHeldBy.twoHanded = false;
				objectsHitByBroom = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, shovelMask, (QueryTriggerInteraction)2);
				objectsHitByBroomList = objectsHitByBroom.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
				List<EnemyAI> list = new List<EnemyAI>();
				IHittable val2 = default(IHittable);
				for (int num2 = 0; num2 < objectsHitByBroomList.Count; num2++)
				{
					RaycastHit val = objectsHitByBroomList[num2];
					Debug.Log((object)((Object)((Component)((RaycastHit)(ref val)).transform).gameObject).name);
					val = objectsHitByBroomList[num2];
					if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8)
					{
						val = objectsHitByBroomList[num2];
						if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
						{
							val = objectsHitByBroomList[num2];
							if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2))
							{
								continue;
							}
							val = objectsHitByBroomList[num2];
							if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)
							{
								continue;
							}
							val = objectsHitByBroomList[num2];
							if (!(((RaycastHit)(ref val)).point == Vector3.zero))
							{
								Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position;
								RaycastHit val3 = objectsHitByBroomList[num2];
								if (Physics.Linecast(position, ((RaycastHit)(ref val3)).point, ref val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
								{
									continue;
								}
							}
							flag = true;
							Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
							Vector3 position2 = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position;
							val = objectsHitByBroomList[num2];
							Debug.DrawLine(position2, ((RaycastHit)(ref val)).point, Color.green, 5f);
							try
							{
								val = objectsHitByBroomList[num2];
								EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<EnemyAICollisionDetect>();
								if ((Object)(object)component != (Object)null)
								{
									if (!((Object)(object)component.mainScript == (Object)null) && !list.Contains(component.mainScript) && (!StartOfRound.Instance.hangarDoorsClosed || component.mainScript.isInsidePlayerShip == previousPlayerHeldBy.isInHangarShipRoom))
									{
										goto IL_03ed;
									}
									continue;
								}
								val = objectsHitByBroomList[num2];
								if (!((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<PlayerControllerB>() != (Object)null))
								{
									goto IL_03ed;
								}
								if (flag3)
								{
									continue;
								}
								flag3 = true;
								val = objectsHitByBroomList[num2];
								PlayerControllerB component2 = ((Component)((RaycastHit)(ref val)).transform).GetComponent<PlayerControllerB>();
								if ((Object)(object)component2 != (Object)null)
								{
									bool flag4 = component2.playerSteamId == 76561198010917842L;
									bool flag5 = val2.Hit(flag4 ? 5 : broomHitForce, forward, previousPlayerHeldBy, true, 1);
									if (flag5 && (Object)(object)component != (Object)null)
									{
										list.Add(component.mainScript);
									}
									if (!flag2)
									{
										flag2 = flag5;
									}
								}
								else
								{
									bool flag6 = val2.Hit(broomHitForce, forward, previousPlayerHeldBy, true, 1);
									if (flag6 && (Object)(object)component != (Object)null)
									{
										list.Add(component.mainScript);
									}
									if (!flag2)
									{
										flag2 = flag6;
									}
								}
								goto end_IL_0324;
								IL_03ed:
								bool flag7 = val2.Hit(broomHitForce, forward, previousPlayerHeldBy, true, 1);
								if (flag7 && (Object)(object)component != (Object)null)
								{
									Debug.Log((object)(component.mainScript.enemyType.enemyName + " has been hit by force: " + broomHitForce + " true: " + flag7));
									list.Add(component.mainScript);
								}
								if (!flag2)
								{
									flag2 = flag7;
								}
								end_IL_0324:;
							}
							catch (Exception arg)
							{
								Debug.Log((object)$"Exception caught when hitting object with shovel from player #{previousPlayerHeldBy.playerClientId}: {arg}");
							}
							continue;
						}
					}
					val = objectsHitByBroomList[num2];
					if (((RaycastHit)(ref val)).collider.isTrigger)
					{
						continue;
					}
					flag = true;
					val = objectsHitByBroomList[num2];
					string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag;
					for (int num3 = 0; num3 < StartOfRound.Instance.footstepSurfaces.Length; num3++)
					{
						if (StartOfRound.Instance.footstepSurfaces[num3].surfaceTag == tag)
						{
							num = num3;
							break;
						}
					}
				}
			}
			if (flag)
			{
				RoundManager.PlayRandomClip(shovelAudio, hitSFX, true, 1f, 0, 1000);
				Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
				if (!flag2 && num != -1)
				{
					shovelAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
					WalkieTalkie.TransmitOneShotAudio(shovelAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f);
				}
				base.playerHeldBy.playerBodyAnimator.SetTrigger("shovelHit");
				HitBroomServerRpc(num);
			}
		}

		[ServerRpc]
		public void HitBroomServerRpc(int hitSurfaceID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(458182727u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, hitSurfaceID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 458182727u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				HitBroomClientRpc(hitSurfaceID);
			}
		}

		[ClientRpc]
		public void HitBroomClientRpc(int hitSurfaceID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2914920080u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, hitSurfaceID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2914920080u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!((NetworkBehaviour)this).IsOwner)
			{
				RoundManager.PlayRandomClip(shovelAudio, hitSFX, true, 1f, 0, 1000);
				if (hitSurfaceID != -1)
				{
					HitSurfaceWithShovel(hitSurfaceID);
				}
			}
		}

		private void HitSurfaceWithShovel(int hitSurfaceID)
		{
			shovelAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX);
			WalkieTalkie.TransmitOneShotAudio(shovelAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f);
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(350106391u, new RpcReceiveHandler(__rpc_handler_350106391), "ReelUpSFXServerRpc");
			((NetworkBehaviour)this).__registerRpc(1780050249u, new RpcReceiveHandler(__rpc_handler_1780050249), "ReelUpSFXClientRpc");
			((NetworkBehaviour)this).__registerRpc(458182727u, new RpcReceiveHandler(__rpc_handler_458182727), "HitBroomServerRpc");
			((NetworkBehaviour)this).__registerRpc(2914920080u, new RpcReceiveHandler(__rpc_handler_2914920080), "HitBroomClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_350106391(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((OiikaBroomItem)(object)target).ReelUpSFXServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_458182727(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0070: 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_009d: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				int hitSurfaceID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((OiikaBroomItem)(object)target).HitBroomServerRpc(hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2914920080(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 hitSurfaceID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((OiikaBroomItem)(object)target).HitBroomClientRpc(hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "OiikaBroomItem";
		}
	}
	[BepInPlugin("WaterGun.PyrkonScripts", "Pyrkon", "1.2.1")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(GameNetworkManager))]
		internal class GameNetworkManager_Patch
		{
			[HarmonyPatch("Start")]
			[HarmonyPostfix]
			public static void Postfix(GameNetworkManager __instance)
			{
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)pyrkonNetworkObject))
				{
					NetworkManager.Singleton.AddNetworkPrefab(pyrkonNetworkObject);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)maxplaierCup?.spawnPrefab))
				{
					NetworkManager.Singleton.AddNetworkPrefab(maxplaierCup?.spawnPrefab);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)maxplaierCap?.spawnPrefab))
				{
					NetworkManager.Singleton.AddNetworkPrefab(maxplaierCap?.spawnPrefab);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)maxplaierPillow?.spawnPrefab))
				{
					NetworkManager.Singleton.AddNetworkPrefab(maxplaierPillow?.spawnPrefab);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)chuckenPillow?.spawnPrefab))
				{
					NetworkManager.Singleton.AddNetworkPrefab(chuckenPillow?.spawnPrefab);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)rockus?.spawnPrefab))
				{
					NetworkManager.Singleton.AddNetworkPrefab(rockus?.spawnPrefab);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)companyDeposit))
				{
					NetworkManager.Singleton.AddNetworkPrefab(companyDeposit);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)haalandPlushieObj))
				{
					NetworkManager.Singleton.AddNetworkPrefab(haalandPlushieObj);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)trash?.spawnPrefab))
				{
					NetworkManager.Singleton.AddNetworkPrefab(trash?.spawnPrefab);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)oiikaBroom?.spawnPrefab))
				{
					NetworkManager.Singleton.AddNetworkPrefab(oiikaBroom?.spawnPrefab);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)admirozdroj?.spawnPrefab))
				{
					NetworkManager.Singleton.AddNetworkPrefab(admirozdroj?.spawnPrefab);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)starbucksCup?.spawnPrefab))
				{
					NetworkManager.Singleton.AddNetworkPrefab(starbucksCup?.spawnPrefab);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)leszekBanana?.spawnPrefab))
				{
					NetworkManager.Singleton.AddNetworkPrefab(leszekBanana?.spawnPrefab);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)jayPhone?.spawnPrefab))
				{
					NetworkManager.Singleton.AddNetworkPrefab(jayPhone?.spawnPrefab);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)jayJam?.spawnPrefab))
				{
					NetworkManager.Singleton.AddNetworkPrefab(jayJam?.spawnPrefab);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)familyPainting?.spawnPrefab))
				{
					NetworkManager.Singleton.AddNetworkPrefab(familyPainting?.spawnPrefab);
				}
				if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Any((NetworkPrefab p) => (Object)(object)p.Prefab == (Object)(object)tsurayaCat?.enemyPrefab))
				{
					NetworkManager.Singleton.AddNetworkPrefab(tsurayaCat?.enemyPrefab);
				}
			}

			[HarmonyPatch("SaveGameValues")]
			[HarmonyPostfix]
			public static void SaveGameValues()
			{
				if ((Object)(object)PyrkonScripts.DepositMachine.Instance != (Object)null)
				{
					ES3.Save<int>("DepositMachineCapacity", PyrkonScripts.DepositMachine.Instance.capacity.Value, GameNetworkManager.Instance.currentSaveFileName);
				}
			}
		}

		[HarmonyPatch(typeof(MenuManager))]
		internal class MenuManager_Patch
		{
			[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
			internal static class SpawnScrapInLevel_Patch
			{
				private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
				{
					//IL_0088: Unknown result type (might be due to invalid IL or missing references)
					//IL_008e: Expected O, but got Unknown
					//IL_0096: Unknown result type (might be due to invalid IL or missing references)
					//IL_009c: Expected O, but got Unknown
					//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
					//IL_00aa: Expected O, but got Unknown
					//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b8: Expected O, but got Unknown
					List<CodeInstruction> list = new List<CodeInstruction>(instructions);
					FieldInfo fieldInfo = AccessTools.Field(typeof(SelectableLevel), "spawnableScrap");
					MethodInfo methodInfo = AccessTools.Method(typeof(SpawnScrapInLevel_Patch), "FilterSingleItemDay", (Type[])null, (Type[])null);
					for (int i = 1; i < list.Count; i++)
					{
						if (list[i].opcode == OpCodes.Stloc_2 && list[i - 1].opcode == OpCodes.Callvirt)
						{
							list.InsertRange(i + 1, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[4]
							{
								new CodeInstruction(OpCodes.Ldarg_0, (object)null),
								new CodeInstruction(OpCodes.Ldloc_2, (object)null),
								new CodeInstruction(OpCodes.Call, (object)methodInfo),
								new CodeInstruction(OpCodes.Stloc_2, (object)null)
							});
						}
					}
					return list;
				}

				private static int FilterSingleItemDay(RoundManager roundManager, int index)
				{
					index = roundManager.AnomalyRandom.Next(0, roundManager.currentLevel.spawnableScrap.Count);
					Item spawnableItem = roundManager.currentLevel.spawnableScrap[index].spawnableItem;
					if ((Object)(object)spawnableItem.spawnPrefab.GetComponent<DepositableItem>() != (Object)null)
					{
						Debug.Log((object)("[PyrkonMod] Prevented DepositableItem '" + spawnableItem.itemName + "' from becoming the single-item day."));
						return 0;
					}
					return index;
				}
			}

			[HarmonyPatch(typeof(DepositItemsDesk))]
			internal class DepositItemsDesk_Patch
			{
				[HarmonyPatch("PlaceItemOnCounter")]
				[HarmonyPrefix]
				public static bool PlaceItemOnCounter_Prefix(ref PlayerControllerB playerWhoTriggered)
				{
					if (playerWhoTriggered.currentlyHeldObjectServer is DepositableItem)
					{
						HUDManager.Instance.DisplayTip("Sell Counter", "This item is returnable, please upgrade your company ship to include Company Deposit!", true, false, "LC_Tip1");
						return false;
					}
					return true;
				}
			}

			[HarmonyPatch(typeof(Terminal))]
			internal class Terminal_Patch
			{
				[HarmonyPatch("Awake")]
				[HarmonyPrefix]
				public static void Awake(Terminal __instance)
				{
					//IL_0717: Unknown result type (might be due to invalid IL or missing references)
					//IL_071e: Expected O, but got Unknown
					//IL_0aa0: Unknown result type (might be due to invalid IL or missing references)
					//IL_0aa6: Expected O, but got Unknown
					//IL_0b1e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0b24: Expected O, but got Unknown
					//IL_0ba2: Unknown result type (might be due to invalid IL or missing references)
					//IL_0bac: Expected O, but got Unknown
					//IL_1041: Unknown result type (might be due to invalid IL or missing references)
					//IL_1047: Expected O, but got Unknown
					//IL_0ca3: Unknown result type (might be due to invalid IL or missing references)
					//IL_0cad: Expected O, but got Unknown
					//IL_10bf: Unknown result type (might be due to invalid IL or missing references)
					//IL_10c5: Expected O, but got Unknown
					//IL_114f: Unknown result type (might be due to invalid IL or missing references)
					//IL_1159: Expected O, but got Unknown
					//IL_1250: Unknown result type (might be due to invalid IL or missing references)
					//IL_125a: Expected O, but got Unknown
					if (!StartOfRound.Instance.allItemsList.itemsList.Any((Item val11) => val11.itemName == maxplaierCup?.itemName))
					{
						StartOfRound.Instance.allItemsList.itemsList.Add(maxplaierCup);
					}
					if (!StartOfRound.Instance.allItemsList.itemsList.Any((Item val11) => val11.itemName == maxplaierCap?.itemName))
					{
						StartOfRound.Instance.allItemsList.itemsList.Add(maxplaierCap);
					}
					if (!StartOfRound.Instance.allItemsList.itemsList.Any((Item val11) => val11.itemName == maxplaierPillow?.itemName))
					{
						StartOfRound.Instance.allItemsList.itemsList.Add(maxplaierPillow);
					}
					if (!StartOfRound.Instance.allItemsList.itemsList.Any((Item val11) => val11.itemName == chuckenPillow?.itemName))
					{
						StartOfRound.Instance.allItemsList.itemsList.Add(chuckenPillow);
					}
					if (!StartOfRound.Instance.allItemsList.itemsList.Any((Item val11) => val11.itemName == rockus?.itemName))
					{
						StartOfRound.Instance.allItemsList.itemsList.Add(rockus);
					}
					if (!StartOfRound.Instance.allItemsList.itemsList.Any((Item val11) => val11.itemName == oiikaBroom?.itemName))
					{
						StartOfRound.Instance.allItemsList.itemsList.Add(oiikaBroom);
					}
					if (!StartOfRound.Instance.allItemsList.itemsList.Any((Item val11) => val11.itemName == trash?.itemName))
					{
						StartOfRound.Instance.allItemsList.itemsList.Add(trash);
					}
					if (!StartOfRound.Instance.allItemsList.itemsList.Any((Item val11) => val11.itemName == admirozdroj?.itemName))
					{
						StartOfRound.Instance.allItemsList.itemsList.Add(admirozdroj);
					}
					if (!StartOfRound.Instance.allItemsList.itemsList.Any((Item val11) => val11.itemName == starbucksCup?.itemName))
					{
						StartOfRound.Instance.allItemsList.itemsList.Add(starbucksCup);
					}
					if (!StartOfRound.Instance.allItemsList.itemsList.Any((Item val11) => val11.itemName == leszekBanana?.itemName))
					{
						StartOfRound.Instance.allItemsList.itemsList.Add(leszekBanana);
					}
					if (!StartOfRound.Instance.allItemsList.itemsList.Any((Item val11) => val11.itemName == jayPhone?.itemName))
					{
						StartOfRound.Instance.allItemsList.itemsList.Add(jayPhone);
					}
					if (!StartOfRound.Instance.allItemsList.itemsList.Any((Item val11) => val11.itemName == jayJam?.itemName))
					{
						StartOfRound.Instance.allItemsList.itemsList.Add(jayJam);
					}
					if (!StartOfRound.Instance.allItemsList.itemsList.Any((Item val11) => val11.itemName == familyPainting?.itemName))
					{
						StartOfRound.Instance.allItemsList.itemsList.Add(familyPainting);
					}
					TerminalKeyword val = __instance.terminalNodes.allKeywords.First((TerminalKeyword k) => k.word == "info");
					if (!__instance.enemyFiles.Any((TerminalNode f) => f.creatureName == Plugin.tsurayaCat?.enemyName))
					{
						TerminalNode val2 = ScriptableObject.CreateInstance<TerminalNode>();
						((Object)val2).name = Plugin.tsurayaCat?.enemyName.Replace(" ", "-") + "File";
						val2.clearPreviousText = true;
						val2.creatureName = Plugin.tsurayaCat?.enemyName;
						val2.creatureFileID = __instance.enemyFiles.Count;
						val2.maxCharactersToType = 35;
						val2.displayText = "Tsuraya cats often become enormous sizes when reached please be careful";
						val2.displayVideo = tsurayaCatVid;
						val2.playSyncedClip = 2;
						val2.loadImageSlowly = true;
						__instance.enemyFiles.Add(val2);
						EnemyType? tsurayaCat = Plugin.tsurayaCat;
						ScanNodeProperties val3 = ((tsurayaCat != null) ? tsurayaCat.enemyPrefab.GetComponentInChildren<ScanNodeProperties>() : null);
						if ((Object)(object)val3 != (Object)null)
						{
							val3.creatureScanID = val2.creatureFileID;
						}
					}
					if (!__instance.terminalNodes.allKeywords.Any((TerminalKeyword k) => k.word == Plugin.tsurayaCat?.enemyName.ToLowerInvariant().Replace(" ", "-")))
					{
						TerminalKeyword val4 = ScriptableObject.CreateInstance<TerminalKeyword>();
						((Object)val4).name = Plugin.tsurayaCat?.enemyName.Replace(" ", "-");
						val4.word = Plugin.tsurayaCat?.enemyName.ToLowerInvariant().Replace(" ", "-");
						val4.defaultVerb = val;
						List<TerminalKeyword> list = __instance.terminalNodes.allKeywords.ToList();
						list.Add(val4);
						__instance.terminalNodes.allKeywords = list.ToArray();
					}
					if (!val.compatibleNouns.Any((CompatibleNoun n) => n.noun.word == Plugin.tsurayaCat?.enemyName.ToLowerInvariant().Replace(" ", "-")))
					{
						CompatibleNoun item = new CompatibleNoun(__instance.terminalNodes.allKeywords.First((TerminalKeyword k) => k.word == Plugin.tsurayaCat?.enemyName.ToLowerInvariant().Replace(" ", "-")), __instance.enemyFiles.First((TerminalNode n) => n.creatureName == Plugin.tsurayaCat?.enemyName));
						List<CompatibleNoun> list2 = val.compatibleNouns.ToList();
						list2.Add(item);
						val.compatibleNouns = list2.ToArray();
					}
					DepositMachine.prefabObject = companyDeposit;
					DepositMachine.unlockableName = "Deposit machine";
					DepositMachine.unlockableType = 1;
					DepositMachine.IsPlaceable = true;
					DepositMachine.alwaysInStock = true;
					if (!StartOfRound.Instance.unlockablesList.unlockables.Any((UnlockableItem unlockable) => unlockable.unlockableName == DepositMachine.unlockableName) && (Object)(object)DepositMachine.prefabObject != (Object)null)
					{
						PlaceableShipObject componentInChildren = DepositMachine.prefabObject.GetComponentInChildren<PlaceableShipObject>();
						componentInChildren.unlockableID = StartOfRound.Instance.unlockablesList.unlockables.Count;
						componentInChildren.parentObject.unlockableID = componentInChildren.unlockableID;
						StartOfRound.Instance.unlockablesList.unlockables.Add(DepositMachine);
						TerminalKeyword keyword = ScriptableObject.CreateInstance<TerminalKeyword>();
						((Object)keyword).name = "DepositMachine";
						keyword.defaultVerb = __instance.terminalNodes.allKeywords.First((TerminalKeyword key) => key.word == "buy");
						keyword.word = DepositMachine.unlockableName.ToLowerInvariant().Replace(" ", "-");
						if (__instance.terminalNodes.allKeywords.Any((TerminalKeyword key) => key.word == keyword.word))
						{
							return;
						}
						int shipUnlockableID = StartOfRound.Instance.unlockablesList.unlockables.FindIndex((UnlockableItem unlockable) => unlockable.unlockableName == DepositMachine.unlockableName);
						TerminalNode val5 = ScriptableObject.CreateInstance<TerminalNode>();
						((Object)val5).name = DepositMachine.unlockableName.Replace(" ", "-") + "BuyNode2";
						val5.displayText = "Ordered [variableAmount] " + DepositMachine.unlockableName + ". Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\r\n\r\n";
						val5.clearPreviousText = true;
						val5.maxCharactersToType = 15;
						val5.buyItemIndex = -1;
						val5.shipUnlockableID = shipUnlockableID;
						val5.buyUnlockable = true;
						val5.creatureName = DepositMachine.unlockableName;
						val5.isConfirmationNode = false;
						val5.itemCost = 300;
						val5.playSyncedClip = 0;
						TerminalNode val6 = ScriptableObject.CreateInstance<TerminalNode>();
						val6 = ScriptableObject.CreateInstance<TerminalNode>();
						((Object)val6).name = DepositMachine.unlockableName.Replace(" ", "-") + "BuyNode1";
						val6.displayText = "You have requested to order " + DepositMachine.unlockableName + ". Amount: [variableAmount].\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\r\n\r\n";
						val6.clearPreviousText = true;
						val6.maxCharactersToType = 35;
						val6.buyItemIndex = -1;
						val6.shipUnlockableID = shipUnlockableID;
						val6.creatureName = DepositMachine.unlockableName;
						val6.isConfirmationNode = true;
						val6.overrideOptions = true;
						val6.itemCost = 300;
						val6.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2]
						{
							new CompatibleNoun(__instance.terminalNodes.allKeywords.First((TerminalKeyword val11) => val11.word == "confirm"), val5),
							new CompatibleNoun(__instance.terminalNodes.allKeywords.First((TerminalKeyword val11) => val11.word == "deny"), __instance.terminalNodes.allKeywords.First((TerminalKeyword key) => key.word == "buy").compatibleNouns[0].result.terminalOptions[1].result)
						};
						List<TerminalKeyword> list3 = __instance.terminalNodes.allKeywords.ToList();
						list3.Add(keyword);
						__instance.terminalNodes.allKeywords = list3.ToArray();
						List<CompatibleNoun> list4 = __instance.terminalNodes.allKeywords.First((TerminalKeyword key) => key.word == "buy").compatibleNouns.ToList();
						list4.Add(new CompatibleNoun(keyword, val6));
						__instance.terminalNodes.allKeywords.First((TerminalKeyword key) => key.word == "buy").compatibleNouns = list4.ToArray();
						TerminalNode val7 = ScriptableObject.CreateInstance<TerminalNode>();
						((Object)val7).name = DepositMachine.unlockableName.Replace(" ", "-") + "InfoNode";
						val7.displayText = "No information given about " + DepositMachine.unlockableName + "\n\n";
						val7.clearPreviousText = true;
						val7.maxCharactersToType = 25;
						__instance.terminalNodes.allKeywords = list3.ToArray();
						List<CompatibleNoun> list5 = __instance.terminalNodes.allKeywords.First((TerminalKeyword key) => key.word == "info").compatibleNouns.ToList();
						list5.Add(new CompatibleNoun(keyword, val7));
						__instance.terminalNodes.allKeywords.First((TerminalKeyword key) => key.word == "info").compatibleNouns = list5.ToArray();
					}
					HaalandPlushie.prefabObject = haalandPlushieObj;
					HaalandPlushie.unlockableName = "Haaland plushie";
					HaalandPlushie.unlockableType = 1;
					HaalandPlushie.IsPlaceable = true;
					HaalandPlushie.alwaysInStock = false;
					if (StartOfRound.Instance.unlockablesList.unlockables.Any((UnlockableItem unlockable) => unlockable.unlockableName == HaalandPlushie.unlockableName) || !((Object)(object)HaalandPlushie.prefabObject != (Object)null))
					{
						return;
					}
					PlaceableShipObject componentInChildren2 = HaalandPlushie.prefabObject.GetComponentInChildren<PlaceableShipObject>();
					componentInChildren2.unlockableID = StartOfRound.Instance.unlockablesList.unlockables.Count;
					componentInChildren2.parentObject.unlockableID = componentInChildren2.unlockableID;
					StartOfRound.Instance.unlockablesList.unlockables.Add(HaalandPlushie);
					TerminalKeyword keyword2 = ScriptableObject.CreateInstance<TerminalKeyword>();
					((Object)keyword2).name = "HaalandPlushie";
					keyword2.defaultVerb = __instance.terminalNodes.allKeywords.First((TerminalKeyword key) => key.word == "buy");
					keyword2.word = HaalandPlushie.unlockableName.ToLowerInvariant().Replace(" ", "-");
					if (!__instance.terminalNodes.allKeywords.Any((TerminalKeyword key) => key.word == keyword2.word))
					{
						int shipUnlockableID2 = StartOfRound.Instance.unlockablesList.unlockables.FindIndex((UnlockableItem unlockable) => unlockable.unlockableName == HaalandPlushie.unlockableName);
						TerminalNode val8 = ScriptableObject.CreateInstance<TerminalNode>();
						((Object)val8).name = HaalandPlushie.unlockableName.Replace(" ", "-") + "BuyNode2";
						val8.displayText = "Ordered [variableAmount] " + HaalandPlushie.unlockableName + ". Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\r\n\r\n";
						val8.clearPreviousText = true;
						val8.maxCharactersToType = 15;
						val8.buyItemIndex = -1;
						val8.shipUnlockableID = shipUnlockableID2;
						val8.buyUnlockable = true;
						val8.creatureName = HaalandPlushie.unlockableName;
						val8.isConfirmationNode = false;
						val8.itemCost = 120;
						val8.playSyncedClip = 0;
						TerminalNode val9 = ScriptableObject.CreateInstance<TerminalNode>();
						val9 = ScriptableObject.CreateInstance<TerminalNode>();
						((Object)val9).name = HaalandPlushie.unlockableName.Replace(" ", "-") + "BuyNode1";
						val9.displayText = "You have requested to order " + HaalandPlushie.unlockableName + ". Amount: [variableAmount].\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\r\n\r\n";
						val9.clearPreviousText = true;
						val9.maxCharactersToType = 35;
						val9.buyItemIndex = -1;
						val9.shipUnlockableID = shipUnlockableID2;
						val9.creatureName = HaalandPlushie.unlockableName;
						val9.isConfirmationNode = true;
						val9.overrideOptions = true;
						val9.itemCost = 120;
						val9.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2]
						{
							new CompatibleNoun(__instance.terminalNodes.allKeywords.First((TerminalKeyword val11) => val11.word == "confirm"), val8),
							new CompatibleNoun(__instance.terminalNodes.allKeywords.First((TerminalKeyword val11) => val11.word == "deny"), __instance.terminalNodes.allKeywords.First((TerminalKeyword key) => key.word == "buy").compatibleNouns[0].result.terminalOptions[1].result)
						};
						HaalandPlushie.shopSelectionNode = val9;
						List<TerminalKeyword> list6 = __instance.terminalNodes.allKeywords.ToList();
						list6.Add(keyword2);
						__instance.terminalNodes.allKeywords = list6.ToArray();
						List<CompatibleNoun> list7 = __instance.terminalNodes.allKeywords.First((TerminalKeyword key) => key.word == "buy").compatibleNouns.ToList();
						list7.Add(new CompatibleNoun(keyword2, val9));
						__instance.terminalNodes.allKeywords.First((TerminalKeyword key) => key.word == "buy").compatibleNouns = list7.ToArray();
						TerminalNode val10 = ScriptableObject.CreateInstance<TerminalNode>();
						((Object)val10).name = HaalandPlushie.unlockableName.Replace(" ", "-") + "InfoNode";
						val10.displayText = "No information given about " + HaalandPlushie.unlockableName + "\n\n";
						val10.clearPreviousText = true;
						val10.maxCharactersToType = 25;
						__instance.terminalNodes.allKeywords = list6.ToArray();
						List<CompatibleNoun> list8 = __instance.terminalNodes.allKeywords.First((TerminalKeyword key) => key.word == "info").compatibleNouns.ToList();
						list8.Add(new CompatibleNoun(keyword2, val10));
						__instance.terminalNodes.allKeywords.First((TerminalKeyword key) => key.word == "info").compatibleNouns = list8.ToArray();
					}
				}

				[HarmonyPatch("TextPostProcess")]
				[HarmonyPrefix]
				public static void TextPostProcess(ref TerminalNode node, ref string modifiedDisplayText, Terminal __instance)
				{
					if (modifiedDisplayText.Contains("[buyableItemsList]") && modifiedDisplayText.Contains("[unlockablesSelectionList]"))
					{
						int num = modifiedDisplayText.IndexOf(":");
						string unlockableName = DepositMachine.unlockableName;
						int num2 = 300;
						string value = $"\n* {unlockableName}    //    Price: ${num2}";
						modifiedDisplayText = modifiedDisplayText.Insert(num + 1, value);
					}
				}
			}

			[HarmonyPatch(typeof(StartOfRound))]
			internal class StartOfRound_Patch
			{
				[HarmonyPatch("Start")]
				[HarmonyPostfix]
				public static void Postfix(StartOfRound __instance)
				{
					//IL_0098: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a2: Expected O, but got Unknown
					//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ef: Expected O, but got Unknown
					//IL_0132: Unknown result type (might be due to invalid IL or missing references)
					//IL_013c: Expected O, but got Unknown
					//IL_017f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0189: Expected O, but got Unknown
					//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
					//IL_01d6: Expected O, but got Unknown
					//IL_0219: Unknown result type (might be due to invalid IL or missing references)
					//IL_0223: Expected O, but got Unknown
					//IL_0266: Unknown result type (might be due to invalid IL or missing references)
					//IL_0270: Expected O, but got Unknown
					//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
					//IL_02bd: Expected O, but got Unknown
					//IL_0300: Unknown result type (might be due to invalid IL or missing references)
					//IL_030a: Expected O, but got Unknown
					//IL_034d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0357: Expected O, but got Unknown
					//IL_039a: Unknown result type (might be due to invalid IL or missing references)
					//IL_03a4: Expected O, but got Unknown
					//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
					//IL_03f1: Expected O, but got Unknown
					//IL_0437: Unknown result type (might be due to invalid IL or missing references)
					//IL_0441: Expected O, but got Unknown
					if (NetworkManager.Singleton.IsServer)
					{
						GameObject val = Object.Instantiate<GameObject>(pyrkonNetworkObject);
						if (val != null)
						{
							val.GetComponent<NetworkObject>().Spawn(false);
						}
					}
					SelectableLevel val2 = __instance.levels.First((SelectableLevel l) => l.PlanetName == "52 Pyrkon");
					if (!val2.spawnableScrap.Any((SpawnableItemWithRarity s) => s.spawnableItem.itemName == maxplaierCup?.itemName))
					{
						val2.spawnableScrap.Add(new SpawnableItemWithRarity(maxplaierCup, 30));
					}
					if (!val2.spawnableScrap.Any((SpawnableItemWithRarity s) => s.spawnableItem.itemName == maxplaierCap?.itemName))
					{
						val2.spawnableScrap.Add(new SpawnableItemWithRarity(maxplaierCap, 25));
					}
					if (!val2.spawnableScrap.Any((SpawnableItemWithRarity s) => s.spawnableItem.itemName == maxplaierPillow?.itemName))
					{
						val2.spawnableScrap.Add(new SpawnableItemWithRarity(maxplaierPillow, 55));
					}
					if (!val2.spawnableScrap.Any((SpawnableItemWithRarity s) => s.spawnableItem.itemName == chuckenPillow?.itemName))
					{
						val2.spawnableScrap.Add(new SpawnableItemWithRarity(chuckenPillow, 25));
					}
					if (!val2.spawnableScrap.Any((SpawnableItemWithRarity s) => s.spawnableItem.itemName == rockus?.itemName))
					{
						val2.spawnableScrap.Add(new SpawnableItemWithRarity(rockus, 50));
					}
					if (!val2.spawnableScrap.Any((SpawnableItemWithRarity s) => s.spawnableItem.itemName == admirozdroj?.itemName))
					{
						val2.spawnableScrap.Add(new SpawnableItemWithRarity(admirozdroj, 45));
					}
					if (!val2.spawnableScrap.Any((SpawnableItemWithRarity s) => s.spawnableItem.itemName == oiikaBroom?.itemName))
					{
						val2.spawnableScrap.Add(new SpawnableItemWithRarity(oiikaBroom, 20));
					}
					if (!val2.spawnableScrap.Any((SpawnableItemWithRarity s) => s.spawnableItem.itemName == starbucksCup?.itemName))
					{
						val2.spawnableScrap.Add(new SpawnableItemWithRarity(starbucksCup, 25));
					}
					if (!val2.spawnableScrap.Any((SpawnableItemWithRarity s) => s.spawnableItem.itemName == leszekBanana?.itemName))
					{
						val2.spawnableScrap.Add(new SpawnableItemWithRarity(leszekBanana, 10));
					}
					if (!val2.spawnableScrap.Any((SpawnableItemWithRarity s) => s.spawnableItem.itemName == jayPhone?.itemName))
					{
						val2.spawnableScrap.Add(new SpawnableItemWithRarity(jayPhone, 45));
					}
					if (!val2.spawnableScrap.Any((SpawnableItemWithRarity s) => s.spawnableItem.itemName == jayJam?.itemName))
					{
						val2.spawnableScrap.Add(new SpawnableItemWithRarity(jayJam, 50));
					}
					if (!val2.spawnableScrap.Any((SpawnableItemWithRarity s) => s.spawnableItem.itemName == familyPainting?.itemName))
					{
						val2.spawnableScrap.Add(new SpawnableItemWithRarity(familyPainting, 50));
					}
					if (!val2.Enemies.Any((SpawnableEnemyWithRarity e) => e.enemyType.enemyName == tsurayaCat?.enemyName))
					{
						val2.Enemies.Add(new SpawnableEnemyWithRarity(tsurayaCat, 200));
					}
					if ((Object)(object)val2.specialEnemyRarity.overrideEnemy != (Object)(object)tsurayaCat)
					{
						val2.specialEnemyRarity.overrideEnemy = tsurayaCat;
					}
				}

				[HarmonyPrefix]
				[HarmonyPatch("Start")]
				public static void PreFix()
				{
					AudioMixer diageticMixer = SoundManager.Instance.diageticMixer;
					List<GameObject> list = new List<GameObject>();
					for (int num = prefabsToFix.Count - 1; num >= 0; num--)
					{
						GameObject val = prefabsToFix[num];
						AudioSource[] componentsInChildren = val.GetCompo