Decompiled source of TerminalFormatter v0.2.28

TerminalFormatter.dll

Decompiled 5 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using AdvancedCompany.Config;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using ConsoleTables;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLevelLoader;
using LethalLib.Modules;
using LethalQuantities;
using LethalQuantities.Json;
using LethalQuantities.Objects;
using LethalRegeneration.config;
using Microsoft.CodeAnalysis;
using MrovLib;
using MrovLib.Compatibility;
using MrovLib.ContentType;
using MrovLib.Events;
using StoreRotationConfig.Api;
using TerminalFormatter.Compatibility;
using TerminalFormatter.Nodes;
using TerminalFormatter.Patches;
using UnityEngine;
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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("LethalLevelLoader")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("TerminalFormatter")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("0.2.28.0")]
[assembly: AssemblyInformationalVersion("0.2.28+948d6798eb08ed5d0846dbb32a17c4916bbdedee")]
[assembly: AssemblyProduct("TerminalFormatter")]
[assembly: AssemblyTitle("TerminalFormatter")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 TerminalFormatter
{
	internal class ACCompatibility
	{
		internal static ManualLogSource logger = Logger.CreateLogSource("TerminalFormatter AC");

		internal static FieldInfo ServerConfiguration;

		internal static Dictionary<string, bool> Items = new Dictionary<string, bool>();

		public static bool populated = false;

		public static void Init(string assemblyName)
		{
			string text = "AdvancedCompany.Config";
			string text2 = "ServerConfiguration";
			Assembly assembly = ((object)Chainloader.PluginInfos[assemblyName].Instance).GetType().Assembly;
			Type type = assembly.GetType(text + "." + text2);
			if (type != null)
			{
				logger.LogInfo((object)$"Type {type} found");
				FieldInfo field = type.GetField("Instance", BindingFlags.Static | BindingFlags.Public);
				if (field != null)
				{
					logger.LogInfo((object)$"Property {field} found");
					Variables.IsACActive = true;
					ServerConfiguration = field;
				}
				else
				{
					logger.LogError((object)$"Property {field} not found");
				}
			}
			else
			{
				logger.LogDebug((object)("Type " + text + "." + text2 + " not found"));
			}
		}

		internal static void Refresh()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			if (!Variables.IsACActive)
			{
				return;
			}
			try
			{
				Items.Clear();
				object value = ServerConfiguration.GetValue(null);
				if (value != null)
				{
					logger.LogInfo((object)$"Value {value} found");
					FieldInfo field = value.GetType().GetField("Items", BindingFlags.Instance | BindingFlags.Public);
					if (field != null)
					{
						ItemsConfig val = (ItemsConfig)field.GetValue(value);
						Dictionary<string, ItemConfig> items = val.Items;
						CollectionExtensions.Do<KeyValuePair<string, ItemConfig>>((IEnumerable<KeyValuePair<string, ItemConfig>>)items, (Action<KeyValuePair<string, ItemConfig>>)delegate(KeyValuePair<string, ItemConfig> x)
						{
							Items.Add(x.Key, x.Value.Active);
						});
					}
					else
					{
						logger.LogError((object)$"Property {field} not found");
					}
				}
				else
				{
					logger.LogError((object)$"Property {ServerConfiguration} value not found");
				}
			}
			catch (Exception ex)
			{
				logger.LogError((object)ex);
			}
		}
	}
	internal class LategameUpgradesCompatibility : CompatibilityBase
	{
		internal static Assembly LGUAssembly;

		public LategameUpgradesCompatibility(string guid, string version = null)
			: base(guid, version)
		{
			if (((CompatibilityBase)this).IsModPresent)
			{
				Init();
			}
		}

		public static void Init()
		{
			LGUAssembly = ((object)Chainloader.PluginInfos["com.malco.lethalcompany.moreshipupgrades"].Instance).GetType().Assembly;
			Plugin.isLGUPresent = true;
		}

		internal static int GetMoonPrice(int price)
		{
			string text = "MoreShipUpgrades.UpgradeComponents.TierUpgrades.EfficientEngines";
			Type type = Plugin.LGUCompat.GetModAssembly.GetType(text ?? "");
			if (type == null)
			{
				Plugin.logger.LogWarning((object)("Could not find " + text + " type"));
				return price;
			}
			MethodInfo method = type.GetMethod("GetDiscountedMoonPrice", BindingFlags.Static | BindingFlags.Public);
			if (method == null)
			{
				Plugin.logger.LogWarning((object)"Could not find GetDiscountedMoonPrice method in EfficientEngines");
				return price;
			}
			return (int)method.Invoke(null, new object[1] { price });
		}
	}
	internal class LLLCompatibility
	{
		public static void Init()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			Plugin.harmony.Patch((MethodBase)AccessTools.Method(typeof(Patches), "TerminalLoadNewNode_Postfix", (Type[])null, (Type[])null), new HarmonyMethod(typeof(LLLCompatibility), "LLLLoadNodePatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			GetLLLSettings();
		}

		public static void GetLLLSettings()
		{
			//IL_0015: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			if (Enum.TryParse<PreviewInfoType>(ConfigManager.LastUsedPreview.Value, out PreviewInfoType result))
			{
				Settings.levelPreviewInfoType = result;
			}
			if (Enum.TryParse<FilterInfoType>(ConfigManager.LastUsedFilter.Value, out FilterInfoType result2))
			{
				Settings.levelPreviewFilterType = result2;
			}
			if (Enum.TryParse<SortInfoType>(ConfigManager.LastUsedSort.Value, out SortInfoType result3))
			{
				Settings.levelPreviewSortType = result3;
			}
			Variables.ISLLLActive = true;
		}

		public static bool LLLLoadNodePatch(Terminal __0, ref TerminalNode __1)
		{
			if ((Object)(object)__1 == (Object)(object)Variables.LastReplacedNode)
			{
				return false;
			}
			return true;
		}

		public static string InvokeMoonOverrideInfoEvent(ExtendedLevel extendedLevel, PreviewInfoType infoType)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			Type typeFromHandle = typeof(TerminalManager);
			EventInfo @event = typeFromHandle.GetEvent("onBeforePreviewInfoTextAdded", BindingFlags.Static | BindingFlags.Public);
			FieldInfo field = typeFromHandle.GetField("onBeforePreviewInfoTextAdded", BindingFlags.Static | BindingFlags.NonPublic);
			if (field != null && field.GetValue(null) is Delegate @delegate)
			{
				object[] args = new object[2] { extendedLevel, infoType };
				Delegate[] invocationList = @delegate.GetInvocationList();
				int num = 0;
				if (num < invocationList.Length)
				{
					Delegate delegate2 = invocationList[num];
					object obj = delegate2.DynamicInvoke(args);
					return obj as string;
				}
			}
			return null;
		}
	}
	internal class LethalLibCompatibility
	{
		public static void Init()
		{
		}

		public static bool IsLLItemDisabled(Item item)
		{
			return Items.shopItems.Find((ShopItem x) => (Object)(object)x.item == (Object)(object)item)?.wasRemoved ?? false;
		}

		public static bool IsLLUpgradeDisabled(UnlockableItem unlockable)
		{
			return Unlockables.registeredUnlockables.Find((RegisteredUnlockable x) => x.unlockable == unlockable)?.disabled ?? false;
		}
	}
	internal class LethalQuantitiesCompatibility : CompatibilityBase
	{
		public LethalQuantitiesCompatibility(string guid, string version = null)
			: base(guid, version)
		{
			if (((CompatibilityBase)this).IsModPresent)
			{
				Init();
			}
		}

		public static void Init()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			Harmony val = new Harmony("TerminalFormatter LQ");
			Plugin.isLQPresent = true;
		}

		public static string GetLevelRiskLevel(SelectableLevel level)
		{
			Type type = ((object)Plugin.INSTANCE).GetType();
			FieldInfo field = type.GetField("presets", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<Guid, LevelPreset> dictionary = (Dictionary<Guid, LevelPreset>)field.GetValue(Plugin.INSTANCE);
			LevelPreset value;
			return (dictionary.TryGetValue(SelectableLevelCache.getGuid(level), out value) ? value : null)?.riskLevel.value;
		}
	}
	internal class LethalRegenCompatibility
	{
		internal static bool IsUpgradeInStore;

		public static void Init()
		{
			IsUpgradeInStore = ConfigurationSync<Configuration>.Instance.HealingUpgradeEnabled;
		}

		public static int GetCost()
		{
			return ConfigurationSync<Configuration>.Instance.HealingUpgradePrice;
		}

		public static bool IsUpgradeBought()
		{
			return ConfigurationSync<Configuration>.Instance.HealingUpgradeUnlocked;
		}
	}
	internal class WeatherTweaksCompatibility
	{
		internal static string nspace = "WeatherTweaks";

		internal static MethodInfo GetPlanetCurrentWeather;

		public static void Init()
		{
			Assembly assembly = ((object)Chainloader.PluginInfos["WeatherTweaks"].Instance).GetType().Assembly;
			Type type = assembly.GetType(nspace + ".Variables");
			if (!(type != null))
			{
				return;
			}
			GetPlanetCurrentWeather = type.GetMethod("GetPlanetCurrentWeather", BindingFlags.Static | BindingFlags.Public);
			if (GetPlanetCurrentWeather != null)
			{
				Plugin.logger.LogInfo((object)$"Method {GetPlanetCurrentWeather} found - BetaWeatherTweaks");
				return;
			}
			GetPlanetCurrentWeather = type.GetMethod("GetPlanetCurrentWeather", BindingFlags.Static | BindingFlags.NonPublic);
			if (GetPlanetCurrentWeather != null)
			{
				Plugin.logger.LogInfo((object)$"Method {GetPlanetCurrentWeather} found");
			}
		}
	}
	public class ConfigManager
	{
		internal static ConfigFile configFile;

		public static ConfigManager Instance { get; private set; }

		public static ConfigEntry<bool> ShowDifficultyInAll { get; private set; }

		public static ConfigEntry<bool> DetailedScanPage { get; private set; }

		public static ConfigEntry<int> DivideShopPage { get; private set; }

		public static ConfigEntry<bool> UseShortenedWeathers { get; private set; }

		public static ConfigEntry<bool> AlwaysDisplayHiddenMoons { get; private set; }

		public static ConfigEntry<bool> ShowNumberedPlanetNames { get; private set; }

		public static ConfigEntry<bool> ShowDecorations { get; private set; }

		public static ConfigEntry<bool> ShowGroupDividerLines { get; private set; }

		public static ConfigEntry<bool> ShowHelpText { get; private set; }

		public static ConfigEntry<string> LastUsedPreview { get; private set; }

		public static ConfigEntry<string> LastUsedFilter { get; private set; }

		public static ConfigEntry<string> LastUsedSort { get; private set; }

		public static ConfigEntry<int> LinesToScroll { get; private set; }

		public static void Init(ConfigFile config)
		{
			Instance = new ConfigManager(config);
		}

		private ConfigManager(ConfigFile config)
		{
			configFile = config;
			ShowDifficultyInAll = configFile.Bind<bool>("General", "Show Difficulty in All", false, "Show difficulty in `preview all` setting");
			DetailedScanPage = configFile.Bind<bool>("General", "Detailed Scan Page", true, "Enable detailed scan page");
			UseShortenedWeathers = configFile.Bind<bool>("Moons", "Use Shortened Weathers", false, "Use shortened weathers in moons catalogue");
			ShowNumberedPlanetNames = configFile.Bind<bool>("General", "Show Numbered Planet Names", false, "Show numbered planet names in terminal");
			AlwaysDisplayHiddenMoons = configFile.Bind<bool>("Moons", "Always Display Hidden Moons", false, "Always display hidden moons in moons catalogue");
			ShowDecorations = configFile.Bind<bool>("General", "Show Decorations", false, "Show decorations in terminal");
			ShowGroupDividerLines = configFile.Bind<bool>("General", "Show Group Divider Lines", false, "Show group divider lines in terminal");
			ShowHelpText = configFile.Bind<bool>("General", "Show Help Text", false, "Show help text in terminal");
			DivideShopPage = configFile.Bind<int>("Store", "Divide shop page into groups", 5, "Number of items per shop section (set to 0 to disable)");
			LastUsedPreview = configFile.Bind<string>("Last Used LLL Option", "Last Used Preview", "All", "Last used preview setting");
			LastUsedFilter = configFile.Bind<string>("Last Used LLL Option", "Last Used Filter", "None", "Last used filter setting");
			LastUsedSort = configFile.Bind<string>("Last Used LLL Option", "Last Used Sort", "Price", "Last used sort setting");
			LinesToScroll = configFile.Bind<int>("General", "Lines to Scroll", 15, "Number of lines to scroll per mouse wheel tick");
			LinesToScroll.SettingChanged += delegate
			{
				TerminalScrollMousePatch.CurrentText = "";
			};
		}
	}
	public class Header
	{
		public string CreateHeader(string text)
		{
			StringBuilder stringBuilder = new StringBuilder();
			int length = text.Length;
			stringBuilder.Append("  ╔");
			for (int i = 0; i < length + 2; i++)
			{
				stringBuilder.Append("═");
			}
			stringBuilder.Append("╗\n");
			stringBuilder.Append("╭─╢ ");
			stringBuilder.Append(text);
			stringBuilder.Append(" ╟&╮\n");
			stringBuilder.Append("│ ╚");
			for (int j = 0; j < length + 2; j++)
			{
				stringBuilder.Append("═");
			}
			stringBuilder.Append("╝^│\n");
			return stringBuilder.ToString();
		}

		public string CreateHeaderWithoutLines(string text, int padLeft = 2)
		{
			StringBuilder stringBuilder = new StringBuilder();
			int length = text.Length;
			for (int i = 0; i < padLeft; i++)
			{
				stringBuilder.Append(" ");
			}
			stringBuilder.Append("╔");
			for (int j = 0; j < length + 2; j++)
			{
				stringBuilder.Append("═");
			}
			stringBuilder.Append("╗\n");
			for (int k = 0; k < padLeft; k++)
			{
				stringBuilder.Append(" ");
			}
			stringBuilder.Append("║ ");
			stringBuilder.Append(text);
			stringBuilder.Append(" ║\n");
			for (int l = 0; l < padLeft; l++)
			{
				stringBuilder.Append(" ");
			}
			stringBuilder.Append("╚");
			for (int m = 0; m < length + 2; m++)
			{
				stringBuilder.Append("═");
			}
			stringBuilder.Append("╝\n");
			return stringBuilder.ToString();
		}

		internal string CreateNumberedHeader(string text, int padLeft = 2, Dictionary<int, string> replaceNumbers = null)
		{
			string text2 = CreateHeaderWithoutLines(text, padLeft);
			StringBuilder stringBuilder = new StringBuilder();
			string[] array = text2.Split('\n');
			for (int i = 0; i < array.Length; i++)
			{
				stringBuilder.Append("  ");
				stringBuilder.Append(array[i].Trim());
				stringBuilder.Append("  " + ((replaceNumbers != null && replaceNumbers.ContainsKey(i)) ? replaceNumbers[i] : ""));
				stringBuilder.Append("\n");
			}
			return stringBuilder.ToString();
		}
	}
	[BepInPlugin("TerminalFormatter", "TerminalFormatter", "0.2.28")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource logger;

		internal static Logger debugLogger = new Logger("TerminalFormatter", (ConfigEntry<bool>)null);

		internal static Harmony harmony = new Harmony("TerminalFormatter");

		internal static TerminalNode LockedNode;

		internal static bool isACPresent = false;

		internal static bool isLLibPresent = false;

		internal static bool isLLLPresent = false;

		internal static bool isLRegenPresent = false;

		internal static bool isLGUPresent = false;

		internal static bool isWTPresent = false;

		internal static bool isLQPresent = false;

		internal static bool isSRCPresent = false;

		internal static CompatibilityBase LGUCompat;

		internal static CompatibilityBase LQCompat;

		internal static CompatibilityBase SRCCompat;

		private void Awake()
		{
			logger = ((BaseUnityPlugin)this).Logger;
			harmony.PatchAll();
			ConfigManager.Init(((BaseUnityPlugin)this).Config);
			EventManager.TerminalStart.AddListener((ParameterEvent<Terminal>)delegate(Terminal terminal)
			{
				Variables.Terminal = terminal;
			});
			if (Chainloader.PluginInfos.ContainsKey("com.potatoepet.AdvancedCompany"))
			{
				logger.LogWarning((object)"AC found, setting up compatibility patches");
				ACCompatibility.Init("com.potatoepet.AdvancedCompany");
				isACPresent = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("imabatby.lethallevelloader"))
			{
				logger.LogWarning((object)"LLL found, setting up compatibility patches");
				LLLCompatibility.Init();
				isLLLPresent = true;
				new Moons();
				new RouteLocked();
				new Simulate();
			}
			else
			{
				new MoonsNoLLL();
			}
			if (Chainloader.PluginInfos.ContainsKey("evaisa.lethallib"))
			{
				logger.LogWarning((object)"LethalLib found, setting up compatibility patches");
				isLLibPresent = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("Toskan4134.LethalRegeneration"))
			{
				logger.LogWarning((object)"LethalRegeneration found, setting up compatibility patches");
				LethalRegenCompatibility.Init();
				isLRegenPresent = true;
			}
			LGUCompat = (CompatibilityBase)(object)new LategameUpgradesCompatibility("com.malco.lethalcompany.moreshipupgrades");
			LQCompat = (CompatibilityBase)(object)new LethalQuantitiesCompatibility("LethalQuantities");
			SRCCompat = (CompatibilityBase)(object)new StoreRotationConfigCompatibility("pacoito.StoreRotationConfig");
			if (Chainloader.PluginInfos.ContainsKey("WeatherTweaks"))
			{
				logger.LogWarning((object)"WeatherTweaks found, setting up compatibility patches");
				WeatherTweaksCompatibility.Init();
				isWTPresent = true;
			}
			new Route();
			new RouteAfter();
			new Scan();
			new Store();
			new Buy();
			new BuyAfter();
			new CannotAfford();
			new Bestiary();
			new Storage();
			LockedNode = ScriptableObject.CreateInstance<TerminalNode>();
			((Object)LockedNode).name = "RouteLocked";
			LockedNode.clearPreviousText = true;
			LockedNode.acceptAnything = true;
			LockedNode.displayText = "You cannot route to the selected moon. The route is locked.";
			LockedNode.terminalOptions = Array.Empty<CompatibleNoun>();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin TerminalFormatter is loaded!");
		}
	}
	internal class Settings
	{
		internal static List<TerminalFormatterNode> RegisteredNodes = new List<TerminalFormatterNode>();

		public static readonly int terminalWidth = 48;

		public static bool firstUse = true;

		internal static readonly int planetWeatherWidth = 18;

		internal static readonly int planetNameWidth = terminalWidth + 2 - planetWeatherWidth - 9;

		internal static readonly int itemNameWidth = terminalWidth - 9 - 10;

		internal static readonly int dividerLength = 17;

		internal static Dictionary<string, string> WeathersShortened = new Dictionary<string, string>
		{
			{ "None", "Non" },
			{ "DustClouds", "Dust" },
			{ "Foggy", "Fog" },
			{ "Rainy", "Rny" },
			{ "Flooded", "Fld" },
			{ "Stormy", "Strm" },
			{ "Eclipsed", "Eclps" }
		};

		internal static List<string> MoonsToIgnore = new List<string>(2) { "71 Gordion", "44 Liquidation" };

		internal static List<string> HiddenMoons = new List<string>(2) { "5 Embrion", "68 Artifice" };

		internal static List<string> MoonsOrderVanilla = new List<string>(9) { "Experimentation", "Assurance", "Vow", "March", "Offense", "Adamance", "Rend", "Dine", "Titan" };

		internal static readonly ManualLogSource logger = Plugin.logger;
	}
	public class SharedMethods
	{
		public static string GetWeather(SelectableLevel level)
		{
			string weather = SharedMethods.GetWeather(level);
			int num = Settings.planetWeatherWidth - 1;
			bool flag = false;
			if (Plugin.isLLLPresent)
			{
				flag = ShouldShowDifficulty(level);
			}
			if (flag)
			{
				num -= 7;
			}
			if (weather.Length >= num || ConfigManager.UseShortenedWeathers.Value)
			{
				CollectionExtensions.Do<KeyValuePair<string, string>>((IEnumerable<KeyValuePair<string, string>>)Settings.WeathersShortened, (Action<KeyValuePair<string, string>>)delegate(KeyValuePair<string, string> pair)
				{
					weather = Regex.Replace(weather, pair.Key, pair.Value);
					weather = weather.Replace(" ", "");
				});
			}
			return weather;
		}

		public static string GetNumberlessPlanetName(SelectableLevel level)
		{
			return SharedMethods.GetNumberlessPlanetName(level);
		}

		public static List<SelectableLevel> GetGameLevels()
		{
			return SharedMethods.GetGameLevels();
		}

		public static int GetPrice(int beforeDiscountPrice)
		{
			if (Plugin.isLGUPresent)
			{
				return LategameUpgradesCompatibility.GetMoonPrice(beforeDiscountPrice);
			}
			return beforeDiscountPrice;
		}

		public static bool ShouldShowDifficulty(SelectableLevel level)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			if (!ConfigManager.ShowDifficultyInAll.Value || (int)Settings.levelPreviewInfoType != 4)
			{
				return (int)Settings.levelPreviewInfoType == 1;
			}
			return true;
		}

		public static string GetLevelRiskLevel(SelectableLevel level)
		{
			if (Plugin.LQCompat.IsModPresent)
			{
				string levelRiskLevel = LethalQuantitiesCompatibility.GetLevelRiskLevel(level);
				if (levelRiskLevel != null)
				{
					return levelRiskLevel;
				}
				return level.riskLevel;
			}
			return level.riskLevel;
		}
	}
	public abstract class TerminalFormatterNode
	{
		public string name;

		public string AdditionalInfo;

		public List<string> terminalNode;

		public ConfigEntry<bool> Enabled;

		public virtual bool IsNodeValid(TerminalNode node, Terminal terminal)
		{
			return true;
		}

		public abstract string GetNodeText(TerminalNode node, Terminal terminal);

		public TerminalFormatterNode(string name, List<string> terminalNode)
		{
			this.name = name;
			this.terminalNode = terminalNode;
			Enabled = ConfigManager.configFile.Bind<bool>("Nodes", name, true, "Enable node " + name);
			Settings.RegisteredNodes.Add(this);
			Plugin.logger.LogInfo((object)("Registered node " + name));
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	[HarmonyPatch(typeof(Terminal))]
	public class TerminalPatches
	{
		private static TerminalNode lastNode;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Terminal), "LoadNewNode")]
		[HarmonyPriority(500)]
		public static bool CheckIfLocked(Terminal __instance, TerminalNode node)
		{
			if ((Object)(object)node == (Object)null)
			{
				return true;
			}
			lastNode = node;
			if (!((CompatibilityBase)Plugin.LLL).IsModPresent)
			{
				return true;
			}
			if (!((Object)node).name.ToLower().Contains("route") && !node.buyRerouteToMoon.Equals(-2))
			{
				return true;
			}
			if (((Object)node).name == "RouteLocked")
			{
				Plugin.debugLogger.LogDebug((object)"Node is RouteLocked");
				return true;
			}
			Route val = ContentManager.Routes.Where((Route x) => (Object)(object)x.Nodes.Node == (Object)(object)node).FirstOrDefault();
			if (val == null)
			{
				Plugin.debugLogger.LogDebug((object)"Level is null");
				return true;
			}
			if ((Object)(object)val.Level == (Object)null)
			{
				return true;
			}
			if (SharedMethods.IsMoonLockedLLL(val.Level))
			{
				Plugin.debugLogger.LogInfo((object)"Node is locked!!");
				__instance.LoadNewNode(Plugin.LockedNode);
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch("LoadNewNode")]
		[HarmonyPriority(0)]
		[HarmonyAfter(new string[] { "imabatby.lethallevelloader" })]
		public static bool LoadNewTerminalFormatterNode(Terminal __instance, TerminalNode node)
		{
			__instance.modifyingText = true;
			((Selectable)__instance.screenText).interactable = true;
			string text = null;
			Variables.LastReplacedNode = null;
			List<TerminalFormatterNode> list = Settings.RegisteredNodes.Where((TerminalFormatterNode formatterNode) => formatterNode.terminalNode.Any((string y) => ((Object)node).name.Contains(y))).ToList();
			if (list != null)
			{
				Plugin.debugLogger.LogDebug((object)$"Possible nodes count: {list.Count}");
				for (int i = 0; i < list.Count; i++)
				{
					TerminalFormatterNode terminalFormatterNode = list[i];
					if (terminalFormatterNode == null)
					{
						continue;
					}
					Plugin.debugLogger.LogDebug((object)("Checking if node " + terminalFormatterNode.name + " is valid..."));
					if (!terminalFormatterNode.IsNodeValid(node, __instance))
					{
						Plugin.debugLogger.LogDebug((object)("Node " + terminalFormatterNode.name + " is not valid"));
						continue;
					}
					if (!terminalFormatterNode.Enabled.Value)
					{
						Plugin.debugLogger.LogDebug((object)("Node " + terminalFormatterNode.name + " is not enabled"));
						continue;
					}
					Plugin.debugLogger.LogDebug((object)("Using node " + terminalFormatterNode.name));
					text = terminalFormatterNode.GetNodeText(node, __instance);
					break;
				}
				if (text != null)
				{
					StringBuilder stringBuilder = new StringBuilder();
					if (Object.op_Implicit((Object)(object)__instance.displayingPersistentImage))
					{
						stringBuilder.Append("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
					}
					stringBuilder.Append("\n\n");
					stringBuilder.Append(text);
					stringBuilder.Append("\n" + new string('-', Settings.dividerLength) + "\n");
					Plugin.debugLogger.LogMessage((object)("New display text:\n" + text));
					if (node.playSyncedClip != -1)
					{
						__instance.PlayTerminalAudioServerRpc(node.playSyncedClip);
					}
					else if ((Object)(object)node.playClip != (Object)null)
					{
						__instance.terminalAudio.PlayOneShot(node.playClip);
					}
					__instance.LoadTerminalImage(node);
					__instance.currentNode = node;
					__instance.screenText.text = stringBuilder.ToString();
					__instance.currentText = stringBuilder.ToString();
					__instance.textAdded = 0;
					Settings.firstUse = false;
					Variables.LastReplacedNode = node;
					return false;
				}
				return true;
			}
			return true;
		}
	}
	public class Variables
	{
		public static Terminal Terminal;

		public static TerminalNode LastReplacedNode;

		public static bool IsACActive;

		public static bool ISLLLActive;
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "TerminalFormatter";

		public const string PLUGIN_NAME = "TerminalFormatter";

		public const string PLUGIN_VERSION = "0.2.28";
	}
}
namespace TerminalFormatter.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB), "ScrollMouse_performed", new Type[] { typeof(CallbackContext) })]
	internal class TerminalScrollMousePatch
	{
		private static float scrollAmount = 1f / 3f;

		public static string CurrentText { get; internal set; } = "";


		private static void ScrollMouse_performed(Scrollbar scrollbar, float scrollDirection)
		{
			if ((Object)(object)scrollbar == (Object)null)
			{
				Plugin.debugLogger.LogWarning((object)"scrollbar is null - too bad!");
				return;
			}
			if (string.CompareOrdinal(Variables.Terminal.currentText, CurrentText) != 0)
			{
				CurrentText = Variables.Terminal.currentText;
				int num = CurrentText.Count((char c) => c.Equals('\n')) + 1;
				scrollAmount = (float)ConfigManager.LinesToScroll.Value / (float)num;
			}
			scrollbar.value += scrollDirection * scrollAmount;
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: 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_0022: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
			{
				new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(PlayerControllerB), "terminalScrollVertical"), (string)null)
			}).Insert((CodeInstruction[])(object)new CodeInstruction[5]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(PlayerControllerB), "terminalScrollVertical")),
				new CodeInstruction(OpCodes.Ldloc_0, (object)null),
				new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(TerminalScrollMousePatch), "ScrollMouse_performed", (Type[])null, (Type[])null)),
				new CodeInstruction(OpCodes.Ret, (object)null)
			}).InstructionEnumeration();
		}
	}
}
namespace TerminalFormatter.Nodes
{
	public class Bestiary : TerminalFormatterNode
	{
		public Bestiary()
			: base("Bestiary", new List<string>(1) { "0_Bestiary" })
		{
			AdditionalInfo = " Welcome to the Bestiary! \n Use INFO after creature name to learn more.";
		}

		public override string GetNodeText(TerminalNode node, Terminal terminal)
		{
			string value = new Header().CreateHeaderWithoutLines("BESTIARY");
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(value);
			List<int> scannedCreatures = terminal.scannedEnemyIDs;
			if (ConfigManager.ShowHelpText.Value)
			{
				stringBuilder.Append((AdditionalInfo != null) ? ("\n" + AdditionalInfo + "\n\n") : "");
			}
			else
			{
				stringBuilder.Append("\n");
			}
			if (terminal.scannedEnemyIDs == null || terminal.scannedEnemyIDs.Count == 0)
			{
				stringBuilder.Append(" NO DATA COLLECTED");
				stringBuilder.Append(" \n");
				stringBuilder.Append(" Scan creatures to unlock their data.");
				return stringBuilder.ToString();
			}
			List<Creature> list = ContentManager.Creatures.Where((Creature x) => scannedCreatures.Contains(x.InfoNode.creatureFileID)).ToList();
			foreach (Creature item in list)
			{
				if (ConfigManager.ShowDecorations.Value)
				{
					stringBuilder.Append(" * ");
				}
				else
				{
					stringBuilder.Append(" ");
				}
				stringBuilder.Append(item.Name);
				stringBuilder.Append("\n");
			}
			return stringBuilder.ToString();
		}
	}
	public class Buy : TerminalFormatterNode
	{
		internal BuyableThing LastResolvedBuyable;

		public Buy()
			: base("Buy", new List<string>(5) { "buy", "BuyNode", "Buy", "Buy1", "Node1" })
		{
		}

		public BuyableThing ResolveNodeIntoBuyable(TerminalNode node)
		{
			Plugin.logger.LogDebug((object)("Resolving node " + ((Object)node).name + " into Buyable"));
			return (from x in ContentManager.Buyables
				where x.Nodes != null && (Object)(object)x.Nodes.Node != (Object)null
				where (Object)(object)x.Nodes.Node == (Object)(object)node || ((Object)x.Nodes.Node).name == ((Object)node).name
				select x).FirstOrDefault();
		}

		public override bool IsNodeValid(TerminalNode node, Terminal terminal)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			BuyableThing val = ResolveNodeIntoBuyable(node);
			if (val != null)
			{
				Plugin.logger.LogDebug((object)$"Resolved Item: {val.Name}({val.Type})");
			}
			return val != null;
		}

		public override string GetNodeText(TerminalNode node, Terminal terminal)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			ConsoleTable val = new ConsoleTable(new string[2] { "Title", "Things" });
			BuyableThing val2 = (LastResolvedBuyable = ResolveNodeIntoBuyable(node));
			string value = new Header().CreateHeaderWithoutLines("CONFIRM PURCHASE");
			StringBuilder stringBuilder = new StringBuilder();
			val.AddRow(new object[2] { "ITEM:", val2.Name });
			bool flag = typeof(BuyableItem) == ((object)val2).GetType();
			if (flag)
			{
				val.AddRow(new object[2]
				{
					"PRICE:",
					$"${val2.Price}"
				});
			}
			if (node.buyItemIndex >= 0 && terminal.itemSalesPercentages[node.buyItemIndex] != 100)
			{
				val.AddRow(new object[2]
				{
					"DISCOUNT:",
					$"{100 - terminal.itemSalesPercentages[node.buyItemIndex]}%"
				});
			}
			if (flag)
			{
				val.AddRow(new object[2]
				{
					"AMOUNT:",
					terminal.playerDefinedAmount.ToString()
				});
			}
			val.AddRow(new object[2] { "", "" });
			val.AddRow(new object[2]
			{
				"TOTAL: ",
				$"${terminal.totalCostOfItems}  (${terminal.groupCredits - terminal.totalCostOfItems} after purchase)"
			});
			stringBuilder.Append(value);
			stringBuilder.Append("\n\n");
			stringBuilder.Append("Please CONFIRM or DENY the purchase:");
			stringBuilder.Append("\n\n");
			stringBuilder.Append(val.ToStringCustomDecoration(false, false, false));
			return stringBuilder.ToString();
		}
	}
	public class BuyAfter : TerminalFormatterNode
	{
		internal BuyableThing LastResolvedBuyable;

		public BuyAfter()
			: base("BuyAfter", new List<string>(9) { "Node2", "node2", "confirm", "2", "buy", "BuyNode", "Buy", "Buy1", "Node1" })
		{
		}

		public BuyableThing ResolveNodeIntoBuyable(TerminalNode node)
		{
			Plugin.logger.LogDebug((object)("Resolving node " + ((Object)node).name + " into Buyable"));
			return (from x in ContentManager.Buyables
				where x.Nodes != null && (Object)(object)x.Nodes.NodeConfirm != (Object)null
				where (Object)(object)x.Nodes.NodeConfirm == (Object)(object)node || ((Object)x.Nodes.NodeConfirm).name == ((Object)node).name
				select x).FirstOrDefault();
		}

		public override bool IsNodeValid(TerminalNode node, Terminal terminal)
		{
			BuyableThing val = ResolveNodeIntoBuyable(node);
			return val != null;
		}

		public override string GetNodeText(TerminalNode node, Terminal terminal)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			ConsoleTable val = new ConsoleTable(new string[2] { "Title", "Things" });
			BuyableThing val2 = (LastResolvedBuyable = ResolveNodeIntoBuyable(node));
			string value = new Header().CreateHeaderWithoutLines("SUCCESS!");
			StringBuilder stringBuilder = new StringBuilder();
			val.AddRow(new object[2] { "ITEM:", val2.Name });
			bool flag = typeof(BuyableItem) == ((object)val2).GetType();
			int playerDefinedAmount = terminal.playerDefinedAmount;
			stringBuilder.Append(value);
			stringBuilder.Append("\n\n");
			stringBuilder.Append("Thank you for your purchase!\n");
			if (flag)
			{
				stringBuilder.Append(string.Format("Your {0} ({1} x {2}) {3} on {4} way!", (playerDefinedAmount == 1) ? "item" : "items", terminal.playerDefinedAmount, val2.Name, (playerDefinedAmount == 1) ? "is" : "are", (playerDefinedAmount == 1) ? "its" : "their"));
			}
			else
			{
				stringBuilder.Append("Your unlockable is now available!");
			}
			return stringBuilder.ToString();
		}
	}
	public class CannotAfford : TerminalFormatterNode
	{
		public CannotAfford()
			: base("CannotAfford", new List<string>(1) { "CannotAfford" })
		{
		}

		public override bool IsNodeValid(TerminalNode node, Terminal terminal)
		{
			node.clearPreviousText = true;
			return true;
		}

		public override string GetNodeText(TerminalNode node, Terminal terminal)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			ConsoleTable val = new ConsoleTable(new string[2] { "Title", "Things" });
			string value = new Header().CreateHeaderWithoutLines("COMPANY STORE");
			StringBuilder stringBuilder = new StringBuilder();
			val.AddRow(new object[2]
			{
				"YOUR CREDITS:",
				$"${terminal.groupCredits}"
			});
			val.AddRow(new object[2]
			{
				"TOTAL:",
				$"${terminal.totalCostOfItems}"
			});
			stringBuilder.Append(value);
			stringBuilder.Append("\n\n");
			stringBuilder.Append("You cannot afford this purchase!");
			stringBuilder.Append("\n\n");
			stringBuilder.Append(val.ToStringCustomDecoration(false, false, false));
			return stringBuilder.ToString();
		}
	}
	public class Moons : TerminalFormatterNode
	{
		public Moons()
			: base("Moons", new List<string>(4) { "MoonsCatalogue", "preview", "sort", "filter" })
		{
			AdditionalInfo = " Welcome to the exomoons catalogue! \n Use ROUTE to to set the autopilot route. \n Use INFO to learn about any moon.";
		}

		public override bool IsNodeValid(TerminalNode node, Terminal terminal)
		{
			return true;
		}

		public override string GetNodeText(TerminalNode node, Terminal terminal)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_0143: Expected O, but got Unknown
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Expected O, but got Unknown
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Expected O, but got Unknown
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Invalid comparison between Unknown and I4
			//IL_0083: 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_00c4: 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)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_06c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cc: Invalid comparison between Unknown and I4
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Invalid comparison between Unknown and I4
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Invalid comparison between Unknown and I4
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Invalid comparison between Unknown and I4
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Invalid comparison between Unknown and I4
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_0498: Invalid comparison between Unknown and I4
			//IL_049a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Invalid comparison between Unknown and I4
			//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
			string text = "";
			bool value = ConfigManager.ShowDecorations.Value;
			object result2;
			object result3;
			if (((Object)node).name.Contains("preview") && Enum.TryParse(typeof(PreviewInfoType), TerminalManager.GetTerminalEventEnum(node.terminalEvent), out object result))
			{
				Settings.levelPreviewInfoType = (PreviewInfoType)result;
			}
			else if (((Object)node).name.Contains("sort") && Enum.TryParse(typeof(SortInfoType), TerminalManager.GetTerminalEventEnum(node.terminalEvent), out result2))
			{
				Settings.levelPreviewSortType = (SortInfoType)result2;
			}
			else if (((Object)node).name.Contains("filter") && Enum.TryParse(typeof(FilterInfoType), TerminalManager.GetTerminalEventEnum(node.terminalEvent), out result3))
			{
				Settings.levelPreviewFilterType = (FilterInfoType)result3;
				if ((int)Settings.levelPreviewFilterType == 2)
				{
					text = TerminalManager.GetTerminalEventString(node.terminalEvent);
					FieldInfo field = typeof(TerminalManager).GetField("currentTagFilter", BindingFlags.Static | BindingFlags.NonPublic);
					if (field != null)
					{
						field.SetValue(null, TerminalManager.GetTerminalEventString(node.terminalEvent));
					}
				}
			}
			MethodInfo method = typeof(TerminalManager).GetMethod("RefreshExtendedLevelGroups", BindingFlags.Static | BindingFlags.NonPublic);
			method.Invoke(null, null);
			MoonsCataloguePage val = (MoonsCataloguePage)SharedMethods.GetLLLMoonsCataloguePage();
			ConsoleTable val2 = new ConsoleTable(new string[3] { "", "", "" });
			ConsoleTable val3 = new ConsoleTable(new string[4] { "Name", "Price", "Weather", "Difficulty" });
			StringBuilder stringBuilder = new StringBuilder();
			string text2 = "MOONS CATALOGUE";
			Dictionary<int, string> replaceNumbers = new Dictionary<int, string>
			{
				{
					0,
					"PREVIEW: " + ((object)(PreviewInfoType)(ref Settings.levelPreviewInfoType)).ToString().ToUpper()
				},
				{
					1,
					"SORT: " + ((object)(SortInfoType)(ref Settings.levelPreviewSortType)).ToString().ToUpper()
				},
				{
					2,
					"FILTER: " + (((int)Settings.levelPreviewFilterType == 2) ? ("<color=#0be697>TAG</color> (" + text + ")") : ((object)(FilterInfoType)(ref Settings.levelPreviewFilterType)).ToString().ToUpper())
				}
			};
			string value2 = new Header().CreateNumberedHeader(text2, 2, replaceNumbers);
			ConfigManager.LastUsedFilter.Value = ((object)(FilterInfoType)(ref Settings.levelPreviewFilterType)).ToString();
			ConfigManager.LastUsedSort.Value = ((object)(SortInfoType)(ref Settings.levelPreviewSortType)).ToString();
			ConfigManager.LastUsedPreview.Value = ((object)(PreviewInfoType)(ref Settings.levelPreviewInfoType)).ToString();
			List<ExtendedLevel> list = new List<ExtendedLevel>();
			foreach (ExtendedLevelGroup extendedLevelGroup in val.ExtendedLevelGroups)
			{
				foreach (ExtendedLevel extendedLevels in extendedLevelGroup.extendedLevelsList)
				{
					if (!SharedMethods.IsMoonHiddenLLL(extendedLevels.SelectableLevel) || ConfigManager.AlwaysDisplayHiddenMoons.Value)
					{
						list.Add(extendedLevels);
					}
				}
			}
			int num = 1;
			foreach (ExtendedLevel item in list)
			{
				string text3 = item.NumberlessPlanetName;
				string value3 = Regex.Match(item.SelectableLevel.PlanetName, "^\\d+").Value;
				if (ConfigManager.ShowNumberedPlanetNames.Value)
				{
					text3 = value3.PadLeft(3, '0') + " " + text3;
				}
				if (value)
				{
					text3 = "* " + text3;
				}
				bool flag = (ConfigManager.ShowDifficultyInAll.Value && (int)Settings.levelPreviewInfoType == 4) || (int)Settings.levelPreviewInfoType == 1;
				int num2 = (flag ? (Settings.planetNameWidth - 2) : Settings.planetNameWidth);
				text3 = ((text3.Length <= Settings.planetNameWidth) ? (text3 ?? "").PadRight(num2) : (text3.Substring(0, num2 - 3) + "..."));
				int num3 = (flag ? 4 : 0);
				string levelRiskLevel = SharedMethods.GetLevelRiskLevel(item.SelectableLevel);
				string text4 = "";
				text4 = ((levelRiskLevel.Length <= num3) ? levelRiskLevel.PadRight(num3) : (levelRiskLevel.Substring(0, num3) ?? ""));
				string text5 = (((int)Settings.levelPreviewInfoType == 4 || (int)Settings.levelPreviewInfoType == 0) ? $"${SharedMethods.GetPrice(item.RoutePrice)}" : "");
				bool flag2 = (int)Settings.levelPreviewInfoType == 4 || (int)Settings.levelPreviewInfoType == 2;
				string weather = SharedMethods.GetWeather(item.SelectableLevel);
				string text6 = (flag2 ? weather.PadRight(Settings.planetWeatherWidth - 2) : "");
				string text7 = LLLCompatibility.InvokeMoonOverrideInfoEvent(item, Settings.levelPreviewInfoType);
				if (text7 != null && text7 != string.Empty)
				{
					Plugin.debugLogger.LogWarning((object)("override preview info for " + item.SelectableLevel.PlanetName + ":\n" + text7));
					Regex regex = new Regex("\\ {2,}");
					val2.AddRow(new object[3]
					{
						text3 + " " + regex.Replace(text7, "  "),
						"",
						""
					});
				}
				else
				{
					val2.AddRow(new object[3]
					{
						text3 + text4,
						text5 ?? "",
						(text6 ?? "").PadLeft(Settings.planetWeatherWidth)
					});
					val3.AddRow(new object[4] { text3, text5, text6, text4 });
				}
				if (Settings.moonsCatalogueSplitCount == 0)
				{
					continue;
				}
				if (num % Settings.moonsCatalogueSplitCount == 0)
				{
					num = 1;
					if (ConfigManager.ShowGroupDividerLines.Value)
					{
						val2.AddRow(new object[3]
						{
							"".PadRight(num2, '-'),
							"".PadRight(5, '-'),
							"".PadRight(Settings.planetWeatherWidth - 2, '-')
						});
					}
					else
					{
						val2.AddRow(new object[3] { "", "", "" });
					}
				}
				else
				{
					num++;
				}
			}
			string value4 = val2.ToStringCustomDecoration(false, false, false);
			stringBuilder.Append(value2);
			if (ConfigManager.ShowHelpText.Value)
			{
				stringBuilder.Append((AdditionalInfo != null) ? ("\n" + AdditionalInfo + "\n\n") : "");
			}
			stringBuilder.Append(((int)Settings.levelPreviewFilterType == 2) ? " If you enabled tag filtering by accident: \n Use the <color=#0be697>filter none</color> command to disable it.\n\n" : "");
			stringBuilder.Append($" The Company // Buying at {Mathf.RoundToInt(StartOfRound.Instance.companyBuyingRate * 100f)}% \n\n");
			stringBuilder.Append(value4);
			string text8 = stringBuilder.ToString().TrimEnd();
			Plugin.debugLogger.LogDebug((object)("All strings:\n" + val3.ToMinimalString()));
			Plugin.debugLogger.LogDebug((object)("Final string:\n" + text8));
			return text8;
		}
	}
	public class MoonsNoLLL : TerminalFormatterNode
	{
		public MoonsNoLLL()
			: base("Moons", new List<string>(1) { "MoonsCatalogue" })
		{
			AdditionalInfo = " Welcome to the exomoons catalogue! \n Use ROUTE to set the autopilot. \n Use INFO to learn about a moon.";
		}

		public override bool IsNodeValid(TerminalNode node, Terminal terminal)
		{
			return true;
		}

		public override string GetNodeText(TerminalNode node, Terminal terminal)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			ConsoleTable val = new ConsoleTable(new string[3] { "Name", "Price", "Weather" });
			StringBuilder stringBuilder = new StringBuilder();
			string text = "MOONS CATALOGUE";
			string value = new Header().CreateNumberedHeader(text);
			bool value2 = ConfigManager.ShowDecorations.Value;
			List<Route> list = (from keyval in ContentManager.Routes.Where((Route keyval) => (Object)(object)keyval.Nodes.Node != (Object)null).ToList()
				orderby Settings.MoonsOrderVanilla.IndexOf(SharedMethods.GetNumberlessPlanetName(keyval.Level))
				select keyval).ToList();
			int num = 1;
			if (value2)
			{
				val.AddRow(new object[3] { "", "", "" });
			}
			foreach (Route item in list)
			{
				SelectableLevel level = item.Level;
				if (!ConfigManager.AlwaysDisplayHiddenMoons.Value)
				{
					if (Settings.HiddenMoons.Contains(level.PlanetName) || Settings.MoonsToIgnore.Contains(level.PlanetName))
					{
						continue;
					}
				}
				else if (Settings.MoonsToIgnore.Contains(level.PlanetName))
				{
					continue;
				}
				int price = SharedMethods.GetPrice(item.Nodes.Node.itemCost);
				string text2 = (ConfigManager.ShowNumberedPlanetNames.Value ? level.PlanetName : SharedMethods.GetNumberlessPlanetName(level));
				if (value2)
				{
					text2 = "* " + text2;
				}
				val.AddRow(new object[3]
				{
					text2,
					$"${price}",
					SharedMethods.GetWeather(level).PadRight(Settings.planetWeatherWidth)
				});
				if (num % 3 == 0)
				{
					num = 1;
					val.AddRow(new object[3] { "", "", "" });
				}
				else
				{
					num++;
				}
			}
			stringBuilder.Append(value);
			stringBuilder.Append((AdditionalInfo != null) ? (AdditionalInfo + "\n\n") : "");
			stringBuilder.Append($" The Company is buying at {Mathf.RoundToInt(StartOfRound.Instance.companyBuyingRate * 100f)}%. \n\n");
			stringBuilder.Append(val.ToStringCustomDecoration(true, false, false));
			return stringBuilder.ToString();
		}
	}
	public class Route : TerminalFormatterNode
	{
		public Route()
			: base("Route", new List<string>(2) { "route", "Route" })
		{
		}

		public Route ResolveNodeIntoRoute(TerminalNode node)
		{
			return ContentManager.Routes.Where((Route x) => (Object)(object)x.Nodes.Node == (Object)(object)node).FirstOrDefault();
		}

		public override bool IsNodeValid(TerminalNode node, Terminal terminal)
		{
			Route val = ResolveNodeIntoRoute(node);
			return val != null;
		}

		public override string GetNodeText(TerminalNode node, Terminal terminal)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			ConsoleTable val = new ConsoleTable(new string[2] { "Title", "Things" });
			Route val2 = ResolveNodeIntoRoute(node);
			string value = new Header().CreateHeaderWithoutLines("CONFIRM ROUTE");
			StringBuilder stringBuilder = new StringBuilder();
			SelectableLevel level = val2.Level;
			string weather = SharedMethods.GetWeather(level);
			int price = SharedMethods.GetPrice(node.itemCost);
			val.AddRow(new object[2]
			{
				"PLANET:",
				SharedMethods.GetNumberlessPlanetName(level)
			});
			val.AddRow(new object[2]
			{
				"PRICE:",
				$"${price} (${terminal.groupCredits - price} after routing)"
			});
			val.AddRow(new object[2]
			{
				"WEATHER:",
				(weather == "") ? "Clear" : weather
			});
			stringBuilder.Append(value);
			stringBuilder.Append("\n\n");
			stringBuilder.Append("Please CONFIRM or DENY routing the autopilot:");
			stringBuilder.Append("\n\n");
			stringBuilder.Append(val.ToStringCustomDecoration(false, false, false));
			return stringBuilder.ToString();
		}
	}
	public class RouteAfter : TerminalFormatterNode
	{
		public RouteAfter()
			: base("RouteAfter", new List<string>(2) { "route", "Route" })
		{
		}

		public Route ResolveNodeIntoRoute(TerminalNode node)
		{
			return ContentManager.Routes.Where((Route x) => (Object)(object)x.Nodes.NodeConfirm == (Object)(object)node).FirstOrDefault();
		}

		public override bool IsNodeValid(TerminalNode node, Terminal terminal)
		{
			Route val = ResolveNodeIntoRoute(node);
			return val != null;
		}

		public override string GetNodeText(TerminalNode node, Terminal terminal)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			ConsoleTable val = new ConsoleTable(new string[2] { "Title", "Things" });
			Route val2 = ResolveNodeIntoRoute(node);
			string value = new Header().CreateHeaderWithoutLines("SUCCESS!");
			StringBuilder stringBuilder = new StringBuilder();
			SelectableLevel level = val2.Level;
			string weather = SharedMethods.GetWeather(level);
			int price = SharedMethods.GetPrice(node.itemCost);
			val.AddRow(new object[2]
			{
				"PLANET:",
				SharedMethods.GetNumberlessPlanetName(level)
			});
			val.AddRow(new object[2]
			{
				"WEATHER:",
				(weather == "") ? "Clear" : weather
			});
			stringBuilder.Append(value);
			stringBuilder.Append("\n\n");
			stringBuilder.Append("Thank you for your purchase!\n");
			stringBuilder.Append("You're currently headed to:");
			stringBuilder.Append("\n\n");
			stringBuilder.Append(val.ToStringCustomDecoration(false, false, false));
			return stringBuilder.ToString();
		}
	}
	public class RouteLocked : TerminalFormatterNode
	{
		public RouteLocked()
			: base("RouteLocked", new List<string>(1) { "RouteLocked" })
		{
		}

		public override bool IsNodeValid(TerminalNode node, Terminal terminal)
		{
			return true;
		}

		public override string GetNodeText(TerminalNode node, Terminal terminal)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			ConsoleTable val = new ConsoleTable(new string[2] { "Title", "Things" });
			string value = new Header().CreateHeaderWithoutLines("ROUTE LOCKED");
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(value);
			stringBuilder.Append("\n\n");
			stringBuilder.Append("You cannot currently route to the selected moon.");
			stringBuilder.Append("\n\n");
			stringBuilder.Append(val.ToStringCustomDecoration(false, false, false));
			return stringBuilder.ToString();
		}
	}
	public class Scan : TerminalFormatterNode
	{
		public Scan()
			: base("Scan", new List<string>(1) { "ScanInfo" })
		{
		}

		public override bool IsNodeValid(TerminalNode node, Terminal terminal)
		{
			return true;
		}

		public override string GetNodeText(TerminalNode node, Terminal terminal)
		{
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			StringBuilder stringBuilder = new StringBuilder();
			bool flag = StartOfRound.Instance.inShipPhase;
			if (StartOfRound.Instance.currentLevel.PlanetName.Contains("Gordion"))
			{
				flag = true;
			}
			int num = 0;
			int num2 = 0;
			List<GrabbableObject> source = ((!flag) ? (from item in Object.FindObjectsOfType<GrabbableObject>()
				where item.itemProperties.isScrap && !item.isInShipRoom && !item.isInElevator
				select item).ToList() : (from item in Object.FindObjectsOfType<GrabbableObject>()
				where item.itemProperties.isScrap && (item.isInElevator || item.isInShipRoom)
				select item).ToList());
			source = source.OrderBy((GrabbableObject x) => x.scrapValue).ToList();
			ConsoleTable val = new ConsoleTable(new string[3] { "Name", "Price", "Two-handed?" });
			foreach (GrabbableObject item in source)
			{
				val.AddRow(new object[3]
				{
					item.itemProperties.itemName.PadRight(Settings.itemNameWidth),
					$"${item.scrapValue}",
					item.itemProperties.twoHanded ? "●" : "○"
				});
				num++;
				num2 += item.scrapValue;
			}
			string text = "SCANNER";
			Dictionary<int, string> replaceNumbers = new Dictionary<int, string>
			{
				{
					0,
					"SCANNING " + (flag ? "SHIP" : "MOON")
				},
				{
					1,
					"ITEMS: " + num
				},
				{
					2,
					"VALUE: $" + num2
				}
			};
			string value = new Header().CreateNumberedHeader(text, 2, replaceNumbers);
			stringBuilder.Append(value);
			if (ConfigManager.DetailedScanPage.Value || flag)
			{
				stringBuilder.Append(val.ToStringCustomDecoration(true, false, false));
			}
			return stringBuilder.ToString();
		}
	}
	public class Simulate : TerminalFormatterNode
	{
		public Simulate()
			: base("Simulate", new List<string>(1) { "simulate" })
		{
		}

		public override bool IsNodeValid(TerminalNode node, Terminal terminal)
		{
			return true;
		}

		public override string GetNodeText(TerminalNode node, Terminal terminal)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			ConsoleTable val = new ConsoleTable(new string[3] { "Interior", "Weight", "Chance" });
			List<ExtendedLevel> extendedLevels = PatchedContent.ExtendedLevels;
			ExtendedLevel val2 = extendedLevels.Where((ExtendedLevel level) => Extensions.Sanitized(node.terminalEvent.ToString().ToLower()).Contains(Extensions.Sanitized(level.NumberlessPlanetName.ToLower()).Replace("-", ""))).FirstOrDefault();
			Dictionary<int, string> replaceNumbers = new Dictionary<int, string> { 
			{
				1,
				"PLANET: " + val2.NumberlessPlanetName
			} };
			string value = new Header().CreateNumberedHeader("SIMULATING ARRIVAL", 2, replaceNumbers);
			List<ExtendedDungeonFlowWithRarity> validExtendedDungeonFlows = DungeonManager.GetValidExtendedDungeonFlows(val2, false);
			validExtendedDungeonFlows.OrderBy((ExtendedDungeonFlowWithRarity o) => -o.rarity).ToList();
			int totalRarityPool = 0;
			CollectionExtensions.Do<ExtendedDungeonFlowWithRarity>((IEnumerable<ExtendedDungeonFlowWithRarity>)validExtendedDungeonFlows, (Action<ExtendedDungeonFlowWithRarity>)delegate(ExtendedDungeonFlowWithRarity dungeonFlow)
			{
				totalRarityPool += dungeonFlow.rarity;
			});
			foreach (ExtendedDungeonFlowWithRarity item in validExtendedDungeonFlows)
			{
				val.AddRow(new object[3]
				{
					item.extendedDungeonFlow.DungeonName.PadRight(Settings.planetNameWidth),
					item.rarity,
					(((float)item.rarity / (float)totalRarityPool * 100f).ToString("F2") + "%").PadLeft(4)
				});
			}
			val.AddRow(new object[3] { "", "", "" });
			val.AddRow(new object[3] { "", "", "" });
			val.AddRow(new object[3]
			{
				"",
				totalRarityPool.ToString().PadRight(6),
				"100%".ToString().PadLeft(4)
			});
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(value);
			if (val2.NumberlessPlanetName == "March")
			{
				stringBuilder.AppendLine("\nData for March will always be innacurate\n");
			}
			stringBuilder.Append("\n");
			stringBuilder.Append(val.ToStringCustomDecoration(true, false, false));
			return stringBuilder.ToString();
		}
	}
	public class Storage : TerminalFormatterNode
	{
		public Storage()
			: base("Storage", new List<string>(1) { "ItemsInStorage" })
		{
			AdditionalInfo = " Welcome to the Storage! \n Type item's name to retrieve it. \n To store items, use [X] while moving the object.";
		}

		public override string GetNodeText(TerminalNode node, Terminal terminal)
		{
			string value = new Header().CreateHeaderWithoutLines("STORAGE");
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(value);
			if (ConfigManager.ShowHelpText.Value)
			{
				stringBuilder.Append((AdditionalInfo != null) ? ("\n" + AdditionalInfo + "\n\n") : "");
			}
			else
			{
				stringBuilder.Append("\n");
			}
			List<UnlockableItem> list = StartOfRound.Instance.unlockablesList.unlockables.Where((UnlockableItem unlockable) => unlockable.inStorage).ToList();
			if (list.Count == 0)
			{
				stringBuilder.Append("No items stored.\n");
				return stringBuilder.ToString();
			}
			foreach (UnlockableItem item in list)
			{
				if (ConfigManager.ShowDecorations.Value)
				{
					stringBuilder.Append(" * ");
				}
				else
				{
					stringBuilder.Append(" ");
				}
				stringBuilder.Append(item.unlockableName);
				stringBuilder.Append("\n");
			}
			return stringBuilder.ToString();
		}
	}
	public class Store : TerminalFormatterNode
	{
		public Store()
			: base("Store", new List<string>(1) { "0_StoreHub" })
		{
			AdditionalInfo = " Welcome to the Company store. \n Use words BUY and INFO on any item. \n Order items in bulk by typing a number.";
		}

		public override bool IsNodeValid(TerminalNode node, Terminal terminal)
		{
			return true;
		}

		public override string GetNodeText(TerminalNode node, Terminal terminal)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			ConsoleTable val = new ConsoleTable(new string[3] { "Name", "Price", "Owned" });
			StringBuilder stringBuilder = new StringBuilder();
			object obj = (Variables.IsACActive ? ACCompatibility.ServerConfiguration.GetValue(null) : null);
			GameObject val2 = GameObject.Find("/Environment/HangarShip");
			List<GrabbableObject> list = val2.GetComponentsInChildren<GrabbableObject>().ToList();
			bool value = ConfigManager.ShowDecorations.Value;
			string text = "COMPANY STORE";
			string value2 = new Header().CreateHeaderWithoutLines(text);
			stringBuilder.Append(value2);
			if (ConfigManager.ShowHelpText.Value)
			{
				stringBuilder.Append((AdditionalInfo != null) ? ("\n" + AdditionalInfo + "\n\n") : "");
			}
			val.AddRow(new object[3] { "[ITEMS]", "", "" });
			if (value)
			{
				val.AddRow(new object[3]
				{
					new string('-', Settings.dividerLength) ?? "",
					"",
					""
				});
			}
			List<BuyableItem> list2 = ContentManager.Items.OrderBy((BuyableItem x) => x.Item.itemName).ToList();
			int num = 1;
			foreach (BuyableItem item2 in list2)
			{
				Item item = item2.Item;
				int buyItemIndex = ((BuyableThing)item2).Nodes.Node.buyItemIndex;
				string text2 = item.itemName;
				int count = list.FindAll((GrabbableObject x) => x.itemProperties.itemName == item.itemName).Count;
				int discount = item2.Discount;
				if (buyItemIndex == -1)
				{
					continue;
				}
				if (value)
				{
					text2 = "* " + text2;
				}
				if (Plugin.isLLibPresent && LethalLibCompatibility.IsLLItemDisabled(item))
				{
					continue;
				}
				if (ACCompatibility.Items.ContainsKey(text2) && !ACCompatibility.Items[text2])
				{
					Plugin.logger.LogDebug((object)("Item " + text2 + " is disabled"));
					continue;
				}
				string text3 = ((item2.Discount != 0) ? string.Format(" {0}-{1}%{2}", value ? "(" : "", discount, value ? ")" : "") : "");
				text2 = ((text2.Length + text3.Length <= Settings.itemNameWidth) ? (text2.PadRight(Settings.itemNameWidth - text3.Length) + text3).PadRight(Settings.itemNameWidth) : (text2.Substring(0, Settings.itemNameWidth - 4 - text3.Length) + "... " + text3));
				val.AddRow(new object[3]
				{
					text2,
					$"${(int)((float)item.creditsWorth * item2.DiscountPercentage)}",
					((count == 0) ? "" : ("×" + count.ToString("D2"))) ?? ""
				});
				if (ConfigManager.DivideShopPage.Value == 0)
				{
					continue;
				}
				if (num % ConfigManager.DivideShopPage.Value == 0)
				{
					num = 1;
					if (ConfigManager.ShowGroupDividerLines.Value)
					{
						val.AddRow(new object[3]
						{
							"".PadRight(Settings.itemNameWidth, '-'),
							"".PadRight(5, '-'),
							"".PadRight(5, '-')
						});
					}
					else
					{
						val.AddRow(new object[3] { "", "", "" });
					}
				}
				else
				{
					num++;
				}
			}
			List<BuyableUnlockable> list3 = (from x in ContentManager.Unlockables
				orderby x.Unlockable.unlockableName
				where !x.IsUnlocked
				select x).ToList();
			if (list3.Count > 0)
			{
				val.AddRow(new object[3] { "", "", "" });
				val.AddRow(new object[3] { "[UPGRADES]", "", "" });
				num = 1;
				if (value)
				{
					val.AddRow(new object[3]
					{
						new string('-', Settings.dividerLength) ?? "",
						"",
						""
					});
				}
			}
			foreach (BuyableUnlockable item3 in list3)
			{
				UnlockableItem unlockable = item3.Unlockable;
				bool flag = unlockable.hasBeenUnlockedByPlayer || unlockable.alreadyUnlocked;
				TerminalNode node2 = ((BuyableThing)item3).Nodes.Node;
				string text4 = unlockable.unlockableName;
				if (value)
				{
					text4 = "* " + text4;
				}
				if ((Plugin.isLLibPresent && LethalLibCompatibility.IsLLUpgradeDisabled(unlockable)) || flag)
				{
					continue;
				}
				val.AddRow(new object[3]
				{
					text4.PadRight(Settings.itemNameWidth),
					$"${((BuyableThing)item3).Price}",
					""
				});
				if (ConfigManager.DivideShopPage.Value == 0)
				{
					continue;
				}
				if (num % ConfigManager.DivideShopPage.Value == 0)
				{
					num = 1;
					if (ConfigManager.ShowGroupDividerLines.Value)
					{
						val.AddRow(new object[3]
						{
							"".PadRight(Settings.itemNameWidth, '-'),
							"".PadRight(5, '-'),
							"".PadRight(5, '-')
						});
					}
					else
					{
						val.AddRow(new object[3] { "", "", "" });
					}
				}
				else
				{
					num++;
				}
			}
			if (Plugin.isLRegenPresent && !LethalRegenCompatibility.IsUpgradeBought() && LethalRegenCompatibility.IsUpgradeInStore)
			{
				val.AddRow(new object[3] { "", "", "" });
				val.AddRow(new object[3] { "[REGENERATION]", "", "" });
				if (value)
				{
					val.AddRow(new object[3]
					{
						new string('-', Settings.dividerLength) ?? "",
						"",
						""
					});
				}
				val.AddRow(new object[3]
				{
					"Natural Regeneration",
					$"${LethalRegenCompatibility.GetCost()}",
					""
				});
			}
			val.AddRow(new object[3] { "", "", "" });
			val.AddRow(new object[3] { "[VEHICLES]", "", "" });
			num = 1;
			if (value)
			{
				val.AddRow(new object[3]
				{
					new string('-', Settings.dividerLength) ?? "",
					"",
					""
				});
			}
			List<BuyableCar> list4 = ContentManager.Vehicles.OrderBy((BuyableCar x) => ((BuyableThing)x).Name).ToList();
			foreach (BuyableCar item4 in list4)
			{
				string text5 = ((BuyableThing)item4).Name;
				if (value)
				{
					text5 = "* " + text5;
				}
				val.AddRow(new object[3]
				{
					text5,
					$"${((BuyableThing)item4).Price}",
					""
				});
				if (ConfigManager.DivideShopPage.Value == 0)
				{
					continue;
				}
				if (num % ConfigManager.DivideShopPage.Value == 0)
				{
					num = 1;
					if (ConfigManager.ShowGroupDividerLines.Value)
					{
						val.AddRow(new object[3]
						{
							"".PadRight(Settings.itemNameWidth, '-'),
							"".PadRight(5, '-'),
							"".PadRight(5, '-')
						});
					}
					else
					{
						val.AddRow(new object[3] { "", "", "" });
					}
				}
				else
				{
					num++;
				}
			}
			List<BuyableDecoration> list5 = (from x in ContentManager.Decorations
				orderby ((BuyableThing)x).Name
				where x.InRotation && !((BuyableUnlockable)x).IsUnlocked
				select x).ToList();
			if (list5.Count > 0)
			{
				val.AddRow(new object[3] { "", "", "" });
				val.AddRow(new object[3] { "[DECORATIONS]", "", "" });
				if (value)
				{
					val.AddRow(new object[3]
					{
						new string('-', Settings.dividerLength) ?? "",
						"",
						""
					});
				}
			}
			num = 1;
			foreach (BuyableDecoration item5 in list5)
			{
				UnlockableItem decoration = item5.Decoration;
				string text6 = ((BuyableThing)item5).Name;
				if (value)
				{
					text6 = "* " + text6;
				}
				if ((Plugin.isLLibPresent && LethalLibCompatibility.IsLLUpgradeDisabled(decoration)) || decoration.hasBeenUnlockedByPlayer || decoration.alreadyUnlocked)
				{
					continue;
				}
				if (Plugin.isSRCPresent)
				{
					int discount2;
					int discountedPrice = StoreRotationConfigCompatibility.GetDiscountedPrice((BuyableThing)(object)item5, out discount2);
					if (discount2 > 0)
					{
						string text7 = string.Format(" {0}-{1}%{2}", value ? ((object)'(') : "", discount2, value ? ((object)')') : "");
						text6 = ((text6.Length + text7.Length <= Settings.itemNameWidth) ? (text6.PadRight(Settings.itemNameWidth - text7.Length) + text7).PadRight(Settings.itemNameWidth) : (text6.Substring(0, Settings.itemNameWidth - 4 - text7.Length) + "..." + text7));
					}
					val.AddRow(new object[3]
					{
						text6,
						$"${discountedPrice}",
						""
					});
				}
				else
				{
					val.AddRow(new object[3]
					{
						text6,
						$"${((BuyableThing)item5).Price}",
						""
					});
				}
				if (ConfigManager.DivideShopPage.Value == 0)
				{
					continue;
				}
				if (num % ConfigManager.DivideShopPage.Value == 0)
				{
					num = 1;
					if (ConfigManager.ShowGroupDividerLines.Value)
					{
						val.AddRow(new object[3]
						{
							"".PadRight(Settings.itemNameWidth, '-'),
							"".PadRight(5, '-'),
							"".PadRight(5, '-')
						});
					}
					else
					{
						val.AddRow(new object[3] { "", "", "" });
					}
				}
				else
				{
					num++;
				}
			}
			List<BuyableSuit> list6 = (from x in ContentManager.Suits
				orderby ((BuyableThing)x).Name
				where x.InRotation && !x.IsUnlocked
				select x).ToList();
			if (list6.Count > 0)
			{
				val.AddRow(new object[3] { "", "", "" });
				val.AddRow(new object[3] { "[SUITS]", "", "" });
				num = 1;
				if (value)
				{
					val.AddRow(new object[3]
					{
						new string('-', Settings.dividerLength) ?? "",
						"",
						""
					});
				}
			}
			foreach (BuyableSuit item6 in list6)
			{
				UnlockableItem suit = item6.Suit;
				string text8 = ((BuyableThing)item6).Name;
				if (value)
				{
					text8 = "* " + text8;
				}
				if (item6.IsUnlocked)
				{
					continue;
				}
				if (Plugin.isSRCPresent)
				{
					int discount3;
					int discountedPrice2 = StoreRotationConfigCompatibility.GetDiscountedPrice((BuyableThing)(object)item6, out discount3);
					if (discount3 > 0)
					{
						string text9 = string.Format(" {0}-{1}%{2}", value ? ((object)'(') : "", discount3, value ? ((object)')') : "");
						text8 = ((text8.Length + text9.Length <= Settings.itemNameWidth) ? (text8.PadRight(Settings.itemNameWidth - text9.Length) + text9).PadRight(Settings.itemNameWidth) : (text8.Substring(0, Settings.itemNameWidth - 4 - text9.Length) + "..." + text9));
					}
					val.AddRow(new object[3]
					{
						text8,
						$"${discountedPrice2}",
						""
					});
				}
				else
				{
					val.AddRow(new object[3]
					{
						text8,
						$"${((BuyableThing)item6).Price}",
						""
					});
				}
				if (ConfigManager.DivideShopPage.Value == 0)
				{
					continue;
				}
				if (num % ConfigManager.DivideShopPage.Value == 0)
				{
					num = 1;
					if (ConfigManager.ShowGroupDividerLines.Value)
					{
						val.AddRow(new object[3]
						{
							"".PadRight(Settings.itemNameWidth, '-'),
							"".PadRight(5, '-'),
							"".PadRight(5, '-')
						});
					}
					else
					{
						val.AddRow(new object[3] { "", "", "" });
					}
				}
				else
				{
					num++;
				}
			}
			val.AddRow(new object[3] { "", "", "" });
			string value3 = val.ToStringCustomDecoration(true, true, false);
			stringBuilder.Append(value3);
			return stringBuilder.ToString().TrimEnd();
		}
	}
}
namespace TerminalFormatter.Compatibility
{
	internal class StoreRotationConfigCompatibility : CompatibilityBase
	{
		public StoreRotationConfigCompatibility(string guid, string version = null)
			: base(guid, version)
		{
			if (((CompatibilityBase)this).IsModPresent)
			{
				Init();
			}
		}

		public static void Init()
		{
			if (!Plugin.isSRCPresent)
			{
				UnpatchTerminalScroll();
			}
			Plugin.isSRCPresent = true;
		}

		public static int GetDiscountedPrice(BuyableThing buyable, out int discount)
		{
			return RotationSalesAPI.GetDiscountedPrice(buyable.Nodes.Node, ref discount);
		}

		public static void UnpatchTerminalScroll()
		{
			Plugin.harmony.Unpatch((MethodBase)AccessTools.Method(typeof(PlayerControllerB), "ScrollMouse_performed", (Type[])null, (Type[])null), (HarmonyPatchType)3, "pacoito.StoreRotationConfig");
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}