Decompiled source of Runemark v0.5.2

plugins/Runemark.dll

Decompiled 2 months 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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GBV.Shared;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Splatform;
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.5.2.0")]
[assembly: AssemblyInformationalVersion("0.5.2+d41778de5e018764102615405b4022657af7f7a5")]
[assembly: AssemblyProduct("Runemark")]
[assembly: AssemblyTitle("Runemark")]
[assembly: AssemblyVersion("0.5.2.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 Title;

		public static GUIStyle Lead;

		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 BtnSmallOn;

		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_00b7: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: 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_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_0443: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: 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_0485: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0507: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: Unknown result type (might be due to invalid IL or missing references)
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_0520: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0534: 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_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_0577: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Expected O, but got Unknown
			//IL_058b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_0596: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05da: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_060e: Expected O, but got Unknown
			//IL_060e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0615: Unknown result type (might be due to invalid IL or missing references)
			//IL_061f: Expected O, but got Unknown
			//IL_061f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0624: Unknown result type (might be due to invalid IL or missing references)
			//IL_062e: Expected O, but got Unknown
			//IL_062e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0636: Unknown result type (might be due to invalid IL or missing references)
			//IL_0641: Unknown result type (might be due to invalid IL or missing references)
			//IL_064d: Expected O, but got Unknown
			//IL_0652: 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_065f: Unknown result type (might be due to invalid IL or missing references)
			//IL_066a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0671: Unknown result type (might be due to invalid IL or missing references)
			//IL_0676: Unknown result type (might be due to invalid IL or missing references)
			//IL_0680: Expected O, but got Unknown
			//IL_0685: Expected O, but got Unknown
			//IL_068a: Unknown result type (might be due to invalid IL or missing references)
			//IL_068f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0697: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b8: Expected O, but got Unknown
			//IL_06bd: Expected O, but got Unknown
			//IL_06c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_06da: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f2: Expected O, but got Unknown
			//IL_06f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fe: Expected O, but got Unknown
			//IL_0703: Unknown result type (might be due to invalid IL or missing references)
			//IL_0708: Unknown result type (might be due to invalid IL or missing references)
			//IL_0710: Unknown result type (might be due to invalid IL or missing references)
			//IL_071b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0722: Unknown result type (might be due to invalid IL or missing references)
			//IL_0727: Unknown result type (might be due to invalid IL or missing references)
			//IL_0731: Expected O, but got Unknown
			//IL_0736: Expected O, but got Unknown
			//IL_0740: Unknown result type (might be due to invalid IL or missing references)
			//IL_0754: Unknown result type (might be due to invalid IL or missing references)
			//IL_0768: Unknown result type (might be due to invalid IL or missing references)
			//IL_0786: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0807: Unknown result type (might be due to invalid IL or missing references)
			//IL_083f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0859: Unknown result type (might be due to invalid IL or missing references)
			//IL_0863: Expected O, but got Unknown
			//IL_086d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0872: Unknown result type (might be due to invalid IL or missing references)
			//IL_087d: Unknown result type (might be due to invalid IL or missing references)
			//IL_088c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0891: Unknown result type (might be due to invalid IL or missing references)
			//IL_089b: Expected O, but got Unknown
			//IL_089b: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b6: Expected O, but got Unknown
			//IL_08b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c5: Expected O, but got Unknown
			//IL_08ca: Expected O, but got Unknown
			//IL_08d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08df: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0903: Unknown result type (might be due to invalid IL or missing references)
			//IL_0909: Unknown result type (might be due to invalid IL or missing references)
			//IL_0918: Unknown result type (might be due to invalid IL or missing references)
			//IL_091d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0927: Expected O, but got Unknown
			//IL_0927: Unknown result type (might be due to invalid IL or missing references)
			//IL_0932: Unknown result type (might be due to invalid IL or missing references)
			//IL_0937: Unknown result type (might be due to invalid IL or missing references)
			//IL_0941: Expected O, but got Unknown
			//IL_0941: Unknown result type (might be due to invalid IL or missing references)
			//IL_0946: Unknown result type (might be due to invalid IL or missing references)
			//IL_0950: Expected O, but got Unknown
			//IL_0955: Expected O, but got Unknown
			//IL_09dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f0: 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(28, (FontStyle)1, TextHi);
				Title = Label(22, (FontStyle)1, TextHi);
				Lead = Label(17, (FontStyle)0, Text);
				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);
				BtnSmallOn = Plate(26, 3, Hex("312B18"), Hex("43391F"), Brass, Hex("3B3320"), Hex("4E4227"), BrassHi, Hex("2A2515"), Hex("352E1A"), BrassHi, TextHi, 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(StoneHi);
				val.hover.textColor = TextHi;
				val.focused.background = Solid(StoneLit);
				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;
				}
			}
		}
	}
	internal static class ChestLock
	{
		internal static readonly int KeyOwner = StringExtensionMethods.GetStableHashCode("gbv_andvari_lock_owner");

		internal static readonly int KeyName = StringExtensionMethods.GetStableHashCode("gbv_andvari_lock_name");

		internal static bool IsLocked(Container container)
		{
			return HeldBy(container) != 0;
		}

		internal static long HeldBy(Container container)
		{
			try
			{
				ZDO val = ZdoOf(container);
				return (val == null) ? 0 : val.GetLong(KeyOwner, 0L);
			}
			catch
			{
				return 0L;
			}
		}

		internal static string HeldByName(Container container)
		{
			try
			{
				ZDO val = ZdoOf(container);
				if (val == null || val.GetLong(KeyOwner, 0L) == 0L)
				{
					return "";
				}
				string text = val.GetString(KeyName, "");
				return string.IsNullOrEmpty(text) ? "somebody" : text;
			}
			catch
			{
				return "";
			}
		}

		internal static ZNetView ViewOf(Container container)
		{
			if ((Object)(object)container == (Object)null)
			{
				return null;
			}
			if (!((Object)(object)container.m_rootObjectOverride != (Object)null))
			{
				return ((Component)container).GetComponent<ZNetView>();
			}
			return container.m_rootObjectOverride;
		}

		private static ZDO ZdoOf(Container container)
		{
			ZNetView val = ViewOf(container);
			if ((Object)(object)val == (Object)null || !val.IsValid())
			{
				return null;
			}
			return val.GetZDO();
		}
	}
	internal static class BankLedger
	{
		internal const string Prefix = "gbv.hk.bank.";

		internal const long Ceiling = 1000000000000L;

		internal static string KeyFor(long worldUid, string prefabName)
		{
			if (string.IsNullOrEmpty(prefabName))
			{
				return null;
			}
			return "gbv.hk.bank." + worldUid.ToString(CultureInfo.InvariantCulture) + "." + prefabName;
		}

		internal static long Parse(string stored)
		{
			if (string.IsNullOrEmpty(stored))
			{
				return 0L;
			}
			if (!long.TryParse(stored, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result))
			{
				return 0L;
			}
			if (result <= 0)
			{
				return 0L;
			}
			if (result <= 1000000000000L)
			{
				return result;
			}
			return 1000000000000L;
		}

		internal static string Format(long balance)
		{
			if (balance <= 0)
			{
				return null;
			}
			return ((balance > 1000000000000L) ? 1000000000000L : balance).ToString(CultureInfo.InvariantCulture);
		}

		internal static long Room(long balance)
		{
			long num = ((balance < 0) ? 0 : balance);
			if (num < 1000000000000L)
			{
				return 1000000000000L - num;
			}
			return 0L;
		}

		internal static int Accepts(long balance, int wanted)
		{
			if (wanted <= 0)
			{
				return 0;
			}
			long num = Room(balance);
			if (num <= 0)
			{
				return 0;
			}
			if (num >= wanted)
			{
				return wanted;
			}
			return (int)num;
		}

		internal static long Credit(long balance, int amount)
		{
			long num = ((balance < 0) ? 0 : balance);
			if (amount <= 0)
			{
				return num;
			}
			long num2 = num + amount;
			if (num2 <= 1000000000000L)
			{
				return num2;
			}
			return 1000000000000L;
		}

		internal static int Grants(long balance, int wanted)
		{
			if (wanted <= 0)
			{
				return 0;
			}
			long num = ((balance < 0) ? 0 : balance);
			if (num <= 0)
			{
				return 0;
			}
			if (num >= wanted)
			{
				return wanted;
			}
			return (int)num;
		}

		internal static long Debit(long balance, int amount)
		{
			long num = ((balance < 0) ? 0 : balance);
			if (amount <= 0)
			{
				return num;
			}
			long num2 = num - amount;
			if (num2 > 0)
			{
				return num2;
			}
			return 0L;
		}

		internal static string Pretty(long balance)
		{
			if (balance <= 0)
			{
				return "0";
			}
			string text = balance.ToString(CultureInfo.InvariantCulture);
			if (text.Length <= 4)
			{
				return text;
			}
			StringBuilder stringBuilder = new StringBuilder(text.Length + text.Length / 3);
			int num = text.Length % 3;
			if (num == 0)
			{
				num = 3;
			}
			stringBuilder.Append(text, 0, num);
			for (int i = num; i < text.Length; i += 3)
			{
				stringBuilder.Append(' ').Append(text, i, 3);
			}
			return stringBuilder.ToString();
		}

		internal static bool IsBankKey(string key)
		{
			if (!string.IsNullOrEmpty(key))
			{
				return key.StartsWith("gbv.hk.bank.", StringComparison.Ordinal);
			}
			return false;
		}

		internal static string PrefabIn(string key)
		{
			if (!IsBankKey(key))
			{
				return null;
			}
			int num = key.IndexOf('.', "gbv.hk.bank.".Length);
			if (num < 0 || num + 1 >= key.Length)
			{
				return null;
			}
			return key.Substring(num + 1);
		}
	}
}
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,
		ChopDamageFlat,
		PickaxeDamageFlat,
		AttackEitrPercent,
		DurabilityDrainPercent,
		BuildRefundChance,
		BaneUndeadPercent,
		BaneBeastPercent,
		BaneBossPercent,
		LifestealPercent
	}
	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,
		PoisonDamagePercent,
		SpiritDamagePercent,
		BluntDamagePercent,
		SlashDamagePercent,
		PierceDamagePercent,
		BackstabPercent,
		OwnSkillDamage,
		WindMastery,
		HeatResistance,
		ReflectPercent,
		NeverWet,
		MistWard,
		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 Weight = 1f;

		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()
		{
			Dictionary<string, AffixDef> dictionary = new Dictionary<string, AffixDef>(StringComparer.Ordinal);
			foreach (AffixDef item in Table())
			{
				dictionary[item.Key] = item;
			}
			ApplyNames(dictionary);
			return dictionary;
		}

		public static List<AffixDef> Table()
		{
			return 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
				},
				new AffixDef
				{
					Key = "blighting",
					Name = "Blighting",
					Description = "All your poison damage is raised.",
					Scope = AffixScope.Player,
					Player = PlayerStat.PoisonDamagePercent,
					Allowed = (ItemClass.Weapon | ItemClass.Armor),
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f,
					MaxTotal = 0.75f
				},
				new AffixDef
				{
					Key = "hallowed",
					Name = "Hallowed",
					Description = "All your spirit damage is raised.",
					Scope = AffixScope.Player,
					Player = PlayerStat.SpiritDamagePercent,
					Allowed = (ItemClass.Weapon | ItemClass.Armor),
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f,
					MaxTotal = 0.75f
				},
				new AffixDef
				{
					Key = "crushing",
					Name = "Crushing",
					Description = "All your blunt damage is raised.",
					Scope = AffixScope.Player,
					Player = PlayerStat.BluntDamagePercent,
					Allowed = (ItemClass.Weapon | ItemClass.Armor),
					Min = 0.05f,
					Max = 0.22f,
					Percent = true,
					Step = 0.01f,
					MaxTotal = 0.5f
				},
				new AffixDef
				{
					Key = "cleaving",
					Name = "Cleaving",
					Description = "All your slashing damage is raised.",
					Scope = AffixScope.Player,
					Player = PlayerStat.SlashDamagePercent,
					Allowed = (ItemClass.Weapon | ItemClass.Armor),
					Min = 0.05f,
					Max = 0.22f,
					Percent = true,
					Step = 0.01f,
					MaxTotal = 0.5f
				},
				new AffixDef
				{
					Key = "piercing",
					Name = "Piercing",
					Description = "All your piercing damage is raised.",
					Scope = AffixScope.Player,
					Player = PlayerStat.PierceDamagePercent,
					Allowed = (ItemClass.Weapon | ItemClass.Armor),
					Min = 0.05f,
					Max = 0.22f,
					Percent = true,
					Step = 0.01f,
					MaxTotal = 0.5f
				},
				new AffixDef
				{
					Key = "windborne",
					Name = "Windborne",
					Description = "A following wind speeds you on.",
					Scope = AffixScope.Player,
					Player = PlayerStat.WindMastery,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 0.2f,
					Max = 0.75f,
					Percent = true,
					Step = 0.05f,
					MaxTotal = 1f
				},
				new AffixDef
				{
					Key = "emberproof",
					Name = "Emberproof",
					Description = "Ashlands heat builds more slowly.",
					Scope = AffixScope.Player,
					Player = PlayerStat.HeatResistance,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 0.04f,
					Max = 0.15f,
					Percent = true,
					Step = 0.01f,
					MaxTotal = 0.4f
				},
				new AffixDef
				{
					Key = "hewing",
					Name = "Hewing",
					Description = "Fells trees faster.",
					Scope = AffixScope.Item,
					Item = ItemStat.ChopDamageFlat,
					Allowed = (ItemClass.Weapon | ItemClass.Tool),
					Min = 5f,
					Max = 30f,
					Percent = false,
					Step = 1f
				},
				new AffixDef
				{
					Key = "delving",
					Name = "Delving",
					Description = "Breaks rock and ore faster.",
					Scope = AffixScope.Item,
					Item = ItemStat.PickaxeDamageFlat,
					Allowed = (ItemClass.Weapon | ItemClass.Tool),
					Min = 5f,
					Max = 30f,
					Percent = false,
					Step = 1f
				},
				new AffixDef
				{
					Key = "conduit",
					Name = "Conduit",
					Description = "This costs less eitr to use.",
					Scope = AffixScope.Item,
					Item = ItemStat.AttackEitrPercent,
					Allowed = ItemClass.Weapon,
					Min = 0.08f,
					Max = 0.35f,
					Percent = true,
					Step = 0.01f
				},
				new AffixDef
				{
					Key = "enduring",
					Name = "Enduring",
					Description = "This wears out more slowly.",
					Scope = AffixScope.Item,
					Item = ItemStat.DurabilityDrainPercent,
					Allowed = (ItemClass.Weapon | ItemClass.Tool),
					Min = 0.15f,
					Max = 0.6f,
					Percent = true,
					Step = 0.05f
				},
				new AffixDef
				{
					Key = "sparing",
					Name = "Sparing",
					Description = "Some pieces cost nothing to build.",
					Scope = AffixScope.Item,
					Item = ItemStat.BuildRefundChance,
					Allowed = ItemClass.Tool,
					Min = 0.04f,
					Max = 0.15f,
					Percent = true,
					Step = 0.01f,
					Weight = 0.6f
				},
				new AffixDef
				{
					Key = "draugrbane",
					Name = "Draugrbane",
					Description = "Hits the undead harder.",
					Scope = AffixScope.Item,
					Item = ItemStat.BaneUndeadPercent,
					Allowed = ItemClass.Weapon,
					Min = 0.1f,
					Max = 0.4f,
					Percent = true,
					Step = 0.05f,
					Weight = 0.5f
				},
				new AffixDef
				{
					Key = "beastbane",
					Name = "Beastbane",
					Description = "Hits beasts and forest kin harder.",
					Scope = AffixScope.Item,
					Item = ItemStat.BaneBeastPercent,
					Allowed = ItemClass.Weapon,
					Min = 0.1f,
					Max = 0.4f,
					Percent = true,
					Step = 0.05f,
					Weight = 0.5f
				},
				new AffixDef
				{
					Key = "jotunbane",
					Name = "Jotunbane",
					Description = "Hits bosses harder.",
					Scope = AffixScope.Item,
					Item = ItemStat.BaneBossPercent,
					Allowed = ItemClass.Weapon,
					Min = 0.15f,
					Max = 0.5f,
					Percent = true,
					Step = 0.05f,
					Weight = 0.3f
				},
				new AffixDef
				{
					Key = "thirsting",
					Name = "Thirsting",
					Description = "Drinks a little life from each hit.",
					Scope = AffixScope.Item,
					Item = ItemStat.LifestealPercent,
					Allowed = ItemClass.Weapon,
					Min = 0.01f,
					Max = 0.04f,
					Percent = true,
					Step = 0.01f,
					Weight = 0.35f
				},
				new AffixDef
				{
					Key = "bristling",
					Name = "Bristling",
					Description = "Attackers take a share back.",
					Scope = AffixScope.Player,
					Player = PlayerStat.ReflectPercent,
					Allowed = (ItemClass.Shield | ItemClass.Armor),
					Min = 0.05f,
					Max = 0.2f,
					Percent = true,
					Step = 0.01f,
					MaxTotal = 0.4f,
					Weight = 0.5f
				},
				new AffixDef
				{
					Key = "oilskin",
					Name = "Oilskin",
					Description = "The rain never soaks you.",
					Scope = AffixScope.Player,
					Player = PlayerStat.NeverWet,
					Allowed = (ItemClass.Armor | ItemClass.Utility),
					Min = 1f,
					Max = 1f,
					Display = AffixDisplay.Flag,
					Weight = 0.5f
				},
				new AffixDef
				{
					Key = "wisptouched",
					Name = "Wisptouched",
					Description = "Pushes back the mist.",
					Scope = AffixScope.Player,
					Player = PlayerStat.MistWard,
					Allowed = ItemClass.Utility,
					Min = 1f,
					Max = 1f,
					Display = AffixDisplay.Flag,
					Weight = 0.3f
				}
			};
		}

		private static void ApplyNames(Dictionary<string, AffixDef> map)
		{
			string[,] array = new string[70, 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" },
				{ "blighting", "Blighted", "of Blight" },
				{ "hallowed", "Consecrated", "of Hallowing" },
				{ "crushing", "Crushing", "of Crushing" },
				{ "cleaving", "Cleaving", "of Cleaving" },
				{ "piercing", "Piercing", "of Piercing" },
				{ "windborne", "Windborne", "of the Gale" },
				{ "emberproof", "Emberproof", "of Cinders" },
				{ "hewing", "Hewing", "of Hewing" },
				{ "delving", "Delving", "of Delving" },
				{ "conduit", "Channelled", "of the Conduit" },
				{ "enduring", "Enduring", "of Long Use" },
				{ "sparing", "Sparing", "of Thrift" },
				{ "draugrbane", "Draugrbane", "of the Barrow Wight" },
				{ "beastbane", "Beastbane", "of the Hunt" },
				{ "jotunbane", "Jotunbane", "of Giants" },
				{ "thirsting", "Thirsting", "of Thirst" },
				{ "bristling", "Bristling", "of Bristles" },
				{ "oilskin", "Oilskinned", "of Dry Cloth" },
				{ "wisptouched", "Wisptouched", "of the Wisp" }
			};
			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];
				}
			}
		}

		public static List<string> NamingGaps()
		{
			List<string> list = new List<string>();
			foreach (AffixDef value in All.Values)
			{
				if (string.IsNullOrEmpty(value.Prefix) && string.IsNullOrEmpty(value.Suffix))
				{
					list.Add(value.Key);
				}
			}
			list.Sort(StringComparer.Ordinal);
			return list;
		}

		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_0159: 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_sha