Decompiled source of TrashDayAdminMenu v0.1.1

plugins/AdminMenu.dll

Decompiled 14 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AdminMenu.Patches;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Ox1;
using QFSW.QC;
using Trash;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UIElements;

[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("AdminMenu")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1+6030e6213f9c334f667be33187f847412a9e8eda")]
[assembly: AssemblyProduct("AdminMenu")]
[assembly: AssemblyTitle("AdminMenu")]
[assembly: AssemblyVersion("0.1.1.0")]
[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 AdminMenu
{
	internal sealed class AdminMenuController : MonoBehaviour
	{
		private enum CloseReason
		{
			User,
			Escape,
			Lost
		}

		private UIDocument _document;

		private AdminMenuPanel _panel;

		private bool _open;

		private bool _suppressedMenus;

		private bool _holdSuppressionUntilEscReleased;

		private bool _loggedTickError;

		private void Update()
		{
			try
			{
				Tick();
			}
			catch (Exception arg)
			{
				if (!_loggedTickError)
				{
					_loggedTickError = true;
					Plugin.Log.LogError((object)$"Admin menu update failed; closing the menu. {arg}");
				}
				if (_open)
				{
					Close(CloseReason.Lost);
				}
			}
		}

		private void OnDestroy()
		{
			if (_open)
			{
				Close(CloseReason.Lost);
			}
			ReleaseSuppression();
		}

		private void Tick()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			if (_holdSuppressionUntilEscReleased && !Hotkey.EscapeHeld())
			{
				ReleaseSuppression();
			}
			if (_open)
			{
				if (_panel.Root.panel == null || MenuGate.ShouldAutoClose(GameActions.IsServer, (Object)(object)GameActions.LocalPlayer() != (Object)null))
				{
					Close(CloseReason.Lost);
					return;
				}
				if (Plugin.CloseOnEscape.Value && Hotkey.EscapePressed())
				{
					Close(CloseReason.Escape);
					return;
				}
				KeepInputLocked();
			}
			if (Hotkey.WasPressed(Plugin.ToggleKey.Value))
			{
				Toggle();
			}
		}

		private void Toggle()
		{
			ToggleDecision toggleDecision = MenuGate.Decide(_open, GameActions.IsServer, (Object)(object)GameActions.LocalPlayer() != (Object)null, MenuSceneManager.IsMenuOpen, ConsoleOpen());
			switch (toggleDecision)
			{
			case ToggleDecision.Open:
				Open();
				return;
			case ToggleDecision.Close:
				Close(CloseReason.User);
				return;
			}
			string text = MenuGate.Message(toggleDecision);
			if (text != null)
			{
				GameActions.Toast(text);
			}
		}

		private void Open()
		{
			if (!EnsurePanel())
			{
				Plugin.Log.LogWarning((object)"No game UI to borrow panel settings from yet; the admin menu can't open here.");
				return;
			}
			_open = true;
			_holdSuppressionUntilEscReleased = false;
			if (!MenuSceneManager.MenusSuppressed)
			{
				MenuSceneManager.MenusSuppressed = true;
				_suppressedMenus = true;
			}
			PlayerCamera.LookInputBlocks.SetRequest((Object)(object)this, true);
			KeepInputLocked();
			_panel.Open();
		}

		private void Close(CloseReason reason)
		{
			if (!_open)
			{
				return;
			}
			_open = false;
			_panel?.Close();
			PlayerCamera.LookInputBlocks.SetRequest((Object)(object)this, false);
			if (MenuGate.ShouldEnableGameInput(MenuSceneManager.AnyMenuVisible.Value, ConsoleOpen()))
			{
				InputActionAsset actions = InputSystem.actions;
				if (actions != null)
				{
					actions.Enable();
				}
			}
			if (reason != CloseReason.Lost && MenuGate.ShouldLockCursor(MenuSceneManager.IsMenuOpen))
			{
				Cursor.lockState = (CursorLockMode)1;
			}
			if (reason == CloseReason.Escape)
			{
				_holdSuppressionUntilEscReleased = true;
			}
			else
			{
				ReleaseSuppression();
			}
		}

		private static void KeepInputLocked()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			InputActionAsset actions = InputSystem.actions;
			if ((Object)(object)actions != (Object)null && actions.enabled)
			{
				actions.Disable();
			}
			if ((int)Cursor.lockState != 0)
			{
				Cursor.lockState = (CursorLockMode)0;
			}
		}

		private void ReleaseSuppression()
		{
			_holdSuppressionUntilEscReleased = false;
			if (MenuGate.ShouldClearMenuSuppression(_suppressedMenus, ConsoleOpen()))
			{
				MenuSceneManager.MenusSuppressed = false;
			}
			_suppressedMenus = false;
		}

		private static bool ConsoleOpen()
		{
			try
			{
				return ConsoleOpenCore();
			}
			catch (Exception)
			{
				return false;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static bool ConsoleOpenCore()
		{
			QuantumConsole instance = QuantumConsole.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				return instance.IsActive;
			}
			return false;
		}

		private bool EnsurePanel()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			if ((Object)(object)_document == (Object)null)
			{
				PanelSettings val = CreatePanelSettings();
				if ((Object)(object)val == (Object)null)
				{
					return false;
				}
				GameObject val2 = new GameObject("AdminMenuUI");
				val2.SetActive(false);
				val2.transform.SetParent(((Component)this).transform, false);
				_document = val2.AddComponent<UIDocument>();
				_document.panelSettings = val;
				val2.SetActive(true);
			}
			if (_panel == null)
			{
				_panel = new AdminMenuPanel();
				_panel.CloseRequested += delegate
				{
					Close(CloseReason.User);
				};
				_panel.AddTab("Players", PlayersTab.Build(_panel, out var refresh), refresh);
				_panel.AddTab("Items", ItemsTab.Build(_panel, out var refresh2), refresh2);
				_panel.AddTab("Cart", CartTab.Build(_panel, out var refresh3), refresh3);
				_panel.AddTab("Level", LevelTab.Build(_panel, out var refresh4), refresh4);
			}
			VisualElement rootVisualElement = _document.rootVisualElement;
			if (rootVisualElement == null)
			{
				return false;
			}
			if (_panel.Root.parent != rootVisualElement)
			{
				_panel.Root.RemoveFromHierarchy();
				rootVisualElement.Add(_panel.Root);
			}
			return _panel.Root.panel != null;
		}

		private static PanelSettings CreatePanelSettings()
		{
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			List<UIDocument> list = new List<UIDocument>();
			UIDocument val = null;
			ToastUI val2 = default(ToastUI);
			if (ToastUI.Instance.TryGet(ref val2) && (Object)(object)val2 != (Object)null)
			{
				val = ((Component)val2).GetComponentInChildren<UIDocument>(true);
				if ((Object)(object)val != (Object)null)
				{
					list.Add(val);
				}
			}
			UIDocument[] array = Object.FindObjectsByType<UIDocument>((FindObjectsSortMode)0);
			foreach (UIDocument val3 in array)
			{
				if ((Object)(object)val3 != (Object)null && (Object)(object)val3 != (Object)(object)val)
				{
					list.Add(val3);
				}
			}
			List<PanelCandidate> list2 = new List<PanelCandidate>();
			foreach (UIDocument item in list)
			{
				PanelSettings panelSettings = item.panelSettings;
				list2.Add(new PanelCandidate
				{
					IsToast = ((Object)(object)item == (Object)(object)val),
					HasTheme = ((Object)(object)panelSettings != (Object)null && (Object)(object)panelSettings.themeStyleSheet != (Object)null),
					HasTargetTexture = ((Object)(object)panelSettings != (Object)null && (Object)(object)panelSettings.targetTexture != (Object)null)
				});
			}
			int num = PanelSource.Pick(list2);
			if (num < 0)
			{
				return null;
			}
			PanelSettings panelSettings2 = list[num].panelSettings;
			PanelSettings obj = ScriptableObject.CreateInstance<PanelSettings>();
			((Object)obj).name = "AdminMenuPanelSettings";
			obj.themeStyleSheet = panelSettings2.themeStyleSheet;
			obj.textSettings = panelSettings2.textSettings;
			obj.scaleMode = panelSettings2.scaleMode;
			obj.referenceResolution = panelSettings2.referenceResolution;
			obj.screenMatchMode = panelSettings2.screenMatchMode;
			obj.match = panelSettings2.match;
			obj.scale = panelSettings2.scale;
			obj.referenceDpi = panelSettings2.referenceDpi;
			obj.fallbackDpi = panelSettings2.fallbackDpi;
			obj.clearColor = false;
			obj.clearDepthStencil = false;
			obj.sortingOrder = 10000f;
			return obj;
		}
	}
	internal sealed class AdminMenuPanel
	{
		private sealed class Tab
		{
			public Button Button;

			public VisualElement Content;

			public Action OnShown;
		}

		private readonly VisualElement _overlay;

		private readonly VisualElement _rail;

		private readonly VisualElement _content;

		private readonly Label _status;

		private readonly List<Tab> _tabs = new List<Tab>();

		private Tab _selected;

		public VisualElement Root => _overlay;

		public bool IsOpen { get; private set; }

		public event Action CloseRequested;

		public AdminMenuPanel()
		{
			//IL_0012: 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_0027: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_0061: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: 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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Expected O, but got Unknown
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Expected O, but got Unknown
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Expected O, but got Unknown
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Expected O, but got Unknown
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Expected O, but got Unknown
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0443: Unknown result type (might be due to invalid IL or missing references)
			//IL_0448: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0478: Unknown result type (might be due to invalid IL or missing references)
			_overlay = new VisualElement
			{
				name = "AdminMenuOverlay"
			};
			IStyle style = _overlay.style;
			style.position = StyleEnum<Position>.op_Implicit((Position)1);
			style.left = (style.right = (style.top = (style.bottom = StyleLength.op_Implicit(0f))));
			style.alignItems = StyleEnum<Align>.op_Implicit((Align)2);
			style.justifyContent = StyleEnum<Justify>.op_Implicit((Justify)1);
			style.backgroundColor = StyleColor.op_Implicit(new Color(0f, 0f, 0f, 0.7f));
			style.color = StyleColor.op_Implicit(Theme.Text);
			style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1);
			VisualElement val4 = new VisualElement
			{
				name = "AdminMenuWindow"
			};
			IStyle style2 = val4.style;
			style2.width = StyleLength.op_Implicit(Length.Percent(72f));
			style2.height = StyleLength.op_Implicit(Length.Percent(78f));
			style2.maxWidth = StyleLength.op_Implicit(1200f);
			style2.backgroundColor = StyleColor.op_Implicit(Theme.Window);
			Theme.SetBorder(val4, 3f, Theme.WindowBorder, 0f);
			Theme.SetPadding(val4, 20f, 24f);
			_overlay.Add(val4);
			VisualElement val5 = Row();
			val5.style.marginBottom = StyleLength.op_Implicit(16f);
			Label val6 = new Label("ADMIN MENU");
			((VisualElement)val6).style.fontSize = StyleLength.op_Implicit(34f);
			((VisualElement)val6).style.unityFontStyleAndWeight = StyleEnum<FontStyle>.op_Implicit((FontStyle)1);
			((VisualElement)val6).style.color = StyleColor.op_Implicit(Theme.Text);
			((VisualElement)val6).style.textShadow = StyleTextShadow.op_Implicit(new TextShadow
			{
				offset = new Vector2(2f, 2f),
				color = Color.black
			});
			((VisualElement)val6).style.flexGrow = StyleFloat.op_Implicit(1f);
			val5.Add((VisualElement)(object)val6);
			Button val7 = new Button((Action)delegate
			{
				this.CloseRequested?.Invoke();
			})
			{
				text = "Close"
			};
			((VisualElement)val7).style.marginLeft = StyleLength.op_Implicit(20f);
			((VisualElement)val7).style.minWidth = StyleLength.op_Implicit(110f);
			Theme.StyleButton(val7);
			val5.Add((VisualElement)(object)val7);
			val4.Add(val5);
			VisualElement val8 = Row();
			val8.style.flexGrow = StyleFloat.op_Implicit(1f);
			val8.style.flexShrink = StyleFloat.op_Implicit(1f);
			val8.style.alignItems = StyleEnum<Align>.op_Implicit((Align)4);
			val4.Add(val8);
			_rail = new VisualElement
			{
				name = "AdminMenuTabs"
			};
			_rail.style.width = StyleLength.op_Implicit(180f);
			_rail.style.flexShrink = StyleFloat.op_Implicit(0f);
			_rail.style.marginRight = StyleLength.op_Implicit(20f);
			_rail.style.paddingRight = StyleLength.op_Implicit(16f);
			_rail.style.borderRightWidth = StyleFloat.op_Implicit(2f);
			_rail.style.borderRightColor = StyleColor.op_Implicit(Theme.Line);
			val8.Add(_rail);
			_content = new VisualElement
			{
				name = "AdminMenuContent"
			};
			_content.style.flexGrow = StyleFloat.op_Implicit(1f);
			_content.style.flexShrink = StyleFloat.op_Implicit(1f);
			val8.Add(_content);
			_status = new Label(" ")
			{
				name = "AdminMenuStatus"
			};
			((VisualElement)_status).style.marginTop = StyleLength.op_Implicit(12f);
			((VisualElement)_status).style.paddingTop = StyleLength.op_Implicit(10f);
			((VisualElement)_status).style.borderTopWidth = StyleFloat.op_Implicit(2f);
			((VisualElement)_status).style.borderTopColor = StyleColor.op_Implicit(Theme.Line);
			((VisualElement)_status).style.color = StyleColor.op_Implicit(Theme.Muted);
			((VisualElement)_status).style.whiteSpace = StyleEnum<WhiteSpace>.op_Implicit((WhiteSpace)0);
			val4.Add((VisualElement)(object)_status);
			Theme.StyleControls(_overlay);
		}

		public void AddTab(string title, VisualElement content, Action onShown)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_0060: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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)
			Button val = new Button
			{
				text = title
			};
			Theme.StyleButton(val, outlined: false);
			((VisualElement)val).style.unityTextAlign = StyleEnum<TextAnchor>.op_Implicit((TextAnchor)3);
			IStyle style = ((VisualElement)val).style;
			StyleLength marginLeft = (((VisualElement)val).style.marginRight = StyleLength.op_Implicit(0f));
			style.marginLeft = marginLeft;
			((VisualElement)val).style.marginBottom = StyleLength.op_Implicit(8f);
			IStyle style2 = ((VisualElement)val).style;
			marginLeft = (((VisualElement)val).style.paddingBottom = StyleLength.op_Implicit(10f));
			style2.paddingTop = marginLeft;
			_rail.Add((VisualElement)(object)val);
			content.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1);
			content.style.flexGrow = StyleFloat.op_Implicit(1f);
			_content.Add(content);
			Theme.StyleControls(content);
			Tab tab = new Tab
			{
				Button = val,
				Content = content,
				OnShown = onShown
			};
			_tabs.Add(tab);
			val.clicked += delegate
			{
				Select(tab);
			};
			if (_selected == null)
			{
				Select(tab);
			}
			else
			{
				Highlight();
			}
		}

		public void Open()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			_overlay.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)0);
			_overlay.BringToFront();
			IsOpen = true;
			SetStatus(" ", error: false);
			if (_selected != null)
			{
				Show(_selected);
			}
		}

		public void Close()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			IsOpen = false;
			_overlay.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1);
		}

		public void SetStatus(string text, bool error)
		{
			//IL_0030: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			((TextElement)_status).text = (string.IsNullOrEmpty(text) ? " " : text);
			((VisualElement)_status).style.color = StyleColor.op_Implicit(error ? Ui.Error : Theme.Muted);
		}

		public void Run(string action, Func<string> work)
		{
			try
			{
				SetStatus(work() ?? action, error: false);
			}
			catch (InvalidOperationException ex)
			{
				SetStatus(action + " failed: " + ex.Message, error: true);
			}
			catch (Exception ex2)
			{
				Plugin.Log.LogError((object)$"{action} failed: {ex2}");
				SetStatus(action + " failed: " + ex2.Message, error: true);
			}
		}

		private void Select(Tab tab)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			_selected = tab;
			foreach (Tab tab2 in _tabs)
			{
				tab2.Content.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)((tab2 != tab) ? 1 : 0));
			}
			Highlight();
			Show(tab);
		}

		private void Highlight()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			foreach (Tab tab in _tabs)
			{
				Theme.SetBorder((VisualElement)(object)tab.Button, 2f, (tab == _selected) ? Theme.Gold : Theme.Line, 4f);
			}
		}

		private void Show(Tab tab)
		{
			if (tab.OnShown != null)
			{
				Run(((TextElement)tab.Button).text, delegate
				{
					tab.OnShown();
					return ((TextElement)_status).text;
				});
			}
		}

		private static VisualElement Row()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			VisualElement val = new VisualElement();
			val.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)2);
			val.style.alignItems = StyleEnum<Align>.op_Implicit((Align)2);
			return val;
		}
	}
	internal static class Amounts
	{
		public const float MaxMoney = 1000000f;

		public static bool TryParseMoney(string text, out float amount)
		{
			amount = 0f;
			if (string.IsNullOrWhiteSpace(text))
			{
				return false;
			}
			if (!float.TryParse(text.Trim().TrimStart('$').Replace(",", string.Empty), NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
			{
				return false;
			}
			if (float.IsNaN(result) || float.IsInfinity(result) || result <= 0f || result > 1000000f)
			{
				return false;
			}
			amount = result;
			return true;
		}
	}
	internal static class CartTab
	{
		public static VisualElement Build(AdminMenuPanel panel, out Action refresh)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Expected O, but got Unknown
			VisualElement val = new VisualElement();
			Toggle invincible = Ui.InvincibleToggle(panel, "Invincible cart", Plugin.InvincibleCart, "The cart is invincible", "The cart takes damage again");
			val.Add((VisualElement)(object)invincible);
			Label summary = Ui.Muted(string.Empty);
			val.Add((VisualElement)(object)summary);
			VisualElement val2 = Ui.Row();
			val2.Add((VisualElement)(object)Ui.ActionButton(panel, "Bring cart to me", GameActions.BringCart, UpdateSummary));
			val2.Add((VisualElement)(object)Ui.ActionButton(panel, "Flip upright", GameActions.FlipCart, UpdateSummary));
			val2.Add((VisualElement)(object)Ui.ActionButton(panel, "Repair", GameActions.RepairCart, UpdateSummary));
			val.Add(val2);
			val.Add((VisualElement)(object)Ui.Muted("Repair puts every broken panel back at tier 1 and clears cart damage. It doesn't tighten wheel bolts."));
			refresh = delegate
			{
				((BaseField<bool>)(object)invincible).SetValueWithoutNotify(Plugin.InvincibleCart.Value);
				UpdateSummary();
			};
			return val;
			void UpdateSummary()
			{
				((TextElement)summary).text = GameActions.CartSummary();
			}
		}
	}
	internal sealed class ConfigurationManagerAttributes
	{
		public string DispName;

		public int? Order;
	}
	internal sealed class PlayerInfo
	{
		public ulong ClientId;

		public string Name;

		public bool HasBody;

		public bool IsDead;

		public bool IsLocal;
	}
	internal static class GameActions
	{
		public static bool IsServer
		{
			get
			{
				if ((Object)(object)NetworkManager.Singleton != (Object)null)
				{
					return NetworkManager.Singleton.IsServer;
				}
				return false;
			}
		}

		public static PlayerController LocalPlayer()
		{
			foreach (PlayerController item in PlayerController.All)
			{
				if ((Object)(object)item != (Object)null && ((NetworkBehaviour)item).IsOwner)
				{
					return item;
				}
			}
			return null;
		}

		public static void Toast(string message)
		{
			Plugin.Log.LogInfo((object)message);
			ToastUI val = default(ToastUI);
			if (ToastUI.Instance.TryGet(ref val) && (Object)(object)val != (Object)null)
			{
				val.ShowToast(message, 2.5f);
			}
		}

		public static List<PlayerInfo> Players()
		{
			ulong num = (((Object)(object)NetworkManager.Singleton != (Object)null) ? NetworkManager.Singleton.LocalClientId : ulong.MaxValue);
			List<PlayerInfo> list = new List<PlayerInfo>();
			PlayerController val = default(PlayerController);
			foreach (OnlinePlayer item in OnlinePlayer.All)
			{
				if (!((Object)(object)item == (Object)null))
				{
					ulong ownerClientId = ((NetworkBehaviour)item).OwnerClientId;
					string value = item.PlayerName.Value;
					PlayerInfo playerInfo = new PlayerInfo
					{
						ClientId = ownerClientId,
						Name = (string.IsNullOrWhiteSpace(value) ? $"Player {ownerClientId}" : value),
						IsLocal = (ownerClientId == num)
					};
					if (PlayerSpawner.TryGetPlayerOwnedBy(ownerClientId, ref val) && (Object)(object)val != (Object)null)
					{
						playerInfo.HasBody = true;
						playerInfo.IsDead = val.IsDead;
					}
					list.Add(playerInfo);
				}
			}
			return list.OrderBy((PlayerInfo p) => (!p.IsLocal) ? 1 : 0).ThenBy<PlayerInfo, string>((PlayerInfo p) => p.Name, StringComparer.OrdinalIgnoreCase).ToList();
		}

		public static string Revive(ulong clientId)
		{
			string name;
			PlayerController obj = RequireBody(clientId, out name);
			if (!obj.IsDead)
			{
				throw new InvalidOperationException(name + " isn't dead");
			}
			obj.Health.FullyHeal();
			return "Revived " + name;
		}

		public static string Heal(ulong clientId)
		{
			string name;
			PlayerController obj = RequireBody(clientId, out name);
			if (obj.IsDead)
			{
				throw new InvalidOperationException(name + " is dead; use Revive");
			}
			obj.Health.FullyHeal();
			return "Healed " + name;
		}

		public static string Kill(ulong clientId)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			string name;
			PlayerController val = RequireBody(clientId, out name);
			if (val.IsDead)
			{
				throw new InvalidOperationException(name + " is already dead");
			}
			Invincibility.Bypass = true;
			try
			{
				val.Health.TakeDamage(1f, ((Component)val).transform.position + Vector3.up, (DamageType)0);
			}
			finally
			{
				Invincibility.Bypass = false;
			}
			if (!val.IsDead)
			{
				return name + " took no damage (the game ignores hits within a second of the last one); try again";
			}
			return "Killed " + name;
		}

		public static string BringToMe(ulong clientId)
		{
			//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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			PlayerController val = RequireLocalPlayer();
			string name;
			PlayerController obj = RequireBody(clientId, out name);
			if ((Object)(object)obj == (Object)(object)val)
			{
				throw new InvalidOperationException("that's you");
			}
			Vector3 val2 = ViewForward();
			obj.Teleport(((Component)val).transform.position + val2 * 1.5f + Vector3.up * 0.5f, Quaternion.LookRotation(-val2), 0f);
			return "Brought " + name + " to you";
		}

		public static string GoTo(ulong clientId)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_0046: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			PlayerController val = RequireLocalPlayer();
			string name;
			PlayerController val2 = RequireBody(clientId, out name);
			if ((Object)(object)val2 == (Object)(object)val)
			{
				throw new InvalidOperationException("that's you");
			}
			Vector3 val3 = Flat(((Component)val2).transform.forward);
			val.Teleport(((Component)val2).transform.position - val3 * 1.5f + Vector3.up * 0.5f, Quaternion.LookRotation(val3), 0f);
			return "Went to " + name;
		}

		public static float? Money()
		{
			TeamInventory val = default(TeamInventory);
			if (!TeamInventory.Instance.TryGet(ref val) || !((Object)(object)val != (Object)null))
			{
				return null;
			}
			return val.MoneyVar.Value;
		}

		public static string AddMoney(float amount)
		{
			if (amount <= 0f || amount > 1000000f)
			{
				throw new InvalidOperationException($"amount must be between 1 and {1000000f:N0}");
			}
			TeamInventory val = default(TeamInventory);
			if (!TeamInventory.Instance.TryGet(ref val) || (Object)(object)val == (Object)null)
			{
				throw new InvalidOperationException("no team money in this level");
			}
			val.Deposit(amount);
			return $"Added ${amount:N0} (team now has ${val.MoneyVar.Value:N0})";
		}

		public static string CartSummary()
		{
			if (!TryGetCart(out var cart))
			{
				return "No cart in this level.";
			}
			WagonPanel[] array = cart.Panels ?? Array.Empty<WagonPanel>();
			int num = array.Count((WagonPanel p) => (Object)(object)p != (Object)null && !p.IsBroken);
			string text = (cart.IsTippedOver() ? ", tipped over" : string.Empty);
			return $"Cart: {num}/{array.Length} panels intact, damage {cart.AccumDamage:P0}{text}";
		}

		public static string BringCart()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0041: Unknown result type (might be due to invalid IL or missing references)
			PlayerController val = RequireLocalPlayer();
			ShoppingCartController obj = RequireCart();
			Vector3 val2 = ViewForward();
			obj.Teleport(((Component)val).transform.position + val2 * 3f + Vector3.up * 0.5f, Quaternion.LookRotation(val2), 0f);
			return "Brought the cart to you";
		}

		public static string FlipCart()
		{
			//IL_000b: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			ShoppingCartController obj = RequireCart();
			float y = ((Component)obj).transform.eulerAngles.y;
			obj.Teleport(((Component)obj).transform.position + Vector3.up * 0.5f, Quaternion.Euler(0f, y, 0f), 0f);
			return "Flipped the cart upright";
		}

		public static string RepairCart()
		{
			ShoppingCartController val = RequireCart();
			int num = 0;
			WagonPanel[] array = val.Panels ?? Array.Empty<WagonPanel>();
			foreach (WagonPanel val2 in array)
			{
				if (!((Object)(object)val2 == (Object)null) && val2.IsBroken)
				{
					val2.Repair(1);
					num++;
				}
			}
			val.AccumDamage = 0f;
			if (num != 0)
			{
				return $"Repaired {num} panel(s) and cleared cart damage";
			}
			return "No broken panels; cleared cart damage";
		}

		public static string NextCheckpoint()
		{
			CheckpointTrigger[] array = Object.FindObjectsByType<CheckpointTrigger>((FindObjectsInactive)1, (FindObjectsSortMode)0);
			if (array.Length == 0)
			{
				throw new InvalidOperationException("no checkpoints in this level");
			}
			if (array.All((CheckpointTrigger c) => (Object)(object)c == (Object)null || c.IsReached))
			{
				throw new InvalidOperationException("every checkpoint is already reached");
			}
			CheckpointTrigger.TeleportToNextCheckpoint();
			return "Teleported everyone to the next checkpoint";
		}

		public static string CompleteLevel()
		{
			CampaignManager val = default(CampaignManager);
			if (!CampaignManager.Instance.TryGet(ref val) || (Object)(object)val == (Object)null)
			{
				throw new InvalidOperationException("no campaign running in this scene");
			}
			val.CompleteLevel();
			return "Completing the level";
		}

		public static List<string> TeleportPoints()
		{
			return (from t in Object.FindObjectsByType<TeleportHere>((FindObjectsSortMode)0)
				where (Object)(object)t != (Object)null && !string.IsNullOrWhiteSpace(t.Name)
				select t.Name).Distinct<string>(StringComparer.OrdinalIgnoreCase).OrderBy<string, string>((string n) => n, StringComparer.OrdinalIgnoreCase).ToList();
		}

		public static string TeleportTo(string name)
		{
			TeleportHere? obj = ((IEnumerable<TeleportHere>)Object.FindObjectsByType<TeleportHere>((FindObjectsSortMode)0)).FirstOrDefault((Func<TeleportHere, bool>)((TeleportHere t) => (Object)(object)t != (Object)null && string.Equals(t.Name, name, StringComparison.OrdinalIgnoreCase)));
			if ((Object)(object)obj == (Object)null)
			{
				throw new InvalidOperationException("teleport point " + name + " is gone");
			}
			obj.Execute();
			return "Teleported everyone and the cart to " + name;
		}

		public static Vector3 SpawnPoint(float distance)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			LocalCamera val = default(LocalCamera);
			if (LocalCamera.Instance.TryGet(ref val) && (Object)(object)val != (Object)null)
			{
				return val.Position + ViewForward() * distance;
			}
			return ((Component)RequireLocalPlayer()).transform.position + ViewForward() * distance + Vector3.up;
		}

		private static Vector3 ViewForward()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			LocalCamera val = default(LocalCamera);
			if (LocalCamera.Instance.TryGet(ref val) && (Object)(object)val != (Object)null)
			{
				return Flat(((Component)val).transform.forward);
			}
			PlayerController val2 = LocalPlayer();
			if (!((Object)(object)val2 != (Object)null))
			{
				return Vector3.forward;
			}
			return Flat(((Component)val2).transform.forward);
		}

		private static Vector3 Flat(Vector3 direction)
		{
			//IL_0022: 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)
			direction.y = 0f;
			if (!(((Vector3)(ref direction)).sqrMagnitude < 0.0001f))
			{
				return ((Vector3)(ref direction)).normalized;
			}
			return Vector3.forward;
		}

		private static PlayerController RequireLocalPlayer()
		{
			return LocalPlayer() ?? throw new InvalidOperationException("you have no player right now");
		}

		private static PlayerController RequireBody(ulong clientId, out string name)
		{
			OnlinePlayer val = ((IEnumerable<OnlinePlayer>)OnlinePlayer.All).FirstOrDefault((Func<OnlinePlayer, bool>)((OnlinePlayer p) => (Object)(object)p != (Object)null && ((NetworkBehaviour)p).OwnerClientId == clientId));
			name = (((Object)(object)val != (Object)null && !string.IsNullOrWhiteSpace(val.PlayerName.Value)) ? val.PlayerName.Value : $"Player {clientId}");
			PlayerController val2 = default(PlayerController);
			if (!PlayerSpawner.TryGetPlayerOwnedBy(clientId, ref val2) || (Object)(object)val2 == (Object)null)
			{
				throw new InvalidOperationException(name + " has no character right now");
			}
			return val2;
		}

		private static bool TryGetCart(out ShoppingCartController cart)
		{
			if (ShoppingCartController.Instance.TryGet(ref cart))
			{
				return (Object)(object)cart != (Object)null;
			}
			return false;
		}

		private static ShoppingCartController RequireCart()
		{
			if (!TryGetCart(out var cart))
			{
				throw new InvalidOperationException("no cart in this level");
			}
			return cart;
		}
	}
	internal static class Hotkey
	{
		private static readonly Dictionary<KeyCode, Key> Renamed = new Dictionary<KeyCode, Key>
		{
			[(KeyCode)13] = (Key)2,
			[(KeyCode)271] = (Key)77,
			[(KeyCode)306] = (Key)55,
			[(KeyCode)305] = (Key)56,
			[(KeyCode)310] = (Key)57,
			[(KeyCode)309] = (Key)58,
			[(KeyCode)96] = (Key)4,
			[(KeyCode)270] = (Key)80,
			[(KeyCode)269] = (Key)81,
			[(KeyCode)268] = (Key)79,
			[(KeyCode)267] = (Key)78,
			[(KeyCode)266] = (Key)82
		};

		public static bool WasPressed(KeyboardShortcut shortcut)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			Keyboard current = Keyboard.current;
			if (current == null || (int)((KeyboardShortcut)(ref shortcut)).MainKey == 0)
			{
				return false;
			}
			if (!TryGetKey(((KeyboardShortcut)(ref shortcut)).MainKey, out var key) || !((ButtonControl)current[key]).wasPressedThisFrame)
			{
				return false;
			}
			foreach (KeyCode modifier in ((KeyboardShortcut)(ref shortcut)).Modifiers)
			{
				if (!TryGetKey(modifier, out var key2) || !((ButtonControl)current[key2]).isPressed)
				{
					return false;
				}
			}
			return true;
		}

		public static bool EscapePressed()
		{
			if (Keyboard.current != null)
			{
				return ((ButtonControl)Keyboard.current.escapeKey).wasPressedThisFrame;
			}
			return false;
		}

		public static bool EscapeHeld()
		{
			if (Keyboard.current != null)
			{
				return ((ButtonControl)Keyboard.current.escapeKey).isPressed;
			}
			return false;
		}

		private unsafe static bool TryGetKey(KeyCode code, out Key key)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			if (Renamed.TryGetValue(code, out key))
			{
				return true;
			}
			string text = ((object)(*(KeyCode*)(&code))/*cast due to .constrained prefix*/).ToString();
			if (text.StartsWith("Alpha"))
			{
				text = "Digit" + text.Substring("Alpha".Length);
			}
			else if (text.StartsWith("Keypad"))
			{
				text = "Numpad" + text.Substring("Keypad".Length);
			}
			if (Enum.TryParse<Key>(text, ignoreCase: true, out key))
			{
				return (int)key != 0;
			}
			return false;
		}
	}
	internal static class ItemCatalog
	{
		private static readonly Dictionary<ItemEntry, GameObject> Prefabs = new Dictionary<ItemEntry, GameObject>();

		private static List<ItemEntry> _entries = new List<ItemEntry>();

		private static NetworkManager _builtFor;

		private static int _builtCount = -1;

		public static IReadOnlyList<ItemEntry> All()
		{
			NetworkManager singleton = NetworkManager.Singleton;
			object obj;
			if (!((Object)(object)singleton != (Object)null))
			{
				obj = null;
			}
			else
			{
				NetworkConfig networkConfig = singleton.NetworkConfig;
				if (networkConfig == null)
				{
					obj = null;
				}
				else
				{
					NetworkPrefabs prefabs = networkConfig.Prefabs;
					obj = ((prefabs != null) ? prefabs.Prefabs : null);
				}
			}
			IReadOnlyList<NetworkPrefab> readOnlyList = (IReadOnlyList<NetworkPrefab>)obj;
			if (readOnlyList == null)
			{
				return Array.Empty<ItemEntry>();
			}
			if ((Object)(object)singleton == (Object)(object)_builtFor && readOnlyList.Count == _builtCount)
			{
				return _entries;
			}
			Prefabs.Clear();
			List<ItemEntry> list = new List<ItemEntry>();
			foreach (NetworkPrefab item in readOnlyList)
			{
				GameObject val = item?.Prefab;
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				try
				{
					if (!((Object)(object)val.GetComponent<Item>() == (Object)null))
					{
						ItemEntry itemEntry = new ItemEntry
						{
							Name = DisplayName(val),
							Rarity = Rarity(val),
							PrefabName = ((Object)val).name
						};
						list.Add(itemEntry);
						Prefabs[itemEntry] = val;
					}
				}
				catch (Exception ex)
				{
					Plugin.Log.LogWarning((object)("Skipping item prefab " + ((Object)val).name + ": " + ex.Message));
				}
			}
			_entries = list;
			_builtFor = singleton;
			_builtCount = readOnlyList.Count;
			Plugin.Log.LogInfo((object)$"Item catalog: {list.Count} items");
			return _entries;
		}

		public static string Spawn(ItemEntry entry, int count)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			if (entry == null || !Prefabs.TryGetValue(entry, out var value) || (Object)(object)value == (Object)null)
			{
				throw new InvalidOperationException("that item is no longer available; reopen the menu");
			}
			if (!GameActions.IsServer)
			{
				throw new InvalidOperationException("only the host can spawn items");
			}
			Vector3 val = GameActions.SpawnPoint(2f) + Vector3.up * 0.3f;
			Vector3 val2 = default(Vector3);
			for (int i = 0; i < count; i++)
			{
				((Vector3)(ref val2))..ctor(Random.Range(-0.3f, 0.3f), (float)i * 0.15f, Random.Range(-0.3f, 0.3f));
				ItemSpawnManager.InstantiateRuntimeItem(value, (Vector3?)(val + val2), (Quaternion?)Quaternion.identity, (Transform)null, (string)null);
			}
			if (count != 1)
			{
				return $"Spawned {count} x {entry.Name}";
			}
			return "Spawned " + entry.Name;
		}

		private static string DisplayName(GameObject prefab)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			PickupInteractionText componentInChildren = prefab.GetComponentInChildren<PickupInteractionText>(true);
			string text = (((Object)(object)componentInChildren != (Object)null) ? componentInChildren.NameKey : null);
			if (string.IsNullOrEmpty(text))
			{
				return ((Object)prefab).name;
			}
			LocalizedText val = Loc.Localize(text);
			string text2 = ((LocalizedText)(ref val)).Text;
			if (!string.IsNullOrWhiteSpace(text2) && !(text2 == text))
			{
				return text2;
			}
			return ((Object)prefab).name;
		}

		private static string Rarity(GameObject prefab)
		{
			Loot component = prefab.GetComponent<Loot>();
			if (!((Object)(object)component != (Object)null))
			{
				return string.Empty;
			}
			return ((object)Unsafe.As<LootRarity, LootRarity>(ref component.Rarity)/*cast due to .constrained prefix*/).ToString();
		}
	}
	internal sealed class ItemEntry
	{
		public string Name;

		public string Rarity;

		public string PrefabName;
	}
	internal static class ItemSearch
	{
		public static List<ItemEntry> Filter(IEnumerable<ItemEntry> items, string query)
		{
			string term = (query ?? string.Empty).Trim();
			return (items ?? Enumerable.Empty<ItemEntry>()).Where((ItemEntry i) => i != null && (term.Length == 0 || Contains(i.Name, term))).OrderBy<ItemEntry, string>((ItemEntry i) => i.Name ?? string.Empty, StringComparer.OrdinalIgnoreCase).ThenBy<ItemEntry, string>((ItemEntry i) => i.PrefabName ?? string.Empty, StringComparer.Ordinal)
				.ToList();
		}

		private static bool Contains(string text, string term)
		{
			if (text != null)
			{
				return text.IndexOf(term, StringComparison.OrdinalIgnoreCase) >= 0;
			}
			return false;
		}
	}
	internal static class ItemsTab
	{
		private const int MaxResults = 200;

		public static VisualElement Build(AdminMenuPanel panel, out Action refresh)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//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_0069: 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_010d: Expected O, but got Unknown
			//IL_0112: Expected O, but got Unknown
			//IL_0122: 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_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Expected O, but got Unknown
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Expected O, but got Unknown
			//IL_01c8: Expected O, but got Unknown
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Expected O, but got Unknown
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Expected O, but got Unknown
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			List<ItemEntry> all = new List<ItemEntry>();
			VisualElement val = new VisualElement();
			val.Add((VisualElement)(object)Ui.Heading("Money"));
			VisualElement val2 = Ui.Row();
			Label money = new Label();
			((VisualElement)money).style.color = StyleColor.op_Implicit(Theme.Text);
			((VisualElement)money).style.width = StyleLength.op_Implicit(200f);
			val2.Add((VisualElement)(object)money);
			float[] array = new float[3] { 10f, 100f, 1000f };
			foreach (float num in array)
			{
				float add = num;
				val2.Add((VisualElement)(object)Ui.ActionButton(panel, $"+${add:N0}", () => GameActions.AddMoney(add), UpdateMoney));
			}
			TextField val3 = new TextField();
			((BaseField<string>)val3).value = string.Empty;
			TextField custom = val3;
			((VisualElement)custom).style.width = StyleLength.op_Implicit(120f);
			((VisualElement)custom).style.marginLeft = StyleLength.op_Implicit(12f);
			val2.Add((VisualElement)(object)custom);
			val2.Add((VisualElement)(object)Ui.ActionButton(panel, "Add", delegate
			{
				if (!Amounts.TryParseMoney(((BaseField<string>)(object)custom).value, out var amount))
				{
					throw new InvalidOperationException($"enter an amount between 1 and {1000000f:N0}");
				}
				return GameActions.AddMoney(amount);
			}, UpdateMoney));
			val.Add(val2);
			val.Add((VisualElement)(object)Ui.Heading("Items"));
			VisualElement val4 = new VisualElement();
			val4.style.marginBottom = StyleLength.op_Implicit(12f);
			TextField val5 = new TextField();
			((BaseField<string>)val5).value = string.Empty;
			TextField search = val5;
			val4.Add((VisualElement)(object)search);
			Label placeholder = new Label("Search items…");
			((VisualElement)placeholder).style.color = StyleColor.op_Implicit(Theme.Muted);
			((VisualElement)placeholder).style.position = StyleEnum<Position>.op_Implicit((Position)1);
			((VisualElement)placeholder).style.left = StyleLength.op_Implicit(8f);
			((VisualElement)placeholder).style.top = StyleLength.op_Implicit(0f);
			((VisualElement)placeholder).style.bottom = StyleLength.op_Implicit(0f);
			((VisualElement)placeholder).style.unityTextAlign = StyleEnum<TextAnchor>.op_Implicit((TextAnchor)3);
			((VisualElement)placeholder).pickingMode = (PickingMode)1;
			val4.Add((VisualElement)(object)placeholder);
			val.Add(val4);
			ScrollView results = new ScrollView();
			((VisualElement)results).style.flexGrow = StyleFloat.op_Implicit(1f);
			val.Add((VisualElement)(object)results);
			INotifyValueChangedExtensions.RegisterValueChangedCallback<string>((INotifyValueChanged<string>)(object)search, (EventCallback<ChangeEvent<string>>)delegate(ChangeEvent<string> evt)
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				((VisualElement)placeholder).style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)(!string.IsNullOrEmpty(evt.newValue)));
				RenderResults();
			});
			refresh = delegate
			{
				UpdateMoney();
				all.Clear();
				all.AddRange(ItemCatalog.All());
				RenderResults();
			};
			return val;
			void RenderResults()
			{
				((VisualElement)results).Clear();
				List<ItemEntry> list = ItemSearch.Filter(all, ((BaseField<string>)(object)search).value);
				if (list.Count == 0)
				{
					((VisualElement)results).Add((VisualElement)(object)Ui.Muted((all.Count == 0) ? "No items found in this session." : "No items match."));
					return;
				}
				int num2 = 0;
				foreach (ItemEntry item in list)
				{
					if (num2++ >= 200)
					{
						((VisualElement)results).Add((VisualElement)(object)Ui.Muted("… more results; refine the search"));
						break;
					}
					VisualElement val6 = BuildRow(panel, item);
					Theme.StyleControls(val6);
					((VisualElement)results).Add(val6);
				}
			}
			void UpdateMoney()
			{
				float? num2 = GameActions.Money();
				((TextElement)money).text = (num2.HasValue ? $"Team money: ${num2.Value:N0}" : "Team money: n/a");
			}
		}

		private static VisualElement BuildRow(AdminMenuPanel panel, ItemEntry item)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_0063: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			VisualElement val = Ui.Row();
			val.style.paddingBottom = StyleLength.op_Implicit(8f);
			val.style.borderBottomWidth = StyleFloat.op_Implicit(1f);
			val.style.borderBottomColor = StyleColor.op_Implicit(Theme.Line);
			Label val2 = new Label(item.Name);
			((VisualElement)val2).style.color = StyleColor.op_Implicit(Theme.Text);
			((VisualElement)val2).style.unityFontStyleAndWeight = StyleEnum<FontStyle>.op_Implicit((FontStyle)1);
			((VisualElement)val2).style.flexGrow = StyleFloat.op_Implicit(1f);
			((VisualElement)val2).style.width = StyleLength.op_Implicit(220f);
			val.Add((VisualElement)(object)val2);
			Label val3 = new Label(item.Rarity);
			((VisualElement)val3).style.color = StyleColor.op_Implicit(Theme.Muted);
			((VisualElement)val3).style.width = StyleLength.op_Implicit(100f);
			val.Add((VisualElement)(object)val3);
			int[] array = new int[3] { 1, 5, 10 };
			foreach (int num in array)
			{
				int n = num;
				val.Add((VisualElement)(object)Ui.ActionButton(panel, $"Spawn {n}", () => ItemCatalog.Spawn(item, n)));
			}
			return val;
		}
	}
	internal static class LevelTab
	{
		public static VisualElement Build(AdminMenuPanel panel, out Action refresh)
		{
			//IL_000d: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			VisualElement val = new VisualElement();
			VisualElement val2 = Ui.Row();
			val2.Add((VisualElement)(object)Ui.ActionButton(panel, "Next checkpoint", GameActions.NextCheckpoint));
			val2.Add((VisualElement)(object)Ui.ConfirmButton(panel, "Complete level", GameActions.CompleteLevel));
			val.Add(val2);
			val.Add((VisualElement)(object)Ui.Heading("Teleport points"));
			val.Add((VisualElement)(object)Ui.Muted("Moves every player and the cart."));
			ScrollView points = new ScrollView();
			((VisualElement)points).style.flexGrow = StyleFloat.op_Implicit(1f);
			val.Add((VisualElement)(object)points);
			refresh = delegate
			{
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				((VisualElement)points).Clear();
				List<string> list = GameActions.TeleportPoints();
				if (list.Count == 0)
				{
					((VisualElement)points).Add((VisualElement)(object)Ui.Muted("No teleport points in this level."));
				}
				else
				{
					VisualElement val3 = Ui.Row();
					foreach (string item in list)
					{
						string target = item;
						Button val4 = Ui.ActionButton(panel, target, () => GameActions.TeleportTo(target));
						((VisualElement)val4).style.marginBottom = StyleLength.op_Implicit(6f);
						val3.Add((VisualElement)(object)val4);
					}
					Theme.StyleControls(val3);
					((VisualElement)points).Add(val3);
				}
			};
			return val;
		}
	}
	internal enum ToggleDecision
	{
		Open,
		Close,
		HostOnly,
		NotInLevel,
		GameMenuOpen
	}
	internal static class MenuGate
	{
		public static ToggleDecision Decide(bool menuOpen, bool isServer, bool hasLocalPlayer, bool gameMenuOpen, bool consoleOpen)
		{
			if (menuOpen)
			{
				return ToggleDecision.Close;
			}
			if (!hasLocalPlayer)
			{
				return ToggleDecision.NotInLevel;
			}
			if (!isServer)
			{
				return ToggleDecision.HostOnly;
			}
			if (gameMenuOpen || consoleOpen)
			{
				return ToggleDecision.GameMenuOpen;
			}
			return ToggleDecision.Open;
		}

		public static string Message(ToggleDecision decision)
		{
			if (decision != ToggleDecision.HostOnly)
			{
				return null;
			}
			return "Admin menu: host only";
		}

		public static bool ShouldAutoClose(bool isServer, bool hasLocalPlayer)
		{
			if (isServer)
			{
				return !hasLocalPlayer;
			}
			return true;
		}

		public static bool ShouldEnableGameInput(bool gameMenuVisible, bool consoleOpen)
		{
			if (!gameMenuVisible)
			{
				return !consoleOpen;
			}
			return false;
		}

		public static bool ShouldClearMenuSuppression(bool suppressedByUs, bool consoleOpen)
		{
			if (suppressedByUs)
			{
				return !consoleOpen;
			}
			return false;
		}

		public static bool ShouldLockCursor(bool gameMenuOpen)
		{
			return !gameMenuOpen;
		}
	}
	internal struct PanelCandidate
	{
		public bool IsToast;

		public bool HasTheme;

		public bool HasTargetTexture;
	}
	internal static class PanelSource
	{
		public static int Pick(IReadOnlyList<PanelCandidate> candidates)
		{
			if (candidates == null)
			{
				return -1;
			}
			int num = -1;
			for (int i = 0; i < candidates.Count; i++)
			{
				PanelCandidate panelCandidate = candidates[i];
				if (panelCandidate.HasTheme && !panelCandidate.HasTargetTexture)
				{
					if (panelCandidate.IsToast)
					{
						return i;
					}
					if (num < 0)
					{
						num = i;
					}
				}
			}
			return num;
		}
	}
	internal static class PlayersTab
	{
		public static VisualElement Build(AdminMenuPanel panel, out Action refresh)
		{
			//IL_000d: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			VisualElement val = new VisualElement();
			Toggle invincible = Ui.InvincibleToggle(panel, "Invincible (everyone)", Plugin.InvinciblePlayers, "Players are invincible", "Players take damage again");
			val.Add((VisualElement)(object)invincible);
			ScrollView list = new ScrollView();
			((VisualElement)list).style.flexGrow = StyleFloat.op_Implicit(1f);
			val.Add((VisualElement)(object)list);
			string shown = null;
			val.schedule.Execute((Action)delegate
			{
				if (!panel.IsOpen)
				{
					return;
				}
				try
				{
					Render(force: false);
				}
				catch (Exception ex)
				{
					Plugin.Log.LogWarning((object)("Players tab refresh failed: " + ex.Message));
				}
			}).Every(1000L);
			refresh = delegate
			{
				((BaseField<bool>)(object)invincible).SetValueWithoutNotify(Plugin.InvinciblePlayers.Value);
				Render(force: true);
			};
			return val;
			void Render(bool force)
			{
				List<PlayerInfo> list2 = GameActions.Players();
				string text = string.Join("|", list2.Select((PlayerInfo p) => $"{p.ClientId}:{p.Name}:{p.HasBody}:{p.IsDead}"));
				if (force || !(text == shown))
				{
					shown = text;
					((VisualElement)list).Clear();
					if (list2.Count != 0)
					{
						foreach (PlayerInfo item in list2)
						{
							VisualElement val2 = BuildRow(panel, item, delegate
							{
								Render(force: true);
							});
							Theme.StyleControls(val2);
							((VisualElement)list).Add(val2);
						}
						return;
					}
					((VisualElement)list).Add((VisualElement)(object)Ui.Muted("No players."));
				}
			}
		}

		private static VisualElement BuildRow(AdminMenuPanel panel, PlayerInfo player, Action rerender)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			VisualElement obj = Ui.Row();
			obj.style.paddingBottom = StyleLength.op_Implicit(10f);
			obj.style.borderBottomWidth = StyleFloat.op_Implicit(1f);
			obj.style.borderBottomColor = StyleColor.op_Implicit(Theme.Line);
			Label val = new Label(player.IsLocal ? (player.Name + " (you)") : player.Name);
			((VisualElement)val).style.color = StyleColor.op_Implicit(Theme.Text);
			((VisualElement)val).style.unityFontStyleAndWeight = StyleEnum<FontStyle>.op_Implicit((FontStyle)1);
			((VisualElement)val).style.width = StyleLength.op_Implicit(200f);
			obj.Add((VisualElement)(object)val);
			Label val2 = new Label((!player.HasBody) ? "No character" : (player.IsDead ? "Dead" : "Alive"));
			((VisualElement)val2).style.color = StyleColor.op_Implicit(player.IsDead ? Ui.Error : Theme.Muted);
			((VisualElement)val2).style.width = StyleLength.op_Implicit(110f);
			obj.Add((VisualElement)(object)val2);
			ulong id = player.ClientId;
			Button val3 = Ui.ActionButton(panel, "Revive", () => GameActions.Revive(id), rerender);
			((VisualElement)val3).SetEnabled(player.HasBody && player.IsDead);
			obj.Add((VisualElement)(object)val3);
			Button val4 = Ui.ActionButton(panel, "Heal", () => GameActions.Heal(id), rerender);
			((VisualElement)val4).SetEnabled(player.HasBody && !player.IsDead);
			obj.Add((VisualElement)(object)val4);
			Button val5 = Ui.ActionButton(panel, "Kill", () => GameActions.Kill(id), rerender);
			((VisualElement)val5).SetEnabled(player.HasBody && !player.IsDead);
			obj.Add((VisualElement)(object)val5);
			Button val6 = Ui.ActionButton(panel, "Bring to me", () => GameActions.BringToMe(id));
			((VisualElement)val6).SetEnabled(player.HasBody && !player.IsLocal);
			obj.Add((VisualElement)(object)val6);
			Button val7 = Ui.ActionButton(panel, "Go to", () => GameActions.GoTo(id));
			((VisualElement)val7).SetEnabled(player.HasBody && !player.IsLocal);
			obj.Add((VisualElement)(object)val7);
			return obj;
		}
	}
	[BepInPlugin("com.darkharasho.trashday.adminmenu", "AdminMenu", "0.1.1")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.darkharasho.trashday.adminmenu";

		public const string PluginName = "AdminMenu";

		public const string PluginVersion = "0.1.1";

		internal static ManualLogSource Log;

		internal static ConfigEntry<KeyboardShortcut> ToggleKey;

		internal static ConfigEntry<bool> CloseOnEscape;

		internal static ConfigEntry<bool> InvinciblePlayers;

		internal static ConfigEntry<bool> InvincibleCart;

		private Harmony _harmony;

		internal static bool PatchesApplied { get; private set; }

		private void Awake()
		{
			//IL_0025: 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_005f: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Expected O, but got Unknown
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			ToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "ToggleKey", new KeyboardShortcut((KeyCode)282, Array.Empty<KeyCode>()), new ConfigDescription("Opens and closes the admin menu. Only the host can open it.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					DispName = "Toggle key",
					Order = 4
				}
			}));
			CloseOnEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "CloseOnEscape", true, new ConfigDescription("Esc closes the admin menu (without opening the pause menu).", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					DispName = "Close on Esc",
					Order = 3
				}
			}));
			InvinciblePlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("Cheats", "InvinciblePlayers", false, new ConfigDescription("Players take no damage. Also on the menu's Players tab.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					DispName = "Invincible players",
					Order = 2
				}
			}));
			InvincibleCart = ((BaseUnityPlugin)this).Config.Bind<bool>("Cheats", "InvincibleCart", false, new ConfigDescription("The cart, its panels and its wheels take no damage. Also on the menu's Cart tab.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					DispName = "Invincible cart",
					Order = 1
				}
			}));
			_harmony = new Harmony("com.darkharasho.trashday.adminmenu");
			try
			{
				_harmony.PatchAll();
				PatchesApplied = true;
			}
			catch (Exception arg)
			{
				Log.LogError((object)$"Patching failed, likely a game update; invincibility is unavailable, the rest of the menu still works. {arg}");
				_harmony.UnpatchSelf();
			}
			GameObject val = new GameObject("AdminMenu");
			Object.DontDestroyOnLoad((Object)val);
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<AdminMenuController>();
			Log.LogInfo((object)string.Format("{0} {1} loaded; press {2} while hosting to open the admin menu", "AdminMenu", "0.1.1", ToggleKey.Value));
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	internal static class Theme
	{
		public static readonly Color Window = Rgb(23, 23, 23);

		public static readonly Color WindowBorder = Rgb(185, 185, 185);

		public static readonly Color Surface = Rgb(34, 36, 41);

		public static readonly Color Control = Rgb(55, 59, 69);

		public static readonly Color ControlHover = Rgb(70, 75, 87);

		public static readonly Color Field = Rgb(20, 21, 24);

		public static readonly Color Line = Rgb(85, 90, 100);

		public static readonly Color Gold = Rgb(240, 200, 94);

		public static readonly Color Text = Rgb(242, 242, 242);

		public static readonly Color Muted = Rgb(169, 174, 183);

		private static readonly TextShadow Shadow = new TextShadow
		{
			offset = new Vector2(2f, 2f),
			color = new Color(0f, 0f, 0f, 0.8f)
		};

		public static void StyleButton(Button button, bool outlined = true)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			IStyle style = ((VisualElement)button).style;
			style.color = StyleColor.op_Implicit(Text);
			style.textShadow = StyleTextShadow.op_Implicit(Shadow);
			style.unityFontStyleAndWeight = StyleEnum<FontStyle>.op_Implicit((FontStyle)1);
			SetPadding((VisualElement)(object)button, 6f, 14f);
			SetBorder((VisualElement)(object)button, 2f, outlined ? Gold : Line, 4f);
			SetHover((VisualElement)(object)button, Control, ControlHover);
		}

		public static void StyleControls(VisualElement root)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			UQueryExtensions.Query(root, (string)null, "unity-base-field__label").ForEach<StyleColor>((Func<VisualElement, StyleColor>)((VisualElement e) => e.style.color = StyleColor.op_Implicit(Muted)));
			UQueryExtensions.Query(root, (string)null, "unity-base-text-field__input").ForEach((Action<VisualElement>)delegate(VisualElement e)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: 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_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				e.style.backgroundColor = StyleColor.op_Implicit(Field);
				e.style.color = StyleColor.op_Implicit(Text);
				SetBorder(e, 1f, Line, 3f);
				UQueryExtensions.Query<VisualElement>(e, (string)null, (string)null).ForEach<StyleColor>((Func<VisualElement, StyleColor>)((VisualElement child) => child.style.color = StyleColor.op_Implicit(Text)));
			});
			UQueryExtensions.Query<Toggle>(root, (string)null, (string)null).ForEach<StyleColor>((Func<Toggle, StyleColor>)((Toggle t) => ((VisualElement)t).style.backgroundColor = StyleColor.op_Implicit(Color.clear)));
			UQueryExtensions.Query(root, (string)null, "unity-toggle__input").ForEach<StyleColor>((Func<VisualElement, StyleColor>)((VisualElement e) => e.style.backgroundColor = StyleColor.op_Implicit(Color.clear)));
			UQueryExtensions.Query(root, (string)null, "unity-toggle__checkmark").ForEach((Action<VisualElement>)delegate(VisualElement e)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: 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_001d: 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_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: 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)
				IStyle style = e.style;
				StyleLength width = (e.style.height = StyleLength.op_Implicit(22f));
				style.width = width;
				e.style.backgroundColor = StyleColor.op_Implicit(Field);
				e.style.unityBackgroundImageTintColor = StyleColor.op_Implicit(Gold);
				SetBorder(e, 2f, Gold, 3f);
			});
			UQueryExtensions.Query(root, (string)null, "unity-base-popup-field__input").ForEach((Action<VisualElement>)delegate(VisualElement e)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//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)
				SetBorder(e, 1f, Line, 3f);
				SetHover(e, Control, ControlHover);
				SetPadding(e, 4f, 10f);
			});
			UQueryExtensions.Query(root, (string)null, "unity-base-popup-field__text").ForEach<StyleColor>((Func<VisualElement, StyleColor>)((VisualElement e) => e.style.color = StyleColor.op_Implicit(Text)));
			UQueryExtensions.Query(root, (string)null, "unity-base-popup-field__arrow").ForEach<StyleColor>((Func<VisualElement, StyleColor>)((VisualElement e) => e.style.unityBackgroundImageTintColor = StyleColor.op_Implicit(Text)));
			UQueryExtensions.Query(root, (string)null, "unity-base-slider__tracker").ForEach((Action<VisualElement>)delegate(VisualElement e)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: 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)
				e.style.backgroundColor = StyleColor.op_Implicit(Field);
				SetBorder(e, 1f, Line, 2f);
			});
			UQueryExtensions.Query(root, (string)null, "unity-base-slider__dragger").ForEach((Action<VisualElement>)delegate(VisualElement e)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: 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)
				e.style.backgroundColor = StyleColor.op_Implicit(Gold);
				SetBorder(e, 0f, Color.clear, 2f);
			});
			UQueryExtensions.Query(root, (string)null, "unity-base-slider__dragger-border").ForEach((Action<VisualElement>)delegate(VisualElement e)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				SetBorder(e, 0f, Color.clear, 0f);
			});
			UQueryExtensions.Query(root, (string)null, "unity-scroller").ForEach((Action<VisualElement>)delegate(VisualElement e)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: 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)
				e.style.backgroundColor = StyleColor.op_Implicit(Color.clear);
				SetBorder(e, 0f, Color.clear, 0f);
			});
			UQueryExtensions.Query(root, (string)null, "unity-scroller__low-button").ForEach<StyleEnum<DisplayStyle>>((Func<VisualElement, StyleEnum<DisplayStyle>>)((VisualElement e) => e.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1)));
			UQueryExtensions.Query(root, (string)null, "unity-scroller__high-button").ForEach<StyleEnum<DisplayStyle>>((Func<VisualElement, StyleEnum<DisplayStyle>>)((VisualElement e) => e.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1)));
			UQueryExtensions.Query(root, (string)null, "unity-scroller").ForEach((Action<VisualElement>)delegate(VisualElement scroller)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//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)
				UQueryExtensions.Query(scroller, (string)null, "unity-base-slider__tracker").ForEach((Action<VisualElement>)delegate(VisualElement e)
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					SetBorder(e, 0f, Color.clear, 3f);
				});
				UQueryExtensions.Query(scroller, (string)null, "unity-base-slider__dragger").ForEach<StyleColor>((Func<VisualElement, StyleColor>)((VisualElement e) => e.style.backgroundColor = StyleColor.op_Implicit(Line)));
			});
		}

		public static void StyleDropdownMenusWhenOpened(DropdownField dropdown)
		{
			EventCallback<EventBase> styleLater = delegate
			{
				((VisualElement)dropdown).schedule.Execute((Action)delegate
				{
					//IL_0023: Unknown result type (might be due to invalid IL or missing references)
					//IL_0028: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_005b: Unknown result type (might be due to invalid IL or missing references)
					//IL_008a: Unknown result type (might be due to invalid IL or missing references)
					//IL_008f: Unknown result type (might be due to invalid IL or missing references)
					//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
					//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
					//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
					IPanel panel = ((VisualElement)dropdown).panel;
					VisualElement val = ((panel != null) ? panel.visualTree : null);
					if (val != null)
					{
						UQueryExtensions.Query(val, (string)null, "unity-base-dropdown__container-outer").ForEach((Action<VisualElement>)delegate(VisualElement e)
						{
							//IL_0006: Unknown result type (might be due to invalid IL or missing references)
							//IL_000b: 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)
							e.style.backgroundColor = StyleColor.op_Implicit(Surface);
							SetBorder(e, 1f, Gold, 3f);
						});
						UQueryExtensions.Query(val, (string)null, "unity-base-dropdown__container-inner").ForEach<StyleColor>((Func<VisualElement, StyleColor>)((VisualElement e) => e.style.backgroundColor = StyleColor.op_Implicit(Surface)));
						UQueryExtensions.Query(val, (string)null, "unity-base-dropdown__item").ForEach((Action<VisualElement>)delegate(VisualElement e)
						{
							//IL_0001: Unknown result type (might be due to invalid IL or missing references)
							//IL_0006: Unknown result type (might be due to invalid IL or missing references)
							SetHover(e, Surface, ControlHover);
						});
						UQueryExtensions.Query(val, (string)null, "unity-base-dropdown__label").ForEach<StyleColor>((Func<VisualElement, StyleColor>)((VisualElement e) => e.style.color = StyleColor.op_Implicit(Text)));
						UQueryExtensions.Query(val, (string)null, "unity-base-dropdown__checkmark").ForEach<StyleColor>((Func<VisualElement, StyleColor>)((VisualElement e) => e.style.unityBackgroundImageTintColor = StyleColor.op_Implicit(Gold)));
					}
				}).ExecuteLater(0L);
			};
			((CallbackEventHandler)dropdown).RegisterCallback<PointerDownEvent>((EventCallback<PointerDownEvent>)delegate(PointerDownEvent e)
			{
				styleLater.Invoke((EventBase)(object)e);
			}, (TrickleDown)1);
			((CallbackEventHandler)dropdown).RegisterCallback<NavigationSubmitEvent>((EventCallback<NavigationSubmitEvent>)delegate(NavigationSubmitEvent e)
			{
				styleLater.Invoke((EventBase)(object)e);
			}, (TrickleDown)1);
		}

		public static void SetHover(VisualElement element, Color normal, Color hover)
		{
			//IL_000e: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			bool hovered = false;
			bool focused = false;
			Action update = delegate
			{
				//IL_0023: 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_0028: Unknown result type (might be due to invalid IL or missing references)
				element.style.backgroundColor = StyleColor.op_Implicit((hovered || focused) ? hover : normal);
			};
			((CallbackEventHandler)element).RegisterCallback<PointerEnterEvent>((EventCallback<PointerEnterEvent>)delegate
			{
				hovered = true;
				update();
			}, (TrickleDown)0);
			((CallbackEventHandler)element).RegisterCallback<PointerLeaveEvent>((EventCallback<PointerLeaveEvent>)delegate
			{
				hovered = false;
				update();
			}, (TrickleDown)0);
			((CallbackEventHandler)element).RegisterCallback<FocusInEvent>((EventCallback<FocusInEvent>)delegate
			{
				focused = true;
				update();
			}, (TrickleDown)0);
			((CallbackEventHandler)element).RegisterCallback<FocusOutEvent>((EventCallback<FocusOutEvent>)delegate
			{
				focused = false;
				update();
			}, (TrickleDown)0);
			update();
		}

		public static void SetPadding(VisualElement element, float vertical, float horizontal)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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)
			IStyle style = element.style;
			StyleLength paddingTop = (style.paddingBottom = StyleLength.op_Implicit(vertical));
			style.paddingTop = paddingTop;
			paddingTop = (style.paddingRight = StyleLength.op_Implicit(horizontal));
			style.paddingLeft = paddingTop;
		}

		public static void SetBorder(VisualElement element, float width, Color color, float radius)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0038: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_0073: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			IStyle style = element.style;
			StyleFloat val = (style.borderRightWidth = StyleFloat.op_Implicit(width));
			StyleFloat val3 = (style.borderLeftWidth = val);
			StyleFloat borderTopWidth = (style.borderBottomWidth = val3);
			style.borderTopWidth = borderTopWidth;
			StyleColor val6 = (style.borderRightColor = StyleColor.op_Implicit(color));
			StyleColor val8 = (style.borderLeftColor = val6);
			StyleColor borderTopColor = (style.borderBottomColor = val8);
			style.borderTopColor = borderTopColor;
			StyleLength val11 = (style.borderBottomRightRadius = StyleLength.op_Implicit(radius));
			StyleLength val13 = (style.borderBottomLeftRadius = val11);
			StyleLength borderTopLeftRadius = (style.borderTopRightRadius = val13);
			style.borderTopLeftRadius = borderTopLeftRadius;
		}

		private static Color Rgb(int r, int g, int b)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return new Color((float)r / 255f, (float)g / 255f, (float)b / 255f);
		}
	}
	internal static class Ui
	{
		public static readonly Color Error = new Color(1f, 0.45f, 0.4f);

		public static Button ActionButton(AdminMenuPanel panel, string text, Func<string> work, Action after = null)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_0046: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			Button val = new Button((Action)delegate
			{
				panel.Run(text, work);
				after?.Invoke();
			})
			{
				text = text
			};
			Theme.StyleButton(val);
			((VisualElement)val).style.marginRight = StyleLength.op_Implicit(6f);
			return val;
		}

		public static Button ConfirmButton(AdminMenuPanel panel, string text, Func<string> work)
		{
			//IL_0036: 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_004c: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			Button button = null;
			bool armed = false;
			button = new Button((Action)delegate
			{
				if (!armed)
				{
					armed = true;
					((TextElement)button).text = "Click again: " + text;
					((VisualElement)button).schedule.Execute((Action)delegate
					{
						armed = false;
						((TextElement)button).text = text;
					}).ExecuteLater(3000L);
				}
				else
				{
					armed = false;
					((TextElement)button).text = text;
					panel.Run(text, work);
				}
			})
			{
				text = text
			};
			Theme.StyleButton(button);
			((VisualElement)button).style.marginRight = StyleLength.op_Implicit(6f);
			return button;
		}

		public static Toggle InvincibleToggle(AdminMenuPanel panel, string label, ConfigEntry<bool> entry, string onText, string offText)
		{
			//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_003a: Expected O, but got Unknown
			//IL_003b: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			Toggle val = new Toggle(label);
			((BaseField<bool>)val).value = entry.Value;
			Toggle val2 = val;
			((VisualElement)val2).style.marginBottom = StyleLength.op_Implicit(12f);
			if (!Plugin.PatchesApplied)
			{
				((BaseField<bool>)(object)val2).label = label + " (unavailable: patching failed, see the BepInEx log)";
				((VisualElement)val2).SetEnabled(false);
				return val2;
			}
			INotifyValueChangedExtensions.RegisterValueChangedCallback<bool>((INotifyValueChanged<bool>)(object)val2, (EventCallback<ChangeEvent<bool>>)delegate(ChangeEvent<bool> evt)
			{
				entry.Value = evt.newValue;
				panel.SetStatus(evt.newValue ? onText : offText, error: false);
			});
			return val2;
		}

		public static VisualElement Row()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			VisualElement val = new VisualElement();
			val.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)2);
			val.style.alignItems = StyleEnum<Align>.op_Implicit((Align)2);
			val.style.flexWrap = StyleEnum<Wrap>.op_Implicit((Wrap)1);
			val.style.marginBottom = StyleLength.op_Implicit(10f);
			return val;
		}

		public static Label Heading(string text)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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)
			//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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			Label val = new Label(text);
			((VisualElement)val).style.fontSize = StyleLength.op_Implicit(20f);
			((VisualElement)val).style.unityFontStyleAndWeight = StyleEnum<FontStyle>.op_Implicit((FontStyle)1);
			((VisualElement)val).style.color = StyleColor.op_Implicit(Theme.Gold);
			((VisualElement)val).style.marginTop = StyleLength.op_Implicit(8f);
			((VisualElement)val).style.marginBottom = StyleLength.op_Implicit(8f);
			return val;
		}

		public static Label Muted(string text)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			Label val = new Label(text);
			((VisualEle