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 MoonVisitedCount v1.0.4
MoonVisitedCount.dll
Decompiled a year agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using MoonVisitedCount.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MoonVisitedCount")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MoonVisitedCount")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a02acc6a-0453-4abc-8918-0a2ffa90f430")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace MoonVisitedCount { [BepInPlugin("La_Chips.MoonVisitedCount", "Moon Visited Count", "1.0.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MoonVisitedCountBase : BaseUnityPlugin { private const string PLUGIN_GUID = "La_Chips.MoonVisitedCount"; private const string PLUGIN_NAME = "Moon Visited Count"; private const string PLUGIN_VERSION = "1.0.0.0"; private readonly Harmony harmony = new Harmony("La_Chips.MoonVisitedCount"); private static MoonVisitedCountBase Instance; public static ManualLogSource logSource; private void Awake() { logSource = Logger.CreateLogSource("La_Chips.MoonVisitedCount"); if ((Object)(object)Instance == (Object)null) { Instance = this; logSource.LogInfo((object)"Creating static instance"); } logSource.LogInfo((object)"Plugin La_Chips.MoonVisitedCount is loaded!"); harmony.PatchAll(typeof(MoonVisitedCountBase)); harmony.PatchAll(typeof(DeleteFileButtonPatch)); harmony.PatchAll(typeof(TerminalPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); } } [Serializable] [ES3Serializable] public class VisitCount { [ES3Serializable] public int LevelID { get; set; } [ES3Serializable] public int VCount { get; set; } [ES3Serializable] public string PlanetName { get; set; } public VisitCount() { } public VisitCount(int levelId, int visitCount, string planetname) { LevelID = levelId; VCount = visitCount; PlanetName = planetname; } public override string ToString() { return $"{PlanetName} ({VCount})"; } } } namespace MoonVisitedCount.Patches { internal class DeleteFileButtonPatch { [HarmonyPatch(typeof(DeleteFileButton), "DeleteFile")] [HarmonyPrefix] [HarmonyPriority(0)] internal static void DeleteSave(DeleteFileButton __instance) { string text = "MoonVisitCount_"; text = __instance.fileToDelete switch { 0 => text + "LCSaveFile1", 1 => text + "LCSaveFile2", 2 => text + "LCSaveFile3", _ => text + "LCSaveFile1", }; if (ES3.KeyExists(text)) { ES3.DeleteKey(text); } } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { private static GameNetworkManager ___gameNetworkManager = GameNetworkManager.Instance; [HarmonyPatch(typeof(StartOfRound), "StartGame")] [HarmonyPostfix] internal static void IncreaseMoonVisitCount(StartOfRound __instance) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown if (!___gameNetworkManager.isHostingGame || __instance.currentLevel.levelID == 3) { return; } VisitCount[] array = ES3.Load<VisitCount[]>("MoonVisitCount_" + ___gameNetworkManager.currentSaveFileName, new VisitCount[0], new ES3Settings((string)null, (ES3Settings)null) { format = (Format)0 }); int num = -1; for (int i = 0; i < array.Length; i++) { if (array[i].LevelID == __instance.currentLevel.levelID) { VisitCount visitCount = array[i]; visitCount.VCount++; array[i] = visitCount; num = i; } } if (num == -1) { VisitCount visitCount2 = new VisitCount(__instance.currentLevel.levelID, 1, RemoveNumbersFromMoon(__instance.currentLevel.PlanetName)); array = CollectionExtensions.AddToArray<VisitCount>(array, visitCount2); } ES3.Save<VisitCount[]>("MoonVisitCount_" + ___gameNetworkManager.currentSaveFileName, array, new ES3Settings((string)null, (ES3Settings)null) { format = (Format)0 }); } internal static string RemoveNumbersFromMoon(string moon) { return Regex.Replace(moon, "^\\d+\\s*", ""); } } internal class TerminalPatch { private static GameNetworkManager ___gameNetworkManager = GameNetworkManager.Instance; [HarmonyPatch(typeof(Terminal), "TextPostProcess")] [HarmonyPrefix] [HarmonyPriority(0)] internal static void TextPostProcess_Prefix(ref string modifiedDisplayText, Terminal __instance) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown if (!modifiedDisplayText.Contains("Welcome to the exomoons catalogue")) { return; } string text3 = ""; string[] array = modifiedDisplayText.Split(new char[1] { '\n' }); VisitCount[] array2 = ES3.Load<VisitCount[]>("MoonVisitCount_" + ___gameNetworkManager.currentSaveFileName, new VisitCount[0], new ES3Settings((string)null, (ES3Settings)null) { format = (Format)0 }); int num = -1; string[] array3 = array; foreach (string text2 in array3) { if (text2.StartsWith("* ") && array2.Length != 0 && !text2.ToLower().Contains("the company building")) { VisitCount visitCount2 = Array.Find(array2, (VisitCount visitCount) => text2.Contains(visitCount.PlanetName)); text3 = ((visitCount2 == null) ? (text3 + text2 + " (0)\n") : (text3 + text2 + $" ({visitCount2.VCount})\n")); num++; } else { text3 = text3 + text2 + "\n"; } } modifiedDisplayText = text3.Substring(0, text3.Length); } } }