Decompiled source of RadarTerminal v1.0.0

RadarTerminal.dll

Decompiled a year ago
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using RadarTerminal.Patches;
using TMPro;
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("RadarTerminal")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RadarTerminal")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0769d736-160e-4de0-9171-beef18feeaef")]
[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 RadarTerminal
{
	[BepInPlugin("Apollyon.RadarTerminal", "RadarTerminal", "1.0.0.0")]
	public class RadarTerminalBase : BaseUnityPlugin
	{
		private const string modGUID = "Apollyon.RadarTerminal";

		private const string modName = "RadarTerminal";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Apollyon.RadarTerminal");

		private static RadarTerminalBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("modGUID");
			mls.LogInfo((object)"Radar is active");
			harmony.PatchAll(typeof(RadarTerminalBase));
			harmony.PatchAll(typeof(HUDManagerPatch));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
		}
	}
}
namespace RadarTerminal.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatch
	{
		[HarmonyPatch("SubmitChat_performed")]
		[HarmonyPrefix]
		private static void InterceptTextChat(ref TMP_InputField ___chatTextField)
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			RadarBoosterItem val2 = Object.FindObjectOfType<RadarBoosterItem>();
			if (!((Object)(object)val2 != (Object)null) || !val2.radarEnabled)
			{
				return;
			}
			string[] array = ___chatTextField.text.Split(new char[1] { ' ' });
			if (array[0] == "/t")
			{
				array = array.Where((string val) => val != "/t").ToArray();
				string text = string.Join(" ", array);
				Terminal val3 = (Terminal)Object.FindObjectOfType(typeof(Terminal));
				val3.BeginUsingTerminal();
				DelayedInput(val3, text);
				___chatTextField.text = text;
			}
		}

		private static async void DelayedInput(Terminal terminal, string input)
		{
			await Task.Delay(250);
			terminal.currentText = "";
			terminal.TextChanged(input);
			terminal.screenText.text = input;
			await Task.Delay(250);
			terminal.OnSubmit();
			await Task.Delay(250);
			terminal.QuitTerminal();
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
	}
}