Decompiled source of EEM BetaTest v0.0.2

EclipseTitle.dll

Decompiled a year ago
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using VerboseCompany.Properties;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("VerboseCompany")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("VerboseCompany")]
[assembly: AssemblyTitle("VerboseCompany")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace VerboseCompany
{
	[BepInPlugin("dev.parax.lethalcompany.verbosecompany", "Verbose Company", "1.0.0")]
	public class Main : BaseUnityPlugin
	{
		private const string ModId = "dev.parax.lethalcompany.verbosecompany";

		private const string ModName = "Verbose Company";

		private const string Version = "1.0.0";

		public static AssetBundle verboseCompanyAssets;

		public static Texture2D titleFontAsset;

		private void Awake()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			verboseCompanyAssets = AssetBundle.LoadFromMemory(Resources.verbosecompanyassets);
			verboseCompanyAssets.LoadAllAssets();
			titleFontAsset = verboseCompanyAssets.LoadAsset<Texture2D>("filsonfontasset");
			Harmony val = new Harmony("dev.parax.lethalcompany.verbosecompany");
			val.PatchAll();
		}
	}
	[HarmonyPatch(typeof(MenuManager))]
	public class TitleText_MenuManagerPatch
	{
		public static string[] LethalSyn = new string[15]
		{
			"Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company",
			"Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company"
		};

		public static string[] CompanySyn = new string[14]
		{
			"Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition",
			"Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition"
		};

		public static GameObject TitleObj;

		public static TextMeshProUGUI TitleObjText;

		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		private static void Start()
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			int num = Random.Range(0, LethalSyn.Length);
			int num2 = Random.Range(0, CompanySyn.Length);
			TitleObj = Object.Instantiate<GameObject>(GameObject.Find("Canvas/MenuContainer/MainButtons/HostButton"));
			((Object)TitleObj.transform).name = "TitleObj";
			TitleObj.transform.SetParent(GameObject.Find("Canvas/MenuContainer").transform);
			TitleObj.transform.rotation = new Quaternion(0f, 0f, 0f, 0f);
			TitleObj.transform.localScale = new Vector3(1f, 1f, 1f);
			TitleObj.transform.localPosition = new Vector3(0f, 140f, 0f);
			Object.Destroy((Object)(object)TitleObj.GetComponent(typeof(Image)));
			Object.Destroy((Object)(object)TitleObj.GetComponent(typeof(Button)));
			Object.Destroy((Object)(object)TitleObj.GetComponent(typeof(Animator)));
			Object.Destroy((Object)(object)TitleObj.transform.GetChild(0));
			Component component = GameObject.Find("Canvas/MenuContainer/TitleObj/Text (TMP)").GetComponent(typeof(TextMeshProUGUI));
			TitleObjText = (TextMeshProUGUI)(object)((component is TextMeshProUGUI) ? component : null);
			((TMP_Text)TitleObjText).text = LethalSyn[num].ToUpper() + "\n" + CompanySyn[num2].ToUpper();
			((TMP_Text)TitleObjText).faceColor = Color32.op_Implicit(new Color(1f, 0f, 0f));
			((TMP_Text)TitleObjText).fontSize = 90f;
			Component component2 = ((Component)TitleObjText).GetComponent(typeof(RectTransform));
			RectTransform val = (RectTransform)(object)((component2 is RectTransform) ? component2 : null);
			val.sizeDelta = new Vector2(1000f, 100f);
			((TMP_Text)TitleObjText).alignment = (TextAlignmentOptions)4098;
			((TMP_Text)TitleObjText).verticalAlignment = (VerticalAlignmentOptions)256;
			((TMP_Text)TitleObjText).lineSpacing = -52f;
			((TMP_Text)TitleObjText).characterSpacing = -12f;
			GameObject.Find("Canvas/MenuContainer/MainButtons/HeaderImage").SetActive(false);
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void Update()
		{
			TitleObj.SetActive(GameObject.Find("Canvas/MenuContainer/MainButtons").activeSelf);
		}
	}
}
namespace VerboseCompany.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("VerboseCompany.Properties.Resources", typeof(Resources).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] verbosecompanyassets
		{
			get
			{
				object @object = ResourceManager.GetObject("verbosecompanyassets", resourceCulture);
				return (byte[])@object;
			}
		}

		internal Resources()
		{
		}
	}
}

TVLoader.dll

Decompiled a year ago
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using TVLoader.Utils;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("TVLoader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TVLoader")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e59845a7-f2f7-4416-9a61-ca1939ce6e2d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TVLoader
{
	[BepInPlugin("rattenbonkers.TVLoader", "TVLoader", "1.0.3")]
	public class TVLoaderPlugin : BaseUnityPlugin
	{
		private const string MyGUID = "rattenbonkers.TVLoader";

		private const string PluginName = "TVLoader";

		private const string VersionString = "1.0.3";

		private static readonly Harmony Harmony = new Harmony("rattenbonkers.TVLoader");

		public static ManualLogSource Log = new ManualLogSource("TVLoader");

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony.PatchAll();
			VideoManager.Load();
			((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("PluginName: {0}, VersionString: {1} is loaded. Video Count: ${2}", "TVLoader", "1.0.3", VideoManager.Videos.Count));
		}
	}
}
namespace TVLoader.Utils
{
	internal static class VideoManager
	{
		public static List<string> Videos = new List<string>();

		public static void Load()
		{
			string[] directories = Directory.GetDirectories(Paths.PluginPath);
			foreach (string text in directories)
			{
				string path = Path.Combine(Paths.PluginPath, text, "Television Videos");
				if (Directory.Exists(path))
				{
					string[] files = Directory.GetFiles(path, "*.mp4");
					Videos.AddRange(files);
					TVLoaderPlugin.Log.LogInfo((object)$"{text} has {files.Length} videos.");
				}
			}
			string path2 = Path.Combine(Paths.PluginPath, "Television Videos");
			if (!Directory.Exists(path2))
			{
				Directory.CreateDirectory(path2);
			}
			string[] files2 = Directory.GetFiles(path2, "*.mp4");
			Videos.AddRange(files2);
			TVLoaderPlugin.Log.LogInfo((object)$"Global has {files2.Length} videos.");
			TVLoaderPlugin.Log.LogInfo((object)$"Loaded {Videos.Count} total.");
		}
	}
}
namespace TVLoader.Patches
{
	[HarmonyPatch(typeof(TVScript))]
	internal class TVScriptPatches
	{
		private static FieldInfo currentClipProperty = typeof(TVScript).GetField("currentClip", BindingFlags.Instance | BindingFlags.NonPublic);

		private static FieldInfo currentTimeProperty = typeof(TVScript).GetField("currentClipTime", BindingFlags.Instance | BindingFlags.NonPublic);

		private static FieldInfo wasLastFrameProp = typeof(TVScript).GetField("wasTvOnLastFrame", BindingFlags.Instance | BindingFlags.NonPublic);

		private static FieldInfo timeSinceTurningOffTVProp = typeof(TVScript).GetField("timeSinceTurningOffTV", BindingFlags.Instance | BindingFlags.NonPublic);

		private static MethodInfo setMatProperty = typeof(TVScript).GetMethod("SetTVScreenMaterial", BindingFlags.Instance | BindingFlags.NonPublic);

		[HarmonyPatch(typeof(TVScript), "Update")]
		[HarmonyPrefix]
		public static bool Update(TVScript __instance)
		{
			return false;
		}

		[HarmonyPatch(typeof(TVScript), "TurnTVOnOff")]
		[HarmonyPrefix]
		public static bool TurnTVOnOff(TVScript __instance, bool on)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			if (VideoManager.Videos.Count == 0)
			{
				return false;
			}
			if ((int)__instance.video.source != 1)
			{
				__instance.video.clip = null;
				__instance.tvSFX.clip = null;
			}
			__instance.tvOn = on;
			if (on)
			{
				PlayNextVideo(__instance);
				__instance.tvSFX.PlayOneShot(__instance.switchTVOn);
				WalkieTalkie.TransmitOneShotAudio(__instance.tvSFX, __instance.switchTVOn, 1f);
			}
			else
			{
				__instance.video.Stop();
				__instance.tvSFX.PlayOneShot(__instance.switchTVOff);
				WalkieTalkie.TransmitOneShotAudio(__instance.tvSFX, __instance.switchTVOff, 1f);
			}
			setMatProperty.Invoke(__instance, new object[1] { on });
			return false;
		}

		[HarmonyPatch(typeof(TVScript), "TVFinishedClip")]
		[HarmonyPrefix]
		public static bool TVFinishedClip(TVScript __instance, VideoPlayer source)
		{
			PlayNextVideo(__instance);
			return false;
		}

		private static void PlayNextVideo(TVScript instance)
		{
			if (VideoManager.Videos.Count != 0)
			{
				TVLoaderPlugin.Log.LogInfo((object)"Playing next video...");
				int num = (int)currentClipProperty.GetValue(instance);
				num = (num + 1) % VideoManager.Videos.Count;
				TVLoaderPlugin.Log.LogInfo((object)$"currentClip: {num} - {VideoManager.Videos[num]}");
				currentTimeProperty.SetValue(instance, 0f);
				currentClipProperty.SetValue(instance, num);
				instance.tvSFX.time = 0f;
				instance.video.url = "file://" + VideoManager.Videos[num];
				instance.video.source = (VideoSource)1;
				instance.video.controlledAudioTrackCount = 1;
				instance.video.audioOutputMode = (VideoAudioOutputMode)1;
				instance.video.SetTargetAudioSource((ushort)0, instance.tvSFX);
				instance.video.Play();
				instance.SyncTVServerRpc();
			}
		}
	}
}

RouteRandom.dll

Decompiled a year ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using RouteRandom.Helpers;
using TMPro;
using UnityEngine;
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: AssemblyTitle("RouteRandom")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RouteRandom")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("335007c9-7068-4df7-85b3-b406e9795203")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RouteRandom
{
	[BepInPlugin("stormytuna.RouteRandom", "Route Random", "1.2.1")]
	public class RouteRandomBase : BaseUnityPlugin
	{
		public const string ModGUID = "stormytuna.RouteRandom";

		public const string ModName = "Route Random";

		public const string ModVersion = "1.2.1";

		public static ManualLogSource Log = Logger.CreateLogSource("stormytuna.RouteRandom");

		public static RouteRandomBase Instance;

		private readonly Harmony harmony = new Harmony("stormytuna.RouteRandom");

		public static ConfigEntry<bool> ConfigAllowMildWeather;

		public static ConfigEntry<bool> ConfigAllowDustCloudsWeather;

		public static ConfigEntry<bool> ConfigAllowRainyWeather;

		public static ConfigEntry<bool> ConfigAllowStormyWeather;

		public static ConfigEntry<bool> ConfigAllowFoggyWeather;

		public static ConfigEntry<bool> ConfigAllowFloodedWeather;

		public static ConfigEntry<bool> ConfigAllowEclipsedWeather;

		public static ConfigEntry<bool> ConfigAllowCostlyPlanets;

		public static ConfigEntry<bool> ConfigRemoveCostOfCostlyPlanets;

		public static ConfigEntry<bool> ConfigSkipConfirmation;

		public static ConfigEntry<bool> ConfigDifferentPlanetEachTime;

		public static ConfigEntry<bool> ConfigHidePlanet;

		private void Awake()
		{
			if (Instance == null)
			{
				Instance = this;
			}
			Log.LogInfo((object)"Route Random has awoken!");
			LoadConfigs();
			harmony.PatchAll();
		}

		private void LoadConfigs()
		{
			ConfigAllowMildWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Allowed Weathers", "AllowMildWeather", true, "Whether or not to allow the 'Mild' weather to be chosen by the 'route randomfilterweather' command");
			ConfigAllowDustCloudsWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Allowed Weathers", "AllowDustCloudsWeather", false, "Whether or not to allow the 'Dust Clouds' weather to be chosen by the 'route randomfilterweather' command");
			ConfigAllowRainyWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Allowed Weathers", "AllowRainyWeather", false, "Whether or not to allow the 'Rainy' weather to be chosen by the 'route randomfilterweather' command");
			ConfigAllowStormyWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Allowed Weathers", "AllowStormyWeather", false, "Whether or not to allow the 'Stormy' weather to be chosen by the 'route randomfilterweather' command");
			ConfigAllowFoggyWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Allowed Weathers", "AllowFoggyWeather", false, "Whether or not to allow the 'Foggy' weather to be chosen by the 'route randomfilterweather' command");
			ConfigAllowFloodedWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Allowed Weathers", "AllowFloodedWeather", false, "Whether or not to allow the 'Flooded' weather to be chosen by the 'route randomfilterweather' command");
			ConfigAllowEclipsedWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Allowed Weathers", "AllowEclipsedWeather", false, "Whether or not to allow the 'Eclipsed' weather to be chosen by the 'route randomfilterweather' command");
			ConfigAllowCostlyPlanets = ((BaseUnityPlugin)this).Config.Bind<bool>("Costly Planets", "AllowCostlyPlanets", false, "Whether or not to allow costly planets (85-Rend, 7-Dine, 8-Titan). NOTE: You will still be prompted to pay the fee to fly there, enable the MakeCostlyPlanetsFree option to avoid that");
			ConfigRemoveCostOfCostlyPlanets = ((BaseUnityPlugin)this).Config.Bind<bool>("Costly Planets", "RemoveCostOfCostlyPlanets", false, "Whether or not to remove the cost of costly planets when they're chosen randomly and allows them to be chosen even when AllowCostlyPlanets is false");
			ConfigSkipConfirmation = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SkipConfirmation", false, "Whether or not to skip the confirmation screen when using 'route random' or 'route randomwithweather' commands");
			ConfigDifferentPlanetEachTime = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DifferentPlanetEachTime", false, "Prevents 'route random' and 'route randomwithweather' commands from choosing the same planet you're on");
			ConfigHidePlanet = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "HidePlanet", false, "Hides the planet you get randomly routed to, both in the terminal response and at the helm. NOTE: This will ALWAYS hide the orbited planet (even when selected manually) and will skip the confirmation screen");
		}
	}
}
namespace RouteRandom.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	public class StartOfRoundPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("SetMapScreenInfoToCurrentLevel")]
		public static void HideMapScreenInfo(StartOfRound __instance, VideoPlayer ___screenLevelVideoReel, TextMeshProUGUI ___screenLevelDescription)
		{
			if (((Object)__instance.currentLevel).name != "CompanyBuildingLevel" && RouteRandomBase.ConfigHidePlanet.Value)
			{
				((TMP_Text)___screenLevelDescription).text = "Orbiting: [REDACTED]\nPopulation: Unknown\nConditions: Unknown\nFauna: Unknown\nWeather: Unknown";
				((Behaviour)___screenLevelVideoReel).enabled = false;
				___screenLevelVideoReel.clip = null;
				((Component)___screenLevelVideoReel).gameObject.SetActive(false);
				___screenLevelVideoReel.Stop();
			}
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	public class TerminalPatch
	{
		private class CompatibleNounComparer : EqualityComparer<CompatibleNoun>
		{
			public override bool Equals(CompatibleNoun x, CompatibleNoun y)
			{
				bool flag = ((Object)x.result).name.Equals(((Object)y.result).name, StringComparison.InvariantCultureIgnoreCase);
				RouteRandomBase.Log.LogInfo((object)$"Comparing {((Object)x.result).name} against {((Object)y.result).name} - result: {flag}");
				return flag;
			}

			public override int GetHashCode(CompatibleNoun obj)
			{
				return ((object)obj.result).GetHashCode();
			}
		}

		public static TerminalPatch Instance;

		private static readonly TerminalNode noSuitablePlanetsNode = new TerminalNode
		{
			name = "NoSuitablePlanets",
			displayText = "\nNo suitable planets found.\nConsider route random.\n\n",
			clearPreviousText = true
		};

		private static readonly TerminalNode hidePlanetHackNode = new TerminalNode
		{
			name = "HidePlanetHack",
			displayText = "\nRouting autopilot to [REDACTED].\nYour new balance is [playerCredits].\n\nPlease enjoy your flight.",
			clearPreviousText = true
		};

		private static TerminalKeyword routeKeyword;

		private static TerminalKeyword randomKeyword;

		private static TerminalKeyword randomFilterWeatherKeyword;

		private static CompatibleNoun routeRandomCompatibleNoun;

		private static CompatibleNoun routeRandomFilterWeatherCompatibleNoun;

		private static TerminalNode routeRendNodeFree;

		private static TerminalNode routeDineNodeFree;

		private static TerminalNode routeTitanNodeFree;

		private static readonly Random rand = new Random();

		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		public static void AddNewTerminalWords(Terminal __instance)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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)
			//IL_0080: 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)
			//IL_0098: Expected O, but got Unknown
			//IL_009d: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Expected O, but got Unknown
			//IL_00d0: Expected O, but got Unknown
			try
			{
				routeKeyword = __instance.GetKeyword("Route");
				randomKeyword = new TerminalKeyword
				{
					word = "random",
					name = "Random",
					defaultVerb = routeKeyword
				};
				randomFilterWeatherKeyword = new TerminalKeyword
				{
					word = "randomfilterweather",
					name = "RandomFilterWeather",
					defaultVerb = routeKeyword
				};
				routeRandomCompatibleNoun = new CompatibleNoun
				{
					noun = randomKeyword,
					result = new TerminalNode
					{
						name = "routeRandom",
						buyRerouteToMoon = -1
					}
				};
				routeRandomFilterWeatherCompatibleNoun = new CompatibleNoun
				{
					noun = randomFilterWeatherKeyword,
					result = new TerminalNode
					{
						name = "routeRandomFilterWeather",
						buyRerouteToMoon = -1
					}
				};
				TerminalNode result = routeKeyword.compatibleNouns.First((CompatibleNoun cn) => ((Object)cn.result).name == "85route").result;
				routeRendNodeFree = TerminalHelper.MakeRouteMoonNodeFree(result, "85routefree");
				TerminalNode result2 = routeKeyword.compatibleNouns.First((CompatibleNoun cn) => ((Object)cn.result).name == "7route").result;
				routeDineNodeFree = TerminalHelper.MakeRouteMoonNodeFree(result2, "7routefree");
				TerminalNode result3 = routeKeyword.compatibleNouns.First((CompatibleNoun cn) => ((Object)cn.result).name == "8route").result;
				routeTitanNodeFree = TerminalHelper.MakeRouteMoonNodeFree(result3, "8routefree");
				TerminalKeyword keyword = __instance.GetKeyword("Moons");
				TerminalNode specialKeywordResult = keyword.specialKeywordResult;
				specialKeywordResult.displayText += "* Random   //   Routes you to a random moon, regardless of weather conditions\n* RandomFilterWeather   //   Routes you to a random moon, filtering out disallowed weather conditions\n\n";
				__instance.AddKeywords(randomKeyword, randomFilterWeatherKeyword);
				__instance.AddCompatibleNounsToKeyword("Route", routeRandomCompatibleNoun, routeRandomFilterWeatherCompatibleNoun);
			}
			catch
			{
				RouteRandomBase.Log.LogError((object)"Failed to add Terminal keywords and compatible nouns!");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ParsePlayerSentence")]
		public static TerminalNode RouteToRandomPlanet(TerminalNode __result, Terminal __instance)
		{
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			bool flag = ((Object)__result).name == "routeRandom";
			bool flag2 = ((Object)__result).name == "routeRandomFilterWeather";
			if (flag || flag2)
			{
				List<CompatibleNoun> list = routeKeyword.compatibleNouns.Where((CompatibleNoun noun) => noun.ResultIsRealMoon() && noun.ResultIsAffordable()).Distinct(new CompatibleNounComparer()).ToList();
				RouteRandomBase.Log.LogInfo((object)$"Num available moons: {list.Count}");
				if (flag2)
				{
					foreach (CompatibleNoun item in list.ToList())
					{
						LevelWeatherType weatherType = RoutePlanetNameToWeatherType(((Object)item.result).name, __instance.moonsCatalogueList);
						if (!WeatherIsAllowed(weatherType))
						{
							list.Remove(item);
						}
					}
					RouteRandomBase.Log.LogInfo((object)$"Num available moons after filtering weather: {list.Count}");
				}
				if (RouteRandomBase.ConfigDifferentPlanetEachTime.Value)
				{
					list.RemoveAll((CompatibleNoun rpn) => rpn.result.GetNodeAfterConfirmation().NodeRoutesToCurrentOrbitedMoon());
					RouteRandomBase.Log.LogInfo((object)$"Num available moons after filtering orbited moon: {list.Count}");
				}
				if (list.Count <= 0)
				{
					RouteRandomBase.Log.LogInfo((object)"Couldn't find a planet with suitable weather!");
					return noSuitablePlanetsNode;
				}
				TerminalNode val = rand.NextFromCollection(list).result;
				RouteRandomBase.Log.LogInfo((object)("Chosen node: " + ((Object)val).name));
				if (RouteRandomBase.ConfigRemoveCostOfCostlyPlanets.Value)
				{
					val = TryGetFreeNodeForCostlyPlanetNode(val);
					RouteRandomBase.Log.LogInfo((object)"Making node free!");
				}
				if (RouteRandomBase.ConfigHidePlanet.Value)
				{
					RouteRandomBase.Log.LogInfo((object)"Hiding stuffs >:3");
					TerminalNode nodeAfterConfirmation = val.GetNodeAfterConfirmation();
					hidePlanetHackNode.buyRerouteToMoon = nodeAfterConfirmation.buyRerouteToMoon;
					hidePlanetHackNode.itemCost = ((!RouteRandomBase.ConfigRemoveCostOfCostlyPlanets.Value) ? nodeAfterConfirmation.itemCost : 0);
					return hidePlanetHackNode;
				}
				return RouteRandomBase.ConfigSkipConfirmation.Value ? val.GetNodeAfterConfirmation() : val;
			}
			return __result;
		}

		private static bool WeatherIsAllowed(LevelWeatherType weatherType)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: 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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected I4, but got Unknown
			return (weatherType - -1) switch
			{
				0 => RouteRandomBase.ConfigAllowMildWeather.Value, 
				1 => RouteRandomBase.ConfigAllowDustCloudsWeather.Value, 
				2 => RouteRandomBase.ConfigAllowRainyWeather.Value, 
				3 => RouteRandomBase.ConfigAllowStormyWeather.Value, 
				4 => RouteRandomBase.ConfigAllowFoggyWeather.Value, 
				5 => RouteRandomBase.ConfigAllowFloodedWeather.Value, 
				6 => RouteRandomBase.ConfigAllowEclipsedWeather.Value, 
				_ => false, 
			};
		}

		private static LevelWeatherType RoutePlanetNameToWeatherType(string routePlanetName, SelectableLevel[] moonCatalogue)
		{
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: 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_015f: Unknown result type (might be due to invalid IL or missing references)
			return (LevelWeatherType)(routePlanetName switch
			{
				"41route" => moonCatalogue[0].currentWeather, 
				"220route" => moonCatalogue[1].currentWeather, 
				"56route" => moonCatalogue[2].currentWeather, 
				"21route" => moonCatalogue[3].currentWeather, 
				"61route" => moonCatalogue[4].currentWeather, 
				"85route" => moonCatalogue[5].currentWeather, 
				"7route" => moonCatalogue[6].currentWeather, 
				"8route" => moonCatalogue[7].currentWeather, 
				_ => -1, 
			});
		}

		private static TerminalNode TryGetFreeNodeForCostlyPlanetNode(TerminalNode node)
		{
			return (TerminalNode)(((Object)node).name switch
			{
				"85route" => routeRendNodeFree, 
				"7route" => routeDineNodeFree, 
				"8route" => routeTitanNodeFree, 
				_ => node, 
			});
		}
	}
}
namespace RouteRandom.Helpers
{
	public static class RandomHelper
	{
		public static TSource NextFromCollection<TSource>(this Random rand, IList<TSource> collection)
		{
			int index = rand.Next(collection.Count());
			return collection[index];
		}
	}
	public static class TerminalHelper
	{
		public static TerminalKeyword GetKeyword(this Terminal terminal, string keywordName)
		{
			return terminal.terminalNodes.allKeywords.First((TerminalKeyword kw) => ((Object)kw).name == keywordName);
		}

		public static TerminalNode GetNodeAfterConfirmation(this TerminalNode node)
		{
			return node.terminalOptions.First((CompatibleNoun cn) => ((Object)cn.noun).name == "Confirm").result;
		}

		public static bool NodeRoutesToCurrentOrbitedMoon(this TerminalNode node)
		{
			return (Object)(object)StartOfRound.Instance.levels[node.buyRerouteToMoon] == (Object)(object)StartOfRound.Instance.currentLevel;
		}

		public static void AddKeyword(this Terminal terminal, TerminalKeyword newKeyword)
		{
			terminal.terminalNodes.allKeywords = CollectionExtensions.AddToArray<TerminalKeyword>(terminal.terminalNodes.allKeywords, newKeyword);
		}

		public static void AddKeywords(this Terminal terminal, params TerminalKeyword[] newKeywords)
		{
			foreach (TerminalKeyword newKeyword in newKeywords)
			{
				terminal.AddKeyword(newKeyword);
			}
		}

		public static void AddCompatibleNounToKeyword(this Terminal terminal, string keywordName, CompatibleNoun newCompatibleNoun)
		{
			TerminalKeyword val = ((IEnumerable<TerminalKeyword>)terminal.terminalNodes.allKeywords).FirstOrDefault((Func<TerminalKeyword, bool>)((TerminalKeyword kw) => ((Object)kw).name == keywordName)) ?? throw new ArgumentException("Failed to find keyword with name " + keywordName);
			val.compatibleNouns = CollectionExtensions.AddToArray<CompatibleNoun>(val.compatibleNouns, newCompatibleNoun);
		}

		public static void AddCompatibleNounsToKeyword(this Terminal terminal, string keywordName, params CompatibleNoun[] newCompatibleNouns)
		{
			foreach (CompatibleNoun newCompatibleNoun in newCompatibleNouns)
			{
				terminal.AddCompatibleNounToKeyword(keywordName, newCompatibleNoun);
			}
		}

		public static bool ResultIsRealMoon(this CompatibleNoun compatibleNoun)
		{
			return compatibleNoun.result.buyRerouteToMoon == -2;
		}

		public static bool ResultIsAffordable(this CompatibleNoun compatibleNoun)
		{
			return compatibleNoun.result.itemCost <= 0 || RouteRandomBase.ConfigAllowCostlyPlanets.Value || RouteRandomBase.ConfigRemoveCostOfCostlyPlanets.Value;
		}

		public static TerminalNode MakeRouteMoonNodeFree(TerminalNode routeMoonNode, string name)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_0052: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			TerminalNode result = routeMoonNode.terminalOptions[1].result;
			TerminalNode result2 = new TerminalNode
			{
				name = ((Object)result).name + "Free",
				buyRerouteToMoon = result.buyRerouteToMoon,
				clearPreviousText = true,
				displayText = result.displayText,
				itemCost = 0
			};
			TerminalNode val = new TerminalNode();
			((Object)val).name = name;
			val.buyRerouteToMoon = -2;
			val.clearPreviousText = true;
			val.displayPlanetInfo = routeMoonNode.displayPlanetInfo;
			val.displayText = routeMoonNode.displayText;
			val.itemCost = 0;
			val.overrideOptions = true;
			val.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2]
			{
				routeMoonNode.terminalOptions[0],
				new CompatibleNoun
				{
					noun = new TerminalKeyword
					{
						name = "Confirm",
						isVerb = true
					},
					result = result2
				}
			};
			return val;
		}
	}
}

plugins/LethalExpansion/LethalExpansion.dll

Decompiled a year ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen;
using DunGen.Adapters;
using GameNetcodeStuff;
using HarmonyLib;
using LethalExpansion.Patches;
using LethalExpansion.Patches.Monsters;
using LethalExpansion.Utils;
using LethalExpansion.Utils.HUD;
using LethalSDK.Component;
using LethalSDK.ScriptableObjects;
using LethalSDK.Utils;
using TMPro;
using Unity.AI.Navigation;
using Unity.Netcode;
using Unity.Netcode.Components;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Audio;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
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: AssemblyTitle("LethalExpansion")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalExpansion")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f80eb3fd-9563-4f80-9fc7-3fcce1655c13")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
public class AutoScrollText : MonoBehaviour
{
	public TextMeshProUGUI textMeshPro;

	public float scrollSpeed = 20f;

	private Vector2 startPosition;

	private float textHeight;

	private bool startScrolling = false;

	private bool isWaitingToReset = false;

	private float displayHeight;

	private float fontSize;

	private void Start()
	{
		textMeshPro = ((Component)this).GetComponent<TextMeshProUGUI>();
		InitializeScrolling();
	}

	private void InitializeScrolling()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)textMeshPro != (Object)null)
		{
			startPosition = ((TMP_Text)textMeshPro).rectTransform.anchoredPosition;
			textHeight = ((TMP_Text)textMeshPro).preferredHeight;
			displayHeight = ((TMP_Text)textMeshPro).rectTransform.sizeDelta.y;
			fontSize = ((TMP_Text)textMeshPro).fontSize;
		}
		((MonoBehaviour)this).StartCoroutine(WaitBeforeScrolling(5f));
	}

	private IEnumerator WaitBeforeScrolling(float waitTime)
	{
		yield return (object)new WaitForSeconds(waitTime);
		startScrolling = true;
	}

	private IEnumerator WaitBeforeResetting(float waitTime)
	{
		isWaitingToReset = true;
		yield return (object)new WaitForSeconds(waitTime);
		((TMP_Text)textMeshPro).rectTransform.anchoredPosition = startPosition;
		isWaitingToReset = false;
		((MonoBehaviour)this).StartCoroutine(WaitBeforeScrolling(5f));
	}

	private void Update()
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: 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)
		if ((Object)(object)textMeshPro != (Object)null && startScrolling && !isWaitingToReset)
		{
			RectTransform rectTransform = ((TMP_Text)textMeshPro).rectTransform;
			rectTransform.anchoredPosition += new Vector2(0f, scrollSpeed * Time.deltaTime);
			if (((TMP_Text)textMeshPro).rectTransform.anchoredPosition.y >= startPosition.y + textHeight - displayHeight - fontSize)
			{
				startScrolling = false;
				((MonoBehaviour)this).StartCoroutine(WaitBeforeResetting(5f));
			}
		}
	}

	public void ResetScrolling()
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		((MonoBehaviour)this).StopAllCoroutines();
		if ((Object)(object)textMeshPro != (Object)null)
		{
			((TMP_Text)textMeshPro).rectTransform.anchoredPosition = startPosition;
		}
		isWaitingToReset = false;
		InitializeScrolling();
	}
}
public class TooltipHandler : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
{
	private string description;

	private string netinfo;

	public static RectTransform ModSettingsToolTipPanel;

	public static TMP_Text ModSettingsToolTipPanelDescription;

	public static TMP_Text ModSettingsToolTipPanelNetInfo;

	public int index;

	private float delay = 0.5f;

	private bool isPointerOver = false;

	public void OnPointerEnter(PointerEventData eventData)
	{
		isPointerOver = true;
		((MonoBehaviour)this).StartCoroutine(ShowTooltipAfterDelay());
	}

	public void OnPointerExit(PointerEventData eventData)
	{
		isPointerOver = false;
		((Component)ModSettingsToolTipPanel).gameObject.SetActive(false);
	}

	private IEnumerator ShowTooltipAfterDelay()
	{
		yield return (object)new WaitForSeconds(delay);
		if (isPointerOver)
		{
			ModSettingsToolTipPanel.anchoredPosition = new Vector2(-30f, ((Component)this).GetComponent<RectTransform>().anchoredPosition.y + 180f);
			description = ConfigManager.Instance.FindDescription(index);
			(bool, bool) info = ConfigManager.Instance.FindNetInfo(index);
			netinfo = "Network synchronization: " + (info.Item1 ? "Yes" : "No") + "\nMod required by clients: " + (info.Item2 ? "No" : "Yes");
			ModSettingsToolTipPanelDescription.text = description;
			ModSettingsToolTipPanelNetInfo.text = netinfo;
			((Component)ModSettingsToolTipPanel).gameObject.SetActive(true);
		}
	}
}
public class ConfigItem
{
	public string Key { get; set; }

	public Type type { get; set; }

	public object Value { get; set; }

	public object DefaultValue { get; set; }

	public string Tab { get; set; }

	public string Description { get; set; }

	public object MinValue { get; set; }

	public object MaxValue { get; set; }

	public bool Sync { get; set; }

	public bool Hidden { get; set; }

	public bool Optional { get; set; }

	public bool RequireRestart { get; set; }

	public ConfigItem(string key, object defaultValue, string tab, string description, object minValue = null, object maxValue = null, bool sync = true, bool optional = false, bool hidden = false, bool requireRestart = false)
	{
		Key = key;
		DefaultValue = defaultValue;
		type = defaultValue.GetType();
		Tab = tab;
		Description = description;
		if (minValue != null && maxValue != null)
		{
			if (minValue.GetType() == type && maxValue.GetType() == type)
			{
				MinValue = minValue;
				MaxValue = maxValue;
			}
		}
		else
		{
			MinValue = null;
			MaxValue = null;
		}
		Sync = sync;
		Optional = optional;
		Hidden = hidden;
		Value = DefaultValue;
		RequireRestart = requireRestart;
	}
}
namespace LethalExpansion
{
	[BepInPlugin("LethalExpansion", "LethalExpansion", "1.1.9")]
	public class LethalExpansion : BaseUnityPlugin
	{
		private const string MyGUID = "LethalExpansion";

		private const string PluginName = "LethalExpansion";

		private const string VersionString = "1.1.9";

		private readonly Version ModVersion = new Version("1.1.9");

		private readonly Version[] CompatibleModVersions = new Version[2]
		{
			new Version(1, 1, 9),
			new Version(1, 1, 8)
		};

		public static readonly int[] CompatibleGameVersions = new int[2] { 40, 45 };

		public static bool sessionWaiting = true;

		public static bool hostDataWaiting = true;

		public static bool ishost = false;

		public static bool alreadypatched = false;

		public static bool isInGame = false;

		private static readonly Harmony Harmony = new Harmony("LethalExpansion");

		public static ManualLogSource Log = new ManualLogSource("LethalExpansion");

		public static ConfigFile config;

		public static NetworkManager networkManager;

		public GameObject SpaceLight;

		public GameObject terrainfixer;

		private int width = 256;

		private int height = 256;

		private int depth = 20;

		private float scale = 20f;

		public List<Type> whitelist = new List<Type>
		{
			typeof(Transform),
			typeof(MeshFilter),
			typeof(MeshRenderer),
			typeof(SkinnedMeshRenderer),
			typeof(MeshCollider),
			typeof(BoxCollider),
			typeof(SphereCollider),
			typeof(CapsuleCollider),
			typeof(SphereCollider),
			typeof(TerrainCollider),
			typeof(WheelCollider),
			typeof(ArticulationBody),
			typeof(ConstantForce),
			typeof(ConfigurableJoint),
			typeof(FixedJoint),
			typeof(HingeJoint),
			typeof(Cloth),
			typeof(Rigidbody),
			typeof(NetworkObject),
			typeof(NetworkRigidbody),
			typeof(NetworkTransform),
			typeof(NetworkAnimator),
			typeof(Animator),
			typeof(Animation),
			typeof(Terrain),
			typeof(Tree),
			typeof(WindZone),
			typeof(DecalProjector),
			typeof(LODGroup),
			typeof(Light),
			typeof(HDAdditionalLightData),
			typeof(LightProbeGroup),
			typeof(LightProbeProxyVolume),
			typeof(LocalVolumetricFog),
			typeof(OcclusionArea),
			typeof(OcclusionPortal),
			typeof(ReflectionProbe),
			typeof(PlanarReflectionProbe),
			typeof(HDAdditionalReflectionData),
			typeof(Skybox),
			typeof(SortingGroup),
			typeof(SpriteRenderer),
			typeof(Volume),
			typeof(AudioSource),
			typeof(AudioReverbZone),
			typeof(AudioReverbFilter),
			typeof(AudioChorusFilter),
			typeof(AudioDistortionFilter),
			typeof(AudioEchoFilter),
			typeof(AudioHighPassFilter),
			typeof(AudioLowPassFilter),
			typeof(AudioListener),
			typeof(LensFlare),
			typeof(TrailRenderer),
			typeof(LineRenderer),
			typeof(ParticleSystem),
			typeof(ParticleSystemRenderer),
			typeof(ParticleSystemForceField),
			typeof(Projector),
			typeof(VideoPlayer),
			typeof(NavMeshSurface),
			typeof(NavMeshModifier),
			typeof(NavMeshModifierVolume),
			typeof(NavMeshLink),
			typeof(NavMeshObstacle),
			typeof(OffMeshLink),
			typeof(NetworkObject),
			typeof(SI_AudioReverbPresets),
			typeof(SI_AudioReverbTrigger),
			typeof(SI_DungeonGenerator),
			typeof(SI_MatchLocalPlayerPosition),
			typeof(SI_AnimatedSun),
			typeof(SI_EntranceTeleport),
			typeof(SI_ScanNodeEntrance),
			typeof(SI_ScanNodeShip),
			typeof(SI_ScanNode),
			typeof(SI_DoorLock),
			typeof(SI_WaterSurface),
			typeof(SI_Ladder),
			typeof(LockPosition)
		};

		private void Awake()
		{
			//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d6: Expected O, but got Unknown
			//IL_061f: Unknown result type (might be due to invalid IL or missing references)
			//IL_062c: Expected O, but got Unknown
			//IL_0631: Unknown result type (might be due to invalid IL or missing references)
			//IL_063e: Expected O, but got Unknown
			//IL_06a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b2: Expected O, but got Unknown
			//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c6: Expected O, but got Unknown
			//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: LethalExpansion, VersionString: 1.1.9 is loading...");
			config = ((BaseUnityPlugin)this).Config;
			ConfigManager.Instance.AddItem(new ConfigItem("GlobalTimeSpeedMultiplier", 1.4f, "Time", "Change the global time speed", 0.1f, 3f));
			ConfigManager.Instance.AddItem(new ConfigItem("LengthOfHours", 60, "Time", "Change amount of seconds in one hour", 1, 300));
			ConfigManager.Instance.AddItem(new ConfigItem("NumberOfHours", 18, "Time", "Max lenght of an Expedition in hours. (Begin at 6 AM | 18 = Midnight)", 6, 20));
			ConfigManager.Instance.AddItem(new ConfigItem("DeadlineDaysAmount", 3, "Expeditions", "Change amount of days for the Quota.", 1, 9, sync: false));
			ConfigManager.Instance.AddItem(new ConfigItem("StartingCredits", 60, "Expeditions", "Change amount of starting Credit.", 0, 1000, sync: false));
			ConfigManager.Instance.AddItem(new ConfigItem("MoonsRoutePricesMultiplier", 1f, "Moons", "Change the Cost of the Moon Routes.", 0f, 5f));
			ConfigManager.Instance.AddItem(new ConfigItem("StartingQuota", 130, "Expeditions", "Change the starting Quota.", 0, 1000, sync: false, optional: true));
			ConfigManager.Instance.AddItem(new ConfigItem("ScrapAmountMultiplier", 1f, "Dungeons", "Change the amount of Scraps in dungeons.", 0f, 10f));
			ConfigManager.Instance.AddItem(new ConfigItem("ScrapValueMultiplier", 0.4f, "Dungeons", "Change the value of Scraps.", 0f, 10f));
			ConfigManager.Instance.AddItem(new ConfigItem("MapSizeMultiplier", 1.5f, "Dungeons", "Change the size of the Dungeons. (Can crash when under 1.0)", 0.8f, 10f));
			ConfigManager.Instance.AddItem(new ConfigItem("PreventMineToExplodeWithItems", false, "Dungeons", "Prevent Landmines to explode by dropping items on them"));
			ConfigManager.Instance.AddItem(new ConfigItem("MineActivationWeight", 0.15f, "Dungeons", "Set the minimal weight to prevent Landmine's explosion (0.15 = 16 lb, Player = 2.0)", 0.01f, 5f));
			ConfigManager.Instance.AddItem(new ConfigItem("WeightUnit", 0, "HUD", "Change the carried Weight unit : 0 = Pounds (lb), 1 = Kilograms (kg) and 2 = Both", 0, 2, sync: false));
			ConfigManager.Instance.AddItem(new ConfigItem("ConvertPoundsToKilograms", true, "HUD", "Convert Pounds into Kilograms (16 lb = 7 kg) (Only effective if WeightUnit = 1)", null, null, sync: false));
			ConfigManager.Instance.AddItem(new ConfigItem("PreventScrapWipeWhenAllPlayersDie", false, "Expeditions", "Prevent the Scraps Wipe when all players die."));
			ConfigManager.Instance.AddItem(new ConfigItem("24HoursClock", false, "HUD", "Display a 24h clock instead of 12h.", null, null, sync: false));
			ConfigManager.Instance.AddItem(new ConfigItem("ClockAlwaysVisible", false, "HUD", "Display clock while inside of the Ship."));
			ConfigManager.Instance.AddItem(new ConfigItem("AutomaticDeadline", false, "Expeditions", "Automatically increase the Deadline depending of the required quota."));
			ConfigManager.Instance.AddItem(new ConfigItem("AutomaticDeadlineStage", 300, "Expeditions", "Increase the quota deadline of one day each time the quota exceeds this value.", 100, 1000));
			ConfigManager.Instance.AddItem(new ConfigItem("LoadModules", true, "Modules", "Load SDK Modules that add new content to the game. Disable it to play with Vanilla players. (RESTART REQUIRED)", null, null, sync: false, optional: false, hidden: false, requireRestart: true));
			ConfigManager.Instance.AddItem(new ConfigItem("MaxItemsInShip", 45, "Expeditions", "Change the Items cap can be kept in the ship.", 10, 500));
			ConfigManager.Instance.ReadConfig();
			((BaseUnityPlugin)this).Config.SettingChanged += ConfigSettingChanged;
			AssetBundlesManager.Instance.LoadAllAssetBundles();
			SceneManager.sceneLoaded += OnSceneLoaded;
			SceneManager.sceneUnloaded += OnSceneUnloaded;
			Harmony.PatchAll(typeof(GameNetworkManager_Patch));
			Harmony.PatchAll(typeof(Terminal_Patch));
			Harmony.PatchAll(typeof(MenuManager_Patch));
			Harmony.PatchAll(typeof(GrabbableObject_Patch));
			Harmony.PatchAll(typeof(RoundManager_Patch));
			Harmony.PatchAll(typeof(TimeOfDay_Patch));
			Harmony.PatchAll(typeof(HUDManager_Patch));
			Harmony.PatchAll(typeof(StartOfRound_Patch));
			Harmony.PatchAll(typeof(EntranceTeleport_Patch));
			Harmony.PatchAll(typeof(Landmine_Patch));
			Harmony val = new Harmony("LethalExpansion");
			MethodInfo methodInfo = AccessTools.Method(typeof(BaboonBirdAI), "GrabScrap", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(HoarderBugAI), "GrabItem", (Type[])null, (Type[])null);
			MethodInfo methodInfo3 = AccessTools.Method(typeof(MonsterGrabItem_Patch), "MonsterGrabItem", (Type[])null, (Type[])null);
			val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(methodInfo3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			MethodInfo methodInfo4 = AccessTools.Method(typeof(HoarderBugAI), "DropItem", (Type[])null, (Type[])null);
			MethodInfo methodInfo5 = AccessTools.Method(typeof(MonsterGrabItem_Patch), "MonsterDropItem_Patch", (Type[])null, (Type[])null);
			MethodInfo methodInfo6 = AccessTools.Method(typeof(HoarderBugAI), "KillEnemy", (Type[])null, (Type[])null);
			MethodInfo methodInfo7 = AccessTools.Method(typeof(MonsterGrabItem_Patch), "KillEnemy_Patch", (Type[])null, (Type[])null);
			val.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, new HarmonyMethod(methodInfo5), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)methodInfo6, (HarmonyMethod)null, new HarmonyMethod(methodInfo7), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline;
			HDRenderPipelineAsset val2 = (HDRenderPipelineAsset)(object)((currentRenderPipeline is HDRenderPipelineAsset) ? currentRenderPipeline : null);
			if ((Object)(object)val2 != (Object)null)
			{
				RenderPipelineSettings currentPlatformRenderPipelineSettings = val2.currentPlatformRenderPipelineSettings;
				currentPlatformRenderPipelineSettings.supportWater = true;
				val2.currentPlatformRenderPipelineSettings = currentPlatformRenderPipelineSettings;
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Water support applied to the HDRenderPipelineAsset.");
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"HDRenderPipelineAsset not found.");
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: LethalExpansion, VersionString: 1.1.9 is loaded.");
		}

		private List<PluginInfo> GetLoadedPlugins()
		{
			return Chainloader.PluginInfos.Values.ToList();
		}

		private float[,] GenerateHeights()
		{
			float[,] array = new float[width, height];
			for (int i = 0; i < width; i++)
			{
				for (int j = 0; j < height; j++)
				{
					array[i, j] = CalculateHeight(i, j);
				}
			}
			return array;
		}

		private float CalculateHeight(int x, int y)
		{
			float num = (float)x / (float)width * scale;
			float num2 = (float)y / (float)height * scale;
			return Mathf.PerlinNoise(num, num2);
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Expected O, but got Unknown
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Expected O, but got Unknown
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_0719: Unknown result type (might be due to invalid IL or missing references)
			//IL_073a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0785: Unknown result type (might be due to invalid IL or missing references)
			//IL_0622: Unknown result type (might be due to invalid IL or missing references)
			//IL_0629: Expected O, but got Unknown
			//IL_0659: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bb: Expected O, but got Unknown
			//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f2: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Loading scene: " + ((Scene)(ref scene)).name));
			if (((Scene)(ref scene)).name == "InitScene")
			{
				networkManager = GameObject.Find("NetworkManager").GetComponent<NetworkManager>();
			}
			if (((Scene)(ref scene)).name == "MainMenu")
			{
				sessionWaiting = true;
				hostDataWaiting = true;
				ishost = false;
				alreadypatched = false;
				isInGame = false;
				AssetGather.Instance.AddAudioMixer(GameObject.Find("Canvas/MenuManager").GetComponent<AudioSource>().outputAudioMixerGroup.audioMixer);
				SettingsMenu.Instance.InitSettingsMenu();
			}
			if (((Scene)(ref scene)).name == "CompanyBuilding")
			{
				GameObject val = Object.Instantiate<GameObject>(AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Prefabs/labyrinth.prefab"));
				SceneManager.MoveGameObjectToScene(val, scene);
				waitForSession().GetAwaiter();
				SpaceLight.SetActive(false);
				terrainfixer.SetActive(false);
			}
			if (((Scene)(ref scene)).name == "SampleSceneRelay")
			{
				SpaceLight = Object.Instantiate<GameObject>(AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Prefabs/SpaceLight.prefab"));
				SceneManager.MoveGameObjectToScene(SpaceLight, scene);
				Mesh mesh = AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Meshes/MonitorWall.fbx").GetComponent<MeshFilter>().mesh;
				GameObject val2 = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube");
				val2.GetComponent<MeshFilter>().mesh = mesh;
				MeshRenderer component = val2.GetComponent<MeshRenderer>();
				GameObject val3 = Object.Instantiate<GameObject>(GameObject.Find("Systems/GameSystems/TimeAndWeather/Flooding"));
				Object.DestroyImmediate((Object)(object)val3.GetComponent<FloodWeather>());
				((Object)val3).name = "WaterSurface";
				val3.transform.position = Vector3.zero;
				val3.SetActive(false);
				SpawnPrefab.Instance.waterSurface = val3;
				((Renderer)component).materials = (Material[])(object)new Material[9]
				{
					((Renderer)component).materials[0],
					((Renderer)component).materials[1],
					((Renderer)component).materials[1],
					((Renderer)component).materials[1],
					((Renderer)component).materials[1],
					((Renderer)component).materials[1],
					((Renderer)component).materials[1],
					((Renderer)component).materials[1],
					((Renderer)component).materials[2]
				};
				((Component)StartOfRound.Instance.screenLevelDescription).gameObject.AddComponent<AutoScrollText>();
				AssetGather.Instance.AddAudioMixer(GameObject.Find("Systems/Audios/DiageticBackground").GetComponent<AudioSource>().outputAudioMixerGroup.audioMixer);
				terrainfixer = new GameObject();
				((Object)terrainfixer).name = "terrainfixer";
				terrainfixer.transform.position = new Vector3(0f, -500f, 0f);
				Terrain val4 = terrainfixer.AddComponent<Terrain>();
				TerrainData val5 = new TerrainData();
				val5.heightmapResolution = width + 1;
				val5.size = new Vector3((float)width, (float)depth, (float)height);
				val5.SetHeights(0, 0, GenerateHeights());
				((BaseUnityPlugin)this).Logger.LogWarning((object)((Object)(object)val4.terrainData == (Object)null));
				((BaseUnityPlugin)this).Logger.LogWarning((object)((Object)(object)val5 == (Object)null));
				val4.terrainData = val5;
				waitForSession().GetAwaiter();
				isInGame = true;
			}
			if (((Scene)(ref scene)).name.StartsWith("Level"))
			{
				SpaceLight.SetActive(false);
				terrainfixer.SetActive(false);
			}
			if (!(((Scene)(ref scene)).name == "InitSceneLaunchOptions") || !isInGame)
			{
				return;
			}
			SpaceLight.SetActive(false);
			terrainfixer.SetActive(false);
			GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
			foreach (GameObject val6 in rootGameObjects)
			{
				val6.SetActive(false);
			}
			List<Type> list = new List<Type>();
			list.Add(typeof(MeshRenderer));
			list.Add(typeof(Transform));
			list.Add(typeof(Rigidbody));
			List<Type> list2 = list;
			if ((Object)(object)Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab != (Object)null && (Object)(object)Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab.transform != (Object)null)
			{
				CheckAndRemoveIllegalComponents(Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab.transform);
				GameObject val7 = Object.Instantiate<GameObject>(Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab);
				if ((Object)(object)val7 != (Object)null)
				{
					SceneManager.MoveGameObjectToScene(val7, scene);
				}
			}
			string[] array = new string[5] { "MapPropsContainer", "OutsideAINode", "SpawnDenialPoint", "ItemShipLandingNode", "OutsideLevelNavMesh" };
			string[] array2 = array;
			foreach (string text in array2)
			{
				if ((Object)(object)GameObject.FindGameObjectWithTag(text) == (Object)null || GameObject.FindGameObjectsWithTag(text).Any(delegate(GameObject o)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					Scene scene2 = o.scene;
					return ((Scene)(ref scene2)).name != "InitSceneLaunchOptions";
				}))
				{
					GameObject val8 = new GameObject();
					((Object)val8).name = text;
					val8.tag = text;
					val8.transform.position = new Vector3(0f, -200f, 0f);
					SceneManager.MoveGameObjectToScene(val8, scene);
				}
			}
			if ((Object)(object)Object.FindObjectOfType<RuntimeDungeon>(false) == (Object)null)
			{
				GameObject val9 = new GameObject();
				((Object)val9).name = "DungeonGenerator";
				val9.tag = "DungeonGenerator";
				val9.transform.position = new Vector3(0f, -200f, 0f);
				RuntimeDungeon val10 = val9.AddComponent<RuntimeDungeon>();
				val10.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0];
				val10.Generator.LengthMultiplier = 0.8f;
				val10.Generator.PauseBetweenRooms = 0.2f;
				val10.GenerateOnStart = false;
				val10.Root = val9;
				UnityNavMeshAdapter val11 = val9.AddComponent<UnityNavMeshAdapter>();
				val11.BakeMode = (RuntimeNavMeshBakeMode)3;
				val11.LayerMask = LayerMask.op_Implicit(35072);
				SceneManager.MoveGameObjectToScene(val9, scene);
			}
			GameObject val12 = GameObject.CreatePrimitive((PrimitiveType)3);
			((Object)val12).name = "OutOfBounds";
			val12.layer = 13;
			val12.transform.position = new Vector3(0f, -300f, 0f);
			val12.transform.localScale = new Vector3(1000f, 5f, 1000f);
			BoxCollider component2 = val12.GetComponent<BoxCollider>();
			((Collider)component2).isTrigger = true;
			val12.AddComponent<OutOfBoundsTrigger>();
			Rigidbody val13 = val12.AddComponent<Rigidbody>();
			val13.useGravity = false;
			val13.isKinematic = true;
			val13.collisionDetectionMode = (CollisionDetectionMode)1;
			SceneManager.MoveGameObjectToScene(val12, scene);
		}

		private void CheckAndRemoveIllegalComponents(Transform root)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			List<Transform> list = new List<Transform>();
			foreach (Transform item2 in root)
			{
				Transform item = item2;
				list.Add(item);
			}
			foreach (Transform item3 in list)
			{
				Component[] components = ((Component)item3).GetComponents<Component>();
				Component[] array = components;
				foreach (Component component in array)
				{
					if (!whitelist.Any((Type whitelistType) => ((object)component).GetType() == whitelistType))
					{
						((BaseUnityPlugin)this).Logger.LogWarning((object)("Removed illegal " + ((object)component).GetType().Name + " component."));
						Object.DestroyImmediate((Object)(object)component);
						break;
					}
				}
				if (item3.childCount > 0)
				{
					CheckAndRemoveIllegalComponents(item3);
				}
			}
		}

		private void OnSceneUnloaded(Scene scene)
		{
			if (((Scene)(ref scene)).name.Length > 0)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Unloading scene: " + ((Scene)(ref scene)).name));
			}
			if ((((Scene)(ref scene)).name.StartsWith("Level") || ((Scene)(ref scene)).name == "CompanyBuilding" || (((Scene)(ref scene)).name == "InitSceneLaunchOptions" && isInGame)) && (Object)(object)SpaceLight != (Object)null)
			{
				SpaceLight.SetActive(true);
			}
		}

		private async Task waitForSession()
		{
			while (sessionWaiting)
			{
				await Task.Delay(1000);
			}
			if (!ishost)
			{
				while (hostDataWaiting)
				{
					NetworkPacketManager.Instance.sendPacket("command:requestConfig");
					await Task.Delay(1000);
				}
			}
			else
			{
				for (int i = 0; i < ConfigManager.Instance.GetAll().Count; i++)
				{
					if (ConfigManager.Instance.MustBeSync(i))
					{
						ConfigManager.Instance.SetItemValue(i, ConfigManager.Instance.FindEntryValue(i));
					}
				}
			}
			TimeOfDay.Instance.globalTimeSpeedMultiplier = ConfigManager.Instance.FindItemValue<float>("GlobalTimeSpeedMultiplier");
			TimeOfDay.Instance.lengthOfHours = ConfigManager.Instance.FindItemValue<int>("LengthOfHours");
			TimeOfDay.Instance.numberOfHours = ConfigManager.Instance.FindItemValue<int>("NumberOfHours");
			TimeOfDay.Instance.quotaVariables.deadlineDaysAmount = ConfigManager.Instance.FindItemValue<int>("DeadlineDaysAmount");
			TimeOfDay.Instance.quotaVariables.startingQuota = ConfigManager.Instance.FindItemValue<int>("StartingQuota");
			TimeOfDay.Instance.quotaVariables.startingCredits = ConfigManager.Instance.FindItemValue<int>("StartingCredits");
			RoundManager.Instance.scrapAmountMultiplier = ConfigManager.Instance.FindItemValue<float>("ScrapAmountMultiplier");
			RoundManager.Instance.scrapValueMultiplier = ConfigManager.Instance.FindItemValue<float>("ScrapValueMultiplier");
			RoundManager.Instance.mapSizeMultiplier = ConfigManager.Instance.FindItemValue<float>("MapSizeMultiplier");
			StartOfRound.Instance.maxShipItemCapacity = ConfigManager.Instance.FindItemValue<int>("MaxItemsInShip");
			if (!alreadypatched)
			{
				Terminal_Patch.MainPatch(GameObject.Find("TerminalScript").GetComponent<Terminal>());
				alreadypatched = true;
			}
		}

		private void ConfigSettingChanged(object sender, EventArgs e)
		{
			SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null);
			if (val != null)
			{
				Log.LogInfo((object)$"{val.ChangedSetting.Definition.Key} Changed to {val.ChangedSetting.BoxedValue}");
			}
		}
	}
}
namespace LethalExpansion.Utils
{
	public class AssetBundlesManager
	{
		private static AssetBundlesManager _instance;

		public AssetBundle mainAssetBundle = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("LethalExpansion.dll", "lethalexpansion.lem"));

		public Dictionary<string, (AssetBundle, ModManifest)> assetBundles = new Dictionary<string, (AssetBundle, ModManifest)>();

		public static AssetBundlesManager Instance
		{
			get
			{
				if (_instance == null)
				{
					_instance = new AssetBundlesManager();
				}
				return _instance;
			}
		}

		public (AssetBundle, ModManifest) Load(string name)
		{
			return assetBundles[name.ToLower()];
		}

		public void LoadAllAssetBundles()
		{
			string path;
			if (Assembly.GetExecutingAssembly().Location.Contains("HolographicWings-LethalExpansion"))
			{
				path = Assembly.GetExecutingAssembly().Location.Replace("HolographicWings-LethalExpansion\\LethalExpansion.dll", string.Empty);
				if (Directory.Exists(Application.dataPath.Replace("Lethal Company_Data", "BepInEx\\plugins")))
				{
					string[] files = Directory.GetFiles(Application.dataPath.Replace("Lethal Company_Data", "BepInEx\\plugins"), "*.lem", SearchOption.AllDirectories);
					foreach (string file in files)
					{
						LoadBundle(file);
					}
				}
			}
			else
			{
				path = Assembly.GetExecutingAssembly().Location.Replace("LethalExpansion.dll", string.Empty);
			}
			string[] files2 = Directory.GetFiles(path, "*.lem", SearchOption.AllDirectories);
			foreach (string file2 in files2)
			{
				LoadBundle(file2);
			}
		}

		public void LoadBundle(string file)
		{
			if (!(Path.GetFileName(file) != "lethalexpansion.lem"))
			{
				return;
			}
			if (!assetBundles.ContainsKey(Path.GetFileNameWithoutExtension(file)))
			{
				AssetBundle val = null;
				try
				{
					val = AssetBundle.LoadFromFile(file);
				}
				catch (Exception ex)
				{
					LethalExpansion.Log.LogError((object)ex);
				}
				if ((Object)(object)val != (Object)null)
				{
					LethalExpansion.Log.LogInfo((object)("AssetBundle loaded: " + Path.GetFileName(file)));
					string text = "Assets/Mods/" + Path.GetFileNameWithoutExtension(file) + "/ModManifest.asset";
					ModManifest modManifest = val.LoadAsset<ModManifest>(text);
					if ((Object)(object)modManifest != (Object)null)
					{
						if (!assetBundles.Any((KeyValuePair<string, (AssetBundle, ModManifest)> b) => b.Value.Item2.modName == modManifest.modName))
						{
							LethalExpansion.Log.LogInfo((object)("ModManifest found: " + modManifest.modName));
							assetBundles.Add(Path.GetFileNameWithoutExtension(file).ToLower(), (val, modManifest));
						}
						else
						{
							LethalExpansion.Log.LogWarning((object)("Another mod with same name is already loaded: " + modManifest.modName));
							val.Unload(true);
							LethalExpansion.Log.LogInfo((object)("AssetBundle unloaded: " + Path.GetFileName(file)));
						}
					}
					else
					{
						LethalExpansion.Log.LogWarning((object)("AssetBundle have no ModManifest: " + Path.GetFileName(file)));
						val.Unload(true);
						LethalExpansion.Log.LogInfo((object)("AssetBundle unloaded: " + Path.GetFileName(file)));
					}
				}
				else
				{
					LethalExpansion.Log.LogWarning((object)("File is not an AssetBundle: " + Path.GetFileName(file)));
				}
			}
			else
			{
				LethalExpansion.Log.LogWarning((object)("AssetBundle with same name already loaded: " + Path.GetFileName(file)));
			}
		}

		public bool BundleLoaded(string bundleName)
		{
			return assetBundles.ContainsKey(bundleName.ToLower());
		}

		public bool BundlesLoaded(string[] bundleNames)
		{
			foreach (string text in bundleNames)
			{
				if (!assetBundles.ContainsKey(text.ToLower()))
				{
					return false;
				}
			}
			return true;
		}
	}
	public class AssetGather
	{
		private static AssetGather _instance;

		public Dictionary<string, AudioClip> audioClips = new Dictionary<string, AudioClip>();

		public Dictionary<string, (AudioMixer, AudioMixerGroup[])> audioMixers = new Dictionary<string, (AudioMixer, AudioMixerGroup[])>();

		public Dictionary<string, GameObject> planetPrefabs = new Dictionary<string, GameObject>();

		public Dictionary<string, GameObject> mapObjects = new Dictionary<string, GameObject>();

		public Dictionary<string, SpawnableOutsideObject> outsideObjects = new Dictionary<string, SpawnableOutsideObject>();

		public Dictionary<string, Item> scraps = new Dictionary<string, Item>();

		public Dictionary<string, LevelAmbienceLibrary> levelAmbiances = new Dictionary<string, LevelAmbienceLibrary>();

		public Dictionary<string, EnemyType> enemies = new Dictionary<string, EnemyType>();

		public static AssetGather Instance
		{
			get
			{
				if (_instance == null)
				{
					_instance = new AssetGather();
				}
				return _instance;
			}
		}

		public void GetList()
		{
			LethalExpansion.Log.LogInfo((object)"Audio Clips");
			foreach (KeyValuePair<string, AudioClip> audioClip in audioClips)
			{
				LethalExpansion.Log.LogInfo((object)audioClip.Key);
			}
			LethalExpansion.Log.LogInfo((object)"Audio Mixers");
			foreach (KeyValuePair<string, (AudioMixer, AudioMixerGroup[])> audioMixer in audioMixers)
			{
				LethalExpansion.Log.LogInfo((object)audioMixer.Key);
			}
			LethalExpansion.Log.LogInfo((object)"Planet Prefabs");
			foreach (KeyValuePair<string, GameObject> planetPrefab in planetPrefabs)
			{
				LethalExpansion.Log.LogInfo((object)planetPrefab.Key);
			}
			LethalExpansion.Log.LogInfo((object)"Map Objects");
			foreach (KeyValuePair<string, GameObject> mapObject in mapObjects)
			{
				LethalExpansion.Log.LogInfo((object)mapObject.Key);
			}
			LethalExpansion.Log.LogInfo((object)"Outside Objects");
			foreach (KeyValuePair<string, SpawnableOutsideObject> outsideObject in outsideObjects)
			{
				LethalExpansion.Log.LogInfo((object)outsideObject.Key);
			}
			LethalExpansion.Log.LogInfo((object)"Scraps");
			foreach (KeyValuePair<string, Item> scrap in scraps)
			{
				LethalExpansion.Log.LogInfo((object)scrap.Key);
			}
			LethalExpansion.Log.LogInfo((object)"Level Ambiances");
			foreach (KeyValuePair<string, LevelAmbienceLibrary> levelAmbiance in levelAmbiances)
			{
				LethalExpansion.Log.LogInfo((object)levelAmbiance.Key);
			}
			LethalExpansion.Log.LogInfo((object)"Enemies");
			foreach (KeyValuePair<string, EnemyType> enemy in enemies)
			{
				LethalExpansion.Log.LogInfo((object)enemy.Key);
			}
		}

		public void AddAudioClip(AudioClip clip)
		{
			if ((Object)(object)clip != (Object)null && !audioClips.ContainsKey(((Object)clip).name) && !audioClips.ContainsValue(clip))
			{
				audioClips.Add(((Object)clip).name, clip);
			}
		}

		public void AddAudioMixer(AudioMixer mixer)
		{
			if (!((Object)(object)mixer != (Object)null) || audioMixers.ContainsKey(((Object)mixer).name))
			{
				return;
			}
			List<AudioMixerGroup> list = new List<AudioMixerGroup>();
			AudioMixerGroup[] array = mixer.FindMatchingGroups(string.Empty);
			foreach (AudioMixerGroup val in array)
			{
				if ((Object)(object)val != (Object)null && !list.Contains(val))
				{
					list.Add(val);
				}
			}
			audioMixers.Add(((Object)mixer).name, (mixer, list.ToArray()));
		}

		public void AddPlanetPrefabs(GameObject prefab)
		{
			if ((Object)(object)prefab != (Object)null && !planetPrefabs.ContainsKey(((Object)prefab).name) && !planetPrefabs.ContainsValue(prefab))
			{
				planetPrefabs.Add(((Object)prefab).name, prefab);
			}
		}

		public void AddMapObjects(GameObject mapObject)
		{
			if ((Object)(object)mapObject != (Object)null && !mapObjects.ContainsKey(((Object)mapObject).name) && !mapObjects.ContainsValue(mapObject))
			{
				mapObjects.Add(((Object)mapObject).name, mapObject);
			}
		}

		public void AddOutsideObject(SpawnableOutsideObject outsideObject)
		{
			if ((Object)(object)outsideObject != (Object)null && !outsideObjects.ContainsKey(((Object)outsideObject).name) && !outsideObjects.ContainsValue(outsideObject))
			{
				outsideObjects.Add(((Object)outsideObject).name, outsideObject);
			}
		}

		public void AddScrap(Item scrap)
		{
			if ((Object)(object)scrap != (Object)null && !scraps.ContainsKey(((Object)scrap).name) && !scraps.ContainsValue(scrap))
			{
				scraps.Add(((Object)scrap).name, scrap);
			}
		}

		public void AddLevelAmbiances(LevelAmbienceLibrary levelAmbiance)
		{
			if ((Object)(object)levelAmbiance != (Object)null && !levelAmbiances.ContainsKey(((Object)levelAmbiance).name) && !levelAmbiances.ContainsValue(levelAmbiance))
			{
				levelAmbiances.Add(((Object)levelAmbiance).name, levelAmbiance);
			}
		}

		public void AddEnemies(EnemyType enemie)
		{
			if ((Object)(object)enemie != (Object)null && !enemies.ContainsKey(((Object)enemie).name) && !enemies.ContainsValue(enemie))
			{
				enemies.Add(((Object)enemie).name, enemie);
			}
		}
	}
	internal class ChatMessageProcessor
	{
		public static bool ProcessMessage(string message)
		{
			if (Regex.IsMatch(message, "^\\[sync\\].*\\[sync\\]$"))
			{
				LethalExpansion.Log.LogInfo((object)message);
				string value = Regex.Match(message, "^\\[sync\\](.*)\\[sync\\]$").Groups[1].Value;
				string[] array = value.Split(new char[1] { ':' });
				if (array.Length == 2)
				{
					string text = array[0];
					string text2 = array[1];
					string text3 = text;
					string text4 = text3;
					if (!(text4 == "config"))
					{
						if (text4 == "command")
						{
							ProcessCommand(text2);
						}
						else
						{
							LethalExpansion.Log.LogInfo((object)"Unrecognized key.");
						}
					}
					else
					{
						ProcessConfig(text2);
					}
				}
				return true;
			}
			return false;
		}

		private static void ProcessConfig(string configValue)
		{
			string[] array = configValue.Split(new char[1] { '=' });
			if (array.Length != 2)
			{
				return;
			}
			string text = array[0];
			string text2 = array[1];
			string text3 = text;
			string text4 = text3;
			if (text4 == "generalConfig")
			{
				if (LethalExpansion.ishost)
				{
					return;
				}
				string[] array2 = text2.Split(new char[1] { '|' });
				LethalExpansion.Log.LogInfo((object)("Received host settings: " + text2));
				for (int i = 0; i < array2.Length; i++)
				{
					if (i < ConfigManager.Instance.GetCount() && ConfigManager.Instance.MustBeSync(i))
					{
						ConfigManager.Instance.SetItemValue(i, array2[i].Substring(1), array2[i][0]);
					}
				}
				LethalExpansion.hostDataWaiting = false;
				LethalExpansion.Log.LogInfo((object)"Updated settings");
			}
			else
			{
				LethalExpansion.Log.LogInfo((object)"Unrecognized property.");
			}
		}

		private static void ProcessCommand(string commandValue)
		{
			if (commandValue == "requestConfig")
			{
				if (!LethalExpansion.ishost)
				{
					return;
				}
				string text = "config:generalConfig=";
				foreach (ConfigItem item in ConfigManager.Instance.GetAll())
				{
					switch (item.type.Name)
					{
					case "Int32":
						text += "i";
						break;
					case "Single":
						text += "f";
						break;
					case "Boolean":
						text += "b";
						break;
					case "String":
						text += "s";
						break;
					}
					text = text + item.Value?.ToString() + "|";
				}
				text = text.Remove(text.Length - 1);
				NetworkPacketManager.Instance.sendPacket(text);
			}
			else
			{
				LethalExpansion.Log.LogInfo((object)"Unrecognized command.");
			}
		}
	}
	public class ConfigManager
	{
		private static ConfigManager _instance;

		private List<ConfigItem> items = new List<ConfigItem>();

		private List<ConfigEntryBase> entries = new List<ConfigEntryBase>();

		public static ConfigManager Instance
		{
			get
			{
				if (_instance == null)
				{
					_instance = new ConfigManager();
				}
				return _instance;
			}
		}

		public void AddItem(ConfigItem item)
		{
			try
			{
				items.Add(item);
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
			}
		}

		public void ReadConfig()
		{
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Expected O, but got Unknown
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Expected O, but got Unknown
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Expected O, but got Unknown
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Expected O, but got Unknown
			items = (from item in items
				orderby item.Tab, item.Key
				select item).ToList();
			try
			{
				for (int i = 0; i < items.Count; i++)
				{
					if (!items[i].Hidden)
					{
						string description = items[i].Description;
						description = description + "\nNetwork synchronization: " + (items[i].Sync ? "Yes" : "No");
						description = description + "\nMod required by clients: " + (items[i].Optional ? "No" : "Yes");
						switch (items[i].type.Name)
						{
						case "Int32":
							entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<int>(items[i].Tab, items[i].Key, (int)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<int>((int)items[i].MinValue, (int)items[i].MaxValue), Array.Empty<object>())));
							break;
						case "Single":
							entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<float>(items[i].Tab, items[i].Key, (float)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>((float)items[i].MinValue, (float)items[i].MaxValue), Array.Empty<object>())));
							break;
						case "Boolean":
							entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<bool>(items[i].Tab, items[i].Key, (bool)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>())));
							break;
						case "String":
							entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<string>(items[i].Tab, items[i].Key, (string)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>())));
							break;
						}
						if (!items[i].Sync)
						{
							items[i].Value = entries.Last().BoxedValue;
						}
					}
					else
					{
						entries.Add(null);
					}
				}
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
			}
		}

		public object FindItemValue(string key)
		{
			try
			{
				return items.First((ConfigItem item) => item.Key == key).Value;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return null;
			}
		}

		public object FindItemValue(int index)
		{
			try
			{
				return items[index].Value;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return null;
			}
		}

		public object FindEntryValue(string key)
		{
			try
			{
				return entries.First((ConfigEntryBase item) => item.Definition.Key == key).BoxedValue;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return null;
			}
		}

		public object FindEntryValue(int index)
		{
			try
			{
				return entries[index].BoxedValue;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return null;
			}
		}

		public bool RequireRestart(string key)
		{
			try
			{
				return items.First((ConfigItem item) => item.Key == key).RequireRestart;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return false;
			}
		}

		public bool RequireRestart(int index)
		{
			try
			{
				return items[index].RequireRestart;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return false;
			}
		}

		public string FindDescription(string key)
		{
			try
			{
				return items.First((ConfigItem item) => item.Key == key).Description;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return null;
			}
		}

		public string FindDescription(int index)
		{
			try
			{
				return items[index].Description;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return null;
			}
		}

		public (bool, bool) FindNetInfo(string key)
		{
			try
			{
				ConfigItem configItem = items.First((ConfigItem item) => item.Key == key);
				return (configItem.Sync, configItem.Optional);
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return (false, false);
			}
		}

		public (bool, bool) FindNetInfo(int index)
		{
			try
			{
				return (items[index].Sync, items[index].Optional);
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return (false, false);
			}
		}

		public object FindDefaultValue(string key)
		{
			try
			{
				return items.First((ConfigItem item) => item.Key == key).DefaultValue;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return null;
			}
		}

		public object FindDefaultValue(int index)
		{
			try
			{
				return items[index].DefaultValue;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return null;
			}
		}

		public bool MustBeSync(string key)
		{
			try
			{
				return items.First((ConfigItem item) => item.Key == key).Sync;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return true;
			}
		}

		public bool MustBeSync(int index)
		{
			try
			{
				return items[index].Sync;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return true;
			}
		}

		public bool SetItemValue(string key, object value)
		{
			ConfigItem configItem = items.First((ConfigItem item) => item.Key == key);
			if (!items.First((ConfigItem item) => item.Key == key).RequireRestart)
			{
				try
				{
					configItem.Value = value;
					return true;
				}
				catch (Exception ex)
				{
					LethalExpansion.Log.LogError((object)ex.Message);
					return false;
				}
			}
			return false;
		}

		public bool SetEntryValue(string key, object value)
		{
			try
			{
				entries.First((ConfigEntryBase item) => item.Definition.Key == key).BoxedValue = value;
				return true;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return false;
			}
		}

		public bool SetItemValue(int index, string value, char type)
		{
			if (!items[index].RequireRestart)
			{
				try
				{
					switch (type)
					{
					case 'i':
						items[index].Value = int.Parse(value);
						break;
					case 'f':
						items[index].Value = float.Parse(value);
						break;
					case 'b':
						items[index].Value = bool.Parse(value);
						break;
					case 's':
						items[index].Value = value;
						break;
					}
					return true;
				}
				catch (Exception ex)
				{
					LethalExpansion.Log.LogError((object)ex.Message);
					return false;
				}
			}
			return false;
		}

		public bool SetEntryValue(int index, string value, char type)
		{
			try
			{
				switch (type)
				{
				case 'i':
					entries[index].BoxedValue = int.Parse(value);
					break;
				case 'f':
					entries[index].BoxedValue = float.Parse(value);
					break;
				case 'b':
					entries[index].BoxedValue = bool.Parse(value);
					break;
				case 's':
					entries[index].BoxedValue = value;
					break;
				}
				return true;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return false;
			}
		}

		public (object, int) FindValueAndIndex(string key)
		{
			try
			{
				return (items.First((ConfigItem item) => item.Key == key).Value, items.FindIndex((ConfigItem item) => item.Key == key));
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return (null, -1);
			}
		}

		public int FindIndex(string key)
		{
			try
			{
				return items.FindIndex((ConfigItem item) => item.Key == key);
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return -1;
			}
		}

		public T FindItemValue<T>(string key)
		{
			try
			{
				ConfigItem configItem = items.First((ConfigItem item) => item.Key == key);
				if (configItem != null && configItem.Value is T)
				{
					return (T)configItem.Value;
				}
				LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type");
				throw new InvalidOperationException("Key not found or value is of incorrect type");
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return default(T);
			}
		}

		public T FindItemValue<T>(int index)
		{
			try
			{
				ConfigItem configItem = items[index];
				if (configItem != null && configItem.Value is T)
				{
					return (T)configItem.Value;
				}
				LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type");
				throw new InvalidOperationException("Key not found or value is of incorrect type");
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return default(T);
			}
		}

		public T FindEntryValue<T>(string key)
		{
			try
			{
				ConfigEntryBase val = entries.First((ConfigEntryBase item) => item.Definition.Key == key);
				if (val != null && val.BoxedValue is T)
				{
					return (T)val.BoxedValue;
				}
				LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type");
				throw new InvalidOperationException("Key not found or value is of incorrect type");
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return default(T);
			}
		}

		public T FindEntryValue<T>(int index)
		{
			try
			{
				ConfigEntryBase val = entries[index];
				if (val != null && val.BoxedValue is T)
				{
					return (T)val.BoxedValue;
				}
				LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type");
				throw new InvalidOperationException("Key not found or value is of incorrect type");
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return default(T);
			}
		}

		public bool SetItemValue<T>(string key, T value)
		{
			ConfigItem configItem = items.First((ConfigItem item) => item.Key == key);
			if (!configItem.RequireRestart)
			{
				try
				{
					if (configItem == null || !(configItem.Value is T))
					{
						LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type");
						throw new InvalidOperationException("Key not found or value is of incorrect type");
					}
					configItem.Value = value;
					return true;
				}
				catch (Exception ex)
				{
					LethalExpansion.Log.LogError((object)ex.Message);
					return false;
				}
			}
			return false;
		}

		public bool SetEntryValue<T>(string key, T value)
		{
			try
			{
				ConfigEntryBase val = entries.First((ConfigEntryBase item) => item.Definition.Key == key);
				if (val != null && val.BoxedValue is T)
				{
					val.BoxedValue = value;
					return true;
				}
				LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type");
				throw new InvalidOperationException("Key not found or value is of incorrect type");
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return false;
			}
		}

		public bool SetItemValue<T>(int index, T value)
		{
			if (!items[index].RequireRestart)
			{
				try
				{
					items[index].Value = value;
					return true;
				}
				catch (Exception ex)
				{
					LethalExpansion.Log.LogError((object)ex.Message);
					return false;
				}
			}
			return false;
		}

		public bool SetEntryValue<T>(int index, T value)
		{
			try
			{
				entries[index].BoxedValue = value;
				return true;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return false;
			}
		}

		public (T, int) FindValueAndIndex<T>(string key)
		{
			try
			{
				ConfigItem configItem = items.First((ConfigItem item) => item.Key == key);
				if (configItem != null && configItem.Value is T)
				{
					return ((T)configItem.Value, items.FindIndex((ConfigItem item) => item.Key == key));
				}
				LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type");
				throw new InvalidOperationException("Key not found or value is of incorrect type");
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return (default(T), -1);
			}
		}

		public List<ConfigItem> GetAll()
		{
			try
			{
				return items;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return null;
			}
		}

		public int GetCount()
		{
			try
			{
				return items.Count;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return -1;
			}
		}

		public int GetEntriesCount()
		{
			try
			{
				return entries.Count;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return -1;
			}
		}

		public object ReadConfigValue(string key)
		{
			try
			{
				return entries[FindIndex(key)].BoxedValue;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return null;
			}
		}

		public T ReadConfigValue<T>(string key)
		{
			try
			{
				return (T)entries[FindIndex(key)].BoxedValue;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return default(T);
			}
		}

		public bool WriteConfigValue(string key, object value)
		{
			try
			{
				int index = FindIndex(key);
				SetItemValue(index, value);
				entries[index].BoxedValue = value;
				return true;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return false;
			}
		}

		public bool WriteConfigValue<T>(string key, T value)
		{
			try
			{
				int index = FindIndex(key);
				SetItemValue(index, value);
				entries[index].BoxedValue = value;
				return true;
			}
			catch (Exception ex)
			{
				LethalExpansion.Log.LogError((object)ex.Message);
				return false;
			}
		}
	}
	internal static class ModUtils
	{
		public static T[] RemoveElementFromArray<T>(T[] originalArray, int indexToRemove)
		{
			if (indexToRemove < 0 || indexToRemove >= originalArray.Length)
			{
				throw new ArgumentOutOfRangeException("indexToRemove");
			}
			T[] array = new T[originalArray.Length - 1];
			int i = 0;
			int num = 0;
			for (; i < originalArray.Length; i++)
			{
				if (i != indexToRemove)
				{
					array[num] = originalArray[i];
					num++;
				}
			}
			return array;
		}
	}
	internal class NetworkPacketManager
	{
		private static NetworkPacketManager _instance;

		public static NetworkPacketManager Instance
		{
			get
			{
				if (_instance == null)
				{
					_instance = new NetworkPacketManager();
				}
				return _instance;
			}
		}

		private NetworkPacketManager()
		{
		}

		public void sendPacket(string packet)
		{
			HUDManager.Instance.AddTextToChatOnServer("[sync]" + packet + "[sync]", -1);
		}
	}
}
namespace LethalExpansion.Utils.HUD
{
	internal class SettingMenu_DragAndDrop : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler
	{
		public UnityEvent onBeginDragEvent;

		public UnityEvent onDragEvent;

		public UnityEvent onEndDragEvent;

		public RectTransform rectTransform;

		private Canvas canvas;

		private void Awake()
		{
			if ((Object)(object)rectTransform == (Object)null)
			{
				rectTransform = ((Component)this).GetComponent<RectTransform>();
			}
			canvas = Object.FindFirstObjectByType<Canvas>();
		}

		public void OnBeginDrag(PointerEventData eventData)
		{
			if (onBeginDragEvent != null)
			{
				onBeginDragEvent.Invoke();
			}
		}

		public void OnDrag(PointerEventData eventData)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			if (eventData != null && (Object)(object)rectTransform != (Object)null)
			{
				rectTransform.anchoredPosition = ClampToWindow(rectTransform.anchoredPosition + eventData.delta / canvas.scaleFactor);
				if (onDragEvent != null)
				{
					onDragEvent.Invoke();
				}
			}
		}

		public void OnEndDrag(PointerEventData eventData)
		{
			if (onEndDragEvent != null)
			{
				onEndDragEvent.Invoke();
			}
		}

		private Vector2 ClampToWindow(Vector2 position)
		{
			//IL_0021: 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)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			float num = -260f;
			float num2 = 260f;
			float num3 = -60f;
			float num4 = 50f;
			float num5 = Mathf.Clamp(position.x, num, num2);
			float num6 = Mathf.Clamp(position.y, num3, num4);
			return new Vector2(num5, num6);
		}
	}
	internal class SettingsMenu
	{
		private static SettingsMenu _instance;

		private bool initialized = false;

		private List<HUDSettingEntry> entries = new List<HUDSettingEntry>();

		public static SettingsMenu Instance
		{
			get
			{
				if (_instance == null)
				{
					_instance = new SettingsMenu();
				}
				return _instance;
			}
		}

		private SettingsMenu()
		{
		}

		public void InitSettingsMenu()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Expected O, but got Unknown
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Expected O, but got Unknown
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Expected O, but got Unknown
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Expected O, but got Unknown
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Expected O, but got Unknown
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Expected O, but got Unknown
			//IL_0576: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a07: Unknown result type (might be due to invalid IL or missing references)
			//IL_0733: Unknown result type (might be due to invalid IL or missing references)
			//IL_073d: Expected O, but got Unknown
			//IL_0859: Unknown result type (might be due to invalid IL or missing references)
			//IL_0863: Expected O, but got Unknown
			//IL_08df: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e9: Expected O, but got Unknown
			//IL_0965: Unknown result type (might be due to invalid IL or missing references)
			//IL_096f: Expected O, but got Unknown
			entries = new List<HUDSettingEntry>();
			GameObject val = GameObject.Find("Canvas/MenuContainer");
			if ((Object)(object)val == (Object)null)
			{
				LethalExpansion.Log.LogError((object)"MenuContainer not found in the scene!");
				return;
			}
			RectTransform component = ((Component)val.transform.Find("MainButtons/HostButton")).GetComponent<RectTransform>();
			component.anchoredPosition += new Vector2(0f, 38.5f);
			RectTransform component2 = ((Component)val.transform.Find("MainButtons/JoinACrew")).GetComponent<RectTransform>();
			component2.anchoredPosition += new Vector2(0f, 38.5f);
			RectTransform component3 = ((Component)val.transform.Find("MainButtons/StartLAN")).GetComponent<RectTransform>();
			component3.anchoredPosition += new Vector2(0f, 38.5f);
			GameObject gameObject = ((Component)val.transform.Find("MainButtons/SettingsButton")).gameObject;
			RectTransform component4 = gameObject.GetComponent<RectTransform>();
			component4.anchoredPosition += new Vector2(0f, 38.5f);
			GameObject val2 = Object.Instantiate<GameObject>(gameObject, val.transform);
			val2.transform.SetParent(val.transform.Find("MainButtons"));
			((Object)val2).name = "ModSettingsButton";
			((Component)val2.transform.Find("Text (TMP)")).GetComponent<TMP_Text>().text = "> Mod Settings";
			val2.GetComponent<RectTransform>().anchoredPosition = gameObject.GetComponent<RectTransform>().anchoredPosition - new Vector2(0f, 38.5f);
			GameObject ModSettingsPanel = Object.Instantiate<GameObject>(AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Prefabs/Settings/ModSettings.prefab"));
			GameObject val3 = AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Prefabs/Settings/SettingEntry.prefab");
			GameObject val4 = AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Prefabs/Settings/SettingCategory.prefab");
			ModSettingsPanel.transform.SetParent(val.transform);
			ModSettingsPanel.transform.localPosition = Vector3.zero;
			ModSettingsPanel.transform.localScale = Vector3.one;
			Button component5 = val2.GetComponent<Button>();
			component5.onClick = new ButtonClickedEvent();
			((UnityEvent)component5.onClick).AddListener((UnityAction)delegate
			{
				ModSettingsPanel.SetActive(true);
				GetSettings();
			});
			SettingMenu_DragAndDrop settingMenu_DragAndDrop = ((Component)ModSettingsPanel.transform.Find("DragAndDropSurface")).gameObject.AddComponent<SettingMenu_DragAndDrop>();
			settingMenu_DragAndDrop.rectTransform = ModSettingsPanel.GetComponent<RectTransform>();
			Button component6 = ((Component)ModSettingsPanel.transform.Find("CloseButton")).GetComponent<Button>();
			Button component7 = ((Component)ModSettingsPanel.transform.Find("ApplyButton")).GetComponent<Button>();
			Button component8 = ((Component)ModSettingsPanel.transform.Find("CancelButton")).GetComponent<Button>();
			((UnityEvent)component6.onClick).AddListener((UnityAction)delegate
			{
				ModSettingsPanel.SetActive(false);
			});
			((UnityEvent)component7.onClick).AddListener((UnityAction)delegate
			{
				ApplySettings();
				ModSettingsPanel.SetActive(false);
			});
			((UnityEvent)component8.onClick).AddListener((UnityAction)delegate
			{
				ModSettingsPanel.SetActive(false);
			});
			GameObject gameObject2 = ((Component)ModSettingsPanel.transform.Find("Scroll View/Viewport/ModSettingsContent")).gameObject;
			Button component9 = ((Component)gameObject2.transform.Find("AllDefaultButton")).GetComponent<Button>();
			((UnityEvent)component9.onClick).AddListener((UnityAction)delegate
			{
				ResetAllSettings();
			});
			RectTransform component10 = gameObject2.GetComponent<RectTransform>();
			GameObject gameObject3 = ((Component)gameObject2.transform.Find("TooltipPanel")).gameObject;
			TooltipHandler.ModSettingsToolTipPanel = gameObject3.GetComponent<RectTransform>();
			TooltipHandler.ModSettingsToolTipPanelDescription = ((Component)gameObject3.transform.Find("Description")).GetComponent<TMP_Text>();
			TooltipHandler.ModSettingsToolTipPanelNetInfo = ((Component)gameObject3.transform.Find("NetInfo")).GetComponent<TMP_Text>();
			int num = -15;
			string text = string.Empty;
			foreach (ConfigItem item in ConfigManager.Instance.GetAll())
			{
				if (item.Tab != text)
				{
					GameObject val5 = Object.Instantiate<GameObject>(val4, gameObject2.transform);
					((Component)val5.transform.Find("Text")).GetComponent<TMP_Text>().text = item.Tab + ":";
					val5.GetComponent<RectTransform>().anchoredPosition = new Vector2(-100f, (float)num);
					text = item.Tab;
					num -= 20;
				}
				HUDSettingEntry entry = new HUDSettingEntry();
				entry.SettingsEntry = Object.Instantiate<GameObject>(val3, gameObject2.transform);
				entry.SettingsEntryKey = ((Component)entry.SettingsEntry.transform.Find("Key")).gameObject;
				entry.SettingsEntryKeyTextComponent = entry.SettingsEntryKey.GetComponent<TMP_Text>();
				entry.SettingsEntryKeyTextComponent.text = item.Key;
				entry.SettingsEntry.GetComponent<RectTransform>().anchoredPosition = new Vector2(-100f, (float)num);
				entry.ValueObject = null;
				entry.ValueTypeName = item.type.Name;
				switch (entry.ValueTypeName)
				{
				case "Int32":
					entry.ValueObject = ((Component)entry.SettingsEntry.transform.Find("Value/Slider")).gameObject;
					entry.ValueObjectSelectable1 = entry.ValueObject.GetComponent<Slider>();
					entry.ValueObjectSelectable1.wholeNumbers = true;
					entry.ValueObjectSelectable1.minValue = (int)item.MinValue;
					entry.ValueObjectSelectable1.maxValue = (int)item.MaxValue;
					entry.ValueObjectSelectable1Text = ((Component)((Component)entry.ValueObjectSelectable1).transform.Find("Text")).GetComponent<TMP_Text>();
					((UnityEvent<float>)(object)entry.ValueObjectSelectable1.onValueChanged).AddListener((UnityAction<float>)delegate(float value)
					{
						value = RoundToNearest((int)value, 1);
						entry.ValueObjectSelectable1Text.text = value.ToString();
					});
					((UnityEvent)((Component)entry.SettingsEntry.transform.Find("DefaultButton")).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
					{
						entry.ValueObjectSelectable1.value = (int)item.DefaultValue;
					});
					break;
				case "Single":
					entry.ValueObject = ((Component)entry.SettingsEntry.transform.Find("Value/Slider")).gameObject;
					entry.ValueObjectSelectable2 = entry.ValueObject.GetComponent<Slider>();
					entry.ValueObjectSelectable2.minValue = (float)item.MinValue;
					entry.ValueObjectSelectable2.maxValue = (float)item.MaxValue;
					entry.ValueObjectSelectable2Text = ((Component)((Component)entry.ValueObjectSelectable2).transform.Find("Text")).GetComponent<TMP_Text>();
					((UnityEvent<float>)(object)entry.ValueObjectSelectable2.onValueChanged).AddListener((UnityAction<float>)delegate(float value)
					{
						value = (float)Math.Round(RoundToNearest(value, 0.05f), 2);
						entry.ValueObjectSelectable2Text.text = value.ToString();
					});
					((UnityEvent)((Component)entry.SettingsEntry.transform.Find("DefaultButton")).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
					{
						entry.ValueObjectSelectable2.value = (float)item.DefaultValue;
					});
					break;
				case "Boolean":
					entry.ValueObject = ((Component)entry.SettingsEntry.transform.Find("Value/Toggle")).gameObject;
					entry.ValueObjectSelectable3 = entry.ValueObject.GetComponent<Toggle>();
					((UnityEvent)((Component)entry.SettingsEntry.transform.Find("DefaultButton")).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
					{
						entry.ValueObjectSelectable3.isOn = (bool)item.DefaultValue;
					});
					break;
				case "String":
					entry.ValueObject = ((Component)entry.SettingsEntry.transform.Find("Value/InputField")).gameObject;
					entry.ValueObjectSelectable4 = entry.ValueObject.GetComponent<TMP_InputField>();
					((UnityEvent)((Component)entry.SettingsEntry.transform.Find("DefaultButton")).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
					{
						entry.ValueObjectSelectable4.text = (string)item.DefaultValue;
					});
					break;
				}
				if ((Object)(object)entry.ValueObject != (Object)null)
				{
					entry.ValueObject.SetActive(true);
				}
				entries.Add(entry);
				num -= 20;
			}
			((Component)component9).GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, (float)(num - 5));
			component10.sizeDelta = new Vector2(380f, (float)Mathf.Abs(num - 25));
			gameObject3.transform.SetAsLastSibling();
			initialized = true;
		}

		public void GetSettings()
		{
			for (int i = 0; i < entries.Count; i++)
			{
				entries[i].SettingsEntry.AddComponent<TooltipHandler>().index = i;
				switch (entries[i].ValueTypeName)
				{
				case "Int32":
					entries[i].ValueObjectSelectable1.value = (int)ConfigManager.Instance.FindEntryValue(i);
					break;
				case "Single":
					entries[i].ValueObjectSelectable2.value = (float)ConfigManager.Instance.FindEntryValue(i);
					break;
				case "Boolean":
					entries[i].ValueObjectSelectable3.isOn = (bool)ConfigManager.Instance.FindEntryValue(i);
					break;
				case "String":
					entries[i].ValueObjectSelectable4.text = (string)ConfigManager.Instance.FindEntryValue(i);
					break;
				}
			}
		}

		public void ApplySettings()
		{
			for (int i = 0; i < entries.Count; i++)
			{
				switch (entries[i].ValueTypeName)
				{
				case "Int32":
					ConfigManager.Instance.SetEntryValue(i, RoundToNearest((int)entries[i].ValueObjectSelectable1.value, 1));
					break;
				case "Single":
					ConfigManager.Instance.SetEntryValue(i, (float)Math.Round(RoundToNearest(entries[i].ValueObjectSelectable2.value, 0.05f), 2));
					break;
				case "Boolean":
					ConfigManager.Instance.SetEntryValue(i, entries[i].ValueObjectSelectable3.isOn);
					break;
				case "String":
					ConfigManager.Instance.SetEntryValue(i, entries[i].ValueObjectSelectable4.text);
					break;
				}
				if (!ConfigManager.Instance.MustBeSync(i))
				{
					switch (entries[i].ValueTypeName)
					{
					case "Int32":
						ConfigManager.Instance.SetItemValue(i, RoundToNearest((int)entries[i].ValueObjectSelectable1.value, 1));
						break;
					case "Single":
						ConfigManager.Instance.SetItemValue(i, (float)Math.Round(RoundToNearest(entries[i].ValueObjectSelectable2.value, 0.05f), 2));
						break;
					case "Boolean":
						ConfigManager.Instance.SetItemValue(i, entries[i].ValueObjectSelectable3.isOn);
						break;
					case "String":
						ConfigManager.Instance.SetItemValue(i, entries[i].ValueObjectSelectable4.text);
						break;
					}
				}
			}
		}

		public void ResetAllSettings()
		{
			for (int i = 0; i < entries.Count; i++)
			{
				switch (entries[i].ValueTypeName)
				{
				case "Int32":
					entries[i].ValueObjectSelectable1.value = (int)ConfigManager.Instance.FindDefaultValue(i);
					break;
				case "Single":
					entries[i].ValueObjectSelectable2.value = (float)ConfigManager.Instance.FindDefaultValue(i);
					break;
				case "Boolean":
					entries[i].ValueObjectSelectable3.isOn = (bool)ConfigManager.Instance.FindDefaultValue(i);
					break;
				case "String":
					entries[i].ValueObjectSelectable4.text = (string)ConfigManager.Instance.FindDefaultValue(i);
					break;
				}
			}
		}

		private int DetermineIncrement(int min, int max)
		{
			int num = max - min;
			if (num <= 5000)
			{
				return 1;
			}
			if (num <= 1000)
			{
				return 50;
			}
			if (num <= 10000)
			{
				return 500;
			}
			return 1000;
		}

		private float DetermineIncrement(float min, float max)
		{
			float num = max - min;
			if (num <= 50f)
			{
				return 1f;
			}
			if (num <= 1000f)
			{
				return 50f;
			}
			if (num <= 10000f)
			{
				return 500f;
			}
			return 1000f;
		}

		private int RoundToNearest(int number, int min, int max)
		{
			int num = DetermineIncrement(min, max);
			return (int)(Math.Round((double)number / (double)num) * (double)num);
		}

		private float RoundToNearest(float number, float min, float max)
		{
			float num = DetermineIncrement(min, max);
			return (float)(Math.Round(number / num) * (double)num);
		}

		private int RoundToNearest(int number, int increment)
		{
			return (int)(Math.Round((double)number / (double)increment) * (double)increment);
		}

		private float RoundToNearest(float number, float increment)
		{
			return (float)(Math.Round(number / increment) * (double)increment);
		}
	}
	internal class HUDSettingEntry
	{
		public GameObject SettingsEntry;

		public GameObject SettingsEntryKey;

		public TMP_Text SettingsEntryKeyTextComponent;

		public GameObject ValueObject;

		public string ValueTypeName;

		public Slider ValueObjectSelectable1;

		public TMP_Text ValueObjectSelectable1Text;

		public Slider ValueObjectSelectable2;

		public TMP_Text ValueObjectSelectable2Text;

		public Toggle ValueObjectSelectable3;

		public TMP_InputField ValueObjectSelectable4;

		public TooltipHandler TooltipHandler;
	}
}
namespace LethalExpansion.Patches
{
	[HarmonyPatch(typeof(EntranceTeleport))]
	public class EntranceTeleport_Patch
	{
		[HarmonyPatch("SetAudioPreset")]
		[HarmonyPrefix]
		public static bool SetAudioPreset_Prefix(EntranceTeleport __instance, int playerObj)
		{
			if ((Object)(object)Object.FindObjectOfType<AudioReverbPresets>() == (Object)null)
			{
				__instance.PlayAudioAtTeleportPositions();
				return false;
			}
			if (Object.FindObjectOfType<AudioReverbPresets>().audioPresets.Length <= __instance.audioReverbPreset)
			{
				__instance.PlayAudioAtTeleportPositions();
				return false;
			}
			return true;
		}

		[HarmonyPatch("TeleportPlayer")]
		[HarmonyPostfix]
		public static void TeleportPlayer_Postfix(EntranceTeleport __instance)
		{
			SI_WaterSurface val = Object.FindObjectOfType<SI_WaterSurface>();
			if ((Object)(object)val != (Object)null)
			{
				if (__instance.isEntranceToBuilding)
				{
					((Behaviour)((Component)val).GetComponentInChildren<AudioSource>()).enabled = false;
				}
				else
				{
					((Behaviour)((Component)val).GetComponentInChildren<AudioSource>()).enabled = true;
				}
			}
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal class GameNetworkManager_Patch
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		private static void Start_Prefix(GameNetworkManager __instance)
		{
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Expected O, but got Unknown
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			if (!LethalExpansion.CompatibleGameVersions.Contains(__instance.gameVersionNum))
			{
				LethalExpansion.Log.LogWarning((object)"Warning, this mod is not made for this Game Version, this could cause unexpected behaviors.");
				LethalExpansion.Log.LogWarning((object)$"Game version: {__instance.gameVersionNum}");
				LethalExpansion.Log.LogWarning((object)string.Format("Compatible mod versions: {0}", string.Join(",", LethalExpansion.CompatibleGameVersions)));
			}
			if (!ConfigManager.Instance.FindItemValue<bool>("LoadModules"))
			{
				return;
			}
			Sprite itemIcon = AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<Sprite>("Assets/Mods/LethalExpansion/Sprites/ScrapItemIcon2.png");
			try
			{
				foreach (KeyValuePair<string, (AssetBundle, ModManifest)> assetBundle in AssetBundlesManager.Instance.assetBundles)
				{
					Scrap[] scraps = AssetBundlesManager.Instance.Load(assetBundle.Key).Item2.scraps;
					foreach (Scrap val in scraps)
					{
						if ((Object)(object)val == (Object)null)
						{
							break;
						}
						Item val2 = (Item)ScriptableObject.CreateInstance(typeof(Item));
						((Object)val2).name = ((Object)val).name;
						val2.itemName = val.itemName;
						val2.canBeGrabbedBeforeGameStart = true;
						val2.isScrap = true;
						val2.minValue = val.minValue;
						val2.maxValue = val.maxValue;
						val2.weight = (float)val.weight / 100f + 1f;
						val2.spawnPrefab = val.prefab;
						val2.requiresBattery = val.requiresBattery;
						val2.itemIcon = itemIcon;
						val2.syncGrabFunction = false;
						val2.syncUseFunction = false;
						val2.syncDiscardFunction = false;
						val2.syncInteractLRFunction = false;
						val2.verticalOffset = val.verticalOffset;
						val2.restingRotation = val.restingRotation;
						val2.positionOffset = val.positionOffset;
						val2.rotationOffset = val.rotationOffset;
						val2.meshOffset = false;
						val2.meshVariants = val.meshVariants;
						val2.materialVariants = val.materialVariants;
						val2.canBeInspected = false;
						if ((Object)(object)val.prefab == (Object)null)
						{
							break;
						}
						PhysicsProp val3 = val.prefab.AddComponent<PhysicsProp>();
						((GrabbableObject)val3).grabbable = true;
						((GrabbableObject)val3).itemProperties = val2;
						((GrabbableObject)val3).mainObjectRenderer = val.prefab.GetComponent<MeshRenderer>();
						AudioSource val4 = val.prefab.AddComponent<AudioSource>();
						val4.playOnAwake = false;
						val4.spatialBlend = 1f;
						ScanNodeProperties val5 = ((Component)val.prefab.transform.Find("ScanNode")).gameObject.AddComponent<ScanNodeProperties>();
						val5.maxRange = 13;
						val5.minRange = 1;
						val5.headerText = val.itemName;
						val5.subText = "Value: ";
						val5.nodeType = 2;
						try
						{
							((Component)__instance).GetComponent<NetworkManager>().PrefabHandler.AddNetworkPrefab(val.prefab);
							LethalExpansion.Log.LogInfo((object)(val.itemName + " Scrap registered."));
						}
						catch (Exception ex)
						{
							LethalExpansion.Log.LogError((object)ex.Message);
						}
					}
				}
			}
			catch (Exception ex2)
			{
				LethalExpansion.Log.LogError((object)ex2.Message);
			}
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManager_Patch
	{
		[HarmonyPatch("AddChatMessage")]
		[HarmonyPrefix]
		private static bool ChatInterpreter(HUDManager __instance, string chatMessage)
		{
			if (ChatMessageProcessor.ProcessMessage(chatMessage))
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void Update_Postfix_Patch(HUDManager __instance)
		{
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				float num = Mathf.RoundToInt(Mathf.Clamp(GameNetworkManager.Instance.localPlayerController.carryWeight - 1f, 0f, 100f) * 105f);
				switch (ConfigManager.Instance.FindItemValue<int>("WeightUnit"))
				{
				case 1:
					((TMP_Text)__instance.weightCounter).text = string.Format("{0} kg", ConfigManager.Instance.FindItemValue<bool>("ConvertPoundsToKilograms") ? ((float)Mathf.RoundToInt(num * 0.4536f)) : num);
					break;
				case 2:
					((TMP_Text)__instance.weightCounter).text = $"{Mathf.RoundToInt(num * 0.4536f)} kg\n{num} lb";
					break;
				}
			}
		}

		[HarmonyPatch("SetClock")]
		[HarmonyPrefix]
		public static bool SetClock_Prefix_Patch(HUDManager __instance, ref string __result, float timeNormalized, float numberOfHours, bool createNewLine)
		{
			if (ConfigManager.Instance.FindItemValue<bool>("24HoursClock"))
			{
				int num = (int)(timeNormalized * (60f * numberOfHours)) + 360;
				int num2 = (int)Mathf.Floor((float)(num / 60));
				num2 %= 24;
				if (!createNewLine)
				{
					string text = " ";
				}
				else
				{
					string text = "\n";
				}
				int num3 = num % 60;
				string text2 = $"{num2:0}:{num3:00}";
				((TMP_Text)__instance.clockNumber).text = text2;
				__result = text2;
			}
			else
			{
				int num4 = (int)(timeNormalized * (60f * numberOfHours)) + 360;
				int num5 = (int)Mathf.Floor((float)(num4 / 60));
				num5 %= 24;
				string text = (createNewLine ? "\n" : " ");
				string text3 = text + "AM";
				text3 = ((num5 >= 12) ? (text + "PM") : (text + "AM"));
				if (num5 > 12)
				{
					num5 %= 12;
				}
				int num6 = num4 % 60;
				string text4 = $"{num5:0}:{num6:00}" + text3;
				((TMP_Text)__instance.clockNumber).text = text4;
				__result = text4;
			}
			return false;
		}

		[HarmonyPatch("SetClockVisible")]
		[HarmonyPostfix]
		public static void SetClockVisible_Postfix_Patch(HUDManager __instance)
		{
			if (ConfigManager.Instance.FindItemValue<bool>("ClockAlwaysVisible"))
			{
				__instance.Clock.targetAlpha = 1f;
			}
		}
	}
	[HarmonyPatch(typeof(Landmine))]
	[HarmonyPatch("OnDestroy")]
	internal class Landmine_Patch
	{
		[HarmonyPatch("OnTriggerEnter")]
		[HarmonyPrefix]
		private static bool LandmineOnTriggerEnter_Prefix(Landmine __instance, Collider other)
		{
			if (ConfigManager.Instance.FindItemValue<bool>("PreventMineToExplodeWithItems") && (((Component)other).CompareTag("PlayerRagdoll") || ((Component)other).CompareTag("PhysicsProp")) && Object.op_Implicit((Object)(object)((Component)other).GetComponent<GrabbableObject>()) && ((Component)other).GetComponent<GrabbableObject>().itemProperties.weight - 1f < ConfigManager.Instance.FindItemValue<float>("MineActivationWeight"))
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch("OnTriggerEnter")]
		[HarmonyPostfix]
		private static void LandmineOnTriggerEnter_Postfix(Landmine __instance, Collider other)
		{
			if (((Component)other).CompareTag("Player") || ((Component)other).CompareTag("PlayerRagdoll") || ((Component)other).CompareTag("PhysicsProp"))
			{
				if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<PlayerControllerB>()) || Object.op_Implicit((Object)(object)((Component)other).GetComponent<DeadBodyInfo>()))
				{
					__instance.AddWeight(2f);
				}
				else if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<GrabbableObject>()))
				{
					__instance.AddWeight(((Component)other).GetComponent<GrabbableObject>().itemProperties.weight - 1f);
					((Component)other).GetComponent<GrabbableObject>().SetLandmine(__instance);
				}
			}
		}

		[HarmonyPatch("OnTriggerExit")]
		[HarmonyPrefix]
		private static bool LandmineOnTriggerExit_Prefix(Landmine __instance, Collider other)
		{
			if (((Component)other).CompareTag("Player") || ((Component)other).CompareTag("PlayerRagdoll") || ((Component)other).CompareTag("PhysicsProp"))
			{
				if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<PlayerControllerB>()) || Object.op_Implicit((Object)(object)((Component)other).GetComponent<DeadBodyInfo>()))
				{
					__instance.RemWeight(2f);
				}
				else if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<PhysicsProp>()))
				{
					__instance.RemWeight(((GrabbableObject)((Component)other).GetComponent<PhysicsProp>()).itemProperties.weight - 1f);
				}
			}
			if (ConfigManager.Instance.FindItemValue<bool>("PreventMineToExplodeWithItems") && __instance.GetWeight() >= ConfigManager.Instance.FindItemValue<float>("MineActivationWeight"))
			{
				return false;
			}
			return true;
		}
	}
	public static class Landmine_Extender
	{
		private class LandmineExtention
		{
			public float Weight { get; set; }
		}

		private static readonly ConditionalWeakTable<Landmine, LandmineExtention> extention = new ConditionalWeakTable<Landmine, LandmineExtention>();

		public static void SetWeight(this Landmine landmine, float value)
		{
			if (!extention.TryGetValue(landmine, out var value2))
			{
				value2 = new LandmineExtention();
				extention.Add(landmine, value2);
			}
			value2.Weight = value;
		}

		public static void AddWeight(this Landmine landmine, float value)
		{
			if (!extention.TryGetValue(landmine, out var value2))
			{
				value2 = new LandmineExtention();
				extention.Add(landmine, value2);
			}
			value2.Weight += value;
			value2.Weight = (float)Math.Round(value2.Weight, 2);
		}

		public static void RemWeight(this Landmine landmine, float value)
		{
			if (!extention.TryGetValue(landmine, out var value2))
			{
				value2 = new LandmineExtention();
				extention.Add(landmine, value2);
			}
			value2.Weight -= value;
			value2.Weight = (float)Math.Round(value2.Weight, 2);
		}

		public static float GetWeight(this Landmine landmine)
		{
			if (extention.TryGetValue(landmine, out var value))
			{
				value.Weight = (float)Math.Round(value.Weight, 2);
				return value.Weight;
			}
			return 0f;
		}

		public static void ItemHeld(this Landmine __instance, GrabbableObject other)
		{
			LethalExpansion.Log.LogInfo((object)"Item removed from mine.");
			if (((Component)other).CompareTag("PhysicsProp") && Object.op_Implicit((Object)(object)((Component)other).GetComponent<GrabbableObject>()))
			{
				__instance.RemWeight(other.itemProperties.weight - 1f);
			}
			if (ConfigManager.Instance.FindItemValue<bool>("PreventMineToExplodeWithItems") && __instance.GetWeight() < ConfigManager.Instance.FindItemValue<float>("MineActivationWeight"))
			{
				__instance.SetOffMineAnimation();
				FieldInfo fieldInfo = AccessTools.Field(typeof(Landmine), "sendingExplosionRPC");
				Console.WriteLine(fieldInfo.GetValue(__instance));
				fieldInfo.SetValue(__instance, true);
				Console.WriteLine(fieldInfo.GetValue(__instance));
				__instance.ExplodeMineServerRpc();
			}
		}
	}
	[HarmonyPatch(typeof(MenuManager))]
	internal class MenuManager_Patch
	{
		[HarmonyPatch("StartHosting")]
		[HarmonyPostfix]
		public static void StartHosting_Postfix(MenuManager __instance)
		{
			LethalExpansion.ishost = true;
			LethalExpansion.sessionWaiting = false;
			LethalExpansion.Log.LogInfo((object)"LethalExpansion Host Started.");
		}

		[HarmonyPatch("StartAClient")]
		[HarmonyPostfix]
		public static void StartAClient_Postfix(MenuManager __instance)
		{
			LethalExpansion.ishost = false;
			LethalExpansion.sessionWaiting = false;
			LethalExpansion.Log.LogInfo((object)"LethalExpansion LAN Client Started.");
		}
	}
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class GrabbableObject_Patch
	{
		[HarmonyPatch("GrabItem")]
		[HarmonyPrefix]
		public static void GrabItem_Postfix(GrabbableObject __instance)
		{
			if (__instance.GetIsOnLandmine())
			{
				__instance.GetLandmine().ItemHeld(__instance);
			}
			LethalExpansion.Log.LogInfo((object)"Item Grabbed.");
		}
	}
	public static class GrabbableObject_Extender
	{
		private class GrabbableObjectExtention
		{
			public bool onLandmine { get; set; } = false;


			public Landmine landmine { get; set; } = null;

		}

		private static readonly ConditionalWeakTable<GrabbableObject, GrabbableObjectExtention> extention = new ConditionalWeakTable<GrabbableObject, GrabbableObjectExtention>();

		public static void SetLandmine(this GrabbableObject grabbableobject, Landmine value)
		{
			if (!extention.TryGetValue(grabbableobject, out var value2))
			{
				value2 = new GrabbableObjectExtention();
				extention.Add(grabbableobject, value2);
			}
			if ((Object)(object)value == (Object)null)
			{
				value2.onLandmine = false;
			}
			else
			{
				value2.onLandmine = true;
			}
			value2.landmine = value;
		}

		public static Landmine GetLandmine(this GrabbableObject grabbableobject)
		{
			if (extention.TryGetValue(grabbableobject, out var value))
			{
				return value.landmine;
			}
			return null;
		}

		public static bool GetIsOnLandmine(this GrabbableObject grabbableobject)
		{
			if (extention.TryGetValue(grabbableobject, out var value))
			{
				return value.onLandmine;
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManager_Patch
	{
		[HarmonyPatch("DespawnPropsAtEndOfRound")]
		[HarmonyPrefix]
		public static bool DespawnPropsAtEndOfRound_Prefix(RoundManager __instance, bool despawnAllItems)
		{
			LethalExpansion.Log.LogInfo((object)"Despawn all items.");
			if (ConfigManager.Instance.FindItemValue<bool>("PreventScrapWipeWhenAllPlayersDie"))
			{
				if (!((NetworkBehaviour)__instance).IsServer)
				{
					return false;
				}
				GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
				for (int i = 0; i < array.Length; i++)
				{
					if (despawnAllItems || (!array[i].isHeld && !array[i].isInShipRoom))
					{
						if (array[i].isHeld && (Object)(object)array[i].playerHeldBy != (Object)null)
						{
							array[i].playerHeldBy.DropAllHeldItems(true, false);
						}
						((Component)array[i]).gameObject.GetComponent<NetworkObject>().Despawn(true);
					}
					else
					{
						array[i].scrapPersistedThroughRounds = true;
					}
					if (__instance.spawnedSyncedObjects.Contains(((Component)array[i]).gameObject))
					{
						__instance.spawnedSyncedObjects.Remove(((Component)array[i]).gameObject);
					}
				}
				return false;
			}
			return true;
		}

		[HarmonyPatch("SpawnMapObjects")]
		[HarmonyPrefix]
		public static bool SpawnMapObjects_Prefix(RoundManager __instance)
		{
			if (__instance.currentLevel.spawnableMapObjects == null)
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch("PlotOutEnemiesForNextHour")]
		[HarmonyPrefix]
		public static bool PlotOutEnemiesForNextHour(RoundManager __instance)
		{
			if (__instance.currentLevel.enemySpawnChanceThroughoutDay == null)
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch("SpawnEnemiesOutside")]
		[HarmonyPrefix]
		public static bool SpawnEnemiesOutside(RoundManager __instance)
		{
			if (__instance.currentLevel.outsideEnemySpawnChanceThroughDay == null)
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch("SpawnDaytimeEnemiesOutside")]
		[HarmonyPrefix]
		public static bool SpawnDaytimeEnemiesOutside(RoundManager __instance)
		{
			if (__instance.currentLevel.daytimeEnemySpawnChanceThroughDay == null)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRound_Patch
	{
		[HarmonyPatch("StartGame")]
		[HarmonyPostfix]
		public static void Awake_Postfix(StartOfRound __instance)
		{
			if (((Object)__instance.currentLevel).name.StartsWith("Assets/Mods/"))
			{
				SceneManager.LoadScene(((Object)__instance.currentLevel).name, (LoadSceneMode)1);
			}
			LethalExpansion.Log.LogInfo((object)"Game started.");
		}

		[HarmonyPatch("OnPlayerConnectedClientRpc")]
		[HarmonyPostfix]
		private static void OnPlayerConnectedClientRpc_Postfix(StartOfRound __instance)
		{
			if (!LethalExpansion.ishost)
			{
				LethalExpansion.ishost = false;
				LethalExpansion.sessionWaiting = false;
				LethalExpansion.Log.LogInfo((object)"LethalExpansion Client Started.");
			}
		}

		[HarmonyPatch("SetMapScreenInfoToCurrentLevel")]
		[HarmonyPostfix]
		private static void SetMapScreenInfoToCurrentLevel_Postfix(StartOfRound __instance)
		{
			AutoScrollText component = ((Component)__instance.screenLevelDescription).GetComponent<AutoScrollText>();
			if ((Object)(object)component != (Object)null)
			{
				component.ResetScrolling();
			}
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	internal class Terminal_Patch
	{
		private static int[] defaultMoonRoutePrices;

		private static TerminalKeyword[] defaultTerminalKeywords;

		public static bool scrapsPatched = false;

		public static bool moonsPatched = false;

		public static Dictionary<int, Moon> newMoons = new Dictionary<int, Moon>();

		public static void MainPatch(Terminal __instance)
		{
			scrapsPatched = false;
			moonsPatched = false;
			Hotfix_DoubleRoutes(__instance);
			GatherAssets(__instance);
			AddScraps(__instance);
			ResetTerminalKeywords(__instance);
			AddMoons(__instance);
			UpdateMoonsCatalogue(__instance);
			ResetMoonsRoutePrices(__instance);
			UpdateMoonsRoutePrices(__instance);
			LethalExpansion.Log.LogInfo((object)"Terminal Main Patch.");
		}

		private static void GatherAssets(Terminal __instance)
		{
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			foreach (Item items in StartOfRound.Instance.allItemsList.itemsList)
			{
				AssetGather.Instance.AddAudioClip(items.grabSFX);
				AssetGather.Instance.AddAudioClip(items.dropSFX);
				AssetGather.Instance.AddAudioClip(items.pocketSFX);
				AssetGather.Instance.AddAudioClip(items.throwSFX);
			}
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			foreach (SelectableLevel val in levels)
			{
				AssetGather.Instance.AddPlanetPrefabs(val.planetPrefab);
				val.spawnableMapObjects.ToList().ForEach(delegate(SpawnableMapObject e)
				{
					AssetGather.Instance.AddMapObjects(e.prefabToSpawn);
				});
				val.spawnableOutsideObjects.ToList().ForEach(delegate(SpawnableOutsideObjectWithRarity e)
				{
					AssetGather.Instance.AddOutsideObject(e.spawnableObject);
				});
				val.spawnableScrap.ForEach(delegate(SpawnableItemWithRarity e)
				{
					AssetGather.Instance.AddScrap(e.spawnableItem);
				});
				AssetGather.Instance.AddLevelAmbiances(val.levelAmbienceClips);
				val.Enemies.ForEach(delegate(SpawnableEnemyWithRarity e)
				{
					AssetGather.Instance.AddEnemies(e.enemyType);
				});
				val.OutsideEnemies.ForEach(delegate(SpawnableEnemyWithRarity e)
				{
					AssetGather.Instance.AddEnemies(e.enemyType);
				});
				val.DaytimeEnemies.ForEach(delegate(SpawnableEnemyWithRarity e)
				{
					AssetGather.Instance.AddEnemies(e.enemyType);
				});
			}
			foreach (KeyValuePair<string, (AssetBundle, ModManifest)> assetBundle in AssetBundlesManager.Instance.assetBundles)
			{
				(AssetBundle, ModManifest) tuple = AssetBundlesManager.Instance.Load(assetBundle.Key);
				if ((Object)(object)tuple.Item2.assetBank != (Object)null)
				{
					PlanetPrefabInfoPair[] array = tuple.Item2.assetBank.PlanetPrefabs();
					foreach (PlanetPrefabInfoPair val2 in array)
					{
						GameObject val3 = assetBundle.Value.Item1.LoadAsset<GameObject>(val2.PlanetPrefabPath);
						Animator val4 = val3.AddComponent<Animator>();
						val4 = AssetGather.Instance.planetPrefabs.First().Value.GetComponent<Animator>();
						AssetGather.Instance.AddPlanetPrefabs(val3);
					}
				}
			}
		}

		public static void AddScraps(Terminal __instance)
		{
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Expected O, but got Unknown
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Expected O, but got Unknown
			if (!ConfigManager.Instance.FindItemValue<bool>("LoadModules") || scrapsPatched)
			{
				return;
			}
			AudioClip val = AssetGather.Instance.audioClips["DropCan"];
			AudioClip val2 = AssetGather.Instance.audioClips["ShovelPickUp"];
			foreach (KeyValuePair<string, (AssetBundle, ModManifest)> assetBundle in AssetBundlesManager.Instance.assetBundles)
			{
				(AssetBundle, ModManifest) tuple = AssetBundlesManager.Instance.Load(assetBundle.Key);
				Scrap[] scraps = tuple.Item2.scraps;
				foreach (Scrap val3 in scraps)
				{
					if ((Object)(object)val3 == (Object)null || (Object)(object)val3.prefab == (Object)null)
					{
						break;
					}
					Item itemProperties = ((GrabbableObject)val3.prefab.GetComponent<PhysicsProp>()).itemProperties;
					AudioSource component = val3.prefab.GetComponent<AudioSource>();
					component.outputAudioMixerGroup = AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master");
					AudioClip val4 = null;
					if (val3.grabSFX.Length > 0)
					{
						val4 = ((!((Object)(object)assetBundle.Value.Item2.assetBank != (Object)null)) ? AssetGather.Instance.audioClips[val3.grabSFX] : ((!assetBundle.Value.Item2.assetBank.HaveAudioClip(val3.grabSFX)) ? AssetGather.Instance.audioClips[val3.grabSFX] : tuple.Item1.LoadAsset<AudioClip>(assetBundle.Value.Item2.assetBank.AudioClipPath(val3.grabSFX))));
					}
					itemProperties.grabSFX = (((Object)(object)val4 != (Object)null) ? val4 : val2);
					AudioClip val5 = null;
					if (val3.dropSFX.Length > 0)
					{
						val5 = ((!((Object)(object)assetBundle.Value.Item2.assetBank != (Object)null)) ? AssetGather.Instance.audioClips[val3.dropSFX] : ((!assetBundle.Value.Item2.assetBank.HaveAudioClip(val3.dropSFX)) ? AssetGather.Instance.audioClips[val3.dropSFX] : tuple.Item1.LoadAsset<AudioClip>(assetBundle.Value.Item2.assetBank.AudioClipPath(val3.dropSFX))));
					}
					itemProperties.dropSFX = (((Object)(object)val5 != (Object)null) ? val5 : val);
					StartOfRound.Instance.allItemsList.itemsList.Add(itemProperties);
					if (val3.useGlobalSpawnRate)
					{
						SpawnableItemWithRarity val6 = new SpawnableItemWithRarity();
						val6.spawnableItem = itemProperties;
						val6.rarity = val3.globalSpawnWeight;
						SelectableLevel[] moonsCatalogueList = __instance.moonsCatalogueList;
						foreach (SelectableLevel val7 in moonsCatalogueList)
						{
							val7.spawnableScrap.Add(val6);
						}
					}
					else
					{
						ScrapSpawnChancePerScene[] source = val3.perPlanetSpawnWeight();
						SelectableLevel[] moonsCatalogueList2 = __instance.moonsCatalogueList;
						foreach (SelectableLevel level in moonsCatalogueList2)
						{
							try
							{
								if (source.Any((ScrapSpawnChancePerScene l) => l.SceneName == level.PlanetName))
								{
									ScrapSpawnChancePerScene val8 = source.First((ScrapSpawnChancePerScene l) => l.SceneName == level.PlanetName);
									SpawnableItemWithRarity val9 = new SpawnableItemWithRarity();
									val9.spawnableItem = itemProperties;
									val9.rarity = val8.SpawnWeight;
									level.spawnableScrap.Add(val9);
								}
							}
							catch (Exc

plugins/LethalExpansion/LethalSDK.dll

Decompiled a year ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using DunGen;
using DunGen.Adapters;
using GameNetcodeStuff;
using LethalSDK.ScriptableObjects;
using LethalSDK.Utils;
using UnityEditor;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
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: AssemblyTitle("LethalSDK")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalSDK")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4d234a4d-c807-438a-b717-4c6d77706054")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
public class AssetModificationProcessor : AssetPostprocessor
{
	private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
	{
		foreach (string assetPath in importedAssets)
		{
			ProcessAsset(assetPath);
		}
		foreach (string assetPath2 in movedAssets)
		{
			ProcessAsset(assetPath2);
		}
	}

	private static void ProcessAsset(string assetPath)
	{
		if (assetPath.Contains("NavMesh-Environment"))
		{
			AssetDatabase.RenameAsset(assetPath, (SelectionLogger.name != string.Empty) ? SelectionLogger.name : "New NavMesh");
		}
		if (assetPath.Contains("New Terrain"))
		{
			AssetDatabase.RenameAsset(assetPath, (SelectionLogger.name != string.Empty) ? SelectionLogger.name : "New Terrain");
		}
		if (assetPath.ToLower().StartsWith("assets/mods/") && assetPath.Split(new char[1] { '/' }).Length > 3 && !assetPath.ToLower().EndsWith(".unity") && !assetPath.ToLower().Contains("/scenes"))
		{
			AssetImporter atPath = AssetImporter.GetAtPath(assetPath);
			if ((Object)(object)atPath != (Object)null)
			{
				string text2 = (atPath.assetBundleName = ExtractBundleNameFromPath(assetPath));
				atPath.assetBundleVariant = "lem";
				Debug.Log((object)(assetPath + " asset moved to " + text2 + " asset bundle."));
			}
		}
		else
		{
			AssetImporter atPath2 = AssetImporter.GetAtPath(assetPath);
			if ((Object)(object)atPath2 != (Object)null)
			{
				atPath2.assetBundleName = null;
				Debug.Log((object)(assetPath + " asset removed from asset bundle."));
			}
		}
	}

	private static string ExtractBundleNameFromPath(string path)
	{
		string[] array = path.Split(new char[1] { '/' });
		if (array.Length > 3)
		{
			return array[2].ToLower();
		}
		return "";
	}
}
[InitializeOnLoad]
public class SelectionLogger
{
	public static string name;

	static SelectionLogger()
	{
		Selection.selectionChanged = (Action)Delegate.Combine(Selection.selectionChanged, new Action(OnSelectionChanged));
	}

	private static void OnSelectionChanged()
	{
		if ((Object)(object)Selection.activeGameObject != (Object)null)
		{
			name = ((Object)GetRootParent(Selection.activeGameObject)).name;
		}
		else
		{
			name = string.Empty;
		}
	}

	public static GameObject GetRootParent(GameObject obj)
	{
		if ((Object)(object)obj != (Object)null && (Object)(object)obj.transform.parent != (Object)null)
		{
			return GetRootParent(((Component)obj.transform.parent).gameObject);
		}
		return obj;
	}
}
[InitializeOnLoad]
public class AssetBundleVariantAssigner
{
	static AssetBundleVariantAssigner()
	{
		AssignVariantToAssetBundles();
	}

	[InitializeOnLoadMethod]
	private static void AssignVariantToAssetBundles()
	{
		string[] allAssetBundleNames = AssetDatabase.GetAllAssetBundleNames();
		string[] array = allAssetBundleNames;
		foreach (string text in array)
		{
			if (!text.Contains("."))
			{
				string[] assetPathsFromAssetBundle = AssetDatabase.GetAssetPathsFromAssetBundle(text);
				string[] array2 = assetPathsFromAssetBundle;
				foreach (string text2 in array2)
				{
					AssetImporter.GetAtPath(text2).SetAssetBundleNameAndVariant(text, "lem");
				}
				Debug.Log((object)("File extention added to AssetBundle: " + text));
			}
		}
		AssetDatabase.SaveAssets();
		string text3 = "Assets/AssetBundles";
		if (!Directory.Exists(text3))
		{
			Debug.LogError((object)("Le dossier n'existe pas : " + text3));
			return;
		}
		string[] files = Directory.GetFiles(text3);
		string[] array3 = files;
		foreach (string text4 in array3)
		{
			if (Path.GetExtension(text4) == "" && Path.GetFileName(text4) != "AssetBundles")
			{
				string path = text4 + ".meta";
				string text5 = text4 + ".manifest";
				string path2 = text5 + ".meta";
				File.Delete(text4);
				if (File.Exists(path))
				{
					File.Delete(path);
				}
				if (File.Exists(text5))
				{
					File.Delete(text5);
				}
				if (File.Exists(path2))
				{
					File.Delete(path2);
				}
				Debug.Log((object)("Fichier supprimé : " + text4));
			}
		}
		AssetDatabase.Refresh();
	}
}
public class CubemapTextureBuilder : EditorWindow
{
	private Texture2D[] textures = (Texture2D[])(object)new Texture2D[6];

	private string[] labels = new string[6] { "Right", "Left", "Top", "Bottom", "Front", "Back" };

	private TextureFormat[] HDRFormats;

	private Vector2Int[] placementRects;

	[MenuItem("LethalSDK/Cubemap Builder")]
	public static void OpenWindow()
	{
		EditorWindow.GetWindow<CubemapTextureBuilder>();
	}

	private Texture2D UpscaleTexture(Texture2D original, int targetWidth, int targetHeight)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		RenderTexture val = (RenderTexture.active = RenderTexture.GetTemporary(targetWidth, targetHeight));
		Graphics.Blit((Texture)(object)original, val);
		Texture2D val2 = new Texture2D(targetWidth, targetHeight);
		val2.ReadPixels(new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), 0, 0);
		val2.Apply();
		RenderTexture.ReleaseTemporary(val);
		return val2;
	}

	private void OnGUI()
	{
		//IL_024f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0256: Expected O, but got Unknown
		for (int i = 0; i < 6; i++)
		{
			ref Texture2D reference = ref textures[i];
			Object obj = EditorGUILayout.ObjectField(labels[i], (Object)(object)textures[i], typeof(Texture2D), false, Array.Empty<GUILayoutOption>());
			reference = (Texture2D)(object)((obj is Texture2D) ? obj : null);
		}
		if (!GUILayout.Button("Build Cubemap", Array.Empty<GUILayoutOption>()))
		{
			return;
		}
		if (textures.Any((Texture2D t) => (Object)(object)t == (Object)null))
		{
			EditorUtility.DisplayDialog("Cubemap Builder Error", "One or more texture is missing.", "Ok");
			return;
		}
		int size = ((Texture)textures[0]).width;
		if (textures.Any((Texture2D t) => ((Texture)t).width != size || ((Texture)t).height != size))
		{
			EditorUtility.DisplayDialog("Cubemap Builder Error", "All the textures need to be the same size and square.", "Ok");
			return;
		}
		bool flag = HDRFormats.Any((TextureFormat f) => f == textures[0].format);
		string[] array = textures.Select((Texture2D t) => AssetDatabase.GetAssetPath((Object)(object)t)).ToArray();
		string text = EditorUtility.SaveFilePanel("Save Cubemap", Path.GetDirectoryName(array[0]), "Cubemap", flag ? "exr" : "png");
		if (!string.IsNullOrEmpty(text))
		{
			bool[] array2 = textures.Select((Texture2D t) => ((Texture)t).isReadable).ToArray();
			TextureImporter[] array3 = array.Select(delegate(string p)
			{
				AssetImporter atPath2 = AssetImporter.GetAtPath(p);
				return (TextureImporter)(object)((atPath2 is TextureImporter) ? atPath2 : null);
			}).ToArray();
			TextureImporter[] array4 = array3;
			foreach (TextureImporter val in array4)
			{
				val.isReadable = true;
			}
			AssetDatabase.Refresh();
			string[] array5 = array;
			foreach (string text2 in array5)
			{
				AssetDatabase.ImportAsset(text2);
			}
			Texture2D val2 = new Texture2D(size * 4, size * 3, (TextureFormat)(flag ? 20 : 4), false);
			for (int l = 0; l < 6; l++)
			{
				val2.SetPixels(((Vector2Int)(ref placementRects[l])).x * size, ((Vector2Int)(ref placementRects[l])).y * size, size, size, textures[l].GetPixels(0));
			}
			val2.Apply(false);
			byte[] bytes = (flag ? ImageConversion.EncodeToEXR(val2) : ImageConversion.EncodeToPNG(val2));
			File.WriteAllBytes(text, bytes);
			Object.DestroyImmediate((Object)(object)val2);
			for (int m = 0; m < 6; m++)
			{
				array3[m].isReadable = array2[m];
			}
			text = text.Remove(0, Application.dataPath.Length - 6);
			AssetDatabase.ImportAsset(text);
			AssetImporter atPath = AssetImporter.GetAtPath(text);
			TextureImporter val3 = (TextureImporter)(object)((atPath is TextureImporter) ? atPath : null);
			val3.textureShape = (TextureImporterShape)2;
			val3.sRGBTexture = false;
			val3.generateCubemap = (TextureImporterGenerateCubemap)5;
			string[] array6 = array;
			foreach (string text3 in array6)
			{
				AssetDatabase.ImportAsset(text3);
			}
			AssetDatabase.ImportAsset(text);
			AssetDatabase.Refresh();
		}
	}

	public CubemapTextureBuilder()
	{
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//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_0087: 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)
		//IL_0095: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: 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)
		TextureFormat[] array = new TextureFormat[9];
		RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
		HDRFormats = (TextureFormat[])(object)array;
		placementRects = (Vector2Int[])(object)new Vector2Int[6]
		{
			new Vector2Int(2, 1),
			new Vector2Int(0, 1),
			new Vector2Int(1, 2),
			new Vector2Int(1, 0),
			new Vector2Int(1, 1),
			new Vector2Int(3, 1)
		};
		((EditorWindow)this)..ctor();
	}
}
public class LockPosition : MonoBehaviour
{
	public Vector3 initialPosition;

	private void Awake()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		initialPosition = ((Component)this).transform.position;
	}

	private void Start()
	{
		Object.Destroy((Object)(object)this);
	}
}
[CustomEditor(typeof(LockPosition))]
public class LockPositionEditor : Editor
{
	public override void OnInspectorGUI()
	{
		//IL_001a: 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)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		((Editor)this).OnInspectorGUI();
		LockPosition lockPosition = (LockPosition)(object)((Editor)this).target;
		if (((Component)lockPosition).transform.position != lockPosition.initialPosition)
		{
			((Component)lockPosition).transform.position = lockPosition.initialPosition;
		}
	}
}
public class TerrainToMeshEditor : EditorWindow
{
	private Terrain terrain;

	private string meshName = "ExportedTerrainMesh";

	[MenuItem("Tools/Terrain to Mesh")]
	public static void ShowWindow()
	{
		EditorWindow.GetWindow<TerrainToMeshEditor>(false, "Terrain to Mesh");
	}

	private void OnGUI()
	{
		GUILayout.Label("Convert Terrain to Mesh", EditorStyles.boldLabel, Array.Empty<GUILayoutOption>());
		ref Terrain reference = ref terrain;
		Object obj = EditorGUILayout.ObjectField("Terrain", (Object)(object)terrain, typeof(Terrain), true, Array.Empty<GUILayoutOption>());
		reference = (Terrain)(object)((obj is Terrain) ? obj : null);
		meshName = EditorGUILayout.TextField("Mesh Name", meshName, Array.Empty<GUILayoutOption>());
		if (GUILayout.Button("Convert", Array.Empty<GUILayoutOption>()))
		{
			if ((Object)(object)terrain != (Object)null)
			{
				ConvertTerrainToMesh(terrain, meshName);
			}
			else
			{
				EditorUtility.DisplayDialog("Terrain to Mesh", "No terrain selected", "OK");
			}
		}
	}

	private void ConvertTerrainToMesh(Terrain terrain, string name)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: 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_0161: Expected O, but got Unknown
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: 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_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: 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_00be: Unknown result type (might be due to invalid IL or missing references)
		TerrainData terrainData = terrain.terrainData;
		Vector3 size = terrainData.size;
		int heightmapResolution = terrainData.heightmapResolution;
		int heightmapResolution2 = terrainData.heightmapResolution;
		Vector3[] array = (Vector3[])(object)new Vector3[heightmapResolution * heightmapResolution2];
		Vector2[] array2 = (Vector2[])(object)new Vector2[heightmapResolution * heightmapResolution2];
		int[] array3 = new int[(heightmapResolution - 1) * (heightmapResolution2 - 1) * 6];
		float[,] heights = terrainData.GetHeights(0, 0, heightmapResolution, heightmapResolution2);
		int num = 0;
		for (int i = 0; i < heightmapResolution2; i++)
		{
			for (int j = 0; j < heightmapResolution; j++)
			{
				int num2 = i * heightmapResolution + j;
				float num3 = heights[i, j];
				array[num2] = new Vector3((float)j / (float)heightmapResolution * size.x, num3 * size.y, (float)i / (float)heightmapResolution2 * size.z);
				array2[num2] = new Vector2((float)j / (float)heightmapResolution, (float)i / (float)heightmapResolution2);
				if (j < heightmapResolution - 1 && i < heightmapResolution2 - 1)
				{
					array3[num++] = num2;
					array3[num++] = num2 + heightmapResolution;
					array3[num++] = num2 + heightmapResolution + 1;
					array3[num++] = num2;
					array3[num++] = num2 + heightmapResolution + 1;
					array3[num++] = num2 + 1;
				}
			}
		}
		Mesh val = new Mesh();
		val.vertices = array;
		val.uv = array2;
		val.triangles = array3;
		val.RecalculateNormals();
		SaveMeshAsAsset(val, name);
	}

	private void SaveMeshAsAsset(Mesh mesh, string name)
	{
		string text = EditorUtility.SaveFilePanelInProject("Save Mesh", name, "asset", "Save mesh as");
		if (text.Length > 0)
		{
			AssetDatabase.CreateAsset((Object)(object)mesh, text);
			AssetDatabase.SaveAssets();
			EditorUtility.DisplayDialog("Terrain to Mesh", "Mesh saved: " + text, "OK");
		}
	}
}
namespace LethalSDK.ScriptableObjects
{
	[CreateAssetMenu(fileName = "AssetBank", menuName = "LethalSDK/Asset Bank")]
	public class AssetBank : ScriptableObject
	{
		[Header("Audio Clips")]
		[SerializeField]
		private AudioClipInfoPair[] _audioClips = new AudioClipInfoPair[0];

		[SerializeField]
		private PlanetPrefabInfoPair[] _planetPrefabs = new PlanetPrefabInfoPair[0];

		[HideInInspector]
		public string serializedAudioClips;

		[HideInInspector]
		public string serializedPlanetPrefabs;

		private void OnValidate()
		{
			serializedAudioClips = string.Join(";", _audioClips.Select((AudioClipInfoPair p) => ((p.AudioClipName.Length != 0) ? p.AudioClipName : (((Object)(object)p.AudioClip != (Object)null) ? ((Object)p.AudioClip).name : "")) + "," + AssetDatabase.GetAssetPath((Object)(object)p.AudioClip)));
			serializedPlanetPrefabs = string.Join(";", _planetPrefabs.Select((PlanetPrefabInfoPair p) => ((p.PlanetPrefabName.Length != 0) ? p.PlanetPrefabName : (((Object)(object)p.PlanetPrefab != (Object)null) ? ((Object)p.PlanetPrefab).name : "")) + "," + AssetDatabase.GetAssetPath((Object)(object)p.PlanetPrefab)));
		}

		public AudioClipInfoPair[] AudioClips()
		{
			return (from s in serializedAudioClips.Split(new char[1] { ';' })
				select s.Split(new char[1] { ',' }) into split
				where split.Length == 2
				select new AudioClipInfoPair(split[0], split[1])).ToArray();
		}

		public bool HaveAudioClip(string audioClipName)
		{
			return AudioClips().Any((AudioClipInfoPair a) => a.AudioClipName == audioClipName);
		}

		public string AudioClipPath(string audioClipName)
		{
			return AudioClips().First((AudioClipInfoPair c) => c.AudioClipName == audioClipName).AudioClipPath;
		}

		public Dictionary<string, string> AudioClipsDictionary()
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			AudioClipInfoPair[] audioClips = _audioClips;
			for (int i = 0; i < audioClips.Length; i++)
			{
				AudioClipInfoPair audioClipInfoPair = audioClips[i];
				dictionary.Add(audioClipInfoPair.AudioClipName, audioClipInfoPair.AudioClipPath);
			}
			return dictionary;
		}

		public PlanetPrefabInfoPair[] PlanetPrefabs()
		{
			return (from s in serializedPlanetPrefabs.Split(new char[1] { ';' })
				select s.Split(new char[1] { ',' }) into split
				where split.Length == 2
				select new PlanetPrefabInfoPair(split[0], split[1])).ToArray();
		}

		public bool HavePlanetPrefabs(string planetPrefabName)
		{
			return PlanetPrefabs().Any((PlanetPrefabInfoPair a) => a.PlanetPrefabName == planetPrefabName);
		}

		public string PlanetPrefabsPath(string planetPrefabName)
		{
			return PlanetPrefabs().First((PlanetPrefabInfoPair c) => c.PlanetPrefabName == planetPrefabName).PlanetPrefabPath;
		}

		public Dictionary<string, string> PlanetPrefabsDictionary()
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			PlanetPrefabInfoPair[] planetPrefabs = _planetPrefabs;
			for (int i = 0; i < planetPrefabs.Length; i++)
			{
				PlanetPrefabInfoPair planetPrefabInfoPair = planetPrefabs[i];
				dictionary.Add(planetPrefabInfoPair.PlanetPrefabName, planetPrefabInfoPair.PlanetPrefabPath);
			}
			return dictionary;
		}
	}
	[CreateAssetMenu(fileName = "ModManifest", menuName = "LethalSDK/Mod Manifest")]
	public class ModManifest : ScriptableObject
	{
		public string modName = "New Mod";

		[Space]
		public SerializableVersion version = new SerializableVersion(0, 0, 0, 0);

		[Space]
		public string author = "Author";

		[Space]
		[TextArea]
		public string description = "Mod Description";

		[Space]
		[Header("Content")]
		public Scrap[] scraps = new Scrap[0];

		public Moon[] moons = new Moon[0];

		[Space]
		public AssetBank assetBank;
	}
	[CreateAssetMenu(fileName = "New Moon", menuName = "LethalSDK/Moon")]
	public class Moon : ScriptableObject
	{
		public string MoonName = "NewMoon";

		public string[] RequiredBundles;

		public bool IsHidden = false;

		public bool IsLocked = false;

		[Header("Info")]
		public string OrbitPrefabName = "Moon1";

		public bool SpawnEnemiesAndScrap = true;

		public string PlanetName = "New Moon";

		public GameObject MainPrefab;

		[TextArea(5, 15)]
		public string PlanetDescription;

		public VideoClip PlanetVideo;

		public string RiskLevel = "X";

		public float TimeToArrive = 1f;

		[Header("Time")]
		public float DaySpeedMultiplier = 1f;

		public bool PlanetHasTime = true;

		[SerializeField]
		private RandomWeatherPair[] _RandomWeatherTypes = new RandomWeatherPair[6]
		{
			new RandomWeatherPair(LevelWeatherType.Rainy, 0, 0),
			new RandomWeatherPair(LevelWeatherType.Rainy, 0, 0),
			new RandomWeatherPair(LevelWeatherType.Stormy, 1, 0),
			new RandomWeatherPair(LevelWeatherType.Foggy, 1, 0),
			new RandomWeatherPair(LevelWeatherType.Flooded, -4, 5),
			new RandomWeatherPair(LevelWeatherType.Eclipsed, 1, 0)
		};

		public bool OverwriteWeather = false;

		public LevelWeatherType OverwriteWeatherType = LevelWeatherType.None;

		[Header("Route")]
		public string RouteWord = "newmoon";

		public int RoutePrice;

		public string BoughtComment = "Please enjoy your flight.";

		[Header("Dungeon")]
		public float FactorySizeMultiplier = 1f;

		[SerializeField]
		private DungeonFlowPair[] _DungeonFlowTypes = new DungeonFlowPair[2]
		{
			new DungeonFlowPair(0, 300),
			new DungeonFlowPair(1, 1)
		};

		[SerializeField]
		private SpawnableScrapPair[] _SpawnableScrap = new SpawnableScrapPair[19]
		{
			new SpawnableScrapPair("Cog1", 80),
			new SpawnableScrapPair("EnginePart1", 90),
			new SpawnableScrapPair("FishTestProp", 12),
			new SpawnableScrapPair("MetalSheet", 88),
			new SpawnableScrapPair("FlashLaserPointer", 4),
			new SpawnableScrapPair("BigBolt", 80),
			new SpawnableScrapPair("BottleBin", 19),
			new SpawnableScrapPair("Ring", 3),
			new SpawnableScrapPair("SteeringWheel", 32),
			new SpawnableScrapPair("MoldPan", 5),
			new SpawnableScrapPair("EggBeater", 10),
			new SpawnableScrapPair("PickleJar", 10),
			new SpawnableScrapPair("DustPan", 32),
			new SpawnableScrapPair("Airhorn", 3),
			new SpawnableScrapPair("ClownHorn", 3),
			new SpawnableScrapPair("CashRegister", 3),
			new SpawnableScrapPair("Candy", 2),
			new SpawnableScrapPair("GoldBar", 1),
			new SpawnableScrapPair("YieldSign", 6)
		};

		public int MinScrap = 8;

		public int MaxScrap = 12;

		public string LevelAmbienceClips = "Level1TypeAmbience";

		public int MaxEnemyPowerCount = 4;

		[SerializeField]
		private SpawnableEnemiesPair[] _Enemies = new SpawnableEnemiesPair[8]
		{
			new SpawnableEnemiesPair("Centipede", 51),
			new SpawnableEnemiesPair("SandSpider", 58),
			new SpawnableEnemiesPair("HoarderBug", 28),
			new SpawnableEnemiesPair("Flowerman", 13),
			new SpawnableEnemiesPair("Crawler", 16),
			new SpawnableEnemiesPair("Blob", 31),
			new SpawnableEnemiesPair("DressGirl", 1),
			new SpawnableEnemiesPair("Puffer", 28)
		};

		public AnimationCurve EnemySpawnChanceThroughoutDay = CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0015411376953125,\"value\":-3.0,\"inSlope\":19.556997299194337,\"outSlope\":19.556997299194337,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0,\"outWeight\":0.12297855317592621},{\"serializedVersion\":\"3\",\"time\":0.4575331211090088,\"value\":4.796203136444092,\"inSlope\":24.479534149169923,\"outSlope\":24.479534149169923,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.396077424287796,\"outWeight\":0.35472238063812258},{\"serializedVersion\":\"3\",\"time\":0.7593884468078613,\"value\":4.973001480102539,\"inSlope\":2.6163148880004885,\"outSlope\":2.6163148880004885,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.2901076376438141,\"outWeight\":0.5360636115074158},{\"serializedVersion\":\"3\",\"time\":1.0,\"value\":15.0,\"inSlope\":35.604026794433597,\"outSlope\":35.604026794433597,\"tangentMode\":0,\"weightedMode\":1,\"inWeight\":0.04912583902478218,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}");

		public float SpawnProbabilityRange = 4f;

		[Header("Outside")]
		[SerializeField]
		private SpawnableMapObjectPair[] _SpawnableMapObjects = new SpawnableMapObjectPair[2]
		{
			new SpawnableMapObjectPair("Landmine", spawnFacingAwayFromWall: false, CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":-0.003082275390625,\"value\":0.0,\"inSlope\":0.23179344832897187,\"outSlope\":0.23179344832897187,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27936428785324099},{\"serializedVersion\":\"3\",\"time\":0.8171924352645874,\"value\":1.7483322620391846,\"inSlope\":7.064207077026367,\"outSlope\":7.064207077026367,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.2631833553314209,\"outWeight\":0.6898177862167358},{\"serializedVersion\":\"3\",\"time\":1.0002186298370362,\"value\":11.760997772216797,\"inSlope\":968.80810546875,\"outSlope\":968.80810546875,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.029036391526460649,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")),
			new SpawnableMapObjectPair("TurretContainer", spawnFacingAwayFromWall: true, CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.354617178440094,\"outSlope\":0.354617178440094,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.9190289974212647,\"value\":1.0005745887756348,\"inSlope\":Infinity,\"outSlope\":1.7338485717773438,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0,\"outWeight\":0.6534967422485352},{\"serializedVersion\":\"3\",\"time\":1.0038425922393799,\"value\":7.198680877685547,\"inSlope\":529.4945068359375,\"outSlope\":529.4945068359375,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.14589552581310273,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}"))
		};

		[SerializeField]
		private SpawnableOutsideObjectPair[] _SpawnableOutsideObjects = new SpawnableOutsideObjectPair[7]
		{
			new SpawnableOutsideObjectPair("LargeRock1", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.7571572661399841,\"value\":0.6448163986206055,\"inSlope\":2.974250078201294,\"outSlope\":2.974250078201294,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.3333333432674408,\"outWeight\":0.3333333432674408},{\"serializedVersion\":\"3\",\"time\":0.9995536804199219,\"value\":5.883961200714111,\"inSlope\":65.30631256103516,\"outSlope\":65.30631256103516,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.12097536772489548,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")),
			new SpawnableOutsideObjectPair("LargeRock2", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.7562879920005798,\"value\":1.2308543920516968,\"inSlope\":5.111926555633545,\"outSlope\":5.111926555633545,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.3333333432674408,\"outWeight\":0.21955738961696626},{\"serializedVersion\":\"3\",\"time\":1.0010795593261719,\"value\":7.59307336807251,\"inSlope\":92.0470199584961,\"outSlope\":92.0470199584961,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.05033162236213684,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")),
			new SpawnableOutsideObjectPair("LargeRock3", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.9964686632156372,\"value\":2.0009398460388185,\"inSlope\":6.82940673828125,\"outSlope\":6.82940673828125,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.06891261041164398,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")),
			new SpawnableOutsideObjectPair("LargeRock4", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.9635604619979858,\"value\":2.153383493423462,\"inSlope\":6.251225471496582,\"outSlope\":6.251225471496582,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.07428120821714401,\"outWeight\":0.3333333432674408},{\"serializedVersion\":\"3\",\"time\":0.9995394349098206,\"value\":5.0,\"inSlope\":15.746581077575684,\"outSlope\":15.746581077575684,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.06317413598299027,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")),
			new SpawnableOutsideObjectPair("TreeLeafless1", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":1.6912956237792969,\"outSlope\":1.6912956237792969,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27726083993911745},{\"serializedVersion\":\"3\",\"time\":0.776531994342804,\"value\":6.162014007568359,\"inSlope\":30.075166702270509,\"outSlope\":30.075166702270509,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.15920747816562653,\"outWeight\":0.5323987007141113},{\"serializedVersion\":\"3\",\"time\":1.0002281665802003,\"value\":38.093849182128909,\"inSlope\":1448.839111328125,\"outSlope\":1448.839111328125,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0620061457157135,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")),
			new SpawnableOutsideObjectPair("SmallGreyRocks1", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":1.6912956237792969,\"outSlope\":1.6912956237792969,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27726083993911745},{\"serializedVersion\":\"3\",\"time\":0.802714467048645,\"value\":1.5478605031967164,\"inSlope\":9.096116065979004,\"outSlope\":9.096116065979004,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.15920747816562653,\"outWeight\":0.58766108751297},{\"serializedVersion\":\"3\",\"time\":1.0002281665802003,\"value\":14.584033966064454,\"inSlope\":1244.9173583984375,\"outSlope\":1244.9173583984375,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.054620321840047839,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")),
			new SpawnableOutsideObjectPair("GiantPumpkin", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":1.6912956237792969,\"outSlope\":1.6912956237792969,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27726083993911745},{\"serializedVersion\":\"3\",\"time\":0.8832725882530212,\"value\":0.5284063816070557,\"inSlope\":3.2962090969085695,\"outSlope\":29.38977813720703,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.19772815704345704,\"outWeight\":0.8989489078521729},{\"serializedVersion\":\"3\",\"time\":0.972209095954895,\"value\":6.7684478759765629,\"inSlope\":140.27394104003907,\"outSlope\":140.27394104003907,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.39466607570648196,\"outWeight\":0.47049039602279665},{\"serializedVersion\":\"3\",\"time\":1.0002281665802003,\"value\":23.0,\"inSlope\":579.3037109375,\"outSlope\":14.8782377243042,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.648808479309082,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}"))
		};

		public int MaxOutsideEnemyPowerCount = 8;

		public int MaxDaytimeEnemyPowerCount = 5;

		[SerializeField]
		private SpawnableEnemiesPair[] _OutsideEnemies = new SpawnableEnemiesPair[3]
		{
			new SpawnableEnemiesPair("MouthDog", 75),
			new SpawnableEnemiesPair("ForestGiant", 0),
			new SpawnableEnemiesPair("SandWorm", 56)
		};

		[SerializeField]
		private SpawnableEnemiesPair[] _DaytimeEnemies = new SpawnableEnemiesPair[3]
		{
			new SpawnableEnemiesPair("RedLocustBees", 22),
			new SpawnableEnemiesPair("Doublewing", 74),
			new SpawnableEnemiesPair("DocileLocustBees", 52)
		};

		public AnimationCurve OutsideEnemySpawnChanceThroughDay = CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":-7.736962288618088e-7,\"value\":-2.996999979019165,\"inSlope\":Infinity,\"outSlope\":0.5040292143821716,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0,\"outWeight\":0.08937685936689377},{\"serializedVersion\":\"3\",\"time\":0.7105481624603272,\"value\":-0.6555822491645813,\"inSlope\":9.172262191772461,\"outSlope\":9.172262191772461,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.3333333432674408,\"outWeight\":0.7196550369262695},{\"serializedVersion\":\"3\",\"time\":1.0052626132965088,\"value\":5.359400749206543,\"inSlope\":216.42247009277345,\"outSlope\":11.374387741088868,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.044637180864810947,\"outWeight\":0.48315444588661196}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}");

		public AnimationCurve DaytimeEnemySpawnChanceThroughDay = CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":2.2706568241119386,\"inSlope\":-7.500085353851318,\"outSlope\":-7.500085353851318,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.3333333432674408,\"outWeight\":0.20650266110897065},{\"serializedVersion\":\"3\",\"time\":0.38507816195487978,\"value\":-0.0064108967781066898,\"inSlope\":-2.7670974731445314,\"outSlope\":-2.7670974731445314,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.28388944268226626,\"outWeight\":0.30659767985343935},{\"serializedVersion\":\"3\",\"time\":0.6767024993896484,\"value\":-7.021658420562744,\"inSlope\":-27.286888122558595,\"outSlope\":-27.286888122558595,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.10391546785831452,\"outWeight\":0.12503522634506226},{\"serializedVersion\":\"3\",\"time\":0.9998173117637634,\"value\":-14.818100929260254,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}");

		public float DaytimeEnemiesProbabilityRange = 5f;

		public bool LevelIncludesSnowFootprints = false;

		[HideInInspector]
		public string serializedRandomWeatherTypes;

		[HideInInspector]
		public string serializedDungeonFlowTypes;

		[HideInInspector]
		public string serializedSpawnableScrap;

		[HideInInspector]
		public string serializedEnemies;

		[HideInInspector]
		public string serializedOutsideEnemies;

		[HideInInspector]
		public string serializedDaytimeEnemies;

		[HideInInspector]
		public string serializedSpawnableMapObjects;

		[HideInInspector]
		public string serializedSpawnableOutsideObjects;

		private void OnValidate()
		{
			serializedRandomWeatherTypes = string.Join(";", _RandomWeatherTypes.Select((RandomWeatherPair p) => $"{(int)p.Weather},{p.WeatherVariable1},{p.WeatherVariable2}"));
			serializedDungeonFlowTypes = string.Join(";", _DungeonFlowTypes.Select((DungeonFlowPair p) => $"{p.ID},{p.Rarity}"));
			serializedSpawnableScrap = string.Join(";", _SpawnableScrap.Select((SpawnableScrapPair p) => $"{p.ObjectName},{p.SpawnWeight}"));
			serializedEnemies = string.Join(";", _Enemies.Select((SpawnableEnemiesPair p) => $"{p.EnemyName},{p.SpawnWeight}"));
			serializedOutsideEnemies = string.Join(";", _OutsideEnemies.Select((SpawnableEnemiesPair p) => $"{p.EnemyName},{p.SpawnWeight}"));
			serializedDaytimeEnemies = string.Join(";", _DaytimeEnemies.Select((SpawnableEnemiesPair p) => $"{p.EnemyName},{p.SpawnWeight}"));
			serializedSpawnableMapObjects = string.Join(";", _SpawnableMapObjects.Select((SpawnableMapObjectPair p) => $"{p.ObjectName}|{p.SpawnFacingAwayFromWall}|{CurveContainer.SerializeCurve(p.SpawnRate)}"));
			serializedSpawnableOutsideObjects = string.Join(";", _SpawnableOutsideObjects.Select((SpawnableOutsideObjectPair p) => p.ObjectName + "|" + CurveContainer.SerializeCurve(p.SpawnRate)));
		}

		public RandomWeatherPair[] RandomWeatherTypes()
		{
			return (from s in serializedRandomWeatherTypes.Split(new char[1] { ';' })
				select s.Split(new char[1] { ',' }) into split
				where split.Length == 3
				select new RandomWeatherPair((LevelWeatherType)int.Parse(split[0]), int.Parse(split[1]), int.Parse(split[2]))).ToArray();
		}

		public DungeonFlowPair[] DungeonFlowTypes()
		{
			return (from s in serializedDungeonFlowTypes.Split(new char[1] { ';' })
				select s.Split(new char[1] { ',' }) into split
				where split.Length == 2
				select new DungeonFlowPair(int.Parse(split[0]), int.Parse(split[1]))).ToArray();
		}

		public SpawnableScrapPair[] SpawnableScrap()
		{
			return (from s in serializedSpawnableScrap.Split(new char[1] { ';' })
				select s.Split(new char[1] { ',' }) into split
				where split.Length == 2
				select new SpawnableScrapPair(split[0], int.Parse(split[1]))).ToArray();
		}

		public SpawnableEnemiesPair[] Enemies()
		{
			return (from s in serializedEnemies.Split(new char[1] { ';' })
				select s.Split(new char[1] { ',' }) into split
				where split.Length == 2
				select new SpawnableEnemiesPair(split[0], int.Parse(split[1]))).ToArray();
		}

		public SpawnableEnemiesPair[] OutsideEnemies()
		{
			return (from s in serializedOutsideEnemies.Split(new char[1] { ';' })
				select s.Split(new char[1] { ',' }) into split
				where split.Length == 2
				select new SpawnableEnemiesPair(split[0], int.Parse(split[1]))).ToArray();
		}

		public SpawnableEnemiesPair[] DaytimeEnemies()
		{
			return (from s in serializedDaytimeEnemies.Split(new char[1] { ';' })
				select s.Split(new char[1] { ',' }) into split
				where split.Length == 2
				select new SpawnableEnemiesPair(split[0], int.Parse(split[1]))).ToArray();
		}

		public SpawnableMapObjectPair[] SpawnableMapObjects()
		{
			return (from s in serializedSpawnableMapObjects.Split(new char[1] { ';' })
				select s.Split(new char[1] { '|' }) into split
				where split.Length == 3
				select new SpawnableMapObjectPair(split[0], bool.Parse(split[1]), CurveContainer.DeserializeCurve(split[2]))).ToArray();
		}

		public SpawnableOutsideObjectPair[] SpawnableOutsideObjects()
		{
			return (from s in serializedSpawnableOutsideObjects.Split(new char[1] { ';' })
				select s.Split(new char[1] { '|' }) into split
				where split.Length == 2
				select new SpawnableOutsideObjectPair(split[0], CurveContainer.DeserializeCurve(split[1]))).ToArray();
		}
	}
	[CreateAssetMenu(fileName = "New Scrap", menuName = "LethalSDK/Scrap")]
	public class Scrap : ScriptableObject
	{
		[Header("Base")]
		public string itemName = string.Empty;

		public int minValue = 0;

		public int maxValue = 0;

		public bool requiresBattery = false;

		public int weight = 0;

		public GameObject prefab;

		[Header("Sounds")]
		public string grabSFX = string.Empty;

		public string dropSFX = string.Empty;

		[Header("Offsets")]
		public float verticalOffset = 0f;

		public Vector3 restingRotation = Vector3.zero;

		public Vector3 positionOffset = Vector3.zero;

		public Vector3 rotationOffset = Vector3.zero;

		[Header("Variants")]
		public Mesh[] meshVariants = (Mesh[])(object)new Mesh[0];

		public Material[] materialVariants = (Material[])(object)new Material[0];

		[Header("Spawn rate")]
		public bool useGlobalSpawnRate = true;

		[Range(0f, 100f)]
		public int globalSpawnWeight = 0;

		[SerializeField]
		private ScrapSpawnChancePerScene[] _perPlanetSpawnWeight = new ScrapSpawnChancePerScene[8]
		{
			new ScrapSpawnChancePerScene("41 Experimentation", 0),
			new ScrapSpawnChancePerScene("220 Assurance", 0),
			new ScrapSpawnChancePerScene("56 Vow", 0),
			new ScrapSpawnChancePerScene("21 Offense", 0),
			new ScrapSpawnChancePerScene("61 March", 0),
			new ScrapSpawnChancePerScene("85 Rend", 0),
			new ScrapSpawnChancePerScene("7 Dine", 0),
			new ScrapSpawnChancePerScene("8 Titan", 0)
		};

		[HideInInspector]
		public string serializedData;

		private void OnValidate()
		{
			serializedData = string.Join(";", _perPlanetSpawnWeight.Select((ScrapSpawnChancePerScene p) => $"{p.SceneName},{p.SpawnWeight}"));
		}

		public ScrapSpawnChancePerScene[] perPlanetSpawnWeight()
		{
			return (from s in serializedData.Split(new char[1] { ';' })
				select s.Split(new char[1] { ',' }) into split
				where split.Length == 2
				select new ScrapSpawnChancePerScene(split[0], int.Parse(split[1]))).ToArray();
		}
	}
}
namespace LethalSDK.Editor
{
	internal class LethalSDKCategory : EditorWindow
	{
		[MenuItem("LethalSDK/Lethal SDK v1", false, 0)]
		public static void ShowWindow()
		{
		}
	}
	public class Lethal_AssetBundleBuilderWindow : EditorWindow
	{
		private enum compressionOption
		{
			NormalCompression,
			FastCompression,
			Uncompressed
		}

		private static string assetBundleDirectoryKey = "LethalSDK_AssetBundleBuilderWindow_assetBundleDirectory";

		private static string compressionModeKey = "LethalSDK_AssetBundleBuilderWindow_compressionMode";

		private static string _64BitsModeKey = "LethalSDK_AssetBundleBuilderWindow_64BitsMode";

		private string assetBundleDirectory = string.Empty;

		private compressionOption compressionMode = compressionOption.NormalCompression;

		private bool _64BitsMode;

		[MenuItem("LethalSDK/AssetBundle Builder")]
		public static void ShowWindow()
		{
			//IL_0017: 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)
			Lethal_AssetBundleBuilderWindow window = EditorWindow.GetWindow<Lethal_AssetBundleBuilderWindow>("AssetBundle Builder");
			((EditorWindow)window).minSize = new Vector2(295f, 133f);
			((EditorWindow)window).maxSize = new Vector2(295f, 133f);
			window.LoadPreferences();
		}

		private void OnGUI()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Expected O, but got Unknown
			GUILayout.Label("Base Settings", EditorStyles.boldLabel, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			EditorGUILayout.LabelField(new GUIContent("Output Path", "The directory where the asset bundles will be saved."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(84f) });
			assetBundleDirectory = EditorGUILayout.TextField(assetBundleDirectory, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
			GUILayout.EndHorizontal();
			EditorGUILayout.Space(5f);
			GUILayout.Label("Options", EditorStyles.boldLabel, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			EditorGUILayout.LabelField(new GUIContent("Compression Mode", "Select the compression option for the asset bundle. Faster the compression is, faster the assets will load and less CPU it will use, but the Bundle will be bigger."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(145f) });
			compressionMode = (compressionOption)(object)EditorGUILayout.EnumPopup((Enum)compressionMode, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) });
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			EditorGUILayout.LabelField(new GUIContent("64 Bits Asset Bundle (Not recommended)", "Better performances but incompatible with 32 bits computers."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(270f) });
			_64BitsMode = EditorGUILayout.Toggle(_64BitsMode, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			EditorGUILayout.Space(5f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Build AssetBundles", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) }))
			{
				BuildAssetBundles();
			}
			if (GUILayout.Button("Reset", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(45f) }))
			{
				ClearPreferences();
			}
			GUILayout.EndHorizontal();
		}

		private void ClearPreferences()
		{
			EditorPrefs.DeleteKey(assetBundleDirectoryKey);
			EditorPrefs.DeleteKey(compressionModeKey);
			EditorPrefs.DeleteKey(_64BitsModeKey);
			LoadPreferences();
		}

		private void BuildAssetBundles()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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)
			if (!Directory.Exists(assetBundleDirectory))
			{
				Directory.CreateDirectory(assetBundleDirectory);
			}
			BuildAssetBundleOptions val = (BuildAssetBundleOptions)0;
			val = (BuildAssetBundleOptions)(compressionMode switch
			{
				compressionOption.NormalCompression => 0, 
				compressionOption.FastCompression => 256, 
				compressionOption.Uncompressed => 1, 
				_ => 0, 
			});
			BuildTarget val2 = (BuildTarget)(_64BitsMode ? 19 : 5);
			try
			{
				if (assetBundleDirectory != null || assetBundleDirectory.Length != 0)
				{
					AssetBundleManifest val3 = BuildPipeline.BuildAssetBundles(assetBundleDirectory, val, val2);
					if ((Object)(object)val3 != (Object)null)
					{
						Debug.Log((object)"AssetBundles built successfully.");
					}
					else
					{
						Debug.LogError((object)"Cannot build AssetBundles.");
					}
				}
				else
				{
					Debug.LogError((object)"AssetBundles path cannot be blank.");
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)ex.Message);
			}
		}

		private void OnLostFocus()
		{
			SavePreferences();
		}

		private void OnDisable()
		{
			SavePreferences();
		}

		private void LoadPreferences()
		{
			assetBundleDirectory = EditorPrefs.GetString(assetBundleDirectoryKey, "Assets/AssetBundles");
			compressionMode = (compressionOption)EditorPrefs.GetInt(compressionModeKey, 0);
			_64BitsMode = EditorPrefs.GetBool(_64BitsModeKey, false);
		}

		private void SavePreferences()
		{
			EditorPrefs.SetString(assetBundleDirectoryKey, assetBundleDirectory);
			EditorPrefs.SetInt(compressionModeKey, (int)compressionMode);
			EditorPrefs.SetBool(_64BitsModeKey, _64BitsMode);
		}
	}
}
namespace LethalSDK.Utils
{
	[Serializable]
	public class SerializableVersion
	{
		public int Major = 1;

		public int Minor = 0;

		public int Build = 0;

		public int Revision = 0;

		public SerializableVersion(int major, int minor, int build, int revision)
		{
			Major = major;
			Minor = minor;
			Build = build;
			Revision = revision;
		}

		public Version ToVersion()
		{
			return new Version(Major, Minor, Build, Revision);
		}

		public override string ToString()
		{
			return $"{Major}.{Minor}.{Build}.{Revision}";
		}
	}
	[Serializable]
	public class CurveContainer
	{
		public AnimationCurve curve;

		public static string SerializeCurve(AnimationCurve curve)
		{
			CurveContainer curveContainer = new CurveContainer
			{
				curve = curve
			};
			return JsonUtility.ToJson((object)curveContainer);
		}

		public static AnimationCurve DeserializeCurve(string json)
		{
			CurveContainer curveContainer = JsonUtility.FromJson<CurveContainer>(json);
			return curveContainer.curve;
		}
	}
	[Serializable]
	public struct StringIntPair
	{
		public string _string;

		public int _int;

		public StringIntPair(string _string, int _int)
		{
			this._string = _string;
			this._int = Mathf.Clamp(_int, 0, 100);
		}
	}
	[Serializable]
	public struct StringStringPair
	{
		public string _string1;

		public string _string2;

		public StringStringPair(string _string1, string _string2)
		{
			this._string1 = _string1;
			this._string2 = _string2;
		}
	}
	[Serializable]
	public struct IntIntPair
	{
		public int _int1;

		public int _int2;

		public IntIntPair(int _int1, int _int2)
		{
			this._int1 = _int1;
			this._int2 = _int2;
		}
	}
	[Serializable]
	public struct DungeonFlowPair
	{
		public int ID;

		[Range(0f, 300f)]
		public int Rarity;

		public DungeonFlowPair(int id, int rarity)
		{
			ID = id;
			Rarity = Mathf.Clamp(rarity, 0, 300);
		}
	}
	[Serializable]
	public struct SpawnableScrapPair
	{
		public string ObjectName;

		[Range(0f, 100f)]
		public int SpawnWeight;

		public SpawnableScrapPair(string objectName, int spawnWeight)
		{
			ObjectName = objectName;
			SpawnWeight = Mathf.Clamp(spawnWeight, 0, 100);
		}
	}
	[Serializable]
	public struct SpawnableMapObjectPair
	{
		public string ObjectName;

		public bool SpawnFacingAwayFromWall;

		public AnimationCurve SpawnRate;

		public SpawnableMapObjectPair(string objectName, bool spawnFacingAwayFromWall, AnimationCurve spawnRate)
		{
			ObjectName = objectName;
			SpawnFacingAwayFromWall = spawnFacingAwayFromWall;
			SpawnRate = spawnRate;
		}
	}
	[Serializable]
	public struct SpawnableOutsideObjectPair
	{
		public string ObjectName;

		public AnimationCurve SpawnRate;

		public SpawnableOutsideObjectPair(string objectName, AnimationCurve spawnRate)
		{
			ObjectName = objectName;
			SpawnRate = spawnRate;
		}
	}
	[Serializable]
	public struct SpawnableEnemiesPair
	{
		public string EnemyName;

		[Range(0f, 100f)]
		public int SpawnWeight;

		public SpawnableEnemiesPair(string enemyName, int spawnWeight)
		{
			EnemyName = enemyName;
			SpawnWeight = Mathf.Clamp(spawnWeight, 0, 100);
		}
	}
	[Serializable]
	public struct ScrapSpawnChancePerScene
	{
		public string SceneName;

		[Range(0f, 100f)]
		public int SpawnWeight;

		public ScrapSpawnChancePerScene(string sceneName, int spawnWeight)
		{
			SceneName = sceneName;
			SpawnWeight = Mathf.Clamp(spawnWeight, 0, 100);
		}
	}
	[Serializable]
	public struct ScrapInfoPair
	{
		public string ScrapPath;

		public Scrap Scrap;

		public ScrapInfoPair(string scrapPath, Scrap scrap)
		{
			ScrapPath = scrapPath;
			Scrap = scrap;
		}
	}
	[Serializable]
	public struct AudioClipInfoPair
	{
		public string AudioClipName;

		[HideInInspector]
		public string AudioClipPath;

		[SerializeField]
		public AudioClip AudioClip;

		public AudioClipInfoPair(string audioClipName, string audioClipPath)
		{
			AudioClipName = audioClipName;
			AudioClipPath = audioClipPath;
			AudioClip = null;
		}
	}
	[Serializable]
	public struct PlanetPrefabInfoPair
	{
		public string PlanetPrefabName;

		[HideInInspector]
		public string PlanetPrefabPath;

		[SerializeField]
		public GameObject PlanetPrefab;

		public PlanetPrefabInfoPair(string planetPrefabName, string planetPrefabPath)
		{
			PlanetPrefabName = planetPrefabName;
			PlanetPrefabPath = planetPrefabPath;
			PlanetPrefab = null;
		}
	}
	[Serializable]
	public struct RandomWeatherPair
	{
		public LevelWeatherType Weather;

		[Tooltip("Thunder Frequency, Flooding speed or minimum initial enemies in eclipses")]
		public int WeatherVariable1;

		[Tooltip("Flooding offset when Weather is Flooded")]
		public int WeatherVariable2;

		public RandomWeatherPair(LevelWeatherType weather, int weatherVariable1, int weatherVariable2)
		{
			Weather = weather;
			WeatherVariable1 = weatherVariable1;
			WeatherVariable2 = weatherVariable2;
		}
	}
	public enum LevelWeatherType
	{
		None = -1,
		DustClouds,
		Rainy,
		Stormy,
		Foggy,
		Flooded,
		Eclipsed
	}
	public class SpawnPrefab
	{
		private static SpawnPrefab _instance;

		public GameObject waterSurface;

		public static SpawnPrefab Instance
		{
			get
			{
				if (_instance == null)
				{
					_instance = new SpawnPrefab();
				}
				return _instance;
			}
		}
	}
}
namespace LethalSDK.Component
{
	public class ScriptImporter : MonoBehaviour
	{
		public virtual void Awake()
		{
			Object.Destroy((Object)(object)this);
		}
	}
	[AddComponentMenu("LethalSDK/MatchLocalPlayerPosition")]
	public class SI_MatchLocalPlayerPosition : ScriptImporter
	{
		public override void Awake()
		{
			((Component)this).gameObject.AddComponent<MatchLocalPlayerPosition>();
			base.Awake();
		}
	}
	[AddComponentMenu("LethalSDK/AnimatedSun")]
	public class SI_AnimatedSun : ScriptImporter
	{
		public Light indirectLight;

		public Light directLight;

		public override void Awake()
		{
			animatedSun val = ((Component)this).gameObject.AddComponent<animatedSun>();
			val.indirectLight = indirectLight;
			val.directLight = directLight;
			base.Awake();
		}
	}
	[AddComponentMenu("LethalSDK/ScanNode")]
	public class SI_ScanNode : ScriptImporter
	{
		public int MinRange;

		public int MaxRange;

		public bool RequiresLineOfSight;

		public string HeaderText;

		public string SubText;

		public int ScrapValue;

		public int CreatureScanID;

		public int NodeType;

		public override void Awake()
		{
			ScanNodeProperties val = ((Component)this).gameObject.AddComponent<ScanNodeProperties>();
			val.minRange = MinRange;
			val.maxRange = MaxRange;
			val.requiresLineOfSight = RequiresLineOfSight;
			val.headerText = HeaderText;
			val.subText = SubText;
			val.scrapValue = ScrapValue;
			val.creatureScanID = CreatureScanID;
			val.nodeType = NodeType;
			base.Awake();
		}
	}
	[AddComponentMenu("LethalSDK/ScanNodeEntrance")]
	public class SI_ScanNodeEntrance : ScriptImporter
	{
		public string HeaderText = "Main entrance";

		public override void Awake()
		{
			ScanNodeProperties val = ((Component)this).gameObject.AddComponent<ScanNodeProperties>();
			val.minRange = 17;
			val.maxRange = 100;
			val.requiresLineOfSight = false;
			val.headerText = HeaderText;
			val.subText = string.Empty;
			val.scrapValue = 0;
			val.creatureScanID = -1;
			val.nodeType = 0;
			base.Awake();
		}
	}
	[AddComponentMenu("LethalSDK/ScanNodeShip")]
	public class SI_ScanNodeShip : ScriptImporter
	{
		public override void Awake()
		{
			ScanNodeProperties val = ((Component)this).gameObject.AddComponent<ScanNodeProperties>();
			val.minRange = 17;
			val.maxRange = 110;
			val.requiresLineOfSight = false;
			val.headerText = "Ship";
			val.subText = "Home base";
			val.scrapValue = 0;
			val.creatureScanID = -1;
			val.nodeType = 0;
			base.Awake();
		}
	}
	[AddComponentMenu("LethalSDK/AudioReverbPresets")]
	public class SI_AudioReverbPresets : ScriptImporter
	{
		public GameObject[] presets;

		public override void Awake()
		{
		}

		public void Update()
		{
			int num = 0;
			GameObject[] array = presets;
			foreach (GameObject val in array)
			{
				if ((Object)(object)val.GetComponent<SI_AudioReverbTrigger>() != (Object)null)
				{
					num++;
				}
			}
			if (num != 0)
			{
				return;
			}
			List<AudioReverbTrigger> list = new List<AudioReverbTrigger>();
			GameObject[] array2 = presets;
			foreach (GameObject val2 in array2)
			{
				if ((Object)(object)val2.GetComponent<AudioReverbTrigger>() != (Object)null)
				{
					list.Add(val2.GetComponent<AudioReverbTrigger>());
				}
			}
			AudioReverbPresets val3 = ((Component)this).gameObject.AddComponent<AudioReverbPresets>();
			val3.audioPresets = list.ToArray();
			Object.Destroy((Object)(object)this);
		}
	}
	[AddComponentMenu("LethalSDK/AudioReverbTrigger")]
	public class SI_AudioReverbTrigger : ScriptImporter
	{
		[Header("Reverb Preset")]
		public bool ChangeDryLevel = false;

		[Range(-10000f, 0f)]
		public float DryLevel = 0f;

		public bool ChangeHighFreq = false;

		[Range(-10000f, 0f)]
		public float HighFreq = -270f;

		public bool ChangeLowFreq = false;

		[Range(-10000f, 0f)]
		public float LowFreq = -244f;

		public bool ChangeDecayTime = false;

		[Range(0f, 35f)]
		public float DecayTime = 1.4f;

		public bool ChangeRoom = false;

		[Range(-10000f, 0f)]
		public float Room = -600f;

		[Header("MISC")]
		public bool ElevatorTriggerForProps = false;

		public bool SetInElevatorTrigger = false;

		public bool IsShipRoom = false;

		public bool ToggleLocalFog = false;

		public float FogEnabledAmount = 10f;

		[Header("Weather and effects")]
		public bool SetInsideAtmosphere = false;

		public bool InsideLighting = false;

		public int WeatherEffect = -1;

		public bool EffectEnabled = true;

		public bool DisableAllWeather = false;

		public bool EnableCurrentLevelWeather = true;

		public override void Awake()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			AudioReverbTrigger val = ((Component)this).gameObject.AddComponent<AudioReverbTrigger>();
			ReverbPreset val2 = (ReverbPreset)ScriptableObject.CreateInstance(typeof(ReverbPreset));
			val2.changeDryLevel = ChangeDryLevel;
			val2.dryLevel = DryLevel;
			val2.changeHighFreq = ChangeHighFreq;
			val2.highFreq = HighFreq;
			val2.changeLowFreq = ChangeLowFreq;
			val2.lowFreq = LowFreq;
			val2.changeDecayTime = ChangeDecayTime;
			val2.decayTime = DecayTime;
			val2.changeRoom = ChangeRoom;
			val2.room = Room;
			val.reverbPreset = val2;
			val.usePreset = -1;
			val.audioChanges = (switchToAudio[])(object)new switchToAudio[0];
			val.elevatorTriggerForProps = ElevatorTriggerForProps;
			val.setInElevatorTrigger = SetInElevatorTrigger;
			val.isShipRoom = IsShipRoom;
			val.toggleLocalFog = ToggleLocalFog;
			val.fogEnabledAmount = FogEnabledAmount;
			val.setInsideAtmosphere = SetInsideAtmosphere;
			val.insideLighting = InsideLighting;
			val.weatherEffect = WeatherEffect;
			val.effectEnabled = EffectEnabled;
			val.disableAllWeather = DisableAllWeather;
			val.enableCurrentLevelWeather = EnableCurrentLevelWeather;
			base.Awake();
		}
	}
	[AddComponentMenu("LethalSDK/DungeonGenerator")]
	public class SI_DungeonGenerator : ScriptImporter
	{
		public GameObject DungeonRoot;

		public override void Awake()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			if (((Component)this).tag != "DungeonGenerator")
			{
				((Component)this).tag = "DungeonGenerator";
			}
			RuntimeDungeon val = ((Component)this).gameObject.AddComponent<RuntimeDungeon>();
			val.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0];
			val.Generator.LengthMultiplier = 0.8f;
			val.Generator.PauseBetweenRooms = 0.2f;
			val.GenerateOnStart = false;
			val.Root = DungeonRoot;
			UnityNavMeshAdapter val2 = ((Component)this).gameObject.AddComponent<UnityNavMeshAdapter>();
			val2.BakeMode = (RuntimeNavMeshBakeMode)3;
			val2.LayerMask = LayerMask.op_Implicit(35072);
			base.Awake();
		}
	}
	[AddComponentMenu("LethalSDK/EntranceTeleport")]
	public class SI_EntranceTeleport : ScriptImporter
	{
		public int EntranceID = 0;

		public Transform EntrancePoint;

		public int AudioReverbPreset = -1;

		public void Update()
		{
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Expected O, but got Unknown
			GameObject val = GameObject.Find("EntranceTeleportA(Clone)");
			if ((Object)(object)val != (Object)null)
			{
				AudioSource val2 = ((Component)this).gameObject.AddComponent<AudioSource>();
				val2.outputAudioMixerGroup = val.GetComponent<AudioSource>().outputAudioMixerGroup;
				val2.playOnAwake = false;
				val2.spatialBlend = 1f;
				EntranceTeleport entranceTeleport = ((Component)this).gameObject.AddComponent<EntranceTeleport>();
				entranceTeleport.isEntranceToBuilding = true;
				entranceTeleport.entrancePoint = EntrancePoint;
				entranceTeleport.entranceId = EntranceID;
				entranceTeleport.audioReverbPreset = AudioReverbPreset;
				entranceTeleport.entrancePointAudio = val2;
				entranceTeleport.doorAudios = val.GetComponent<EntranceTeleport>().doorAudios;
				InteractTrigger val3 = ((Component)this).gameObject.AddComponent<InteractTrigger>();
				val3.hoverIcon = val.GetComponent<InteractTrigger>().hoverIcon;
				val3.hoverTip = "Enter : [LMB]";
				val3.interactable = true;
				val3.oneHandedItemAllowed = true;
				val3.twoHandedItemAllowed = true;
				val3.holdInteraction = true;
				val3.timeToHold = 1.5f;
				val3.timeToHoldSpeedMultiplier = 1f;
				val3.holdingInteractEvent = new InteractEventFloat();
				val3.onInteract = new InteractEvent();
				val3.onInteractEarly = new InteractEvent();
				val3.onStopInteract = new InteractEvent();
				val3.onCancelAnimation = new InteractEvent();
				((UnityEvent<PlayerControllerB>)(object)val3.onInteract).AddListener((UnityAction<PlayerControllerB>)delegate
				{
					entranceTeleport.TeleportPlayer();
				});
				Object.Destroy((Object)(object)this);
			}
		}

		public override void Awake()
		{
		}
	}
	[AddComponentMenu("LethalSDK/DoorLock")]
	public class SI_DoorLock : ScriptImporter
	{
		public override void Awake()
		{
			base.Awake();
		}
	}
	[AddComponentMenu("LethalSDK/WaterSurface")]
	public class SI_WaterSurface : ScriptImporter
	{
		private GameObject obj;

		public override void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			obj = Object.Instantiate<GameObject>(SpawnPrefab.Instance.waterSurface);
			SceneManager.MoveGameObjectToScene(obj, ((Component)this).gameObject.scene);
			obj.transform.parent = ((Component)this).transform;
			obj.transform.localPosition = Vector3.zero;
			obj.SetActive(true);
		}
	}
	[AddComponentMenu("LethalSDK/Ladder")]
	public class SI_Ladder : ScriptImporter
	{
		public override void Awake()
		{
			base.Awake();
		}
	}
}