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 MoonUnlockUnhide v1.2.1
MoonUnlockUnhide.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LethalLevelLoader; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MoonUnlockUnhide")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HP Inc.")] [assembly: AssemblyProduct("MoonUnlockUnhide")] [assembly: AssemblyCopyright("Copyright © HP Inc. 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4d0769b7-474e-4aec-8199-2c42ac2268df")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace MoonUnlockUnhide; internal class ConfigManager { public static ConfigEntry<string> ignoreMoonsList; public static void Init(ConfigFile config) { ignoreMoonsList = config.Bind<string>("General", "ignoreMoonsList", "example1,example2,example3", "List of moons to ignore when unhiding/unlocking moons. Separate with commas."); } } [HarmonyPatch(typeof(HangarShipDoor), "Start")] internal static class UnlockUnhidePatch { private static List<string> ignoreMoons; public static void Postfix() { List<ExtendedLevel> extendedLevels = PatchedContent.ExtendedLevels; if (ignoreMoons == null) { genIgnoreMoonsList(extendedLevels); } foreach (ExtendedLevel item in extendedLevels) { if (!ignoreMoons.Contains(item.NumberlessPlanetName.ToLower())) { if (item.IsRouteHidden) { Plugin.mls.LogInfo((object)("Unhiding " + item.NumberlessPlanetName)); item.IsRouteHidden = false; } if (item.IsRouteLocked) { Plugin.mls.LogInfo((object)("Unlocking " + item.NumberlessPlanetName)); item.IsRouteLocked = false; } } } } private static void genIgnoreMoonsList(List<ExtendedLevel> allExtendedLevels) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown Plugin.mls.LogInfo((object)"Generating ignoreMoons list"); ignoreMoons = new List<string>(); FieldInfo internalStaticField = Utils.getInternalStaticField("LethalLevelLoader.TerminalManager, LethalLevelLoader", "routeKeyword"); if (internalStaticField != null) { TerminalKeyword val = (TerminalKeyword)internalStaticField.GetValue(null); foreach (ExtendedLevel allExtendedLevel in allExtendedLevels) { bool flag = false; foreach (CompatibleNoun item in new List<CompatibleNoun>(val.compatibleNouns)) { if ((Object)(object)item.result == (Object)(object)allExtendedLevel.RouteNode) { flag = true; break; } } if (!flag) { ignoreMoons.Add(allExtendedLevel.NumberlessPlanetName.ToLower()); } } } else { Plugin.mls.LogError((object)"Could not find the field routeKeyword in LethalLevelLoader.TerminalManager"); } string[] array = ConfigManager.ignoreMoonsList.Value.Split(new char[1] { ',' }); string[] array2 = array; foreach (string text in array2) { ignoreMoons.Add(text.ToLower()); } foreach (string ignoreMoon in ignoreMoons) { Plugin.mls.LogInfo((object)("Ignoring " + ignoreMoon)); } } } internal static class StarlancerMoonsPatch { public static void onAwake() { FieldInfo internalStaticField = Utils.getInternalStaticField("StarlancerMoons.TerminalManagerPatch, StarlancerMoons", "KeywordReplacements"); if (internalStaticField == null) { Plugin.mls.LogWarning((object)"Could not find the field KeywordReplacements in StarlancerMoons.TerminalManagerPatch, StarlancerMoons may not be installed."); return; } Dictionary<string, string> dictionary = (Dictionary<string, string>)internalStaticField.GetValue(null); dictionary["starlancerzero"] = "starlancerzero"; Plugin.mls.LogInfo((object)"StarlancerTero is now routable as starlancerzero"); } } [BepInPlugin("ProjectBots.MoonUnlockUnhide", "MoonUnlockUnhide", "1.2.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private const string modGUID = "ProjectBots.MoonUnlockUnhide"; private const string modName = "MoonUnlockUnhide"; private const string modVersion = "1.2.1"; public static Harmony harmony = new Harmony("ProjectBots.MoonUnlockUnhide"); public static ManualLogSource mls; private void Awake() { mls = Logger.CreateLogSource("ProjectBots.MoonUnlockUnhide"); ConfigManager.Init(((BaseUnityPlugin)this).Config); harmony.PatchAll(typeof(UnlockUnhidePatch)); StarlancerMoonsPatch.onAwake(); mls.LogInfo((object)"MoonUnlockUnhide has been awoken!"); } } internal class Utils { internal static FieldInfo getInternalStaticField(string typeName, string fieldName) { Type type = Type.GetType(typeName); if (type != null) { FieldInfo field = type.GetField(fieldName, BindingFlags.Static | BindingFlags.NonPublic); if (field != null) { return field; } } return null; } }