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 TerminalFormatter.Nodes;
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.23.0")]
[assembly: AssemblyInformationalVersion("0.2.23+8acc1c191236ec6240bb8b0e14afbd66af3922c7")]
[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";
Type type = ((object)Chainloader.PluginInfos[assemblyName].Instance).GetType().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_005a: Unknown result type (might be due to invalid IL or missing references)
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)
{
CollectionExtensions.Do<KeyValuePair<string, ItemConfig>>((IEnumerable<KeyValuePair<string, ItemConfig>>)((ItemsConfig)field.GetValue(value)).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_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
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_004a: Unknown result type (might be due to invalid IL or missing references)
Type typeFromHandle = typeof(TerminalManager);
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)
{
return invocationList[num].DynamicInvoke(args) 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)
new Harmony("TerminalFormatter LQ");
Plugin.isLQPresent = true;
}
public static string GetLevelRiskLevel(SelectableLevel level)
{
LevelPreset value;
return (((Dictionary<Guid, LevelPreset>)((object)Plugin.INSTANCE).GetType().GetField("presets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(Plugin.INSTANCE)).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()
{
Type type = ((object)Chainloader.PluginInfos["WeatherTweaks"].Instance).GetType().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");
}
}
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.23")]
[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 CompatibilityBase LGUCompat;
internal static CompatibilityBase LQCompat;
private void Awake()
{
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Expected O, but got Unknown
logger = ((BaseUnityPlugin)this).Logger;
harmony.PatchAll();
ConfigManager.Init(((BaseUnityPlugin)this).Config);
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;
if (LLLOldPlugin.IsTheOldLLLActive())
{
new MoonsOldLLL();
new SimulateOldLLL();
}
else
{
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");
if (Chainloader.PluginInfos.ContainsKey("WeatherTweaks"))
{
logger.LogWarning((object)"WeatherTweaks found, setting up compatibility patches");
WeatherTweaksCompatibility.Init();
isWTPresent = true;
}
new TerminalFormatter.Nodes.Route();
new RouteAfter();
new Scan();
new Store();
new Buy();
new BuyAfter();
new CannotAfford();
LockedNode = Object.Instantiate<TerminalNode>(new TerminalNode
{
name = "RouteLocked",
clearPreviousText = true,
acceptAnything = true,
displayText = "You cannot route to the selected moon. The route is locked.",
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 abstract bool IsNodeValid(TerminalNode node, Terminal terminal);
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.LogWarning((object)("Registered node " + name));
}
}
[HarmonyPatch(typeof(Terminal))]
[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 route = Variables.Routes.Where((Route x) => (Object)(object)x.Nodes.Node == (Object)(object)node).FirstOrDefault();
if ((Object)(object)route == (Object)null)
{
Plugin.debugLogger.LogDebug((object)"Level is null");
return true;
}
if ((Object)(object)route.Level == (Object)null)
{
return true;
}
if (SharedMethods.IsMoonLockedLLL(route.Level))
{
Plugin.debugLogger.LogInfo((object)"Node is locked!!");
__instance.LoadNewNode(Plugin.LockedNode);
return false;
}
return true;
}
[HarmonyPostfix]
[HarmonyAfter(new string[] { "imabatby.lethallevelloader" })]
[HarmonyPatch("LoadNewNode")]
public static void StartPostfix(Terminal __instance, ref TerminalNode node)
{
Variables.BuyableItemList = __instance.buyableItemsList.ToList();
Variables.UnlockableItemList = StartOfRound.Instance.unlockablesList.unlockables.Where((UnlockableItem x) => x.unlockableType == 1 && x.alwaysInStock).ToList();
Variables.DecorationsList = __instance.ShipDecorSelection;
if (Variables.IsACActive)
{
ACCompatibility.Refresh();
}
if (Settings.firstUse && Variables.ISLLLActive)
{
LLLCompatibility.GetLLLSettings();
}
node.clearPreviousText = 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)
{
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);
}
}
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;
}
[HarmonyPostfix]
[HarmonyPatch("Start")]
public static void StartPostfix2(Terminal __instance)
{
Variables.Reset();
Plugin.debugLogger.LogDebug((object)"Terminal Start");
Variables.Terminal = __instance;
List<TerminalNode> Nodes = Resources.FindObjectsOfTypeAll<TerminalNode>().ToList();
Variables.Nodes = Nodes;
List<SelectableLevel> gameLevels = SharedMethods.GetGameLevels();
int i;
for (i = 0; i < gameLevels.Count; i++)
{
SelectableLevel val = gameLevels[i];
List<TerminalNode> list = Nodes.Where((TerminalNode x) => x.buyRerouteToMoon == i || x.displayPlanetInfo == i).Distinct().ToList();
if (((CompatibilityBase)Plugin.LLL).IsModPresent && list.Count > 2)
{
List<TerminalNode> LLLNodes = SharedMethods.GetLevelTerminalNodes(val);
list.RemoveAll((TerminalNode node) => !LLLNodes.Contains(node));
}
for (int j = 0; j < list.Count; j++)
{
Plugin.debugLogger.LogDebug((object)$"Node: {list[j]}");
_ = (Object)(object)list[j] == (Object)null;
}
RelatedNodes nodes = new RelatedNodes
{
Node = list.Where((TerminalNode node) => node.buyRerouteToMoon == -2).Distinct().ToList()
.FirstOrDefault(),
NodeConfirm = list.Where((TerminalNode node) => node.buyRerouteToMoon != -2).Distinct().ToList()
.LastOrDefault()
};
Variables.Routes.Add(new Route(val, nodes));
}
List<Item> buyableItems = __instance.buyableItemsList.ToList();
buyableItems.ForEach(delegate(Item item)
{
Plugin.debugLogger.LogDebug((object)("Item: " + item.itemName));
List<TerminalNode> list4 = Nodes.Where((TerminalNode x) => x.buyItemIndex == buyableItems.IndexOf(item)).ToList();
for (int m = 0; m < list4.Count; m++)
{
_ = (Object)(object)list4[m] == (Object)null;
}
RelatedNodes nodes2 = new RelatedNodes
{
Node = list4.Where((TerminalNode node) => node.isConfirmationNode && !((Object)node).name.ToLower().Contains("mapper")).Distinct().ToList()
.FirstOrDefault(),
NodeConfirm = list4.Where((TerminalNode node) => !node.isConfirmationNode && !((Object)node).name.ToLower().Contains("mapper")).Distinct().ToList()
.LastOrDefault()
};
Variables.Buyables.Add(new BuyableItem(__instance, nodes2));
});
List<UnlockableItem> unlockables = StartOfRound.Instance.unlockablesList.unlockables.ToList();
for (int k = 0; k < unlockables.Count; k++)
{
UnlockableItem unlockable = unlockables[k];
Plugin.debugLogger.LogDebug((object)("Unlockable: " + unlockable.unlockableName));
if ((Object)(object)unlockable.suitMaterial != (Object)null)
{
continue;
}
List<TerminalNode> list2 = Nodes.Where((TerminalNode x) => x.shipUnlockableID == unlockables.IndexOf(unlockable)).Distinct().ToList();
if (CheckPossibleNodeNull(list2))
{
continue;
}
RelatedNodes relatedNodes = new RelatedNodes
{
Node = list2.Where((TerminalNode node) => !node.buyUnlockable).Distinct().ToList()
.FirstOrDefault(),
NodeConfirm = list2.Where((TerminalNode node) => node.buyUnlockable).Distinct().ToList()
.LastOrDefault()
};
if (!((Object)(object)relatedNodes.Node == (Object)null) && !((Object)(object)relatedNodes.NodeConfirm == (Object)null))
{
if (unlockable.unlockableType == 1 && unlockable.alwaysInStock)
{
Variables.Buyables.Add(new BuyableUnlockable(__instance, relatedNodes));
}
else
{
Variables.Buyables.Add(new BuyableDecoration(__instance, relatedNodes));
}
}
}
List<BuyableVehicle> buyableVehicles = __instance.buyableVehicles.ToList();
for (int l = 0; l < buyableVehicles.Count; l++)
{
BuyableVehicle vehicle = buyableVehicles[l];
Plugin.debugLogger.LogDebug((object)("Vehicle: " + vehicle.vehicleDisplayName));
List<TerminalNode> list3 = Nodes.Where((TerminalNode x) => x.buyVehicleIndex == buyableVehicles.IndexOf(vehicle)).Distinct().ToList();
if (!CheckPossibleNodeNull(list3))
{
RelatedNodes relatedNodes2 = new RelatedNodes
{
Node = list3.Where((TerminalNode node) => node.isConfirmationNode).Distinct().ToList()
.FirstOrDefault(),
NodeConfirm = list3.Where((TerminalNode node) => !node.isConfirmationNode).Distinct().ToList()
.LastOrDefault()
};
if (!((Object)(object)relatedNodes2.Node == (Object)null) && !((Object)(object)relatedNodes2.NodeConfirm == (Object)null))
{
Variables.Buyables.Add(new BuyableCar(__instance, relatedNodes2));
}
}
}
}
internal static bool CheckPossibleNodeNull(List<TerminalNode> possibleNodes)
{
List<TerminalNode> list = new List<TerminalNode>();
for (int i = 0; i < possibleNodes.Count; i++)
{
Plugin.debugLogger.LogDebug((object)$"Node: {possibleNodes[i]}");
if (!((Object)(object)possibleNodes[i] == (Object)null) && possibleNodes[i].itemCost > 0)
{
list.Add(possibleNodes[i]);
}
}
return possibleNodes == list;
}
}
public enum PurchaseType
{
Item,
Unlockable,
Decoration,
Vehicle,
Moon
}
public class RelatedNodes
{
public TerminalNode Node;
public TerminalNode NodeConfirm;
}
public class BuyableThing : ScriptableObject
{
public string Name;
public int Price;
public PurchaseType Type;
public RelatedNodes Nodes;
public BuyableThing(Terminal terminal, RelatedNodes nodes)
{
Plugin.debugLogger.LogWarning((object)$"BuyableThing constructor: {terminal}, {nodes}");
Nodes = nodes;
}
}
public class BuyableItem : BuyableThing
{
public Item Item;
public BuyableItem(Terminal terminal, RelatedNodes nodes)
: base(terminal, nodes)
{
Type = PurchaseType.Item;
Item = terminal.buyableItemsList[nodes.Node.buyItemIndex];
Price = Item.creditsWorth;
Name = Item.itemName;
((Object)this).name = Name;
}
}
public class BuyableUnlockable : BuyableThing
{
public UnlockableItem Unlockable;
public BuyableUnlockable(Terminal terminal, RelatedNodes nodes)
: base(terminal, nodes)
{
Type = PurchaseType.Unlockable;
Unlockable = StartOfRound.Instance.unlockablesList.unlockables[Nodes.Node.shipUnlockableID];
int price = 0;
if ((Object)(object)Nodes.Node != (Object)null)
{
if (Nodes.Node.itemCost <= 0)
{
if (Variables.upgrades.ContainsKey(Unlockable.unlockableName))
{
Plugin.debugLogger.LogWarning((object)$"Unlockable {Unlockable.unlockableName} has an upgrade price of {Variables.upgrades[Unlockable.unlockableName]}");
price = Variables.upgrades[Unlockable.unlockableName];
}
else
{
Plugin.debugLogger.LogDebug((object)("Unlockable " + Unlockable.unlockableName + " does not have an upgrade price"));
price = Nodes.Node.itemCost;
}
}
else
{
price = Nodes.Node.itemCost;
}
}
Price = price;
Name = Unlockable.unlockableName;
((Object)this).name = Name;
}
}
public class BuyableDecoration : BuyableThing
{
public UnlockableItem Decoration;
public BuyableDecoration(Terminal terminal, RelatedNodes nodes)
: base(terminal, nodes)
{
Type = PurchaseType.Decoration;
UnlockableItem decoration = StartOfRound.Instance.unlockablesList.unlockables[Nodes.Node.shipUnlockableID];
Decoration = decoration;
Price = Decoration.shopSelectionNode.itemCost;
Name = Decoration.unlockableName;
((Object)this).name = Name;
}
}
public class BuyableCar : BuyableThing
{
public BuyableVehicle Vehicle;
public BuyableCar(Terminal terminal, RelatedNodes nodes)
: base(terminal, nodes)
{
Type = PurchaseType.Vehicle;
Vehicle = Variables.Terminal.buyableVehicles[nodes.Node.buyVehicleIndex];
Price = Vehicle.creditsWorth;
Name = Vehicle.vehicleDisplayName;
((Object)this).name = Name;
Variables.Vehicles.Add(this);
}
}
public class Route : ScriptableObject
{
public SelectableLevel Level;
public RelatedNodes Nodes;
public Route(SelectableLevel level, RelatedNodes nodes)
{
Level = level;
Nodes = nodes;
Plugin.debugLogger.LogWarning((object)$"Route constructor: {level}; {nodes.Node}, {nodes.NodeConfirm}");
((Object)this).name = Level.PlanetName;
}
}
public class Variables
{
public static List<Item> BuyableItemList = new List<Item>();
public static List<UnlockableItem> UnlockableItemList = new List<UnlockableItem>();
public static List<TerminalNode> DecorationsList = new List<TerminalNode>();
public static List<TerminalNode> Nodes = new List<TerminalNode>();
public static List<BuyableThing> Buyables = new List<BuyableThing>();
public static List<Route> Routes = new List<Route>();
public static List<BuyableCar> Vehicles = new List<BuyableCar>();
public static Terminal Terminal;
public static TerminalNode LastReplacedNode = null;
public static bool IsACActive = false;
public static bool ISLLLActive = false;
public static Dictionary<string, int> upgrades = new Dictionary<string, int>
{
{ "Teleporter", 375 },
{ "Signal translator", 255 },
{ "Loud horn", 100 },
{ "Inverse Teleporter", 425 }
};
public static void Reset()
{
Buyables.Clear();
Routes.Clear();
Nodes.Clear();
Vehicles.Clear();
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "TerminalFormatter";
public const string PLUGIN_NAME = "TerminalFormatter";
public const string PLUGIN_VERSION = "0.2.23";
}
}
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 Buy : TerminalFormatterNode
{
internal BuyableThing LastResolvedBuyable;
public Buy()
: base("Buy", new List<string>(5) { "buy", "BuyNode", "Buy", "Buy1", "Node1" })
{
}
public BuyableThing ResolveNodeIntoBuyable(TerminalNode node)
{
return Variables.Buyables.Where((BuyableThing x) => (Object)(object)x.Nodes.Node == (Object)(object)node || ((Object)x.Nodes.Node).name == ((Object)node).name).FirstOrDefault();
}
public override bool IsNodeValid(TerminalNode node, Terminal terminal)
{
BuyableThing buyableThing = ResolveNodeIntoBuyable(node);
if ((Object)(object)buyableThing != (Object)null)
{
Plugin.logger.LogDebug((object)$"Resolved Item: {buyableThing.Name}({buyableThing.Type})");
}
return (Object)(object)buyableThing != (Object)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 buyableThing = (LastResolvedBuyable = ResolveNodeIntoBuyable(node));
string value = new Header().CreateHeaderWithoutLines("CONFIRM PURCHASE");
StringBuilder stringBuilder = new StringBuilder();
val.AddRow(new object[2] { "ITEM:", buyableThing.Name });
bool flag = typeof(BuyableItem) == ((object)buyableThing).GetType();
if (flag)
{
val.AddRow(new object[2]
{
"PRICE:",
$"${buyableThing.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)
{
return Variables.Buyables.Where((BuyableThing x) => (Object)(object)x.Nodes.NodeConfirm == (Object)(object)node || ((Object)x.Nodes.NodeConfirm).name == ((Object)node).name).FirstOrDefault();
}
public override bool IsNodeValid(TerminalNode node, Terminal terminal)
{
return (Object)(object)ResolveNodeIntoBuyable(node) != (Object)null;
}
public override string GetNodeText(TerminalNode node, Terminal terminal)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
ConsoleTable val = new ConsoleTable(new string[2] { "Title", "Things" });
BuyableThing buyableThing = (LastResolvedBuyable = ResolveNodeIntoBuyable(node));
string value = new Header().CreateHeaderWithoutLines("SUCCESS!");
StringBuilder stringBuilder = new StringBuilder();
val.AddRow(new object[2] { "ITEM:", buyableThing.Name });
bool num = typeof(BuyableItem) == ((object)buyableThing).GetType();
int playerDefinedAmount = terminal.playerDefinedAmount;
stringBuilder.Append(value);
stringBuilder.Append("\n\n");
stringBuilder.Append("Thank you for your purchase!\n");
if (num)
{
stringBuilder.Append(string.Format("Your {0} ({1} x {2}) {3} on {4} way!", (playerDefinedAmount == 1) ? "item" : "items", terminal.playerDefinedAmount, buyableThing.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_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Expected O, but got Unknown
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Expected O, but got Unknown
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Expected O, but got Unknown
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: 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_06b1: Unknown result type (might be due to invalid IL or missing references)
//IL_06b7: 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_039c: Unknown result type (might be due to invalid IL or missing references)
//IL_03a2: Invalid comparison between Unknown and I4
//IL_0448: Unknown result type (might be due to invalid IL or missing references)
//IL_044e: Invalid comparison between Unknown and I4
//IL_0450: Unknown result type (might be due to invalid IL or missing references)
//IL_0456: Invalid comparison between Unknown and I4
//IL_0481: Unknown result type (might be due to invalid IL or missing references)
//IL_0487: Invalid comparison between Unknown and I4
//IL_0489: Unknown result type (might be due to invalid IL or missing references)
//IL_048f: Invalid comparison between Unknown and I4
//IL_04bd: 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));
}
}
}
typeof(TerminalManager).GetMethod("RefreshExtendedLevelGroups", BindingFlags.Static | BindingFlags.NonPublic).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;
}
int num2;
int num3;
if (!ConfigManager.ShowDifficultyInAll.Value || (int)Settings.levelPreviewInfoType != 4)
{
num2 = (((int)Settings.levelPreviewInfoType == 1) ? 1 : 0);
if (num2 == 0)
{
num3 = Settings.planetNameWidth;
goto IL_03c0;
}
}
else
{
num2 = 1;
}
num3 = Settings.planetNameWidth - 2;
goto IL_03c0;
IL_03c0:
int num4 = num3;
text3 = ((text3.Length <= Settings.planetNameWidth) ? (text3 ?? "").PadRight(num4) : (text3.Substring(0, num4 - 3) + "..."));
int num5 = ((num2 != 0) ? 4 : 0);
string levelRiskLevel = SharedMethods.GetLevelRiskLevel(item.SelectableLevel);
string text4 = "";
text4 = ((levelRiskLevel.Length <= num5) ? levelRiskLevel.PadRight(num5) : (levelRiskLevel.Substring(0, num5) ?? ""));
string text5 = (((int)Settings.levelPreviewInfoType == 4 || (int)Settings.levelPreviewInfoType == 0) ? $"${SharedMethods.GetPrice(item.RoutePrice)}" : "");
bool num6 = (int)Settings.levelPreviewInfoType == 4 || (int)Settings.levelPreviewInfoType == 2;
string weather = SharedMethods.GetWeather(item.SelectableLevel);
string text6 = (num6 ? 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(num4, '-'),
"".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 MoonsOldLLL : TerminalFormatterNode
{
public MoonsOldLLL()
: base("Moons", new List<string>(4) { "MoonsCatalogue", "preview", "sort", "filter" })
{
}
public override bool IsNodeValid(TerminalNode node, Terminal terminal)
{
return true;
}
public override string GetNodeText(TerminalNode node, Terminal terminal)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Invalid comparison between Unknown and I4
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Invalid comparison between Unknown and I4
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Invalid comparison between Unknown and I4
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Invalid comparison between Unknown and I4
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Invalid comparison between Unknown and I4
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Invalid comparison between Unknown and I4
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 text = "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: " + ((object)(FilterInfoType)(ref Settings.levelPreviewFilterType)).ToString().ToUpper()
}
};
string value = new Header().CreateNumberedHeader(text, 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();
foreach (ExtendedLevelGroup extendedLevelGroup in val.ExtendedLevelGroups)
{
foreach (ExtendedLevel extendedLevels in extendedLevelGroup.extendedLevelsList)
{
if (SharedMethods.IsMoonHiddenLLL(extendedLevels.selectableLevel))
{
continue;
}
string numberlessPlanetName = extendedLevels.NumberlessPlanetName;
int num;
int num2;
if (!ConfigManager.ShowDifficultyInAll.Value || (int)Settings.levelPreviewInfoType != 4)
{
num = (((int)Settings.levelPreviewInfoType == 1) ? 1 : 0);
if (num == 0)
{
num2 = Settings.planetNameWidth;
goto IL_01c4;
}
}
else
{
num = 1;
}
num2 = Settings.planetNameWidth - 2;
goto IL_01c4;
IL_01c4:
int num3 = num2;
numberlessPlanetName = ((numberlessPlanetName.Length <= Settings.planetNameWidth) ? (numberlessPlanetName ?? "").PadRight(num3) : (numberlessPlanetName.Substring(0, num3 - 3) + "..."));
numberlessPlanetName = ((numberlessPlanetName.Length <= Settings.planetNameWidth) ? (numberlessPlanetName ?? "").PadRight(Settings.planetNameWidth) : (numberlessPlanetName.Substring(0, Settings.planetNameWidth - 3) + "..."));
string text2 = ((num != 0) ? (" " + extendedLevels.selectableLevel.riskLevel.ToString().PadRight(2)) : "");
string text3 = (((int)Settings.levelPreviewInfoType == 4 || (int)Settings.levelPreviewInfoType == 0) ? $"${SharedMethods.GetPrice(extendedLevels.RoutePrice)}" : "");
bool num4 = (int)Settings.levelPreviewInfoType == 4 || (int)Settings.levelPreviewInfoType == 2;
string weatherCondition = SharedMethods.GetWeather(extendedLevels.selectableLevel);
if (weatherCondition.Length > Settings.planetWeatherWidth - 2 || ConfigManager.UseShortenedWeathers.Value)
{
CollectionExtensions.Do<KeyValuePair<string, string>>((IEnumerable<KeyValuePair<string, string>>)Settings.WeathersShortened, (Action<KeyValuePair<string, string>>)delegate(KeyValuePair<string, string> pair)
{
weatherCondition = Regex.Replace(weatherCondition, pair.Key, pair.Value);
});
}
string text4 = (num4 ? weatherCondition.PadRight(Settings.planetWeatherWidth - 2) : "");
val2.AddRow(new object[3]
{
numberlessPlanetName + text2,
text3 ?? "",
(text4 ?? "").PadLeft(Settings.planetWeatherWidth)
});
val3.AddRow(new object[4] { numberlessPlanetName, text3, text4, text2 });
}
val2.AddRow(new object[3] { "", "", "" });
}
string value2 = val2.ToStringCustomDecoration(false, false, false);
stringBuilder.Append(value);
stringBuilder.Append($" The Company // Buying at {Mathf.RoundToInt(StartOfRound.Instance.companyBuyingRate * 100f)}% \n\n");
stringBuilder.Append(value2);
string result = stringBuilder.ToString().TrimEnd();
Plugin.debugLogger.LogDebug((object)("All strings:\n" + val3.ToMinimalString()));
return result;
}
}
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<TerminalFormatter.Route> list = (from keyval in Variables.Routes.Where((TerminalFormatter.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 (TerminalFormatter.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 TerminalFormatter.Route ResolveNodeIntoRoute(TerminalNode node)
{
return Variables.Routes.Where((TerminalFormatter.Route x) => (Object)(object)x.Nodes.Node == (Object)(object)node).FirstOrDefault();
}
public override bool IsNodeValid(TerminalNode node, Terminal terminal)
{
return (Object)(object)ResolveNodeIntoRoute(node) != (Object)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" });
TerminalFormatter.Route route = ResolveNodeIntoRoute(node);
string value = new Header().CreateHeaderWithoutLines("CONFIRM ROUTE");
StringBuilder stringBuilder = new StringBuilder();
SelectableLevel level = route.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 TerminalFormatter.Route ResolveNodeIntoRoute(TerminalNode node)
{
return Variables.Routes.Where((TerminalFormatter.Route x) => (Object)(object)x.Nodes.NodeConfirm == (Object)(object)node).FirstOrDefault();
}
public override bool IsNodeValid(TerminalNode node, Terminal terminal)
{
return (Object)(object)ResolveNodeIntoRoute(node) != (Object)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" });
TerminalFormatter.Route route = ResolveNodeIntoRoute(node);
string value = new Header().CreateHeaderWithoutLines("SUCCESS!");
StringBuilder stringBuilder = new StringBuilder();
SelectableLevel level = route.Level;
string weather = SharedMethods.GetWeather(level);
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" });
ExtendedLevel val2 = PatchedContent.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 SimulateOldLLL : TerminalFormatterNode
{
public SimulateOldLLL()
: 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" });
ExtendedLevel val2 = PatchedContent.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> obj = (List<ExtendedDungeonFlowWithRarity>)typeof(DungeonManager).GetMethod("GetValidExtendedDungeonFlows", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, new object[2] { val2, false });
obj.OrderBy((ExtendedDungeonFlowWithRarity o) => -o.rarity).ToList();
int totalRarityPool = 0;
CollectionExtensions.Do<ExtendedDungeonFlowWithRarity>((IEnumerable<ExtendedDungeonFlowWithRarity>)obj, (Action<ExtendedDungeonFlowWithRarity>)delegate(ExtendedDungeonFlowWithRarity dungeonFlow)
{
totalRarityPool += dungeonFlow.rarity;
});
foreach (ExtendedDungeonFlowWithRarity item in obj)
{
val.AddRow(new object[3]
{
item.extendedDungeonFlow.dungeonDisplayName.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 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();
if (Variables.IsACActive)
{
ACCompatibility.ServerConfiguration.GetValue(null);
}
List<GrabbableObject> list = GameObject.Find("/Environment/HangarShip").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<Item> list2 = Variables.BuyableItemList.OrderBy((Item x) => x.itemName).ToList();
int num = 1;
foreach (Item item in list2)
{
int num2 = terminal.buyableItemsList.ToList().IndexOf(item);
string text2 = item.itemName;
int count = list.FindAll((GrabbableObject x) => x.itemProperties.itemName == item.itemName).Count;
if (num2 == -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 = ((terminal.itemSalesPercentages[num2] != 100) ? string.Format(" {0}-{1}%{2}", value ? "(" : "", 100 - terminal.itemSalesPercentages[num2], 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,
$"${(float)item.creditsWorth * ((float)terminal.itemSalesPercentages[num2] / 100f)}",
((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++;
}
}
val.AddRow(new object[3] { "", "", "" });
val.AddRow(new object[3] { "[UPGRADES]", "", "" });
num = 1;
if (value)
{
val.AddRow(new object[3]
{
new string('-', Settings.dividerLength) ?? "",
"",
""
});
}
Dictionary<string, int> dictionary = new Dictionary<string, int>
{
{ "Teleporter", 375 },
{ "Signal translator", 255 },
{ "Loud horn", 100 },
{ "Inverse Teleporter", 425 }
};
foreach (UnlockableItem item2 in Variables.UnlockableItemList.OrderBy((UnlockableItem x) => x.unlockableName).ToList())
{
bool flag = item2.hasBeenUnlockedByPlayer || item2.alreadyUnlocked;
TerminalNode val2 = item2.shopSelectionNode;
string text4 = item2.unlockableName;
if (value)
{
text4 = "* " + text4;
}
if (Plugin.isLLibPresent && LethalLibCompatibility.IsLLUpgradeDisabled(item2))
{
continue;
}
if ((Object)(object)val2 == (Object)null)
{
int index = StartOfRound.Instance.unlockablesList.unlockables.ToList().IndexOf(item2);
val2 = Object.FindObjectsOfType<TerminalNode>().ToList().Find((TerminalNode x) => x.shipUnlockableID == index);
}
if (flag)
{
continue;
}
val.AddRow(new object[3]
{
text4.PadRight(Settings.itemNameWidth),
$"${(Object.op_Implicit((Object)(object)val2) ? val2.itemCost : dictionary[item2.unlockableName])}",
""
});
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) ?? "",
"",
""
});
}
foreach (BuyableVehicle item3 in (from x in Variables.Vehicles
orderby x.Name
select x.Vehicle).ToList())
{
string text5 = item3.vehicleDisplayName;
if (value)
{
text5 = "* " + text5;
}
val.AddRow(new object[3]
{
text5,
$"${item3.creditsWorth}",
""
});
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] { "", "", "" });
val.AddRow(new object[3] { "[DECORATIONS]", "", "" });
if (value)
{
val.AddRow(new object[3]
{
new string('-', Settings.dividerLength) ?? "",
"",
""
});
}
List<TerminalNode> list3 = Variables.DecorationsList.OrderBy((TerminalNode x) => x.creatureName).ToList();
num = 1;
foreach (TerminalNode item4 in list3)
{
UnlockableItem val3 = StartOfRound.Instance.unlockablesList.unlockables[item4.shipUnlockableID];
string text6 = item4.creatureName;
if (value)
{
text6 = "* " + text6;
}
if ((Plugin.isLLibPresent && LethalLibCompatibility.IsLLUpgradeDisabled(val3)) || val3.hasBeenUnlockedByPlayer || val3.alreadyUnlocked)
{
continue;
}
val.AddRow(new object[3]
{
text6,
$"${item4.itemCost}",
""
});
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 System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}