using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Localization;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BetterTerminalInfo")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8f2969c29b4a3fd02bb616714fdfdda0230b291e")]
[assembly: AssemblyProduct("BetterTerminalInfo")]
[assembly: AssemblyTitle("BetterTerminalInfo")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace BetterTerminalInfo
{
internal static class Patch
{
[HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "AddInitialTerminalOutput")]
[HarmonyPrefix]
public static bool AddBetterInitialTerminalOutput(LG_ComputerTerminalCommandInterpreter __instance)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Invalid comparison between Unknown and I4
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Invalid comparison between Unknown and I4
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Invalid comparison between Unknown and I4
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Invalid comparison between Unknown and I4
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Invalid comparison between Unknown and I4
int num = 0;
if (__instance.m_commandsPerEnum != null)
{
Enumerator<TERM_Command, string> enumerator = __instance.m_commandsPerEnum.GetEnumerator();
while (enumerator.MoveNext())
{
TERM_Command key = enumerator.Current.Key;
if ((int)key <= 20)
{
if (key - 1 <= 3 || key - 18 <= 2)
{
continue;
}
}
else if (key - 28 <= 2 || (int)key == 43)
{
continue;
}
num++;
}
}
string itemKey = __instance.m_terminal.ItemKey;
int count = __instance.m_terminal.GetLocalLogs().Count;
__instance.AddOutput("", false);
__instance.AddOutput("---------------------------------------------------------------", false);
__instance.AddOutput("TERMINAL OS v0.50", false);
__instance.AddOutput("---------------------------------------------------------------", false);
if (__instance.m_terminal.SpawnNode != null)
{
string formattedText = __instance.m_terminal.SpawnNode.m_zone.NavInfo.GetFormattedText((LG_NavInfoFormat)7);
__instance.AddOutput("Welcome to <b>" + itemKey + "</b>, located in <b>" + formattedText + "</b>", true);
}
else
{
__instance.AddOutput("Welcome to <b>" + itemKey + "</b>", true);
}
__instance.AddOutput($"There are {count} logs on this terminal", false);
__instance.AddOutput($"There are {num} extra commands on this terminal", true);
__instance.AddOutput("Type \"HELP\" to get help using the terminal.", false);
__instance.AddOutput("Type \"COMMANDS\" to get a list of all available commands.", false);
__instance.AddOutput("Press [ESC] to exit", true);
return false;
}
[HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "AddCommand", new Type[]
{
typeof(TERM_Command),
typeof(string),
typeof(LocalizedText),
typeof(TERM_CommandRule)
})]
[HarmonyPostfix]
public static void RegenerateInfoAfterAddCommand(LG_ComputerTerminalCommandInterpreter __instance)
{
if (__instance.m_inputBuffer.Count == 0)
{
__instance.ClearOutputQueueAndScreenBuffer();
__instance.AddInitialTerminalOutput();
}
}
}
[BepInPlugin("BetterTerminalInfo", "BetterTerminalInfo", "1.0.0")]
public class Plugin : BasePlugin
{
public override void Load()
{
Harmony.CreateAndPatchAll(typeof(Patch), "tru0067.BetterTerminalInfo");
((BasePlugin)this).Log.LogInfo((object)"BetterTerminalInfo is loaded!");
}
}
}