Decompiled source of ModTestBench v1.0.0

plugins/ModTestBench.dll

Decompiled an hour ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using REPOLib.Modules;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ModTestBench")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ModTestBench")]
[assembly: AssemblyTitle("ModTestBench")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 ModTestBench
{
	public enum Kind
	{
		Enemy,
		Valuable,
		Item
	}
	public class Entry
	{
		public Kind Kind;

		public string Label;

		public EnemySetup Enemy;

		public PrefabRef Valuable;

		public Item Item;
	}
	public static class Bench
	{
		public static bool GodMode;

		public static Entry Last;

		public static bool InRun
		{
			get
			{
				if (!SemiFunc.RunIsLevel() && !SemiFunc.RunIsShop())
				{
					return SemiFunc.RunIsLobby();
				}
				return true;
			}
		}

		public static bool IsHost => SemiFunc.IsMasterClientOrSingleplayer();

		public static List<Entry> Enemies()
		{
			List<Entry> list = new List<Entry>();
			foreach (EnemySetup allEnemy in Enemies.AllEnemies)
			{
				if (Object.op_Implicit((Object)(object)allEnemy))
				{
					string text = Clean(((Object)allEnemy).name);
					EnemyParent val = ParentOf(allEnemy);
					if (Object.op_Implicit((Object)(object)val) && !string.IsNullOrEmpty(val.enemyName) && val.enemyName.IndexOf(text, StringComparison.OrdinalIgnoreCase) < 0)
					{
						text = val.enemyName + " (" + text + ")";
					}
					list.Add(new Entry
					{
						Kind = Kind.Enemy,
						Label = text,
						Enemy = allEnemy
					});
				}
			}
			return list.OrderBy((Entry e) => e.Label).ToList();
		}

		public static List<Entry> ValuableList()
		{
			return (from v in Valuables.AllValuables
				where ((PrefabRef<GameObject>)(object)v)?.IsValid() ?? false
				select new Entry
				{
					Kind = Kind.Valuable,
					Label = Clean(((PrefabRef<GameObject>)(object)v).PrefabName),
					Valuable = v
				} into e
				group e by e.Label into g
				select g.First() into e
				orderby e.Label
				select e).ToList();
		}

		public static List<Entry> ItemList()
		{
			return (from i in Items.AllItems
				where Object.op_Implicit((Object)(object)i) && i.prefab != null && ((PrefabRef<GameObject>)(object)i.prefab).IsValid()
				select new Entry
				{
					Kind = Kind.Item,
					Label = ((string.IsNullOrEmpty(i.itemName) || i.itemName == "N/A") ? Clean(((Object)i).name) : i.itemName),
					Item = i
				} into e
				orderby e.Label
				select e).ToList();
		}

		private static string Clean(string name)
		{
			if (string.IsNullOrEmpty(name))
			{
				return "?";
			}
			string[] array = new string[4] { "Enemy - ", "Enemy Group - ", "Valuable ", "Item " };
			foreach (string text in array)
			{
				if (name.StartsWith(text, StringComparison.OrdinalIgnoreCase))
				{
					return name.Substring(text.Length);
				}
			}
			return name;
		}

		private static EnemyParent ParentOf(EnemySetup setup)
		{
			if (setup.spawnObjects == null)
			{
				return null;
			}
			EnemyParent result = default(EnemyParent);
			foreach (PrefabRef spawnObject in setup.spawnObjects)
			{
				if (spawnObject != null && ((PrefabRef<GameObject>)(object)spawnObject).IsValid())
				{
					GameObject prefab = ((PrefabRef<GameObject>)(object)spawnObject).Prefab;
					if (Object.op_Implicit((Object)(object)prefab) && prefab.TryGetComponent<EnemyParent>(ref result))
					{
						return result;
					}
				}
			}
			return null;
		}

		public static Vector3 SpotInFront(float distance, bool onNavMesh)
		{
			//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_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_006c: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			PlayerAvatar instance = PlayerAvatar.instance;
			Vector3 forward = (Object.op_Implicit((Object)(object)Camera.main) ? ((Component)Camera.main).transform : ((Component)instance).transform).forward;
			forward.y = 0f;
			if (((Vector3)(ref forward)).sqrMagnitude < 0.01f)
			{
				forward = ((Component)instance).transform.forward;
			}
			((Vector3)(ref forward)).Normalize();
			Vector3 val = ((Component)instance).transform.position + Vector3.up * 1f;
			int num = LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct());
			float num2 = distance;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, forward, ref val2, distance, num, (QueryTriggerInteraction)1))
			{
				num2 = Mathf.Max(0.8f, ((RaycastHit)(ref val2)).distance - 0.6f);
			}
			Vector3 val3 = val + forward * num2;
			RaycastHit val4 = default(RaycastHit);
			if (Physics.Raycast(val3, Vector3.down, ref val4, 6f, num, (QueryTriggerInteraction)1))
			{
				val3 = ((RaycastHit)(ref val4)).point;
			}
			else
			{
				val3.y = ((Component)instance).transform.position.y;
			}
			NavMeshHit val5 = default(NavMeshHit);
			if (onNavMesh && NavMesh.SamplePosition(val3, ref val5, 4f, -1))
			{
				val3 = ((NavMeshHit)(ref val5)).position;
			}
			return val3;
		}

		public static string Spawn(Entry entry, int count, float distance)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			if (entry == null)
			{
				return "Nothing picked yet.";
			}
			if (!Object.op_Implicit((Object)(object)PlayerAvatar.instance) || !InRun)
			{
				return "Start a run first.";
			}
			if (!IsHost)
			{
				return "Only the host can spawn things.";
			}
			Last = entry;
			int num = 0;
			for (int i = 0; i < Mathf.Clamp(count, 1, 20); i++)
			{
				Vector3 val = (Vector3)((i == 0) ? Vector3.zero : new Vector3(Random.Range(-1f, 1f), 0f, Random.Range(-1f, 1f)));
				Quaternion val2 = Quaternion.LookRotation(-FlatForward());
				try
				{
					switch (entry.Kind)
					{
					case Kind.Enemy:
					{
						List<EnemyParent> list = Enemies.SpawnEnemy(entry.Enemy, SpotInFront(distance, onNavMesh: true) + val, val2, false);
						if (list != null)
						{
							num += list.Count((EnemyParent p) => Object.op_Implicit((Object)(object)p));
						}
						break;
					}
					case Kind.Valuable:
						if (Object.op_Implicit((Object)(object)Valuables.SpawnValuable(entry.Valuable, SpotInFront(distance, onNavMesh: false) + val + Vector3.up * 0.8f, val2)))
						{
							num++;
						}
						break;
					case Kind.Item:
						if (Object.op_Implicit((Object)(object)Items.SpawnItem(entry.Item, SpotInFront(distance, onNavMesh: false) + val + Vector3.up * 0.8f, val2)))
						{
							num++;
						}
						break;
					}
				}
				catch (Exception arg)
				{
					Plugin.Log.LogError((object)$"Spawning {entry.Label} failed: {arg}");
					return "Spawning " + entry.Label + " failed, see the log.";
				}
			}
			Plugin.Log.LogInfo((object)$"Spawned {num} x {entry.Label}");
			if (num <= 0)
			{
				return entry.Label + " did not spawn.";
			}
			return $"Spawned {num} x {entry.Label}";
		}

		private static Vector3 FlatForward()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			Vector3 forward = (Object.op_Implicit((Object)(object)Camera.main) ? ((Component)Camera.main).transform : ((Component)PlayerAvatar.instance).transform).forward;
			forward.y = 0f;
			if (!(((Vector3)(ref forward)).sqrMagnitude < 0.01f))
			{
				return ((Vector3)(ref forward)).normalized;
			}
			return Vector3.forward;
		}

		public static string KillEnemies()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHost)
			{
				return "Only the host can do that.";
			}
			if (!Object.op_Implicit((Object)(object)EnemyDirector.instance))
			{
				return "No enemies here.";
			}
			int num = 0;
			foreach (EnemyParent item in EnemyDirector.instance.enemiesSpawned.ToList())
			{
				if (Object.op_Implicit((Object)(object)item) && item.Spawned)
				{
					EnemyHealth componentInChildren = ((Component)item).GetComponentInChildren<EnemyHealth>(true);
					if (Object.op_Implicit((Object)(object)componentInChildren) && !componentInChildren.dead)
					{
						componentInChildren.Hurt(Math.Max(componentInChildren.healthCurrent, componentInChildren.health) + 1, Vector3.up);
						num++;
					}
					else if (!Object.op_Implicit((Object)(object)componentInChildren))
					{
						item.SpawnedTimerSet(0f);
						num++;
					}
				}
			}
			return $"Killed {num} enemies.";
		}

		public static string DespawnEnemies()
		{
			if (!IsHost)
			{
				return "Only the host can do that.";
			}
			if (!Object.op_Implicit((Object)(object)EnemyDirector.instance))
			{
				return "No enemies here.";
			}
			int num = 0;
			foreach (EnemyParent item in EnemyDirector.instance.enemiesSpawned)
			{
				if (Object.op_Implicit((Object)(object)item) && item.Spawned)
				{
					item.SpawnedTimerSet(0f);
					num++;
				}
			}
			return $"Sent {num} enemies away.";
		}

		public static string Heal()
		{
			PlayerAvatar instance = PlayerAvatar.instance;
			if (!Object.op_Implicit((Object)(object)instance) || !Object.op_Implicit((Object)(object)instance.playerHealth))
			{
				return "No player yet.";
			}
			instance.playerHealth.Heal(instance.playerHealth.maxHealth, true);
			return "Healed.";
		}

		public static string BringCart()
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHost)
			{
				return "Only the host can do that.";
			}
			PlayerAvatar me = PlayerAvatar.instance;
			if (!Object.op_Implicit((Object)(object)me))
			{
				return "No player yet.";
			}
			PhysGrabCart val = (from c in Object.FindObjectsOfType<PhysGrabCart>()
				orderby c.isSmallCart ? 1 : 0, Vector3.Distance(((Component)c).transform.position, ((Component)me).transform.position)
				select c).FirstOrDefault();
			if (!Object.op_Implicit((Object)(object)val))
			{
				return "No cart in this level.";
			}
			PhysGrabObject component = ((Component)val).GetComponent<PhysGrabObject>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return "That cart cannot be moved.";
			}
			component.Teleport(SpotInFront(2.5f, onNavMesh: false) + Vector3.up * 0.3f, Quaternion.LookRotation(FlatForward()));
			return "Cart is in front of you.";
		}

		public static string StartSolo()
		{
			if (InRun)
			{
				return "Already in a run.";
			}
			if (!Object.op_Implicit((Object)(object)Object.FindObjectOfType<MenuPageMain>()))
			{
				return "Go to the main menu first.";
			}
			SemiFunc.MenuActionSingleplayerGame((string)null, (List<string>)null);
			return "Starting a solo run.";
		}

		public static void Tick()
		{
			if (GodMode)
			{
				PlayerAvatar instance = PlayerAvatar.instance;
				if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.playerHealth))
				{
					instance.playerHealth.InvincibleSet(0.5f);
				}
			}
		}
	}
	[BepInPlugin("com.purplehaxttv.modtestbench", "Mod Test Bench", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		public static Plugin Instance;

		private ConfigEntry<KeyCode> panelKey;

		private ConfigEntry<KeyCode> repeatKey;

		private ConfigEntry<float> distance;

		private ConfigEntry<bool> autoSolo;

		public bool Open;

		private Rect window = new Rect(40f, 140f, 460f, 540f);

		private GUIStyle windowStyle;

		private Vector2 scroll;

		private Kind tab;

		private string search = "";

		private int count = 1;

		private string status = "";

		private float statusUntil;

		private bool autoSoloDone;

		private readonly Dictionary<Kind, List<Entry>> lists = new Dictionary<Kind, List<Entry>>();

		private float listsAt = -999f;

		private void Awake()
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			((Component)this).transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			panelKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "Open panel", (KeyCode)289, "Opens and closes the test bench panel.");
			repeatKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "Spawn last again", (KeyCode)290, "Spawns the last thing you picked again, without opening the panel.");
			distance = ((BaseUnityPlugin)this).Config.Bind<float>("Spawning", "Distance", 3f, new ConfigDescription("How far in front of you things appear, in metres.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>()));
			autoSolo = ((BaseUnityPlugin)this).Config.Bind<bool>("Shortcuts", "Start solo run on launch", false, "Skips the main menu and starts a new solo run as soon as the game has loaded.");
			Log.LogInfo((object)"Mod Test Bench loaded. Press F8 in a run.");
		}

		private void Update()
		{
			//IL_000b: 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)
			try
			{
				Bench.Tick();
				if (Input.GetKeyDown(panelKey.Value))
				{
					Open = !Open;
				}
				if (!Open && Input.GetKeyDown(repeatKey.Value))
				{
					Say(Bench.Spawn(Bench.Last, count, distance.Value));
				}
				if (autoSolo.Value && !autoSoloDone && !Bench.InRun && Object.op_Implicit((Object)(object)Object.FindObjectOfType<MenuPageMain>()) && Time.realtimeSinceStartup > 20f)
				{
					autoSoloDone = true;
					Say(Bench.StartSolo());
				}
				if (Open)
				{
					if (Object.op_Implicit((Object)(object)CursorManager.instance))
					{
						CursorManager.instance.Unlock(0.1f);
					}
					if (Object.op_Implicit((Object)(object)InputManager.instance))
					{
						InputManager.instance.DisableMovement(0.1f);
						InputManager.instance.DisableAiming(0.1f);
					}
				}
			}
			catch (Exception arg)
			{
				Log.LogError((object)$"Update failed: {arg}");
				Open = false;
			}
		}

		private void Say(string text)
		{
			status = text;
			statusUntil = Time.realtimeSinceStartup + 5f;
		}

		private List<Entry> ListFor(Kind kind)
		{
			if (Time.realtimeSinceStartup - listsAt > 5f)
			{
				lists.Clear();
				listsAt = Time.realtimeSinceStartup;
			}
			if (!lists.TryGetValue(kind, out var value))
			{
				try
				{
					value = kind switch
					{
						Kind.Valuable => Bench.ValuableList(), 
						Kind.Enemy => Bench.Enemies(), 
						_ => Bench.ItemList(), 
					};
				}
				catch (Exception arg)
				{
					Log.LogError((object)$"Listing {kind} failed: {arg}");
					value = new List<Entry>();
				}
				lists[kind] = value;
			}
			return value;
		}

		private void OnGUI()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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_008f: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Max(1f, (float)Screen.height / 1080f);
			GUI.matrix = Matrix4x4.Scale(new Vector3(num, num, 1f));
			if (!Open)
			{
				if (status != "" && Time.realtimeSinceStartup < statusUntil)
				{
					GUI.Label(new Rect(20f, 20f, 600f, 30f), status);
				}
				return;
			}
			if (windowStyle == null)
			{
				Texture2D val = new Texture2D(1, 1)
				{
					hideFlags = (HideFlags)61
				};
				val.SetPixel(0, 0, new Color(0.07f, 0.05f, 0.11f, 0.97f));
				val.Apply();
				windowStyle = new GUIStyle(GUI.skin.window);
				windowStyle.normal.background = val;
				windowStyle.onNormal.background = val;
			}
			window = GUILayout.Window(517499, window, new WindowFunction(Draw), "Mod Test Bench", windowStyle, Array.Empty<GUILayoutOption>());
		}

		private void Draw(int id)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			Kind[] array = new Kind[3]
			{
				Kind.Enemy,
				Kind.Valuable,
				Kind.Item
			};
			foreach (Kind kind in array)
			{
				if (GUILayout.Toggle(tab == kind, kind switch
				{
					Kind.Valuable => "Valuables", 
					Kind.Enemy => "Enemies", 
					_ => "Items", 
				}, GUI.skin.button, Array.Empty<GUILayoutOption>()) && tab != kind)
				{
					tab = kind;
					scroll = Vector2.zero;
				}
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Search", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			search = GUILayout.TextField(search ?? "", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) });
			if (GUILayout.Button("x", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(24f) }))
			{
				search = "";
			}
			GUILayout.Label("How many", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(66f) });
			int[] array2 = new int[3] { 1, 3, 5 };
			for (int i = 0; i < array2.Length; i++)
			{
				int num = array2[i];
				if (GUILayout.Toggle(count == num, num.ToString(), GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }))
				{
					count = num;
				}
			}
			GUILayout.EndHorizontal();
			List<Entry> list = ListFor(tab);
			scroll = GUILayout.BeginScrollView(scroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(380f) });
			if (!Bench.InRun)
			{
				GUILayout.Label("Nothing to spawn until you are in a run.", Array.Empty<GUILayoutOption>());
			}
			else if (list.Count == 0)
			{
				GUILayout.Label("Nothing found.", Array.Empty<GUILayoutOption>());
			}
			foreach (Entry item in list)
			{
				if ((!(search != "") || item.Label.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0) && GUILayout.Button(item.Label, Array.Empty<GUILayoutOption>()))
				{
					Say(Bench.Spawn(item, count, distance.Value));
				}
			}
			GUILayout.EndScrollView();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Kill enemies", Array.Empty<GUILayoutOption>()))
			{
				Say(Bench.KillEnemies());
			}
			if (GUILayout.Button("Send enemies away", Array.Empty<GUILayoutOption>()))
			{
				Say(Bench.DespawnEnemies());
			}
			if (GUILayout.Button("Bring cart", Array.Empty<GUILayoutOption>()))
			{
				Say(Bench.BringCart());
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Heal me", Array.Empty<GUILayoutOption>()))
			{
				Say(Bench.Heal());
			}
			Bench.GodMode = GUILayout.Toggle(Bench.GodMode, "Cannot be hurt", GUI.skin.button, Array.Empty<GUILayoutOption>());
			if (!Bench.InRun && GUILayout.Button("Start solo run", Array.Empty<GUILayoutOption>()))
			{
				Say(Bench.StartSolo());
			}
			GUILayout.EndHorizontal();
			GUILayout.Label((Time.realtimeSinceStartup < statusUntil) ? status : $"{panelKey.Value} closes this. {repeatKey.Value} spawns the last pick again.", Array.Empty<GUILayoutOption>());
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 22f));
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}