Decompiled source of RepoRusAdmin v0.3.0

plugins/RepoRusAdmin.dll

Decompiled 3 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using RepoCommon;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RepoRusAdmin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+c9fd33d5cae0af8af245ed38c3e26c188a5721d7")]
[assembly: AssemblyProduct("RepoRusAdmin")]
[assembly: AssemblyTitle("RepoRusAdmin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RepoCommon
{
	internal static class Modal
	{
		private static readonly List<InputKey> NoKeys = new List<InputKey>();

		internal static void Hold()
		{
			InputManager instance = InputManager.instance;
			if ((Object)(object)instance != (Object)null)
			{
				instance.DisableControlsExcept(0.1f, NoKeys);
				instance.DisableMovement(0.1f);
				instance.DisableAiming(0.1f);
			}
			if ((Object)(object)CursorManager.instance != (Object)null)
			{
				CursorManager.instance.Unlock(0.2f);
			}
		}

		internal static bool InRun()
		{
			if (!SemiFunc.IsMainMenu())
			{
				return !SemiFunc.IsSplashScreen();
			}
			return false;
		}
	}
	internal static class Ui
	{
		internal static readonly Color Accent = new Color(0.97f, 0.66f, 0.16f);

		internal static readonly Color Good = new Color(0.5f, 0.88f, 0.58f);

		internal static readonly Color Bad = new Color(0.96f, 0.4f, 0.36f);

		internal static readonly Color TextColor = new Color(0.93f, 0.94f, 0.96f);

		internal static readonly Color MutedColor = new Color(0.62f, 0.65f, 0.72f);

		internal static GUIStyle Window;

		internal static GUIStyle Card;

		internal static GUIStyle Title;

		internal static GUIStyle Heading;

		internal static GUIStyle Body;

		internal static GUIStyle Muted;

		internal static GUIStyle Hint;

		internal static GUIStyle Button;

		internal static GUIStyle ButtonAccent;

		internal static GUIStyle ButtonDanger;

		internal static GUIStyle Tab;

		internal static GUIStyle TabActive;

		internal static GUIStyle Toast;

		internal static GUIStyle Field;

		internal static GUIStyle SliderBar;

		internal static GUIStyle SliderThumb;

		private static bool ready;

		private static Texture2D cursorTexture;

		internal static float Scale()
		{
			return Mathf.Max(0.75f, (float)Screen.height / 1080f);
		}

		internal static void Init()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_0050: 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_0067: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_00b2: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: 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_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Expected O, but got Unknown
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Expected O, but got Unknown
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Expected O, but got Unknown
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Expected O, but got Unknown
			//IL_0329: Expected O, but got Unknown
			//IL_0342: 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_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Expected O, but got Unknown
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Expected O, but got Unknown
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Expected O, but got Unknown
			//IL_03ad: Expected O, but got Unknown
			//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			if (!ready)
			{
				ready = true;
				Window = Box(new Color(0.055f, 0.063f, 0.08f, 0.95f), 16, new RectOffset(0, 0, 0, 0));
				Card = Box(new Color(0.105f, 0.118f, 0.15f, 0.98f), 9, new RectOffset(14, 14, 8, 8));
				Toast = Box(new Color(0.055f, 0.063f, 0.08f, 0.92f), 9, new RectOffset(18, 12, 6, 6));
				Toast.fontSize = 17;
				Toast.normal.textColor = TextColor;
				Toast.alignment = (TextAnchor)3;
				Toast.wordWrap = false;
				Title = Text(26, (FontStyle)1, Accent);
				Heading = Text(19, (FontStyle)1, TextColor);
				Body = Text(16, (FontStyle)0, TextColor);
				Muted = Text(14, (FontStyle)0, MutedColor);
				Hint = Text(13, (FontStyle)0, MutedColor);
				Hint.alignment = (TextAnchor)4;
				Button = Pressable(new Color(0.2f, 0.23f, 0.29f), new Color(0.27f, 0.31f, 0.39f), TextColor);
				ButtonAccent = Pressable(Accent, new Color(1f, 0.78f, 0.36f), new Color(0.1f, 0.08f, 0.04f));
				ButtonDanger = Pressable(new Color(0.55f, 0.18f, 0.17f), new Color(0.75f, 0.24f, 0.22f), Color.white);
				Tab = Pressable(new Color(0.13f, 0.15f, 0.19f), new Color(0.2f, 0.23f, 0.29f), MutedColor);
				TabActive = Pressable(Accent, Accent, new Color(0.1f, 0.08f, 0.04f));
				GUIStyle tab = Tab;
				int fontSize = (TabActive.fontSize = 17);
				tab.fontSize = fontSize;
				Field = Box(new Color(0.13f, 0.15f, 0.19f), 7, new RectOffset(10, 10, 6, 6));
				Field.fontSize = 16;
				Field.normal.textColor = TextColor;
				Field.focused.background = Field.normal.background;
				Field.focused.textColor = TextColor;
				Field.alignment = (TextAnchor)3;
				SliderBar = new GUIStyle(GUI.skin.horizontalSlider)
				{
					fixedHeight = 8f,
					border = new RectOffset(4, 4, 4, 4),
					margin = new RectOffset(6, 6, 9, 9),
					padding = new RectOffset(0, 0, 0, 0)
				};
				SliderBar.normal.background = Rounded(new Color(0.22f, 0.25f, 0.32f), 4);
				SliderThumb = new GUIStyle(GUI.skin.horizontalSliderThumb)
				{
					fixedWidth = 18f,
					fixedHeight = 18f,
					border = new RectOffset(9, 9, 9, 9),
					margin = new RectOffset(0, 0, 0, 0),
					padding = new RectOffset(0, 0, 0, 0)
				};
				SliderThumb.normal.background = Rounded(Accent, 9);
				SliderThumb.hover.background = Rounded(new Color(1f, 0.8f, 0.4f), 9);
				SliderThumb.active.background = Rounded(Color.white, 9);
			}
		}

		internal static float Slider(string label, float value, float min, float max, string format = "0.##", float labelWidth = 230f)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(label, Body, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(labelWidth) });
			float result = GUILayout.HorizontalSlider(value, min, max, SliderBar, SliderThumb, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(22f),
				GUILayout.ExpandWidth(true)
			});
			GUILayout.Label(result.ToString(format), Body, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(72f) });
			GUILayout.EndHorizontal();
			return result;
		}

		internal static bool Toggle(string label, bool value, params GUILayoutOption[] options)
		{
			if (!GUILayout.Button((value ? "●  " : "○  ") + label, value ? ButtonAccent : Button, options))
			{
				return value;
			}
			return !value;
		}

		internal static void DrawCursor()
		{
			//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_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_0043: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)cursorTexture == (Object)null)
			{
				cursorTexture = MakeCursor();
			}
			Matrix4x4 matrix = GUI.matrix;
			GUI.matrix = Matrix4x4.identity;
			float num = Mathf.Max(1f, (float)Screen.height / 1080f);
			Vector3 mousePosition = Input.mousePosition;
			GUI.DrawTexture(new Rect(mousePosition.x - 2f * num, (float)Screen.height - mousePosition.y - 2f * num, (float)((Texture)cursorTexture).width * num, (float)((Texture)cursorTexture).height * num), (Texture)(object)cursorTexture);
			GUI.matrix = matrix;
		}

		private static GUIStyle Text(int size, FontStyle fontStyle, Color color)
		{
			//IL_000a: 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_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_0024: 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)
			//IL_0031: Expected O, but got Unknown
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				fontSize = size,
				fontStyle = fontStyle,
				wordWrap = true
			};
			val.normal.textColor = color;
			return val;
		}

		private static GUIStyle Box(Color color, int radius, RectOffset padding)
		{
			//IL_0000: 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_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_0026: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_003c: 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_0054: 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_006d: Expected O, but got Unknown
			Texture2D background = Rounded(color, radius);
			GUIStyle val = new GUIStyle(GUI.skin.box)
			{
				border = new RectOffset(radius, radius, radius, radius),
				padding = padding,
				margin = new RectOffset(0, 0, 0, 0)
			};
			val.normal.background = background;
			val.hover.background = background;
			val.active.background = background;
			val.focused.background = background;
			return val;
		}

		private static GUIStyle Pressable(Color normal, Color hover, Color text)
		{
			//IL_000a: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0022: 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_0033: Expected O, but got Unknown
			//IL_0033: 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_0042: Expected O, but got Unknown
			//IL_0042: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle(GUI.skin.button)
			{
				border = new RectOffset(9, 9, 9, 9),
				padding = new RectOffset(14, 14, 7, 7),
				margin = new RectOffset(3, 3, 3, 3),
				fontSize = 16,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)4
			};
			val.normal.background = Rounded(normal, 9);
			val.hover.background = Rounded(hover, 9);
			val.active.background = Rounded(Color.Lerp(hover, Color.black, 0.2f), 9);
			val.focused.background = val.normal.background;
			GUIStyleState normal2 = val.normal;
			GUIStyleState hover2 = val.hover;
			GUIStyleState active = val.active;
			Color val2 = (val.focused.textColor = text);
			Color val4 = (active.textColor = val2);
			Color textColor = (hover2.textColor = val4);
			normal2.textColor = textColor;
			return val;
		}

		private static Texture2D Rounded(Color color, int radius)
		{
			//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_0012: 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_0022: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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)
			Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)1,
				wrapMode = (TextureWrapMode)1,
				hideFlags = (HideFlags)61
			};
			for (int i = 0; i < 32; i++)
			{
				for (int j = 0; j < 32; j++)
				{
					float num = (((float)j + 0.5f < (float)radius) ? ((float)radius - ((float)j + 0.5f)) : (((float)j + 0.5f > (float)(32 - radius)) ? ((float)j + 0.5f - (float)(32 - radius)) : 0f));
					float num2 = (((float)i + 0.5f < (float)radius) ? ((float)radius - ((float)i + 0.5f)) : (((float)i + 0.5f > (float)(32 - radius)) ? ((float)i + 0.5f - (float)(32 - radius)) : 0f));
					float num3 = Mathf.Clamp01((float)radius - Mathf.Sqrt(num * num + num2 * num2) + 0.5f);
					val.SetPixel(j, i, new Color(color.r, color.g, color.b, color.a * num3));
				}
			}
			val.Apply();
			return val;
		}

		private static Texture2D MakeCursor()
		{
			//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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: 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)
			Vector2[] poly = (Vector2[])(object)new Vector2[7]
			{
				new Vector2(2f, 2f),
				new Vector2(2f, 24f),
				new Vector2(7.5f, 19f),
				new Vector2(11.5f, 28f),
				new Vector2(15f, 26.5f),
				new Vector2(11f, 18f),
				new Vector2(18f, 18f)
			};
			bool[,] array = new bool[22, 32];
			for (int i = 0; i < 32; i++)
			{
				for (int j = 0; j < 22; j++)
				{
					array[j, i] = PointInPolygon(new Vector2((float)j + 0.5f, (float)i + 0.5f), poly);
				}
			}
			Texture2D val = new Texture2D(22, 32, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)1,
				wrapMode = (TextureWrapMode)1,
				hideFlags = (HideFlags)61
			};
			for (int k = 0; k < 32; k++)
			{
				for (int l = 0; l < 22; l++)
				{
					Color val2 = Color.clear;
					if (array[l, k])
					{
						val2 = Color.white;
					}
					else if (NeighborInside(array, l, k, 22, 32))
					{
						((Color)(ref val2))..ctor(0f, 0f, 0f, 0.95f);
					}
					val.SetPixel(l, 31 - k, val2);
				}
			}
			val.Apply();
			return val;
		}

		private static bool NeighborInside(bool[,] inside, int x, int y, int w, int h)
		{
			for (int i = -1; i <= 1; i++)
			{
				for (int j = -1; j <= 1; j++)
				{
					int num = x + j;
					int num2 = y + i;
					if (num >= 0 && num2 >= 0 && num < w && num2 < h && inside[num, num2])
					{
						return true;
					}
				}
			}
			return false;
		}

		private static bool PointInPolygon(Vector2 p, Vector2[] poly)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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)
			bool flag = false;
			int num = 0;
			int num2 = poly.Length - 1;
			while (num < poly.Length)
			{
				if (poly[num].y > p.y != poly[num2].y > p.y && p.x < (poly[num2].x - poly[num].x) * (p.y - poly[num].y) / (poly[num2].y - poly[num].y) + poly[num].x)
				{
					flag = !flag;
				}
				num2 = num++;
			}
			return flag;
		}
	}
}
namespace RepoRusAdmin
{
	internal static class AdminActions
	{
		private const string UpgradePrefix = "playerUpgrade";

		internal static bool IsHost()
		{
			return SemiFunc.IsMasterClientOrSingleplayer();
		}

		internal static List<PlayerAvatar> Players()
		{
			return (from p in SemiFunc.PlayerGetList()
				where (Object)(object)p != (Object)null
				select p).ToList();
		}

		internal static int Heal(IEnumerable<PlayerAvatar> targets)
		{
			int num = 0;
			foreach (PlayerAvatar target in targets)
			{
				if (!((Object)(object)target == (Object)null) && !target.deadSet)
				{
					target.playerHealth.HealOther(target.playerHealth.maxHealth, true);
					num++;
				}
			}
			return num;
		}

		internal static int Revive(IEnumerable<PlayerAvatar> targets)
		{
			int num = 0;
			foreach (PlayerAvatar target in targets)
			{
				if (!((Object)(object)target == (Object)null) && target.deadSet)
				{
					target.playerDeathHead.inExtractionPoint = true;
					target.playerDeathHead.Revive();
					num++;
				}
			}
			return num;
		}

		internal static string Kick(PlayerAvatar target)
		{
			if (!SemiFunc.IsMultiplayer())
			{
				return "Вы играете один — выгонять некого.";
			}
			if ((Object)(object)target == (Object)null || (Object)(object)target == (Object)(object)PlayerAvatar.instance)
			{
				return "Себя выгнать нельзя.";
			}
			Player owner = target.photonView.Owner;
			if (owner == null || owner.IsMasterClient)
			{
				return "Этого игрока выгнать нельзя.";
			}
			PhotonNetwork.CloseConnection(owner);
			return null;
		}

		internal static void Teleport(PlayerAvatar who, Vector3 position, Quaternion rotation)
		{
			//IL_000a: 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)
			if ((Object)(object)who != (Object)null)
			{
				who.Spawn(position, rotation);
			}
		}

		internal static void TeleportToMe(PlayerAvatar who)
		{
			//IL_0020: 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_0035: 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)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			PlayerAvatar instance = PlayerAvatar.instance;
			if (!((Object)(object)who == (Object)null) && !((Object)(object)instance == (Object)null))
			{
				Teleport(who, ((Component)instance).transform.position + ((Component)instance).transform.forward * 1.2f + Vector3.up * 0.3f, ((Component)instance).transform.rotation);
			}
		}

		internal static void TeleportMeTo(PlayerAvatar target)
		{
			//IL_0020: 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_0035: 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)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			PlayerAvatar instance = PlayerAvatar.instance;
			if (!((Object)(object)target == (Object)null) && !((Object)(object)instance == (Object)null))
			{
				Teleport(instance, ((Component)target).transform.position + ((Component)target).transform.forward * 1.2f + Vector3.up * 0.3f, ((Component)target).transform.rotation);
			}
		}

		internal static List<string> UpgradeNames()
		{
			if ((Object)(object)StatsManager.instance == (Object)null)
			{
				return new List<string>();
			}
			return (from k in StatsManager.instance.dictionaryOfDictionaries.Keys
				where k.StartsWith("playerUpgrade")
				select k.Substring("playerUpgrade".Length) into k
				orderby k
				select k).ToList();
		}

		internal static int GetUpgrade(PlayerAvatar player, string name)
		{
			if ((Object)(object)player == (Object)null || (Object)(object)StatsManager.instance == (Object)null)
			{
				return 0;
			}
			return StatsManager.instance.dictionaryOfDictionaries["playerUpgrade" + name].GetValueOrDefault(player.steamID, 0);
		}

		internal static void AddUpgrade(PlayerAvatar player, string name, int delta)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null || (Object)(object)PunManager.instance == (Object)null)
			{
				return;
			}
			int upgrade = GetUpgrade(player, name);
			delta = Math.Min(10000, upgrade + delta) - upgrade;
			if (delta != 0)
			{
				if (SemiFunc.IsMultiplayer())
				{
					PunManager.instance.photonView.RPC("TesterUpgradeCommandRPC", (RpcTarget)0, new object[3] { player.steamID, name, delta });
				}
				else
				{
					PunManager.instance.TesterUpgradeCommandRPC(player.steamID, name, delta, default(PhotonMessageInfo));
				}
			}
		}

		internal static int GetMoney()
		{
			return SemiFunc.StatGetRunCurrency();
		}

		internal static void SetMoney(int value)
		{
			SemiFunc.StatSetRunCurrency(Math.Max(0, value));
		}

		internal static bool GodMode()
		{
			if ((Object)(object)PlayerAvatar.instance != (Object)null)
			{
				return PlayerAvatar.instance.playerHealth.godMode;
			}
			return false;
		}

		internal static void SetGodMode(bool value)
		{
			if (!((Object)(object)PlayerAvatar.instance == (Object)null))
			{
				if ((Object)(object)DebugCommandHandler.instance != (Object)null)
				{
					DebugCommandHandler.instance.godMode = value;
				}
				PlayerAvatar.instance.playerHealth.godMode = value;
			}
		}

		internal static bool InfiniteEnergy()
		{
			if ((Object)(object)PlayerController.instance != (Object)null)
			{
				return PlayerController.instance.DebugEnergy;
			}
			return false;
		}

		internal static void SetInfiniteEnergy(bool value)
		{
			if (!((Object)(object)PlayerController.instance == (Object)null))
			{
				if ((Object)(object)DebugCommandHandler.instance != (Object)null)
				{
					DebugCommandHandler.instance.infiniteEnergy = value;
				}
				PlayerController.instance.DebugEnergy = value;
				PlayerController.instance.EnergyCurrent = PlayerController.instance.EnergyStart;
			}
		}

		internal static bool NoAggro()
		{
			if ((Object)(object)DebugCommandHandler.instance != (Object)null && (Object)(object)PlayerController.instance != (Object)null)
			{
				return DebugCommandHandler.instance.enemyNoVision.Contains(PlayerController.instance.playerSteamID);
			}
			return false;
		}

		internal static void SetNoAggro(bool value)
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)DebugCommandHandler.instance == (Object)null) && !((Object)(object)PlayerController.instance == (Object)null))
			{
				string playerSteamID = PlayerController.instance.playerSteamID;
				List<string> enemyNoVision = DebugCommandHandler.instance.enemyNoVision;
				if (value && !enemyNoVision.Contains(playerSteamID))
				{
					enemyNoVision.Add(playerSteamID);
				}
				if (!value)
				{
					enemyNoVision.Remove(playerSteamID);
				}
				if (SemiFunc.IsMultiplayer())
				{
					PunManager.instance.photonView.RPC("TesterNoAggroCommandRPC", (RpcTarget)2, new object[2] { playerSteamID, value });
				}
				else
				{
					PunManager.instance.TesterNoAggroCommandRPC(playerSteamID, value, default(PhotonMessageInfo));
				}
			}
		}

		internal static int RemoveEnemies()
		{
			int num = 0;
			foreach (EnemyParent item in EnemyDirector.instance.enemiesSpawned.ToList())
			{
				if ((Object)(object)item != (Object)null && item.Spawned)
				{
					num++;
					item.SpawnedTimerSet(0f);
					item.DespawnedTimerSet(10f, false);
				}
			}
			return num;
		}

		internal static int DestroyEnemies()
		{
			int num = 0;
			foreach (EnemyParent item in EnemyDirector.instance.enemiesSpawned.ToList())
			{
				if (!((Object)(object)item == (Object)null))
				{
					num++;
					EnemyDirector.instance.enemiesSpawned.Remove(item);
					if (SemiFunc.IsMultiplayer())
					{
						PhotonNetwork.Destroy(((Component)item).gameObject);
					}
					else
					{
						Object.Destroy((Object)(object)((Component)item).gameObject);
					}
				}
			}
			return num;
		}

		internal static string CompleteLevel()
		{
			if (!SemiFunc.RunIsLevel())
			{
				return "Доступно только внутри уровня.";
			}
			RunManager.instance.ChangeLevel(true, false, (ChangeLevelType)0);
			return null;
		}

		internal static string RestartLevel()
		{
			if (!SemiFunc.RunIsLevel())
			{
				return "Доступно только внутри уровня.";
			}
			RunManager.instance.ChangeLevel(false, false, (ChangeLevelType)0);
			return null;
		}

		internal static string NextStage()
		{
			if (!SemiFunc.RunIsShop() && !SemiFunc.RunIsLobby())
			{
				return "Доступно только в магазине или на базе.";
			}
			RunManager.instance.ChangeLevel(false, false, (ChangeLevelType)0);
			return null;
		}
	}
	internal static class AdminPanel
	{
		internal static bool Open;

		private const float W = 1000f;

		private const float H = 720f;

		private static readonly string[] TabNames = new string[5] { "Грузовик", "Игроки", "Спавн", "Улучшения", "Игра" };

		private static int tab;

		private static Vector2 scroll;

		private static readonly Dictionary<string, float> armed = new Dictionary<string, float>();

		private static bool errorLogged;

		private static float refreshAt;

		private static List<ItemAttributes> truckItems = new List<ItemAttributes>();

		private static List<PlayerAvatar> players = new List<PlayerAvatar>();

		private static List<Spawner.Entry> spawnFiltered = new List<Spawner.Entry>();

		private static List<string> upgradeNames = new List<string>();

		private static string moneyText = "";

		private static Spawner.Kind spawnKind = Spawner.Kind.Items;

		private static readonly Dictionary<Spawner.Kind, List<Spawner.Entry>> spawnLists = new Dictionary<Spawner.Kind, List<Spawner.Entry>>();

		private static string spawnSearch = "";

		private static int spawnCount = 1;

		private static int upgradePlayer;

		internal static void Toggle()
		{
			if (Open || Modal.InRun())
			{
				Open = !Open;
				refreshAt = 0f;
				armed.Clear();
				spawnLists.Clear();
				if (Open)
				{
					moneyText = (AdminActions.IsHost() ? AdminActions.GetMoney().ToString() : "");
				}
			}
		}

		internal static void Tick()
		{
			if (Open)
			{
				if (Input.GetKeyDown((KeyCode)27))
				{
					Open = false;
				}
				else
				{
					Modal.Hold();
				}
			}
		}

		internal static void Draw()
		{
			//IL_01b5: 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_0018: Invalid comparison between Unknown and I4
			//IL_0021: 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_0034: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			if (!Open)
			{
				return;
			}
			Ui.Init();
			if ((int)Event.current.type == 8)
			{
				RefreshCaches();
			}
			Matrix4x4 matrix = GUI.matrix;
			float num = Ui.Scale();
			GUI.matrix = Matrix4x4.Scale(new Vector3(num, num, 1f));
			float num2 = (float)Screen.width / num;
			float num3 = (float)Screen.height / num;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor((num2 - 1000f) / 2f, (num3 - 720f) / 2f, 1000f, 720f);
			GUI.Box(val, GUIContent.none, Ui.Window);
			GUILayout.BeginArea(new Rect(((Rect)(ref val)).x + 22f, ((Rect)(ref val)).y + 16f, 956f, 688f));
			try
			{
				DrawHeader();
				if (!AdminActions.IsHost())
				{
					GUILayout.Space(30f);
					GUILayout.Label("Панель доступна только хосту комнаты.", Ui.Heading, Array.Empty<GUILayoutOption>());
					GUILayout.Label("Остальным игрокам она ничего не показывает и ни на что не влияет.", Ui.Muted, Array.Empty<GUILayoutOption>());
				}
				else
				{
					DrawTabs();
					GUILayout.Space(8f);
					switch (tab)
					{
					case 0:
						DrawTruck();
						break;
					case 1:
						DrawPlayers();
						break;
					case 2:
						DrawSpawner();
						break;
					case 3:
						DrawUpgrades();
						break;
					default:
						DrawGame();
						break;
					}
				}
				GUILayout.FlexibleSpace();
				GUILayout.Label($"{Plugin.PanelKey.Value} или Esc — закрыть   ·   команды в чате: /помощь", Ui.Hint, Array.Empty<GUILayoutOption>());
			}
			catch (Exception ex)
			{
				if (ex is ExitGUIException)
				{
					throw;
				}
				if (!errorLogged)
				{
					errorLogged = true;
					Plugin.Log.LogError((object)$"Панель: {ex}");
				}
			}
			finally
			{
				GUILayout.EndArea();
				GUI.matrix = matrix;
			}
			Ui.DrawCursor();
		}

		private static void RefreshCaches()
		{
			if (!AdminActions.IsHost())
			{
				return;
			}
			players = AdminActions.Players();
			upgradeNames = AdminActions.UpgradeNames();
			if (Time.unscaledTime >= refreshAt)
			{
				refreshAt = Time.unscaledTime + 0.5f;
				truckItems = TruckCleaner.FindInTruck();
			}
			truckItems.RemoveAll((ItemAttributes i) => (Object)(object)i == (Object)null);
			if (tab != 2)
			{
				return;
			}
			if (!spawnLists.TryGetValue(spawnKind, out var value))
			{
				try
				{
					value = Spawner.Build(spawnKind);
				}
				catch (Exception arg)
				{
					Plugin.Log.LogError((object)$"Список для спавна: {arg}");
					value = new List<Spawner.Entry>();
				}
				spawnLists[spawnKind] = value;
			}
			string term = spawnSearch.Trim().ToLowerInvariant();
			spawnFiltered = ((term.Length == 0) ? value : value.Where((Spawner.Entry e) => e.Title.ToLowerInvariant().Contains(term) || e.Subtitle.ToLowerInvariant().Contains(term)).ToList());
		}

		private static void DrawHeader()
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("REPO · Администратор", Ui.Title, Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Закрыть", Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) }))
			{
				Open = false;
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(6f);
		}

		private static void DrawTabs()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			for (int i = 0; i < TabNames.Length; i++)
			{
				if (GUILayout.Button(TabNames[i], (tab == i) ? Ui.TabActive : Ui.Tab, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) }))
				{
					tab = i;
					scroll = Vector2.zero;
					refreshAt = 0f;
				}
			}
			GUILayout.EndHorizontal();
		}

		private static bool ConfirmButton(string id, string label, GUIStyle style, params GUILayoutOption[] options)
		{
			float value;
			bool flag = armed.TryGetValue(id, out value) && Time.unscaledTime < value;
			if (GUILayout.Button(flag ? "Точно? Нажмите ещё раз" : label, flag ? Ui.ButtonDanger : style, options))
			{
				if (flag)
				{
					armed.Remove(id);
					return true;
				}
				armed[id] = Time.unscaledTime + 4f;
			}
			return false;
		}

		private static void DrawTruck()
		{
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			List<ItemAttributes> list = truckItems.Where((ItemAttributes i) => (Object)(object)i != (Object)null && !TruckCleaner.IsProtected(i)).ToList();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Предметов в грузовике: {truckItems.Count}", Ui.Heading, Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUI.enabled = list.Count > 0;
			if (ConfirmButton("truck-all", $"Убрать всё, кроме защищённых ({list.Count})", Ui.ButtonAccent, GUILayout.Height(34f)))
			{
				Hud.Say($"Убрано из грузовика: {TruckCleaner.RemoveItems(list)}");
				refreshAt = 0f;
			}
			GUI.enabled = true;
			GUILayout.EndHorizontal();
			GUILayout.Label("Защищены (не трогает кнопка «убрать всё»): " + Plugin.ProtectedTypes.Value + ". Меняется в конфиге мода.", Ui.Muted, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			if (truckItems.Count == 0)
			{
				GUILayout.Label("В грузовике пусто. Панель видит предметы, пока вы на базе или на уровне.", Ui.Body, Array.Empty<GUILayoutOption>());
				return;
			}
			scroll = GUILayout.BeginScrollView(scroll, Array.Empty<GUILayoutOption>());
			foreach (IGrouping<string, ItemAttributes> item in (from i in truckItems
				where (Object)(object)i != (Object)null
				group i by i.item.itemName into g
				orderby g.Count() descending
				select g).ToList())
			{
				List<ItemAttributes> list2 = item.ToList();
				bool flag = TruckCleaner.IsProtected(list2[0]);
				GUILayout.BeginHorizontal(Ui.Card, Array.Empty<GUILayoutOption>());
				GUILayout.Label($"{item.Key}  ×{list2.Count}", Ui.Body, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) });
				GUILayout.Label(ItemNames.Get(list2[0].item.itemType) + (flag ? " · защищено" : ""), Ui.Muted, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) });
				GUILayout.FlexibleSpace();
				if (GUILayout.Button("−1", Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }))
				{
					TruckCleaner.RemoveItems(list2.Take(1));
					Hud.Say("Убрано «" + item.Key + "»: 1");
					refreshAt = 0f;
				}
				if (ConfirmButton("truck-" + item.Key, "Убрать все", Ui.Button, GUILayout.Width(190f)))
				{
					Hud.Say($"Убрано «{item.Key}»: {TruckCleaner.RemoveItems(list2)}");
					refreshAt = 0f;
				}
				GUILayout.EndHorizontal();
				GUILayout.Space(3f);
			}
			GUILayout.EndScrollView();
		}

		private static void DrawPlayers()
		{
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Игроков: {players.Count}", Ui.Heading, Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Вылечить всех", Ui.ButtonAccent, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) }))
			{
				Hud.Say($"Вылечено игроков: {AdminActions.Heal(players)}");
			}
			if (GUILayout.Button("Воскресить всех", Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) }))
			{
				int num = AdminActions.Revive(players);
				Hud.Say((num > 0) ? $"Воскрешено игроков: {num}" : "Мёртвых нет.", num > 0);
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(6f);
			scroll = GUILayout.BeginScrollView(scroll, Array.Empty<GUILayoutOption>());
			foreach (PlayerAvatar player in players)
			{
				if (!((Object)(object)player == (Object)null))
				{
					bool flag = (Object)(object)player == (Object)(object)PlayerAvatar.instance;
					bool deadSet = player.deadSet;
					PlayerHealth playerHealth = player.playerHealth;
					GUILayout.BeginHorizontal(Ui.Card, Array.Empty<GUILayoutOption>());
					GUILayout.Label(player.playerName + (flag ? "  (вы)" : ""), Ui.Body, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(210f) });
					Color color = GUI.color;
					GUI.color = (deadSet ? Ui.Bad : Ui.Good);
					GUILayout.Label(deadSet ? "мёртв" : $"{playerHealth.health} / {playerHealth.maxHealth}", Ui.Body, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) });
					GUI.color = color;
					GUILayout.FlexibleSpace();
					GUI.enabled = !deadSet;
					if (GUILayout.Button("Лечить", Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }))
					{
						AdminActions.Heal((IEnumerable<PlayerAvatar>)(object)new PlayerAvatar[1] { player });
						Hud.Say("Вылечен: " + player.playerName);
					}
					GUI.enabled = deadSet;
					if (GUILayout.Button("Воскресить", Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(115f) }))
					{
						AdminActions.Revive((IEnumerable<PlayerAvatar>)(object)new PlayerAvatar[1] { player });
						Hud.Say("Воскрешён: " + player.playerName);
					}
					GUI.enabled = !flag;
					if (GUILayout.Button("К себе", Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(85f) }))
					{
						AdminActions.TeleportToMe(player);
						Hud.Say(player.playerName + " перенесён к вам");
					}
					if (GUILayout.Button("К нему", Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(85f) }))
					{
						AdminActions.TeleportMeTo(player);
						Hud.Say("Вы перенесены к " + player.playerName);
					}
					GUI.enabled = !flag && SemiFunc.IsMultiplayer();
					if (ConfirmButton("kick-" + player.steamID, "Кик", Ui.Button, GUILayout.Width(100f)))
					{
						string text = AdminActions.Kick(player);
						Hud.Say(text ?? ("Игрок «" + player.playerName + "» выгнан из комнаты."), text == null);
					}
					GUI.enabled = true;
					GUILayout.EndHorizontal();
					GUILayout.Space(3f);
				}
			}
			GUILayout.EndScrollView();
		}

		private static void DrawSpawner()
		{
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			Spawner.Kind[] array = new Spawner.Kind[3]
			{
				Spawner.Kind.Items,
				Spawner.Kind.Enemies,
				Spawner.Kind.Valuables
			};
			foreach (Spawner.Kind kind in array)
			{
				if (GUILayout.Button(kind switch
				{
					Spawner.Kind.Enemies => "Враги", 
					Spawner.Kind.Items => "Предметы", 
					_ => "Ценности", 
				}, (spawnKind == kind) ? Ui.ButtonAccent : Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) }))
				{
					spawnKind = kind;
					scroll = Vector2.zero;
				}
			}
			GUILayout.Space(14f);
			GUILayout.Label("Поиск:", Ui.Body, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
			spawnSearch = GUILayout.TextField(spawnSearch, 40, Ui.Field, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(220f),
				GUILayout.Height(32f)
			});
			GUILayout.FlexibleSpace();
			GUILayout.Label("Сколько:", Ui.Body, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(75f) });
			int[] array2 = new int[3] { 1, 5, 10 };
			for (int i = 0; i < array2.Length; i++)
			{
				int num = array2[i];
				if (GUILayout.Button("×" + num, (spawnCount == num) ? Ui.ButtonAccent : Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(60f),
					GUILayout.Height(32f)
				}))
				{
					spawnCount = num;
				}
			}
			GUILayout.EndHorizontal();
			string arg = ((spawnKind == Spawner.Kind.Enemies) ? "Враги появляются в ближайшей к вам точке уровня." : "Предметы и ценности появляются перед вами, на расстоянии вытянутой руки.");
			GUILayout.Label($"{arg} Найдено: {spawnFiltered.Count}", Ui.Muted, Array.Empty<GUILayoutOption>());
			GUILayout.Space(4f);
			scroll = GUILayout.BeginScrollView(scroll, Array.Empty<GUILayoutOption>());
			foreach (Spawner.Entry item in spawnFiltered)
			{
				GUILayout.BeginHorizontal(Ui.Card, Array.Empty<GUILayoutOption>());
				GUILayout.Label(item.Title, Ui.Body, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(380f) });
				GUILayout.Label(item.Subtitle, Ui.Muted, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) });
				GUILayout.FlexibleSpace();
				if (GUILayout.Button((spawnCount > 1) ? $"Создать ×{spawnCount}" : "Создать", Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }))
				{
					SpawnEntry(item);
				}
				GUILayout.EndHorizontal();
				GUILayout.Space(2f);
			}
			GUILayout.EndScrollView();
		}

		private static void SpawnEntry(Spawner.Entry entry)
		{
			try
			{
				for (int i = 0; i < spawnCount; i++)
				{
					entry.Spawn();
				}
				Hud.Say("Создано: " + entry.Title + ((spawnCount > 1) ? $" ×{spawnCount}" : ""));
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)$"Спавн «{entry.Title}»: {ex}");
				Hud.Say("Не удалось создать «" + entry.Title + "»: " + ex.Message, ok: false);
			}
		}

		private static void DrawUpgrades()
		{
			//IL_0112: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			if (players.Count == 0)
			{
				GUILayout.Label("Игроков не найдено.", Ui.Body, Array.Empty<GUILayoutOption>());
				return;
			}
			upgradePlayer = Mathf.Clamp(upgradePlayer, 0, players.Count - 1);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Игрок:", Ui.Body, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
			for (int i = 0; i < players.Count; i++)
			{
				if (!((Object)(object)players[i] == (Object)null) && GUILayout.Button(players[i].playerName, (upgradePlayer == i) ? Ui.ButtonAccent : Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) }))
				{
					upgradePlayer = i;
				}
			}
			GUILayout.EndHorizontal();
			GUILayout.Label("Постоянные улучшения игрока (как в магазине). Изменение сразу применяется у игрока.", Ui.Muted, Array.Empty<GUILayoutOption>());
			GUILayout.Space(4f);
			PlayerAvatar val = players[upgradePlayer];
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			scroll = GUILayout.BeginScrollView(scroll, Array.Empty<GUILayoutOption>());
			foreach (string upgradeName in upgradeNames)
			{
				GUILayout.BeginHorizontal(Ui.Card, Array.Empty<GUILayoutOption>());
				GUILayout.Label(ItemNames.Upgrade(upgradeName), Ui.Body, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(330f) });
				GUILayout.Label(AdminActions.GetUpgrade(val, upgradeName).ToString(), Ui.Heading, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
				GUILayout.FlexibleSpace();
				if (GUILayout.Button("−1", Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }))
				{
					AdminActions.AddUpgrade(val, upgradeName, -1);
				}
				if (GUILayout.Button("+1", Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }))
				{
					AdminActions.AddUpgrade(val, upgradeName, 1);
				}
				if (GUILayout.Button("+5", Ui.ButtonAccent, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }))
				{
					AdminActions.AddUpgrade(val, upgradeName, 5);
				}
				GUILayout.EndHorizontal();
				GUILayout.Space(2f);
			}
			GUILayout.EndScrollView();
		}

		private static void DrawGame()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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)
			scroll = GUILayout.BeginScrollView(scroll, Array.Empty<GUILayoutOption>());
			int money = AdminActions.GetMoney();
			GUILayout.Label($"Деньги: {money}   (единицы как в меню игры, тыс.)", Ui.Heading, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			int[] array = new int[7] { -50, -10, -5, 5, 10, 50, 100 };
			for (int i = 0; i < array.Length; i++)
			{
				int num = array[i];
				if (GUILayout.Button((num > 0) ? ("+" + num) : num.ToString(), Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) }))
				{
					AdminActions.SetMoney(money + num);
					moneyText = AdminActions.GetMoney().ToString();
				}
			}
			GUILayout.Space(10f);
			moneyText = GUILayout.TextField(moneyText, 9, Ui.Field, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(130f),
				GUILayout.Height(34f)
			});
			if (GUILayout.Button("Задать", Ui.ButtonAccent, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) }) && int.TryParse(moneyText, out var result))
			{
				AdminActions.SetMoney(result);
				Hud.Say($"Деньги: было {money}, стало {AdminActions.GetMoney()}");
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(14f);
			GUILayout.Label("Режимы для себя", Ui.Heading, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			bool flag = AdminActions.GodMode();
			if (Ui.Toggle("Бессмертие", flag, GUILayout.Height(34f)) != flag)
			{
				AdminActions.SetGodMode(!flag);
			}
			bool flag2 = AdminActions.InfiniteEnergy();
			if (Ui.Toggle("Бесконечная энергия", flag2, GUILayout.Height(34f)) != flag2)
			{
				AdminActions.SetInfiniteEnergy(!flag2);
			}
			bool flag3 = AdminActions.NoAggro();
			if (Ui.Toggle("Враги не видят меня", flag3, GUILayout.Height(34f)) != flag3)
			{
				AdminActions.SetNoAggro(!flag3);
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(14f);
			GUILayout.Label("Враги", Ui.Heading, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (ConfirmButton("enemies-despawn", "Убрать всех врагов", Ui.Button, GUILayout.Width(250f), GUILayout.Height(34f)))
			{
				Hud.Say($"Врагов убрано: {AdminActions.RemoveEnemies()} (они могут появиться снова)");
			}
			if (ConfirmButton("enemies-destroy", "Уничтожить всех врагов", Ui.Button, GUILayout.Width(250f), GUILayout.Height(34f)))
			{
				Hud.Say($"Врагов уничтожено: {AdminActions.DestroyEnemies()}");
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(14f);
			GUILayout.Label("Уровень", Ui.Heading, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Переходы между уровнями делает сама игра, как при обычном прохождении. Нажимайте, когда все готовы.", Ui.Muted, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (ConfirmButton("lvl-complete", "Завершить уровень (в магазин)", Ui.Button, GUILayout.Width(320f), GUILayout.Height(34f)))
			{
				string text = AdminActions.CompleteLevel();
				if (text != null)
				{
					Hud.Say(text, ok: false);
				}
			}
			if (ConfirmButton("lvl-restart", "Перезапустить уровень", Ui.Button, GUILayout.Width(250f), GUILayout.Height(34f)))
			{
				string text2 = AdminActions.RestartLevel();
				if (text2 != null)
				{
					Hud.Say(text2, ok: false);
				}
			}
			if (ConfirmButton("lvl-next", "Дальше (из магазина/базы)", Ui.Button, GUILayout.Width(280f), GUILayout.Height(34f)))
			{
				string text3 = AdminActions.NextStage();
				if (text3 != null)
				{
					Hud.Say(text3, ok: false);
				}
			}
			GUILayout.EndHorizontal();
			GUILayout.EndScrollView();
		}
	}
	internal static class Commands
	{
		internal static void Register(DebugCommandHandler handler)
		{
			Add(handler, new string[2] { "помощь", "ahelp" }, "Список команд администратора", hostOnly: false, Help);
			Add(handler, new string[2] { "игроки", "players" }, "Игроки: имя и здоровье", hostOnly: false, Players);
			Add(handler, new string[2] { "хлам", "junk" }, "Что лежит в грузовике", hostOnly: true, delegate
			{
				TruckCleaner.List();
			});
			Add(handler, new string[2] { "убрать", "clean" }, "Убрать предметы из грузовика: /убрать всё | /убрать гранаты", hostOnly: true, TruckCleaner.Clean);
			Add(handler, new string[2] { "деньги", "money" }, "Деньги: /деньги 50 (задать), /деньги +10, /деньги -5", hostOnly: true, Money);
			Add(handler, new string[2] { "лечить", "heal" }, "Вылечить: /лечить [имя|все]", hostOnly: true, Heal);
			Add(handler, new string[2] { "воскресить", "rev" }, "Воскресить: /воскресить [имя|все]", hostOnly: true, Revive);
			Add(handler, new string[2] { "кик", "kick" }, "Выгнать игрока: /кик имя", hostOnly: true, Kick);
			Add(handler, new string[2] { "враги", "enemies" }, "Убрать всех врагов с уровня", hostOnly: true, delegate
			{
				Hud.Say($"Врагов убрано: {AdminActions.RemoveEnemies()}");
			});
			Plugin.Log.LogInfo((object)"Команды администратора зарегистрированы");
		}

		private static void Add(DebugCommandHandler handler, string[] names, string description, bool hostOnly, Action<string[]> run)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			foreach (string name in names)
			{
				handler.Register(new ChatCommand(name, description, (Action<bool, string[]>)delegate(bool isDebugConsole, string[] args)
				{
					try
					{
						if (hostOnly && !AdminActions.IsHost())
						{
							Hud.Say("Эта команда только для хоста.", ok: false);
						}
						else
						{
							run(args);
						}
					}
					catch (Exception ex)
					{
						Plugin.Log.LogError((object)$"/{name}: {ex}");
						Hud.Say("Ошибка в команде /" + name + ": " + ex.Message, ok: false);
					}
				}, (Func<bool, string, string[], List<string>>)null, (Func<bool>)null, false));
			}
		}

		private static void Help(string[] args)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Hud.Say($"Главное — панель по клавише {Plugin.PanelKey.Value}. Команды чата (в скобках — латиницей):\n" + "/хлам (/junk) — что лежит в грузовике\n/убрать всё | гранаты | название (/clean) — убрать предметы из грузовика\n/деньги 50 | +10 | -5 (/money) — задать или изменить деньги\n/лечить [имя|все] (/heal) — вылечить\n/воскресить [имя|все] (/rev) — воскресить\n/кик имя (/kick) — выгнать игрока\n/враги (/enemies) — убрать всех врагов\n/игроки (/players) — список игроков");
		}

		private static void Players(string[] args)
		{
			List<PlayerAvatar> list = AdminActions.Players();
			if (list.Count == 0)
			{
				Hud.Say("Игроков не найдено.", ok: false);
				return;
			}
			Hud.Say("Игроки:\n" + string.Join("\n", list.Select((PlayerAvatar p) => p.playerName + " — " + (p.deadSet ? "мёртв" : (p.playerHealth.health + "/" + p.playerHealth.maxHealth)))));
		}

		private static List<PlayerAvatar> FindPlayers(string[] args)
		{
			string term = string.Join(" ", args).Trim().ToLowerInvariant();
			List<PlayerAvatar> list = AdminActions.Players();
			if (term.Length == 0)
			{
				return new List<PlayerAvatar> { PlayerAvatar.instance };
			}
			if (term == "все" || term == "всех" || term == "all")
			{
				return list;
			}
			return list.Where((PlayerAvatar p) => p.playerName != null && p.playerName.ToLowerInvariant().Contains(term)).ToList();
		}

		private static void Money(string[] args)
		{
			if (args.Length == 0 || !int.TryParse(args[0], out var result))
			{
				Hud.Say("Использование: /деньги 50 (задать), /деньги +10 или /деньги -5 (изменить). Единицы — как в меню игры (тыс.).", ok: false);
				return;
			}
			int money = AdminActions.GetMoney();
			AdminActions.SetMoney((args[0].StartsWith("+") || args[0].StartsWith("-")) ? (money + result) : result);
			Hud.Say($"Деньги: было {money}, стало {AdminActions.GetMoney()}");
		}

		private static void Heal(string[] args)
		{
			List<PlayerAvatar> list = FindPlayers(args);
			if (list.Count == 0)
			{
				Hud.Say("Игрок не найден. Список: /игроки", ok: false);
			}
			else
			{
				Hud.Say($"Вылечено игроков: {AdminActions.Heal(list)}");
			}
		}

		private static void Revive(string[] args)
		{
			List<PlayerAvatar> list = FindPlayers(args);
			if (list.Count == 0)
			{
				Hud.Say("Игрок не найден. Список: /игроки", ok: false);
				return;
			}
			int num = AdminActions.Revive(list);
			Hud.Say((num > 0) ? $"Воскрешено игроков: {num}" : "Среди выбранных нет мёртвых.", num > 0);
		}

		private static void Kick(string[] args)
		{
			if (args.Length == 0)
			{
				Hud.Say("Использование: /кик имя", ok: false);
				return;
			}
			List<PlayerAvatar> list = (from p in FindPlayers(args)
				where (Object)(object)p != (Object)(object)PlayerAvatar.instance
				select p).ToList();
			if (list.Count != 1)
			{
				Hud.Say((list.Count == 0) ? "Игрок не найден (себя выгнать нельзя). Список: /игроки" : ("Подходит несколько игроков, уточните имя: " + string.Join(", ", list.Select((PlayerAvatar p) => p.playerName))), ok: false);
			}
			else
			{
				string playerName = list[0].playerName;
				string text = AdminActions.Kick(list[0]);
				Hud.Say(text ?? ("Игрок «" + playerName + "» выгнан из комнаты."), text == null);
			}
		}
	}
	internal static class Hud
	{
		private struct Line
		{
			public string Text;

			public bool Ok;

			public float Until;
		}

		private const int MaxLines = 16;

		private const float ShowSeconds = 9f;

		private static readonly List<Line> lines = new List<Line>();

		internal static void Say(string text, bool ok = true)
		{
			Plugin.Log.LogInfo((object)text.Replace("\n", " | "));
			string[] array = text.Split('\n');
			foreach (string text2 in array)
			{
				lines.Add(new Line
				{
					Text = text2,
					Ok = ok,
					Until = Time.unscaledTime + 9f
				});
			}
			while (lines.Count > 16)
			{
				lines.RemoveAt(0);
			}
		}

		internal static void Draw()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			if (lines.Count == 0)
			{
				return;
			}
			lines.RemoveAll((Line l) => Time.unscaledTime >= l.Until);
			if (lines.Count == 0)
			{
				return;
			}
			Ui.Init();
			Matrix4x4 matrix = GUI.matrix;
			float num = Ui.Scale();
			GUI.matrix = Matrix4x4.Scale(new Vector3(num, num, 1f));
			float num2 = 90f;
			Color color = GUI.color;
			Rect val3 = default(Rect);
			foreach (Line line in lines)
			{
				GUIContent val = new GUIContent(line.Text);
				Vector2 val2 = Ui.Toast.CalcSize(val);
				((Rect)(ref val3))..ctor(24f, num2, val2.x + 8f, 30f);
				GUI.Box(val3, val, Ui.Toast);
				GUI.color = (line.Ok ? Ui.Accent : Ui.Bad);
				GUI.DrawTexture(new Rect(((Rect)(ref val3)).x + 6f, ((Rect)(ref val3)).y + 6f, 4f, ((Rect)(ref val3)).height - 12f), (Texture)(object)Texture2D.whiteTexture);
				GUI.color = color;
				num2 += 34f;
			}
			GUI.matrix = matrix;
		}
	}
	internal static class ItemNames
	{
		private static readonly Dictionary<itemType, string> Ru = new Dictionary<itemType, string>
		{
			{
				(itemType)0,
				"дроны"
			},
			{
				(itemType)1,
				"сферы"
			},
			{
				(itemType)2,
				"тележки"
			},
			{
				(itemType)3,
				"улучшения предметов"
			},
			{
				(itemType)4,
				"улучшения игрока"
			},
			{
				(itemType)5,
				"кристаллы энергии"
			},
			{
				(itemType)6,
				"гранаты"
			},
			{
				(itemType)7,
				"оружие ближнего боя"
			},
			{
				(itemType)8,
				"аптечки"
			},
			{
				(itemType)9,
				"оружие"
			},
			{
				(itemType)10,
				"трекеры"
			},
			{
				(itemType)11,
				"мины"
			},
			{
				(itemType)12,
				"карманные тележки"
			},
			{
				(itemType)13,
				"инструменты"
			},
			{
				(itemType)14,
				"транспорт"
			},
			{
				(itemType)15,
				"метатели"
			}
		};

		private static readonly Dictionary<string, string> Upgrades = new Dictionary<string, string>
		{
			{ "Health", "Здоровье" },
			{ "Stamina", "Выносливость" },
			{ "Speed", "Скорость бега" },
			{ "Strength", "Сила хвата" },
			{ "Range", "Дальность хвата" },
			{ "Throw", "Сила броска" },
			{ "ExtraJump", "Дополнительный прыжок" },
			{ "Launch", "Рывок кувырком" },
			{ "TumbleWings", "Крылья кувырка" },
			{ "TumbleClimb", "Лазание кувырком" },
			{ "CrouchRest", "Отдых в приседе" },
			{ "MapPlayerCount", "Карта: число игроков" },
			{ "DeathHeadBattery", "Батарея головы" }
		};

		internal unsafe static string Get(itemType type)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			if (!Ru.TryGetValue(type, out var value))
			{
				return ((object)(*(itemType*)(&type))/*cast due to .constrained prefix*/).ToString();
			}
			return value;
		}

		internal static string Upgrade(string key)
		{
			if (!Upgrades.TryGetValue(key, out var value))
			{
				return key;
			}
			return value;
		}
	}
	internal static class Patches
	{
		[HarmonyPatch(typeof(DebugCommandHandler), "Start")]
		[HarmonyPostfix]
		private static void CommandHandlerStartPostfix(DebugCommandHandler __instance)
		{
			try
			{
				Commands.Register(__instance);
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"Регистрация команд: {arg}");
			}
		}
	}
	[BepInPlugin("reporus.admin", "RepoRusAdmin", "0.3.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string Guid = "reporus.admin";

		public const string Name = "RepoRusAdmin";

		public const string Version = "0.3.0";

		internal static ManualLogSource Log;

		internal static ConfigEntry<KeyboardShortcut> PanelKey;

		internal static ConfigEntry<string> ProtectedTypes;

		internal static ConfigEntry<bool> ConfirmClean;

		internal static ConfigEntry<float> ConfirmSeconds;

		private void Awake()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			PanelKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Общее", "Клавиша панели", new KeyboardShortcut((KeyCode)287, Array.Empty<KeyCode>()), "Открывает и закрывает панель администратора (только у хоста). Esc тоже закрывает.");
			ProtectedTypes = ((BaseUnityPlugin)this).Config.Bind<string>("Чистка грузовика", "Защищённые категории", "cart,pocket_cart,power_crystal", "Эти категории предметов кнопка «Убрать всё» и команда «/убрать всё» не трогают. Названия: drone, orb, cart, item_upgrade, player_upgrade, power_crystal, grenade, melee, healthPack, gun, tracker, mine, pocket_cart, tool, vehicle, launcher. Через запятую.");
			ConfirmClean = ((BaseUnityPlugin)this).Config.Bind<bool>("Чистка грузовика", "Подтверждение команды в чате", true, "Для команды «/убрать» в чате: перед удалением показать, что именно будет убрано, и попросить повторить команду. В панели подтверждение двойным нажатием работает всегда.");
			ConfirmSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Чистка грузовика", "Время на подтверждение, сек", 20f, new ConfigDescription("Сколько секунд после первого вызова команды в чате можно подтвердить повтором.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 120f), Array.Empty<object>()));
			new Harmony("reporus.admin").PatchAll(typeof(Patches));
			Log.LogInfo((object)string.Format("{0} {1} загружен. Панель: {2}, команды чата: /помощь", "RepoRusAdmin", "0.3.0", PanelKey.Value));
		}

		private void Update()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			KeyboardShortcut value = PanelKey.Value;
			if (((KeyboardShortcut)(ref value)).IsDown())
			{
				AdminPanel.Toggle();
			}
			AdminPanel.Tick();
		}

		private void OnGUI()
		{
			AdminPanel.Draw();
			Hud.Draw();
		}
	}
	internal static class Spawner
	{
		internal enum Kind
		{
			Items,
			Enemies,
			Valuables
		}

		internal sealed class Entry
		{
			public string Title;

			public string Subtitle;

			public Action Spawn;
		}

		private static bool Multiplayer()
		{
			return GameManager.instance.gameMode != 0;
		}

		internal static List<Entry> Build(Kind kind)
		{
			return kind switch
			{
				Kind.Items => BuildItems(), 
				Kind.Enemies => BuildEnemies(), 
				_ => BuildValuables(), 
			};
		}

		private static Vector3 PointInFront(float spread = 0f)
		{
			//IL_003a: 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_001e: 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_002d: 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_0052: 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_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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			Camera main = Camera.main;
			Vector3 val = (((Object)(object)main != (Object)null) ? ((Component)main).transform.position : (((Component)PlayerAvatar.instance).transform.position + Vector3.up * 1.5f));
			Vector3 val2 = (((Object)(object)main != (Object)null) ? ((Component)main).transform.forward : ((Component)PlayerAvatar.instance).transform.forward);
			float num = 2.2f;
			RaycastHit val3 = default(RaycastHit);
			if (Physics.Raycast(val, val2, ref val3, num, -1, (QueryTriggerInteraction)1))
			{
				num = Mathf.Max(0.6f, ((RaycastHit)(ref val3)).distance - 0.4f);
			}
			Vector3 val4 = val + val2 * num + Vector3.up * 0.2f;
			if (spread > 0f)
			{
				val4 += new Vector3(Random.Range(0f - spread, spread), Random.Range(0f, spread), Random.Range(0f - spread, spread));
			}
			return val4;
		}

		private static List<Entry> BuildItems()
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			List<Entry> list = new List<Entry>();
			if ((Object)(object)StatsManager.instance == (Object)null)
			{
				return list;
			}
			foreach (Item item in from i in StatsManager.instance.itemDictionary.Values
				where (Object)(object)i != (Object)null && !i.disabled
				orderby i.itemName
				select i)
			{
				Item captured = item;
				list.Add(new Entry
				{
					Title = item.itemName,
					Subtitle = ItemNames.Get(item.itemType),
					Spawn = delegate
					{
						SpawnItem(captured);
					}
				});
			}
			return list;
		}

		private static void SpawnItem(Item item)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_0010: 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_003a: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = PointInFront(0.25f);
			Quaternion identity = Quaternion.identity;
			if (Multiplayer())
			{
				PhotonNetwork.InstantiateRoomObject(((PrefabRef<GameObject>)(object)item.prefab).ResourcePath, val, identity, (byte)0, (object[])null);
			}
			else
			{
				Object.Instantiate<GameObject>(((PrefabRef<GameObject>)(object)item.prefab).Prefab, val, identity);
			}
		}

		private static List<Entry> BuildEnemies()
		{
			List<Entry> list = new List<Entry>();
			if ((Object)(object)EnemyDirector.instance == (Object)null)
			{
				return list;
			}
			foreach (EnemySetup item in from s in EnemyDirector.instance.enemiesDifficulty1.Concat(EnemyDirector.instance.enemiesDifficulty2).Concat(EnemyDirector.instance.enemiesDifficulty3)
				where (Object)(object)s != (Object)null
				group s by ((Object)s).name into g
				select g.First() into s
				orderby ((Object)s).name
				select s)
			{
				EnemySetup captured = item;
				list.Add(new Entry
				{
					Title = Regex.Replace(((Object)item).name, "^Enemy (- )?", ""),
					Subtitle = "враг",
					Spawn = delegate
					{
						SpawnEnemy(captured);
					}
				});
			}
			return list;
		}

		private static void SpawnEnemy(EnemySetup setup)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			LevelPoint val = SemiFunc.LevelPointsGetClosestToLocalPlayer();
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Vector3 position = ((Component)val).transform.position;
			foreach (PrefabRef spawnObject in setup.spawnObjects)
			{
				GameObject val2 = (Multiplayer() ? PhotonNetwork.InstantiateRoomObject(((PrefabRef<GameObject>)(object)spawnObject).ResourcePath, position, Quaternion.identity, (byte)0, (object[])null) : Object.Instantiate<GameObject>(((PrefabRef<GameObject>)(object)spawnObject).Prefab, position, Quaternion.identity));
				EnemyParent component = val2.GetComponent<EnemyParent>();
				if ((Object)(object)component != (Object)null)
				{
					component.SetupDone = true;
					Enemy componentInChildren = val2.GetComponentInChildren<Enemy>();
					if (componentInChildren != null)
					{
						componentInChildren.EnemyTeleported(position);
					}
					component.firstSpawnPointUsed = true;
				}
			}
		}

		private static List<Entry> BuildValuables()
		{
			List<Entry> list = new List<Entry>();
			if ((Object)(object)RunManager.instance == (Object)null)
			{
				return list;
			}
			foreach (PrefabRef item in from x in RunManager.instance.levels.SelectMany((Level l) => l.ValuablePresets.SelectMany((LevelValuables p) => p.tiny.Concat(p.small).Concat(p.medium).Concat(p.big)
					.Concat(p.wide)
					.Concat(p.tall)
					.Concat(p.veryTall)))
				where ((PrefabRef<GameObject>)(object)x)?.IsValid() ?? false
				group x by ((PrefabRef<GameObject>)(object)x).PrefabName into g
				select g.First() into p
				orderby ((PrefabRef<GameObject>)(object)p).PrefabName
				select p)
			{
				PrefabRef captured = item;
				list.Add(new Entry
				{
					Title = Regex.Replace(((PrefabRef<GameObject>)(object)item).PrefabName, "^Valuable ", ""),
					Subtitle = "ценность",
					Spawn = delegate
					{
						SpawnValuable(captured);
					}
				});
			}
			return list;
		}

		private static void SpawnValuable(PrefabRef prefab)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = PointInFront(0.25f);
			Quaternion identity = Quaternion.identity;
			ValuableObject component = (Multiplayer() ? PhotonNetwork.InstantiateRoomObject(((PrefabRef<GameObject>)(object)prefab).ResourcePath, val, identity, (byte)0, (object[])null) : Object.Instantiate<GameObject>(((PrefabRef<GameObject>)(object)prefab).Prefab, val, identity)).GetComponent<ValuableObject>();
			if (component != null)
			{
				component.DollarValueSetLogic();
			}
		}
	}
	internal static class TruckCleaner
	{
		private static string pendingTerm;

		private static float pendingUntil;

		internal static List<ItemAttributes> FindInTruck()
		{
			List<ItemAttributes> list = new List<ItemAttributes>();
			ItemAttributes[] array = Object.FindObjectsOfType<ItemAttributes>();
			foreach (ItemAttributes val in array)
			{
				if ((Object)(object)val == (Object)null || val.shopItem || (Object)(object)val.item == (Object)null || (Object)(object)val.roomVolumeCheck == (Object)null || !val.roomVolumeCheck.inTruck)
				{
					continue;
				}
				PhysGrabObject component = ((Component)val).GetComponent<PhysGrabObject>();
				if (!((Object)(object)component != (Object)null) || !component.grabbed)
				{
					ItemEquippable component2 = ((Component)val).GetComponent<ItemEquippable>();
					if (!((Object)(object)component2 != (Object)null) || !component2.IsEquipped())
					{
						list.Add(val);
					}
				}
			}
			return list;
		}

		private static bool IsAll(string term)
		{
			if (!(term == "всё") && !(term == "все"))
			{
				return term == "all";
			}
			return true;
		}

		internal static bool IsProtected(ItemAttributes item)
		{
			return (from s in Plugin.ProtectedTypes.Value.Split(new char[3] { ',', ';', ' ' }, StringSplitOptions.RemoveEmptyEntries)
				select s.Trim().ToLowerInvariant()).Contains(((object)Unsafe.As<itemType, itemType>(ref item.item.itemType)/*cast due to .constrained prefix*/).ToString().ToLowerInvariant());
		}

		private unsafe static bool Matches(ItemAttributes item, string term)
		{
			//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_001e: Unknown result type (might be due to invalid IL or missing references)
			if (IsAll(term))
			{
				return !IsProtected(item);
			}
			itemType itemType = item.item.itemType;
			if (!ItemNames.Get(itemType).ToLowerInvariant().Contains(term) && !((object)(*(itemType*)(&itemType))/*cast due to .constrained prefix*/).ToString().ToLowerInvariant().Contains(term) && !item.item.itemName.ToLowerInvariant().Contains(term))
			{
				return ((Object)item.item).name.ToLowerInvariant().Contains(term);
			}
			return true;
		}

		private static string Describe(IEnumerable<ItemAttributes> items)
		{
			List<string> list = (from i in items
				group i by i.item.itemName into g
				orderby g.Count() descending
				select $"{g.Key} ×{g.Count()} ({ItemNames.Get(g.First().item.itemType)})").ToList();
			string text = string.Join("\n", list.Take(10));
			if (list.Count > 10)
			{
				text += $"\n…и ещё {list.Count - 10} вид(ов)";
			}
			return text;
		}

		internal static void List()
		{
			List<ItemAttributes> list = FindInTruck();
			if (list.Count == 0)
			{
				Hud.Say("В грузовике нет предметов (или вы не на базе/в уровне).", ok: false);
				return;
			}
			int num = list.Count((ItemAttributes i) => !IsProtected(i));
			Hud.Say($"В грузовике предметов: {list.Count} (под «/убрать всё»: {num}, защищено: {list.Count - num})\n{Describe(list)}");
		}

		internal static void Clean(string[] args)
		{
			List<string> list = args.Select((string a) => a.ToLowerInvariant()).ToList();
			bool flag = list.Count > 0 && (list.Last() == "да" || list.Last() == "yes");
			if (flag)
			{
				list.RemoveAt(list.Count - 1);
			}
			string term = string.Join(" ", list).Trim();
			if (term.Length == 0)
			{
				Hud.Say("Чистка грузовика: «/убрать всё» — всё, кроме защищённого; «/убрать гранаты» — по категории или названию.\nСначала команда покажет, что будет убрано; повторите её для подтверждения (или добавьте «да»). «/хлам» — что лежит в грузовике.");
				return;
			}
			List<ItemAttributes> list2 = (from i in FindInTruck()
				where Matches(i, term)
				select i).ToList();
			if (list2.Count == 0)
			{
				Hud.Say("В грузовике нет подходящих предметов по запросу «" + term + "».", ok: false);
			}
			else if (!flag && Plugin.ConfirmClean.Value && (!(pendingTerm == term) || !(Time.unscaledTime < pendingUntil)))
			{
				pendingTerm = term;
				pendingUntil = Time.unscaledTime + Plugin.ConfirmSeconds.Value;
				Hud.Say($"Будет убрано предметов: {list2.Count}\n{Describe(list2)}\n" + $"Чтобы подтвердить, повторите команду в течение {Plugin.ConfirmSeconds.Value:0} с (или добавьте «да»).");
			}
			else
			{
				pendingTerm = null;
				Hud.Say($"Убрано из грузовика: {RemoveItems(list2)}");
			}
		}

		internal static int RemoveItems(IEnumerable<ItemAttributes> items)
		{
			int num = 0;
			foreach (ItemAttributes item in items.ToList())
			{
				if (!((Object)(object)item == (Object)null))
				{
					Remove(item);
					num++;
				}
			}
			return num;
		}

		private static void Remove(ItemAttributes item)
		{
			string instanceName = item.instanceName;
			if (!string.IsNullOrEmpty(instanceName) && StatsManager.instance.item.ContainsKey(instanceName))
			{
				StatsManager.instance.ItemRemove(instanceName);
			}
			else
			{
				Plugin.Log.LogWarning((object)("У предмета «" + item.item.itemName + "» нет записи в сохранении, удаляю только из мира"));
			}
			PhysGrabObject component = ((Component)item).GetComponent<PhysGrabObject>();
			if ((Object)(object)component != (Object)null)
			{
				component.DestroyPhysGrabObject();
			}
			else
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}