using System;
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 BepInEx;
using GameNetcodeStuff;
using Microsoft.CodeAnalysis;
using TerminalApi;
using TerminalApi.Events;
using UnityEngine;
using UnityEngine.Events;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("TerminalPlus")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds a handful of useful console commands")]
[assembly: AssemblyFileVersion("1.0.6.0")]
[assembly: AssemblyInformationalVersion("1.0.6+718dbc568af7384920e2bf08963d2c4c4c15dde2")]
[assembly: AssemblyProduct("TerminalPlus")]
[assembly: AssemblyTitle("TerminalPlus")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.6.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 TerminalPlus
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "TerminalPlus";
public const string PLUGIN_NAME = "TerminalPlus";
public const string PLUGIN_VERSION = "1.0.6";
}
}
namespace TestPlugin
{
[BepInPlugin("orangefantasma.terminalplus", "TerminalPlus", "1.0.6")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Expected O, but got Unknown
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Expected O, but got Unknown
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Expected O, but got Unknown
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogInfo((object)"TerminalPlus Loaded!");
Events.TerminalAwake += new TerminalEventHandler(TerminalIsAwake);
Events.TerminalWaking += new TerminalEventHandler(TerminalIsWaking);
Events.TerminalStarting += new TerminalEventHandler(TerminalIsStarting);
Events.TerminalStarted += new TerminalEventHandler(TerminalIsStarted);
Events.TerminalParsedSentence += new TerminalParseSentenceEventHandler(TextSubmitted);
Events.TerminalBeginUsing += new TerminalEventHandler(OnBeginUsing);
Events.TerminalBeganUsing += new TerminalEventHandler(BeganUsing);
Events.TerminalExited += new TerminalEventHandler(OnTerminalExit);
}
private void OnTerminalExit(object sender, TerminalEventArgs e)
{
((BaseUnityPlugin)this).Logger.LogMessage((object)"Terminal Exited");
}
private void TerminalIsAwake(object sender, TerminalEventArgs e)
{
((BaseUnityPlugin)this).Logger.LogMessage((object)"Terminal is awake");
TerminalApi.AddCommand("detailedscan", "Ship is not Landed!\n\n", "ds1", true);
TerminalApi.AddCommand("dscan", "Ship is not Landed!\n\n", "ds2", true);
TerminalApi.AddCommand("detscan", "Ship is not Landed!\n\n", "ds3", true);
TerminalApi.AddCommand("ds", "Ship is not Landed!\n\n", "ds4", true);
TerminalApi.AddCommand("tp", "Attempting Teleport...\n\n", "tele1", true);
TerminalApi.AddCommand("teleport", "Attempting Teleport...\n\n", "tele2", true);
TerminalApi.AddCommand("inverse", "Attempting Inverse Teleport...\n\n", "intele", true);
TerminalApi.AddCommand("light", "Toggling lights...\n\n", "lightswitch1", true);
TerminalApi.AddCommand("lights", "Toggling lights...\n\n", "lightswitch2", true);
}
private void TerminalIsWaking(object sender, TerminalEventArgs e)
{
((BaseUnityPlugin)this).Logger.LogMessage((object)"Terminal is waking");
}
private void TerminalIsStarting(object sender, TerminalEventArgs e)
{
((BaseUnityPlugin)this).Logger.LogMessage((object)"Terminal is starting");
}
private void TerminalIsStarted(object sender, TerminalEventArgs e)
{
((BaseUnityPlugin)this).Logger.LogMessage((object)"Terminal is started");
}
private void TextSubmitted(object sender, TerminalParseSentenceEventArgs e)
{
((BaseUnityPlugin)this).Logger.LogMessage((object)$"Text submitted: {e.SubmittedText} Node Returned: {e.ReturnedNode}");
if (e.SubmittedText == "tp" || e.SubmittedText == "teleport")
{
ShipTeleporter[] array = Object.FindObjectsOfType<ShipTeleporter>();
for (int i = 0; i < array.Length; i++)
{
if (!array[i].isInverseTeleporter && array[i].buttonTrigger.interactable)
{
((UnityEvent<PlayerControllerB>)(object)array[i].buttonTrigger.onInteract).Invoke(GameNetworkManager.Instance.localPlayerController);
}
}
}
else if (e.SubmittedText == "inverse")
{
ShipTeleporter[] array2 = Object.FindObjectsOfType<ShipTeleporter>();
for (int j = 0; j < array2.Length; j++)
{
if (array2[j].isInverseTeleporter && array2[j].buttonTrigger.interactable)
{
((UnityEvent<PlayerControllerB>)(object)array2[j].buttonTrigger.onInteract).Invoke(GameNetworkManager.Instance.localPlayerController);
}
}
}
else
{
if (!(e.SubmittedText == "light") && !(e.SubmittedText == "lights"))
{
return;
}
InteractTrigger[] array3 = Object.FindObjectsOfType<InteractTrigger>();
for (int k = 0; k < array3.Length; k++)
{
if (((Object)array3[k]).name == "LightSwitch")
{
((UnityEvent<PlayerControllerB>)(object)array3[k].onInteract).Invoke(GameNetworkManager.Instance.localPlayerController);
}
}
}
}
private void OnBeginUsing(object sender, TerminalEventArgs e)
{
((BaseUnityPlugin)this).Logger.LogMessage((object)"Player has just started using the terminal");
List<GrabbableObject> list = new List<GrabbableObject>();
GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
int num = 0;
for (int i = 0; i < array.Length; i++)
{
if (array[i].itemProperties.isScrap && !array[i].scrapPersistedThroughRounds && !array[i].isInShipRoom)
{
list.Add(array[i]);
num += array[i].scrapValue;
}
}
string text = string.Join("\n", list.Select((GrabbableObject x) => x.itemProperties.itemName + " : " + x.scrapValue + " Value"));
string text2 = "Items not in ship: " + list.Count() + "\n\n" + text + "\n\nWith a total value of: " + num + "\n\n";
TerminalApi.UpdateKeywordCompatibleNoun("ds1", "detailedscan", TerminalApi.CreateTerminalNode(text2 ?? "", true, ""));
TerminalApi.UpdateKeywordCompatibleNoun("ds3", "detscan", TerminalApi.CreateTerminalNode(text2 ?? "", true, ""));
TerminalApi.UpdateKeywordCompatibleNoun("ds2", "dscan", TerminalApi.CreateTerminalNode(text2 ?? "", true, ""));
TerminalApi.UpdateKeywordCompatibleNoun("ds4", "ds", TerminalApi.CreateTerminalNode(text2 ?? "", true, ""));
}
private void BeganUsing(object sender, TerminalEventArgs e)
{
((BaseUnityPlugin)this).Logger.LogMessage((object)"Player is using terminal");
}
}
}