Decompiled source of LethalToolbox v1.0.4

LethalToolbox.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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.Graph;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLevelLoader;
using LethalToolbox;
using LethalToolbox.NetcodePatcher;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Animations;
using UnityEngine.Events;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("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("LethalToolbox")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A Custom API to support the manual and dynamic integration of custom levels and dungeons in Lethal Company.")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+649eadb42b73685beebedb0e19cd4fc6850a4a9c")]
[assembly: AssemblyProduct("LethalToolbox")]
[assembly: AssemblyTitle("LethalToolbox")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 LethalToolkit
{
	[BepInPlugin("imabatby.lethaltoolbox", "LethalToolbox", "1.0.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BaseUnityPlugin
	{
		public const string ModGUID = "imabatby.lethaltoolbox";

		public const string ModName = "LethalToolbox";

		public const string ModVersion = "1.0.4";

		public static Plugin Instance;

		internal static readonly Harmony Harmony = new Harmony("imabatby.lethaltoolbox");

		internal static ManualLogSource logger;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalToolbox loaded!!");
			NetcodePatch();
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			if (((Scene)(ref scene)).name == "SampleSceneRelay")
			{
				Data.GetPlayerObjects();
			}
		}

		private void NetcodePatch()
		{
			try
			{
				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);
						}
					}
				}
			}
			catch
			{
				Debug.Log((object)"NetcodePatcher did a big fucksie wuckise!");
			}
		}
	}
}
namespace LethalToolbox
{
	public class HurtPlayer : NetworkBehaviour
	{
		public enum RagdollType
		{
			Default,
			HeadBurst,
			Spring,
			Electrocuted,
			ComedyMask,
			TragedyMask,
			Burnt
		}

		public int damage;

		public float cooldown;

		public Vector3 playerForceVelocity = Vector3.zero;

		[Space(10f)]
		public bool spawnBody;

		public CauseOfDeath causeOfDeath = (CauseOfDeath)0;

		public RagdollType bodyType = RagdollType.Default;

		private bool isOnCooldown = false;

		public void KillPlayer(PlayerControllerB player)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			player.KillPlayer(playerForceVelocity, spawnBody, causeOfDeath, (int)bodyType, default(Vector3));
		}

		public void DamagePlayer(PlayerControllerB player)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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)
			if (!isOnCooldown)
			{
				((MonoBehaviour)this).StartCoroutine(StartCooldown(cooldown));
				int num = damage;
				CauseOfDeath val = causeOfDeath;
				Vector3 val2 = playerForceVelocity;
				player.DamagePlayer(num, true, true, val, (int)bodyType, false, val2);
			}
		}

		public IEnumerator StartCooldown(float cooldown)
		{
			isOnCooldown = true;
			yield return (object)new WaitForSeconds(cooldown);
			isOnCooldown = false;
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "HurtPlayer";
		}
	}
	public class DynamicSpawnSyncedObject : SpawnSyncedObject
	{
		private void Awake()
		{
			if ((Object)(object)base.spawnPrefab == (Object)null)
			{
				((Component)this).gameObject.SetActive(false);
			}
		}

		public void AwakeWithReference(ExtendedContent extendedContent)
		{
			ExtendedItem val = (ExtendedItem)(object)((extendedContent is ExtendedItem) ? extendedContent : null);
			if (val != null)
			{
				base.spawnPrefab = val.Item.spawnPrefab;
			}
			else
			{
				ExtendedEnemyType val2 = (ExtendedEnemyType)(object)((extendedContent is ExtendedEnemyType) ? extendedContent : null);
				if (val2 != null)
				{
					base.spawnPrefab = val2.EnemyType.enemyPrefab;
				}
			}
			if ((Object)(object)base.spawnPrefab != (Object)null)
			{
				((Component)this).gameObject.SetActive(true);
			}
		}
	}
	public class MoveObject : NetworkBehaviour
	{
		public float moveSpeed;

		public List<Vector3> targetPositions = new List<Vector3>();

		private NetworkVariable<int> networkedTargetPositionsIndex = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private int targetPositionsIndex
		{
			get
			{
				return networkedTargetPositionsIndex.Value;
			}
			set
			{
				networkedTargetPositionsIndex.Value = value;
			}
		}

		public void Update()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, targetPositions[targetPositionsIndex], Time.deltaTime * moveSpeed);
		}

		public void TogglePositionForward(GameObject gameObject)
		{
			TogglePositionServerRpc(isForward: true);
		}

		public void TogglePositionBackward(GameObject gameObject)
		{
			TogglePositionServerRpc(isForward: false);
		}

		[ServerRpc]
		public void TogglePositionServerRpc(bool isForward)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_00dd: 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)base.__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(4285485337u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isForward, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4285485337u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			if (isForward)
			{
				Debug.Log((object)"Moving Forward");
				if (targetPositionsIndex != targetPositions.Count - 1)
				{
					targetPositionsIndex++;
				}
				else
				{
					targetPositionsIndex = 0;
				}
			}
			else
			{
				Debug.Log((object)"Moving Backward");
				if (targetPositionsIndex == 0)
				{
					targetPositionsIndex = targetPositions.Count - 1;
				}
				else
				{
					targetPositionsIndex--;
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_MoveObject()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(4285485337u, new RpcReceiveHandler(__rpc_handler_4285485337));
		}

		private static void __rpc_handler_4285485337(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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_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 isForward = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isForward, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((MoveObject)(object)target).TogglePositionServerRpc(isForward);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "MoveObject";
		}
	}
	public class ParentObject : NetworkBehaviour
	{
		public bool checkForNetworkObjects = true;

		public List<ParentConstraint> currentConstraints = new List<ParentConstraint>();

		public List<GameObject> registeredParents = new List<GameObject>();

		public Vector3 lastFramePosition;

		public void ParentGameObject(GameObject newChild)
		{
			PlayerControllerB componentInParent = ((Component)this).GetComponentInParent<PlayerControllerB>();
			if ((Object)(object)componentInParent != (Object)null)
			{
				newChild = ((Component)componentInParent).gameObject;
			}
			if (!registeredParents.Contains(newChild))
			{
				registeredParents.Add(newChild);
			}
		}

		public void UnparentGameObject(GameObject currentChild)
		{
			PlayerControllerB componentInParent = ((Component)this).GetComponentInParent<PlayerControllerB>();
			if ((Object)(object)componentInParent != (Object)null)
			{
				currentChild = ((Component)componentInParent).gameObject;
			}
			if (registeredParents.Contains(currentChild))
			{
				registeredParents.Add(currentChild);
			}
		}

		public void FixedUpdate()
		{
			//IL_002a: 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_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)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			foreach (GameObject registeredParent in registeredParents)
			{
				if ((Object)(object)registeredParent != (Object)null)
				{
					Transform transform = registeredParent.transform;
					transform.position += ((Component)this).transform.position - lastFramePosition;
				}
			}
		}

		public void LateUpdate()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			lastFramePosition = ((Component)this).transform.position;
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ParentObject";
		}
	}
	public class RotateObject : NetworkBehaviour
	{
		public float moveSpeed;

		public List<Vector3> targetRotations = new List<Vector3>();

		private NetworkVariable<int> networkedTargetRotationsIndex = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private Vector3 targetRotation;

		private int targetRotationsIndex
		{
			get
			{
				return networkedTargetRotationsIndex.Value;
			}
			set
			{
				networkedTargetRotationsIndex.Value = value;
			}
		}

		public void Update()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(targetRotations[targetRotationsIndex]), Time.deltaTime * moveSpeed);
		}

		public void ToggleRotationForward(GameObject gameObject)
		{
			ToggleRotationServerRpc(isForward: true);
		}

		public void ToggleRotationBackward(GameObject gameObject)
		{
			ToggleRotationServerRpc(isForward: false);
		}

		[ServerRpc]
		public void ToggleRotationServerRpc(bool isForward)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_00dd: 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)base.__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(3550389085u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isForward, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3550389085u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			if (isForward)
			{
				Debug.Log((object)"Rotating Forward");
				if (targetRotationsIndex != targetRotations.Count - 1)
				{
					targetRotationsIndex++;
				}
				else
				{
					targetRotationsIndex = 0;
				}
			}
			else
			{
				Debug.Log((object)"Rotating Backward");
				if (targetRotationsIndex == 0)
				{
					targetRotationsIndex = targetRotations.Count - 1;
				}
				else
				{
					targetRotationsIndex--;
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_RotateObject()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3550389085u, new RpcReceiveHandler(__rpc_handler_3550389085));
		}

		private static void __rpc_handler_3550389085(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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_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 isForward = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isForward, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((RotateObject)(object)target).ToggleRotationServerRpc(isForward);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "RotateObject";
		}
	}
	public class AwakeEvent : NetworkBehaviour
	{
		public UnityEvent onAwakeEvent;

		public void Awake()
		{
			onAwakeEvent.Invoke();
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "AwakeEvent";
		}
	}
	[Serializable]
	public class GameObjectEvent : UnityEvent<GameObject>
	{
	}
	public class OnCollisionEnterEvent : MonoBehaviour
	{
		public string tagFilter;

		public bool debugAllContacts;

		public GameObjectEvent onCollisionEnterEvent;

		public void OnCollisionEnter(Collision other)
		{
			if (debugAllContacts)
			{
				Debug.Log((object)(((Object)((Component)this).gameObject).name + " hit " + ((Object)other.gameObject).name));
			}
			if (tagFilter == string.Empty || other.gameObject.CompareTag(tagFilter))
			{
				((UnityEvent<GameObject>)onCollisionEnterEvent)?.Invoke(other.gameObject);
			}
		}

		public void DebugLog(GameObject other)
		{
			Debug.Log((object)((Object)other).name);
		}
	}
	public class OnTriggerEnterEvent : MonoBehaviour
	{
		public ComparisonType comparisonType;

		public string filter;

		public bool debugAllContacts;

		public bool checkPreviousRoot;

		public GameObjectEvent onCollisionEnterEvent;

		public int frameCooldown = 0;

		private int frameCooldownCounter;

		public Transform previousRoot;

		public bool onCooldown => frameCooldownCounter != frameCooldown;

		public void OnTriggerEnter(Collider other)
		{
			if (!((Object)(object)((Component)other).transform.root == (Object)(object)previousRoot) && !onCooldown)
			{
				Comparison comparison = new Comparison(comparisonType, filter);
				if (debugAllContacts)
				{
					Debug.Log((object)("GameObject Name: " + ((Object)((Component)other).gameObject).name + " GameObject Tag: " + ((Component)other).gameObject.tag));
				}
				if (comparison.ValidComparison(((Component)other).gameObject))
				{
					previousRoot = ((Component)other).transform.root;
					((UnityEvent<GameObject>)onCollisionEnterEvent)?.Invoke(((Component)other).gameObject);
				}
			}
		}

		public void OnTriggerExit(Collider other)
		{
			if ((Object)(object)((Component)other).transform.root == (Object)(object)previousRoot)
			{
				previousRoot = null;
			}
		}

		public void Update()
		{
			if (frameCooldownCounter == frameCooldown)
			{
				frameCooldownCounter = 0;
			}
			else
			{
				frameCooldownCounter++;
			}
		}

		public void DebugLog(GameObject other)
		{
			Debug.Log((object)("DebugLog - GameObject Name: " + ((Object)other.gameObject).name + " GameObject Tag: " + other.gameObject.tag));
		}
	}
	public class OnTriggerExitEvent : MonoBehaviour
	{
		public ComparisonType comparisonType;

		public string filter;

		public bool debugAllContacts;

		public GameObjectEvent onCollisionExitEvent;

		public void OnTriggerExit(Collider other)
		{
			Comparison comparison = new Comparison(comparisonType, filter);
			if (debugAllContacts)
			{
				Debug.Log((object)("GameObject Name: " + ((Object)((Component)other).gameObject).name + " GameObject Tag: " + ((Component)other).gameObject.tag));
			}
			if (comparison.ValidComparison(((Component)other).gameObject))
			{
				((UnityEvent<GameObject>)onCollisionExitEvent)?.Invoke(((Component)other).gameObject);
			}
		}

		public void DebugLog(GameObject other)
		{
			Debug.Log((object)("DebugLog - GameObject Name: " + ((Object)other.gameObject).name + " GameObject Tag: " + other.gameObject.tag));
		}
	}
	public class ApparatusTakenEvent : NetworkBehaviour
	{
		public UnityEvent onApparatusTakenEvent;

		public void Awake()
		{
			LevelManager.GlobalLevelEvents.onApparatusTaken.AddListener((ParameterEvent<LungProp>)OnApparatusTakenEvent);
		}

		public void OnApparatusTakenEvent(LungProp lungProp)
		{
			onApparatusTakenEvent.Invoke();
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ApparatusTakenEvent";
		}
	}
	public class PlayerEnterDungeonEvent : NetworkBehaviour
	{
		public UnityEvent<PlayerControllerB> onPlayerEnterDungeonEvent;

		private List<EntranceTeleport> whitelistedEntranceTeleports = new List<EntranceTeleport>();

		public void Awake()
		{
			LevelManager.GlobalLevelEvents.onPlayerEnterDungeon.AddListener((ParameterEvent<(EntranceTeleport, PlayerControllerB)>)OnPlayerEnterDungeon);
		}

		public void OnPlayerEnterDungeon((EntranceTeleport, PlayerControllerB) teleporterAndPlayer)
		{
			if (whitelistedEntranceTeleports.Contains(teleporterAndPlayer.Item1))
			{
				onPlayerEnterDungeonEvent.Invoke(teleporterAndPlayer.Item2);
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PlayerEnterDungeonEvent";
		}
	}
	public class PlayerExitDungeonEvent : NetworkBehaviour
	{
		public UnityEvent<PlayerControllerB> onPlayerExitDungeonEvent;

		private List<EntranceTeleport> whitelistedEntranceTeleports = new List<EntranceTeleport>();

		public void Awake()
		{
			LevelManager.GlobalLevelEvents.onPlayerExitDungeon.AddListener((ParameterEvent<(EntranceTeleport, PlayerControllerB)>)OnPlayerExitDungeon);
		}

		public void OnPlayerExitDungeon((EntranceTeleport, PlayerControllerB) teleporterAndPlayer)
		{
			if (whitelistedEntranceTeleports.Contains(teleporterAndPlayer.Item1))
			{
				onPlayerExitDungeonEvent.Invoke(teleporterAndPlayer.Item2);
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PlayerExitDungeonEvent";
		}
	}
	public class PowerSwitchToggleEvent : NetworkBehaviour
	{
		public UnityEvent onPowerSwitchToggleOn;

		public UnityEvent onPowerSwitchToggleOff;

		public void Awake()
		{
			LevelManager.GlobalLevelEvents.onPowerSwitchToggle.AddListener((ParameterEvent<bool>)OnPowerSwitchToggle);
		}

		public void OnPowerSwitchToggle(bool result)
		{
			if (result)
			{
				onPowerSwitchToggleOn.Invoke();
			}
			else
			{
				onPowerSwitchToggleOff.Invoke();
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PowerSwitchToggleEvent";
		}
	}
	public class ShipLandEvent : NetworkBehaviour
	{
		public UnityEvent onShipLandEvent;

		public void Awake()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			LevelManager.GlobalLevelEvents.onShipLand.AddListener(new Event(OnShipLand));
		}

		public void OnShipLand()
		{
			onShipLandEvent.Invoke();
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ShipLandEvent";
		}
	}
	public class ShipLeaveEvent : NetworkBehaviour
	{
		public UnityEvent onShipLeaveEvent;

		public void Awake()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			LevelManager.GlobalLevelEvents.onShipLeave.AddListener(new Event(OnShipLeave));
		}

		public void OnShipLeave()
		{
			onShipLeaveEvent.Invoke();
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ShipLeaveEvent";
		}
	}
	public class TimeOfDayEvent : NetworkBehaviour
	{
		public DayMode filteredDayMode = (DayMode)(-1);

		public LevelWeatherType filteredWeatherType = (LevelWeatherType)(-1);

		public UnityEvent onTimeOfDayChanged;

		public void Awake()
		{
			LevelManager.GlobalLevelEvents.onDayModeToggle.AddListener((ParameterEvent<DayMode>)OnDayModeToggle);
		}

		public void OnDayModeToggle(DayMode dayMode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (dayMode == filteredDayMode && LevelManager.CurrentExtendedLevel.SelectableLevel.currentWeather == filteredWeatherType)
			{
				onTimeOfDayChanged.Invoke();
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "TimeOfDayEvent";
		}
	}
	[Serializable]
	public class ExtendedLevelReference
	{
		public string extendedLevelName;

		public ExtendedLevel ExtendedLevel { get; private set; }

		public void GetExtendedLevel()
		{
			if (!string.IsNullOrEmpty(extendedLevelName))
			{
				return;
			}
			foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels)
			{
				if (extendedLevelName.ToLower() == ((Object)extendedLevel).name.ToLower())
				{
					ExtendedLevel = extendedLevel;
				}
			}
		}
	}
	public enum ComparisonType
	{
		Tag,
		Name,
		IsPlayer
	}
	[Serializable]
	public class Comparison
	{
		public ComparisonType comparisonType;

		public string comparisonFilter = string.Empty;

		public Comparison(ComparisonType newComparisonType, string newComparisonFilter)
		{
			comparisonType = newComparisonType;
			comparisonFilter = newComparisonFilter;
		}

		public bool ValidComparison(GameObject comparableGameObject)
		{
			return ValidComparison(comparableGameObject, comparisonType);
		}

		public bool ValidComparison(GameObject comparableGameObject, ComparisonType comparisonType)
		{
			if (comparisonType == ComparisonType.Tag && comparableGameObject.CompareTag(comparisonFilter))
			{
				return true;
			}
			if (comparisonType == ComparisonType.Name && ((Object)comparableGameObject).name == comparisonFilter)
			{
				return true;
			}
			if (comparisonType == ComparisonType.IsPlayer)
			{
				foreach (GameObject playerAllObjects in Data.playerAllObjectsList)
				{
					if ((Object)(object)playerAllObjects == (Object)(object)comparableGameObject)
					{
						return true;
					}
				}
			}
			return false;
		}
	}
	internal static class Data
	{
		public static List<GameObject> playerRootObjectsList = new List<GameObject>();

		public static List<GameObject> playerAllObjectsList = new List<GameObject>();

		public static void GetPlayerObjects()
		{
			PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
			foreach (PlayerControllerB val in array)
			{
				playerRootObjectsList.Add(((Component)val).gameObject);
				playerAllObjectsList.Add(((Component)val).gameObject);
				Transform[] componentsInChildren = ((Component)val).GetComponentsInChildren<Transform>();
				foreach (Transform val2 in componentsInChildren)
				{
					if (!playerAllObjectsList.Contains(((Component)val2).gameObject))
					{
						playerAllObjectsList.Add(((Component)val2).gameObject);
					}
				}
			}
		}

		public static bool TryFindPlayer(GameObject child, out GameObject playerObject)
		{
			Transform parent = child.transform.parent;
			playerObject = null;
			while ((Object)(object)parent != (Object)null)
			{
				foreach (GameObject playerRootObjects in playerRootObjectsList)
				{
					if ((Object)(object)((Component)parent).gameObject == (Object)(object)playerRootObjects)
					{
						playerObject = playerRootObjects;
						return true;
					}
				}
				parent = parent.parent;
			}
			return false;
		}
	}
	[Serializable]
	public class UnityEventExtendedContent : UnityEvent<ExtendedContent>
	{
	}
	public class RuntimeReferenceCollector : MonoBehaviour
	{
		public ScriptableObject contentToFind;

		[HideInInspector]
		private ExtendedContent foundContent;

		public UnityEventExtendedContent onContentFound;

		public void Awake()
		{
			if (!((Object)(object)contentToFind == (Object)null))
			{
				foundContent = TryFindContent(contentToFind);
				if ((Object)(object)foundContent != (Object)null)
				{
					((UnityEvent<ExtendedContent>)onContentFound).Invoke(foundContent);
				}
			}
		}

		public ExtendedContent TryFindContent(ScriptableObject referenceContent)
		{
			ExtendedContent result = null;
			SelectableLevel val = (SelectableLevel)(object)((referenceContent is SelectableLevel) ? referenceContent : null);
			if (val != null)
			{
				ExtendedLevel val2 = default(ExtendedLevel);
				if (PatchedContent.TryGetExtendedContent(val, ref val2))
				{
					result = (ExtendedContent)(object)val2;
				}
			}
			else
			{
				DungeonFlow val3 = (DungeonFlow)(object)((referenceContent is DungeonFlow) ? referenceContent : null);
				if (val3 != null)
				{
					ExtendedDungeonFlow val4 = default(ExtendedDungeonFlow);
					if (PatchedContent.TryGetExtendedContent(val3, ref val4))
					{
						result = (ExtendedContent)(object)val4;
					}
				}
				else
				{
					Item val5 = (Item)(object)((referenceContent is Item) ? referenceContent : null);
					if (val5 != null)
					{
						ExtendedItem val6 = default(ExtendedItem);
						if (PatchedContent.TryGetExtendedContent(val5, ref val6))
						{
							result = (ExtendedContent)(object)val6;
						}
					}
					else
					{
						EnemyType val7 = (EnemyType)(object)((referenceContent is EnemyType) ? referenceContent : null);
						ExtendedEnemyType val8 = default(ExtendedEnemyType);
						if (val7 != null && PatchedContent.TryGetExtendedContent(val7, ref val8))
						{
							result = (ExtendedContent)(object)val8;
						}
					}
				}
			}
			return result;
		}
	}
}
namespace LethalToolbox.Filters
{
	public class PlayerInventoryFilter : NetworkBehaviour
	{
		public UnityEvent<PlayerControllerB> onFilteredEvent;

		public List<string> itemNameFilters = new List<string>();

		public void FilterEvent(PlayerControllerB player)
		{
			if (!((Object)(object)player != (Object)null))
			{
				return;
			}
			GrabbableObject[] itemSlots = player.ItemSlots;
			foreach (GrabbableObject val in itemSlots)
			{
				if ((Object)(object)val != (Object)null && itemNameFilters.Contains(((Object)val.itemProperties).name))
				{
					onFilteredEvent.Invoke(player);
				}
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PlayerInventoryFilter";
		}
	}
}
namespace LethalToolbox.Actions.LethalLevelLoader
{
	public class ToggleRouteProperties : MonoBehaviour
	{
		public string extendedLevelName;

		public ExtendedLevelReference extendedLevelReference;

		public void Awake()
		{
			extendedLevelReference.GetExtendedLevel();
			if ((Object)(object)extendedLevelReference.ExtendedLevel == (Object)null)
			{
				Debug.Log((object)("LethalToolbox: Could Not Find ExtendedLevel: " + extendedLevelReference.extendedLevelName + ", Disabling Component!"));
				((Behaviour)this).enabled = false;
			}
		}

		public void ToggleIsRouteHidden(bool value)
		{
			if ((Object)(object)extendedLevelReference.ExtendedLevel != (Object)null)
			{
				extendedLevelReference.ExtendedLevel.IsRouteHidden = value;
			}
		}

		public void ToggleIsRouteLocked(bool value)
		{
			if ((Object)(object)extendedLevelReference.ExtendedLevel != (Object)null)
			{
				extendedLevelReference.ExtendedLevel.IsRouteLocked = value;
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace LethalToolbox.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}