Decompiled source of ExtraTerminalCommands v1.5.0

BepInEx/plugins/ExtraTerminalCommands/Beauver.ExtraTerminalCommands.dll

Decompiled 10 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using Beauver.ExtraTerminalCommands.NetcodePatcher;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExtraTerminalCommands.Handlers;
using ExtraTerminalCommands.Networking;
using ExtraTerminalCommands.TerminalCommands;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using TerminalApi;
using TerminalApi.Classes;
using TerminalApi.Events;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Beauver")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: AssemblyInformationalVersion("1.5.0+8351a7f130275fc6b5ac5c223317934b6d85f6ec")]
[assembly: AssemblyProduct("Extra Terminal Commands")]
[assembly: AssemblyTitle("Beauver.ExtraTerminalCommands")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Beauver/ExtraTerminalCommands")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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 ExtraTerminalCommands
{
	[BepInPlugin("Beauver.ExtraTerminalCommands", "Extra Terminal Commands", "1.5.0")]
	[BepInDependency("atomic.terminalapi", "1.5.0")]
	public class ExtraTerminalCommandsBase : BaseUnityPlugin
	{
		public static ConfigEntry<bool> configExtraCommandsList;

		public static ConfigEntry<bool> configLaunchCommand;

		public static ConfigEntry<bool> configAllowLaunchOnMoon;

		public static ConfigEntry<bool> configTimeCommand;

		public static ConfigEntry<bool> configTeleportCommand;

		public static ConfigEntry<bool> configInverseTeleportCommand;

		public static ConfigEntry<bool> configLightsCommand;

		public static ConfigEntry<bool> configDoorsCommand;

		public static ConfigEntry<bool> configIntroSongCommand;

		public static ConfigEntry<bool> configRandomMoonCommand;

		public static ConfigEntry<bool> configClearCommand;

		public static ConfigEntry<bool> configSwitchCommand;

		public static ConfigEntry<bool> configHornCommand;

		public static ConfigEntry<bool> configAllowRandomWeatherFilter;

		public static ConfigEntry<bool> configHidePlanet;

		public static ConfigEntry<int> configRandomCommandPrice;

		public static ConfigEntry<int> configHornDefaultseconds;

		public static ConfigEntry<int> configHornMaxSeconds;

		public const string modGUID = "Beauver.ExtraTerminalCommands";

		public const string modName = "Extra Terminal Commands";

		public const string modVersion = "1.5.0";

		private readonly Harmony harmony = new Harmony("Beauver.ExtraTerminalCommands");

		public static AssetBundle MainAssetBundle;

		private static ExtraTerminalCommandsBase Instance;

		public static ManualLogSource mls;

		public static int daysJoined;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Beauver.ExtraTerminalCommands");
			LoadConfig();
			harmony.PatchAll();
			MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "extraterminalcommandsnetwork"));
			NetcodePatcher();
			mls.LogInfo((object)"Invoked NetcodePatcher");
			RegisterCommands();
			mls.LogInfo((object)"Beauver.ExtraTerminalCommands v1.5.0 has loaded!");
		}

		private void RegisterCommands()
		{
			if (!configExtraCommandsList.Value)
			{
				ExtraCommands.extraCommands();
			}
			if (!configTimeCommand.Value)
			{
				TimeCommand.timeCommand();
			}
			if (!configLaunchCommand.Value)
			{
				LaunchCommand.launchCommand();
			}
			if (!configTeleportCommand.Value)
			{
				TeleportCommand.teleportCommand();
			}
			if (!configInverseTeleportCommand.Value)
			{
				InverseTeleportCommand.inverseTeleportCommand();
			}
			if (!configLightsCommand.Value)
			{
				LightsCommand.lightsCommand();
			}
			if (!configDoorsCommand.Value)
			{
				DoorsCommand.doorsCommand();
			}
			if (!configIntroSongCommand.Value)
			{
				IntroSongCommand introSongCommand = new IntroSongCommand();
				introSongCommand.introSongCommand();
			}
			if (!configRandomMoonCommand.Value)
			{
				RandomMoonCommand.randomMoonCommand();
			}
			if (!configClearCommand.Value)
			{
				ClearScreenCommand.clearScreenCommand();
			}
			if (!configSwitchCommand.Value)
			{
				SwitchCommand.switchCommand();
			}
			if (!configHornCommand.Value)
			{
				HornCommand.hornCommand();
			}
			daysJoined = 0;
		}

		private void LoadConfig()
		{
			configExtraCommandsList = ((BaseUnityPlugin)this).Config.Bind<bool>("commands", "DisableCommandsList", false, "Disables the 'extra' command which shows the command list.");
			configLaunchCommand = ((BaseUnityPlugin)this).Config.Bind<bool>("commands", "DisableLaunch", false, "Disables the 'launch' command in terminal");
			configAllowLaunchOnMoon = ((BaseUnityPlugin)this).Config.Bind<bool>("launch", "AllowLaunch", true, "Allows the 'launch' command to be executed when on a moon. \nIf this is set to false the 'launch' command only works in space.");
			configTimeCommand = ((BaseUnityPlugin)this).Config.Bind<bool>("commands", "DisableTime", false, "Disables the 'time' command in terminal");
			configTeleportCommand = ((BaseUnityPlugin)this).Config.Bind<bool>("commands", "DisableTeleport", false, "Disables the 'teleport' command in terminal");
			configInverseTeleportCommand = ((BaseUnityPlugin)this).Config.Bind<bool>("commands", "DisableInverseTeleport", false, "Disables the 'itp' command in terminal");
			configLightsCommand = ((BaseUnityPlugin)this).Config.Bind<bool>("commands", "DisableLights", false, "Disables the 'lights' command in terminal");
			configDoorsCommand = ((BaseUnityPlugin)this).Config.Bind<bool>("commands", "DisableDoors", false, "Disables the 'doors' command in terminal");
			configIntroSongCommand = ((BaseUnityPlugin)this).Config.Bind<bool>("commands", "DisableIntroSong", false, "Plays the intro song when this command is run");
			configRandomMoonCommand = ((BaseUnityPlugin)this).Config.Bind<bool>("commands", "DisableRandomMoon", false, "Disables the 'random' command to go to a random moon.");
			configClearCommand = ((BaseUnityPlugin)this).Config.Bind<bool>("commands", "DisableClear", false, "Disables the 'clear' command which clears all lines in the console.");
			configSwitchCommand = ((BaseUnityPlugin)this).Config.Bind<bool>("commands", "DisableSwitch", false, "Disables the 's' command, which does the same as the vanilla 'switch' command.");
			configHornCommand = ((BaseUnityPlugin)this).Config.Bind<bool>("commands", "DisableHorn", false, "Disables the 'horn' command, which sounds the horn for X amount of seconds");
			configRandomCommandPrice = ((BaseUnityPlugin)this).Config.Bind<int>("random", "RandomCommandPrice", 100, "The price of the 'random' command. You will not receive a confirmation warning.");
			configAllowRandomWeatherFilter = ((BaseUnityPlugin)this).Config.Bind<bool>("random", "AllowWeatherFilter", true, "When enabled allows you to filter out weather when going to a random moon by typing 'random weather'");
			configHidePlanet = ((BaseUnityPlugin)this).Config.Bind<bool>("random", "AllowPlanetHide", true, "When enabled will not show what planet you're going to when writing 'random'");
			configHornDefaultseconds = ((BaseUnityPlugin)this).Config.Bind<int>("horn", "SecondsEnabled", 10, "This is the amount of seconds the horn will continue to sound when running 'horn'");
			configHornMaxSeconds = ((BaseUnityPlugin)this).Config.Bind<int>("horn", "MaxSeconds", 30, "This is the maximum amount of seconds the horn can sound when running 'horn [time]' Be warned, the higher this number more lag may occur.");
		}

		private static void NetcodePatcher()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}

		private void OnDestroy()
		{
			mls.LogInfo((object)"Beauver.ExtraTerminalCommands v1.5.0 was unloaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Beauver.ExtraTerminalCommands";

		public const string PLUGIN_NAME = "Extra Terminal Commands";

		public const string PLUGIN_VERSION = "1.5.0";
	}
}
namespace ExtraTerminalCommands.TerminalCommands
{
	internal class ClearScreenCommand
	{
		public static string description = "Clears the terminal view.";

		public static void clearScreenCommand()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			CommandInfo val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = onClear;
			CommandInfo val2 = val;
			TerminalApi.AddCommand("clear", val2, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = onClear;
			TerminalApi.AddCommand("cl", val, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = onClear;
			TerminalApi.AddCommand("cls", val, (string)null, true);
		}

		private static string onClear()
		{
			if (ETCNetworkHandler.Instance.clearCmdDisabled)
			{
				return "This command is disabled by the host.\n";
			}
			return "";
		}
	}
	internal class DoorsCommand
	{
		public static string description = "Toggles the door switch.";

		public static void doorsCommand()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			CommandInfo val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = onDoorCommand;
			CommandInfo val2 = val;
			val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = onDoorCommand;
			CommandInfo val3 = val;
			TerminalApi.AddCommand("doors", val2, (string)null, true);
			TerminalApi.AddCommand("door", val3, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = onDoorCommand;
			TerminalApi.AddCommand("d", val, (string)null, true);
		}

		private static string onDoorCommand()
		{
			if (ETCNetworkHandler.Instance.doorCmdDisabled)
			{
				return "This command is disabled by the host.\n";
			}
			if (!StartOfRound.Instance.shipDoorsEnabled)
			{
				return "You are currently not on a moon, you can not toggle the doors.\n";
			}
			string text = ((!StartOfRound.Instance.hangarDoorsClosed) ? "closed." : "opened.");
			InteractTrigger componentInChildren = GameObject.Find(StartOfRound.Instance.hangarDoorsClosed ? "StartButton" : "StopButton").GetComponentInChildren<InteractTrigger>();
			((UnityEvent<PlayerControllerB>)(object)componentInChildren.onInteract).Invoke(GameNetworkManager.Instance.localPlayerController);
			return "Doors " + text + "\n";
		}
	}
	internal class ExtraCommands
	{
		public static void extraCommands()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			CommandInfo val = new CommandInfo();
			val.Category = "other";
			val.Description = "Shows every command from the \"ExtraCommands\" mod.";
			val.DisplayTextSupplier = onExtraCommands;
			CommandInfo val2 = val;
			TerminalApi.AddCommand("EXTRA", val2, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = "Inverse teleports everyone on the inverse teleporter.";
			val.DisplayTextSupplier = onExtraCommands;
			TerminalApi.AddCommand("Extra", val, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = "Inverse teleports everyone on the inverse teleporter.";
			val.DisplayTextSupplier = onExtraCommands;
			TerminalApi.AddCommand("EC", val, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = "Inverse teleports everyone on the inverse teleporter.";
			val.DisplayTextSupplier = onExtraCommands;
			TerminalApi.AddCommand("Extra-Commands", val, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = "Inverse teleports everyone on the inverse teleporter.";
			val.DisplayTextSupplier = onExtraCommands;
			TerminalApi.AddCommand("Extra Commands", val, (string)null, true);
		}

		private static string onExtraCommands()
		{
			ETCNetworkHandler instance = ETCNetworkHandler.Instance;
			if (instance.extraCmdDisabled)
			{
				return "This command is disabled by the host.\n";
			}
			string text = "Extra Terminal Commands:";
			if (!instance.tpCmdDisabled)
			{
				text = text + "\n\n>TP\n" + TeleportCommand.description;
			}
			if (!instance.itpCmdDisabled)
			{
				text = text + "\n\n>ITP\n" + InverseTeleportCommand.description;
			}
			if (!instance.randomCmdDisabled)
			{
				text = text + "\n\n>RANDOM [WEATHER]\n" + RandomMoonCommand.description;
			}
			if (!instance.launchCmdDisabled)
			{
				text = text + "\n\n>LAUNCH\n" + LaunchCommand.description;
			}
			if (!instance.hornCmdDisabled)
			{
				text = text + "\n\n>HORN [SECONDS]\n" + HornCommand.description;
			}
			if (!instance.doorCmdDisabled)
			{
				text = text + "\n\n>DOORS\n" + DoorsCommand.description;
			}
			if (!instance.lightCmdDisabled)
			{
				text = text + "\n\n>LIGHTS\n" + LightsCommand.description;
			}
			if (!instance.introCmdDisabled)
			{
				text = text + "\n\n>INTRO\n" + IntroSongCommand.description;
			}
			if (!instance.timeCmdDisabled)
			{
				text = text + "\n\n>TIME\n" + TimeCommand.description;
			}
			if (!instance.clearCmdDisabled)
			{
				text = text + "\n\n>CLEAR\n" + ClearScreenCommand.description;
			}
			if (!instance.switchCmdDisabled)
			{
				text = text + "\n\n>S\n" + SwitchCommand.description;
			}
			return text + "\n\n";
		}
	}
	internal class HornCommand
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Func<string> <0>__returnText;

			public static TerminalParseSentenceEventHandler <1>__onParsedPlayerSentance;
		}

		public static bool isBlaring = false;

		public static string description = "Holds the horn down for you for the next X-Amount of seconds (editable in config)";

		public static void hornCommand()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			CommandInfo val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = returnText;
			TerminalApi.AddCommand("horn", val, (string)null, true);
			object obj = <>O.<1>__onParsedPlayerSentance;
			if (obj == null)
			{
				TerminalParseSentenceEventHandler val2 = onParsedPlayerSentance;
				<>O.<1>__onParsedPlayerSentance = val2;
				obj = (object)val2;
			}
			Events.TerminalParsedSentence += (TerminalParseSentenceEventHandler)obj;
		}

		public static string returnText()
		{
			if (isBlaring)
			{
				return "The horn is already making sound!\n";
			}
			if (ETCNetworkHandler.Instance.hornCmdDisabled)
			{
				return "This command is disabled by the host.\n";
			}
			if ((Object)(object)Object.FindAnyObjectByType<ShipAlarmCord>() == (Object)null)
			{
				return "You have not yet purchased the horn.\n";
			}
			return "The horn will continue to sound.";
		}

		private static void onParsedPlayerSentance(object sender, TerminalParseSentenceEventArgs e)
		{
			if (!ETCNetworkHandler.Instance.switchCmdDisabled)
			{
				ParsedPlayerSentanceHandler.onParsedPlayerSentance(sender, e);
			}
		}

		public static async Task onHornStandard()
		{
			if (isBlaring || ETCNetworkHandler.Instance.hornCmdDisabled)
			{
				return;
			}
			ShipAlarmCord horn = Object.FindAnyObjectByType<ShipAlarmCord>();
			if (!((Object)(object)horn == (Object)null))
			{
				isBlaring = true;
				System.Timers.Timer timer = new System.Timers.Timer(ETCNetworkHandler.Instance.hornSeconds * 1000);
				timer.Elapsed += delegate(object sender, ElapsedEventArgs e)
				{
					OnTimerElapsedAsync(sender, e, horn);
				};
				timer.Start();
				while (timer.Enabled)
				{
					await Task.Delay(200);
					horn.HoldCordDown();
				}
				isBlaring = false;
			}
		}

		public static async Task onHornTimed(int seconds)
		{
			if (isBlaring || ETCNetworkHandler.Instance.hornCmdDisabled)
			{
				return;
			}
			ShipAlarmCord horn = Object.FindAnyObjectByType<ShipAlarmCord>();
			if (!((Object)(object)horn == (Object)null))
			{
				isBlaring = true;
				System.Timers.Timer timer = new System.Timers.Timer(seconds * 1000);
				timer.Elapsed += delegate(object sender, ElapsedEventArgs e)
				{
					OnTimerElapsedAsync(sender, e, horn);
				};
				timer.Start();
				while (timer.Enabled)
				{
					await Task.Delay(200);
					horn.HoldCordDown();
				}
				isBlaring = false;
			}
		}

		private static async void OnTimerElapsedAsync(object sender, ElapsedEventArgs e, ShipAlarmCord horn)
		{
			((System.Timers.Timer)sender).Stop();
			horn.StopHorn();
		}
	}
	internal class IntroSongCommand : NetworkBehaviour
	{
		public static string description = "Plays the intro song.";

		public void introSongCommand()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Expected O, but got Unknown
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Expected O, but got Unknown
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Expected O, but got Unknown
			CommandInfo val = new CommandInfo
			{
				Category = "none",
				Description = description,
				DisplayTextSupplier = PlayIntro
			};
			TerminalApi.AddCommand("intro", val, (string)null, true);
			TerminalApi.AddCommand("song", new CommandInfo
			{
				Category = "none",
				Description = description,
				DisplayTextSupplier = PlayIntro
			}, (string)null, true);
			TerminalApi.AddCommand("introsong", new CommandInfo
			{
				Category = "none",
				Description = description,
				DisplayTextSupplier = PlayIntro
			}, (string)null, true);
			TerminalApi.AddCommand("intro-song", new CommandInfo
			{
				Category = "none",
				Description = description,
				DisplayTextSupplier = PlayIntro
			}, (string)null, true);
			TerminalApi.AddCommand("intro song", new CommandInfo
			{
				Category = "none",
				Description = description,
				DisplayTextSupplier = PlayIntro
			}, (string)null, true);
			TerminalApi.AddCommand("great asset", new CommandInfo
			{
				Category = "none",
				Description = description,
				DisplayTextSupplier = PlayIntro
			}, (string)null, true);
			TerminalApi.AddCommand("greatasset", new CommandInfo
			{
				Category = "none",
				Description = description,
				DisplayTextSupplier = PlayIntro
			}, (string)null, true);
			TerminalApi.AddCommand("ga", new CommandInfo
			{
				Category = "none",
				Description = description,
				DisplayTextSupplier = PlayIntro
			}, (string)null, true);
		}

		public string PlayIntro()
		{
			if (ETCNetworkHandler.Instance.introCmdDisabled)
			{
				return "This command is disabled by the host.\n";
			}
			if (ETCNetworkHandler.Instance.introPlaying)
			{
				return "Song is already playing, please try again once it has stopped playing\n";
			}
			if (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost)
			{
				ETCNetworkHandler.Instance.PlayIntroSongClientRpc();
			}
			else
			{
				ETCNetworkHandler.Instance.PlayIntroSongServerRpc();
			}
			return "Now playing a banger song!\n";
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "IntroSongCommand";
		}
	}
	internal class InverseTeleportCommand
	{
		public static string description = "Inverse teleports everyone on the inverse teleporter.";

		public static void inverseTeleportCommand()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			CommandInfo val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = OnInverseTeleportCommand;
			TerminalApi.AddCommand("iteleport", val, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = OnInverseTeleportCommand;
			TerminalApi.AddCommand("itp", val, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = OnInverseTeleportCommand;
			TerminalApi.AddCommand("inverseteleport", val, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = OnInverseTeleportCommand;
			TerminalApi.AddCommand("inverse-teleport", val, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = OnInverseTeleportCommand;
			TerminalApi.AddCommand("inverse teleport", val, (string)null, true);
		}

		private static string OnInverseTeleportCommand()
		{
			if (ETCNetworkHandler.Instance.itpCmdDisabled)
			{
				return "This command is disabled by the host.\n";
			}
			if (!StartOfRound.Instance.shipDoorsEnabled || !StartOfRound.Instance.currentLevel.planetHasTime)
			{
				return "You are currently not on a moon.\n";
			}
			if ((Object)(object)GameObject.Find("InverseTeleporter(Clone)") == (Object)null)
			{
				return "You do not own the inverse teleporter.\n";
			}
			ShipTeleporter component = GameObject.Find("InverseTeleporter(Clone)").GetComponent<ShipTeleporter>();
			FieldInfo field = ((object)component).GetType().GetField("cooldownTime", BindingFlags.Instance | BindingFlags.NonPublic);
			float num = (float)field.GetValue(component);
			if (field == null)
			{
				return "Your inverse steleporter does not have a cooldown.\n";
			}
			if ((Object)(object)component == (Object)null)
			{
				return "You do not own the inverse teleporter. If you do, try restarting the game.\n";
			}
			if (!component.buttonTrigger.interactable)
			{
				return "Inverse teleporter is on cooldown, " + Math.Round(num, 1) + " seconds remain.\n";
			}
			((UnityEvent<PlayerControllerB>)(object)component.buttonTrigger.onInteract).Invoke(GameNetworkManager.Instance.localPlayerController);
			return "Teleporting player to facility.\n";
		}
	}
	internal class LaunchCommand
	{
		public static string description = "Launches or Lands the ship.";

		public static void launchCommand()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			CommandInfo val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = OnLaunchCommand;
			CommandInfo val2 = val;
			TerminalApi.AddCommand("launch", val2, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = OnLaunchCommand;
			TerminalApi.AddCommand("go", val, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = OnLaunchCommand;
			TerminalApi.AddCommand("start", val, (string)null, true);
		}

		private static string OnLaunchCommand()
		{
			if (ETCNetworkHandler.Instance.launchCmdDisabled)
			{
				return "This command is disabled by the host.\n";
			}
			if (!NetworkManager.Singleton.IsHost && !NetworkManager.Singleton.IsServer && ExtraTerminalCommandsBase.daysJoined <= 0)
			{
				return "You have just joined this game. You can not launch the ship yet, please wait a day.\n";
			}
			if ((Object)(object)GameObject.Find("StartGameLever") == (Object)null)
			{
				return "Can not find start lever.\n";
			}
			StartMatchLever component = GameObject.Find("StartGameLever").GetComponent<StartMatchLever>();
			if ((Object)(object)component == (Object)null)
			{
				return "Can not find start lever.\n";
			}
			if ((StartOfRound.Instance.shipDoorsEnabled && !StartOfRound.Instance.shipHasLanded && !StartOfRound.Instance.shipIsLeaving) || (!StartOfRound.Instance.shipDoorsEnabled && StartOfRound.Instance.travellingToNewLevel))
			{
				return "Unable to complete action. The ship has already been launched.\n";
			}
			if (!ETCNetworkHandler.Instance.allowLaunchOnMoon && component.leverHasBeenPulled)
			{
				return "Could not launch to space, you can only launch to a moon. This is due to config settings.\n";
			}
			component.PullLever();
			component.LeverAnimation();
			if (component.leverHasBeenPulled)
			{
				component.StartGame();
				return "Ship landing\n";
			}
			component.EndGame();
			return "Ship launched\n";
		}
	}
	internal class LightsCommand
	{
		public static string description = "Toggles the lightswitch.";

		public static void lightsCommand()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			CommandInfo val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = onLightCommand;
			CommandInfo val2 = val;
			TerminalApi.AddCommand("lights", val2, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = onLightCommand;
			TerminalApi.AddCommand("light", val, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = onLightCommand;
			TerminalApi.AddCommand("l", val, (string)null, true);
		}

		private static string onLightCommand()
		{
			if (ETCNetworkHandler.Instance.lightCmdDisabled)
			{
				return "This command is disabled by the host.\n";
			}
			((UnityEvent<PlayerControllerB>)(object)GameObject.Find("LightSwitch").GetComponent<InteractTrigger>().onInteract).Invoke(GameNetworkManager.Instance.localPlayerController);
			return "Toggeled the lights.\n";
		}
	}
	internal class RandomMoonCommand
	{
		public static string description = "Sends you to a random moon. Use [Weather/Money/Both] to blacklist moons that contain this.";

		public static void randomMoonCommand()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			CommandInfo val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = onRandomMoonNoFilter;
			CommandInfo val2 = val;
			if (ExtraTerminalCommandsBase.configAllowRandomWeatherFilter.Value)
			{
				val = new CommandInfo();
				val.Category = "none";
				val.Description = description;
				val.DisplayTextSupplier = onRandomMoonWeather;
				TerminalApi.AddCommand("r w", val, (string)null, true);
				val = new CommandInfo();
				val.Category = "none";
				val.Description = description;
				val.DisplayTextSupplier = onRandomMoonWeather;
				TerminalApi.AddCommand("r weather", val, (string)null, true);
				val = new CommandInfo();
				val.Category = "none";
				val.Description = description;
				val.DisplayTextSupplier = onRandomMoonWeather;
				TerminalApi.AddCommand("random weather", val, (string)null, true);
			}
			TerminalApi.AddCommand("random", val2, (string)null, true);
			val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = onRandomMoonNoFilter;
			TerminalApi.AddCommand("r", val, (string)null, true);
		}

		private static string onRandomMoonNoFilter()
		{
			if (ETCNetworkHandler.Instance.randomCmdDisabled)
			{
				return "This command is disabled by the host.\n";
			}
			StartOfRound val = Object.FindObjectOfType<StartOfRound>();
			Terminal val2 = Object.FindObjectOfType<Terminal>();
			if (val.shipDoorsEnabled)
			{
				return "You are currently on a moon. Can not travel to a random moon\n";
			}
			List<SelectableLevel> list = new List<SelectableLevel>();
			SelectableLevel[] moonsCatalogueList = val2.moonsCatalogueList;
			foreach (SelectableLevel item in moonsCatalogueList)
			{
				list.Add(item);
			}
			return goToRandomPlanet(list);
		}

		private static string onRandomMoonWeather()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Invalid comparison between Unknown and I4
			if (!ETCNetworkHandler.Instance.allowWeatherFilter)
			{
				return "This filter is disabled by the host.\n";
			}
			StartOfRound val = Object.FindObjectOfType<StartOfRound>();
			Terminal val2 = Object.FindObjectOfType<Terminal>();
			if (val.shipDoorsEnabled)
			{
				return "You are currently on a moon. Can not travel to a random moon.\n";
			}
			List<SelectableLevel> list = new List<SelectableLevel>();
			SelectableLevel[] moonsCatalogueList = val2.moonsCatalogueList;
			foreach (SelectableLevel val3 in moonsCatalogueList)
			{
				if ((int)val3.currentWeather == -1)
				{
					list.Add(val3);
				}
			}
			return goToRandomPlanet(list);
		}

		private static string goToRandomPlanet(List<SelectableLevel> moons)
		{
			StartOfRound val = Object.FindObjectOfType<StartOfRound>();
			Terminal val2 = Object.FindObjectOfType<Terminal>();
			Random random = new Random();
			int num = ExtraTerminalCommandsBase.configRandomCommandPrice.Value;
			if (num < 0)
			{
				num = 0;
			}
			if (val2.groupCredits - num < 0)
			{
				return $"Could not go to a random moon, you have too little money, you need atleast: {num} credits.\n";
			}
			int index = random.Next(0, moons.Count);
			if (((NetworkBehaviour)val).IsHost || ((NetworkBehaviour)val).IsServer)
			{
				val.ChangeLevelClientRpc(moons[index].levelID, val2.groupCredits - num);
				ETCNetworkHandler.Instance.unknownPlanetClientRpc();
			}
			else
			{
				val.ChangeLevelServerRpc(moons[index].levelID, val2.groupCredits - num);
				ETCNetworkHandler.Instance.unknownPlanetServerRpc();
			}
			return "Traveled to ???\n";
		}
	}
	internal class SwitchCommand
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static TerminalParseSentenceEventHandler <0>__onParsedPlayerSentance;

			public static Func<string> <1>__returnText;
		}

		public static string description = "Switches the camera view to the next or specified user";

		public static void switchCommand()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			object obj = <>O.<0>__onParsedPlayerSentance;
			if (obj == null)
			{
				TerminalParseSentenceEventHandler val = onParsedPlayerSentance;
				<>O.<0>__onParsedPlayerSentance = val;
				obj = (object)val;
			}
			Events.TerminalParsedSentence += (TerminalParseSentenceEventHandler)obj;
			CommandInfo val2 = new CommandInfo();
			val2.Category = "hide";
			val2.Description = description;
			val2.DisplayTextSupplier = returnText;
			TerminalApi.AddCommand("s", val2, (string)null, true);
			val2 = new CommandInfo();
			val2.Category = "hide";
			val2.Description = description;
			val2.DisplayTextSupplier = returnText;
			TerminalApi.AddCommand("sw", val2, (string)null, true);
		}

		public static string returnText()
		{
			if (ETCNetworkHandler.Instance.switchCmdDisabled)
			{
				return "This command is disabled by the host.\n";
			}
			return "Switched radar scan view\n";
		}

		private static void onParsedPlayerSentance(object sender, TerminalParseSentenceEventArgs e)
		{
			if (!ETCNetworkHandler.Instance.switchCmdDisabled)
			{
				ParsedPlayerSentanceHandler.onParsedPlayerSentance(sender, e);
			}
		}

		public static void switchNormal()
		{
			StartOfRound.Instance.mapScreen.SwitchRadarTargetForward(true);
		}

		public static void switchInput(string[] userInputParts)
		{
			Terminal val = Object.FindObjectOfType<Terminal>();
			int num = val.CheckForPlayerNameCommand("switch", userInputParts[1]);
			StartOfRound.Instance.mapScreen.SwitchRadarTargetAndSync(num);
		}
	}
	internal class TeleportCommand
	{
		public static string description = "Teleports the current selected player on the camera.";

		public static void teleportCommand()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			CommandInfo val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = OnTeleportCommand;
			CommandInfo val2 = val;
			val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = OnTeleportCommand;
			CommandInfo val3 = val;
			TerminalApi.AddCommand("teleport", val2, (string)null, true);
			TerminalApi.AddCommand("tp", val3, (string)null, true);
		}

		private static string OnTeleportCommand()
		{
			if (ETCNetworkHandler.Instance.tpCmdDisabled)
			{
				return "This command is disabled by the host.\n";
			}
			if ((Object)(object)GameObject.Find("Teleporter(Clone)") == (Object)null)
			{
				return "You do not own the teleporter.\n";
			}
			ShipTeleporter component = GameObject.Find("Teleporter(Clone)").GetComponent<ShipTeleporter>();
			FieldInfo field = ((object)component).GetType().GetField("cooldownTime", BindingFlags.Instance | BindingFlags.NonPublic);
			float num = (float)field.GetValue(component);
			if (field == null)
			{
				return "Your teleporter does not have a cooldown.\n";
			}
			if ((Object)(object)component == (Object)null)
			{
				return "You do not own the teleporter. If you do, try restarting the game.\n";
			}
			if (!component.buttonTrigger.interactable)
			{
				return "Teleporter is on cooldown, " + Math.Round(num, 1) + " seconds remain.\n";
			}
			((UnityEvent<PlayerControllerB>)(object)component.buttonTrigger.onInteract).Invoke(GameNetworkManager.Instance.localPlayerController);
			return "Teleporting player to ship.\n";
		}
	}
	internal class TimeCommand
	{
		public static string description = "Displays the current time on the planet.";

		public static void timeCommand()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			CommandInfo val = new CommandInfo();
			val.Category = "none";
			val.Description = description;
			val.DisplayTextSupplier = OnTimeCommand;
			CommandInfo val2 = val;
			TerminalApi.AddCommand("time", val2, (string)null, true);
		}

		private static string OnTimeCommand()
		{
			if (ETCNetworkHandler.Instance.timeCmdDisabled)
			{
				return "This command is disabled by the host.\n";
			}
			if (StartOfRound.Instance.currentLevel.planetHasTime && StartOfRound.Instance.shipDoorsEnabled)
			{
				return "The time is " + ((TMP_Text)HUDManager.Instance.clockNumber).text.Replace('\n', ' ') + ".\n";
			}
			return "You are currently not on a moon, please try again once you are on a moon.\n";
		}
	}
}
namespace ExtraTerminalCommands.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	public class StartOfRoundPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("SetMapScreenInfoToCurrentLevel")]
		public static void HideMapScreenInfo(VideoPlayer ___screenLevelVideoReel, TextMeshProUGUI ___screenLevelDescription)
		{
			if (ETCNetworkHandler.Instance.allowHidePlanet && ETCNetworkHandler.Instance.randomMoonCommandRan)
			{
				((TMP_Text)___screenLevelDescription).text = "Orbiting: Unkown\nPopulation: Unknown\nConditions: Unknown\nFauna: Unknown\nWeather: Unknown";
				((Behaviour)___screenLevelVideoReel).enabled = false;
				___screenLevelVideoReel.clip = null;
				((Component)___screenLevelVideoReel).gameObject.SetActive(false);
				___screenLevelVideoReel.Stop();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("DisableShipSpeaker")]
		public static void DisableShipSpeaker()
		{
			if (ETCNetworkHandler.Instance.introPlaying)
			{
				if (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost)
				{
					ETCNetworkHandler.Instance.canceledSongClientRpc();
				}
				else
				{
					ETCNetworkHandler.Instance.canceledSongServerRpc();
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnClientConnect")]
		public static void onClientConnectPatch()
		{
			ETCNetworkHandler instance = ETCNetworkHandler.Instance;
			if (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost)
			{
				ETCNetworkHandler.Instance.syncVariablesClientRpc(instance.extraCmdDisabled, instance.timeCmdDisabled, instance.launchCmdDisabled, instance.tpCmdDisabled, instance.itpCmdDisabled, instance.lightCmdDisabled, instance.doorCmdDisabled, instance.introCmdDisabled, instance.randomCmdDisabled, instance.clearCmdDisabled, instance.switchCmdDisabled, instance.hornCmdDisabled, instance.allowWeatherFilter, instance.allowHidePlanet, instance.randomMoonPrice, instance.allowLaunchOnMoon, instance.hornSeconds, instance.hornMaxSeconds);
			}
			else
			{
				ETCNetworkHandler.Instance.syncVariablesServerRpc();
			}
			addSwitchCmd();
		}

		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		public static void onStartup()
		{
			addSwitchCmd();
			addHornCmd();
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnLocalDisconnect")]
		public static void onLocalDisconnectPatch()
		{
			ExtraTerminalCommandsBase.daysJoined = 0;
		}

		[HarmonyPostfix]
		[HarmonyPatch("openingDoorsSequence")]
		public static void openingDoorsSequencePatch()
		{
			ExtraTerminalCommandsBase.daysJoined++;
		}

		public static void addSwitchCmd()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			if (!ETCNetworkHandler.Instance.switchCmdDisabled)
			{
				GameNetworkManager[] array = Object.FindObjectsOfType<GameNetworkManager>();
				GameNetworkManager[] array2 = array;
				foreach (GameNetworkManager val in array2)
				{
					string text = "sw " + val.username;
					CommandInfo val2 = new CommandInfo();
					val2.Category = "none";
					val2.Description = SwitchCommand.description;
					val2.DisplayTextSupplier = SwitchCommand.returnText;
					TerminalApi.AddCommand(text, val2, (string)null, true);
					string text2 = "s " + val.username;
					val2 = new CommandInfo();
					val2.Category = "none";
					val2.Description = SwitchCommand.description;
					val2.DisplayTextSupplier = SwitchCommand.returnText;
					TerminalApi.AddCommand(text2, val2, (string)null, true);
					ExtraTerminalCommandsBase.mls.LogInfo((object)("Added command: s/sw " + val.username));
				}
			}
		}

		public static void addHornCmd()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			if (!ETCNetworkHandler.Instance.hornCmdDisabled)
			{
				for (int i = 0; i <= ETCNetworkHandler.Instance.hornMaxSeconds; i++)
				{
					string text = "horn " + i;
					CommandInfo val = new CommandInfo();
					val.Category = "none";
					val.Description = HornCommand.description;
					val.DisplayTextSupplier = HornCommand.returnText;
					TerminalApi.AddCommand(text, val, (string)null, true);
				}
			}
		}
	}
}
namespace ExtraTerminalCommands.Networking
{
	public class ETCNetworkHandler : NetworkBehaviour
	{
		public bool introPlaying;

		public bool randomMoonCommandRan;

		public bool extraCmdDisabled = ExtraTerminalCommandsBase.configExtraCommandsList.Value;

		public bool timeCmdDisabled = ExtraTerminalCommandsBase.configTimeCommand.Value;

		public bool launchCmdDisabled = ExtraTerminalCommandsBase.configLaunchCommand.Value;

		public bool tpCmdDisabled = ExtraTerminalCommandsBase.configTeleportCommand.Value;

		public bool itpCmdDisabled = ExtraTerminalCommandsBase.configInverseTeleportCommand.Value;

		public bool lightCmdDisabled = ExtraTerminalCommandsBase.configLightsCommand.Value;

		public bool doorCmdDisabled = ExtraTerminalCommandsBase.configDoorsCommand.Value;

		public bool introCmdDisabled = ExtraTerminalCommandsBase.configIntroSongCommand.Value;

		public bool randomCmdDisabled = ExtraTerminalCommandsBase.configRandomMoonCommand.Value;

		public bool clearCmdDisabled = ExtraTerminalCommandsBase.configClearCommand.Value;

		public bool switchCmdDisabled = ExtraTerminalCommandsBase.configSwitchCommand.Value;

		public bool hornCmdDisabled = ExtraTerminalCommandsBase.configHornCommand.Value;

		public bool allowWeatherFilter = ExtraTerminalCommandsBase.configAllowRandomWeatherFilter.Value;

		public bool allowHidePlanet = ExtraTerminalCommandsBase.configHidePlanet.Value;

		public int randomMoonPrice = ExtraTerminalCommandsBase.configRandomCommandPrice.Value;

		public bool allowLaunchOnMoon = ExtraTerminalCommandsBase.configAllowLaunchOnMoon.Value;

		public int hornSeconds = ExtraTerminalCommandsBase.configHornDefaultseconds.Value;

		public int hornMaxSeconds = ExtraTerminalCommandsBase.configHornMaxSeconds.Value;

		private CancellationTokenSource introTimerCancellation;

		public static ETCNetworkHandler Instance { get; private set; }

		public static event Action<string> LevelEvent;

		public override void OnNetworkSpawn()
		{
			ETCNetworkHandler.LevelEvent = null;
			if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && (Object)(object)Instance != (Object)null)
			{
				((Component)Instance).gameObject.GetComponent<NetworkObject>().Despawn(true);
				ExtraTerminalCommandsBase.mls.LogWarning((object)"Despawned network object. Don't fear, if you just started a level, this may happen.");
			}
			Instance = this;
			((NetworkBehaviour)this).OnNetworkSpawn();
		}

		[ClientRpc]
		public void EventClientRpc(string eventName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2607261955u, val, (RpcDelivery)0);
				bool flag = eventName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(eventName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2607261955u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ETCNetworkHandler.LevelEvent != null)
			{
				ETCNetworkHandler.LevelEvent(eventName);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void syncVariablesServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3866133877u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3866133877u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					syncVariablesClientRpc(extraCmdDisabled, timeCmdDisabled, launchCmdDisabled, tpCmdDisabled, itpCmdDisabled, lightCmdDisabled, doorCmdDisabled, introCmdDisabled, randomCmdDisabled, clearCmdDisabled, switchCmdDisabled, hornCmdDisabled, allowWeatherFilter, allowHidePlanet, randomMoonPrice, allowLaunchOnMoon, hornSeconds, hornMaxSeconds);
				}
			}
		}

		[ClientRpc]
		public void syncVariablesClientRpc(bool extraCmd, bool timeCmd, bool launchCmd, bool tpCmd, bool itpCmd, bool lightCmd, bool doorCmd, bool introCmd, bool randomCmd, bool clearCmd, bool switchCmd, bool hornCmd, bool weatherFilter, bool hidePlanet, int moonPrice, bool launchOnMoon, int hornSec, int hornMaxSec)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2037871955u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref extraCmd, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref timeCmd, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref launchCmd, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref tpCmd, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref itpCmd, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref lightCmd, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref doorCmd, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref introCmd, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref randomCmd, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref clearCmd, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref switchCmd, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hornCmd, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref weatherFilter, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hidePlanet, default(ForPrimitives));
					BytePacker.WriteValueBitPacked(val2, moonPrice);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref launchOnMoon, default(ForPrimitives));
					BytePacker.WriteValueBitPacked(val2, hornSec);
					BytePacker.WriteValueBitPacked(val2, hornMaxSec);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2037871955u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					randomMoonPrice = moonPrice;
					extraCmdDisabled = extraCmd;
					timeCmdDisabled = timeCmd;
					launchCmdDisabled = launchCmd;
					tpCmdDisabled = tpCmd;
					itpCmdDisabled = itpCmd;
					lightCmdDisabled = lightCmd;
					doorCmdDisabled = doorCmd;
					introCmdDisabled = introCmd;
					randomCmdDisabled = randomCmd;
					clearCmdDisabled = clearCmd;
					switchCmdDisabled = switchCmd;
					hornCmdDisabled = hornCmd;
					allowWeatherFilter = weatherFilter;
					allowHidePlanet = hidePlanet;
					randomMoonPrice = moonPrice;
					allowLaunchOnMoon = launchOnMoon;
					hornSeconds = hornSec;
					hornMaxSeconds = hornMaxSec;
					ExtraTerminalCommandsBase.mls.LogInfo((object)"Synced variables with host.");
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PlayIntroSongServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2578151003u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2578151003u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ExtraTerminalCommandsBase.mls.LogInfo((object)"Called play intro ServerRPC");
					PlayIntroSongClientRpc();
				}
			}
		}

		[ClientRpc]
		public void PlayIntroSongClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3024087000u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3024087000u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				ExtraTerminalCommandsBase.mls.LogInfo((object)"Called intro play ClientRPC");
				StartOfRound val3 = Object.FindObjectOfType<StartOfRound>();
				GameObject val4 = GameObject.Find("SpeakerAudio");
				if ((Object)(object)val3 == (Object)null || (Object)(object)val4 == (Object)null)
				{
					ExtraTerminalCommandsBase.mls.LogError((object)"Could not find speakers");
					return;
				}
				val4.GetComponent<AudioSource>().PlayOneShot(val3.shipIntroSpeechSFX);
				introPlaying = true;
				startIntroTimer();
			}
		}

		[ClientRpc]
		public void canceledSongClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1785242979u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1785242979u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					introPlaying = false;
					introTimerCancellation?.Cancel();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void canceledSongServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4151275566u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4151275566u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					canceledSongClientRpc();
				}
			}
		}

		public async Task startIntroTimer()
		{
			try
			{
				await Task.Delay(38200, introTimerCancellation.Token);
				introPlaying = false;
			}
			catch (TaskCanceledException)
			{
				introPlaying = false;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void unknownPlanetServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(130605597u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 130605597u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					unknownPlanetClientRpc();
				}
			}
		}

		[ClientRpc]
		public void unknownPlanetClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2486707572u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2486707572u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					randomMoonCommandRan = true;
					undoRandomMoonCmd();
				}
			}
		}

		private async Task undoRandomMoonCmd()
		{
			await Task.Delay(6000);
			randomMoonCommandRan = false;
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ETCNetworkHandler()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2607261955u, new RpcReceiveHandler(__rpc_handler_2607261955));
			NetworkManager.__rpc_func_table.Add(3866133877u, new RpcReceiveHandler(__rpc_handler_3866133877));
			NetworkManager.__rpc_func_table.Add(2037871955u, new RpcReceiveHandler(__rpc_handler_2037871955));
			NetworkManager.__rpc_func_table.Add(2578151003u, new RpcReceiveHandler(__rpc_handler_2578151003));
			NetworkManager.__rpc_func_table.Add(3024087000u, new RpcReceiveHandler(__rpc_handler_3024087000));
			NetworkManager.__rpc_func_table.Add(1785242979u, new RpcReceiveHandler(__rpc_handler_1785242979));
			NetworkManager.__rpc_func_table.Add(4151275566u, new RpcReceiveHandler(__rpc_handler_4151275566));
			NetworkManager.__rpc_func_table.Add(130605597u, new RpcReceiveHandler(__rpc_handler_130605597));
			NetworkManager.__rpc_func_table.Add(2486707572u, new RpcReceiveHandler(__rpc_handler_2486707572));
		}

		private static void __rpc_handler_2607261955(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string eventName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref eventName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ETCNetworkHandler)(object)target).EventClientRpc(eventName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3866133877(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ETCNetworkHandler)(object)target).syncVariablesServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2037871955(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool extraCmd = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref extraCmd, default(ForPrimitives));
				bool timeCmd = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref timeCmd, default(ForPrimitives));
				bool launchCmd = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref launchCmd, default(ForPrimitives));
				bool tpCmd = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref tpCmd, default(ForPrimitives));
				bool itpCmd = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref itpCmd, default(ForPrimitives));
				bool lightCmd = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref lightCmd, default(ForPrimitives));
				bool doorCmd = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref doorCmd, default(ForPrimitives));
				bool introCmd = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref introCmd, default(ForPrimitives));
				bool randomCmd = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref randomCmd, default(ForPrimitives));
				bool clearCmd = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref clearCmd, default(ForPrimitives));
				bool switchCmd = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref switchCmd, default(ForPrimitives));
				bool hornCmd = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hornCmd, default(ForPrimitives));
				bool weatherFilter = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref weatherFilter, default(ForPrimitives));
				bool hidePlanet = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hidePlanet, default(ForPrimitives));
				int moonPrice = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref moonPrice);
				bool launchOnMoon = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref launchOnMoon, default(ForPrimitives));
				int hornSec = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref hornSec);
				int hornMaxSec = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref hornMaxSec);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ETCNetworkHandler)(object)target).syncVariablesClientRpc(extraCmd, timeCmd, launchCmd, tpCmd, itpCmd, lightCmd, doorCmd, introCmd, randomCmd, clearCmd, switchCmd, hornCmd, weatherFilter, hidePlanet, moonPrice, launchOnMoon, hornSec, hornMaxSec);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2578151003(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ETCNetworkHandler)(object)target).PlayIntroSongServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3024087000(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ETCNetworkHandler)(object)target).PlayIntroSongClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1785242979(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ETCNetworkHandler)(object)target).canceledSongClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4151275566(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ETCNetworkHandler)(object)target).canceledSongServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_130605597(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ETCNetworkHandler)(object)target).unknownPlanetServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2486707572(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ETCNetworkHandler)(object)target).unknownPlanetClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "ETCNetworkHandler";
		}
	}
	[HarmonyPatch]
	public class NetworkObjectManager
	{
		private static GameObject networkPrefab;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		public static void Init()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			if (!((Object)(object)networkPrefab != (Object)null))
			{
				networkPrefab = (GameObject)ExtraTerminalCommandsBase.MainAssetBundle.LoadAsset("Assets/AssetsBundlesWanted/NetworkHandler.prefab");
				networkPrefab.AddComponent<ETCNetworkHandler>();
				NetworkManager.Singleton.AddNetworkPrefab(networkPrefab);
				ExtraTerminalCommandsBase.mls.LogInfo((object)"Loaded NetworkHandler");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		private static void SpawnNetworkHandler()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity);
				val.GetComponent<NetworkObject>().Spawn(false);
				ExtraTerminalCommandsBase.mls.LogInfo((object)"Spawned NetworkHandler");
			}
		}
	}
}
namespace ExtraTerminalCommands.Handlers
{
	internal class ParsedPlayerSentanceHandler
	{
		public static void onParsedPlayerSentance(object sender, TerminalParseSentenceEventArgs e)
		{
			string terminalInput = TerminalApi.GetTerminalInput();
			string[] array = terminalInput.Split(' ');
			if (array.Length == 1)
			{
				if (array[0] == "s" || array[0] == "sw")
				{
					SwitchCommand.switchNormal();
				}
				else if (array[0] == "horn")
				{
					HornCommand.onHornStandard();
				}
			}
			else if (array.Length == 2)
			{
				int result;
				if (array[0] == "s" || array[0] == "sw")
				{
					SwitchCommand.switchInput(array);
				}
				else if (array[0] == "horn" && int.TryParse(array[1], out result) && result <= ETCNetworkHandler.Instance.hornMaxSeconds)
				{
					HornCommand.onHornTimed(result);
				}
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace Beauver.ExtraTerminalCommands.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}