Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Interactive Moon Catalogue Forked v1.2.0
InteractiveMoonCatalogueForked.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HarmonyLib; using InteractiveMoonCatalogue.Compat; using InteractiveMoonCatalogue.UI.Application; using InteractiveMoonCatalogue.UI.Cursor; using InteractiveMoonCatalogue.Util; using InteractiveMoonCatalogueForked.NetcodePatcher; using InteractiveTerminalAPI.UI; using InteractiveTerminalAPI.UI.Application; using InteractiveTerminalAPI.UI.Cursor; using InteractiveTerminalAPI.UI.Page; using InteractiveTerminalAPI.UI.Screen; using LethalLevelLoader; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 InteractiveMoonCatalogueForked { public static class PluginInfo { public const string PLUGIN_GUID = "InteractiveMoonCatalogueForked"; public const string PLUGIN_NAME = "ExtendDeadline"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace WeatherProbe.Misc { internal static class Metadata { public const string GUID = "com.github.SammySemicolon.InteractiveMoonCatalogue"; public const string NAME = "Interactive Moon Catalogue Forked"; public const string VERSION = "1.2.0"; } } namespace InteractiveMoonCatalogue { [BepInPlugin("com.github.SammySemicolon.InteractiveMoonCatalogue", "Interactive Moon Catalogue Forked", "1.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static readonly Harmony harmony = new Harmony("com.github.SammySemicolon.InteractiveMoonCatalogue"); internal static ManualLogSource mls; private void Awake() { InteractiveTerminalManager.RegisterApplication<MoonCatalogueApplication>("moons", false); mls = ((BaseUnityPlugin)this).Logger; mls.LogInfo((object)"Interactive Moon Catalogue Forked 1.2.0 has been loaded successfully."); } } } namespace InteractiveMoonCatalogue.Util { internal static class Tools { private static Terminal terminal; internal static Terminal GetTerminal() { if ((Object)(object)terminal == (Object)null) { terminal = GameObject.Find("TerminalScript").GetComponent<Terminal>(); } return terminal; } } } namespace InteractiveMoonCatalogue.UI.Cursor { internal class LevelCursorElement : CursorElement { public SelectableLevel Level { get; set; } public TerminalNode RouteNode { get; set; } public override string GetText(int availableLength) { StringBuilder sb = new StringBuilder(); bool flag = false; string text; if (LethalLevelLoaderCompat.Enabled && LethalLevelLoaderCompat.IsLocked(Level)) { text = "[???]"; } else { text = Level.PlanetName.Substring(Level.PlanetName.IndexOf(' ') + 1) ?? ""; if (text.Contains("Gordion")) { text += " / The Company"; } } Terminal terminal = Tools.GetTerminal(); int groupCredits = terminal.groupCredits; if (!((CursorElement)this).Active((CursorElement)(object)this)) { if ((Object)(object)Level == (Object)(object)StartOfRound.Instance.currentLevel) { sb.Append("<color=#026440>"); } else { sb.Append("<color=#66666666>"); } } sb.Append(text); if (LethalLevelLoaderCompat.Enabled && LethalLevelLoaderCompat.IsLocked(Level)) { sb.Append("</color>"); return sb.ToString(); } sb.Append(new string(' ', Mathf.Max(0, 14 - text.Length))); string previousText = ""; if (!string.IsNullOrEmpty(Level.riskLevel) && !Level.riskLevel.Contains("Safe")) { previousText = ((!Level.riskLevel.Contains("CORRUPTION")) ? (" (" + Level.riskLevel + ")") : " (Corrupted)"); } if (!string.IsNullOrEmpty(previousText)) { sb.Append(previousText); } AppendPriceText(ref sb, groupCredits, ref previousText); AppendWeatherText(ref sb, ref previousText); if (!((CursorElement)this).Active((CursorElement)(object)this)) { sb.Append("</color>"); } return sb.ToString(); } private void AppendPriceText(ref StringBuilder sb, int credits, ref string previousText) { int itemCost = RouteNode.itemCost; if (itemCost <= 0) { sb.Append(new string(' ', Mathf.Max(0, 9))); return; } sb.Append(new string(' ', Mathf.Max(0, 9 - previousText.Length))); if (itemCost > credits) { sb.Append("<color=#880000>"); sb.Append(itemCost); sb.Append("$"); sb.Append("</color>"); } else { sb.Append(itemCost); sb.Append("$"); } previousText = itemCost + "$"; } private void AppendWeatherText(ref StringBuilder sb, ref string previousText) { //IL_0021: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0059: Unknown result type (might be due to invalid IL or missing references) LevelWeatherType val = (Level.overrideWeather ? Level.overrideWeatherType : Level.currentWeather); if ((int)val != -1) { sb.Append(new string(' ', Mathf.Max(0, 9 - previousText.Length))); sb.Append($"({val})"); } } } } namespace InteractiveMoonCatalogue.UI.Application { internal class MoonCatalogueApplication : PageApplication<CursorElement> { private TerminalKeyword routeKeyword; protected override int GetEntriesPerPage<T>(T[] entries) { return 12; } public override void Initialization() { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown List<SelectableLevel> list = StartOfRound.Instance.levels.ToList(); SelectableLevel[] levels = StartOfRound.Instance.levels; levels = levels.Where((SelectableLevel x) => !x.PlanetName.Contains("Liquidation")).ToArray(); if (LethalLevelLoaderCompat.Enabled) { LethalLevelLoaderCompat.GrabAllAvailableLevels(ref levels); } (SelectableLevel[][], BaseCursorMenu<CursorElement>[], IScreen[]) pageEntries = base.GetPageEntries<SelectableLevel>(levels); SelectableLevel[][] item = pageEntries.Item1; BaseCursorMenu<CursorElement>[] item2 = pageEntries.Item2; IScreen[] item3 = pageEntries.Item3; for (int i = 0; i < item.Length; i++) { SelectableLevel[] array = item[i]; LevelCursorElement[] array2 = new LevelCursorElement[array.Length]; int num = i; CursorElement[] array3 = (CursorElement[])(object)array2; item2[num] = (BaseCursorMenu<CursorElement>)(object)CursorMenu<CursorElement>.Create(0, '>', array3, new Func<CursorElement, CursorElement, int>[1] { CompareElements }); BaseCursorMenu<CursorElement> val = item2[i]; ITextElement[] elements = (ITextElement[])(object)new ITextElement[3] { (ITextElement)TextElement.Create("Select the moon you wish to route to:"), (ITextElement)TextElement.Create(" "), (ITextElement)val }; item3[i] = (IScreen)new BoxedScreen { Title = "Moon Catalogue", elements = elements }; for (int j = 0; j < array.Length; j++) { SelectableLevel level = array[j]; if (!((Object)(object)level == (Object)null)) { TerminalNode routeNode = GetRouteNode(list.IndexOf(level)); int num2 = j; LevelCursorElement obj = new LevelCursorElement { Level = level, RouteNode = routeNode }; ((CursorElement)obj).Active = (CursorElement x) => CanPurchaseRoute((LevelCursorElement)(object)x); ((CursorElement)obj).SelectInactive = true; ((CursorElement)obj).Action = delegate { PurchaseRoute(level, routeNode); }; array2[num2] = obj; } } } base.currentPage = base.initialPage; ((BaseInteractiveApplication<CursorElement>)(object)this).currentCursorMenu = base.initialPage.GetCurrentCursorMenu(); ((TerminalApplication)this).currentScreen = ((PageElement)base.initialPage).GetCurrentScreen(); base.currentPage.ChangeSorting(); } private int CompareElements(CursorElement cursor1, CursorElement cursor2) { if (cursor1 == null) { return 1; } if (cursor2 == null) { return -1; } LevelCursorElement levelCursorElement = cursor1 as LevelCursorElement; LevelCursorElement levelCursorElement2 = cursor2 as LevelCursorElement; int itemCost = levelCursorElement.RouteNode.itemCost; int itemCost2 = levelCursorElement2.RouteNode.itemCost; if (itemCost == itemCost2) { int num = EvaluateRiskLevel(levelCursorElement); int num2 = EvaluateRiskLevel(levelCursorElement2); if (num == num2) { string text = levelCursorElement.Level.PlanetName.Substring(levelCursorElement.Level.PlanetName.IndexOf(' ') + 1); string strB = levelCursorElement2.Level.PlanetName.Substring(levelCursorElement2.Level.PlanetName.IndexOf(' ') + 1); return text.CompareTo(strB); } return num2.CompareTo(num); } return itemCost2.CompareTo(itemCost); } private int EvaluateRiskLevel(LevelCursorElement element) { string riskLevel = element.Level.riskLevel; int num = riskLevel.Count((char c) => c == '+'); int num2 = riskLevel.Count((char c) => c == '-'); riskLevel.Replace("+", ""); riskLevel.Replace("-", ""); riskLevel.Replace(" ", ""); if (1 == 0) { } int num3 = riskLevel switch { "D" => 100, "C" => 200, "B" => 300, "A" => 400, "S" => 500, _ => 1000, }; if (1 == 0) { } return num3 + num - num2; } private TerminalNode GetRouteNode(int levelIndex) { if ((Object)(object)routeKeyword == (Object)null) { routeKeyword = ((TerminalApplication)this).terminal.terminalNodes.allKeywords.First((TerminalKeyword k) => k.word == "route"); } for (int i = 0; i < routeKeyword.compatibleNouns.Length; i++) { TerminalNode result = routeKeyword.compatibleNouns[i].result; CompatibleNoun[] terminalOptions = result.terminalOptions; for (int j = 0; j < terminalOptions.Length; j++) { TerminalNode result2 = terminalOptions[j].result; if (!((Object)(object)result2 == (Object)null) && result2.buyRerouteToMoon == levelIndex) { return result2; } } } return null; } private void PurchaseRoute(SelectableLevel level, TerminalNode routeNode) { string planetName = level.PlanetName; Action action = delegate { base.ResetScreen(); }; if (!StartOfRound.Instance.inShipPhase) { ((InteractiveTerminalApplication<CursorElement>)(object)this).ErrorMessage(planetName, action, "You cannot travel to another moon while landed on one!"); return; } if (StartOfRound.Instance.travellingToNewLevel) { ((InteractiveTerminalApplication<CursorElement>)(object)this).ErrorMessage(planetName, action, "You cannot travel to another moon while travelling to one!"); return; } if (StartOfRound.Instance.isChallengeFile) { ((InteractiveTerminalApplication<CursorElement>)(object)this).ErrorMessage(planetName, action, "You cannot travel to another moon while doing a challenge moon!"); return; } if ((Object)(object)StartOfRound.Instance.levels[routeNode.buyRerouteToMoon] == (Object)(object)StartOfRound.Instance.currentLevel) { ((InteractiveTerminalApplication<CursorElement>)(object)this).ErrorMessage(planetName, action, "You have already arrived to this moon!"); return; } if (LethalLevelLoaderCompat.Enabled && LethalLevelLoaderCompat.IsLocked(level)) { ((InteractiveTerminalApplication<CursorElement>)(object)this).ErrorMessage(planetName, action, "You are unable to route to this moon!"); return; } int groupCredits = ((TerminalApplication)this).terminal.groupCredits; if (groupCredits < routeNode.itemCost) { ((InteractiveTerminalApplication<CursorElement>)(object)this).ErrorMessage(planetName, action, "Not enough credits to purchase this route!"); return; } ((InteractiveTerminalApplication<CursorElement>)(object)this).Confirm(planetName, $"Do you confirm routing to {level.PlanetName}? You will spend {routeNode.itemCost} Company Credits for the routing.", (Action)delegate { ConfirmRoute(routeNode); }, action, ""); } private void ConfirmRoute(TerminalNode routeNode) { StartOfRound.Instance.ChangeLevelServerRpc(routeNode.buyRerouteToMoon, ((TerminalApplication)this).terminal.groupCredits - routeNode.itemCost); base.ResetScreen(); } private bool CanPurchaseRoute(LevelCursorElement element) { if (!StartOfRound.Instance.inShipPhase || StartOfRound.Instance.travellingToNewLevel || StartOfRound.Instance.isChallengeFile || (Object)(object)StartOfRound.Instance.levels[element.RouteNode.buyRerouteToMoon] == (Object)(object)StartOfRound.Instance.currentLevel) { return false; } if (LethalLevelLoaderCompat.Enabled && LethalLevelLoaderCompat.IsLocked(element.Level)) { return false; } int groupCredits = ((TerminalApplication)this).terminal.groupCredits; return element.RouteNode.itemCost <= groupCredits; } } } namespace InteractiveMoonCatalogue.Compat { internal static class LethalLevelLoaderCompat { public static bool Enabled => Chainloader.PluginInfos.ContainsKey("imabatby.lethallevelloader"); internal static void GrabAllAvailableLevels(ref SelectableLevel[] levels) { ExtendedLevel val = default(ExtendedLevel); levels = levels.Where((SelectableLevel x) => PatchedContent.TryGetExtendedContent(x, ref val) && !val.IsRouteHidden).ToArray(); } internal static int CompareAscendingDifficulty(SelectableLevel level1, SelectableLevel level2) { ExtendedLevel val = default(ExtendedLevel); PatchedContent.TryGetExtendedContent(level1, ref val); ExtendedLevel val2 = default(ExtendedLevel); PatchedContent.TryGetExtendedContent(level2, ref val2); return val2.CalculatedDifficultyRating.CompareTo(val.CalculatedDifficultyRating); } internal static int CompareDescendingDifficulty(SelectableLevel level1, SelectableLevel level2) { ExtendedLevel val = default(ExtendedLevel); PatchedContent.TryGetExtendedContent(level1, ref val); ExtendedLevel val2 = default(ExtendedLevel); PatchedContent.TryGetExtendedContent(level2, ref val2); return val.CalculatedDifficultyRating.CompareTo(val2.CalculatedDifficultyRating); } internal static bool IsLocked(SelectableLevel level) { ExtendedLevel val = default(ExtendedLevel); PatchedContent.TryGetExtendedContent(level, ref val); return (Object)(object)val == (Object)null || val.IsRouteLocked; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace InteractiveMoonCatalogueForked.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }