Decompiled source of Runemark v0.4.1

plugins/Runemark.dll

Decompiled 2 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GBV.Shared;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.UI;

[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.4.1.0")]
[assembly: AssemblyInformationalVersion("0.4.1+f2e998b8f0b1b5d8afc4312fe48a35a0495ee154")]
[assembly: AssemblyProduct("Runemark")]
[assembly: AssemblyTitle("Runemark")]
[assembly: AssemblyVersion("0.4.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);
		}
	}
	public class JsonException : Exception
	{
		public JsonException(string message)
			: base(message)
		{
		}
	}
	public sealed class JsonValue
	{
		public enum Kind
		{
			Null,
			Bool,
			Number,
			String,
			Array,
			Object
		}

		private bool _bool;

		private double _number;

		private bool _isFloat;

		private string _string;

		private List<JsonValue> _array;

		private Dictionary<string, JsonValue> _object;

		public static readonly JsonValue Null = new JsonValue
		{
			ValueKind = Kind.Null
		};

		private const int MaxDepth = 64;

		public Kind ValueKind { get; private set; }

		public bool IsNull => ValueKind == Kind.Null;

		public JsonValue this[string key]
		{
			get
			{
				if (ValueKind != Kind.Object)
				{
					return Null;
				}
				if (!_object.TryGetValue(key, out var value))
				{
					return Null;
				}
				return value;
			}
		}

		public JsonValue this[int index]
		{
			get
			{
				if (ValueKind != Kind.Array || index < 0 || index >= _array.Count)
				{
					return Null;
				}
				return _array[index];
			}
		}

		public int Count
		{
			get
			{
				if (ValueKind == Kind.Array)
				{
					return _array.Count;
				}
				if (ValueKind == Kind.Object)
				{
					return _object.Count;
				}
				return 0;
			}
		}

		public IEnumerable<KeyValuePair<string, JsonValue>> Members
		{
			get
			{
				if (ValueKind != Kind.Object)
				{
					return new KeyValuePair<string, JsonValue>[0];
				}
				return _object;
			}
		}

		public IEnumerable<JsonValue> Items
		{
			get
			{
				if (ValueKind != Kind.Array)
				{
					return new JsonValue[0];
				}
				return _array;
			}
		}

		private JsonValue()
		{
		}

		public static JsonValue Bool(bool v)
		{
			return new JsonValue
			{
				ValueKind = Kind.Bool,
				_bool = v
			};
		}

		public static JsonValue Number(double v)
		{
			return new JsonValue
			{
				ValueKind = Kind.Number,
				_number = v
			};
		}

		public static JsonValue Number(float v)
		{
			return new JsonValue
			{
				ValueKind = Kind.Number,
				_number = v,
				_isFloat = true
			};
		}

		public static JsonValue String(string v)
		{
			if (v != null)
			{
				return new JsonValue
				{
					ValueKind = Kind.String,
					_string = v
				};
			}
			return Null;
		}

		public static JsonValue NewArray()
		{
			return new JsonValue
			{
				ValueKind = Kind.Array,
				_array = new List<JsonValue>()
			};
		}

		public static JsonValue NewObject()
		{
			return new JsonValue
			{
				ValueKind = Kind.Object,
				_object = new Dictionary<string, JsonValue>(StringComparer.Ordinal)
			};
		}

		public JsonValue Add(JsonValue v)
		{
			if (ValueKind != Kind.Array)
			{
				throw new JsonException("Add called on a " + ValueKind);
			}
			_array.Add(v ?? Null);
			return this;
		}

		public JsonValue Set(string key, JsonValue v)
		{
			if (ValueKind != Kind.Object)
			{
				throw new JsonException("Set called on a " + ValueKind);
			}
			_object[key] = v ?? Null;
			return this;
		}

		public JsonValue Set(string key, string v)
		{
			return Set(key, String(v));
		}

		public JsonValue Set(string key, double v)
		{
			return Set(key, Number(v));
		}

		public JsonValue Set(string key, float v)
		{
			return Set(key, Number(v));
		}

		public JsonValue Set(string key, int v)
		{
			return Set(key, Number((double)v));
		}

		public JsonValue Set(string key, long v)
		{
			return Set(key, Number((double)v));
		}

		public JsonValue Set(string key, bool v)
		{
			return Set(key, Bool(v));
		}

		public string AsString(string fallback = null)
		{
			if (ValueKind != Kind.String)
			{
				return fallback;
			}
			return _string;
		}

		public double AsDouble(double fallback = 0.0)
		{
			if (ValueKind != Kind.Number)
			{
				return fallback;
			}
			return _number;
		}

		public float AsFloat(float fallback = 0f)
		{
			if (ValueKind != Kind.Number)
			{
				return fallback;
			}
			return (float)_number;
		}

		public int AsInt(int fallback = 0)
		{
			if (ValueKind != Kind.Number)
			{
				return fallback;
			}
			return (int)Math.Round(_number);
		}

		public long AsLong(long fallback = 0L)
		{
			if (ValueKind != Kind.Number)
			{
				return fallback;
			}
			return (long)Math.Round(_number);
		}

		public bool AsBool(bool fallback = false)
		{
			if (ValueKind != Kind.Bool)
			{
				return fallback;
			}
			return _bool;
		}

		public override string ToString()
		{
			StringBuilder stringBuilder = new StringBuilder();
			Write(stringBuilder, this, -1, 0);
			return stringBuilder.ToString();
		}

		public string ToPrettyString()
		{
			StringBuilder stringBuilder = new StringBuilder();
			Write(stringBuilder, this, 2, 0);
			return stringBuilder.ToString();
		}

		private static void Write(StringBuilder sb, JsonValue v, int indent, int depth)
		{
			bool flag = indent >= 0;
			switch (v.ValueKind)
			{
			case Kind.Null:
				sb.Append("null");
				break;
			case Kind.Bool:
				sb.Append(v._bool ? "true" : "false");
				break;
			case Kind.Number:
				WriteNumber(sb, v._number, v._isFloat);
				break;
			case Kind.String:
				WriteString(sb, v._string);
				break;
			case Kind.Array:
			{
				if (v._array.Count == 0)
				{
					sb.Append("[]");
					break;
				}
				sb.Append('[');
				for (int i = 0; i < v._array.Count; i++)
				{
					if (i > 0)
					{
						sb.Append(',');
					}
					if (flag)
					{
						NewLine(sb, indent, depth + 1);
					}
					Write(sb, v._array[i], indent, depth + 1);
				}
				if (flag)
				{
					NewLine(sb, indent, depth);
				}
				sb.Append(']');
				break;
			}
			case Kind.Object:
			{
				if (v._object.Count == 0)
				{
					sb.Append("{}");
					break;
				}
				sb.Append('{');
				bool flag2 = true;
				foreach (KeyValuePair<string, JsonValue> item in v._object)
				{
					if (!flag2)
					{
						sb.Append(',');
					}
					flag2 = false;
					if (flag)
					{
						NewLine(sb, indent, depth + 1);
					}
					WriteString(sb, item.Key);
					sb.Append(':');
					if (flag)
					{
						sb.Append(' ');
					}
					Write(sb, item.Value, indent, depth + 1);
				}
				if (flag)
				{
					NewLine(sb, indent, depth);
				}
				sb.Append('}');
				break;
			}
			}
		}

		private static void NewLine(StringBuilder sb, int indent, int depth)
		{
			sb.Append('\n');
			sb.Append(' ', indent * depth);
		}

		private static void WriteNumber(StringBuilder sb, double d, bool asFloat)
		{
			if (double.IsNaN(d) || double.IsInfinity(d))
			{
				sb.Append('0');
			}
			else
			{
				sb.Append(asFloat ? ((float)d).ToString("R", CultureInfo.InvariantCulture) : d.ToString("R", CultureInfo.InvariantCulture));
			}
		}

		private static void WriteString(StringBuilder sb, string s)
		{
			sb.Append('"');
			foreach (char c in s)
			{
				switch (c)
				{
				case '"':
					sb.Append("\\\"");
					continue;
				case '\\':
					sb.Append("\\\\");
					continue;
				case '\b':
					sb.Append("\\b");
					continue;
				case '\f':
					sb.Append("\\f");
					continue;
				case '\n':
					sb.Append("\\n");
					continue;
				case '\r':
					sb.Append("\\r");
					continue;
				case '\t':
					sb.Append("\\t");
					continue;
				}
				if (c < ' ')
				{
					StringBuilder stringBuilder = sb.Append("\\u");
					int num = c;
					stringBuilder.Append(num.ToString("x4", CultureInfo.InvariantCulture));
				}
				else
				{
					sb.Append(c);
				}
			}
			sb.Append('"');
		}

		public static JsonValue Parse(string text)
		{
			if (text == null)
			{
				throw new JsonException("Cannot parse null.");
			}
			int pos = 0;
			JsonValue result = ParseValue(text, ref pos, 0);
			SkipWhitespace(text, ref pos);
			if (pos != text.Length)
			{
				throw new JsonException("Trailing content at offset " + pos + ".");
			}
			return result;
		}

		public static JsonValue TryParse(string text)
		{
			try
			{
				return Parse(text);
			}
			catch (JsonException)
			{
				return null;
			}
		}

		private static JsonValue ParseValue(string s, ref int pos, int depth)
		{
			if (depth > 64)
			{
				throw new JsonException("Nested too deeply.");
			}
			SkipWhitespace(s, ref pos);
			if (pos >= s.Length)
			{
				throw new JsonException("Unexpected end of input.");
			}
			switch (s[pos])
			{
			case '{':
				return ParseObject(s, ref pos, depth);
			case '[':
				return ParseArray(s, ref pos, depth);
			case '"':
				return String(ParseString(s, ref pos));
			case 't':
				Expect(s, ref pos, "true");
				return Bool(v: true);
			case 'f':
				Expect(s, ref pos, "false");
				return Bool(v: false);
			case 'n':
				Expect(s, ref pos, "null");
				return Null;
			default:
				return Number(ParseNumber(s, ref pos));
			}
		}

		private static JsonValue ParseObject(string s, ref int pos, int depth)
		{
			pos++;
			JsonValue jsonValue = NewObject();
			SkipWhitespace(s, ref pos);
			if (pos < s.Length && s[pos] == '}')
			{
				pos++;
				return jsonValue;
			}
			while (true)
			{
				SkipWhitespace(s, ref pos);
				if (pos >= s.Length || s[pos] != '"')
				{
					throw new JsonException("Expected a member name at offset " + pos + ".");
				}
				string key = ParseString(s, ref pos);
				SkipWhitespace(s, ref pos);
				if (pos >= s.Length || s[pos] != ':')
				{
					throw new JsonException("Expected ':' at offset " + pos + ".");
				}
				pos++;
				jsonValue._object[key] = ParseValue(s, ref pos, depth + 1);
				SkipWhitespace(s, ref pos);
				if (pos >= s.Length)
				{
					throw new JsonException("Unterminated object.");
				}
				if (s[pos] != ',')
				{
					break;
				}
				pos++;
			}
			if (s[pos] == '}')
			{
				pos++;
				return jsonValue;
			}
			throw new JsonException("Expected ',' or '}' at offset " + pos + ".");
		}

		private static JsonValue ParseArray(string s, ref int pos, int depth)
		{
			pos++;
			JsonValue jsonValue = NewArray();
			SkipWhitespace(s, ref pos);
			if (pos < s.Length && s[pos] == ']')
			{
				pos++;
				return jsonValue;
			}
			while (true)
			{
				jsonValue._array.Add(ParseValue(s, ref pos, depth + 1));
				SkipWhitespace(s, ref pos);
				if (pos >= s.Length)
				{
					throw new JsonException("Unterminated array.");
				}
				if (s[pos] != ',')
				{
					break;
				}
				pos++;
			}
			if (s[pos] == ']')
			{
				pos++;
				return jsonValue;
			}
			throw new JsonException("Expected ',' or ']' at offset " + pos + ".");
		}

		private static string ParseString(string s, ref int pos)
		{
			pos++;
			StringBuilder stringBuilder = new StringBuilder();
			while (pos < s.Length)
			{
				char c = s[pos++];
				switch (c)
				{
				case '"':
					return stringBuilder.ToString();
				default:
					stringBuilder.Append(c);
					break;
				case '\\':
				{
					if (pos >= s.Length)
					{
						throw new JsonException("Unterminated escape.");
					}
					char c2 = s[pos++];
					switch (c2)
					{
					case '"':
						stringBuilder.Append('"');
						break;
					case '\\':
						stringBuilder.Append('\\');
						break;
					case '/':
						stringBuilder.Append('/');
						break;
					case 'b':
						stringBuilder.Append('\b');
						break;
					case 'f':
						stringBuilder.Append('\f');
						break;
					case 'n':
						stringBuilder.Append('\n');
						break;
					case 'r':
						stringBuilder.Append('\r');
						break;
					case 't':
						stringBuilder.Append('\t');
						break;
					case 'u':
					{
						if (pos + 4 > s.Length)
						{
							throw new JsonException("Truncated \\u escape.");
						}
						if (!int.TryParse(s.Substring(pos, 4), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var result))
						{
							throw new JsonException("Bad \\u escape at offset " + pos + ".");
						}
						stringBuilder.Append((char)result);
						pos += 4;
						break;
					}
					default:
						throw new JsonException("Unknown escape '\\" + c2 + "' at offset " + (pos - 1) + ".");
					}
					break;
				}
				}
			}
			throw new JsonException("Unterminated string.");
		}

		private static double ParseNumber(string s, ref int pos)
		{
			int num = pos;
			if (pos < s.Length && (s[pos] == '-' || s[pos] == '+'))
			{
				pos++;
			}
			while (pos < s.Length)
			{
				char c = s[pos];
				if ((c < '0' || c > '9') && c != '.' && c != 'e' && c != 'E' && c != '-' && c != '+')
				{
					break;
				}
				pos++;
			}
			string text = s.Substring(num, pos - num);
			if (!double.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
			{
				throw new JsonException("Bad number '" + text + "' at offset " + num + ".");
			}
			return result;
		}

		private static void Expect(string s, ref int pos, string literal)
		{
			if (pos + literal.Length > s.Length || string.CompareOrdinal(s, pos, literal, 0, literal.Length) != 0)
			{
				throw new JsonException("Expected '" + literal + "' at offset " + pos + ".");
			}
			pos += literal.Length;
		}

		private static void SkipWhitespace(string s, ref int pos)
		{
			while (pos < s.Length)
			{
				switch (s[pos])
				{
				case '\t':
				case '\n':
				case '\r':
				case ' ':
					pos++;
					break;
				case '/':
					if (pos + 1 < s.Length && s[pos + 1] == '/')
					{
						pos += 2;
						while (pos < s.Length && s[pos] != '\n')
						{
							pos++;
						}
						break;
					}
					return;
				default:
					return;
				}
			}
		}
	}
}
namespace GBV.Runemark
{
	public enum AffixScope
	{
		Item,
		Player
	}
	public enum ItemStat
	{
		None,
		PhysicalDamagePercent,
		FireDamageFlat,
		FrostDamageFlat,
		LightningDamageFlat,
		PoisonDamageFlat,
		SpiritDamageFlat,
		ArmorFlat,
		DurabilityPercent,
		BlockPowerPercent,
		WeightPercent,
		DrawStaminaPercent,
		DrawEitrPercent,
		DeflectionPercent,
		ValuePercent,
		ReloadPercent
	}
	public enum PlayerStat
	{
		None,
		CarryWeightFlat,
		MoveSpeedPercent,
		HealthRegenPercent,
		StaminaRegenPercent,
		EitrRegenPercent,
		AttackStaminaPercent,
		BlockStaminaPercent,
		JumpStaminaPercent,
		StealthPercent,
		SwimSpeedPercent,
		ParryBonusPercent,
		StaggerResistPercent,
		JumpHeightPercent,
		DodgeStaminaPercent,
		RunStaminaPercent,
		SkillGainPercent,
		SwimStaminaPercent,
		SneakStaminaPercent,
		HomeStaminaPercent,
		FallDamagePercent,
		FallSpeedCap,
		ArmorPercent,
		AdrenalinePercent,
		HealthPerTick,
		FireDamagePercent,
		FrostDamagePercent,
		LightningDamagePercent,
		BackstabPercent,
		OwnSkillDamage,
		OwnSkillLevel,
		ResistFire,
		ResistFrost,
		ResistLightning,
		ResistPoison,
		SailingPower,
		TamingBoost
	}
	public enum AffixDisplay
	{
		Number,
		Percent,
		Resistance,
		Flag
	}
	[Flags]
	public enum ItemClass
	{
		None = 0,
		Weapon = 1,
		Shield = 2,
		Armor = 4,
		Tool = 8,
		Utility = 0x10,
		Any = 0x1F
	}
	public sealed class AffixDef
	{
		public string Key;

		public string Name;

		public string Description;

		public string Prefix;

		public string Suffix;

		public AffixScope Scope;

		public ItemStat Item;

		public PlayerStat Player;

		public ItemClass Allowed;

		public float Min;

		public float Max;

		public bool Percent;

		public AffixDisplay Display;

		public float Step;

		public float MaxTotal;

		public string Describe(float value)
		{
			return Display switch
			{
				AffixDisplay.Flag => Name, 
				AffixDisplay.Resistance => Name + " (" + ResistanceWord(value) + ")", 
				_ => Name + " " + (Percent ? ("+" + (value * 100f).ToString("0.#") + "%") : ("+" + value.ToString("0.#"))), 
			};
		}

		public static string ResistanceWord(float value)
		{
			int num = (int)Math.Round(value);
			if (num >= 3)
			{
				return "Very Resistant";
			}
			if (num >= 2)
			{
				return "Resistant";
			}
			return "Slightly Resistant";
		}
	}
	public static class Affixes
	{
		public static Dictionary<string, AffixDef> All = Defaults();

		public static Dictionary<string, AffixDef> Defaults()
		{
			List<AffixDef> obj = new List<AffixDef>
			{
				new AffixDef
				{
					Key = "keen",
					Name = "Keen",
					Description = "Raises blunt, slash and pierce damage.",
					Scope = AffixScope.Item,
					Item = ItemStat.PhysicalDamagePercent,
					Allowed = (ItemClass.Weapon | ItemClass.Tool),
					Min = 0.06f,
					Max = 0.3f,
					Percent = true,
					Step = 0.01f
				},
				new AffixDef
				{
					Key = "ember",
					Name = "Ember",
					Description = "Adds fire damage to every hit.",
					Scope = AffixScope.Item,
					Item = ItemStat.FireDamageFlat,
					Allowed = ItemClass.Weapon,
					Min = 4f,
					Max = 26f,
					Percent = false,
					Step = 1f
				},
				new AffixDef
				{
					Key = "rime",
					Name = "Rime",
					Description = "Adds frost damage, which also slows.",
					Scope = AffixScope.Item,
					Item = ItemStat.FrostDamageFlat,
					Allowed = ItemClass.Weapon,
					Min = 4f,
					Max = 26f,
					Percent = false,
					Step = 1f
				},
				new AffixDef
				{
					Key = "storm",
					Name = "Storm",
					Description = "Adds lightning damage to every hit.",
					Scope = AffixScope.Item,
					Item = ItemStat.LightningDamageFlat,
					Allowed = ItemClass.Weapon,
					Min = 4f,
					Max = 26f,
					Percent = false,
					Step = 1f
				},
				new AffixDef
				{
					Key = "venom",
					Name = "Venom",
					Description = "Adds poison damage over time.",
					Scope = AffixScope.Item,
					Item = ItemStat.PoisonDamageFlat,
					Allowed = ItemClass.Weapon,
					Min = 5f,
					Max = 30f,
					Percent = false,
					Step = 1f
				},
				new AffixDef
				{
					Key = "barrow",
					Name = "Barrow",
					Description = "Adds spirit damage. Undead only.",
					Scope = AffixScope.Item,
					Item = ItemStat.SpiritDamageFlat,
					Allowed = ItemClass.Weapon,
					Min = 4f,
					Max = 24f,
					Percent = false,
					Step = 1f
				},
				new AffixDef
				{
					Key = "warded",
					Name = "Warded",
					Description = "Raises this piece's armour.",
					Scope = AffixScope.Item,
					Item = ItemStat.ArmorFlat,
					Allowed = (ItemClass.Shield | ItemClass.Armor),
					Min = 1f,
					Max = 9f,
					Percent = false,
					Step = 1f
				},
				new AffixDef
				{
					Key = "bulwark",
					Name = "Bulwark",
					Description = "Blocks absorb more damage.",
					Scope = AffixScope.Item,
					Item = ItemStat.BlockPowerPercent,
					Allowed = ItemClass.Shield,
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f
				},
				new AffixDef
				{
					Key = "sturdy",
					Name = "Sturdy",
					Description = "Raises maximum durability.",
					Scope = AffixScope.Item,
					Item = ItemStat.DurabilityPercent,
					Allowed = ItemClass.Any,
					Min = 0.15f,
					Max = 0.8f,
					Percent = true,
					Step = 0.05f
				},
				new AffixDef
				{
					Key = "light",
					Name = "Light",
					Description = "This item weighs less.",
					Scope = AffixScope.Item,
					Item = ItemStat.WeightPercent,
					Allowed = ItemClass.Any,
					Min = 0.1f,
					Max = 0.45f,
					Percent = true,
					Step = 0.05f
				},
				new AffixDef
				{
					Key = "bearing",
					Name = "Bearing",
					Description = "Carry more before being encumbered.",
					Scope = AffixScope.Player,
					Player = PlayerStat.CarryWeightFlat,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 10f,
					Max = 60f,
					Percent = false,
					Step = 5f
				},
				new AffixDef
				{
					Key = "swift",
					Name = "Swift",
					Description = "Move faster on foot.",
					Scope = AffixScope.Player,
					Player = PlayerStat.MoveSpeedPercent,
					Allowed = ItemClass.Armor,
					Min = 0.02f,
					Max = 0.09f,
					Percent = true,
					Step = 0.01f
				},
				new AffixDef
				{
					Key = "mending",
					Name = "Mending",
					Description = "Health regenerates faster.",
					Scope = AffixScope.Player,
					Player = PlayerStat.HealthRegenPercent,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 0.05f,
					Max = 0.3f,
					Percent = true,
					Step = 0.05f
				},
				new AffixDef
				{
					Key = "tireless",
					Name = "Tireless",
					Description = "Stamina regenerates faster.",
					Scope = AffixScope.Player,
					Player = PlayerStat.StaminaRegenPercent,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 0.05f,
					Max = 0.3f,
					Percent = true,
					Step = 0.05f
				},
				new AffixDef
				{
					Key = "seidr",
					Name = "Seidr",
					Description = "Eitr regenerates faster.",
					Scope = AffixScope.Player,
					Player = PlayerStat.EitrRegenPercent,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 0.05f,
					Max = 0.3f,
					Percent = true,
					Step = 0.05f
				},
				new AffixDef
				{
					Key = "measured",
					Name = "Measured",
					Description = "Attacking costs less stamina.",
					Scope = AffixScope.Player,
					Player = PlayerStat.AttackStaminaPercent,
					Allowed = ItemClass.Weapon,
					Min = 0.05f,
					Max = 0.25f,
					Percent = true,
					Step = 0.05f
				},
				new AffixDef
				{
					Key = "braced",
					Name = "Braced",
					Description = "Blocking costs less stamina.",
					Scope = AffixScope.Player,
					Player = PlayerStat.BlockStaminaPercent,
					Allowed = ItemClass.Shield,
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f
				},
				new AffixDef
				{
					Key = "bounding",
					Name = "Bounding",
					Description = "Jumping costs less stamina.",
					Scope = AffixScope.Player,
					Player = PlayerStat.JumpStaminaPercent,
					Allowed = ItemClass.Armor,
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f
				},
				new AffixDef
				{
					Key = "shadowed",
					Name = "Shadowed",
					Description = "Harder to spot while sneaking.",
					Scope = AffixScope.Player,
					Player = PlayerStat.StealthPercent,
					Allowed = ItemClass.Armor,
					Min = 0.05f,
					Max = 0.25f,
					Percent = true,
					Step = 0.05f
				},
				new AffixDef
				{
					Key = "otter",
					Name = "Otter",
					Description = "Swim faster.",
					Scope = AffixScope.Player,
					Player = PlayerStat.SwimSpeedPercent,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 0.05f,
					Max = 0.25f,
					Percent = true,
					Step = 0.05f
				},
				new AffixDef
				{
					Key = "steady",
					Name = "Steady",
					Description = "Drawing costs less stamina.",
					Scope = AffixScope.Item,
					Item = ItemStat.DrawStaminaPercent,
					Allowed = ItemClass.Weapon,
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f
				},
				new AffixDef
				{
					Key = "whisper",
					Name = "Whispering",
					Description = "Drawing costs less eitr.",
					Scope = AffixScope.Item,
					Item = ItemStat.DrawEitrPercent,
					Allowed = ItemClass.Weapon,
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f
				},
				new AffixDef
				{
					Key = "repelling",
					Name = "Repelling",
					Description = "Blocked attackers are thrown back harder.",
					Scope = AffixScope.Item,
					Item = ItemStat.DeflectionPercent,
					Allowed = ItemClass.Shield,
					Min = 0.1f,
					Max = 0.5f,
					Percent = true,
					Step = 0.05f
				},
				new AffixDef
				{
					Key = "rebuke",
					Name = "Rebuke",
					Description = "Parries absorb more.",
					Scope = AffixScope.Player,
					Player = PlayerStat.ParryBonusPercent,
					Allowed = ItemClass.Shield,
					Min = 0.1f,
					Max = 0.45f,
					Percent = true,
					Step = 0.05f
				},
				new AffixDef
				{
					Key = "unmoved",
					Name = "Unmoved",
					Description = "Harder to stagger.",
					Scope = AffixScope.Player,
					Player = PlayerStat.StaggerResistPercent,
					Allowed = (ItemClass.Shield | ItemClass.Armor),
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f
				},
				new AffixDef
				{
					Key = "leaping",
					Name = "Leaping",
					Description = "Jump higher.",
					Scope = AffixScope.Player,
					Player = PlayerStat.JumpHeightPercent,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 0.05f,
					Max = 0.22f,
					Percent = true,
					Step = 0.01f
				},
				new AffixDef
				{
					Key = "nimble",
					Name = "Nimble",
					Description = "Dodging costs less stamina.",
					Scope = AffixScope.Player,
					Player = PlayerStat.DodgeStaminaPercent,
					Allowed = ItemClass.Armor,
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f
				},
				new AffixDef
				{
					Key = "strider",
					Name = "Longstrider",
					Description = "Running costs less stamina.",
					Scope = AffixScope.Player,
					Player = PlayerStat.RunStaminaPercent,
					Allowed = ItemClass.Armor,
					Min = 0.05f,
					Max = 0.25f,
					Percent = true,
					Step = 0.05f
				},
				new AffixDef
				{
					Key = "learned",
					Name = "Learned",
					Description = "All skills rise faster.",
					Scope = AffixScope.Player,
					Player = PlayerStat.SkillGainPercent,
					Allowed = ItemClass.Any,
					Min = 0.05f,
					Max = 0.3f,
					Percent = true,
					Step = 0.05f
				},
				new AffixDef
				{
					Key = "practiced",
					Name = "Practiced",
					Description = "Raises this weapon's own skill.",
					Scope = AffixScope.Player,
					Player = PlayerStat.OwnSkillLevel,
					Allowed = (ItemClass.Weapon | ItemClass.Tool),
					Min = 1f,
					Max = 4f,
					Display = AffixDisplay.Number,
					Step = 1f
				},
				new AffixDef
				{
					Key = "ashbound",
					Name = "Ashbound",
					Description = "Resists fire.",
					Scope = AffixScope.Player,
					Player = PlayerStat.ResistFire,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 1f,
					Max = 3f,
					Display = AffixDisplay.Resistance,
					Step = 1f
				},
				new AffixDef
				{
					Key = "winterborn",
					Name = "Winterborn",
					Description = "Resists frost.",
					Scope = AffixScope.Player,
					Player = PlayerStat.ResistFrost,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 1f,
					Max = 3f,
					Display = AffixDisplay.Resistance,
					Step = 1f
				},
				new AffixDef
				{
					Key = "grounded",
					Name = "Grounded",
					Description = "Resists lightning.",
					Scope = AffixScope.Player,
					Player = PlayerStat.ResistLightning,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 1f,
					Max = 3f,
					Display = AffixDisplay.Resistance,
					Step = 1f
				},
				new AffixDef
				{
					Key = "bloodless",
					Name = "Bloodless",
					Description = "Resists poison.",
					Scope = AffixScope.Player,
					Player = PlayerStat.ResistPoison,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 1f,
					Max = 3f,
					Display = AffixDisplay.Resistance,
					Step = 1f
				},
				new AffixDef
				{
					Key = "seafarer",
					Name = "Seafarer",
					Description = "The wind is always with your ship.",
					Scope = AffixScope.Player,
					Player = PlayerStat.SailingPower,
					Allowed = ItemClass.Utility,
					Min = 1f,
					Max = 1f,
					Display = AffixDisplay.Flag
				},
				new AffixDef
				{
					Key = "beastfriend",
					Name = "Beastfriend",
					Description = "Nearby animals tame faster.",
					Scope = AffixScope.Player,
					Player = PlayerStat.TamingBoost,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 1f,
					Max = 1f,
					Display = AffixDisplay.Flag
				},
				new AffixDef
				{
					Key = "prized",
					Name = "Prized",
					Description = "Worth more to a trader.",
					Scope = AffixScope.Item,
					Item = ItemStat.ValuePercent,
					Allowed = ItemClass.Any,
					Min = 0.15f,
					Max = 0.75f,
					Percent = true,
					Step = 0.05f
				},
				new AffixDef
				{
					Key = "swiftload",
					Name = "Swiftload",
					Description = "Reloads faster.",
					Scope = AffixScope.Item,
					Item = ItemStat.ReloadPercent,
					Allowed = ItemClass.Weapon,
					Min = 0.1f,
					Max = 0.4f,
					Percent = true,
					Step = 0.05f
				},
				new AffixDef
				{
					Key = "featherfall",
					Name = "Featherfall",
					Description = "Take less falling damage.",
					Scope = AffixScope.Player,
					Player = PlayerStat.FallDamagePercent,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 0.15f,
					Max = 0.6f,
					Percent = true,
					Step = 0.05f,
					MaxTotal = 0.9f
				},
				new AffixDef
				{
					Key = "drifting",
					Name = "Drifting",
					Description = "You fall more slowly.",
					Scope = AffixScope.Player,
					Player = PlayerStat.FallSpeedCap,
					Allowed = ItemClass.Utility,
					Min = 18f,
					Max = 30f,
					Display = AffixDisplay.Number,
					Step = 1f
				},
				new AffixDef
				{
					Key = "plated",
					Name = "Plated",
					Description = "Raises all your armour.",
					Scope = AffixScope.Player,
					Player = PlayerStat.ArmorPercent,
					Allowed = ItemClass.Armor,
					Min = 0.03f,
					Max = 0.12f,
					Percent = true,
					Step = 0.01f,
					MaxTotal = 0.35f
				},
				new AffixDef
				{
					Key = "tideborn",
					Name = "Tideborn",
					Description = "Swimming costs less stamina.",
					Scope = AffixScope.Player,
					Player = PlayerStat.SwimStaminaPercent,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f,
					MaxTotal = 0.8f
				},
				new AffixDef
				{
					Key = "padded",
					Name = "Padded",
					Description = "Sneaking costs less stamina.",
					Scope = AffixScope.Player,
					Player = PlayerStat.SneakStaminaPercent,
					Allowed = ItemClass.Armor,
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f,
					MaxTotal = 0.8f
				},
				new AffixDef
				{
					Key = "homesteader",
					Name = "Homesteader",
					Description = "Building and farming cost less stamina.",
					Scope = AffixScope.Player,
					Player = PlayerStat.HomeStaminaPercent,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 0.1f,
					Max = 0.4f,
					Percent = true,
					Step = 0.05f,
					MaxTotal = 0.8f
				},
				new AffixDef
				{
					Key = "furious",
					Name = "Furious",
					Description = "Adrenaline builds faster.",
					Scope = AffixScope.Player,
					Player = PlayerStat.AdrenalinePercent,
					Allowed = (ItemClass.Weapon | ItemClass.Armor),
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f,
					MaxTotal = 1f
				},
				new AffixDef
				{
					Key = "knitting",
					Name = "Knitting",
					Description = "Slowly heals you over time.",
					Scope = AffixScope.Player,
					Player = PlayerStat.HealthPerTick,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 0.25f,
					Max = 1.5f,
					Display = AffixDisplay.Number,
					Step = 0.25f,
					MaxTotal = 4f
				},
				new AffixDef
				{
					Key = "kindled",
					Name = "Kindled",
					Description = "All your fire damage is raised.",
					Scope = AffixScope.Player,
					Player = PlayerStat.FireDamagePercent,
					Allowed = (ItemClass.Weapon | ItemClass.Armor),
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f,
					MaxTotal = 0.75f
				},
				new AffixDef
				{
					Key = "hoarfrost",
					Name = "Hoarfrost",
					Description = "All your frost damage is raised.",
					Scope = AffixScope.Player,
					Player = PlayerStat.FrostDamagePercent,
					Allowed = (ItemClass.Weapon | ItemClass.Armor),
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f,
					MaxTotal = 0.75f
				},
				new AffixDef
				{
					Key = "thunderstruck",
					Name = "Thunderstruck",
					Description = "All your lightning damage is raised.",
					Scope = AffixScope.Player,
					Player = PlayerStat.LightningDamagePercent,
					Allowed = (ItemClass.Weapon | ItemClass.Armor),
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f,
					MaxTotal = 0.75f
				},
				new AffixDef
				{
					Key = "ambush",
					Name = "Ambush",
					Description = "Backstabs hit harder.",
					Scope = AffixScope.Player,
					Player = PlayerStat.BackstabPercent,
					Allowed = (ItemClass.Weapon | ItemClass.Armor),
					Min = 0.1f,
					Max = 0.4f,
					Percent = true,
					Step = 0.05f,
					MaxTotal = 1f
				},
				new AffixDef
				{
					Key = "honed",
					Name = "Honed",
					Description = "Raises damage with this weapon's own skill.",
					Scope = AffixScope.Player,
					Player = PlayerStat.OwnSkillDamage,
					Allowed = ItemClass.Weapon,
					Min = 0.05f,
					Max = 0.2f,
					Percent = true,
					Step = 0.01f,
					MaxTotal = 0.4f
				}
			};
			Dictionary<string, AffixDef> dictionary = new Dictionary<string, AffixDef>(StringComparer.Ordinal);
			foreach (AffixDef item in obj)
			{
				dictionary[item.Key] = item;
			}
			ApplyNames(dictionary);
			return dictionary;
		}

		private static void ApplyNames(Dictionary<string, AffixDef> map)
		{
			string[,] array = new string[51, 3]
			{
				{ "keen", "Keen", "of Edges" },
				{ "ember", "Burning", "of Embers" },
				{ "rime", "Rimed", "of Rime" },
				{ "storm", "Thundering", "of Storms" },
				{ "venom", "Venomous", "of Venom" },
				{ "barrow", "Barrowtouched", "of the Barrow" },
				{ "warded", "Warded", "of Warding" },
				{ "bulwark", "Shielding", "of the Bulwark" },
				{ "sturdy", "Sturdy", "of Endurance" },
				{ "light", "Light", "of Feathers" },
				{ "bearing", "Stout", "of Bearing" },
				{ "swift", "Swift", "of Swiftness" },
				{ "mending", "Mending", "of Mending" },
				{ "tireless", "Tireless", "of Vigour" },
				{ "seidr", "Witched", "of Seidr" },
				{ "measured", "Measured", "of Measure" },
				{ "braced", "Braced", "of Bracing" },
				{ "bounding", "Bounding", "of Bounding" },
				{ "shadowed", "Shadowed", "of Shadows" },
				{ "otter", "Sleek", "of the Otter" },
				{ "steady", "Steady", "of Steadiness" },
				{ "whisper", "Whispering", "of Whispers" },
				{ "repelling", "Repelling", "of Repelling" },
				{ "rebuke", "Rebuking", "of Rebuke" },
				{ "unmoved", "Unmoved", "of the Rooted" },
				{ "leaping", "Leaping", "of Leaping" },
				{ "nimble", "Nimble", "of Nimbleness" },
				{ "strider", "Striding", "of Long Strides" },
				{ "learned", "Learned", "of Learning" },
				{ "practiced", "Practiced", "of Practice" },
				{ "ashbound", "Ashbound", "of Ashes" },
				{ "winterborn", "Winterborn", "of Winter" },
				{ "grounded", "Grounded", "of Grounding" },
				{ "bloodless", "Bloodless", "of Cold Blood" },
				{ "seafarer", "Seafaring", "of Fair Winds" },
				{ "beastfriend", "Gentling", "of Beasts" },
				{ "prized", "Prized", "of Worth" },
				{ "swiftload", "Quickhanded", "of Quick Hands" },
				{ "featherfall", "Feathered", "of Featherfall" },
				{ "drifting", "Drifting", "of Drifting" },
				{ "plated", "Plated", "of the Plate" },
				{ "tideborn", "Tideborn", "of Tides" },
				{ "padded", "Padded", "of Soft Steps" },
				{ "homesteader", "Homesteading", "of the Homestead" },
				{ "furious", "Furious", "of Fury" },
				{ "knitting", "Knitting", "of Knitting" },
				{ "kindled", "Kindled", "of Kindling" },
				{ "hoarfrost", "Hoarfrost", "of Hoarfrost" },
				{ "thunderstruck", "Thunderstruck", "of Thunder" },
				{ "ambush", "Ambushing", "of Ambush" },
				{ "honed", "Honed", "of the Honed Edge" }
			};
			for (int i = 0; i < array.GetLength(0); i++)
			{
				if (map.TryGetValue(array[i, 0], out var value))
				{
					value.Prefix = array[i, 1];
					value.Suffix = array[i, 2];
				}
			}
			foreach (AffixDef value2 in map.Values)
			{
				if (string.IsNullOrEmpty(value2.Prefix) && string.IsNullOrEmpty(value2.Suffix))
				{
					ManualLogSource log = RunemarkPlugin.Log;
					if (log != null)
					{
						log.LogWarning((object)("Runemark: affix '" + value2.Key + "' has no prefix or suffix, so it will never show up in an item's name. Add it to the table in Affixes.ApplyNames."));
					}
				}
			}
		}

		public static string DecorateName(string baseName, MagicItem magic)
		{
			if (magic != null && magic.HasTitle)
			{
				return magic.Title;
			}
			if (magic?.Affixes == null || magic.Affixes.Count == 0)
			{
				return baseName;
			}
			string text = null;
			string text2 = null;
			int num = -1;
			for (int i = 0; i < magic.Affixes.Count; i++)
			{
				AffixDef affixDef = Get(magic.Affixes[i].Key);
				if (affixDef != null && !string.IsNullOrEmpty(affixDef.Prefix))
				{
					text = affixDef.Prefix;
					num = i;
					break;
				}
			}
			for (int j = 0; j < magic.Affixes.Count; j++)
			{
				if (j != num)
				{
					AffixDef affixDef2 = Get(magic.Affixes[j].Key);
					if (affixDef2 != null && !string.IsNullOrEmpty(affixDef2.Suffix))
					{
						text2 = affixDef2.Suffix;
						break;
					}
				}
			}
			string text3 = baseName;
			if (!string.IsNullOrEmpty(text))
			{
				text3 = text + " " + text3;
			}
			if (!string.IsNullOrEmpty(text2))
			{
				text3 = text3 + " " + text2;
			}
			return text3;
		}

		public static AffixDef Get(string key)
		{
			if (key == null)
			{
				return null;
			}
			if (!All.TryGetValue(key, out var value))
			{
				return null;
			}
			return value;
		}

		public static ItemClass ClassOf(ItemData item)
		{
			//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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected I4, but got Unknown
			if (item?.m_shared == null)
			{
				return ItemClass.None;
			}
			ItemType itemType = item.m_shared.m_itemType;
			switch (itemType - 3)
			{
			case 2:
				return ItemClass.Shield;
			case 3:
			case 4:
			case 8:
			case 9:
			case 14:
				return ItemClass.Armor;
			case 15:
			case 21:
				return ItemClass.Utility;
			case 16:
				return ItemClass.Tool;
			case 0:
			case 1:
			case 11:
			case 12:
			case 19:
				return ItemClass.Weapon;
			default:
				return ItemClass.None;
			}
		}

		public static List<AffixDef> CandidatesFor(ItemData item)
		{
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			List<AffixDef> list = new List<AffixDef>();
			ItemClass itemClass = ClassOf(item);
			if (itemClass == ItemClass.None)
			{
				return list;
			}
			foreach (AffixDef value in All.Values)
			{
				if ((value.Allowed & itemClass) != ItemClass.None && (value.Item != ItemStat.PhysicalDamagePercent || !(((DamageTypes)(ref item.m_shared.m_damages)).GetTotalPhysicalDamage() <= 0f)) && (value.Item != ItemStat.BlockPowerPercent || !(item.m_shared.m_blockPower <= 0f)) && (value.Item != ItemStat.ArmorFlat || !(item.m_shared.m_armor <= 0f) || itemClass == ItemClass.Shield) && (value.Item != ItemStat.DurabilityPercent || item.m_shared.m_useDurability) && (value.Item != ItemStat.WeightPercent || !(item.m_shared.m_weight <= 0f)) && (value.Item != ItemStat.DrawStaminaPercent || !(item.m_shared.m_attack.m_drawStaminaDrain <= 0f)) && (value.Item != ItemStat.DrawEitrPercent || !(item.m_shared.m_attack.m_drawEitrDrain <= 0f)) && (value.Item != ItemStat.DeflectionPercent || !(item.m_shared.m_deflectionForce <= 0f)) && ((value.Player != PlayerStat.OwnSkillLevel && value.Player != PlayerStat.OwnSkillDamage) || (int)item.m_shared.m_skillType != 0) && (value.Item != ItemStat.ReloadPercent || item.m_shared.m_attack.m_requiresReload) && (value.Item != ItemStat.ValuePercent || item.m_shared.m_value > 0))
				{
					list.Add(value);
				}
			}
			return list;
		}
	}
	public static class BorderArt
	{
		public struct Style
		{
			public float Thickness;

			public bool InnerLine;

			public float BracketLength;

			public float StudSize;

			public bool Ticks;

			public bool OuterRing;

			public float Glow;
		}

		public static Style StyleFor(int rarityIndex)
		{
			return new Style
			{
				Thickness = ((rarityIndex >= 1) ? 2.2f : 1.5f),
				InnerLine = (rarityIndex >= 1),
				BracketLength = ((rarityIndex >= 2) ? 22f : 0f),
				Ticks = (rarityIndex >= 3),
				StudSize = ((rarityIndex >= 4) ? 5f : 0f),
				OuterRing = (rarityIndex >= 4),
				Glow = ((rarityIndex >= 4) ? 0.75f : 0f)
			};
		}

		public static void Render(int size, int rarityIndex, float cr, float cg, float cb, float[] rgba)
		{
			Render(size, StyleFor(rarityIndex), cr, cg, cb, rgba);
		}

		public static void Render(int size, Style style, float cr, float cg, float cb, float[] rgba)
		{
			if (rgba == null || rgba.Length < size * size * 4)
			{
				throw new ArgumentException("rgba buffer is too small for " + size + "x" + size + ".");
			}
			float num = Lerp(cr, 1f, 0.25f);
			float num2 = Lerp(cg, 1f, 0.25f);
			float num3 = Lerp(cb, 1f, 0.25f);
			float cr2 = Lerp(cr, 1f, 0.55f);
			float cg2 = Lerp(cg, 1f, 0.55f);
			float cb2 = Lerp(cb, 1f, 0.55f);
			float num4 = (float)size * 0.5f;
			float num5 = num4 - 3f;
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num6 = (float)j + 0.5f - num4;
					float num7 = (float)i + 0.5f - num4;
					float rr = 0f;
					float gg = 0f;
					float bb = 0f;
					float aa = 0f;
					float num8 = RoundRectSdf(num6, num7, num5, num5, 2f);
					Add(ref rr, ref gg, ref bb, ref aa, num, num2, num3, Coverage(Abs(num8) - style.Thickness * 0.5f));
					if (style.BracketLength > 0f)
					{
						float num9 = style.BracketLength * 0.5f;
						float thickness = style.Thickness;
						float num10 = float.MaxValue;
						for (int k = -1; k <= 1; k += 2)
						{
							for (int l = -1; l <= 1; l += 2)
							{
								float num11 = BoxSdf(num6 - (float)k * (num5 - num9), num7 - (float)l * num5, num9, thickness);
								float num12 = BoxSdf(num6 - (float)k * num5, num7 - (float)l * (num5 - num9), thickness, num9);
								if (num11 < num10)
								{
									num10 = num11;
								}
								if (num12 < num10)
								{
									num10 = num12;
								}
							}
						}
						Add(ref rr, ref gg, ref bb, ref aa, num, num2, num3, Coverage(num10));
					}
					if (style.InnerLine)
					{
						float v = RoundRectSdf(num6, num7, num5 - 5f, num5 - 5f, 2f);
						Add(ref rr, ref gg, ref bb, ref aa, num * 0.75f, num2 * 0.75f, num3 * 0.75f, Coverage(Abs(v) - 0.55f) * 0.8f);
					}
					if (style.OuterRing)
					{
						float v2 = RoundRectSdf(num6, num7, num5 + 2.6f, num5 + 2.6f, 2f);
						Add(ref rr, ref gg, ref bb, ref aa, num, num2, num3, Coverage(Abs(v2) - 0.6f) * 0.85f);
					}
					if (style.StudSize > 0f)
					{
						float num13 = num5 - style.StudSize * 0.7f;
						float num14 = float.MaxValue;
						for (int m = -1; m <= 1; m += 2)
						{
							for (int n = -1; n <= 1; n += 2)
							{
								float num15 = DiamondSdf(num6 - (float)m * num13, num7 - (float)n * num13, style.StudSize);
								if (num15 < num14)
								{
									num14 = num15;
								}
							}
						}
						Add(ref rr, ref gg, ref bb, ref aa, cr2, cg2, cb2, Coverage(num14));
					}
					if (style.Ticks)
					{
						float a = BoxSdf(num6, num7 - num5, 4.5f, 4.2f);
						a = Min(a, BoxSdf(num6, num7 + num5, 4.5f, 4.2f));
						a = Min(a, BoxSdf(num6 - num5, num7, 4.2f, 4.5f));
						a = Min(a, BoxSdf(num6 + num5, num7, 4.2f, 4.5f));
						Add(ref rr, ref gg, ref bb, ref aa, cr2, cg2, cb2, Coverage(a));
					}
					if (style.Glow > 0f && num8 > 0f)
					{
						float num16 = Clamp01(1f - num8 / 9f);
						Add(ref rr, ref gg, ref bb, ref aa, cr, cg, cb, num16 * num16 * style.Glow * 0.6f);
					}
					int num17 = (i * size + j) * 4;
					rgba[num17] = rr;
					rgba[num17 + 1] = gg;
					rgba[num17 + 2] = bb;
					rgba[num17 + 3] = aa;
				}
			}
		}

		private static void Add(ref float rr, ref float gg, ref float bb, ref float aa, float cr, float cg, float cb, float coverage)
		{
			if (!(coverage <= 0f))
			{
				if (coverage > 1f)
				{
					coverage = 1f;
				}
				float num = Clamp01(aa + coverage);
				float t = coverage / Math.Max(num, 0.0001f);
				rr = Lerp(rr, cr, t);
				gg = Lerp(gg, cg, t);
				bb = Lerp(bb, cb, t);
				aa = num;
			}
		}

		public static float Coverage(float d)
		{
			return Clamp01(0.5f - d);
		}

		public static float RoundRectSdf(float x, float y, float hw, float hh, float r)
		{
			float val = Abs(x) - (hw - r);
			float num = Abs(y) - (hh - r);
			float num2 = Math.Max(val, 0f);
			float num3 = Math.Max(num, 0f);
			return (float)Math.Sqrt(num2 * num2 + num3 * num3) + Math.Min(Math.Max(val, num), 0f) - r;
		}

		public static float DiamondSdf(float x, float y, float size)
		{
			return (Abs(x) + Abs(y) - size) * 0.70710677f;
		}

		public static float BoxSdf(float x, float y, float hw, float hh)
		{
			return RoundRectSdf(x, y, hw, hh, 0f);
		}

		private static float Abs(float v)
		{
			if (!(v < 0f))
			{
				return v;
			}
			return 0f - v;
		}

		private static float Min(float a, float b)
		{
			if (!(a < b))
			{
				return b;
			}
			return a;
		}

		private static float Clamp01(float v)
		{
			if (!(v < 0f))
			{
				if (!(v > 1f))
				{
					return v;
				}
				return 1f;
			}
			return 0f;
		}

		private static float Lerp(float a, float b, float t)
		{
			return a + (b - a) * Clamp01(t);
		}
	}
	internal static class RarityBorders
	{
		private const int Size = 96;

		private const int SliceBorder = 28;

		private static readonly Dictionary<int, Sprite> Cache = new Dictionary<int, Sprite>();

		private static readonly Dictionary<int, Sprite> TooltipCache = new Dictionary<int, Sprite>();

		public static void Reset()
		{
			Drop(Cache);
			Drop(TooltipCache);
		}

		private static void Drop(Dictionary<int, Sprite> cache)
		{
			foreach (Sprite value in cache.Values)
			{
				if (!((Object)(object)value == (Object)null))
				{
					if ((Object)(object)value.texture != (Object)null)
					{
						Object.Destroy((Object)(object)value.texture);
					}
					Object.Destroy((Object)(object)value);
				}
			}
			cache.Clear();
		}

		public static Sprite For(int rarityIndex)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if (Cache.TryGetValue(rarityIndex, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			Sprite val = Build(rarityIndex, BorderArt.StyleFor(rarityIndex), Vector4.zero);
			Cache[rarityIndex] = val;
			return val;
		}

		public static Sprite ForTooltip(int rarityIndex)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (TooltipCache.TryGetValue(rarityIndex, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			BorderArt.Style style = BorderArt.StyleFor(rarityIndex);
			style.Ticks = false;
			Sprite val = Build(rarityIndex, style, new Vector4(28f, 28f, 28f, 28f));
			TooltipCache[rarityIndex] = val;
			return val;
		}

		private static Sprite Build(int rarityIndex, BorderArt.Style style, Vector4 border)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00e8: 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)
			Color val = BeamVisuals.ParseColor(Rarity.Get(rarityIndex).Color);
			Texture2D val2 = new Texture2D(96, 96, (TextureFormat)5, false)
			{
				name = "RunemarkBorder" + rarityIndex,
				filterMode = (FilterMode)1,
				wrapMode = (TextureWrapMode)1,
				hideFlags = (HideFlags)61
			};
			float[] array = new float[36864];
			BorderArt.Render(96, style, val.r, val.g, val.b, array);
			Color[] array2 = (Color[])(object)new Color[9216];
			for (int i = 0; i < array2.Length; i++)
			{
				int num = i * 4;
				array2[i] = new Color(array[num], array[num + 1], array[num + 2], array[num + 3]);
			}
			val2.SetPixels(array2);
			val2.Apply(false);
			Sprite obj = Sprite.Create(val2, new Rect(0f, 0f, 96f, 96f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, border);
			((Object)obj).hideFlags = (HideFlags)61;
			return obj;
		}
	}
	internal static class TooltipBorder
	{
		private static UITooltip _tagged;

		private static int _taggedRarity = -1;

		private static int _taggedFrame = -999;

		private static Image _image;

		private const int TagLifetimeFrames = 2;

		public static void Tag(UITooltip tooltip, int rarityIndex)
		{
			_tagged = tooltip;
			_taggedRarity = rarityIndex;
			_taggedFrame = Time.frameCount;
		}

		public static GameObject Shared()
		{
			try
			{
				return AccessTools.StaticFieldRefAccess<GameObject>(typeof(UITooltip), "m_tooltip");
			}
			catch
			{
				return null;
			}
		}

		public static void Apply(UITooltip instance, GameObject tooltipObject)
		{
			if ((Object)(object)tooltipObject == (Object)null)
			{
				return;
			}
			bool flag = Time.frameCount - _taggedFrame <= 2;
			if (!(RunemarkPlugin.Enabled.Value && RunemarkPlugin.TooltipBorders.Value && (Object)(object)instance == (Object)(object)_tagged && flag) || _taggedRarity < 0)
			{
				if ((Object)(object)_image != (Object)null)
				{
					((Behaviour)_image).enabled = false;
				}
			}
			else if (EnsureImage(tooltipObject))
			{
				_image.sprite = RarityBorders.ForTooltip(_taggedRarity);
				((Behaviour)_image).enabled = true;
			}
		}

		private static bool EnsureImage(GameObject tooltipObject)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_0083: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_image != (Object)null && ((Component)_image).transform.IsChildOf(tooltipObject.transform))
			{
				return true;
			}
			if (tooltipObject.transform.childCount == 0)
			{
				return false;
			}
			Transform child = tooltipObject.transform.GetChild(0);
			RectTransform val = (RectTransform)(object)((child is RectTransform) ? child : null);
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			GameObject val2 = new GameObject("RunemarkTooltipBorder", new Type[1] { typeof(RectTransform) });
			RectTransform val3 = (RectTransform)val2.transform;
			((Transform)val3).SetParent((Transform)(object)val, false);
			val2.AddComponent<LayoutElement>().ignoreLayout = true;
			val3.anchorMin = Vector2.zero;
			val3.anchorMax = Vector2.one;
			val3.offsetMin = new Vector2(-3f, -3f);
			val3.offsetMax = new Vector2(3f, 3f);
			((Transform)val3).localScale = Vector3.one;
			val3.pivot = new Vector2(0.5f, 0.5f);
			_image = val2.AddComponent<Image>();
			((Graphic)_image).raycastTarget = false;
			_image.type = (Type)1;
			_image.fillCenter = false;
			((Transform)val3).SetAsLastSibling();
			ret