Decompiled source of Better Terminal Scanner v1.0.0

BetterTerminalScanner.dll

Decompiled 2 weeks ago
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 BepInEx.Logging;
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("TerminalScannerPlus")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TerminalScannerPlus")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8111916a-fba9-46bc-8c0a-e28c4d7fa50c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TerminalScannerPlus;

[BepInPlugin("TerminalScannerPlus.mod", "Terminal Scanner Plus", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("TerminalScannerPlus.mod");
		ManualLogSource val2 = Logger.CreateLogSource("Terminal Scanner Plus");
		val2.LogInfo((object)"Loaded Succesfully");
		val.PatchAll();
	}
}
[HarmonyPatch(typeof(Terminal), "TextPostProcess")]
public class TextPostProcessPatch
{
	public static void Postfix(ref string __result)
	{
		if (!__result.Contains("objects outside the ship, totalling at an approximate value of"))
		{
			return;
		}
		GrabbableObject[] source = Object.FindObjectsOfType<GrabbableObject>();
		List<GrabbableObject> list = (from obj in source
			where obj.itemProperties.isScrap && !obj.isInShipRoom && !obj.isInElevator
			orderby obj.itemProperties.itemName
			select obj).ToList();
		string text = "";
		int num = 0;
		int num2 = 0;
		foreach (GrabbableObject item in list)
		{
			if (item.itemProperties.isScrap && !item.isInShipRoom && !item.isInElevator)
			{
				text += $"\n* {item.itemProperties.itemName} // ${item.scrapValue}";
				num++;
				num2 += item.scrapValue;
			}
		}
		__result = $"\n\n\nThere are {num} objects outside the ship, totalling a value of ${num2}.\n{text}\n\n";
	}
}