Decompiled source of ShipLootPlus OLD v1.0.2

Figgle.dll

Decompiled a year ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Drew Noakes")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright Drew Noakes 2017-2023")]
[assembly: AssemblyDescription("ASCII banner generation for .NET")]
[assembly: AssemblyFileVersion("0.5.1.0")]
[assembly: AssemblyInformationalVersion("0.5.1+83b4a47d24d50442e09efa6c4a0d9a32c68e3f4d")]
[assembly: AssemblyProduct("Figgle")]
[assembly: AssemblyTitle("Figgle")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/drewnoakes/figgle.git")]
[assembly: AssemblyVersion("0.5.1.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 Figgle
{
	public sealed class FiggleException : Exception
	{
		public FiggleException(string message)
			: base(message)
		{
		}
	}
	internal readonly struct Line
	{
		public string Content { get; }

		public byte SpaceBefore { get; }

		public byte SpaceAfter { get; }

		public char FrontChar
		{
			get
			{
				if (Content.Length != SpaceBefore)
				{
					return Content[SpaceBefore];
				}
				return ' ';
			}
		}

		public char BackChar
		{
			get
			{
				if (Content.Length != SpaceAfter)
				{
					return Content[Content.Length - SpaceAfter - 1];
				}
				return ' ';
			}
		}

		public Line(string content, byte spaceBefore, byte spaceAfter)
		{
			Content = content;
			SpaceBefore = spaceBefore;
			SpaceAfter = spaceAfter;
		}
	}
	internal sealed class FiggleCharacter
	{
		public IReadOnlyList<Line> Lines { get; }

		public FiggleCharacter(IReadOnlyList<Line> lines)
		{
			Lines = lines;
		}
	}
	public enum FiggleTextDirection
	{
		LeftToRight,
		RightToLeft
	}
	public sealed class FiggleFont
	{
		private readonly IReadOnlyList<FiggleCharacter> _requiredCharacters;

		private readonly IReadOnlyDictionary<int, FiggleCharacter> _sparseCharacters;

		private readonly char _hardBlank;

		private readonly int _smushMode;

		private const int SM_SMUSH = 128;

		private const int SM_KERN = 64;

		private const int SM_HARDBLANK = 32;

		private const int SM_BIGX = 16;

		private const int SM_PAIR = 8;

		private const int SM_HIERARCHY = 4;

		private const int SM_LOWLINE = 2;

		private const int SM_EQUAL = 1;

		private const int SM_FULLWIDTH = 0;

		public int Height { get; }

		public int Baseline { get; }

		public FiggleTextDirection Direction { get; }

		internal FiggleFont(IReadOnlyList<FiggleCharacter> requiredCharacters, IReadOnlyDictionary<int, FiggleCharacter> sparseCharacters, char hardBlank, int height, int baseline, FiggleTextDirection direction, int smushMode)
		{
			_requiredCharacters = requiredCharacters;
			_sparseCharacters = sparseCharacters;
			_hardBlank = hardBlank;
			_smushMode = smushMode;
			Height = height;
			Baseline = baseline;
			Direction = direction;
		}

		private FiggleCharacter GetCharacter(char c)
		{
			if (c < '\0' || c > 'ÿ')
			{
				_sparseCharacters.TryGetValue(c, out FiggleCharacter value);
				return value ?? _requiredCharacters[0];
			}
			return _requiredCharacters[c] ?? _requiredCharacters[0];
		}

		public bool Contains(char c)
		{
			if (c < '\0' || c > 'ÿ')
			{
				return _sparseCharacters.ContainsKey(c);
			}
			return _requiredCharacters[c] != null;
		}

		public string Render(string message, int? smushOverride = null)
		{
			int smush = smushOverride ?? _smushMode;
			List<StringBuilder> list = (from _ in Enumerable.Range(0, Height)
				select new StringBuilder()).ToList();
			FiggleCharacter figgleCharacter = null;
			foreach (char c in message)
			{
				FiggleCharacter character = GetCharacter(c);
				if (character == null)
				{
					continue;
				}
				int num = CalculateFitMove(figgleCharacter, character);
				for (int j = 0; j < Height; j++)
				{
					Line line = character.Lines[j];
					StringBuilder stringBuilder = list[j];
					if (num != 0)
					{
						int num2 = num;
						if (figgleCharacter != null)
						{
							byte spaceAfter = figgleCharacter.Lines[j].SpaceAfter;
							if (spaceAfter != 0)
							{
								int num3 = Math.Min(spaceAfter, num2);
								for (int k = 0; k < num3; k++)
								{
									if (stringBuilder[stringBuilder.Length - 1] != ' ')
									{
										break;
									}
									num2--;
									stringBuilder.Length--;
								}
							}
						}
						int num4 = stringBuilder.Length - 1;
						char l2 = stringBuilder[num4];
						stringBuilder.Append((num2 == 0) ? line.Content : line.Content.Substring(num2));
						if (num2 != 0 && stringBuilder.Length != 0 && character.Lines[j].Content.Length != 0)
						{
							char r2 = character.Lines[j].Content[num2 - 1];
							char c2 = TrySmush(l2, r2);
							if (c2 != 0 && num4 >= 0)
							{
								stringBuilder[num4] = c2;
							}
						}
					}
					else
					{
						stringBuilder.Append(line.Content);
					}
				}
				figgleCharacter = character;
			}
			StringBuilder stringBuilder2 = new StringBuilder();
			foreach (StringBuilder item in list)
			{
				stringBuilder2.AppendLine(item.Replace(_hardBlank, ' ').ToString());
			}
			return stringBuilder2.ToString();
			int CalculateFitMove(FiggleCharacter? l, FiggleCharacter r)
			{
				if (smush == 0)
				{
					return 0;
				}
				if (l == null)
				{
					return 0;
				}
				int num5 = int.MaxValue;
				for (int m = 0; m < Height; m++)
				{
					Line line2 = l.Lines[m];
					Line line3 = r.Lines[m];
					int num6 = line2.SpaceAfter + line3.SpaceBefore;
					if (TrySmush(line2.BackChar, line3.FrontChar) != 0)
					{
						num6++;
					}
					num6 = Math.Min(num6, line3.Content.Length);
					if (num6 < num5)
					{
						num5 = num6;
					}
				}
				return num5;
			}
			char TrySmush(char l, char r)
			{
				if (l == ' ')
				{
					return r;
				}
				if (r == ' ')
				{
					return l;
				}
				if ((_smushMode & 0x80) == 0)
				{
					return '\0';
				}
				if ((_smushMode & 0x3F) == 0)
				{
					if (l == _hardBlank)
					{
						return r;
					}
					if (r == _hardBlank)
					{
						return l;
					}
					if (Direction != 0)
					{
						return l;
					}
					return r;
				}
				if (((uint)_smushMode & 0x20u) != 0 && l == _hardBlank && r == _hardBlank)
				{
					return l;
				}
				if (l == _hardBlank && r == _hardBlank)
				{
					return '\0';
				}
				if (((uint)_smushMode & (true ? 1u : 0u)) != 0 && l == r)
				{
					return l;
				}
				if (((uint)_smushMode & 2u) != 0)
				{
					if (l == '_' && Enumerable.Contains("|/\\[]{}()<>", r))
					{
						return r;
					}
					if (r == '_' && Enumerable.Contains("|/\\[]{}()<>", l))
					{
						return l;
					}
				}
				if (((uint)_smushMode & 4u) != 0)
				{
					if (l == '|' && Enumerable.Contains("/\\[]{}()<>", r))
					{
						return r;
					}
					if (r == '|' && Enumerable.Contains("/\\[]{}()<>", l))
					{
						return l;
					}
					if (Enumerable.Contains("/\\", l) && Enumerable.Contains("[]{}()<>", r))
					{
						return r;
					}
					if (Enumerable.Contains("/\\", r) && Enumerable.Contains("[]{}()<>", l))
					{
						return l;
					}
					if (Enumerable.Contains("[]", l) && Enumerable.Contains("{}()<>", r))
					{
						return r;
					}
					if (Enumerable.Contains("[]", r) && Enumerable.Contains("{}()<>", l))
					{
						return l;
					}
					if (Enumerable.Contains("{}", l) && Enumerable.Contains("()<>", r))
					{
						return r;
					}
					if (Enumerable.Contains("{}", r) && Enumerable.Contains("()<>", l))
					{
						return l;
					}
					if (Enumerable.Contains("()", l) && Enumerable.Contains("<>", r))
					{
						return r;
					}
					if (Enumerable.Contains("()", r) && Enumerable.Contains("<>", l))
					{
						return l;
					}
				}
				if (((uint)_smushMode & 8u) != 0)
				{
					if (l == '[' && r == ']')
					{
						return '|';
					}
					if (r == '[' && l == ']')
					{
						return '|';
					}
					if (l == '{' && r == '}')
					{
						return '|';
					}
					if (r == '{' && l == '}')
					{
						return '|';
					}
					if (l == '(' && r == ')')
					{
						return '|';
					}
					if (r == '(' && l == ')')
					{
						return '|';
					}
				}
				if (((uint)_smushMode & 0x10u) != 0)
				{
					if (l == '/' && r == '\\')
					{
						return '|';
					}
					if (r == '/' && l == '\\')
					{
						return 'Y';
					}
					if (l == '>' && r == '<')
					{
						return 'X';
					}
				}
				return '\0';
			}
		}
	}
	public static class FiggleFontParser
	{
		private const int SM_SMUSH = 128;

		private const int SM_KERN = 64;

		private const int SM_FULLWIDTH = 0;

		private static readonly Regex _firstLinePattern = new Regex("^flf2                         # signature\r\n              a                             # always 'a'\r\n              (?<hardblank>.)               # any single character\r\n              \\s(?<height>\\d+)              # the number of rows, shared across all characters\r\n              \\s(?<baseline>\\d+)            # the number of rows from the top of the char to the baseline (excludes descenders)\r\n              \\s(\\d+)                       # the maximum width of character data in the file, including endmarks\r\n              \\s(?<layoutold>-?\\d+)         # layout settings (old format)\r\n              \\s(?<commentlinecount>\\d+)    # number of comment lines after first line, before first character\r\n              (\\s(?<direction>\\d+))?        # print direction (0 is left-to-right, 1 is right-to-left)\r\n              (\\s(?<layoutnew>\\d+))?        # layout settings (new format)\r\n              (\\s(\\d+))?                    # number of code-tagged (non-required) characters in the font, equal to total number of characters minus 102\r\n              (\\s|$)", RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace);

		public static FiggleFont Parse(Stream stream, StringPool? pool = null)
		{
			StringPool pool2 = pool;
			if (stream == null)
			{
				throw new ArgumentNullException("stream");
			}
			StreamReader reader = new StreamReader(stream);
			string text = reader.ReadLine();
			if (text == null)
			{
				throw new FiggleException("Font file is empty.");
			}
			Match match = _firstLinePattern.Match(text);
			if (!match.Success)
			{
				throw new FiggleException("Font file has invalid first line.");
			}
			char hardBlank = match.Groups["hardblank"].Value[0];
			int height = int.Parse(match.Groups["height"].Value);
			int baseline = int.Parse(match.Groups["baseline"].Value);
			int layoutOld = int.Parse(match.Groups["layoutold"].Value);
			int num = int.Parse(match.Groups["commentlinecount"].Value);
			Group group = match.Groups["layoutnew"];
			int smushMode = (group.Success ? int.Parse(group.Value) : UpgradeLayout());
			Group group2 = match.Groups["direction"];
			FiggleTextDirection direction = (group2.Success ? ((FiggleTextDirection)int.Parse(group2.Value)) : FiggleTextDirection.LeftToRight);
			for (int i = 0; i < num; i++)
			{
				reader.ReadLine();
			}
			if (pool2 == null)
			{
				pool2 = new StringPool();
			}
			FiggleCharacter[] array = new FiggleCharacter[256];
			for (int j = 32; j < 127; j++)
			{
				array[j] = ReadCharacter();
			}
			array[196] = ReadCharacter();
			array[214] = ReadCharacter();
			array[220] = ReadCharacter();
			array[228] = ReadCharacter();
			array[246] = ReadCharacter();
			array[252] = ReadCharacter();
			array[223] = ReadCharacter();
			Dictionary<int, FiggleCharacter> dictionary = new Dictionary<int, FiggleCharacter>();
			while (true)
			{
				string text2 = reader.ReadLine();
				if (text2 == null)
				{
					break;
				}
				if (!string.IsNullOrWhiteSpace(text2))
				{
					if (!ParseUtil.TryParse(text2, out var i2))
					{
						throw new FiggleException("Unsupported code-tagged character code string \"" + text2 + "\".");
					}
					if (i2 >= 0 && i2 < 256)
					{
						array[i2] = ReadCharacter();
					}
					else
					{
						dictionary[i2] = ReadCharacter();
					}
				}
			}
			return new FiggleFont(array, dictionary, hardBlank, height, baseline, direction, smushMode);
			static byte CountEolSpaces(string s)
			{
				byte b = 0;
				int num2 = s.Length - 1;
				while (num2 > 0 && s[num2] == ' ')
				{
					num2--;
					b++;
				}
				return b;
			}
			static byte CountSolSpaces(string s)
			{
				byte b2 = 0;
				while (b2 < s.Length && s[b2] == ' ')
				{
					b2++;
				}
				return b2;
			}
			FiggleCharacter ReadCharacter()
			{
				Line[] array2 = new Line[height];
				for (int k = 0; k < height; k++)
				{
					string text3 = reader.ReadLine();
					if (text3 == null)
					{
						throw new FiggleException("Unexpected EOF in Font file.");
					}
					char c = text3[text3.Length - 1];
					text3 = text3.TrimEnd(new char[1] { c });
					array2[k] = new Line(pool2.Pool(text3), CountSolSpaces(text3), CountEolSpaces(text3));
				}
				return new FiggleCharacter(array2);
			}
			int UpgradeLayout()
			{
				if (layoutOld == 0)
				{
					return 64;
				}
				if (layoutOld < 0)
				{
					return 0;
				}
				return (layoutOld & 0x1F) | 0x80;
			}
		}
	}
	public static class FiggleFonts
	{
		private static readonly ConcurrentDictionary<string, FiggleFont> _fontByName = new ConcurrentDictionary<string, FiggleFont>(StringComparer.Ordinal);

		private static readonly StringPool _stringPool = new StringPool();

		public static FiggleFont OneRow => GetByName("1row");

		public static FiggleFont ThreeD => GetByName("3-d");

		public static FiggleFont ThreeDDiagonal => GetByName("3d_diagonal");

		public static FiggleFont ThreeByFive => GetByName("3x5");

		public static FiggleFont FourMax => GetByName("4max");

		public static FiggleFont FiveLineOblique => GetByName("5lineoblique");

		public static FiggleFont Acrobatic => GetByName("acrobatic");

		public static FiggleFont Alligator => GetByName("alligator");

		public static FiggleFont Alligator2 => GetByName("alligator2");

		public static FiggleFont Alligator3 => GetByName("alligator3");

		public static FiggleFont Alpha => GetByName("alpha");

		public static FiggleFont Alphabet => GetByName("alphabet");

		public static FiggleFont Amc3Line => GetByName("amc3line");

		public static FiggleFont Amc3Liv1 => GetByName("amc3liv1");

		public static FiggleFont AmcAaa01 => GetByName("amcaaa01");

		public static FiggleFont AmcNeko => GetByName("amcneko");

		public static FiggleFont AmcRazor2 => GetByName("amcrazo2");

		public static FiggleFont AmcRazor => GetByName("amcrazor");

		public static FiggleFont AmcSlash => GetByName("amcslash");

		public static FiggleFont AmcSlder => GetByName("amcslder");

		public static FiggleFont AmcThin => GetByName("amcthin");

		public static FiggleFont AmcTubes => GetByName("amctubes");

		public static FiggleFont AmcUn1 => GetByName("amcun1");

		public static FiggleFont Arrows => GetByName("arrows");

		public static FiggleFont AsciiNewroman => GetByName("ascii_new_roman");

		public static FiggleFont Avatar => GetByName("avatar");

		public static FiggleFont B1FF => GetByName("B1FF");

		public static FiggleFont Banner => GetByName("banner");

		public static FiggleFont Banner3 => GetByName("banner3");

		public static FiggleFont Banner3D => GetByName("banner3-D");

		public static FiggleFont Banner4 => GetByName("banner4");

		public static FiggleFont BarbWire => GetByName("barbwire");

		public static FiggleFont Basic => GetByName("basic");

		public static FiggleFont Bear => GetByName("bear");

		public static FiggleFont Bell => GetByName("bell");

		public static FiggleFont Benjamin => GetByName("benjamin");

		public static FiggleFont Big => GetByName("big");

		public static FiggleFont BigChief => GetByName("bigchief");

		public static FiggleFont BigFig => GetByName("bigfig");

		public static FiggleFont Binary => GetByName("binary");

		public static FiggleFont Block => GetByName("block");

		public static FiggleFont Blocks => GetByName("blocks");

		public static FiggleFont Bolger => GetByName("bolger");

		public static FiggleFont Braced => GetByName("braced");

		public static FiggleFont Bright => GetByName("bright");

		public static FiggleFont Broadway => GetByName("broadway");

		public static FiggleFont BroadwayKB => GetByName("broadway_kb");

		public static FiggleFont Bubble => GetByName("bubble");

		public static FiggleFont Bulbhead => GetByName("bulbhead");

		public static FiggleFont Caligraphy2 => GetByName("calgphy2");

		public static FiggleFont Caligraphy => GetByName("caligraphy");

		public static FiggleFont Cards => GetByName("cards");

		public static FiggleFont CatWalk => GetByName("catwalk");

		public static FiggleFont Chiseled => GetByName("chiseled");

		public static FiggleFont Chunky => GetByName("chunky");

		public static FiggleFont Coinstak => GetByName("coinstak");

		public static FiggleFont Cola => GetByName("cola");

		public static FiggleFont Colossal => GetByName("colossal");

		public static FiggleFont Computer => GetByName("computer");

		public static FiggleFont Contessa => GetByName("contessa");

		public static FiggleFont Contrast => GetByName("contrast");

		public static FiggleFont Cosmic => GetByName("cosmic");

		public static FiggleFont Cosmike => GetByName("cosmike");

		public static FiggleFont Crawford => GetByName("crawford");

		public static FiggleFont Crazy => GetByName("crazy");

		public static FiggleFont Cricket => GetByName("cricket");

		public static FiggleFont Cursive => GetByName("cursive");

		public static FiggleFont CyberLarge => GetByName("cyberlarge");

		public static FiggleFont CyberMedium => GetByName("cybermedium");

		public static FiggleFont CyberSmall => GetByName("cybersmall");

		public static FiggleFont Cygnet => GetByName("cygnet");

		public static FiggleFont DANC4 => GetByName("DANC4");

		public static FiggleFont DancingFont => GetByName("dancingfont");

		public static FiggleFont Decimal => GetByName("decimal");

		public static FiggleFont DefLeppard => GetByName("defleppard");

		public static FiggleFont Diamond => GetByName("diamond");

		public static FiggleFont DietCola => GetByName("dietcola");

		public static FiggleFont Digital => GetByName("digital");

		public static FiggleFont Doh => GetByName("doh");

		public static FiggleFont Doom => GetByName("doom");

		public static FiggleFont DosRebel => GetByName("dosrebel");

		public static FiggleFont DotMatrix => GetByName("dotmatrix");

		public static FiggleFont Double => GetByName("double");

		public static FiggleFont DoubleShorts => GetByName("doubleshorts");

		public static FiggleFont DRPepper => GetByName("drpepper");

		public static FiggleFont DWhistled => GetByName("dwhistled");

		public static FiggleFont EftiChess => GetByName("eftichess");

		public static FiggleFont EftiFont => GetByName("eftifont");

		public static FiggleFont EftiPiti => GetByName("eftipiti");

		public static FiggleFont EftiRobot => GetByName("eftirobot");

		public static FiggleFont EftiItalic => GetByName("eftitalic");

		public static FiggleFont EftiWall => GetByName("eftiwall");

		public static FiggleFont EftiWater => GetByName("eftiwater");

		public static FiggleFont Epic => GetByName("epic");

		public static FiggleFont Fender => GetByName("fender");

		public static FiggleFont Filter => GetByName("filter");

		public static FiggleFont FireFontK => GetByName("fire_font-k");

		public static FiggleFont FireFontS => GetByName("fire_font-s");

		public static FiggleFont Flipped => GetByName("flipped");

		public static FiggleFont FlowerPower => GetByName("flowerpower");

		public static FiggleFont FourTops => GetByName("fourtops");

		public static FiggleFont Fraktur => GetByName("fraktur");

		public static FiggleFont FunFace => GetByName("funface");

		public static FiggleFont FunFaces => GetByName("funfaces");

		public static FiggleFont Fuzzy => GetByName("fuzzy");

		public static FiggleFont Georgia16 => GetByName("georgi16");

		public static FiggleFont Georgia11 => GetByName("Georgia11");

		public static FiggleFont Ghost => GetByName("ghost");

		public static FiggleFont Ghoulish => GetByName("ghoulish");

		public static FiggleFont Glenyn => GetByName("glenyn");

		public static FiggleFont Goofy => GetByName("goofy");

		public static FiggleFont Gothic => GetByName("gothic");

		public static FiggleFont Graceful => GetByName("graceful");

		public static FiggleFont Gradient => GetByName("gradient");

		public static FiggleFont Graffiti => GetByName("graffiti");

		public static FiggleFont Greek => GetByName("greek");

		public static FiggleFont HeartLeft => GetByName("heart_left");

		public static FiggleFont HeartRight => GetByName("heart_right");

		public static FiggleFont Henry3d => GetByName("henry3d");

		public static FiggleFont Hex => GetByName("hex");

		public static FiggleFont Hieroglyphs => GetByName("hieroglyphs");

		public static FiggleFont Hollywood => GetByName("hollywood");

		public static FiggleFont HorizontalLeft => GetByName("horizontalleft");

		public static FiggleFont HorizontalRight => GetByName("horizontalright");

		public static FiggleFont ICL1900 => GetByName("ICL-1900");

		public static FiggleFont Impossible => GetByName("impossible");

		public static FiggleFont Invita => GetByName("invita");

		public static FiggleFont Isometric1 => GetByName("isometric1");

		public static FiggleFont Isometric2 => GetByName("isometric2");

		public static FiggleFont Isometric3 => GetByName("isometric3");

		public static FiggleFont Isometric4 => GetByName("isometric4");

		public static FiggleFont Italic => GetByName("italic");

		public static FiggleFont Ivrit => GetByName("ivrit");

		public static FiggleFont Jacky => GetByName("jacky");

		public static FiggleFont Jazmine => GetByName("jazmine");

		public static FiggleFont Jerusalem => GetByName("jerusalem");

		public static FiggleFont Katakana => GetByName("katakana");

		public static FiggleFont Kban => GetByName("kban");

		public static FiggleFont Keyboard => GetByName("keyboard");

		public static FiggleFont Knob => GetByName("knob");

		public static FiggleFont Konto => GetByName("konto");

		public static FiggleFont KontoSlant => GetByName("kontoslant");

		public static FiggleFont Larry3d => GetByName("larry3d");

		public static FiggleFont Lcd => GetByName("lcd");

		public static FiggleFont Lean => GetByName("lean");

		public static FiggleFont Letters => GetByName("letters");

		public static FiggleFont LilDevil => GetByName("lildevil");

		public static FiggleFont LineBlocks => GetByName("lineblocks");

		public static FiggleFont Linux => GetByName("linux");

		public static FiggleFont LockerGnome => GetByName("lockergnome");

		public static FiggleFont Madrid => GetByName("madrid");

		public static FiggleFont Marquee => GetByName("marquee");

		public static FiggleFont MaxFour => GetByName("maxfour");

		public static FiggleFont Merlin1 => GetByName("merlin1");

		public static FiggleFont Merlin2 => GetByName("merlin2");

		public static FiggleFont Mike => GetByName("mike");

		public static FiggleFont Mini => GetByName("mini");

		public static FiggleFont Mirror => GetByName("mirror");

		public static FiggleFont Mnemonic => GetByName("mnemonic");

		public static FiggleFont Modular => GetByName("modular");

		public static FiggleFont Morse => GetByName("morse");

		public static FiggleFont Morse2 => GetByName("morse2");

		public static FiggleFont Moscow => GetByName("moscow");

		public static FiggleFont Mshebrew210 => GetByName("mshebrew210");

		public static FiggleFont Muzzle => GetByName("muzzle");

		public static FiggleFont NancyJ => GetByName("nancyj");

		public static FiggleFont NancyJFancy => GetByName("nancyj-fancy");

		public static FiggleFont NancyJImproved => GetByName("nancyj-improved");

		public static FiggleFont NancyJUnderlined => GetByName("nancyj-underlined");

		public static FiggleFont Nipples => GetByName("nipples");

		public static FiggleFont NScript => GetByName("nscript");

		public static FiggleFont NTGreek => GetByName("ntgreek");

		public static FiggleFont NVScript => GetByName("nvscript");

		public static FiggleFont O8 => GetByName("o8");

		public static FiggleFont Octal => GetByName("octal");

		public static FiggleFont Ogre => GetByName("ogre");

		public static FiggleFont OldBanner => GetByName("oldbanner");

		public static FiggleFont OS2 => GetByName("os2");

		public static FiggleFont Pawp => GetByName("pawp");

		public static FiggleFont Peaks => GetByName("peaks");

		public static FiggleFont PeaksSlant => GetByName("peaksslant");

		public static FiggleFont Pebbles => GetByName("pebbles");

		public static FiggleFont Pepper => GetByName("pepper");

		public static FiggleFont Poison => GetByName("poison");

		public static FiggleFont Puffy => GetByName("puffy");

		public static FiggleFont Puzzle => GetByName("puzzle");

		public static FiggleFont Pyramid => GetByName("pyramid");

		public static FiggleFont Rammstein => GetByName("rammstein");

		public static FiggleFont Rectangles => GetByName("rectangles");

		public static FiggleFont RedPhoenix => GetByName("red_phoenix");

		public static FiggleFont Relief => GetByName("relief");

		public static FiggleFont Relief2 => GetByName("relief2");

		public static FiggleFont Rev => GetByName("rev");

		public static FiggleFont Reverse => GetByName("reverse");

		public static FiggleFont Roman => GetByName("roman");

		public static FiggleFont Rot13 => GetByName("rot13");

		public static FiggleFont Rotated => GetByName("rotated");

		public static FiggleFont Rounded => GetByName("rounded");

		public static FiggleFont RowanCap => GetByName("rowancap");

		public static FiggleFont Rozzo => GetByName("rozzo");

		public static FiggleFont Runic => GetByName("runic");

		public static FiggleFont Runyc => GetByName("runyc");

		public static FiggleFont SantaClara => GetByName("santaclara");

		public static FiggleFont SBlood => GetByName("sblood");

		public static FiggleFont Script => GetByName("script");

		public static FiggleFont ScriptSlant => GetByName("slscript");

		public static FiggleFont SerifCap => GetByName("serifcap");

		public static FiggleFont Shadow => GetByName("shadow");

		public static FiggleFont Shimrod => GetByName("shimrod");

		public static FiggleFont Short => GetByName("short");

		public static FiggleFont Slant => GetByName("slant");

		public static FiggleFont Slide => GetByName("slide");

		public static FiggleFont Small => GetByName("small");

		public static FiggleFont SmallCaps => GetByName("smallcaps");

		public static FiggleFont IsometricSmall => GetByName("smisome1");

		public static FiggleFont KeyboardSmall => GetByName("smkeyboard");

		public static FiggleFont PoisonSmall => GetByName("smpoison");

		public static FiggleFont ScriptSmall => GetByName("smscript");

		public static FiggleFont ShadowSmall => GetByName("smshadow");

		public static FiggleFont SlantSmall => GetByName("smslant");

		public static FiggleFont TengwarSmall => GetByName("smtengwar");

		public static FiggleFont Soft => GetByName("soft");

		public static FiggleFont Speed => GetByName("speed");

		public static FiggleFont Spliff => GetByName("spliff");

		public static FiggleFont SRelief => GetByName("s-relief");

		public static FiggleFont Stacey => GetByName("stacey");

		public static FiggleFont Stampate => GetByName("stampate");

		public static FiggleFont Stampatello => GetByName("stampatello");

		public static FiggleFont Standard => GetByName("standard");

		public static FiggleFont Starstrips => GetByName("starstrips");

		public static FiggleFont Starwars => GetByName("starwars");

		public static FiggleFont Stellar => GetByName("stellar");

		public static FiggleFont Stforek => GetByName("stforek");

		public static FiggleFont Stop => GetByName("stop");

		public static FiggleFont Straight => GetByName("straight");

		public static FiggleFont SubZero => GetByName("sub-zero");

		public static FiggleFont Swampland => GetByName("swampland");

		public static FiggleFont Swan => GetByName("swan");

		public static FiggleFont Sweet => GetByName("sweet");

		public static FiggleFont Tanja => GetByName("tanja");

		public static FiggleFont Tengwar => GetByName("tengwar");

		public static FiggleFont Term => GetByName("term");

		public static FiggleFont Test1 => GetByName("test1");

		public static FiggleFont Thick => GetByName("thick");

		public static FiggleFont Thin => GetByName("thin");

		public static FiggleFont ThreePoint => GetByName("threepoint");

		public static FiggleFont Ticks => GetByName("ticks");

		public static FiggleFont TicksSlant => GetByName("ticksslant");

		public static FiggleFont Tiles => GetByName("tiles");

		public static FiggleFont TinkerToy => GetByName("tinker-toy");

		public static FiggleFont Tombstone => GetByName("tombstone");

		public static FiggleFont Train => GetByName("train");

		public static FiggleFont Trek => GetByName("trek");

		public static FiggleFont Tsalagi => GetByName("tsalagi");

		public static FiggleFont Tubular => GetByName("tubular");

		public static FiggleFont Twisted => GetByName("twisted");

		public static FiggleFont TwoPoint => GetByName("twopoint");

		public static FiggleFont Univers => GetByName("univers");

		public static FiggleFont UsaFlag => GetByName("usaflag");

		public static FiggleFont Varsity => GetByName("varsity");

		public static FiggleFont Wavy => GetByName("wavy");

		public static FiggleFont Weird => GetByName("weird");

		public static FiggleFont WetLetter => GetByName("wetletter");

		public static FiggleFont Whimsy => GetByName("whimsy");

		public static FiggleFont Wow => GetByName("wow");

		private static FiggleFont GetByName(string name)
		{
			return _fontByName.GetOrAdd(name, FontFactory);
			static FiggleFont FontFactory(string name)
			{
				return ParseEmbeddedFont(name) ?? throw new FiggleException("No embedded font exists with name \"" + name + "\".");
			}
		}

		public static FiggleFont? TryGetByName(string name)
		{
			if (_fontByName.TryGetValue(name, out FiggleFont value))
			{
				return value;
			}
			value = ParseEmbeddedFont(name);
			if (value != null)
			{
				_fontByName.TryAdd(name, value);
			}
			return value;
		}

		private static FiggleFont? ParseEmbeddedFont(string name)
		{
			using Stream stream = typeof(FiggleFonts).GetTypeInfo().Assembly.GetManifestResourceStream("Figgle.Fonts.zip");
			if (stream == null)
			{
				throw new FiggleException("Unable to open embedded font archive.");
			}
			using ZipArchive zipArchive = new ZipArchive(stream, ZipArchiveMode.Read);
			ZipArchiveEntry entry = zipArchive.GetEntry(name + ".flf");
			if (entry == null)
			{
				return null;
			}
			using Stream stream2 = entry.Open();
			return FiggleFontParser.Parse(stream2, _stringPool);
		}
	}
	internal static class ParseUtil
	{
		public static bool TryParse(string s, out int i)
		{
			int num = 0;
			int num2 = 0;
			bool flag = false;
			foreach (char c in s)
			{
				switch (num)
				{
				case 0:
				case 1:
					switch (c)
					{
					case '0':
						num = 2;
						break;
					case '-':
						if (num == 0)
						{
							flag = true;
							num = 1;
							break;
						}
						i = 0;
						return false;
					default:
						if (char.IsDigit(c))
						{
							num2 = c - 48;
							num = 3;
						}
						else if (num != 0 || !char.IsWhiteSpace(c))
						{
							i = 0;
							return false;
						}
						break;
					}
					break;
				case 2:
					switch (c)
					{
					case 'X':
					case 'h':
					case 'x':
						num = 5;
						break;
					case ' ':
						i = 0;
						return true;
					default:
						if (char.IsDigit(c))
						{
							num2 = c - 48;
							num = 4;
							break;
						}
						i = 0;
						return false;
					}
					break;
				case 3:
					if (char.IsDigit(c))
					{
						num2 *= 10;
						num2 += c - 48;
						break;
					}
					if (char.IsWhiteSpace(c))
					{
						i = (flag ? (-num2) : num2);
						return true;
					}
					i = 0;
					return false;
				case 4:
				{
					int num5 = c - 48;
					if (num5 >= 0 && num5 < 8)
					{
						num2 *= 8;
						num2 += num5;
						break;
					}
					if (char.IsWhiteSpace(c))
					{
						i = (flag ? (-num2) : num2);
						return true;
					}
					i = 0;
					return false;
				}
				case 5:
				case 6:
				{
					if (c >= '0' && c <= '9')
					{
						num = 6;
						int num3 = c - 48;
						num2 *= 16;
						num2 += num3;
						break;
					}
					char c2 = char.ToLower(c);
					if (c2 >= 'a' && c <= 'f')
					{
						num = 6;
						int num4 = c2 - 97 + 10;
						num2 *= 16;
						num2 += num4;
						break;
					}
					if (num == 6 && char.IsWhiteSpace(c))
					{
						i = (flag ? (-num2) : num2);
						return true;
					}
					i = 0;
					return false;
				}
				}
			}
			switch (num)
			{
			case 3:
			case 4:
			case 6:
				i = (flag ? (-num2) : num2);
				return true;
			case 2:
				i = 0;
				return true;
			default:
				i = 0;
				return false;
			}
		}
	}
	public sealed class StringPool
	{
		private readonly Dictionary<string, string> _pool = new Dictionary<string, string>(StringComparer.Ordinal);

		public string Pool(string s)
		{
			lock (_pool)
			{
				if (_pool.TryGetValue(s, out string value))
				{
					return value;
				}
				_pool[s] = s;
				return s;
			}
		}
	}
}

ShipLootPlus.dll

Decompiled a year ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Figgle;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using ShipLootPlus.Utils;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ShipLootPlus")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShipLootPlus")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5b20d4e7-b524-4818-877d-931940d78212")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace ShipLootPlus
{
	public class PluginMetadata
	{
		public const string Author = "PXC";

		public const string Name = "ShipLootPlus";

		public const string Id = "PXC.ShipLootPlus";

		public const string Version = "1.0.0";

		public string FullName => string.Format("{0} v{1}", "ShipLootPlus", "1.0.0");
	}
	[BepInPlugin("PXC.ShipLootPlus", "ShipLootPlus", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ShipLootPlus : BaseUnityPlugin
	{
		public enum ElementLocation
		{
			Top,
			Middle,
			Bottom
		}

		public static PluginMetadata pluginMetadata = new PluginMetadata();

		public static ManualLogSource Log = new ManualLogSource("PXC.ShipLootPlus");

		public static ShipLootPlus Instance;

		public static Dictionary<string, int> UiElements = new Dictionary<string, int>();

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)string.Format("Initializing plugin: {0} by {1}", pluginMetadata.FullName, "PXC"));
			if (LoadOriginal() != null)
			{
				Log.LogInfo((object)"");
				Log.LogInfo((object)"");
				Log.LogError((object)">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
				Log.LogError((object)("Original ShipLoot has been detected - Disabing " + pluginMetadata.FullName + "..."));
				Log.LogWarning((object)("If you want to use " + pluginMetadata.FullName + " please disable the original ShipLoot!"));
				Log.LogError((object)"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
				Log.LogInfo((object)"");
				Log.LogInfo((object)"");
				Log.LogInfo((object)string.Format("Unloaded plugin: {0} by {1}", pluginMetadata.FullName, "PXC"));
			}
			else
			{
				Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "PXC.ShipLootPlus");
				ConfigSettings.Initialize(((BaseUnityPlugin)this).Config, "Shows ShipLoot, Quota, and Days left information on the scan HUD");
				Log.LogInfo((object)$"Loaded!\n{FiggleFonts.Doom.Render(pluginMetadata.FullName, (int?)null)}");
			}
		}

		private static Assembly LoadOriginal()
		{
			try
			{
				Assembly assembly = AppDomain.CurrentDomain.Load("ShipLoot");
				Log.LogInfo((object)$"Found Original ShipLoot: {assembly}");
				return assembly;
			}
			catch (FileNotFoundException)
			{
				return null;
			}
		}
	}
}
namespace ShipLootPlus.Utils
{
	public class ConfigSettings
	{
		public static ConfigEntry<bool> AllowOutside;

		public static ConfigEntry<bool> AllCaps;

		public static ConfigEntry<string> LineColor;

		public static ConfigEntry<bool> ShowShipLoot;

		public static ConfigEntry<ShipLootPlus.ElementLocation> ShipLootPosition;

		public static ConfigEntry<string> ShipLootColor;

		public static ConfigEntry<string> ShipLootFormat;

		public static ConfigEntry<bool> ShowQuota;

		public static ConfigEntry<ShipLootPlus.ElementLocation> QuotaPosition;

		public static ConfigEntry<string> QuotaColor;

		public static ConfigEntry<string> QuotaFormat;

		public static ConfigEntry<bool> ShowDays;

		public static ConfigEntry<ShipLootPlus.ElementLocation> DaysPosition;

		public static ConfigEntry<string> DaysColor;

		public static ConfigEntry<string> DaysFormat;

		public static void Initialize(ConfigFile config, string description)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Expected O, but got Unknown
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Expected O, but got Unknown
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Expected O, but got Unknown
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Expected O, but got Unknown
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Expected O, but got Unknown
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Expected O, but got Unknown
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Expected O, but got Unknown
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Expected O, but got Unknown
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Expected O, but got Unknown
			LethalConfigManager.SetModDescription(description);
			string text = "General";
			AllowOutside = config.Bind<bool>(text, "Allow Outside", false, "Should the scanner hud be shown when scanning outside the ship?");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(AllowOutside, false));
			AllCaps = config.Bind<bool>(text, "All Caps", false, "Should text be in all caps?");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(AllCaps, false));
			LineColor = config.Bind<string>(text, "Line Color", "2D5122", "Line color (hex code)");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(LineColor, true));
			text = "Ship Loot";
			ShowShipLoot = config.Bind<bool>(text, "Show", true, "Shows the " + text + " on the scan hud");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(ShowShipLoot, true));
			ShipLootPosition = config.Bind<ShipLootPlus.ElementLocation>(text, "Position", ShipLootPlus.ElementLocation.Top, "This is where the " + text + " information is positioned on the HUD (IMPORTANT! Must not be the same as the other two)");
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<ShipLootPlus.ElementLocation>(ShipLootPosition, new EnumDropDownOptions
			{
				RequiresRestart = true
			}));
			ShipLootColor = config.Bind<string>(text, "Color", "19D56C", text + " text color (hex code)");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(ShipLootColor, true));
			ShipLootFormat = config.Bind<string>(text, "Format", "Ship: %LootValue%", text + " text format (%LootValue% = Loot value on the ship)");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(ShipLootFormat, true));
			text = "Quota";
			ShowQuota = config.Bind<bool>(text, "Show", true, "Shows the " + text + " on the scan hud");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(ShowQuota, true));
			QuotaPosition = config.Bind<ShipLootPlus.ElementLocation>(text, "Position", ShipLootPlus.ElementLocation.Middle, "This is where the " + text + " information is positioned on the HUD (IMPORTANT! Must not be the same as the other two)");
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<ShipLootPlus.ElementLocation>(QuotaPosition, new EnumDropDownOptions
			{
				RequiresRestart = true
			}));
			QuotaColor = config.Bind<string>(text, "Color", "19D56C", text + " text color (hex code)");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(QuotaColor, true));
			QuotaFormat = config.Bind<string>(text, "Format", "Quota: %FulfilledValue%/%QuotaValue%", text + " text format (%FulfilledValue% = Value turned in for the quota. %QuotaValue% = Full value of the current quota)");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(QuotaFormat, true));
			text = "Days Left";
			ShowDays = config.Bind<bool>(text, "Show", true, "Shows the " + text + " on the scan hud");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(ShowDays, true));
			DaysPosition = config.Bind<ShipLootPlus.ElementLocation>(text, "Position", ShipLootPlus.ElementLocation.Bottom, "This is where the " + text + " information is positioned on the HUD (IMPORTANT! Must not be the same as the other two)");
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<ShipLootPlus.ElementLocation>(DaysPosition, new EnumDropDownOptions
			{
				RequiresRestart = true
			}));
			DaysColor = config.Bind<string>(text, "Color", "19D56C", text + " text color (hex code)");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(DaysColor, true));
			DaysFormat = config.Bind<string>(text, "Format", "Days Left: %DaysLeft%", text + " text format (%DaysLeft% = Days left to turn in quota)");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(DaysFormat, true));
		}
	}
}
namespace ShipLootPlus.Patches
{
	[HarmonyPatch]
	internal class HudManagerPatcher
	{
		private static float timeLeftDisplay;

		private const float DisplayTime = 5f;

		public static List<ShipLootPlusItem> UiElementList { get; set; }

		private static List<string> ItemsToIgnore { get; set; }

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "PingScan_performed")]
		private static void OnScan(HUDManager __instance, CallbackContext context)
		{
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || !((CallbackContext)(ref context)).performed || !__instance.CanPlayerScan() || __instance.playerPingingScan > -0.5f || (!ConfigSettings.AllowOutside.Value && !StartOfRound.Instance.inShipPhase && !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom))
			{
				return;
			}
			ItemsToIgnore = new List<string> { "ClipboardManual", "StickyNoteItem" };
			if (UiElementList == null)
			{
				UiElementList = LoadObjectList();
			}
			if (UiElementList.Any((ShipLootPlusItem e) => (Object)(object)e.gameOjbect == (Object)null))
			{
				CreateUiElements();
			}
			if (UiElementList.Count == 3)
			{
				foreach (ShipLootPlusItem item in UiElementList.Where((ShipLootPlusItem t) => (Object)(object)t.textMeshProUGui != (Object)null))
				{
					((TMP_Text)item.textMeshProUGui).fontSize = 18f;
				}
			}
			else if (UiElementList.Count == 2)
			{
				foreach (ShipLootPlusItem item2 in UiElementList.Where((ShipLootPlusItem t) => (Object)(object)t.textMeshProUGui != (Object)null))
				{
					((TMP_Text)item2.textMeshProUGui).fontSize = 23f;
				}
			}
			float num = CalculateLootValue(ItemsToIgnore);
			TimeOfDay instance = TimeOfDay.Instance;
			Dictionary<string, string> substitutions = new Dictionary<string, string>
			{
				{
					"%LootValue%",
					num.ToString("F0")
				},
				{
					"%FulfilledValue%",
					instance.quotaFulfilled.ToString()
				},
				{
					"%QuotaValue%",
					instance.profitQuota.ToString()
				},
				{
					"%DaysLeft%",
					instance.daysUntilDeadline.ToString()
				}
			};
			foreach (ShipLootPlusItem item3 in UiElementList.Where((ShipLootPlusItem e) => e.ShowText))
			{
				string text = ExpandVariables(item3.format, substitutions);
				((TMP_Text)item3.textMeshProUGui).text = text;
				if (ConfigSettings.AllCaps.Value)
				{
					((TMP_Text)item3.textMeshProUGui).text = ((TMP_Text)item3.textMeshProUGui).text.ToUpper();
				}
			}
			timeLeftDisplay = 5f;
			if (UiElementList.Any((ShipLootPlusItem e) => !e.gameOjbect.activeSelf))
			{
				((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(DisplayDataCoroutine());
			}
		}

		public static string ExpandVariables(string format, Dictionary<string, string> Substitutions = null)
		{
			string text = format;
			if (Substitutions != null)
			{
				foreach (KeyValuePair<string, string> Substitution in Substitutions)
				{
					string pattern = Regex.Escape(Substitution.Key);
					text = Regex.Replace(text, pattern, Substitution.Value, RegexOptions.IgnoreCase);
				}
			}
			return text;
		}

		private static List<ShipLootPlusItem> LoadObjectList()
		{
			//IL_0026: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			List<ShipLootPlusItem> list = new List<ShipLootPlusItem>
			{
				new ShipLootPlusItem
				{
					Name = "Line",
					color = ConvertHexColor(ConfigSettings.LineColor.Value, 0.75f),
					ShowImg = true,
					ShowText = false,
					Enabled = true,
					OffsetX = 60f,
					OffsetY = -54.5f
				}
			};
			if (ConfigSettings.ShowShipLoot.Value)
			{
				list.Add(new ShipLootPlusItem
				{
					Location = ConfigSettings.ShipLootPosition.Value,
					color = ConvertHexColor(ConfigSettings.ShipLootColor.Value),
					format = ConfigSettings.ShipLootFormat.Value,
					Enabled = true,
					OffsetX = GetXOffset(ConfigSettings.ShipLootPosition.Value),
					OffsetY = GetYOffset(ConfigSettings.ShipLootPosition.Value)
				});
			}
			if (ConfigSettings.ShowQuota.Value)
			{
				list.Add(new ShipLootPlusItem
				{
					Name = "Quota",
					Location = ConfigSettings.QuotaPosition.Value,
					color = ConvertHexColor(ConfigSettings.QuotaColor.Value),
					format = ConfigSettings.QuotaFormat.Value,
					Enabled = true,
					OffsetX = GetXOffset(ConfigSettings.QuotaPosition.Value),
					OffsetY = GetYOffset(ConfigSettings.QuotaPosition.Value)
				});
			}
			if (ConfigSettings.ShowDays.Value)
			{
				list.Add(new ShipLootPlusItem
				{
					Name = "Days",
					Location = ConfigSettings.DaysPosition.Value,
					color = ConvertHexColor(ConfigSettings.DaysColor.Value),
					format = ConfigSettings.DaysFormat.Value,
					Enabled = true,
					OffsetX = GetXOffset(ConfigSettings.DaysPosition.Value),
					OffsetY = GetYOffset(ConfigSettings.DaysPosition.Value)
				});
			}
			return list;
		}

		private static Color ConvertHexColor(string hColor, float alpha = 0.95f)
		{
			//IL_0035: 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)
			if (!Regex.IsMatch(hColor, "^#"))
			{
				hColor = "#" + hColor;
			}
			Color result = default(Color);
			if (ColorUtility.TryParseHtmlString(hColor, ref result))
			{
				return result;
			}
			return new Color(25f, 213f, 108f);
		}

		private static float GetXOffset(ShipLootPlus.ElementLocation location)
		{
			return location switch
			{
				ShipLootPlus.ElementLocation.Top => 37f, 
				ShipLootPlus.ElementLocation.Middle => 41f, 
				ShipLootPlus.ElementLocation.Bottom => 45f, 
				_ => 60f, 
			};
		}

		private static float GetYOffset(ShipLootPlus.ElementLocation location)
		{
			return location switch
			{
				ShipLootPlus.ElementLocation.Top => -50f, 
				ShipLootPlus.ElementLocation.Middle => -56f, 
				ShipLootPlus.ElementLocation.Bottom => -62f, 
				_ => -54.5f, 
			};
		}

		private static void CreateUiElements()
		{
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: 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_036b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle/ValueCounter");
			if (!Object.op_Implicit((Object)(object)val))
			{
				ShipLootPlus.Log.LogError((object)"Failed to find ValueCounter object to copy!");
				return;
			}
			IEnumerable<ShipLootPlusItem> source = UiElementList.Where((ShipLootPlusItem e) => e.Enabled && e.ShowText);
			if (source.Count() == 1)
			{
				ShipLootPlusItem? shipLootPlusItem = source.FirstOrDefault();
				shipLootPlusItem.Location = ShipLootPlus.ElementLocation.Middle;
				shipLootPlusItem.OffsetX = GetXOffset(shipLootPlusItem.Location);
				shipLootPlusItem.OffsetY = GetYOffset(shipLootPlusItem.Location) + 2f;
			}
			else if (source.Count() == 2)
			{
				IEnumerable<ShipLootPlusItem> source2 = source.Where((ShipLootPlusItem e) => e.Location == ShipLootPlus.ElementLocation.Top);
				IEnumerable<ShipLootPlusItem> enumerable = source.Where((ShipLootPlusItem e) => e.Location == ShipLootPlus.ElementLocation.Middle);
				IEnumerable<ShipLootPlusItem> enumerable2 = source.Where((ShipLootPlusItem e) => e.Location == ShipLootPlus.ElementLocation.Bottom);
				if (enumerable2.Count() != 0)
				{
					if (source2.Count() != 0)
					{
						foreach (ShipLootPlusItem item in enumerable2)
						{
							item.Location = ShipLootPlus.ElementLocation.Middle;
							item.OffsetX = GetXOffset(ShipLootPlus.ElementLocation.Middle) + 4f;
							item.OffsetY = GetYOffset(ShipLootPlus.ElementLocation.Middle) + -4f;
						}
					}
					else
					{
						foreach (ShipLootPlusItem item2 in enumerable)
						{
							item2.Location = ShipLootPlus.ElementLocation.Top;
							item2.OffsetX = GetXOffset(ShipLootPlus.ElementLocation.Top);
							item2.OffsetY = GetYOffset(ShipLootPlus.ElementLocation.Top);
						}
						foreach (ShipLootPlusItem item3 in enumerable2)
						{
							item3.Location = ShipLootPlus.ElementLocation.Middle;
							item3.OffsetX = GetXOffset(ShipLootPlus.ElementLocation.Middle) + 4f;
							item3.OffsetY = GetYOffset(ShipLootPlus.ElementLocation.Middle) + -4f;
						}
					}
				}
			}
			foreach (ShipLootPlusItem item4 in UiElementList.Where((ShipLootPlusItem e) => (Object)(object)e.gameOjbect == (Object)null))
			{
				item4.gameOjbect = Object.Instantiate<GameObject>(val.gameObject, val.transform.parent, false);
				item4.gameOjbect.transform.Translate(0f, 1f, 0f);
				TextMeshProUGUI componentInChildren = item4.gameOjbect.GetComponentInChildren<TextMeshProUGUI>();
				((Behaviour)componentInChildren).enabled = false;
				Image componentInChildren2 = item4.gameOjbect.GetComponentInChildren<Image>();
				((Behaviour)componentInChildren2).enabled = false;
				if (item4.ShowText)
				{
					((Behaviour)componentInChildren).enabled = true;
					((Graphic)componentInChildren).color = item4.color;
					((TMP_Text)componentInChildren).fontSize = 13f;
					item4.textMeshProUGui = componentInChildren;
					if (source.Count() == 1)
					{
						((TMP_Text)componentInChildren).fontSize = 23f;
					}
					else if (source.Count() == 2)
					{
						((TMP_Text)componentInChildren).fontSize = 18f;
					}
				}
				if (item4.ShowImg)
				{
					((Behaviour)componentInChildren2).enabled = true;
					((Graphic)componentInChildren2).color = item4.color;
					RectTransform component = ((Component)componentInChildren2).GetComponent<RectTransform>();
					Rect rect = component.rect;
					float num = ((Rect)(ref rect)).width / 0.25f;
					rect = component.rect;
					float height = ((Rect)(ref rect)).height;
					component.sizeDelta = new Vector2(num, height);
				}
				Vector3 localPosition = item4.gameOjbect.transform.localPosition;
				float x = localPosition.x;
				float num2 = -54.5f;
				x = localPosition.x + item4.OffsetX;
				num2 = item4.OffsetY;
				item4.gameOjbect.transform.localPosition = new Vector3(x, num2, localPosition.z);
			}
		}

		private static float CalculateLootValue(List<string> Ignored)
		{
			List<GrabbableObject> list = (from obj in GameObject.Find("/Environment/HangarShip").GetComponentsInChildren<GrabbableObject>()
				where !Ignored.Contains(((Object)obj).name)
				select obj).ToList();
			ShipLootPlus.Log.LogDebug((object)"Calculating total ship scrap value.");
			CollectionExtensions.Do<GrabbableObject>((IEnumerable<GrabbableObject>)list, (Action<GrabbableObject>)delegate(GrabbableObject scrap)
			{
				ShipLootPlus.Log.LogDebug((object)$"{((Object)scrap).name} - ${scrap.scrapValue}");
			});
			return list.Sum((GrabbableObject scrap) => scrap.scrapValue);
		}

		private static IEnumerator DisplayDataCoroutine()
		{
			UiElementList.ForEach(delegate(ShipLootPlusItem obj)
			{
				obj.gameOjbect.SetActive(true);
			});
			while (timeLeftDisplay > 0f)
			{
				float num = timeLeftDisplay;
				timeLeftDisplay = 0f;
				yield return (object)new WaitForSeconds(num);
			}
			UiElementList.ForEach(delegate(ShipLootPlusItem obj)
			{
				obj.gameOjbect.SetActive(false);
			});
		}
	}
	public class ShipLootPlusItem
	{
		public string Name;

		public ShipLootPlus.ElementLocation Location;

		public float OffsetX;

		public float OffsetY;

		public Color color;

		public string format;

		public GameObject gameOjbect;

		public TextMeshProUGUI textMeshProUGui;

		public bool ShowText = true;

		public bool ShowImg;

		public bool Enabled;
	}
	public class ShipLootPlusPositions
	{
		public const float TopOffsetX = 37f;

		public const float TopOffsetY = -50f;

		public const float MiddleOffsetX = 41f;

		public const float MiddleOffsetY = -56f;

		public const float BottomOffsetX = 45f;

		public const float BottomOffsetY = -62f;

		public const float TwoElementOffsetX = 4f;

		public const float TwoElementOffsetY = -4f;

		public const float DefaultFontSize = 13f;

		public const float TwoElementFontSize = 18f;

		public const float OneElementFontSize = 23f;
	}
}