Please disclose if your mod was created primarily 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 PortableTerminalSolo v1.0.1
BepInEx/plugins/PortableTerminalSolo.dll
Decompiled 2 years agousing System; using System.Collections; 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 AdvancedCompany.Game; using AdvancedCompany.Terminal.Applications; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Kotoky.Apps; using Kotoky.Patch; 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: IgnoresAccessChecksTo("AdvancedCompany")] [assembly: AssemblyCompany("PortableTerminalSolo")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+57b2e59df0476534011988c9b397be9bde8b2081")] [assembly: AssemblyProduct("PortableTerminalSolo")] [assembly: AssemblyTitle("PortableTerminalSolo")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 Kotoky { [BepInDependency("com.potatoepet.AdvancedCompany", "1.1.1")] [BepInPlugin("PortableTerminalSolo", "PortableTerminalSolo", "1.0.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony _harmony = new Harmony("PortableTerminalSolo"); public static Plugin Instance { get; set; } public static ManualLogSource Log => ((BaseUnityPlugin)Instance).Logger; public Plugin() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown Instance = this; } private void Awake() { Log.LogInfo((object)"Applying patches..."); ApplyPluginPatch(); Log.LogInfo((object)"Patches applied"); Log.LogInfo((object)"Registering terminal apps..."); RegisterApps(); Log.LogInfo((object)"Apps registered"); } private void RegisterApps() { TeleportApplication teleportApplication = new TeleportApplication(); MobileTerminal.RegisterApplication("hack", (IApplication)(object)new HackApplication()); MobileTerminal.RegisterApplication("scan", (IApplication)(object)new ScanApplication()); MobileTerminal.RegisterApplication("tp", (IApplication)(object)teleportApplication); MobileTerminal.RegisterApplication("teleport", (IApplication)(object)teleportApplication); } private void ApplyPluginPatch() { _harmony.PatchAll(typeof(MobileTerminalPatch)); } } public static class PluginInfo { public const string PLUGIN_GUID = "PortableTerminalSolo"; public const string PLUGIN_NAME = "PortableTerminalSolo"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace Kotoky.Patch { [HarmonyPatch(typeof(MobileTerminal))] public class MobileTerminalPatch { [HarmonyPatch("Close")] [HarmonyPostfix] public static void OnCloseTerminal(MobileTerminal __instance) { if (__instance.Player.IsLocal && HackApplication.CurrentHack != null) { Plugin.Log.LogInfo((object)"Stoping hack"); ((MonoBehaviour)Manager.Terminal).StopCoroutine(HackApplication.CurrentHack); HackApplication.CurrentHack = null; } } } } namespace Kotoky.Apps { public class HackApplication : IApplication { public static IEnumerator CurrentHack; public void Main(MobileTerminal terminal, string[] args) { terminal.DeactivateInput(); if (args.Length != 0) { CurrentHack = HackRoutine(args[0], terminal); ((MonoBehaviour)Manager.Terminal).StartCoroutine(CurrentHack); } else { terminal.WriteLine("Usage: hack [target]"); terminal.Exit(); } } private IEnumerator HackRoutine(string target, MobileTerminal terminal) { Plugin.Log.LogInfo((object)"Starting hack"); terminal.Clear(); terminal.WriteLine("Started hacking " + target + "..."); yield return (object)new WaitForSeconds(0.75f); terminal.WriteLine("Connecting to facility system..."); yield return (object)new WaitForSeconds(0.75f); terminal.WriteLine("Connected, starting brute force attack..."); yield return (object)new WaitForSeconds(1.5f); terminal.WriteLine("Successfully breached security..."); yield return (object)new WaitForSeconds(0.5f); terminal.WriteLine("Hack complete, calling function..."); Manager.Terminal.CallFunctionInAccessibleTerminalObject(target); Manager.Terminal.PlayBroadcastCodeEffect(); terminal.Exit(); } public void Exit() { CurrentHack = null; } public void Submit(string text) { } public void Update() { } } public class ScanApplication : IApplication { public void Main(MobileTerminal terminal, string[] args) { terminal.Clear(); if (args.Length != 0 && args[0] == "life") { ScanLife(terminal); } else { ScanScrap(terminal); } terminal.Exit(); } private void ScanScrap(MobileTerminal terminal) { List<GrabbableObject> list = (from o in Object.FindObjectsOfType<GrabbableObject>() where o.itemProperties.isScrap && !o.scrapPersistedThroughRounds && !o.isInShipRoom select o).ToList(); if (list.Count == 0) { terminal.SetText("No Scrap Found!.\n\n", true); return; } int num = list.Sum((GrabbableObject o) => o.scrapValue); string text = string.Join("\n", list.Select((GrabbableObject x) => x.itemProperties.itemName + " : " + x.scrapValue + " Value")); string text2 = "Scrap scanned: " + list.Count() + "\n\n" + text + "\n\nWith a total value of: " + num + "\n\n"; terminal.SetText(text2, true); } private void ScanLife(MobileTerminal terminal) { List<IGrouping<string, EnemyAI>> list = (from ai in Object.FindObjectsOfType<EnemyAI>() where (Object)(object)((Component)ai).GetComponentInChildren<ScanNodeProperties>() != (Object)null && !ai.isEnemyDead group ai by ((Component)ai).GetComponentInChildren<ScanNodeProperties>().headerText into g orderby g.Key select g).ToList(); int num = Object.FindObjectsOfType<MaskedPlayerEnemy>().Count((MaskedPlayerEnemy m) => !((EnemyAI)m).isEnemyDead); num += StartOfRound.Instance.livingPlayers; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Life forms scanned: " + list.Count() + "\n"); stringBuilder.AppendLine("Humans: " + num); foreach (IGrouping<string, EnemyAI> item in list) { stringBuilder.Append(item.Key); stringBuilder.Append(": "); stringBuilder.AppendLine(item.Count().ToString()); } stringBuilder.AppendLine(); terminal.SetText(stringBuilder.ToString(), true); } public void Exit() { } public void Submit(string text) { } public void Update() { } } public class TeleportApplication : IApplication { private ShipTeleporter _teleporter; public void Main(MobileTerminal terminal, string[] args) { if (_teleporter == null) { _teleporter = GetTeleporter(); } if ((Object)(object)_teleporter == (Object)null) { terminal.WriteLine("No teleporter found!"); terminal.Exit(); return; } StartOfRound.Instance.mapScreen.targetedPlayer = terminal.Player.Controller; _teleporter.PressTeleportButtonOnLocalClient(); terminal.Exit(); terminal.Submit("help", (string[])null); } private ShipTeleporter GetTeleporter() { ShipTeleporter[] array = Object.FindObjectsOfType<ShipTeleporter>(); for (int i = 0; i < array.Length; i++) { if (!array[i].isInverseTeleporter) { return array[i]; } } return null; } public void Exit() { } public void Submit(string text) { } public void Update() { } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }