using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using GameNetcodeStuff; using HarmonyLib; 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("CrewFetch")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CrewFetch")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d434fe6b-d2f9-4edb-a21a-f86a2f15e90d")] [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 CrewFetch; [BepInPlugin("com.quorix.crewfetchmod", "Crew Fetch Mod", "1.0.0")] public class CrewFetch : BaseUnityPlugin { private void Awake() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"Crew Fetch Mod by Quorix loaded and initialized."); Harmony val = new Harmony("com.quorix.crewfetchmod"); val.PatchAll(); } } [HarmonyPatch(typeof(Terminal))] internal class HelpMenuPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AddToHelpMenu(Terminal __instance) { TerminalKeyword val = ((IEnumerable)__instance.terminalNodes.allKeywords).FirstOrDefault((Func)((TerminalKeyword k) => k.word == "other")); if ((Object)(object)val != (Object)null && (Object)(object)val.specialKeywordResult != (Object)null) { string displayText = val.specialKeywordResult.displayText; if (!displayText.Contains(">CREWFETCH")) { val.specialKeywordResult.displayText = displayText.TrimEnd(new char[1] { '\n' }) + "\n\n>CREWFETCH\nDisplays system and ship information.\n\n"; } } } } [HarmonyPatch(typeof(Terminal))] internal class CrewFetchCommandPatch { private static TerminalNode crewfetchNode; [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AddCrewfetchCommand(Terminal __instance) { if (!__instance.terminalNodes.allKeywords.Any((TerminalKeyword k) => k.word == "crewfetch")) { crewfetchNode = ScriptableObject.CreateInstance(); ((Object)crewfetchNode).name = "CrewfetchCommandNode"; crewfetchNode.displayText = "Gathering system info...\n\n"; crewfetchNode.clearPreviousText = true; TerminalKeyword val = ScriptableObject.CreateInstance(); ((Object)val).name = "CrewfetchCommand"; val.word = "crewfetch"; val.isVerb = false; val.specialKeywordResult = crewfetchNode; List list = __instance.terminalNodes.allKeywords.ToList(); list.Add(val); __instance.terminalNodes.allKeywords = list.ToArray(); } } [HarmonyPatch("LoadNewNode")] [HarmonyPrefix] private static void OnLoadNewNode(ref TerminalNode node, Terminal __instance) { if ((Object)(object)node != (Object)null && (Object)(object)node == (Object)(object)crewfetchNode) { node.displayText = GenerateCrewfetchText(__instance) + "\n\n"; } } private static string GenerateCrewfetchText(Terminal terminal) { int num = StartOfRound.Instance.allPlayerScripts.Count((PlayerControllerB p) => p.isPlayerControlled && !p.isPlayerDead); int num2 = StartOfRound.Instance.allPlayerScripts.Count((PlayerControllerB p) => p.isPlayerControlled || p.isPlayerDead); GrabbableObject[] array = Object.FindObjectsOfType(); int num3 = 0; int num4 = 0; GrabbableObject[] array2 = array; foreach (GrabbableObject val in array2) { if (val.itemProperties.isScrap && val.isInShipRoom) { num3++; num4 += val.scrapValue; } } string planetName = StartOfRound.Instance.currentLevel.PlanetName; string text = ((object)(LevelWeatherType)(ref StartOfRound.Instance.currentLevel.currentWeather)).ToString(); int groupCredits = terminal.groupCredits; int profitQuota = TimeOfDay.Instance.profitQuota; int quotaFulfilled = TimeOfDay.Instance.quotaFulfilled; int daysUntilDeadline = TimeOfDay.Instance.daysUntilDeadline; return $"\r\n system@company-os\r\n -----------------\r\n Current Moon: {planetName} ({text})\r\n Credits Balance: ${groupCredits}\r\n ______ [ CREW STATUS ]\r\n / ____/ Alive Employees: {num} / {num2}\r\n / / \r\n/ /___ [ SHIP INVENTORY ]\r\n\\____/ Scrap Collected (Items): {num3}\r\n Estimated Value: ${num4}\r\n \r\n [ COMPANY QUOTA ]\r\n Fulfilled: ${quotaFulfilled} / ${profitQuota}\r\n Days Left: {daysUntilDeadline}\r\n"; } }