Decompiled source of NatalisLib v1.0.1

BepInEx/plugins/NatalisLib/NatalisLib.dll

Decompiled 4 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using DunGen;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using LobbyCompatibility.Attributes;
using Microsoft.CodeAnalysis;
using NatalisLib.NetcodePatcher;
using NatalisLib.Patches;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("NatalisLib")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-dev")]
[assembly: AssemblyProduct("NatalisLib")]
[assembly: AssemblyTitle("NatalisLib")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace NatalisLib
{
	[RequireComponent(typeof(InteractTrigger))]
	public class CandleBlowOut : NetworkBehaviour
	{
		public AudioSource thisAudioSource;

		public AudioClip audioClip;

		public void OnInteract(PlayerControllerB player)
		{
			DisableInteractTriggerServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		public void DisableInteractTriggerServerRpc()
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1748145469u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1748145469u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					DisableInteractTriggerClientRpc();
				}
			}
		}

		[ClientRpc]
		public void DisableInteractTriggerClientRpc()
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2003618293u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2003618293u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((Component)this).GetComponent<InteractTrigger>().interactable = false;
					((Collider)((Component)this).GetComponent<BoxCollider>()).enabled = false;
					PlayAudio();
				}
			}
		}

		public void PlayAudio()
		{
			if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && !((Object)(object)thisAudioSource == (Object)null) && !((Object)(object)audioClip == (Object)null))
			{
				thisAudioSource.PlayOneShot(audioClip, 1f);
				WalkieTalkie.TransmitOneShotAudio(thisAudioSource, audioClip, 1f);
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_CandleBlowOut()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1748145469u, new RpcReceiveHandler(__rpc_handler_1748145469));
			NetworkManager.__rpc_func_table.Add(2003618293u, new RpcReceiveHandler(__rpc_handler_2003618293));
		}

		private static void __rpc_handler_1748145469(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;
				((CandleBlowOut)(object)target).DisableInteractTriggerServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2003618293(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)2;
				((CandleBlowOut)(object)target).DisableInteractTriggerClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "CandleBlowOut";
		}
	}
	[RequireComponent(typeof(InteractTrigger))]
	public class CutSliceTrigger : NetworkBehaviour
	{
		private InteractTrigger cutTrigger;

		private LoafItem loaf;

		private void Awake()
		{
			cutTrigger = ((Component)this).gameObject.GetComponent<InteractTrigger>();
			loaf = ((Component)this).gameObject.GetComponentInParent<LoafItem>();
		}

		public void Update()
		{
			if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				return;
			}
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)null && GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.itemName == "Bread Knife")
			{
				cutTrigger.interactable = true;
				((Collider)((Component)this).GetComponent<BoxCollider>()).enabled = true;
				if (StartOfRound.Instance.localPlayerUsingController)
				{
					cutTrigger.hoverTip = "Cut slice: [R-trigger]";
				}
				else
				{
					cutTrigger.hoverTip = "Cut slice: [ LMB ]";
				}
			}
			else
			{
				cutTrigger.interactable = false;
				((Collider)((Component)this).GetComponent<BoxCollider>()).enabled = false;
			}
		}

		public void CutSlice(int playerWhoCut)
		{
			loaf.RemoveSliceOnServerRpc(playerWhoCut);
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "CutSliceTrigger";
		}
	}
	public class FoodItem : GrabbableObject
	{
		[Header("Food Settings")]
		public AudioClip eatSfx;

		private bool isHoldingButton;

		private bool eaten;

		private float timeToEat = 1.61f;

		private float eatingProgress;

		private Animator animator;

		private Coroutine eatCoroutine;

		private PlayerControllerB previousPlayerHeldBy;

		private ParticleSystem particles;

		private static int maxHealth => GetMaxHealthPatch.maxHealth;

		public void Awake()
		{
			animator = ((Component)this).GetComponent<Animator>();
			particles = ((Component)this).GetComponentInChildren<ParticleSystem>();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			isHoldingButton = buttonDown;
			if (isHoldingButton)
			{
				previousPlayerHeldBy = base.playerHeldBy;
				if (eatCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(eatCoroutine);
				}
				eatCoroutine = ((MonoBehaviour)this).StartCoroutine(eat());
			}
		}

		private IEnumerator eat()
		{
			EatAnimationServerRpc(eating: true, (int)previousPlayerHeldBy.playerClientId);
			yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld || !base.isBeingUsed || eaten));
			EatAnimationServerRpc(eating: false, (int)previousPlayerHeldBy.playerClientId);
			eatingProgress = 0f;
			if (eaten)
			{
				animator.Play("EatFinish");
				yield return (object)new WaitForSeconds(0.2f);
				CompleteEat();
			}
		}

		[ServerRpc]
		public void EatAnimationServerRpc(bool eating, int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Invalid comparison between Unknown and I4
			//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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_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 val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2845371706u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref eating, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2845371706u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				EatAnimationClientRpc(eating, playerId);
			}
		}

		[ClientRpc]
		public void EatAnimationClientRpc(bool eating, int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3917910944u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref eating, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3917910944u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				StartOfRound.Instance.allPlayerScripts[playerId].playerBodyAnimator.SetBool("walkieTalkie", eating);
				animator.SetBool("eat", eating);
				if (eating)
				{
					particles.Play();
					((Component)this).gameObject.GetComponent<AudioSource>().PlayOneShot(eatSfx, 1f);
				}
				else
				{
					particles.Stop();
					((Component)this).gameObject.GetComponent<AudioSource>().Stop(true);
				}
			}
		}

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if (((NetworkBehaviour)this).IsOwner && isHoldingButton && base.isHeld)
			{
				eatingProgress += Time.deltaTime;
				if (eatingProgress >= timeToEat)
				{
					eaten = true;
				}
			}
		}

		public void CompleteEat()
		{
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				Heal(10);
				base.playerHeldBy.DespawnHeldObject();
			}
		}

		private void Heal(int healAmount)
		{
			int num = previousPlayerHeldBy.health + healAmount;
			previousPlayerHeldBy.health = ((num > maxHealth) ? maxHealth : num);
			HUDManager.Instance.UpdateHealthUI(previousPlayerHeldBy.health, false);
			previousPlayerHeldBy.DamagePlayerServerRpc(-healAmount, previousPlayerHeldBy.health);
			if (previousPlayerHeldBy.health >= 10 && previousPlayerHeldBy.criticallyInjured)
			{
				previousPlayerHeldBy.MakeCriticallyInjured(false);
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_FoodItem()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2845371706u, new RpcReceiveHandler(__rpc_handler_2845371706));
			NetworkManager.__rpc_func_table.Add(3917910944u, new RpcReceiveHandler(__rpc_handler_3917910944));
		}

		private static void __rpc_handler_2845371706(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_007c: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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
			{
				bool eating = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref eating, default(ForPrimitives));
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((FoodItem)(object)target).EatAnimationServerRpc(eating, playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3917910944(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool eating = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref eating, default(ForPrimitives));
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((FoodItem)(object)target).EatAnimationClientRpc(eating, playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "FoodItem";
		}
	}
	public class KnifeItem : GrabbableObject
	{
		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_0026: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (!((Object)(object)base.playerHeldBy == (Object)null) && ((NetworkBehaviour)this).IsOwner && Physics.Raycast(new Ray(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward), ref val, 3f, 2816))
			{
				CutSliceTrigger component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<CutSliceTrigger>();
				if ((Object)(object)component != (Object)null)
				{
					component.CutSlice((int)base.playerHeldBy.playerClientId);
				}
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "KnifeItem";
		}
	}
	public class LoafItem : GrabbableObject
	{
		public GameObject[] loafModels;

		public GameObject slicePrefab;

		public AudioSource thisAudioSource;

		public AudioClip[] sliceSfx;

		private int slicesRemaining = 6;

		[ClientRpc]
		public void UpdateSliceVisualsClientRpc(int newSliceCount)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2542241751u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, newSliceCount);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2542241751u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					slicesRemaining = newSliceCount;
					UpdateVisuals();
					RoundManager.PlayRandomClip(thisAudioSource, sliceSfx, true, 1f, 0, 1000);
				}
			}
		}

		[ClientRpc]
		public void DespawnClientRpc()
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(698774026u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 698774026u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && (Object)(object)base.playerHeldBy != (Object)null && ((NetworkBehaviour)this).IsOwner)
				{
					base.playerHeldBy.DespawnHeldObject();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void RemoveSliceOnServerRpc(int playerWhoCut)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2855879749u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerWhoCut);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2855879749u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			RemoveSlice(playerWhoCut);
			if (slicesRemaining <= 0)
			{
				if ((Object)(object)base.playerHeldBy != (Object)null)
				{
					DespawnClientRpc();
				}
				else
				{
					((Component)this).gameObject.GetComponent<NetworkObject>().Despawn(true);
				}
			}
			UpdateSliceVisualsClientRpc(slicesRemaining);
		}

		public void RemoveSlice(int playerWhoCut)
		{
			slicesRemaining--;
			UpdateVisuals();
			SpawnSlice(playerWhoCut);
		}

		public void SpawnSlice(int playerWhoCut)
		{
			//IL_0019: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerWhoCut];
			GrabbableObject component = Object.Instantiate<GameObject>(slicePrefab, ((Component)val).transform.position, ((Component)val).transform.rotation, RoundManager.Instance.mapPropsContainer.transform).GetComponent<GrabbableObject>();
			((Component)component).GetComponent<NetworkObject>().Spawn(true);
			Transform transform = ((Component)component).transform;
			component.startFallingPosition = transform.position;
			if (Object.op_Implicit((Object)(object)((Component)component).transform.parent))
			{
				component.startFallingPosition = ((Component)component).transform.parent.InverseTransformPoint(component.startFallingPosition);
			}
			component.FallToGround(false);
			if (Object.op_Implicit((Object)(object)component.itemProperties.dropSFX))
			{
				val.itemAudio.PlayOneShot(component.itemProperties.dropSFX);
			}
		}

		public void UpdateVisuals()
		{
			for (int i = 0; i < loafModels.Length; i++)
			{
				loafModels[i].SetActive(loafModels.Length - i == slicesRemaining);
			}
		}

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

		public override int GetItemDataToSave()
		{
			return slicesRemaining;
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_LoafItem()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2542241751u, new RpcReceiveHandler(__rpc_handler_2542241751));
			NetworkManager.__rpc_func_table.Add(698774026u, new RpcReceiveHandler(__rpc_handler_698774026));
			NetworkManager.__rpc_func_table.Add(2855879749u, new RpcReceiveHandler(__rpc_handler_2855879749));
		}

		private static void __rpc_handler_2542241751(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 newSliceCount = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref newSliceCount);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((LoafItem)(object)target).UpdateSliceVisualsClientRpc(newSliceCount);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_698774026(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)2;
				((LoafItem)(object)target).DespawnClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2855879749(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 playerWhoCut = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoCut);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((LoafItem)(object)target).RemoveSliceOnServerRpc(playerWhoCut);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "LoafItem";
		}
	}
	[BepInPlugin("NatalisLib", "NatalisLib", "0.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[LobbyCompatibility(/*Could not decode attribute arguments.*/)]
	public class NatalisLib : BaseUnityPlugin
	{
		public static NatalisLib Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		internal static AssetBundle Bundle { get; set; }

		public static GameObject RoomPrefab { get; set; }

		public static GameObject OldStartingRoomPrefab { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "natalisbundle");
			Bundle = AssetBundle.LoadFromFile(text);
			LoadItems();
			NetcodePatcher();
			Patch();
			GameObject val = Bundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/NatalisLib/Prefabs/StartingRoomSwapper.prefab");
			val.AddComponent<StartingRoomSwapper>();
			NetworkPrefabs.RegisterNetworkPrefab(val);
			StartOfRoundAwake_Patch.startingRoomSwapper = val;
			Logger.LogInfo((object)"NatalisLib v0.0.0 has loaded!");
		}

		internal static void LoadItems()
		{
			Item val = LoadItem("Assets/LethalCompany/Mods/NatalisLib/Prefabs/Loaf.asset");
			Item val2 = LoadItem("Assets/LethalCompany/Mods/NatalisLib/Prefabs/Party Popper.asset");
			Item val3 = LoadItem("Assets/LethalCompany/Mods/NatalisLib/Prefabs/Bread Slice.asset");
			Item val4 = LoadItem("Assets/LethalCompany/Mods/NatalisLib/Prefabs/Bread Knife.asset");
		}

		internal static Item LoadItem(string itemPath)
		{
			Item val = Bundle.LoadAsset<Item>(itemPath);
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Utilities.FixMixerGroups(val.spawnPrefab);
			Items.RegisterItem(val);
			Items.RegisterShopItem(val, 0);
			return val;
		}

		internal static void Patch()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("NatalisLib");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}

		private void NetcodePatcher()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	public class PartyPopper : NoisemakerProp
	{
		[Header("Party Popper Settings")]
		public GameObject ParticlePrefab;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_0038: 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)
			((NoisemakerProp)this).ItemActivate(used, buttonDown);
			Transform val = ((!((GrabbableObject)this).isInElevator) ? RoundManager.Instance.mapPropsContainer.transform : StartOfRound.Instance.elevatorTransform);
			GameObject val2 = Object.Instantiate<GameObject>(ParticlePrefab, ((Component)this).transform.position, ((Component)this).transform.rotation, val);
			val2.GetComponentInChildren<ParticleSystem>().Play();
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PartyPopper";
		}
	}
	public class StartingRoomSwapper : NetworkBehaviour
	{
		private NetworkVariable<bool> IsCustomRoom = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private InputAction toggleAction;

		public override void OnNetworkSpawn()
		{
			if (((NetworkBehaviour)this).IsServer)
			{
				IsCustomRoom.Value = false;
			}
			else
			{
				NatalisLib.Logger.LogInfo((object)("Joining Initial Natalis? ----- " + IsCustomRoom.Value.ToString().ToUpper()));
				OnCustomRoomChanged(IsCustomRoom.Value, IsCustomRoom.Value);
			}
			NetworkVariable<bool> isCustomRoom = IsCustomRoom;
			isCustomRoom.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)isCustomRoom.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnCustomRoomChanged));
		}

		public override void OnNetworkDespawn()
		{
			NetworkVariable<bool> isCustomRoom = IsCustomRoom;
			isCustomRoom.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)isCustomRoom.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnCustomRoomChanged));
		}

		public void OnCustomRoomChanged(bool previous, bool isCustomRoom)
		{
			NatalisLib.Logger.LogInfo((object)"-* NATALIS ROOM CHANGED *-");
			RoundManager.Instance.dungeonFlowTypes[0].dungeonFlow.Lines[0].DungeonArchetypes[0].TileSets[0].TileWeights.Weights[0].Value = (isCustomRoom ? NatalisLib.RoomPrefab : NatalisLib.OldStartingRoomPrefab);
			NatalisLib.Logger.LogInfo((object)("Natalis ----- " + isCustomRoom.ToString().ToUpper()));
		}

		private void Awake()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			toggleAction = new InputAction("TogglePrefab", (InputActionType)0, "<Keyboard>/backquote", (string)null, (string)null, (string)null);
			toggleAction.performed += OnTogglePerformed;
			toggleAction.Enable();
		}

		private void OnTogglePerformed(CallbackContext context)
		{
			switch (GameNetworkManager.Instance.localPlayerController.playerUsername)
			{
			case "QuackAndCheese":
			case "Sanakotsu":
			case "MayaIsLonely":
				ToggleNatalisRoomServerRpc();
				break;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ToggleNatalisRoomServerRpc()
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(421143555u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 421143555u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					IsCustomRoom.Value = !IsCustomRoom.Value;
					SendAlertClientRpc(IsCustomRoom.Value);
				}
			}
		}

		[ClientRpc]
		public void SendAlertClientRpc(bool isCustomRoom)
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(66419174u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isCustomRoom, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 66419174u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			switch (GameNetworkManager.Instance.localPlayerController.playerUsername)
			{
			case "QuackAndCheese":
			case "Sanakotsu":
			case "MayaIsLonely":
				if (isCustomRoom)
				{
					HUDManager.Instance.DisplayTip("It's go time.", "The starting room is replaced and ready.", false, false, "LC_Tip1");
				}
				else
				{
					HUDManager.Instance.DisplayTip("It's rewind time.", "The starting room has been reset.", false, false, "LC_Tip1");
				}
				break;
			}
		}

		private void OnDestroy()
		{
			toggleAction.Disable();
			toggleAction.performed -= OnTogglePerformed;
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_StartingRoomSwapper()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(421143555u, new RpcReceiveHandler(__rpc_handler_421143555));
			NetworkManager.__rpc_func_table.Add(66419174u, new RpcReceiveHandler(__rpc_handler_66419174));
		}

		private static void __rpc_handler_421143555(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;
				((StartingRoomSwapper)(object)target).ToggleNatalisRoomServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_66419174(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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool isCustomRoom = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isCustomRoom, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((StartingRoomSwapper)(object)target).SendAlertClientRpc(isCustomRoom);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "StartingRoomSwapper";
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "NatalisLib";

		public const string PLUGIN_NAME = "NatalisLib";

		public const string PLUGIN_VERSION = "0.0.0";
	}
}
namespace NatalisLib.Patches
{
	[HarmonyPatch(typeof(StartMatchLever))]
	public class GetMaxHealthPatch
	{
		public static int maxHealth = 100;

		[HarmonyPatch("PlayLeverPullEffectsClientRpc")]
		[HarmonyPostfix]
		public static void StartGameHpPostfix(ref StartOfRound ___playersManager, ref bool ___leverHasBeenPulled)
		{
			if (___leverHasBeenPulled)
			{
				maxHealth = ___playersManager.localPlayerController.health;
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager), "Awake")]
	internal class RoundManagerAwake_Patch
	{
		public static bool IsSetupComplete { get; private set; }

		private static void Postfix(ref RoundManager __instance)
		{
			if (IsSetupComplete)
			{
				return;
			}
			List<DoorwaySocket> list = Resources.FindObjectsOfTypeAll<DoorwaySocket>().ToList();
			NatalisLib.RoomPrefab = NatalisLib.Bundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/NatalisLib/Prefabs/NatalisRoom.prefab");
			NatalisLib.OldStartingRoomPrefab = __instance.dungeonFlowTypes[0].dungeonFlow.Lines[0].DungeonArchetypes[0].TileSets[0].TileWeights.Weights[0].Value;
			Doorway[] componentsInChildren = NatalisLib.RoomPrefab.GetComponentsInChildren<Doorway>();
			Doorway[] array = componentsInChildren;
			foreach (Doorway val in array)
			{
				if (!val.HasSocketAssigned)
				{
					continue;
				}
				foreach (DoorwaySocket item in list)
				{
					if (((Object)val.Socket).name == ((Object)item).name)
					{
						val.socket = item;
					}
				}
			}
			SpawnSyncedObject[] componentsInChildren2 = NatalisLib.RoomPrefab.GetComponentsInChildren<SpawnSyncedObject>();
			List<GameObject> list2 = new List<GameObject>();
			foreach (NetworkPrefab prefab in NetworkManager.Singleton.NetworkConfig.Prefabs.m_Prefabs)
			{
				list2.Add(prefab.Prefab);
			}
			foreach (GameObject item2 in list2)
			{
				SpawnSyncedObject[] array2 = componentsInChildren2;
				foreach (SpawnSyncedObject val2 in array2)
				{
					if ((Object)(object)val2.spawnPrefab != (Object)null && ((Object)val2.spawnPrefab).name == ((Object)item2).name)
					{
						val2.spawnPrefab = item2;
					}
				}
			}
			IsSetupComplete = true;
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "Awake")]
	public class StartOfRoundAwake_Patch
	{
		public static GameObject startingRoomSwapper;

		private static void Postfix()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(startingRoomSwapper, Vector3.zero, Quaternion.identity);
				val.GetComponent<NetworkObject>().Spawn(false);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace NatalisLib.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}