Decompiled source of Highseat v0.12.1

plugins/Highseat.dll

Decompiled 11 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GBV.Shared;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Splatform;
using UnityEngine;

[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("Guys Being Vikings")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.12.1.0")]
[assembly: AssemblyInformationalVersion("0.12.1+e657779d0bc7e0ad2354e990e7009cad98cf6d27")]
[assembly: AssemblyProduct("Highseat")]
[assembly: AssemblyTitle("Highseat")]
[assembly: AssemblyVersion("0.12.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 GBV.Shared
{
	internal static class Theme
	{
		public static readonly Color StoneDeep = Hex("0A0B0D");

		public static readonly Color Stone = Hex("14161A");

		public static readonly Color StoneHi = Hex("1F2329");

		public static readonly Color StoneLit = Hex("2D323A");

		public static readonly Color Carve = Hex("060708");

		public static readonly Color Brass = Hex("C9A45C");

		public static readonly Color BrassHi = Hex("F2D9A0");

		public static readonly Color BrassDim = Hex("6B5630");

		public static readonly Color BrassInk = Hex("17110478");

		public static readonly Color TextHi = Hex("F7F4EE");

		public static readonly Color Text = Hex("D8D4CC");

		public static readonly Color Muted = Hex("9FA0A2");

		public static readonly Color Faint = Hex("74767A");

		public static readonly Color Good = Hex("A6C978");

		public static readonly Color Bad = Hex("DD6A57");

		public static readonly Color Warn = Hex("E8B25C");

		public const float Pad = 30f;

		public const float Inlay = 9f;

		public const float TabH = 46f;

		public const float RowH = 30f;

		public const float FooterH = 44f;

		public static GUIStyle Blank;

		public static GUIStyle Wordmark;

		public static GUIStyle TabOn;

		public static GUIStyle TabOff;

		public static GUIStyle Heading;

		public static GUIStyle Body;

		public static GUIStyle BodyHi;

		public static GUIStyle Dim;

		public static GUIStyle Small;

		public static GUIStyle SmallRight;

		public static GUIStyle Mono;

		public static GUIStyle MonoDim;

		public static GUIStyle MonoEcho;

		public static GUIStyle Search;

		public static GUIStyle Field;

		public static GUIStyle FieldText;

		public static GUIStyle FieldArea;

		public static GUIStyle Console_;

		public static GUIStyle Link;

		public static GUIStyle LinkOn;

		public static GUIStyle Chip;

		public static GUIStyle ChipOn;

		public static GUIStyle Row;

		public static GUIStyle Action;

		public static GUIStyle ActionKey;

		public static GUIStyle Danger;

		public static GUIStyle Btn;

		public static GUIStyle BtnOn;

		public static GUIStyle BtnPrimary;

		public static GUIStyle BtnDanger;

		public static GUIStyle BtnSmall;

		public static GUIStyle DropItem;

		public static GUIStyle TileName;

		public static GUIStyle TileNameHot;

		public static GUIStyle Glyph;

		public static GUIStyle ScrollbarV;

		public static GUIStyle ScrollbarThumb;

		public static GUIStyle Scroll;

		public static Texture2D Grain;

		public static Texture2D Px;

		private static bool _built;

		public static void EnsureBuilt()
		{
			//IL_000e: 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: Expected O, but got Unknown
			//IL_0039: 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_005d: 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_0081: 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_00a5: 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_00d4: 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_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_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: 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_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Expected O, but got Unknown
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: 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_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: 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_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: 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)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: 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_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: 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_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			//IL_043d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0461: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Expected O, but got Unknown
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_050d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0513: Unknown result type (might be due to invalid IL or missing references)
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			//IL_0528: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_0538: Unknown result type (might be due to invalid IL or missing references)
			//IL_0547: Unknown result type (might be due to invalid IL or missing references)
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_056c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0572: Unknown result type (might be due to invalid IL or missing references)
			//IL_057c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_058b: Expected O, but got Unknown
			//IL_058b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0592: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Expected O, but got Unknown
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ab: Expected O, but got Unknown
			//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05be: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ca: Expected O, but got Unknown
			//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Expected O, but got Unknown
			//IL_0602: Expected O, but got Unknown
			//IL_0607: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0614: Unknown result type (might be due to invalid IL or missing references)
			//IL_061f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0626: Unknown result type (might be due to invalid IL or missing references)
			//IL_062b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0635: Expected O, but got Unknown
			//IL_063a: Expected O, but got Unknown
			//IL_063f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0644: Unknown result type (might be due to invalid IL or missing references)
			//IL_064c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0657: Unknown result type (might be due to invalid IL or missing references)
			//IL_065e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0665: Unknown result type (might be due to invalid IL or missing references)
			//IL_066f: Expected O, but got Unknown
			//IL_066f: Unknown result type (might be due to invalid IL or missing references)
			//IL_067b: Expected O, but got Unknown
			//IL_0680: Unknown result type (might be due to invalid IL or missing references)
			//IL_0685: Unknown result type (might be due to invalid IL or missing references)
			//IL_068d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0698: Unknown result type (might be due to invalid IL or missing references)
			//IL_069f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ae: Expected O, but got Unknown
			//IL_06b3: Expected O, but got Unknown
			//IL_06bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0703: Unknown result type (might be due to invalid IL or missing references)
			//IL_0751: Unknown result type (might be due to invalid IL or missing references)
			//IL_0784: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e0: Expected O, but got Unknown
			//IL_07ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0809: Unknown result type (might be due to invalid IL or missing references)
			//IL_080e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0818: Expected O, but got Unknown
			//IL_0818: Unknown result type (might be due to invalid IL or missing references)
			//IL_0823: Unknown result type (might be due to invalid IL or missing references)
			//IL_0829: Unknown result type (might be due to invalid IL or missing references)
			//IL_0833: Expected O, but got Unknown
			//IL_0833: Unknown result type (might be due to invalid IL or missing references)
			//IL_0838: Unknown result type (might be due to invalid IL or missing references)
			//IL_0842: Expected O, but got Unknown
			//IL_0847: Expected O, but got Unknown
			//IL_0851: Unknown result type (might be due to invalid IL or missing references)
			//IL_0856: Unknown result type (might be due to invalid IL or missing references)
			//IL_085c: Unknown result type (might be due to invalid IL or missing references)
			//IL_086b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0871: Unknown result type (might be due to invalid IL or missing references)
			//IL_0880: Unknown result type (might be due to invalid IL or missing references)
			//IL_0886: Unknown result type (might be due to invalid IL or missing references)
			//IL_0895: Unknown result type (might be due to invalid IL or missing references)
			//IL_089a: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a4: Expected O, but got Unknown
			//IL_08a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08af: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08be: Expected O, but got Unknown
			//IL_08be: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cd: Expected O, but got Unknown
			//IL_08d2: Expected O, but got Unknown
			//IL_0959: Unknown result type (might be due to invalid IL or missing references)
			//IL_096d: Unknown result type (might be due to invalid IL or missing references)
			if (!_built)
			{
				_built = true;
				Px = Solid(Color.white);
				Grain = StoneGrain(128);
				Blank = new GUIStyle();
				Wordmark = Label(26, (FontStyle)1, TextHi);
				Heading = Label(11, (FontStyle)1, Brass);
				Body = Label(13, (FontStyle)0, Text);
				BodyHi = Label(13, (FontStyle)1, TextHi);
				Dim = Label(13, (FontStyle)0, Muted);
				Small = Label(11, (FontStyle)0, Muted);
				SmallRight = Label(11, (FontStyle)0, Muted);
				SmallRight.alignment = (TextAnchor)5;
				Mono = Label(12, (FontStyle)0, TextHi);
				MonoDim = Label(12, (FontStyle)0, Muted);
				MonoEcho = Label(12, (FontStyle)1, Brass);
				TabOff = Ghost(46f, 13, (FontStyle)0, Muted, TextHi);
				TabOn = Ghost(46f, 13, (FontStyle)1, BrassHi, BrassHi);
				TabOff.alignment = (TextAnchor)4;
				TabOn.alignment = (TextAnchor)4;
				Link = Ghost(30f, 13, (FontStyle)0, Text, BrassHi);
				LinkOn = Ghost(30f, 13, (FontStyle)1, BrassHi, BrassHi);
				Link.alignment = (TextAnchor)4;
				LinkOn.alignment = (TextAnchor)4;
				Chip = Ghost(26f, 12, (FontStyle)0, Muted, BrassHi);
				ChipOn = Ghost(26f, 12, (FontStyle)1, Brass, BrassHi);
				Chip.alignment = (TextAnchor)4;
				ChipOn.alignment = (TextAnchor)4;
				Row = Ghost(30f, 13, (FontStyle)0, Text, BrassHi);
				Row.alignment = (TextAnchor)3;
				Row.padding = new RectOffset(12, 12, 0, 0);
				Action = Ghost(34f, 13, (FontStyle)1, Brass, BrassHi);
				Action.alignment = (TextAnchor)4;
				ActionKey = Ghost(34f, 13, (FontStyle)1, BrassInk, BrassInk);
				ActionKey.alignment = (TextAnchor)4;
				Danger = Ghost(34f, 13, (FontStyle)1, Bad, Hex("FF8B78"));
				Danger.alignment = (TextAnchor)4;
				Btn = Plate(34, 4, Hex("1B1F25"), Hex("272D35"), Hex("3B434E"), Hex("262D36"), Hex("39424E"), Hex("6E5F3A"), Hex("14171C"), Hex("1B2027"), Brass, Text, 13);
				BtnOn = Plate(34, 4, Hex("312B18"), Hex("43391F"), Brass, Hex("3B3320"), Hex("4E4227"), BrassHi, Hex("2A2515"), Hex("352E1A"), BrassHi, BrassHi, 13);
				BtnPrimary = Plate(34, 4, Hex("A8873A"), Hex("D0A63A"), Hex("F2D9A0"), Hex("C09A38"), Hex("EBC97A"), Hex("F7E6BE"), Hex("8A6E2C"), Hex("A8873A"), Hex("F2D9A0"), Hex("151003"), 13);
				BtnPrimary.fontStyle = (FontStyle)1;
				BtnDanger = Plate(34, 4, Hex("5A2621"), Hex("7A332C"), Hex("A8453A"), Hex("7A332C"), Hex("9C4239"), Hex("DD6A57"), Hex("431B17"), Hex("5A2621"), Hex("DD6A57"), Hex("F3C8C0"), 13);
				BtnDanger.fontStyle = (FontStyle)1;
				BtnSmall = Plate(26, 3, Hex("1B1F25"), Hex("272D35"), Hex("3B434E"), Hex("262D36"), Hex("39424E"), Hex("6E5F3A"), Hex("14171C"), Hex("1B2027"), Brass, Text, 12);
				DropItem = Ghost(28f, 13, (FontStyle)0, Text, BrassHi);
				DropItem.alignment = (TextAnchor)3;
				DropItem.padding = new RectOffset(12, 12, 0, 0);
				GUIStyle val = new GUIStyle(GUI.skin.textField);
				val.normal.background = Solid(Carve);
				val.normal.textColor = TextHi;
				val.hover.background = Solid(Carve);
				val.hover.textColor = TextHi;
				val.focused.background = Solid(Carve);
				val.focused.textColor = TextHi;
				val.border = new RectOffset(0, 0, 0, 0);
				val.padding = new RectOffset(10, 10, 0, 0);
				val.margin = new RectOffset(0, 0, 0, 0);
				val.fontSize = 15;
				val.fixedHeight = 34f;
				val.alignment = (TextAnchor)3;
				Search = val;
				Field = new GUIStyle(Search)
				{
					fontSize = 13,
					fixedHeight = 26f,
					alignment = (TextAnchor)4,
					padding = new RectOffset(2, 2, 0, 0)
				};
				FieldText = new GUIStyle(Search)
				{
					fontSize = 13,
					fixedHeight = 26f,
					alignment = (TextAnchor)3,
					padding = new RectOffset(8, 8, 0, 0)
				};
				FieldArea = new GUIStyle(Search)
				{
					fontSize = 13,
					fixedHeight = 0f,
					alignment = (TextAnchor)0,
					padding = new RectOffset(10, 10, 8, 8),
					wordWrap = true
				};
				Console_ = new GUIStyle(Search)
				{
					fontSize = 13,
					fixedHeight = 0f,
					alignment = (TextAnchor)3,
					padding = new RectOffset(4, 4, 0, 0)
				};
				Console_.normal.textColor = TextHi;
				Console_.focused.textColor = TextHi;
				Console_.hover.textColor = TextHi;
				Texture2D background = Solid(new Color(0f, 0f, 0f, 0f));
				Console_.normal.background = background;
				Console_.focused.background = background;
				Console_.hover.background = background;
				Console_.active.background = background;
				TileName = Label(11, (FontStyle)0, Text);
				TileName.alignment = (TextAnchor)1;
				TileName.wordWrap = true;
				TileName.clipping = (TextClipping)1;
				TileNameHot = Label(11, (FontStyle)1, TextHi);
				TileNameHot.alignment = (TextAnchor)1;
				TileNameHot.wordWrap = true;
				TileNameHot.clipping = (TextClipping)1;
				Glyph = Label(20, (FontStyle)0, Hex("4A3F33"));
				Glyph.alignment = (TextAnchor)4;
				Scroll = new GUIStyle();
				GUIStyle val2 = new GUIStyle(GUI.skin.verticalScrollbar);
				val2.normal.background = Solid(Hex("0A0807"));
				val2.border = new RectOffset(0, 0, 0, 0);
				val2.fixedWidth = 3f;
				val2.margin = new RectOffset(10, 0, 0, 0);
				val2.padding = new RectOffset(0, 0, 0, 0);
				ScrollbarV = val2;
				GUIStyle val3 = new GUIStyle(GUI.skin.verticalScrollbarThumb);
				val3.normal.background = Solid(BrassDim);
				val3.hover.background = Solid(Brass);
				val3.active.background = Solid(BrassHi);
				val3.border = new RectOffset(0, 0, 0, 0);
				val3.fixedWidth = 3f;
				val3.margin = new RectOffset(0, 0, 0, 0);
				val3.padding = new RectOffset(0, 0, 0, 0);
				ScrollbarThumb = val3;
				GUI.skin.verticalScrollbarUpButton = GUIStyle.none;
				GUI.skin.verticalScrollbarDownButton = GUIStyle.none;
				GUI.skin.horizontalScrollbarLeftButton = GUIStyle.none;
				GUI.skin.horizontalScrollbarRightButton = GUIStyle.none;
				GUI.skin.verticalScrollbar = ScrollbarV;
				GUI.skin.verticalScrollbarThumb = ScrollbarThumb;
				GUI.skin.settings.selectionColor = new Color(Brass.r, Brass.g, Brass.b, 0.3f);
				GUI.skin.settings.cursorColor = BrassHi;
			}
		}

		public static void DrawSlab(Rect r)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: 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_0024: 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_0064: 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_0092: 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_00c7: 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_00dd: 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_0140: 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_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: 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_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			Fill(r, Stone);
			Color color = GUI.color;
			GUI.color = new Color(1f, 1f, 1f, 0.95f);
			GUI.DrawTextureWithTexCoords(r, (Texture)(object)Grain, new Rect(0f, 0f, ((Rect)(ref r)).width / (float)((Texture)Grain).width, ((Rect)(ref r)).height / (float)((Texture)Grain).height));
			GUI.color = color;
			FillFade(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 34f), Carve, 0.6f, topDown: true);
			FillFade(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - 34f, ((Rect)(ref r)).width, 34f), Carve, 0.6f, topDown: false);
			Outline(r, Hex("000000"), 1f);
			Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).y + 1f, ((Rect)(ref r)).width - 2f, 1f), new Color(StoneLit.r, StoneLit.g, StoneLit.b, 0.9f));
			Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).y + 1f, 1f, ((Rect)(ref r)).height - 2f), new Color(StoneLit.r, StoneLit.g, StoneLit.b, 0.7f));
			Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).yMax - 2f, ((Rect)(ref r)).width - 2f, 1f), new Color(0f, 0f, 0f, 0.65f));
			Fill(new Rect(((Rect)(ref r)).xMax - 2f, ((Rect)(ref r)).y + 1f, 1f, ((Rect)(ref r)).height - 2f), new Color(0f, 0f, 0f, 0.5f));
			Rect r2 = default(Rect);
			((Rect)(ref r2))..ctor(((Rect)(ref r)).x + 9f, ((Rect)(ref r)).y + 9f, ((Rect)(ref r)).width - 18f, ((Rect)(ref r)).height - 18f);
			Outline(r2, new Color(Brass.r, Brass.g, Brass.b, 0.75f), 1f);
			Outline(new Rect(((Rect)(ref r2)).x + 1f, ((Rect)(ref r2)).y + 1f, ((Rect)(ref r2)).width - 2f, ((Rect)(ref r2)).height - 2f), new Color(0f, 0f, 0f, 0.55f), 1f);
			Rivet(((Rect)(ref r2)).x, ((Rect)(ref r2)).y);
			Rivet(((Rect)(ref r2)).xMax, ((Rect)(ref r2)).y);
			Rivet(((Rect)(ref r2)).x, ((Rect)(ref r2)).yMax);
			Rivet(((Rect)(ref r2)).xMax, ((Rect)(ref r2)).yMax);
		}

		private static void Rivet(float cx, float cy)
		{
			//IL_0053: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(cx - 3f, cy - 3f, 6f, 6f);
			Fill(new Rect(((Rect)(ref r)).x - 1f, ((Rect)(ref r)).y - 1f, ((Rect)(ref r)).width + 2f, ((Rect)(ref r)).height + 2f), new Color(0f, 0f, 0f, 0.6f));
			Fill(r, BrassDim);
			Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 2f), Brass);
			Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).y + 1f, 2f, 2f), BrassHi);
		}

		public static void Fill(Rect r, Color c)
		{
			//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_000b: Unknown result type (might be due to invalid IL or missing references)
			Color color = GUI.color;
			GUI.color = c;
			GUI.DrawTexture(r, (Texture)(object)Px);
			GUI.color = color;
		}

		private static void FillFade(Rect r, Color c, float alpha, bool topDown)
		{
			//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_0056: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			int num = 8;
			for (int i = 0; i < num; i++)
			{
				float num2 = (float)i / (float)num;
				float num3 = alpha * (topDown ? (1f - num2) : num2);
				float num4 = ((Rect)(ref r)).height / (float)num;
				Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + num4 * (float)i, ((Rect)(ref r)).width, num4 + 1f), new Color(c.r, c.g, c.b, num3));
			}
		}

		public static void Outline(Rect r, Color c, float w)
		{
			//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_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_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_007d: 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)
			Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, w), c);
			Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - w, ((Rect)(ref r)).width, w), c);
			Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, w, ((Rect)(ref r)).height), c);
			Fill(new Rect(((Rect)(ref r)).xMax - w, ((Rect)(ref r)).y, w, ((Rect)(ref r)).height), c);
		}

		public static void Hairline(Rect r, float alpha = 0.28f)
		{
			//IL_001a: 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)
			Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 1f), new Color(Brass.r, Brass.g, Brass.b, alpha));
		}

		public static void Groove(Rect r)
		{
			//IL_001a: 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_0049: 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)
			Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 1f), Carve);
			Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 1f, ((Rect)(ref r)).width, 1f), new Color(StoneLit.r, StoneLit.g, StoneLit.b, 0.8f));
		}

		public static string Spaced(string s)
		{
			if (string.IsNullOrEmpty(s))
			{
				return s;
			}
			StringBuilder stringBuilder = new StringBuilder(s.Length * 2);
			string text = s.ToUpperInvariant();
			foreach (char value in text)
			{
				stringBuilder.Append(value).Append(' ');
			}
			return stringBuilder.ToString().TrimEnd();
		}

		private static GUIStyle Label(int size, FontStyle style, Color colour)
		{
			//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_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)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//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_0047: Expected O, but got Unknown
			//IL_0047: 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_0056: Expected O, but got Unknown
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				fontSize = size,
				fontStyle = style
			};
			val.normal.textColor = colour;
			val.margin = new RectOffset(0, 0, 0, 0);
			val.padding = new RectOffset(0, 0, 0, 0);
			val.alignment = (TextAnchor)3;
			val.wordWrap = false;
			return val;
		}

		private static GUIStyle Ghost(float h, int size, FontStyle style, Color normal, Color hover)
		{
			//IL_0014: 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_003a: 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_0052: 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_005f: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_009d: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			//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_00e1: Expected O, but got Unknown
			//IL_00e1: 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_00f0: Expected O, but got Unknown
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected O, but got Unknown
			Texture2D background = Solid(new Color(0f, 0f, 0f, 0f));
			GUIStyle val = new GUIStyle(GUI.skin.button);
			val.normal.background = background;
			val.normal.textColor = normal;
			val.hover.background = background;
			val.hover.textColor = hover;
			val.active.background = background;
			val.active.textColor = hover;
			val.onNormal.background = background;
			val.onNormal.textColor = hover;
			val.onHover.background = background;
			val.onHover.textColor = hover;
			val.onActive.background = background;
			val.onActive.textColor = hover;
			val.border = new RectOffset(0, 0, 0, 0);
			val.padding = new RectOffset(8, 8, 0, 0);
			val.margin = new RectOffset(0, 0, 0, 0);
			val.fixedHeight = h;
			val.fontSize = size;
			val.fontStyle = style;
			val.alignment = (TextAnchor)3;
			val.wordWrap = false;
			val.clipping = (TextClipping)1;
			return val;
		}

		private static GUIStyle Plate(int h, int radius, Color nBot, Color nTop, Color nEdge, Color hBot, Color hTop, Color hEdge, Color aBot, Color aTop, Color aEdge, Color text, int fontSize)
		{
			//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_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_0025: 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_0032: 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_003c: 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_004a: 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_0057: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_0088: 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_009a: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_00ce: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_00eb: 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_00fe: Expected O, but got Unknown
			//IL_00fe: 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_010f: Expected O, but got Unknown
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: 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_0144: Expected O, but got Unknown
			GUIStyle val = new GUIStyle(GUI.skin.button);
			val.normal.background = PlateTex(h, radius, nBot, nTop, nEdge);
			val.normal.textColor = text;
			val.hover.background = PlateTex(h, radius, hBot, hTop, hEdge);
			val.hover.textColor = text;
			val.active.background = PlateTex(h, radius, aBot, aTop, aEdge);
			val.active.textColor = text;
			val.onNormal.background = PlateTex(h, radius, aBot, aTop, aEdge);
			val.onNormal.textColor = text;
			val.onHover.background = PlateTex(h, radius, aBot, aTop, aEdge);
			val.onHover.textColor = text;
			val.onActive.background = PlateTex(h, radius, aBot, aTop, aEdge);
			val.onActive.textColor = text;
			val.border = new RectOffset(radius + 3, radius + 3, 0, 0);
			val.padding = new RectOffset(10, 10, 0, 0);
			val.margin = new RectOffset(0, 0, 0, 0);
			val.fixedHeight = h;
			val.fontSize = fontSize;
			val.alignment = (TextAnchor)4;
			val.wordWrap = false;
			val.clipping = (TextClipping)1;
			return val;
		}

		private static Texture2D PlateTex(int h, int radius, Color bottom, Color top, Color edge)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_002a: 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_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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_00cd: 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_00dd: 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)
			int num = radius * 2 + 8;
			Texture2D val = new Texture2D(num, h, (TextureFormat)5, false);
			for (int i = 0; i < h; i++)
			{
				float num2 = ((h <= 1) ? 0f : ((float)i / (float)(h - 1)));
				Color val2 = Color.Lerp(bottom, top, num2);
				if (i >= h - 1)
				{
					val2 = Color.Lerp(val2, Color.white, 0.12f);
				}
				for (int j = 0; j < num; j++)
				{
					float num3 = Sdf(j, i, num, h, radius);
					float num4 = Mathf.Clamp01(0.5f - num3);
					if (num4 <= 0f)
					{
						val.SetPixel(j, i, new Color(0f, 0f, 0f, 0f));
						continue;
					}
					float num5 = Mathf.Clamp01(0.5f - (num3 + 1.15f));
					Color val3 = Color.Lerp(edge, val2, num5);
					val.SetPixel(j, i, new Color(val3.r, val3.g, val3.b, num4));
				}
			}
			return Finish(val);
		}

		private static float Sdf(float x, float y, int w, int h, int radius)
		{
			float num = Mathf.Min((float)radius, (float)Mathf.Min(w, h) * 0.5f);
			float num2 = x + 0.5f;
			float num3 = y + 0.5f;
			float num4 = Mathf.Clamp(num2, num, (float)w - num);
			float num5 = Mathf.Clamp(num3, num, (float)h - num);
			float num6 = num2 - num4;
			float num7 = num3 - num5;
			return Mathf.Sqrt(num6 * num6 + num7 * num7) - num;
		}

		private static Color Hex(string hex)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			int num = Convert.ToInt32(hex.Substring(0, 2), 16);
			int num2 = Convert.ToInt32(hex.Substring(2, 2), 16);
			int num3 = Convert.ToInt32(hex.Substring(4, 2), 16);
			float num4 = ((hex.Length >= 8) ? ((float)Convert.ToInt32(hex.Substring(6, 2), 16) / 255f) : 1f);
			return new Color((float)num / 255f, (float)num2 / 255f, (float)num3 / 255f, num4);
		}

		private static Texture2D Finish(Texture2D t)
		{
			((Object)t).hideFlags = (HideFlags)61;
			((Texture)t).filterMode = (FilterMode)1;
			((Texture)t).wrapMode = (TextureWrapMode)0;
			t.Apply();
			return t;
		}

		private static Texture2D Solid(Color c)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			Texture2D val = new Texture2D(1, 1, (TextureFormat)5, false);
			val.SetPixel(0, 0, c);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			return Finish(val);
		}

		private static Texture2D StoneGrain(int size)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_00c4: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)5, false);
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num = (0f + Tileable(j, i, size, 8f) * 0.5f + Tileable(j, i, size, 19f) * 0.32f + Tileable(j, i, size, 43f) * 0.18f - 0.5f) * 2f;
					float num2 = Mathf.Abs(num) * 0.55f;
					Color val2 = ((num >= 0f) ? new Color(StoneHi.r, StoneHi.g, StoneHi.b, num2) : new Color(Carve.r, Carve.g, Carve.b, num2 * 1.5f));
					val.SetPixel(j, i, val2);
				}
			}
			return Finish(val);
		}

		private static float Tileable(int x, int y, int size, float freq)
		{
			float num = (float)x / (float)size;
			float num2 = (float)y / (float)size;
			float num3 = Mathf.PerlinNoise(num * freq, num2 * freq);
			float num4 = Mathf.PerlinNoise((num - 1f) * freq, num2 * freq);
			float num5 = Mathf.PerlinNoise(num * freq, (num2 - 1f) * freq);
			float num6 = Mathf.PerlinNoise((num - 1f) * freq, (num2 - 1f) * freq);
			return Mathf.Lerp(Mathf.Lerp(num3, num4, num), Mathf.Lerp(num5, num6, num), num2);
		}
	}
}
namespace GBV.Highseat
{
	internal static class Admin
	{
		private static string _cachedDiagnosis;

		private static float _lastCheck = -999f;

		private static bool _cachedIsAdmin;

		public static bool IsAdmin
		{
			get
			{
				Refresh();
				return _cachedIsAdmin;
			}
		}

		public static string Diagnosis
		{
			get
			{
				Refresh();
				return _cachedDiagnosis;
			}
		}

		private static void Refresh()
		{
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			if (realtimeSinceStartup - _lastCheck < 1f)
			{
				return;
			}
			_lastCheck = realtimeSinceStartup;
			ZNet instance = ZNet.instance;
			if ((Object)(object)instance == (Object)null)
			{
				_cachedIsAdmin = false;
				_cachedDiagnosis = null;
				return;
			}
			try
			{
				_cachedIsAdmin = instance.LocalPlayerIsAdminOrHost();
			}
			catch
			{
				_cachedIsAdmin = false;
			}
			_cachedDiagnosis = (_cachedIsAdmin ? null : Diagnose(instance));
		}

		private static string Diagnose(ZNet znet)
		{
			try
			{
				string text = ((object)Unsafe.As<PlatformUserID, PlatformUserID>(ref UserInfo.GetLocalUser().UserId)/*cast due to .constrained prefix*/).ToString();
				if (string.IsNullOrEmpty(text))
				{
					return "Your platform user id is not available yet. Still connecting?";
				}
				List<string> adminList = znet.GetAdminList();
				if (adminList == null || adminList.Count == 0)
				{
					return "No admin list arrived from the server. Either adminlist.txt is empty, in which case add this line and restart the server:\n    " + text + "\nor the list was sent and lost in transit. Highseat logs \"admin list received early\" when it arrives, so check the log before editing anything.";
				}
				int num = text.LastIndexOf('_');
				string text2 = ((num >= 0) ? text.Substring(num + 1) : text);
				foreach (string item in adminList)
				{
					if (item != null && item.Trim() == text2)
					{
						return "adminlist.txt has your id WITHOUT its platform prefix, which Valheim will never match. Replace \"" + text2 + "\" with:\n    " + text + "\nthen restart the server.";
					}
				}
				return "You are not in the server's admin list. Add this line to adminlist.txt and restart the server:\n    " + text;
			}
			catch (Exception ex)
			{
				return "Could not determine admin status: " + ex.Message;
			}
		}
	}
	[HarmonyPatch(typeof(ZNet), "OnNewConnection")]
	internal static class ZNet_OnNewConnection_Patch
	{
		private static Action<ZRpc, ZPackage> _forward;

		private static ZNet _boundTo;

		private static bool _reportedFailure;

		private static bool _reportedArrival;

		private static void Postfix(ZNet __instance, ZNetPeer peer)
		{
			try
			{
				if (!((Object)(object)__instance == (Object)null) && peer != null && peer.m_rpc != null && !__instance.IsServer() && Bind(__instance))
				{
					_reportedArrival = false;
					peer.m_rpc.Register<ZPackage>("AdminList", (Action<ZRpc, ZPackage>)EarlyAdminList);
				}
			}
			catch (Exception ex)
			{
				if (!_reportedFailure)
				{
					_reportedFailure = true;
					HighseatPlugin.Log.LogWarning((object)("Could not pre-register the AdminList handler: " + ex.Message));
				}
			}
		}

		private static bool Bind(ZNet znet)
		{
			if (_forward != null && _boundTo == znet)
			{
				return true;
			}
			MethodInfo methodInfo = AccessTools.Method(typeof(ZNet), "RPC_AdminList", (Type[])null, (Type[])null);
			if (methodInfo == null)
			{
				if (!_reportedFailure)
				{
					_reportedFailure = true;
					HighseatPlugin.Log.LogWarning((object)"ZNet.RPC_AdminList is gone. Admin status may not arrive if a ServerSync mod is installed on the server.");
				}
				return false;
			}
			_forward = (Action<ZRpc, ZPackage>)Delegate.CreateDelegate(typeof(Action<ZRpc, ZPackage>), znet, methodInfo);
			_boundTo = znet;
			return true;
		}

		private static void EarlyAdminList(ZRpc rpc, ZPackage pkg)
		{
			try
			{
				_forward(rpc, pkg);
				if (!_reportedArrival)
				{
					_reportedArrival = true;
					ZNet instance = ZNet.instance;
					int num = ((!((Object)(object)instance == (Object)null) && instance.GetAdminList() != null) ? instance.GetAdminList().Count : 0);
					HighseatPlugin.Log.LogInfo((object)("admin list received early (" + num + " entries). A ServerSync mod on the server would otherwise have dropped it."));
				}
			}
			catch (Exception ex)
			{
				HighseatPlugin.Log.LogWarning((object)("AdminList handler failed: " + ex.Message));
			}
		}
	}
	internal enum CatalogCategory
	{
		All,
		Item,
		Creature,
		Piece,
		Other
	}
	internal enum ItemKind
	{
		All,
		Weapon,
		Armor,
		Tool,
		Ammo,
		Food,
		Material,
		Trophy,
		Other
	}
	internal sealed class CatalogEntry
	{
		public string Name;

		public string Display;

		public string Label;

		public string Tip;

		public string SearchKey;

		public Sprite Icon;

		public CatalogCategory Category;

		public ItemKind Kind;
	}
	internal static class Catalog
	{
		private static List<CatalogEntry> _all;

		private static string _error;

		public static bool Ready => _all != null;

		public static int Count
		{
			get
			{
				if (_all != null)
				{
					return _all.Count;
				}
				return 0;
			}
		}

		public static string Error => _error;

		public static void Reset()
		{
			_all = null;
			_error = null;
		}

		public static bool EnsureBuilt()
		{
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			if (_all != null)
			{
				return true;
			}
			ZNetScene instance = ZNetScene.instance;
			if ((Object)(object)instance == (Object)null || instance.m_prefabs == null || instance.m_prefabs.Count == 0)
			{
				return false;
			}
			List<CatalogEntry> list = new List<CatalogEntry>(instance.m_prefabs.Count);
			foreach (GameObject prefab in instance.m_prefabs)
			{
				if ((Object)(object)prefab == (Object)null || string.IsNullOrEmpty(((Object)prefab).name))
				{
					continue;
				}
				CatalogEntry catalogEntry = new CatalogEntry
				{
					Name = ((Object)prefab).name,
					Display = ((Object)prefab).name,
					Category = CatalogCategory.Other
				};
				try
				{
					ItemDrop component = prefab.GetComponent<ItemDrop>();
					if ((Object)(object)component != (Object)null)
					{
						catalogEntry.Category = CatalogCategory.Item;
						if (component.m_itemData != null && component.m_itemData.m_shared != null)
						{
							catalogEntry.Display = Localize(component.m_itemData.m_shared.m_name, ((Object)prefab).name);
							catalogEntry.Kind = Classify(component.m_itemData.m_shared.m_itemType);
							Sprite[] icons = component.m_itemData.m_shared.m_icons;
							if (icons != null && icons.Length != 0)
							{
								catalogEntry.Icon = icons[0];
							}
						}
					}
					else if ((Object)(object)prefab.GetComponent<Character>() != (Object)null)
					{
						catalogEntry.Category = CatalogCategory.Creature;
						Humanoid component2 = prefab.GetComponent<Humanoid>();
						if ((Object)(object)component2 != (Object)null)
						{
							catalogEntry.Display = Localize(((Character)component2).m_name, ((Object)prefab).name);
						}
					}
					else
					{
						Piece component3 = prefab.GetComponent<Piece>();
						if ((Object)(object)component3 != (Object)null)
						{
							catalogEntry.Category = CatalogCategory.Piece;
							catalogEntry.Display = Localize(component3.m_name, ((Object)prefab).name);
							if ((Object)(object)component3.m_icon != (Object)null)
							{
								catalogEntry.Icon = component3.m_icon;
							}
						}
					}
				}
				catch (Exception ex)
				{
					HighseatPlugin.Log.LogDebug((object)("Catalog skipped detail for " + ((Object)prefab).name + ": " + ex.Message));
				}
				catalogEntry.SearchKey = (catalogEntry.Name + " " + catalogEntry.Display).ToLowerInvariant();
				list.Add(catalogEntry);
			}
			Disambiguate(list);
			list.Sort((CatalogEntry a, CatalogEntry b) => string.Compare(a.Label, b.Label, StringComparison.OrdinalIgnoreCase));
			_all = list;
			HighseatPlugin.Log.LogInfo((object)("Catalog built: " + _all.Count + " prefabs indexed."));
			return true;
		}

		private static void Disambiguate(List<CatalogEntry> entries)
		{
			Dictionary<string, int> dictionary = new Dictionary<string, int>(entries.Count, StringComparer.OrdinalIgnoreCase);
			foreach (CatalogEntry entry in entries)
			{
				dictionary[entry.Display] = ((!dictionary.TryGetValue(entry.Display, out var value)) ? 1 : (value + 1));
			}
			foreach (CatalogEntry entry2 in entries)
			{
				bool flag = dictionary[entry2.Display] > 1;
				entry2.Label = (flag ? entry2.Name : entry2.Display);
				entry2.Tip = (string.Equals(entry2.Name, entry2.Display, StringComparison.Ordinal) ? entry2.Name : (entry2.Name + "     " + entry2.Display));
			}
		}

		private static ItemKind Classify(ItemType type)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected I4, but got Unknown
			switch (type - 1)
			{
			case 2:
			case 3:
			case 13:
			case 14:
			case 19:
			case 21:
				return ItemKind.Weapon;
			case 4:
			case 5:
			case 6:
			case 10:
			case 11:
			case 16:
			case 17:
			case 23:
				return ItemKind.Armor;
			case 18:
				return ItemKind.Tool;
			case 8:
			case 22:
				return ItemKind.Ammo;
			case 1:
			case 20:
				return ItemKind.Food;
			case 0:
				return ItemKind.Material;
			case 12:
				return ItemKind.Trophy;
			default:
				return ItemKind.Other;
			}
		}

		private static string Localize(string token, string fallback)
		{
			if (string.IsNullOrEmpty(token))
			{
				return fallback;
			}
			try
			{
				if (Localization.instance != null)
				{
					string text = Localization.instance.Localize(token);
					if (!string.IsNullOrEmpty(text) && !text.StartsWith("["))
					{
						return text;
					}
				}
			}
			catch
			{
			}
			if (!token.StartsWith("$"))
			{
				return token;
			}
			return fallback;
		}

		public static void Filter(string needle, CatalogCategory category, ItemKind kind, List<CatalogEntry> into)
		{
			into.Clear();
			if (_all == null)
			{
				return;
			}
			string text = (string.IsNullOrEmpty(needle) ? null : needle.Trim().ToLowerInvariant());
			foreach (CatalogEntry item in _all)
			{
				if ((category == CatalogCategory.All || item.Category == category) && (kind == ItemKind.All || item.Category != CatalogCategory.Item || item.Kind == kind) && (text == null || item.SearchKey.IndexOf(text, StringComparison.Ordinal) >= 0))
				{
					into.Add(item);
				}
			}
		}

		public static int CountIn(CatalogCategory category)
		{
			if (_all == null)
			{
				return 0;
			}
			if (category == CatalogCategory.All)
			{
				return _all.Count;
			}
			int num = 0;
			foreach (CatalogEntry item in _all)
			{
				if (item.Category == category)
				{
					num++;
				}
			}
			return num;
		}
	}
	internal static class ConsoleMirror
	{
		private const int Capacity = 200;

		private static readonly List<string> Lines = new List<string>(200);

		public static int Revision { get; private set; }

		public static IList<string> Snapshot => Lines;

		public static string Last
		{
			get
			{
				if (Lines.Count != 0)
				{
					return Lines[Lines.Count - 1];
				}
				return null;
			}
		}

		public static void Add(string text)
		{
			if (!string.IsNullOrEmpty(text))
			{
				Lines.Add(text);
				if (Lines.Count > 200)
				{
					Lines.RemoveRange(0, Lines.Count - 200);
				}
				Revision++;
				if (HighseatPlugin.Log != null)
				{
					HighseatPlugin.Log.LogInfo((object)("console | " + text));
				}
			}
		}

		public static void Clear()
		{
			Lines.Clear();
			Revision++;
		}
	}
	internal sealed class HighseatPanel
	{
		private enum Tab
		{
			Spawn,
			Player,
			World,
			Server,
			Mods
		}

		private enum TextAlign
		{
			Left,
			Center,
			Right
		}

		private static class Btn
		{
			public const float H = 34f;
		}

		private const int WindowId = 1213416769;

		private const float IconSize = 44f;

		private const float CellH = 92f;

		private const float CellMin = 96f;

		private static int _guardUntilFrame;

		private static readonly Tab[] TabOrder = new Tab[5]
		{
			Tab.Spawn,
			Tab.Player,
			Tab.World,
			Tab.Server,
			Tab.Mods
		};

		private static readonly string[] TabLabels = new string[5] { "Spawn", "Player", "World", "Server", "Mods" };

		private static readonly int[] Quantities = new int[4] { 1, 5, 10, 50 };

		private Rect _window;

		private Tab _tab;

		private string _extId;

		private bool _rectLoaded;

		private float _lastDeniedLog = -999f;

		private string _search = string.Empty;

		private string _lastSearch;

		private CatalogCategory _category = CatalogCategory.Item;

		private CatalogCategory _lastCategory;

		private ItemKind _kind;

		private ItemKind _lastKind;

		private int _amount = 1;

		private int _level = 1;

		private Vector2 _gridScroll;

		private Rect _gridArea;

		private readonly List<CatalogEntry> _filtered = new List<CatalogEntry>();

		private bool _filterDirty = true;

		private int _skillIndex;

		private int _skillAmount = 10;

		private string _gotoX = "0";

		private string _gotoZ = "0";

		private string[] _skillNames;

		private bool _skillOpen;

		private Rect _skillBtnRect;

		private Vector2 _skillScroll;

		private Vector2 _optionScroll;

		private bool _playersOpen;

		private float _lastSaveAt = -10f;

		private Vector2 _modListScroll;

		private Vector2 _modPaneScroll;

		private int _modIndex;

		private string _modSearch = string.Empty;

		private string _settingSearch = string.Empty;

		private readonly Dictionary<string, string> _textBuffer = new Dictionary<string, string>();

		private readonly Dictionary<string, ModSetting> _bufferOwner = new Dictionary<string, ModSetting>();

		private string _lastFocused = string.Empty;

		private ModSetting _choiceFor;

		private Rect _choiceBtnRect;

		private Vector2 _choiceScroll;

		private ModSetting _editFor;

		private string _editText = string.Empty;

		private Vector2 _editScroll;

		private const float AnimDur = 0.17f;

		private float _tabAnimAt = -10f;

		private float _gridAnimAt = -10f;

		private float _timeOfDay = 0.5f;

		private int _skipSeconds = 60;

		private Vector2 _envScroll;

		private Vector2 _playerScroll;

		private Vector2 _logScroll;

		private int _seenRevision = -1;

		private bool _showLog;

		private const string CmdControl = "HighseatCommandLine";

		private string _cmd = string.Empty;

		private readonly List<string> _cmdHistory = new List<string>();

		private int _historyPos = -1;

		private bool _focusCmd;

		private bool _caretToEnd;

		private int _tabIndex;

		private string _tabStem;

		private static readonly HashSet<string> _brokenTabs = new HashSet<string>();

		private const float ModListW = 300f;

		private const float SettingRowH = 34f;

		private static string _cheatFlagOwner;

		private static bool _cheatFlagChecked;

		internal static bool IsOpen { get; private set; }

		internal static bool BlocksGameInput
		{
			get
			{
				if (!IsOpen)
				{
					return Time.frameCount <= _guardUntilFrame;
				}
				return true;
			}
		}

		internal static bool OwnsConsoleKey
		{
			get
			{
				//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_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Invalid comparison between Unknown and I4
				if (HighseatPlugin.PanelHotkey != null)
				{
					KeyboardShortcut value = HighseatPlugin.PanelHotkey.Value;
					return (int)((KeyboardShortcut)(ref value)).MainKey == 286;
				}
				return false;
			}
		}

		internal void Update()
		{
			//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)
			if (!_rectLoaded)
			{
				_rectLoaded = true;
				_window = new Rect(HighseatPlugin.WindowX.Value, HighseatPlugin.WindowY.Value, HighseatPlugin.WindowW.Value, HighseatPlugin.WindowH.Value);
			}
			if (HotkeyPressed())
			{
				if (IsOpen)
				{
					SetOpen(open: false);
				}
				else if (Admin.IsAdmin)
				{
					SetOpen(open: true);
				}
				else
				{
					DenyOpen();
				}
			}
			if (IsOpen && Input.GetKeyDown((KeyCode)27))
			{
				SetOpen(open: false);
			}
			if (IsOpen && ((Object)(object)ZNet.instance == (Object)null || !Admin.IsAdmin))
			{
				SetOpen(open: false);
			}
			if (IsOpen)
			{
				HoldCursor();
			}
		}

		private unsafe bool HotkeyPressed()
		{
			//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_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_0013: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			KeyboardShortcut value = HighseatPlugin.PanelHotkey.Value;
			KeyCode mainKey = ((KeyboardShortcut)(ref value)).MainKey;
			if ((int)mainKey == 0)
			{
				return false;
			}
			bool flag = ((KeyboardShortcut)(ref value)).IsDown();
			bool flag2 = false;
			using (IEnumerator<KeyCode> enumerator = ((KeyboardShortcut)(ref value)).Modifiers.GetEnumerator())
			{
				if (enumerator.MoveNext())
				{
					_ = enumerator.Current;
					flag2 = true;
				}
			}
			bool flag3 = !flag2 && Input.GetKeyDown(mainKey);
			if (!flag && !flag3)
			{
				return false;
			}
			HighseatPlugin.Log.LogInfo((object)("hotkey " + ((object)(*(KeyCode*)(&mainKey))/*cast due to .constrained prefix*/).ToString() + ": shortcut=" + flag + " raw=" + flag3 + " admin=" + Admin.IsAdmin + " connected=" + ((Object)(object)ZNet.instance != (Object)null) + " open=" + IsOpen));
			return true;
		}

		private void DenyOpen()
		{
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			if (!(realtimeSinceStartup - _lastDeniedLog < 5f))
			{
				_lastDeniedLog = realtimeSinceStartup;
				string diagnosis = Admin.Diagnosis;
				HighseatPlugin.Log.LogInfo((object)("Highseat not opened: you are not a server admin." + (string.IsNullOrEmpty(diagnosis) ? string.Empty : (" " + diagnosis.Replace("\n", " ")))));
			}
		}

		internal void HoldCursor()
		{
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
		}

		private void SetOpen(bool open)
		{
			if (open == IsOpen)
			{
				return;
			}
			IsOpen = open;
			if (open)
			{
				_filterDirty = true;
				ModSettings.Reset();
				_cheatFlagChecked = false;
				_choiceFor = null;
				_textBuffer.Clear();
				_bufferOwner.Clear();
				if (HighseatPlugin.AutoDevCommands.Value)
				{
					EnsureDevCommands();
				}
			}
			else
			{
				CommitLapsedFocus();
				Commit(_lastFocused);
				ModSettings.Flush(force: true);
				_guardUntilFrame = Time.frameCount + 4;
				SaveRect();
				Cursor.visible = false;
				Cursor.lockState = (CursorLockMode)1;
			}
		}

		private void SaveRect()
		{
			if (!(((Rect)(ref _window)).width < 400f) && !(((Rect)(ref _window)).height < 300f))
			{
				HighseatPlugin.WindowX.Value = ((Rect)(ref _window)).x;
				HighseatPlugin.WindowY.Value = ((Rect)(ref _window)).y;
				HighseatPlugin.WindowW.Value = ((Rect)(ref _window)).width;
				HighseatPlugin.WindowH.Value = ((Rect)(ref _window)).height;
			}
		}

		private void EnsureDevCommands()
		{
			if (!Terminal.m_cheat && Admin.IsAdmin)
			{
				Run("devcommands", silent: true);
			}
		}

		internal void Draw()
		{
			//IL_00de: 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_00f9: 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_0119: Expected O, but got Unknown
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			if (IsOpen)
			{
				Theme.EnsureBuilt();
				((Rect)(ref _window)).width = Mathf.Clamp(((Rect)(ref _window)).width, 1100f, Mathf.Max(1100f, (float)Screen.width - 60f));
				((Rect)(ref _window)).height = Mathf.Clamp(((Rect)(ref _window)).height, 720f, Mathf.Max(720f, (float)Screen.height - 60f));
				((Rect)(ref _window)).x = Mathf.Clamp(((Rect)(ref _window)).x, 0f - ((Rect)(ref _window)).width + 200f, (float)Screen.width - 200f);
				((Rect)(ref _window)).y = Mathf.Clamp(((Rect)(ref _window)).y, 0f, (float)Screen.height - 120f);
				GUI.color = Color.white;
				GUI.backgroundColor = Color.white;
				_window = GUI.Window(1213416769, _window, new WindowFunction(DrawWindow), GUIContent.none, Theme.Blank);
			}
		}

		private void DrawWindow(int id)
		{
			//IL_0027: 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_008a: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: 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_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(0f, 0f, ((Rect)(ref _window)).width, ((Rect)(ref _window)).height);
			Theme.DrawSlab(r);
			float num = 30f;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(num, num * 0.62f, ((Rect)(ref r)).width - num * 2f, ((Rect)(ref r)).height - num * 1.3f);
			DrawMasthead(val);
			float num2 = ((Rect)(ref val)).y + 46f;
			DrawTabs(new Rect(((Rect)(ref val)).x, num2, ((Rect)(ref val)).width, 46f));
			float num3 = num2 + 46f + 18f;
			float num4 = ((Rect)(ref val)).yMax - 44f;
			Rect r2 = default(Rect);
			((Rect)(ref r2))..ctor(((Rect)(ref val)).x, num3, ((Rect)(ref val)).width, num4 - num3 - 14f);
			Rect zero = Rect.zero;
			if (_showLog)
			{
				float num5 = Mathf.Clamp(((Rect)(ref r2)).width * 0.3f, 280f, 420f);
				((Rect)(ref zero))..ctor(((Rect)(ref r2)).xMax - num5, num3, num5, ((Rect)(ref r2)).height);
				((Rect)(ref r2)).width = ((Rect)(ref r2)).width - (num5 + 28f);
			}
			Color color = GUI.color;
			float num6 = Mathf.Clamp01((Time.realtimeSinceStartup - _tabAnimAt) / 0.17f);
			if (num6 < 1f)
			{
				float num7 = 1f - (1f - num6) * (1f - num6);
				GUI.color = new Color(1f, 1f, 1f, Mathf.Lerp(0.1f, 1f, num7));
				((Rect)(ref r2)).x = ((Rect)(ref r2)).x + (1f - num7) * 34f;
			}
			bool flag = _extId == null && ((_playersOpen && _tab == Tab.Server) || (_tab == Tab.Mods && (_choiceFor != null || _editFor != null)) || (_skillOpen && _tab == Tab.Player));
			bool enabled = GUI.enabled;
			GUI.enabled = enabled && !flag;
			if (_extId != null)
			{
				DrawExtension(r2);
			}
			else
			{
				switch (_tab)
				{
				case Tab.Spawn:
					DrawSpawn(r2);
					break;
				case Tab.Player:
					DrawPlayer(r2);
					break;
				case Tab.World:
					DrawWorld(r2);
					break;
				case Tab.Mods:
					DrawMods(r2);
					break;
				default:
					DrawServer(r2);
					break;
				}
			}
			GUI.enabled = enabled;
			GUI.color = color;
			if (_showLog)
			{
				DrawLog(zero);
			}
			if (_extId == null && _skillOpen && _tab == Tab.Player)
			{
				DrawSkillDropdown();
			}
			if (_extId == null && _playersOpen && _tab == Tab.Server)
			{
				DrawPlayersOverlay(val);
			}
			if (_extId == null && _choiceFor != null && _tab == Tab.Mods)
			{
				DrawChoiceDropdown(val);
			}
			if (_extId == null && _editFor != null && _tab == Tab.Mods)
			{
				DrawEditOverlay(val);
			}
			DrawFooter(new Rect(((Rect)(ref val)).x, num4, ((Rect)(ref val)).width, 44f));
			GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _window)).width, 42f));
		}

		private void DrawMasthead(Rect r)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			GUI.Label(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, 420f, 34f), "HIGHSEAT", Theme.Wordmark);
			bool cheat = Terminal.m_cheat;
			bool flag = CheatsConfirmed();
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref r)).xMax - 168f, ((Rect)(ref r)).y + 4f, 168f, 34f);
			if (GUI.Button(val, cheat ? "Disable Cheats" : "Enable Cheats", cheat ? Theme.Btn : Theme.BtnPrimary))
			{
				Run("devcommands");
			}
			float right = ((Rect)(ref val)).x - 22f;
			right = Mark(right, ((Rect)(ref r)).y + 10f, cheat ? "CHEATS ON" : "CHEATS OFF", cheat ? Theme.Good : Theme.Muted);
			right = Mark(right, ((Rect)(ref r)).y + 10f, flag ? "CONFIRMED" : "UNCONFIRMED", flag ? Theme.Good : Theme.Warn);
			Mark(right, ((Rect)(ref r)).y + 10f, "ADMIN", Theme.Brass);
		}

		private float Mark(float right, float y, string label, Color colour)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0014: 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_004f: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			string text = Theme.Spaced(label);
			GUIContent val = new GUIContent(text);
			float x = Theme.Small.CalcSize(val).x;
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(right - x, y + 2f, x, 16f);
			GUIStyle val3 = new GUIStyle(Theme.Small);
			val3.normal.textColor = colour;
			GUIStyle val4 = val3;
			GUI.Label(val2, text, val4);
			Theme.Fill(new Rect(((Rect)(ref val2)).x - 14f, y + 8f, 3f, 3f), new Color(colour.r, colour.g, colour.b, 0.7f));
			return ((Rect)(ref val2)).x - 24f;
		}

		private void DrawTabs(Rect r)
		{
			//IL_0020: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: 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_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			Theme.Groove(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - 2f, ((Rect)(ref r)).width, 2f));
			float num = 96f;
			float num2 = ((Rect)(ref r)).xMax - num - 12f;
			float num3 = ((Rect)(ref r)).x;
			for (int i = 0; i < TabOrder.Length; i++)
			{
				bool flag = _extId == null && _tab == TabOrder[i];
				string text = Theme.Spaced(TabLabels[i]);
				Rect tab;
				float num4 = PaintTab(new Rect(num3, ((Rect)(ref r)).y, 0f, ((Rect)(ref r)).height), text, flag, out tab);
				if (GUI.Button(tab, text, flag ? Theme.TabOn : Theme.TabOff) && !flag)
				{
					SelectBuiltIn(TabOrder[i]);
				}
				num3 += num4;
			}
			IList<HighseatTab> all = HighseatTabs.All;
			for (int j = 0; j < all.Count; j++)
			{
				HighseatTab highseatTab = all[j];
				bool flag2 = _extId == highseatTab.Id;
				string text2 = Theme.Spaced(highseatTab.Label);
				if (num3 + TabWidth(text2, flag2) > num2)
				{
					break;
				}
				Rect tab2;
				float num5 = PaintTab(new Rect(num3, ((Rect)(ref r)).y, 0f, ((Rect)(ref r)).height), text2, flag2, out tab2);
				if (GUI.Button(tab2, text2, flag2 ? Theme.TabOn : Theme.TabOff) && !flag2)
				{
					SelectExtension(highseatTab);
				}
				num3 += num5;
			}
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref r)).xMax - num, ((Rect)(ref r)).y, num, ((Rect)(ref r)).height);
			if (_showLog)
			{
				Theme.Fill(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).yMax - 2f, ((Rect)(ref val)).width, 2f), Theme.BrassHi);
			}
			if (GUI.Button(val, Theme.Spaced("Log"), _showLog ? Theme.TabOn : Theme.TabOff))
			{
				_showLog = !_showLog;
				_focusCmd = _showLog;
			}
		}

		private static float TabWidth(string spacedLabel, bool active)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			return (active ? Theme.TabOn : Theme.TabOff).CalcSize(new GUIContent(spacedLabel)).x + 34f;
		}

		private static float PaintTab(Rect slot, string spacedLabel, bool active, out Rect tab)
		{
			//IL_001f: 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_002f: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			float num = TabWidth(spacedLabel, active);
			tab = new Rect(((Rect)(ref slot)).x, ((Rect)(ref slot)).y, num, ((Rect)(ref slot)).height);
			bool flag = ((Rect)(ref tab)).Contains(Event.current.mousePosition);
			if (active)
			{
				Theme.Fill(new Rect(((Rect)(ref tab)).x, ((Rect)(ref tab)).y + 4f, ((Rect)(ref tab)).width, ((Rect)(ref tab)).height - 6f), new Color(Theme.StoneLit.r, Theme.StoneLit.g, Theme.StoneLit.b, 0.55f));
				Theme.Fill(new Rect(((Rect)(ref tab)).x, ((Rect)(ref tab)).yMax - 2f, ((Rect)(ref tab)).width, 2f), Theme.BrassHi);
			}
			else if (flag)
			{
				Theme.Fill(new Rect(((Rect)(ref tab)).x, ((Rect)(ref tab)).yMax - 2f, ((Rect)(ref tab)).width, 2f), new Color(Theme.Brass.r, Theme.Brass.g, Theme.Brass.b, 0.4f));
			}
			return num;
		}

		private void SelectBuiltIn(Tab tab)
		{
			LeaveExtension();
			_tab = tab;
			_tabAnimAt = Time.realtimeSinceStartup;
			_skillOpen = false;
			_playersOpen = false;
			_choiceFor = null;
			_editFor = null;
		}

		private void SelectExtension(HighseatTab t)
		{
			LeaveExtension();
			_extId = t.Id;
			_tabAnimAt = Time.realtimeSinceStartup;
			_skillOpen = false;
			_playersOpen = false;
			try
			{
				t.OnSelected?.Invoke();
			}
			catch (Exception ex)
			{
				BreakTab(t, "OnSelected", ex);
			}
		}

		private void LeaveExtension()
		{
			if (_extId == null)
			{
				return;
			}
			HighseatTab highseatTab = HighseatTabs.Find(_extId);
			_extId = null;
			if (highseatTab == null)
			{
				return;
			}
			try
			{
				highseatTab.OnDeselected?.Invoke();
			}
			catch (Exception ex)
			{
				BreakTab(highseatTab, "OnDeselected", ex);
			}
		}

		internal static void ForgetBrokenTabs()
		{
			_brokenTabs.Clear();
		}

		private void DrawExtension(Rect r)
		{
			//IL_0043: 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)
			HighseatTab highseatTab = HighseatTabs.Find(_extId);
			if (highseatTab == null)
			{
				_extId = null;
				return;
			}
			if (_brokenTabs.Contains(highseatTab.Id))
			{
				GUI.Label(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 48f), highseatTab.Label + " stopped drawing after it threw. See the BepInEx log.", Theme.Dim);
				return;
			}
			try
			{
				highseatTab.Draw(r);
			}
			catch (Exception ex)
			{
				BreakTab(highseatTab, "Draw", ex);
			}
		}

		private static void BreakTab(HighseatTab t, string what, Exception ex)
		{
			if (_brokenTabs.Add(t.Id))
			{
				ManualLogSource log = HighseatPlugin.Log;
				if (log != null)
				{
					log.LogError((object)("Highseat: the '" + t.Label + "' tab threw from " + what + " and was disabled.\n" + ex));
				}
			}
		}

		private void DrawSpawn(Rect r)
		{
			//IL_0050: 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)
			//IL_00bc: 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_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: 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_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: 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)
			if (!Catalog.EnsureBuilt())
			{
				GUI.Label(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 24f), "Waiting for the world to finish loading.", Theme.Dim);
				return;
			}
			float y = ((Rect)(ref r)).y;
			GUI.Label(new Rect(((Rect)(ref r)).x, y, 220f, 18f), Theme.Spaced("Spawn"), Theme.Heading);
			Theme.Hairline(new Rect(((Rect)(ref r)).x + 90f, y + 9f, ((Rect)(ref r)).width - 90f - 130f, 1f));
			GUI.Label(new Rect(((Rect)(ref r)).xMax - 120f, y, 120f, 18f), _filtered.Count.ToString("N0", CultureInfo.InvariantCulture) + " results", Theme.SmallRight);
			y += 30f;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref r)).x, y, ((Rect)(ref r)).width * 0.46f, 34f);
			Theme.Fill(val, Theme.Carve);
			Theme.Fill(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).yMax - 1f, ((Rect)(ref val)).width, 1f), new Color(Theme.Brass.r, Theme.Brass.g, Theme.Brass.b, 0.45f));
			string text = GUI.TextField(val, _search, Theme.Search);
			if (text != _search)
			{
				_search = text;
				_filterDirty = true;
			}
			if (string.IsNullOrEmpty(_search))
			{
				GUI.Label(new Rect(((Rect)(ref val)).x + 12f, ((Rect)(ref val)).y, ((Rect)(ref val)).width, ((Rect)(ref val)).height), "search", Theme.MonoDim);
			}
			float x = ((Rect)(ref val)).xMax + 26f;
			x = Filter(x, y, CatalogCategory.Item, "Items");
			x = Filter(x, y, CatalogCategory.Creature, "Beasts");
			x = Filter(x, y, CatalogCategory.Piece, "Pieces");
			x = Filter(x, y, CatalogCategory.Other, "Other");
			Filter(x, y, CatalogCategory.All, "All");
			y += 44f;
			if (_category == CatalogCategory.Item)
			{
				float x2 = ((Rect)(ref r)).x;
				x2 = Kind(x2, y, ItemKind.All, "All");
				x2 = Kind(x2, y, ItemKind.Weapon, "Weapons");
				x2 = Kind(x2, y, ItemKind.Armor, "Armor");
				x2 = Kind(x2, y, ItemKind.Tool, "Tools");
				x2 = Kind(x2, y, ItemKind.Ammo, "Ammo");
				x2 = Kind(x2, y, ItemKind.Food, "Food");
				x2 = Kind(x2, y, ItemKind.Material, "Materials");
				x2 = Kind(x2, y, ItemKind.Trophy, "Trophies");
				Kind(x2, y, ItemKind.Other, "Other");
				y += 32f;
			}
			else
			{
				y += 6f;
			}
			RefreshFilterIfNeeded();
			Rect area = default(Rect);
			((Rect)(ref area))..ctor(((Rect)(ref r)).x, y, ((Rect)(ref r)).width, ((Rect)(ref r)).yMax - y);
			Color color = GUI.color;
			float num = Mathf.Clamp01((Time.realtimeSinceStartup - _gridAnimAt) / 0.17f);
			if (num < 1f)
			{
				float num2 = 1f - (1f - num) * (1f - num);
				GUI.color = new Color(1f, 1f, 1f, Mathf.Lerp(0.15f, 1f, num2));
				((Rect)(ref area)).y = ((Rect)(ref area)).y + (1f - num2) * 18f;
			}
			DrawGrid(area);
			GUI.color = color;
		}

		private float Filter(float x, float y, CatalogCategory category, string label)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0029: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			bool flag = _category == category;
			string text = Theme.Spaced(label);
			GUIStyle val = (flag ? Theme.LinkOn : Theme.Link);
			float x2 = val.CalcSize(new GUIContent(text)).x;
			float num = x2 - (float)(val.padding.left + val.padding.right);
			float num2 = x2 + 18f;
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(x, y + 2f, num2, 30f);
			if (flag)
			{
				Theme.Fill(new Rect(((Rect)(ref val2)).x + (num2 - num) * 0.5f, ((Rect)(ref val2)).yMax - 3f, num, 1f), Theme.BrassHi);
			}
			if (GUI.Button(val2, text, val) && !flag)
			{
				_category = category;
				_filterDirty = true;
				_gridAnimAt = Time.realtimeSinceStartup;
			}
			return x + num2 + 6f;
		}

		private float Kind(float x, float y, ItemKind kind, string label)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			bool flag = _kind == kind;
			GUIStyle val = (flag ? Theme.ChipOn : Theme.Chip);
			float x2 = val.CalcSize(new GUIContent(label)).x;
			float num = x2 - (float)(val.padding.left + val.padding.right);
			float num2 = x2 + 14f;
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(x, y, num2, 26f);
			if (flag)
			{
				Theme.Fill(new Rect(((Rect)(ref val2)).x + (num2 - num) * 0.5f, ((Rect)(ref val2)).yMax - 3f, num, 1f), new Color(Theme.Brass.r, Theme.Brass.g, Theme.Brass.b, 0.7f));
			}
			if (GUI.Button(val2, label, val) && !flag)
			{
				_kind = kind;
				_filterDirty = true;
				_gridAnimAt = Time.realtimeSinceStartup;
			}
			return x + num2 + 4f;
		}

		private void RefreshFilterIfNeeded()
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			if (_filterDirty || !(_search == _lastSearch) || _category != _lastCategory || _kind != _lastKind)
			{
				_filterDirty = false;
				_lastSearch = _search;
				_lastCategory = _category;
				_lastKind = _kind;
				Catalog.Filter(_search, _category, _kind, _filtered);
				_gridScroll = Vector2.zero;
			}
		}

		private void DrawGrid(Rect area)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//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_00c1: 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_00cc: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			if ((int)Event.current.type == 7)
			{
				_gridArea = area;
			}
			if (((Rect)(ref _gridArea)).width < 40f || ((Rect)(ref _gridArea)).height < 40f)
			{
				return;
			}
			int count = _filtered.Count;
			float num = Theme.ScrollbarV.fixedWidth + (float)Theme.ScrollbarV.margin.left;
			float num2 = ((Rect)(ref _gridArea)).width - num;
			int num3 = Mathf.Max(1, Mathf.FloorToInt(num2 / 96f));
			float num4 = num2 / (float)num3;
			int num5 = Mathf.CeilToInt((float)count / (float)num3);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(0f, 0f, num2, Mathf.Max((float)num5 * 92f, ((Rect)(ref _gridArea)).height));
			_gridScroll = GUI.BeginScrollView(_gridArea, _gridScroll, val, GUIStyle.none, Theme.ScrollbarV);
			if (count == 0)
			{
				GUI.Label(new Rect(0f, 10f, num2, 22f), "Nothing matches that search.", Theme.Dim);
			}
			int num6 = Mathf.Max(0, Mathf.FloorToInt(_gridScroll.y / 92f) - 1);
			int num7 = Mathf.Min(num5 - 1, num6 + Mathf.CeilToInt(((Rect)(ref _gridArea)).height / 92f) + 2);
			for (int i = num6; i <= num7; i++)
			{
				for (int j = 0; j < num3; j++)
				{
					int num8 = i * num3 + j;
					if (num8 >= count)
					{
						break;
					}
					DrawCell(new Rect((float)j * num4, (float)i * 92f, num4, 92f), _filtered[num8]);
				}
			}
			GUI.EndScrollView();
		}

		private void DrawCell(Rect rect, CatalogEntry entry)
		{
			//IL_0042: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref rect)).x + 3f, ((Rect)(ref rect)).y + 3f, ((Rect)(ref rect)).width - 6f, ((Rect)(ref rect)).height - 6f);
			bool flag = ((Rect)(ref val)).Contains(Event.current.mousePosition);
			if (flag)
			{
				Theme.Fill(val, new Color(Theme.StoneLit.r, Theme.StoneLit.g, Theme.StoneLit.b, 0.75f));
			}
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(((Rect)(ref val)).x + (((Rect)(ref val)).width - 44f) * 0.5f, ((Rect)(ref val)).y + 8f, 44f, 44f);
			if ((Object)(object)entry.Icon != (Object)null)
			{
				DrawSprite(val2, entry.Icon);
			}
			else
			{
				GUI.Label(val2, Glyph(entry.Category), Theme.Glyph);
			}
			GUI.Label(new Rect(((Rect)(ref val)).x + 2f, ((Rect)(ref val)).y + 44f + 12f, ((Rect)(ref val)).width - 4f, 30f), entry.Label, flag ? Theme.TileNameHot : Theme.TileName);
			if (flag)
			{
				Theme.Outline(val, new Color(Theme.Brass.r, Theme.Brass.g, Theme.Brass.b, 0.85f), 1f);
			}
			if (GUI.Button(val, new GUIContent(string.Empty, entry.Tip), Theme.Blank))
			{
				Run("spawn " + entry.Name + " " + _amount + " " + _level);
			}
		}

		private static string Glyph(CatalogCategory c)
		{
			return c switch
			{
				CatalogCategory.Creature => "●", 
				CatalogCategory.Piece => "■", 
				CatalogCategory.Item => "◆", 
				_ => "·", 
			};
		}

		private static void DrawSprite(Rect rect, Sprite sprite)
		{
			//IL_001a: 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_0068: 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)
			if ((Object)(object)sprite == (Object)null || (Object)(object)sprite.texture == (Object)null)
			{
				return;
			}
			try
			{
				Rect textureRect = sprite.textureRect;
				float num = ((Texture)sprite.texture).width;
				float num2 = ((Texture)sprite.texture).height;
				if (!(num <= 0f) && !(num2 <= 0f) && !(((Rect)(ref textureRect)).width <= 0f) && !(((Rect)(ref textureRect)).height <= 0f))
				{
					GUI.DrawTextureWithTexCoords(rect, (Texture)(object)sprite.texture, new Rect(((Rect)(ref textureRect)).x / num, ((Rect)(ref textureRect)).y / num2, ((Rect)(ref textureRect)).width / num, ((Rect)(ref textureRect)).height / num2), true);
				}
			}
			catch
			{
			}
		}

		private void DrawLog(Rect r)
		{
			//IL_001a: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: 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_0192: 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_0216: Expected O, but got Unknown
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: 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_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Expected O, but got Unknown
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Expected O, but got Unknown
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			Theme.Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, 1f, ((Rect)(ref r)).height), new Color(Theme.Brass.r, Theme.Brass.g, Theme.Brass.b, 0.35f));
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref r)).x + 16f, ((Rect)(ref r)).y, ((Rect)(ref r)).width - 16f, ((Rect)(ref r)).height);
			string text = Theme.Spaced("Log");
			float x = Theme.Heading.CalcSize(new GUIContent(text)).x;
			GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, x + 10f, 18f), text, Theme.Heading);
			Theme.Hairline(new Rect(((Rect)(ref val)).x + x + 14f, ((Rect)(ref val)).y + 9f, ((Rect)(ref val)).width - x - 20f, 1f));
			Rect r2 = default(Rect);
			((Rect)(ref r2))..ctor(((Rect)(ref val)).x, ((Rect)(ref val)).y + 26f, ((Rect)(ref val)).width - 6f, ((Rect)(ref val)).height - 26f - 80f);
			Theme.Fill(r2, new Color(Theme.Carve.r, Theme.Carve.g, Theme.Carve.b, 0.55f));
			Theme.Outline(r2, new Color(Theme.StoneLit.r, Theme.StoneLit.g, Theme.StoneLit.b, 0.6f), 1f);
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(((Rect)(ref r2)).x + 10f, ((Rect)(ref r2)).y + 8f, ((Rect)(ref r2)).width - 18f, ((Rect)(ref r2)).height - 16f);
			IList<string> snapshot = ConsoleMirror.Snapshot;
			float num = 0f;
			for (int i = 0; i < snapshot.Count; i++)
			{
				num += Theme.MonoDim.CalcHeight(new GUIContent(snapshot[i]), ((Rect)(ref val2)).width - 14f) + 2f;
			}
			if (ConsoleMirror.Revision != _seenRevision)
			{
				_seenRevision = ConsoleMirror.Revision;
				_logScroll.y = Mathf.Max(0f, num - ((Rect)(ref val2)).height);
			}
			_logScroll = GUI.BeginScrollView(val2, _logScroll, new Rect(0f, 0f, ((Rect)(ref val2)).width - 14f, Mathf.Max(num, ((Rect)(ref val2)).height)), GUIStyle.none, Theme.ScrollbarV);
			float num2 = 0f;
			for (int j = 0; j < snapshot.Count; j++)
			{
				string text2 = snapshot[j];
				float num3 = Theme.MonoDim.CalcHeight(new GUIContent(text2), ((Rect)(ref val2)).width - 14f) + 2f;
				GUIStyle val3 = new GUIStyle(text2.StartsWith("> ") ? Theme.MonoEcho : ((j == snapshot.Count - 1) ? Theme.Mono : Theme.MonoDim))
				{
					wordWrap = true,
					alignment = (TextAnchor)0
				};
				GUI.Label(new Rect(0f, num2, ((Rect)(ref val2)).width - 14f, num3), text2, val3);
				num2 += num3;
			}
			GUI.EndScrollView();
			DrawCommandLine(new Rect(((Rect)(ref val)).x, ((Rect)(ref r2)).yMax + 10f, ((Rect)(ref val)).width - 6f, 30f));
			if (GUI.Button(new Rect(((Rect)(ref val)).x, ((Rect)(ref r)).yMax - 34f, 96f, 26f), "Clear", Theme.BtnSmall))
			{
				ConsoleMirror.Clear();
			}
		}

		private vo