Decompiled source of Billboards v1.8.2

Billboards.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
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 BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Billboards.Modules;
using GameNetcodeStuff;
using HarmonyLib;
using LethalNetworkAPI;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("UnloadedHangar")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds billboards to several moons")]
[assembly: AssemblyFileVersion("1.8.2.0")]
[assembly: AssemblyInformationalVersion("1.7.7+75e95b7d38c16d78266d6b3452ddfb59cc4fbbc1")]
[assembly: AssemblyProduct("Billboards")]
[assembly: AssemblyTitle("Billboards")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.8.2.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;
		}
	}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
public sealed class RequireNetworking : Attribute
{
	private bool isNetworkingSetUp = false;

	public RequireNetworking(bool isNetworkingSetUp)
	{
		this.isNetworkingSetUp = isNetworkingSetUp;
		if (!this.isNetworkingSetUp)
		{
			Debug.LogWarning((object)("Method '" + MethodBase.GetCurrentMethod().Name + "' requires networking, but either it has none, or the flag has the wrong value."));
		}
	}
}
namespace Billboards
{
	internal class Content
	{
		public static GameObject[] AssetsList;

		public static void Load()
		{
			LoadAssetsFromAssetBundle();
		}

		private static void LoadAssetsFromAssetBundle()
		{
			try
			{
				string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location);
				string text = Path.Combine(directoryName, "bilboards");
				AssetBundle val = AssetBundle.LoadFromFile(text);
				AssetsList = val.LoadAllAssets<GameObject>();
				Plugin.logger.LogInfo((object)"Successfully loaded assets from AssetBundle!");
			}
			catch (Exception arg)
			{
				Plugin.logger.LogError((object)$"Error: failed to load assets from AssetBundle.\n\n{arg}");
			}
		}
	}
	public class ExternalContent : MonoBehaviour
	{
		internal static ExternalContent Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
		}

		public void Start()
		{
			((MonoBehaviour)this).Invoke("DelayedStart", 2f);
		}

		private void DelayedStart()
		{
			if (BillboardControler.GetCurrentLevel() == ManagerPatchClasses.PlanetDictionary[ManagerPatchClasses.SpawnPlanet.Artifice] && Plugin.ConfigManager.Artifice.Value)
			{
				((MonoBehaviour)this).StartCoroutine((IEnumerator)CoroutineStart("artifice.png"));
			}
			else if (BillboardControler.GetCurrentLevel() == ManagerPatchClasses.PlanetDictionary[ManagerPatchClasses.SpawnPlanet.Assurance] && Plugin.ConfigManager.Assurance.Value)
			{
				((MonoBehaviour)this).StartCoroutine((IEnumerator)CoroutineStart("assurance.png"));
			}
			else if (BillboardControler.GetCurrentLevel() == ManagerPatchClasses.PlanetDictionary[ManagerPatchClasses.SpawnPlanet.CompanyBuilding] && Plugin.ConfigManager.Company.Value)
			{
				((MonoBehaviour)this).StartCoroutine((IEnumerator)CoroutineStart("company.png"));
			}
			else if (BillboardControler.GetCurrentLevel() == ManagerPatchClasses.PlanetDictionary[ManagerPatchClasses.SpawnPlanet.Experimentation] && Plugin.ConfigManager.Experimentation.Value)
			{
				((MonoBehaviour)this).StartCoroutine((IEnumerator)CoroutineStart("experimentation.png"));
			}
			else if (BillboardControler.GetCurrentLevel() == ManagerPatchClasses.PlanetDictionary[ManagerPatchClasses.SpawnPlanet.Offense] && Plugin.ConfigManager.Offense.Value)
			{
				((MonoBehaviour)this).StartCoroutine((IEnumerator)CoroutineStart("offense.png"));
			}
			else if (BillboardControler.GetCurrentLevel() == ManagerPatchClasses.PlanetDictionary[ManagerPatchClasses.SpawnPlanet.Titan] && Plugin.ConfigManager.Titan.Value)
			{
				((MonoBehaviour)this).StartCoroutine((IEnumerator)CoroutineStart("titan.png"));
			}
		}

		public IEnumerator<UnityWebRequestAsyncOperation> CoroutineStart(string imageToLoad)
		{
			string path = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location);
			string convertedPath = Path.Combine(path, imageToLoad);
			UnityWebRequest www = UnityWebRequestTexture.GetTexture("file://" + convertedPath);
			yield return www.SendWebRequest();
			Texture2D texture = DownloadHandlerTexture.GetContent(www);
			((Renderer)BillboardControler.Instance.BillboardContent.GetComponent<MeshRenderer>()).material.mainTexture = (Texture)(object)texture;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Billboards-UnloadedHangar", "Billboards", "1.8.2")]
	public class Plugin : BaseUnityPlugin
	{
		public static class PluginInfo
		{
			public const string Guid = "Billboards-UnloadedHangar";

			public const string Name = "Billboards";

			public const string Ver = "1.8.2";
		}

		internal const bool ObsoleteMethodsErroring = true;

		internal static Plugin Instance;

		internal static ManualLogSource logger;

		internal static ConfigManager ConfigManager;

		internal Harmony _harmony;

		private void Awake()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = Logger.CreateLogSource("Billboards");
			logger.LogInfo((object)"Billboards has awoken!");
			ConfigManager = new ConfigManager();
			Content.Load();
			NetcodePatcherAwake();
			_harmony = new Harmony("Billboards-UnloadedHangar");
			_harmony.PatchAll(typeof(NetworkHandler));
			_harmony.PatchAll(typeof(ManagerPatchClasses));
			_harmony.PatchAll(typeof(TerminalCommands));
		}

		private void NetcodePatcherAwake()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			Type[] array2 = array;
			foreach (Type type in array2)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array3 = methods;
				MethodInfo[] array4 = array3;
				foreach (MethodInfo methodInfo in array4)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
}
namespace Billboards.Modules
{
	public class BillboardBreakerBox : MonoBehaviour
	{
		public int leversSwitchedOff = 2;

		public bool isPowerOn;

		public BillboardControler controler;

		private VideoPlayer player;

		public Animator[] breakerSwitches;

		public AudioSource thisAudioSource;

		public AudioSource breakerBoxHum;

		public AudioClip switchPowerSFX;

		public Light breakerBoxLight;

		public MeshRenderer breakerBoxLightRenderer;

		private bool permanentlyOff = false;

		private Material[] sharedMaterialsInternal;

		public Material lightOffMaterial;

		internal static BillboardBreakerBox Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
		}

		private void Start()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			player = ((Component)controler).GetComponent<VideoPlayer>();
			sharedMaterialsInternal = ((Renderer)breakerBoxLightRenderer).sharedMaterials;
			if ((Object)(object)player != (Object)null)
			{
				player.prepareCompleted += new EventHandler(PlayerReady);
			}
		}

		private void OnDestroy()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			if ((Object)(object)player != (Object)null)
			{
				player.prepareCompleted -= new EventHandler(PlayerReady);
			}
		}

		public void SwitchBreakerRPC()
		{
			NetworkHandler.SwitchBreakerMessage.SendAllClients(0, true, false);
		}

		public void SwitchBreaker(bool on)
		{
			if ((Object)(object)controler == (Object)null)
			{
				return;
			}
			if (permanentlyOff)
			{
				leversSwitchedOff--;
			}
			else
			{
				leversSwitchedOff++;
			}
			if (!permanentlyOff)
			{
				if (leversSwitchedOff <= 0)
				{
					breakerBoxHum.Play();
				}
				else if (leversSwitchedOff == 1)
				{
					breakerBoxHum.Stop();
				}
			}
			if (!permanentlyOff)
			{
				if (leversSwitchedOff <= 0 && !isPowerOn)
				{
					isPowerOn = true;
					PowerOn();
				}
				else if (leversSwitchedOff > 0 && isPowerOn)
				{
					isPowerOn = false;
					PowerOff();
				}
			}
		}

		private void PowerOff()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			player.Prepare();
			controler.BillboardContentBase.SetActive(false);
			controler.BillboardRenderTextureContent.SetActive(true);
			permanentlyOff = true;
			Landmine.SpawnExplosion(((Component)this).transform.position, true, 4f, 10f, 100, 0f, (GameObject)null, false);
			breakerBoxHum.Stop();
			((Behaviour)breakerBoxLight).enabled = false;
			sharedMaterialsInternal[1] = lightOffMaterial;
			sharedMaterialsInternal[1].color = Color.black;
			((Renderer)breakerBoxLightRenderer).sharedMaterials = sharedMaterialsInternal;
		}

		private void PowerOn()
		{
			player.Stop();
			controler.BillboardContentBase.SetActive(true);
			controler.BillboardRenderTextureContent.SetActive(false);
		}

		private void PlayerReady(VideoPlayer source)
		{
			player.Play();
		}
	}
	public class BillboardControler : MonoBehaviour
	{
		public Animator ThisAnimator;

		public BoxCollider TriggerBox;

		[Header("Content")]
		public GameObject BillboardRenderTextureContent;

		public GameObject BillboardContentBase;

		public GameObject BillboardContent;

		[Space]
		[Header("Misc")]
		public GameObject BillboardSupport;

		public GameObject BreakerBox;

		[Space]
		[Header("Screen materials")]
		public Material TakeyOriginalMaterial;

		public Material TakeyCaptainMaterial;

		public Material TakeyCuteMaterial;

		public Material TakeyErrorMaterial;

		public Material TakeyAlooMaterial;

		public Material TakeyBirthdayMaterial;

		public Dictionary<int, Material> BillboardScreenDictionary = new Dictionary<int, Material>();

		internal static BillboardControler Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
		}

		private void Start()
		{
			ConstructDictionary();
			CalculateSpawnTransformData();
		}

		internal void TransmitContent()
		{
			if (NetworkManager.Singleton.IsHost && GetCurrentLevel() != ManagerPatchClasses.PlanetDictionary[ManagerPatchClasses.SpawnPlanet.Offense])
			{
				DateTime now = DateTime.Now;
				DateTime dateTime = new DateTime(now.Year, 9, 1);
				DateTime dateTime2 = new DateTime(now.Year, 9, 7);
				if (now >= dateTime && now <= dateTime2)
				{
					NetworkHandler.TransmitRandomContentIdServerMessage.SendAllClients(5789, true);
				}
				else
				{
					NetworkHandler.TransmitRandomContentIdServerMessage.SendAllClients(GenerateRandomContentId(), true);
				}
			}
		}

		internal void SetReceivedRandomContentId(int generatedId)
		{
			try
			{
				((Renderer)BillboardContent.GetComponent<MeshRenderer>()).material = BillboardScreenDictionary[generatedId];
			}
			catch (Exception ex)
			{
				Plugin.logger.LogError((object)ex);
			}
		}

		internal int GenerateRandomContentId()
		{
			return (int)Random.Range(1f, 5f);
		}

		private void ConstructDictionary()
		{
			if (GetCurrentLevel() != ManagerPatchClasses.PlanetDictionary[ManagerPatchClasses.SpawnPlanet.Offense])
			{
				BillboardScreenDictionary.Add(1, TakeyOriginalMaterial);
				BillboardScreenDictionary.Add(2, TakeyCaptainMaterial);
				BillboardScreenDictionary.Add(3, TakeyCuteMaterial);
				BillboardScreenDictionary.Add(4, TakeyErrorMaterial);
				BillboardScreenDictionary.Add(5, TakeyAlooMaterial);
				BillboardScreenDictionary.Add(5789, TakeyBirthdayMaterial);
			}
		}

		internal void DestroySelf()
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		internal void CalculateSpawnTransformData()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: 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)
			if (GetCurrentLevel() == ManagerPatchClasses.PlanetDictionary[ManagerPatchClasses.SpawnPlanet.Artifice])
			{
				SetObjectTransformData(new Vector3(24.6231f, 41.006f, -151.6691f), new Quaternion(0f, 0.59494144f, 0f, -0.80376905f));
			}
			else if (GetCurrentLevel() == ManagerPatchClasses.PlanetDictionary[ManagerPatchClasses.SpawnPlanet.Assurance])
			{
				SetObjectTransformData(new Vector3(109.1466f, 33.4108f, 25.2918f), new Quaternion(0f, 0.9659258f, 0f, 0.2588191f));
			}
			else if (GetCurrentLevel() == ManagerPatchClasses.PlanetDictionary[ManagerPatchClasses.SpawnPlanet.CompanyBuilding])
			{
				SetObjectTransformData(new Vector3(-20.3698f, 13.3352f, -8.2763f), new Quaternion(0f, 0f, 0.016058357f, -0.9998711f), enableBillboardSupport: false, enableBreakerBox: false);
			}
			else if (GetCurrentLevel() == ManagerPatchClasses.PlanetDictionary[ManagerPatchClasses.SpawnPlanet.Experimentation])
			{
				SetObjectTransformData(new Vector3(-110.2656f, 11.7807f, -7.7252f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.5f, 0.5f, 0.5f), 0.05f, enableBillboardSupport: false, enableBreakerBox: false);
			}
			else if (GetCurrentLevel() == ManagerPatchClasses.PlanetDictionary[ManagerPatchClasses.SpawnPlanet.Offense])
			{
				SetObjectTransformData(new Vector3(51.201f, 9.7661f, -49.3033f), new Quaternion(0.55357707f, 0.7383669f, -0.23778345f, -0.3030276f), enableBillboardSupport: true, enableBreakerBox: false);
			}
			else if (GetCurrentLevel() == ManagerPatchClasses.PlanetDictionary[ManagerPatchClasses.SpawnPlanet.Titan])
			{
				SetObjectTransformData(new Vector3(-32.3487f, 67.4162f, 8.6263f), new Quaternion(0f, 0.30070576f, 0f, 0.953717f), new Vector3(0.68f, 0.68f, 0.68f), 0.15f, enableBillboardSupport: false, enableBreakerBox: false);
			}
		}

		internal static string GetCurrentLevel()
		{
			return ((object)RoundManager.Instance.currentLevel).ToString();
		}

		private void SetObjectTransformData(Vector3 position, Quaternion rotation, bool enableBillboardSupport = true, bool enableBreakerBox = true)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).gameObject.transform.position = position;
			((Component)this).gameObject.transform.rotation = rotation;
			BillboardSupport.SetActive(enableBillboardSupport);
			BreakerBox.SetActive(enableBreakerBox);
		}

		private void SetObjectTransformData(Vector3 position, Quaternion rotation, Vector3 scale, float lightRange, bool enableBillboardSupport = true, bool enableBreakerBox = true)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).gameObject.transform.position = position;
			((Component)this).gameObject.transform.rotation = rotation;
			((Component)this).gameObject.transform.localScale = scale;
			((Component)BillboardContent.transform.GetChild(0)).GetComponent<Light>().range = lightRange;
			BillboardSupport.SetActive(enableBillboardSupport);
			BreakerBox.SetActive(enableBreakerBox);
		}

		public void PlayFallAnim()
		{
			ThisAnimator.SetTrigger("FallAnim");
		}
	}
	internal class CompatibilityHandler
	{
		internal static bool facilityMeltdownPresent;

		internal static void OnGameLoad()
		{
			facilityMeltdownPresent = IsModPresent("me.loaforc.facilitymeltdown", "FacilityMeltdown dettected, executing integration patches...");
			if (facilityMeltdownPresent)
			{
				try
				{
					Plugin.logger.LogInfo((object)"PatchingMeltdownHandler");
				}
				catch (Exception ex)
				{
					Plugin.logger.LogError((object)ex);
				}
			}
		}

		private static bool IsModPresent(string name, string logMessage)
		{
			bool flag = Chainloader.PluginInfos.ContainsKey(name);
			if (flag)
			{
				Plugin.logger.LogInfo((object)(name + " is present. " + logMessage));
			}
			return flag;
		}
	}
	internal class ConfigManager
	{
		public ExtendedConfigEntry<bool> EnableConfiguration;

		public ExtendedConfigEntry<bool> Experimentation;

		public ExtendedConfigEntry<bool> Assurance;

		public ExtendedConfigEntry<bool> Artifice;

		public ExtendedConfigEntry<bool> Company;

		public ExtendedConfigEntry<bool> Offense;

		public ExtendedConfigEntry<bool> Titan;

		public ExtendedConfigEntry<bool> ExperimentationSpawn;

		public ExtendedConfigEntry<bool> AssuranceSpawn;

		public ExtendedConfigEntry<bool> ArtificeSpawn;

		public ExtendedConfigEntry<bool> CompanySpawn;

		public ExtendedConfigEntry<bool> OffenseSpawn;

		public ExtendedConfigEntry<bool> TitanSpawn;

		public ConfigManager()
		{
			BindConfigs();
			ClearUnusedEntries();
		}

		private void BindConfigs()
		{
			EnableConfiguration = new ExtendedConfigEntry<bool>("General Settings", "EnableConfiguration", defaultValue: false, "Enable if you want to use custom set config setting values. If disabled, the default config setting values will be used.");
			Experimentation = new ExtendedConfigEntry<bool>("General Settings", "Experimentation", defaultValue: false, "Enable custom content for experimentation billboard", useEnableConfiguration: true);
			Assurance = new ExtendedConfigEntry<bool>("General Settings", "Assurance", defaultValue: false, "Enable custom content for assurance billboard", useEnableConfiguration: true);
			Artifice = new ExtendedConfigEntry<bool>("General Settings", "Artifice", defaultValue: false, "Enable custom content for artifice billboard", useEnableConfiguration: true);
			Company = new ExtendedConfigEntry<bool>("General Settings", "Company", defaultValue: false, "Enable custom content for company billboard", useEnableConfiguration: true);
			Offense = new ExtendedConfigEntry<bool>("General Settings", "Offense", defaultValue: false, "Enable custom content for offense billboard", useEnableConfiguration: true);
			Titan = new ExtendedConfigEntry<bool>("General Settings", "Titan", defaultValue: false, "Enable custom content for titan billboard", useEnableConfiguration: true);
			ExperimentationSpawn = new ExtendedConfigEntry<bool>("Spawn Control", "ExperimentationSpawn", defaultValue: true, "Enable experimentation billboard", useEnableConfiguration: true);
			AssuranceSpawn = new ExtendedConfigEntry<bool>("Spawn Control", "AssuranceSpawn", defaultValue: true, "Enable assurance billboard", useEnableConfiguration: true);
			ArtificeSpawn = new ExtendedConfigEntry<bool>("Spawn Control", "ArtificeSpawn", defaultValue: true, "Enable artifice billboard", useEnableConfiguration: true);
			CompanySpawn = new ExtendedConfigEntry<bool>("Spawn Control", "CompanySpawn", defaultValue: true, "Enable company billboard", useEnableConfiguration: true);
			OffenseSpawn = new ExtendedConfigEntry<bool>("Spawn Control", "OffenseSpawn", defaultValue: true, "Enable offense billboard", useEnableConfiguration: true);
			TitanSpawn = new ExtendedConfigEntry<bool>("Spawn Control", "TitanSpawn", defaultValue: true, "Enable titan billboard", useEnableConfiguration: true);
		}

		private void ClearUnusedEntries()
		{
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(config, null);
			dictionary.Clear();
			config.Save();
		}
	}
	public class ExtendedConfigEntry<T>
	{
		public ConfigEntry<T> ConfigEntry;

		public Func<T> GetValue;

		public Action<T> SetValue;

		public bool UseEnableConfiguration = false;

		public T DefaultValue => (T)((ConfigEntryBase)ConfigEntry).DefaultValue;

		public T Value
		{
			get
			{
				return GetValue();
			}
			set
			{
				SetValue(value);
			}
		}

		public ExtendedConfigEntry(string section, string key, T defaultValue, string description, bool useEnableConfiguration = false)
		{
			ConfigEntry = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<T>(section, key, defaultValue, description);
			UseEnableConfiguration = useEnableConfiguration;
			Initialize();
		}

		public ExtendedConfigEntry(string section, string key, T defaultValue, ConfigDescription configDescription = null, bool useEnableConfiguration = false)
		{
			ConfigEntry = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<T>(section, key, defaultValue, configDescription);
			UseEnableConfiguration = useEnableConfiguration;
			Initialize();
		}

		private void Initialize()
		{
			if (GetValue == null)
			{
				GetValue = () => (UseEnableConfiguration && !Plugin.ConfigManager.EnableConfiguration.Value) ? DefaultValue : ConfigEntry.Value;
			}
			if (SetValue == null)
			{
				SetValue = delegate(T value)
				{
					ConfigEntry.Value = value;
				};
			}
		}

		public void ResetToDefault()
		{
			ConfigEntry.Value = (T)((ConfigEntryBase)ConfigEntry).DefaultValue;
		}
	}
	[HarmonyPatch]
	public class ManagerPatchClasses : MonoBehaviour
	{
		public enum SpawnPlanet
		{
			Artifice,
			Assurance,
			CompanyBuilding,
			Experimentation,
			Offense,
			Titan
		}

		public enum Variant
		{
			Classic,
			Offense
		}

		public static Dictionary<SpawnPlanet, string> PlanetDictionary = new Dictionary<SpawnPlanet, string>
		{
			{
				SpawnPlanet.Artifice,
				"ArtificeLevel (SelectableLevel)"
			},
			{
				SpawnPlanet.Assurance,
				"AssuranceLevel (SelectableLevel)"
			},
			{
				SpawnPlanet.CompanyBuilding,
				"CompanyBuildingLevel (SelectableLevel)"
			},
			{
				SpawnPlanet.Experimentation,
				"ExperimentationLevel (SelectableLevel)"
			},
			{
				SpawnPlanet.Offense,
				"OffenseLevel (SelectableLevel)"
			},
			{
				SpawnPlanet.Titan,
				"TitanLevel (SelectableLevel)"
			}
		};

		internal static ManagerPatchClasses Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(StartOfRound), "ShipLeave")]
		private static void OnShipLeave()
		{
			DependantStaticLeave();
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(StartOfRound), "StartGame")]
		private static void OnGameStart()
		{
			OnGameStartStatic();
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(TimeOfDay), "Start")]
		private static void OnTimeOfDayStart()
		{
			OnTimeOfDayStartStatic();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(RoundManager), "FinishGeneratingNewLevelClientRpc")]
		private static void SendContentIdAfterGen()
		{
			if ((Object)(object)BillboardControler.Instance != (Object)null)
			{
				BillboardControler.Instance.TransmitContent();
			}
		}

		public static void DependantStaticLeave()
		{
			OnShipLeaveStatic();
		}

		public static void OnShipLeaveStatic()
		{
			if (NetworkManager.Singleton.IsHost)
			{
				try
				{
					NetworkHandler.DeSpawnBillboardServerMessage.SendAllClients(0, true);
				}
				catch (Exception arg)
				{
					Plugin.logger.LogError((object)$" Failed to run OnGameStartStatic Exception: {arg}");
				}
			}
		}

		public static void OnGameStartStatic()
		{
			if (!NetworkManager.Singleton.IsHost)
			{
				return;
			}
			try
			{
				if ((BillboardControler.GetCurrentLevel() == PlanetDictionary[SpawnPlanet.Artifice] && Plugin.ConfigManager.ArtificeSpawn.Value) || (BillboardControler.GetCurrentLevel() == PlanetDictionary[SpawnPlanet.Assurance] && Plugin.ConfigManager.AssuranceSpawn.Value) || (BillboardControler.GetCurrentLevel() == PlanetDictionary[SpawnPlanet.CompanyBuilding] && Plugin.ConfigManager.CompanySpawn.Value) || (BillboardControler.GetCurrentLevel() == PlanetDictionary[SpawnPlanet.Experimentation] && Plugin.ConfigManager.ExperimentationSpawn.Value) || (BillboardControler.GetCurrentLevel() == PlanetDictionary[SpawnPlanet.Titan] && Plugin.ConfigManager.TitanSpawn.Value))
				{
					NetworkHandler.SpawnBillboardServerMessage.SendAllClients(Variant.Classic, true);
				}
				else if (BillboardControler.GetCurrentLevel() == PlanetDictionary[SpawnPlanet.Offense] && Plugin.ConfigManager.OffenseSpawn.Value)
				{
					NetworkHandler.SpawnBillboardServerMessage.SendAllClients(Variant.Offense, true);
				}
			}
			catch (Exception arg)
			{
				Plugin.logger.LogError((object)$" Failed to run OnGameStartStatic Exception: {arg}");
			}
			NetworkHandler.NameTagServerMessage.SendAllClients(0, true);
			Plugin.logger.LogDebug((object)"GameStart");
		}

		public static void OnTimeOfDayStartStatic()
		{
			try
			{
				try
				{
					if ((Object)(object)Instance == (Object)null)
					{
						Object.Instantiate<GameObject>(Content.AssetsList[1]);
					}
					else
					{
						Plugin.logger.LogWarning((object)"Constructor was already spawned, aborting spawning duplicates to prevent errors");
					}
				}
				catch (Exception arg)
				{
					Plugin.logger.LogWarning((object)$"Failed to spawn ConstructorObject {arg}");
				}
			}
			catch (Exception arg2)
			{
				Plugin.logger.LogError((object)$"Failed to run OnTimeOfDayStartStatic() {arg2}");
			}
			Plugin.logger.LogDebug((object)"TimeOfDayStart");
		}

		public static void NothingHereDontWorryAboutIt()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB[] array = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
			foreach (PlayerControllerB val in array)
			{
				if ((val.playerSteamId == 76561198381652786L) | (val.playerSteamId == 76561198993712632L) | (val.playerSteamId == 76561197980238122L))
				{
					((Graphic)val.usernameBillboardText).color = Color.red;
				}
			}
		}

		[Obsolete("FacilityMeltdown integration removed", true)]
		public static void SwitchMeltdownContent(int switchToMeltdown)
		{
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			switch (switchToMeltdown)
			{
			case 0:
				flag = false;
				break;
			case 1:
				flag = true;
				break;
			}
			if (((object)RoundManager.Instance.currentLevel).ToString() == "ArtificeLevel (SelectableLevel)")
			{
				ObjectConstructor.Instance.ArtBillboardContent.SetActive(!flag);
				ObjectConstructor.Instance.ArtBillboardMeltdownContent.SetActive(flag);
			}
			else if (((object)RoundManager.Instance.currentLevel).ToString() == "AssuranceLevel (SelectableLevel)")
			{
				ObjectConstructor.Instance.AssBillboardContent.SetActive(!flag);
				ObjectConstructor.Instance.AssBillboardMeltdownContent.SetActive(flag);
			}
			else if (((object)RoundManager.Instance.currentLevel).ToString() == "CompanyBuildingLevel (SelectableLevel)")
			{
				ObjectConstructor.Instance.CompBillboardContent.SetActive(!flag);
				ObjectConstructor.Instance.CompBillboardMeltdownContent.SetActive(flag);
			}
			else if (((object)RoundManager.Instance.currentLevel).ToString() == "ExperimentationLevel (SelectableLevel)")
			{
				ObjectConstructor.Instance.ExpBillboardContent.SetActive(!flag);
				ObjectConstructor.Instance.ExpBillboardMeltdownContent.SetActive(flag);
			}
			else if (((object)RoundManager.Instance.currentLevel).ToString() == "OffenseLevel (SelectableLevel)")
			{
				((Renderer)ObjectConstructor.Instance.OffBillboardContent.gameObject.GetComponent<MeshRenderer>()).material.color = Color.grey;
			}
		}

		[Obsolete("Replaced by direct call", true)]
		public static void ArtificeBillboardClientSpawn(int data)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Content.AssetsList[data];
			Vector3 position = Content.AssetsList[data].transform.position;
			Quaternion rotation = Content.AssetsList[data].transform.rotation;
			Object.Instantiate<GameObject>(obj, position, ((Quaternion)(ref rotation)).normalized, Content.AssetsList[data].transform.parent);
		}

		[Obsolete("External object removal nolonger needed", true)]
		public static void ArtificeBillboardClientDeSpawn(int data)
		{
			switch (data)
			{
			case 0:
				Object.Destroy((Object)(object)ObjectConstructor.Instance.ArtBillboard.gameObject);
				break;
			case 1:
				Object.Destroy((Object)(object)ObjectConstructor.Instance.AssBillboard.gameObject);
				break;
			case 2:
				Object.Destroy((Object)(object)ObjectConstructor.Instance.CompBillboard.gameObject);
				break;
			case 3:
				Object.Destroy((Object)(object)ObjectConstructor.Instance.ExpBillboard.gameObject);
				break;
			case 5:
				Object.Destroy((Object)(object)ObjectConstructor.Instance.OffBillboard.gameObject);
				break;
			}
		}
	}
	[HarmonyPatch]
	internal class NetworkHandler
	{
		public static bool NetworkHandlersRegistered = false;

		public static LethalServerMessage<ManagerPatchClasses.Variant> SpawnBillboardServerMessage = new LethalServerMessage<ManagerPatchClasses.Variant>("SPAWN_BILLBOARD", (Action<ManagerPatchClasses.Variant, ulong>)null);

		public static LethalClientMessage<ManagerPatchClasses.Variant> SpawnBillboardClientMessage = new LethalClientMessage<ManagerPatchClasses.Variant>("SPAWN_BILLBOARD", (Action<ManagerPatchClasses.Variant>)null, (Action<ManagerPatchClasses.Variant, ulong>)null);

		public static LethalServerMessage<int> DeSpawnBillboardServerMessage = new LethalServerMessage<int>("DESPAWN_BILLBOARD", (Action<int, ulong>)null);

		public static LethalClientMessage<int> DeSpawnBillboardClientMessage = new LethalClientMessage<int>("DESPAWN_BILLBOARD", (Action<int>)null, (Action<int, ulong>)null);

		public static LethalServerMessage<int> TransmitRandomContentIdServerMessage = new LethalServerMessage<int>("TRANSMIT", (Action<int, ulong>)null);

		public static LethalClientMessage<int> TransmitRandomContentIdMessage = new LethalClientMessage<int>("TRANSMIT", (Action<int>)null, (Action<int, ulong>)null);

		public static LethalServerMessage<int> SwitchBreakerServerMessage = new LethalServerMessage<int>("SWITCH_BREAKER", (Action<int, ulong>)null);

		public static LethalClientMessage<int> SwitchBreakerMessage = new LethalClientMessage<int>("SWITCH_BREAKER", (Action<int>)null, (Action<int, ulong>)null);

		[Obsolete("Facility Meltdown integration removed", true)]
		public static LethalServerMessage<int> SwitchMeltdownBillboardServerMessage = new LethalServerMessage<int>("SWITCH_BILLBOARD", (Action<int, ulong>)null);

		[Obsolete("Facility Meltdown integration removed", true)]
		public static LethalClientMessage<int> SwitchMeltdownBillboardClientMessage = new LethalClientMessage<int>("SWITCH_BILLBOARD", (Action<int>)null, (Action<int, ulong>)null);

		public static LethalServerMessage<int> NameTagServerMessage = new LethalServerMessage<int>("NAMETAG", (Action<int, ulong>)null);

		public static LethalClientMessage<int> NameTagClientMessage = new LethalClientMessage<int>("NAMETAG", (Action<int>)null, (Action<int, ulong>)null);

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Start")]
		public static void RegisterNetworkHandlers()
		{
			if (NetworkHandlersRegistered)
			{
				return;
			}
			try
			{
				SpawnBillboardServerMessage.OnReceived += SpawnBillboardNetworkHandlerServer;
				SpawnBillboardClientMessage.OnReceived += SpawnBillboardNetworkHandler;
				DeSpawnBillboardServerMessage.OnReceived += DeSpawnBillboardNetworkHandlerServer;
				DeSpawnBillboardClientMessage.OnReceived += DeSpawnBillboardNetworkHandler;
				NameTagServerMessage.OnReceived += NameTagNetworkHandlerServer;
				NameTagClientMessage.OnReceived += NameTagNetworkHandler;
				TransmitRandomContentIdServerMessage.OnReceived += TransmitRandomContentIdNetworkHandlerServer;
				TransmitRandomContentIdMessage.OnReceived += TransmitRandomContentIdNetworkHandler;
				SwitchBreakerServerMessage.OnReceived += SwitchBreakerNetworkHandlerServer;
				SwitchBreakerMessage.OnReceivedFromClient += SwitchBreakerNetworkHandler;
				NetworkHandlersRegistered = true;
			}
			catch (Exception arg)
			{
				Plugin.logger.LogFatal((object)$"Failed to register network handlers, Billboards mod can NOT continue... UnPatching everything! Exception: {arg}");
				HUDManager.Instance.DisplayTip("Fatal Error", "Failed to register network handlers, UnPatching!", true, false, "LC_Tip1");
				Harmony.UnpatchAll();
			}
			finally
			{
				if (NetworkHandlersRegistered)
				{
					Plugin.logger.LogDebug((object)"Registered network handlers!");
				}
			}
		}

		public static void SpawnBillboardNetworkHandler(ManagerPatchClasses.Variant data)
		{
			Plugin.logger.LogWarning((object)$"Received network message for spawn billboard result: {data}");
			HandleSpawnBillboard(data);
		}

		public static void SpawnBillboardNetworkHandlerServer(ManagerPatchClasses.Variant data, ulong empty)
		{
			Plugin.logger.LogWarning((object)$"Received network message for spawn billboard result: {data}");
			HandleSpawnBillboard(data);
		}

		public static void HandleSpawnBillboard(ManagerPatchClasses.Variant data)
		{
			switch (data)
			{
			case ManagerPatchClasses.Variant.Classic:
				Object.Instantiate<GameObject>(Content.AssetsList[0]);
				break;
			case ManagerPatchClasses.Variant.Offense:
				Object.Instantiate<GameObject>(Content.AssetsList[2]);
				break;
			}
		}

		public static void DeSpawnBillboardNetworkHandler(int data)
		{
			Plugin.logger.LogWarning((object)$"Received network message for despawn billboard result: {data}");
			HandleDeSpawnBillboard(data);
		}

		public static void DeSpawnBillboardNetworkHandlerServer(int data, ulong empty)
		{
			Plugin.logger.LogWarning((object)$"Received network message for despawn billboard result: {data}");
			HandleDeSpawnBillboard(data);
		}

		public static void HandleDeSpawnBillboard(int data)
		{
			if ((Object)(object)BillboardControler.Instance != (Object)null)
			{
				BillboardControler.Instance.DestroySelf();
			}
		}

		public static void TransmitRandomContentIdNetworkHandler(int data)
		{
			Plugin.logger.LogWarning((object)$"Received network message for transmit billboard content result: {data}");
			HandleTransmitRandomContentId(data);
		}

		public static void TransmitRandomContentIdNetworkHandlerServer(int data, ulong empty)
		{
			Plugin.logger.LogWarning((object)$"Received network message for transmit billboard content result: {data}");
			HandleTransmitRandomContentId(data);
		}

		public static void HandleTransmitRandomContentId(int data)
		{
			BillboardControler.Instance.SetReceivedRandomContentId(data);
		}

		public static void SwitchBreakerNetworkHandler(int data, ulong empty)
		{
			Plugin.logger.LogWarning((object)$"Received network message for switch breaker result: {data}");
			HandleSwitchBreaker(data);
		}

		public static void SwitchBreakerNetworkHandlerServer(int data, ulong empty)
		{
			Plugin.logger.LogWarning((object)$"Received network message for switch breaker result: {data}");
			HandleSwitchBreaker(data);
		}

		public static void HandleSwitchBreaker(int data)
		{
			BillboardBreakerBox.Instance.SwitchBreaker(on: false);
		}

		public static void SwitchMeltdownBillboardNetworkHandler(int data)
		{
			Plugin.logger.LogWarning((object)$"Received network message for switch billboard content result: {data}");
			HandleSwitchMeltdownBillboar(data);
		}

		public static void SwitchMeltdownBillboardNetworkHandlerServer(int data, ulong empty)
		{
			Plugin.logger.LogWarning((object)$"Received network message for switch billboard content result: {data}");
			HandleSwitchMeltdownBillboar(data);
		}

		public static void HandleSwitchMeltdownBillboar(int data)
		{
		}

		public static void NameTagNetworkHandler(int data)
		{
			Plugin.logger.LogWarning((object)$"Received network message for [REDACTED] result: {data}");
			HandleNameTag(data);
		}

		public static void NameTagNetworkHandlerServer(int data, ulong empty)
		{
			Plugin.logger.LogWarning((object)$"Received network message for [REDACTED] result: {data}");
			HandleNameTag(data);
		}

		public static void HandleNameTag(int data)
		{
			if (data == 0)
			{
				ManagerPatchClasses.NothingHereDontWorryAboutIt();
			}
		}
	}
	[Obsolete("Class nolonger needed", true)]
	public class ObjectConstructor : MonoBehaviour
	{
		[Obsolete("Nolonger needed", true)]
		public static ObjectConstructor Instance { get; private set; }

		[Obsolete("Replaced by object reference", true)]
		internal GameObject ArtBillboard => GameObject.Find("/Bbilboard(Clone)");

		[Obsolete("Replaced by object reference", true)]
		internal GameObject AssBillboard => GameObject.Find("/BbilboardAss(Clone)");

		[Obsolete("Replaced by object reference", true)]
		internal GameObject ExpBillboard => GameObject.Find("/BbilboardExper(Clone)");

		[Obsolete("Replaced by object reference", true)]
		internal GameObject CompBillboard => GameObject.Find("/BbilboardCompany(Clone)");

		[Obsolete("Replaced by object reference", true)]
		internal GameObject OffBillboard => GameObject.Find("/BbilboardOffenseBroken(Clone)");

		[Obsolete("Replaced by object reference", true)]
		internal static GameObject ConstructorObj => GameObject.Find("/BbilboardFrameworkConstructor(Clone)");

		[Obsolete("Replaced by object reference", true)]
		internal GameObject AssBillboardContent => GameObject.Find("/BbilboardAss(Clone)/Cube/Content");

		[Obsolete("Replaced by object reference", true)]
		internal GameObject AssBillboardMeltdownContent => GameObject.Find("/BbilboardAss(Clone)/Cube/MeltdownContent");

		[Obsolete("Replaced by object reference", true)]
		internal GameObject ArtBillboardContent => GameObject.Find("/Bbilboard(Clone)/Cube/Content");

		[Obsolete("Replaced by object reference", true)]
		internal GameObject ArtBillboardMeltdownContent => GameObject.Find("/Bbilboard(Clone)/Cube/MeltdownContent");

		[Obsolete("Replaced by object reference", true)]
		internal GameObject ExpBillboardContent => GameObject.Find("/BbilboardExper(Clone)/Cube/Content");

		[Obsolete("Replaced by object reference", true)]
		internal GameObject ExpBillboardMeltdownContent => GameObject.Find("/BbilboardExper(Clone)/Cube/MeltdownContent");

		[Obsolete("Replaced by object reference", true)]
		internal GameObject CompBillboardContent => GameObject.Find("/BbilboardCompany(Clone)/Cube/Content");

		[Obsolete("Replaced by object reference", true)]
		internal GameObject CompBillboardMeltdownContent => GameObject.Find("/BbilboardCompany(Clone)/Cube/MeltdownContent");

		[Obsolete("Replaced by object reference", true)]
		internal GameObject OffBillboardContent => GameObject.Find("/BbilboardOffenseBroken(Clone)/BillboardDeformed2BetterFront");

		[Obsolete("Replaced by object reference", true)]
		internal GameObject OffBillboardMeltdownContent => GameObject.Find("/BbilboardOffenseBroken(Clone)/BillboardDeformed2BetterFront");

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
		}

		[Obsolete("Moved to manager as direct call", true)]
		public static void SpawnFramework()
		{
			Object.Instantiate<GameObject>(Content.AssetsList[4]);
		}
	}
	[RequireComponent(typeof(BoxCollider))]
	public class PowerBoxHittable : MonoBehaviour, IHittable
	{
		bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			//IL_0016: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			if (hitID == 5)
			{
				return false;
			}
			Landmine.SpawnExplosion(((Component)this).transform.position + Vector3.up, true, 5.7f, 6f, 50, 0f, (GameObject)null, false);
			Plugin.logger.LogError((object)"Explode");
			return true;
		}
	}
	[HarmonyPatch]
	public class TerminalCommands
	{
		public class InternalCommand
		{
			public string command;

			public string shortinfo;

			public string info;

			public Action<string[]> execute;
		}

		private static string response = "";

		private static bool _clearPreviousText = true;

		internal static bool BillboardsCommandEnabled = false;

		public static List<InternalCommand> mCommands = new List<InternalCommand>
		{
			new InternalCommand
			{
				command = "Billboards",
				shortinfo = "[Redacted]",
				info = "[Redacted]",
				execute = delegate
				{
					if (BillboardsCommandEnabled)
					{
						Object.FindObjectOfType<Terminal>().PlayTerminalAudioServerRpc(2);
						Respond("Company safety note:\nWarning! 'Billboards' have been classified as threat level: A\nExecute extreme caution when a 'Billboard' is present within your work area!\n\nDate: September 8, 1968\n\nBillboards are strange metal structures spread across several moons.\nAt first glance they appear to be some sort of advertisements for number of non-existant items. Their structure consists of metal girder support beam, a small breaker box located on its back side and a big flat screen.\n\nWhile the support beam and the flat screen pose no risk, the breaker box on the other hand seems to be designed to unleash huge amounts of electricity at anyone who tries to alter its settings.\nEven tho there is no known connection between them and The Company the billboards them selves still pose a great danger, as it turns out their appearance as a billboard is a disguise to hide their real purpose in plain sight. At first i could not belive it, but they are grade 7 nuclear missles, no billboards. I really hope \nthey are nolonger active, but seeing their screens light up with every moon visit that might just not be the case.\nHell, i saw one of those things launch it self right after we went back to orbit, but Desmond still doesn't belive me.\nHe said that i am being paranoid and that they are 'just billboards', but i know what i saw.\n\n");
					}
					else
					{
						Respond("Classified file inaccessible!\nReason: Access denied!");
						Object.FindObjectOfType<Terminal>().PlayTerminalAudioServerRpc(3);
					}
				}
			}
		};

		public static void Respond(string text, bool clearPreviousText = true)
		{
			Plugin.logger.LogInfo((object)text);
			response = text;
			_clearPreviousText = clearPreviousText;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Terminal), "ParsePlayerSentence")]
		private static void OnParsePlayerSentence(ref Terminal __instance, ref TerminalNode __result)
		{
			if (!NetworkManager.Singleton.IsServer)
			{
				return;
			}
			string text = __instance.screenText.text;
			int textAdded = __instance.textAdded;
			int length = text.Length;
			int num = length - textAdded;
			string[] array = text.Substring(num, length - num).Split(" ");
			if (array.Length == 0)
			{
				return;
			}
			string text2 = array[0];
			string[] subArray = array[1..];
			foreach (InternalCommand mCommand in mCommands)
			{
				if (!(mCommand.command.ToLower() != text2))
				{
					mCommand.execute(subArray);
				}
			}
			if (!Utility.IsNullOrWhiteSpace(response))
			{
				__result = ScriptableObject.CreateInstance<TerminalNode>();
				__result.displayText = response + "\n\n";
				__result.clearPreviousText = _clearPreviousText;
				response = "";
			}
		}
	}
}