Decompiled source of TestingLib v1.2.1

plugins/TestingLib/TestingLib.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 GameNetcodeStuff;
using HarmonyLib;
using IL;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On;
using On.GameNetcodeStuff;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
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: AssemblyCompany("TestingLib")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("TestingLib for Lethal Company.")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1+29ba464d1a8b40929f9cccc784677d83f373199d")]
[assembly: AssemblyProduct("TestingLib")]
[assembly: AssemblyTitle("TestingLib")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TestingLib
{
	internal class Helper
	{
		internal static void ListAllEnemies(bool nameOnly)
		{
			Plugin.Logger.LogInfo((object)"-- Inside Enemies ---");
			PrintListEnemy(RoundManager.Instance.currentLevel.Enemies, nameOnly);
			Plugin.Logger.LogInfo((object)"-- Outside Enemies --");
			PrintListEnemy(RoundManager.Instance.currentLevel.OutsideEnemies, nameOnly);
			Plugin.Logger.LogInfo((object)"-- Daytime Enemies --");
			PrintListEnemy(RoundManager.Instance.currentLevel.DaytimeEnemies, nameOnly);
		}

		private static void PrintListEnemy(List<SpawnableEnemyWithRarity> listOfEnemies, bool nameOnly)
		{
			foreach (SpawnableEnemyWithRarity listOfEnemy in listOfEnemies)
			{
				string text = listOfEnemy.enemyType.enemyName.Replace(' ', '_');
				text = text.Replace('-', '_');
				if (nameOnly)
				{
					Plugin.Logger.LogInfo((object)listOfEnemy.enemyType.enemyName);
					continue;
				}
				Plugin.Logger.LogInfo((object)("public const string " + text + " = \"" + listOfEnemy.enemyType.enemyName + "\";"));
			}
			Plugin.Logger.LogInfo((object)"---------------------");
		}

		internal static void ListAllItems(bool nameOnly)
		{
			Plugin.Logger.LogInfo((object)"-- Items ------------");
			foreach (Item items in StartOfRound.Instance.allItemsList.itemsList)
			{
				string text = items.itemName.Replace(' ', '_');
				text = text.Replace('-', '_');
				if (nameOnly)
				{
					Plugin.Logger.LogInfo((object)items.itemName);
					continue;
				}
				Plugin.Logger.LogInfo((object)("public const string " + text + " = \"" + items.itemName + "\";"));
			}
			Plugin.Logger.LogInfo((object)"---------------------");
		}
	}
	internal class Instances
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Start <0>__QuickMenuManager_Start;
		}

		internal static QuickMenuManager QMM_Instance;

		internal static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			object obj = <>O.<0>__QuickMenuManager_Start;
			if (obj == null)
			{
				hook_Start val = QuickMenuManager_Start;
				<>O.<0>__QuickMenuManager_Start = val;
				obj = (object)val;
			}
			QuickMenuManager.Start += (hook_Start)obj;
		}

		private static void QuickMenuManager_Start(orig_Start orig, QuickMenuManager self)
		{
			QMM_Instance = self;
			orig.Invoke(self);
		}
	}
	public class Enemy
	{
		public static IEnumerator DrawPath(LineRenderer line, NavMeshAgent agent)
		{
			if (((Behaviour)agent).enabled)
			{
				yield return (object)new WaitForEndOfFrame();
				line.SetPosition(0, ((Component)agent).transform.position);
				line.positionCount = agent.path.corners.Length;
				for (int i = 1; i < agent.path.corners.Length; i++)
				{
					line.SetPosition(i, agent.path.corners[i]);
				}
			}
		}
	}
	[Attributes.DevTools(Attributes.Visibility.Whitelist, Attributes.Available.PlayerSpawn)]
	public class Execute
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_SetPlayerSafeInShip <0>__StartOfRound_SetPlayerSafeInShip;
		}

		[Attributes.DevTools(Attributes.Visibility.ConfigOnly)]
		public static void ToggleTestRoom()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_003a: 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)
			//IL_0045: Expected O, but got Unknown
			Plugin.Logger.LogInfo((object)"Execute: Toggle Test Room");
			Instances.QMM_Instance.Debug_ToggleTestRoom();
			if (Object.op_Implicit((Object)(object)StartOfRound.Instance.testRoom))
			{
				object obj = <>O.<0>__StartOfRound_SetPlayerSafeInShip;
				if (obj == null)
				{
					hook_SetPlayerSafeInShip val = StartOfRound_SetPlayerSafeInShip;
					<>O.<0>__StartOfRound_SetPlayerSafeInShip = val;
					obj = (object)val;
				}
				StartOfRound.SetPlayerSafeInShip += (hook_SetPlayerSafeInShip)obj;
			}
			else
			{
				object obj2 = <>O.<0>__StartOfRound_SetPlayerSafeInShip;
				if (obj2 == null)
				{
					hook_SetPlayerSafeInShip val2 = StartOfRound_SetPlayerSafeInShip;
					<>O.<0>__StartOfRound_SetPlayerSafeInShip = val2;
					obj2 = (object)val2;
				}
				StartOfRound.SetPlayerSafeInShip -= (hook_SetPlayerSafeInShip)obj2;
			}
		}

		private static void StartOfRound_SetPlayerSafeInShip(orig_SetPlayerSafeInShip orig, StartOfRound self)
		{
			bool isInHangarShipRoom = GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom;
			if (isInHangarShipRoom)
			{
				GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom = false;
			}
			orig.Invoke(self);
			if (isInHangarShipRoom)
			{
				GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom = isInHangarShipRoom;
			}
		}
	}
	public class OnEvent
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_SpawnPlayerAnimation <0>__PlayerControllerB_SpawnPlayerAnimation;
		}

		public static event Action PlayerSpawn;

		internal static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			object obj = <>O.<0>__PlayerControllerB_SpawnPlayerAnimation;
			if (obj == null)
			{
				hook_SpawnPlayerAnimation val = PlayerControllerB_SpawnPlayerAnimation;
				<>O.<0>__PlayerControllerB_SpawnPlayerAnimation = val;
				obj = (object)val;
			}
			PlayerControllerB.SpawnPlayerAnimation += (hook_SpawnPlayerAnimation)obj;
		}

		private static void PlayerControllerB_SpawnPlayerAnimation(orig_SpawnPlayerAnimation orig, PlayerControllerB self)
		{
			OnEvent.PlayerSpawn?.Invoke();
			if (Patch.shouldSkipSpawnPlayerAnimation)
			{
				Plugin.Logger.LogInfo((object)"Patch: SkipSpawnPlayerAnimation");
			}
			else
			{
				orig.Invoke(self);
			}
		}
	}
	[Attributes.DevTools(Attributes.Visibility.Whitelist, Attributes.Available.Always)]
	public class Patch
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Update <0>__InfiniteSprint_PlayerControllerB_Update;

			public static hook_Jump_performed <1>__PlayerControllerB_Jump_performed;

			public static hook_Update <2>__PlayerControllerB_Update;

			public static hook_RunTerminalEvents <3>__Terminal_RunTerminalEvents;

			public static Manipulator <4>__ShotgunItem_ItemActivate;
		}

		private static bool shouldDebug;

		internal static bool shouldSkipSpawnPlayerAnimation;

		public static void IsEditor()
		{
			shouldDebug = true;
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPostfix]
		private static void Application_isEditor_Postfix(ref bool __result)
		{
			if (shouldDebug)
			{
				__result = true;
			}
		}

		public static void InfiniteSprint()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: 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: Expected O, but got Unknown
			object obj = <>O.<0>__InfiniteSprint_PlayerControllerB_Update;
			if (obj == null)
			{
				hook_Update val = InfiniteSprint_PlayerControllerB_Update;
				<>O.<0>__InfiniteSprint_PlayerControllerB_Update = val;
				obj = (object)val;
			}
			PlayerControllerB.Update -= (hook_Update)obj;
			object obj2 = <>O.<0>__InfiniteSprint_PlayerControllerB_Update;
			if (obj2 == null)
			{
				hook_Update val2 = InfiniteSprint_PlayerControllerB_Update;
				<>O.<0>__InfiniteSprint_PlayerControllerB_Update = val2;
				obj2 = (object)val2;
			}
			PlayerControllerB.Update += (hook_Update)obj2;
		}

		private static void InfiniteSprint_PlayerControllerB_Update(orig_Update orig, PlayerControllerB self)
		{
			orig.Invoke(self);
			self.sprintMeter = 1f;
		}

		[Attributes.DevTools(Attributes.Visibility.ConfigOnly)]
		public static void SkipSpawnPlayerAnimation()
		{
			shouldSkipSpawnPlayerAnimation = true;
		}

		public static void OnDeathHeal()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			MethodInfo methodInfo = AccessTools.DeclaredMethod(typeof(PlayerControllerB), "KillPlayer", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.DeclaredMethod(typeof(Patch), "PlayerControllerB_KillPlayer", (Type[])null, (Type[])null);
			Plugin._harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		private static bool PlayerControllerB_KillPlayer(PlayerControllerB __instance)
		{
			//IL_0029: 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)
			__instance.health = 100;
			__instance.MakeCriticallyInjured(false);
			HUDManager.Instance.UpdateHealthUI(__instance.health, false);
			__instance.DamagePlayer(0, false, true, (CauseOfDeath)0, 0, false, default(Vector3));
			return false;
		}

		public static void MovementCheat()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: 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: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			object obj = <>O.<1>__PlayerControllerB_Jump_performed;
			if (obj == null)
			{
				hook_Jump_performed val = PlayerControllerB_Jump_performed;
				<>O.<1>__PlayerControllerB_Jump_performed = val;
				obj = (object)val;
			}
			PlayerControllerB.Jump_performed -= (hook_Jump_performed)obj;
			object obj2 = <>O.<1>__PlayerControllerB_Jump_performed;
			if (obj2 == null)
			{
				hook_Jump_performed val2 = PlayerControllerB_Jump_performed;
				<>O.<1>__PlayerControllerB_Jump_performed = val2;
				obj2 = (object)val2;
			}
			PlayerControllerB.Jump_performed += (hook_Jump_performed)obj2;
			object obj3 = <>O.<2>__PlayerControllerB_Update;
			if (obj3 == null)
			{
				hook_Update val3 = PlayerControllerB_Update;
				<>O.<2>__PlayerControllerB_Update = val3;
				obj3 = (object)val3;
			}
			PlayerControllerB.Update -= (hook_Update)obj3;
			object obj4 = <>O.<2>__PlayerControllerB_Update;
			if (obj4 == null)
			{
				hook_Update val4 = PlayerControllerB_Update;
				<>O.<2>__PlayerControllerB_Update = val4;
				obj4 = (object)val4;
			}
			PlayerControllerB.Update += (hook_Update)obj4;
		}

		private static void PlayerControllerB_Update(orig_Update orig, PlayerControllerB self)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if (self.isSpeedCheating)
			{
				self.walkForce *= 0.8f;
				self.walkForce = Vector3.ClampMagnitude(self.walkForce, 0.1f);
				if (self.isSprinting)
				{
					self.fallValue -= 130f * Time.deltaTime;
					self.thisController.Move(self.walkForce * 700f * Time.deltaTime);
				}
				else
				{
					self.thisController.Move(self.walkForce * 200f * Time.deltaTime);
				}
			}
			orig.Invoke(self);
		}

		private static void PlayerControllerB_Jump_performed(orig_Jump_performed orig, PlayerControllerB self, CallbackContext context)
		{
			self.playerSlidingTimer = 0f;
			self.isJumping = true;
			self.sprintMeter = Mathf.Clamp(self.sprintMeter - 0.08f, 0f, 1f);
			self.movementAudio.PlayOneShot(StartOfRound.Instance.playerJumpSFX);
			if (self.jumpCoroutine != null)
			{
				((MonoBehaviour)self).StopCoroutine(self.jumpCoroutine);
				self.isSpeedCheating = true;
				if (self.isSprinting)
				{
					self.jumpForce = 50f;
				}
				else
				{
					self.jumpForce = 13f;
				}
				self.jumpCoroutine = ((MonoBehaviour)self).StartCoroutine(CustomPlayerJump(self));
			}
			else
			{
				self.jumpCoroutine = ((MonoBehaviour)self).StartCoroutine(self.PlayerJump());
			}
		}

		private static IEnumerator CustomPlayerJump(PlayerControllerB self)
		{
			self.playerBodyAnimator.SetBool("Jumping", true);
			self.fallValue = self.jumpForce;
			self.fallValueUncapped = self.jumpForce;
			yield return (object)new WaitForSeconds(0.1f);
			self.isJumping = false;
			self.isFallingFromJump = true;
			yield return (object)new WaitUntil((Func<bool>)(() => self.thisController.isGrounded));
			self.playerBodyAnimator.SetBool("Jumping", false);
			self.isFallingFromJump = false;
			self.PlayerHitGroundEffects();
			self.jumpCoroutine = null;
			self.isSpeedCheating = false;
			self.jumpForce = 13f;
		}

		public static void InfiniteCredits()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: 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: Expected O, but got Unknown
			object obj = <>O.<3>__Terminal_RunTerminalEvents;
			if (obj == null)
			{
				hook_RunTerminalEvents val = Terminal_RunTerminalEvents;
				<>O.<3>__Terminal_RunTerminalEvents = val;
				obj = (object)val;
			}
			Terminal.RunTerminalEvents -= (hook_RunTerminalEvents)obj;
			object obj2 = <>O.<3>__Terminal_RunTerminalEvents;
			if (obj2 == null)
			{
				hook_RunTerminalEvents val2 = Terminal_RunTerminalEvents;
				<>O.<3>__Terminal_RunTerminalEvents = val2;
				obj2 = (object)val2;
			}
			Terminal.RunTerminalEvents += (hook_RunTerminalEvents)obj2;
		}

		private static void Terminal_RunTerminalEvents(orig_RunTerminalEvents orig, Terminal self, TerminalNode node)
		{
			self.groupCredits = 100000000;
		}

		public static void InfiniteShotgunAmmo()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: 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: Expected O, but got Unknown
			object obj = <>O.<4>__ShotgunItem_ItemActivate;
			if (obj == null)
			{
				Manipulator val = ShotgunItem_ItemActivate;
				<>O.<4>__ShotgunItem_ItemActivate = val;
				obj = (object)val;
			}
			ShotgunItem.ItemActivate -= (Manipulator)obj;
			object obj2 = <>O.<4>__ShotgunItem_ItemActivate;
			if (obj2 == null)
			{
				Manipulator val2 = ShotgunItem_ItemActivate;
				<>O.<4>__ShotgunItem_ItemActivate = val2;
				obj2 = (object)val2;
			}
			ShotgunItem.ItemActivate += (Manipulator)obj2;
		}

		private static void ShotgunItem_ItemActivate(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<ShotgunItem>(x, "shellsLoaded")
			});
			val.Remove();
			val.Emit(OpCodes.Pop);
			val.Next.OpCode = OpCodes.Br;
		}

		[Attributes.DevTools(Attributes.Visibility.MenuOnly)]
		public static void PatchAll()
		{
			IsEditor();
			SkipSpawnPlayerAnimation();
			OnDeathHeal();
			MovementCheat();
			InfiniteSprint();
			InfiniteCredits();
			InfiniteShotgunAmmo();
		}

		[Attributes.DevTools(Attributes.Visibility.MenuOnly)]
		public static void UnpatchAll()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			shouldDebug = false;
			object obj = <>O.<0>__InfiniteSprint_PlayerControllerB_Update;
			if (obj == null)
			{
				hook_Update val = InfiniteSprint_PlayerControllerB_Update;
				<>O.<0>__InfiniteSprint_PlayerControllerB_Update = val;
				obj = (object)val;
			}
			PlayerControllerB.Update -= (hook_Update)obj;
			shouldSkipSpawnPlayerAnimation = false;
			MethodInfo methodInfo = AccessTools.DeclaredMethod(typeof(PlayerControllerB), "KillPlayer", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.DeclaredMethod(typeof(Patch), "PlayerControllerB_KillPlayer", (Type[])null, (Type[])null);
			Plugin._harmony.Unpatch((MethodBase)methodInfo, methodInfo2);
			object obj2 = <>O.<1>__PlayerControllerB_Jump_performed;
			if (obj2 == null)
			{
				hook_Jump_performed val2 = PlayerControllerB_Jump_performed;
				<>O.<1>__PlayerControllerB_Jump_performed = val2;
				obj2 = (object)val2;
			}
			PlayerControllerB.Jump_performed -= (hook_Jump_performed)obj2;
			object obj3 = <>O.<2>__PlayerControllerB_Update;
			if (obj3 == null)
			{
				hook_Update val3 = PlayerControllerB_Update;
				<>O.<2>__PlayerControllerB_Update = val3;
				obj3 = (object)val3;
			}
			PlayerControllerB.Update -= (hook_Update)obj3;
			object obj4 = <>O.<3>__Terminal_RunTerminalEvents;
			if (obj4 == null)
			{
				hook_RunTerminalEvents val4 = Terminal_RunTerminalEvents;
				<>O.<3>__Terminal_RunTerminalEvents = val4;
				obj4 = (object)val4;
			}
			Terminal.RunTerminalEvents -= (hook_RunTerminalEvents)obj4;
			object obj5 = <>O.<4>__ShotgunItem_ItemActivate;
			if (obj5 == null)
			{
				Manipulator val5 = ShotgunItem_ItemActivate;
				<>O.<4>__ShotgunItem_ItemActivate = val5;
				obj5 = (object)val5;
			}
			ShotgunItem.ItemActivate -= (Manipulator)obj5;
		}
	}
	[Attributes.DevTools(Attributes.Visibility.Whitelist, Attributes.Available.PlayerSpawn)]
	public class Tools
	{
		public enum TeleportLocation
		{
			Inside = 1,
			Outside
		}

		[Attributes.DevTools(Attributes.Visibility.ConfigOnly, Attributes.Available.PlayerSpawn)]
		public static void TeleportSelf(TeleportLocation location = (TeleportLocation)0)
		{
			//IL_003a: 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)
			switch (location)
			{
			case TeleportLocation.Inside:
				Plugin.Logger.LogInfo((object)"Tools: Teleport Inside");
				((Component)GameNetworkManager.Instance.localPlayerController).transform.position = new Vector3(8f, -173.6f, -32f);
				GameNetworkManager.Instance.localPlayerController.isInsideFactory = true;
				break;
			case TeleportLocation.Outside:
				Plugin.Logger.LogInfo((object)"Tools: Teleport Outside");
				((Component)GameNetworkManager.Instance.localPlayerController).transform.position = new Vector3(50f, -5.4f, 0f);
				break;
			}
			GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom = false;
		}

		[Attributes.DevTools(Attributes.Visibility.MenuOnly, Attributes.Available.PlayerSpawn)]
		public static void TeleportSelfToEntrance()
		{
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			int num = 0;
			EntranceTeleport[] array = Object.FindObjectsByType<EntranceTeleport>((FindObjectsSortMode)0);
			EntranceTeleport[] array2 = array;
			foreach (EntranceTeleport val in array2)
			{
				if (val.entranceId == num && localPlayerController.isInsideFactory != val.isEntranceToBuilding)
				{
					val.TeleportPlayer();
					break;
				}
			}
		}

		[Attributes.DevTools(Attributes.Visibility.ConfigOnly, Attributes.Available.PlayerSpawn)]
		public static void SpawnEnemyInFrontOfSelf(string enemyName)
		{
			//IL_002b: 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)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Logger.LogInfo((object)"Tools: SpawnEnemyInFrontOfSelf");
			Vector3 val = ((Component)GameNetworkManager.Instance.localPlayerController).transform.position - Vector3.Scale(new Vector3(-5f, 0f, -5f), ((Component)GameNetworkManager.Instance.localPlayerController).transform.forward);
			List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
			list.AddRange(RoundManager.Instance.currentLevel.Enemies);
			list.AddRange(RoundManager.Instance.currentLevel.OutsideEnemies);
			list.AddRange(RoundManager.Instance.currentLevel.DaytimeEnemies);
			SpawnableEnemyWithRarity val2 = list.Find((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.Equals(enemyName));
			if (val2 == null)
			{
				Helper.ListAllEnemies(nameOnly: true);
			}
			else
			{
				RoundManager.Instance.SpawnEnemyGameObject(val, 0f, -1, val2.enemyType);
			}
		}

		[Attributes.DevTools(Attributes.Visibility.ConfigOnly, Attributes.Available.PlayerSpawn)]
		public static void GiveItemToSelf(string itemName)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			Item val = StartOfRound.Instance.allItemsList.itemsList.Find((Item x) => x.itemName.Equals(itemName));
			if ((Object)(object)val == (Object)null)
			{
				Helper.ListAllItems(nameOnly: true);
				return;
			}
			GameObject val2 = Object.Instantiate<GameObject>(val.spawnPrefab, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position, Quaternion.identity, StartOfRound.Instance.propsContainer);
			GrabbableObject component = val2.GetComponent<GrabbableObject>();
			component.fallTime = 0f;
			((NetworkBehaviour)component).NetworkObject.Spawn(false);
			((MonoBehaviour)component).StartCoroutine(WaitAndGrabObject(val2, component));
		}

		private static IEnumerator WaitAndGrabObject(GameObject obj, GrabbableObject _obj)
		{
			yield return (object)new WaitForEndOfFrame();
			_obj.InteractItem();
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (GameNetworkManager.Instance.localPlayerController.FirstEmptyItemSlot() == -1)
			{
				Plugin.Logger.LogInfo((object)"GiveItemToSelf: Could not grab item, inventory full!");
				yield break;
			}
			localPlayerController.twoHanded = _obj.itemProperties.twoHanded;
			localPlayerController.carryWeight += Mathf.Clamp(_obj.itemProperties.weight - 1f, 0f, 10f);
			localPlayerController.grabbedObjectValidated = true;
			localPlayerController.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)_obj).NetworkObject));
			_obj.GrabItemOnClient();
			_obj.parentObject = localPlayerController.localItemHolder;
			localPlayerController.isHoldingObject = true;
			_obj.hasBeenHeld = true;
			_obj.EnablePhysics(false);
		}

		[Attributes.DevTools(Attributes.Visibility.Blacklist)]
		[Obsolete("Please use Patch.PatchAll() instead.")]
		public static void RunAllPatchAndExecuteMethods()
		{
			Patch.IsEditor();
			Patch.SkipSpawnPlayerAnimation();
			Patch.OnDeathHeal();
			Patch.MovementCheat();
			Patch.InfiniteSprint();
			Patch.InfiniteCredits();
			Patch.InfiniteShotgunAmmo();
			OnEvent.PlayerSpawn -= OnEvent_PlayerSpawn;
			OnEvent.PlayerSpawn += OnEvent_PlayerSpawn;
		}

		private static void OnEvent_PlayerSpawn()
		{
			Execute.ToggleTestRoom();
		}
	}
	public class Attributes
	{
		public enum Visibility
		{
			Whitelist,
			Blacklist,
			MenuOnly,
			ConfigOnly
		}

		public enum Available
		{
			Always,
			PlayerSpawn
		}

		public class DevTools : Attribute
		{
			private Visibility kindVisiblity;

			private Available kindTime;

			public Visibility Visibility => kindVisiblity;

			public Available Time => kindTime;

			public DevTools(Visibility initVisiblity, Available initTime)
			{
				kindVisiblity = initVisiblity;
				kindTime = initTime;
			}

			public DevTools(Visibility initVisibility)
			{
				kindVisiblity = initVisibility;
				kindTime = Available.Always;
			}
		}
	}
	public class Lookup
	{
		public class Item
		{
			public const string Binoculars = "Binoculars";

			public const string Boombox = "Boombox";

			public const string box = "box";

			public const string Flashlight = "Flashlight";

			public const string Jetpack = "Jetpack";

			public const string Key = "Key";

			public const string Lockpicker = "Lockpicker";

			public const string Apparatus = "Apparatus";

			public const string Mapper = "Mapper";

			public const string Pro_flashlight = "Pro-flashlight";

			public const string Shovel = "Shovel";

			public const string Stun_grenade = "Stun grenade";

			public const string Extension_ladder = "Extension ladder";

			public const string TZP_Inhalant = "TZP-Inhalant";

			public const string Walkie_talkie = "Walkie-talkie";

			public const string Zap_gun = "Zap gun";

			public const string Magic_7_ball = "Magic 7 ball";

			public const string Airhorn = "Airhorn";

			public const string Bell = "Bell";

			public const string Big_bolt = "Big bolt";

			public const string Bottles = "Bottles";

			public const string Brush = "Brush";

			public const string Candy = "Candy";

			public const string Cash_register = "Cash register";

			public const string Chemical_jug = "Chemical jug";

			public const string Clown_horn = "Clown horn";

			public const string Large_axle = "Large axle";

			public const string Teeth = "Teeth";

			public const string Dust_pan = "Dust pan";

			public const string Egg_beater = "Egg beater";

			public const string V_type_engine = "V-type engine";

			public const string Golden_cup = "Golden cup";

			public const string Fancy_lamp = "Fancy lamp";

			public const string Painting = "Painting";

			public const string Plastic_fish = "Plastic fish";

			public const string Laser_pointer = "Laser pointer";

			public const string Gold_bar = "Gold bar";

			public const string Hairdryer = "Hairdryer";

			public const string Magnifying_glass = "Magnifying glass";

			public const string Metal_sheet = "Metal sheet";

			public const string Cookie_mold_pan = "Cookie mold pan";

			public const string Mug = "Mug";

			public const string Perfume_bottle = "Perfume bottle";

			public const string Old_phone = "Old phone";

			public const string Jar_of_pickles = "Jar of pickles";

			public const string Pill_bottle = "Pill bottle";

			public const string Remote = "Remote";

			public const string Ring = "Ring";

			public const string Toy_robot = "Toy robot";

			public const string Rubber_Ducky = "Rubber Ducky";

			public const string Red_soda = "Red soda";

			public const string Steering_wheel = "Steering wheel";

			public const string Stop_sign = "Stop sign";

			public const string Tea_kettle = "Tea kettle";

			public const string Toothpaste = "Toothpaste";

			public const string Toy_cube = "Toy cube";

			public const string Hive = "Hive";

			public const string Radar_booster = "Radar-booster";

			public const string Yield_sign = "Yield sign";

			public const string Shotgun = "Shotgun";

			public const string Ammo = "Ammo";

			public const string Spray_paint = "Spray paint";

			public const string Homemade_flashbang = "Homemade flashbang";

			public const string Gift = "Gift";

			public const string Flask = "Flask";

			public const string Tragedy = "Tragedy";

			public const string Comedy = "Comedy";

			public const string Whoopie_cushion = "Whoopie cushion";
		}

		public class EnemyInside
		{
			public const string Centipede = "Centipede";

			public const string Bunker_Spider = "Bunker Spider";

			public const string Hoarding_bug = "Hoarding bug";

			public const string Flowerman = "Flowerman";

			public const string Crawler = "Crawler";

			public const string Blob = "Blob";

			public const string Girl = "Girl";

			public const string Puffer = "Puffer";

			public const string Nutcracker = "Nutcracker";
		}

		public class EnemyOutside
		{
			public const string MouthDog = "MouthDog";

			public const string ForestGiant = "ForestGiant";

			public const string Earth_Leviathan = "Earth Leviathan";
		}

		public class EnemyDaytime
		{
			public const string Red_Locust_Bees = "Red Locust Bees";

			public const string Manticoil = "Manticoil";

			public const string Docile_Locust_Bees = "Docile Locust Bees";
		}
	}
	[BepInPlugin("hamunii.testinglib", "TestingLib", "1.2.1")]
	public class Plugin : BaseUnityPlugin
	{
		internal static Harmony _harmony;

		public const string ModGUID = "hamunii.testinglib";

		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin TestingLib is loaded!");
			_harmony = new Harmony("TestingLib");
			_harmony.PatchAll(typeof(Patch));
			Instances.Init();
			OnEvent.Init();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "TestingLib";

		public const string PLUGIN_NAME = "TestingLib";

		public const string PLUGIN_VERSION = "1.2.1";
	}
}