Decompiled source of LethalExpansion v1.3.45

LethalExpansion.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen;
using DunGen.Adapters;
using DunGen.Graph;
using GameNetcodeStuff;
using HarmonyLib;
using LethalExpansion.Extenders;
using LethalExpansion.Patches;
using LethalExpansion.Patches.Monsters;
using LethalExpansion.Utils;
using LethalExpansion.Utils.HUD;
using LethalSDK.Component;
using LethalSDK.Editor;
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.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.ProBuilder;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Mono.Security")]
[assembly: IgnoresAccessChecksTo("Newtonsoft.Json")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.AccessibilityModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.AIModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.AndroidJNIModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.AnimationModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.AssetBundleModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.AudioModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ClothModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ClusterInputModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ClusterRendererModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ContentLoadModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.CrashReportingModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.DirectorModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine")]
[assembly: IgnoresAccessChecksTo("UnityEngine.DSPGraphModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.GameCenterModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.GIModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.GridModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.HotReloadModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ImageConversionModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.IMGUIModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.InputLegacyModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.InputModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.JSONSerializeModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.LocalizationModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ParticleSystemModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.PerformanceReportingModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.Physics2DModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.PhysicsModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ProfilerModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.PropertiesModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ScreenCaptureModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SharedInternalsModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SpriteMaskModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SpriteShapeModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.StreamingModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SubstanceModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SubsystemsModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.TerrainModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.TerrainPhysicsModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.TextCoreFontEngineModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.TextCoreTextEngineModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.TextRenderingModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.TilemapModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.TLSModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UIElementsModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UIModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UmbraModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UnityAnalyticsCommonModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UnityAnalyticsModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UnityConnectModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UnityCurlModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UnityTestProtocolModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestAssetBundleModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestAudioModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestTextureModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestWWWModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.VehiclesModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.VFXModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.VideoModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.VirtualTexturingModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.VRModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.WindModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.XRModule")]
[assembly: AssemblyCompany("LethalExpansion")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+7fde565dca80ddd6feff8ddc1af6cf802b1b3aa3")]
[assembly: AssemblyProduct("LethalExpansion")]
[assembly: AssemblyTitle("LethalExpansion")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public class AutoScrollText : MonoBehaviour
{
	public TextMeshProUGUI textMeshPro;

	public float scrollSpeed = 15f;

	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 + -80f);
			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.3.45")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class LethalExpansion : BaseUnityPlugin
	{
		private enum compatibility
		{
			unknown,
			perfect,
			good,
			medium,
			bad,
			critical
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<PluginInfo, bool> <>9__31_1;

			public static UnityAction <>9__31_0;

			public static Func<PluginInfo, bool> <>9__31_2;

			public static Func<PluginInfo, bool> <>9__31_3;

			public static Func<PluginInfo, bool> <>9__31_4;

			public static Func<AudioMixerGroup, bool> <>9__32_0;

			public static Func<GameObject, bool> <>9__32_1;

			public static Func<AudioMixerGroup, bool> <>9__32_2;

			public static Func<AudioMixerGroup, bool> <>9__32_3;

			public static Func<AudioMixerGroup, bool> <>9__32_4;

			public static Func<PluginInfo, bool> <>9__35_0;

			public static Func<PluginInfo, bool> <>9__35_1;

			public static Func<PluginInfo, bool> <>9__35_2;

			public static Func<PluginInfo, bool> <>9__35_3;

			public static Func<PluginInfo, bool> <>9__35_4;

			public static Func<PluginInfo, bool> <>9__35_5;

			internal bool <OnSceneLoaded>b__31_1(PluginInfo p)
			{
				return p.Metadata.GUID == "CoomfyDungeon";
			}

			internal void <OnSceneLoaded>b__31_0()
			{
				ConfigManager.Instance.SetItemValue("CoomfyDungeonCompatibility", value: true);
				ConfigManager.Instance.SetEntryValue("CoomfyDungeonCompatibility", value: true);
			}

			internal bool <OnSceneLoaded>b__31_2(PluginInfo p)
			{
				return p.Metadata.GUID == "imabatby.lethallevelloader";
			}

			internal bool <OnSceneLoaded>b__31_3(PluginInfo p)
			{
				return p.Metadata.GUID == "imabatby.lethallevelloader";
			}

			internal bool <OnSceneLoaded>b__31_4(PluginInfo p)
			{
				return p.Metadata.GUID == "SpaceSunShine";
			}

			internal bool <LoadCustomMoon>b__32_0(AudioMixerGroup a)
			{
				return ((Object)a).name == "Master";
			}

			internal bool <LoadCustomMoon>b__32_1(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 scene = o.scene;
				return ((Scene)(ref scene)).name != "InitSceneLaunchOptions";
			}

			internal bool <LoadCustomMoon>b__32_2(AudioMixerGroup a)
			{
				return ((Object)a).name == "Master";
			}

			internal bool <LoadCustomMoon>b__32_3(AudioMixerGroup a)
			{
				return ((Object)a).name == "Master";
			}

			internal bool <LoadCustomMoon>b__32_4(AudioMixerGroup a)
			{
				return ((Object)a).name == "Master";
			}

			internal bool <waitForSession>b__35_0(PluginInfo p)
			{
				return p.Metadata.GUID == "BrutalCompanyPlus";
			}

			internal bool <waitForSession>b__35_1(PluginInfo p)
			{
				return p.Metadata.GUID == "LethalAdjustments";
			}

			internal bool <waitForSession>b__35_2(PluginInfo p)
			{
				return p.Metadata.GUID == "CoomfyDungeon";
			}

			internal bool <waitForSession>b__35_3(PluginInfo p)
			{
				return p.Metadata.GUID == "299792458.MoreMoneyStart";
			}

			internal bool <waitForSession>b__35_4(PluginInfo p)
			{
				return p.Metadata.GUID == "ExtraDaysToDeadline";
			}

			internal bool <waitForSession>b__35_5(PluginInfo p)
			{
				return p.Metadata.GUID == "AdvancedCompany";
			}
		}

		private const string PluginGUID = "LethalExpansion";

		private const string PluginName = "LethalExpansion";

		private const string VersionString = "1.3.45";

		public static readonly Version ModVersion = new Version("1.3.45");

		public static readonly int[] CompatibleGameVersions = new int[4] { 45, 47, 48, 49 };

		private readonly Dictionary<string, compatibility> CompatibleMods = new Dictionary<string, compatibility>
		{
			{
				"com.sinai.unityexplorer",
				compatibility.medium
			},
			{
				"HDLethalCompany",
				compatibility.good
			},
			{
				"LC_API",
				compatibility.good
			},
			{
				"me.swipez.melonloader.morecompany",
				compatibility.medium
			},
			{
				"BrutalCompanyPlus",
				compatibility.medium
			},
			{
				"MoonOfTheDay",
				compatibility.good
			},
			{
				"Television_Controller",
				compatibility.bad
			},
			{
				"beeisyou.LandmineFix",
				compatibility.perfect
			},
			{
				"LethalAdjustments",
				compatibility.good
			},
			{
				"CoomfyDungeon",
				compatibility.bad
			},
			{
				"BiggerLobby",
				compatibility.good
			},
			{
				"KoderTech.BoomboxController",
				compatibility.good
			},
			{
				"299792458.MoreMoneyStart",
				compatibility.good
			},
			{
				"ExtraDaysToDeadline",
				compatibility.good
			},
			{
				"AdvancedCompany",
				compatibility.unknown
			},
			{
				"SpaceSunShine",
				compatibility.good
			},
			{
				"Nie_SpaceShipDoor",
				compatibility.good
			},
			{
				"imabatby.lethallevelloader",
				compatibility.bad
			},
			{
				"ShaosilGaming.GeneralImprovements",
				compatibility.unknown
			}
		};

		public static List<PluginInfo> loadedPlugins = new List<PluginInfo>();

		public static bool sessionWaiting = true;

		public static bool hostDataWaiting = true;

		public static bool ishost = false;

		public static bool alreadypatched = false;

		public static bool weathersReadyToShare = false;

		public static bool isInGame = false;

		public static bool dungeonGeneratorReady = false;

		public static int delayedLevelChange = -1;

		public static string lastKickReason = string.Empty;

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

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

		public static ConfigFile config;

		public GameObject SpaceLight;

		public GameObject terrainfixer;

		public static Transform currentWaterSurface;

		private int width = 256;

		private int height = 256;

		private int depth = 20;

		private float scale = 20f;

		private void Awake()
		{
			//IL_0ef0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ef6: Expected O, but got Unknown
			//IL_0f3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f4c: Expected O, but got Unknown
			//IL_0f51: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f5e: Expected O, but got Unknown
			//IL_0fc5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fd2: Expected O, but got Unknown
			//IL_0fd9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fe6: Expected O, but got Unknown
			//IL_1004: Unknown result type (might be due to invalid IL or missing references)
			//IL_1009: Unknown result type (might be due to invalid IL or missing references)
			//IL_1015: 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.3.45 is loading...");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Getting other plugins list");
			loadedPlugins = GetLoadedPlugins();
			foreach (PluginInfo loadedPlugin in loadedPlugins)
			{
				if (!(loadedPlugin.Metadata.GUID != "LethalExpansion"))
				{
					continue;
				}
				if (CompatibleMods.ContainsKey(loadedPlugin.Metadata.GUID))
				{
					switch (CompatibleMods[loadedPlugin.Metadata.GUID])
					{
					case compatibility.unknown:
						Console.BackgroundColor = ConsoleColor.Gray;
						((BaseUnityPlugin)this).Logger.LogInfo((object)"                              ");
						Console.ResetColor();
						((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}");
						break;
					case compatibility.perfect:
						Console.BackgroundColor = ConsoleColor.Blue;
						((BaseUnityPlugin)this).Logger.LogInfo((object)"                              ");
						Console.ResetColor();
						((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}");
						break;
					case compatibility.good:
						Console.BackgroundColor = ConsoleColor.Green;
						((BaseUnityPlugin)this).Logger.LogInfo((object)"                              ");
						Console.ResetColor();
						((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}");
						break;
					case compatibility.medium:
						Console.BackgroundColor = ConsoleColor.Yellow;
						((BaseUnityPlugin)this).Logger.LogInfo((object)"                              ");
						Console.ResetColor();
						((BaseUnityPlugin)this).Logger.LogWarning((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}");
						break;
					case compatibility.bad:
						Console.BackgroundColor = ConsoleColor.Red;
						((BaseUnityPlugin)this).Logger.LogInfo((object)"                              ");
						Console.ResetColor();
						((BaseUnityPlugin)this).Logger.LogError((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}");
						break;
					case compatibility.critical:
						Console.BackgroundColor = ConsoleColor.Magenta;
						((BaseUnityPlugin)this).Logger.LogInfo((object)"                              ");
						Console.ResetColor();
						((BaseUnityPlugin)this).Logger.LogFatal((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}");
						break;
					default:
						Console.BackgroundColor = ConsoleColor.Gray;
						((BaseUnityPlugin)this).Logger.LogInfo((object)"                              ");
						Console.ResetColor();
						((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}");
						break;
					}
					((BaseUnityPlugin)this).Logger.LogInfo((object)"------------------------------");
				}
				else
				{
					Console.BackgroundColor = ConsoleColor.Gray;
					((BaseUnityPlugin)this).Logger.LogInfo((object)"                              ");
					Console.ResetColor();
					((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {compatibility.unknown}");
					((BaseUnityPlugin)this).Logger.LogInfo((object)"------------------------------");
				}
			}
			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("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));
			ConfigManager.Instance.AddItem(new ConfigItem("StartingCredits", 60, "Expeditions", "Change amount of starting Credit.", 0, 1000));
			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: true, 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, 3000));
			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.AddItem(new ConfigItem("ShowMoonWeatherInCatalogue", true, "HUD", "Display the current weather of Moons in the Terminal's Moon Catalogue."));
			ConfigManager.Instance.AddItem(new ConfigItem("ShowMoonRankInCatalogue", false, "HUD", "Display the rank of Moons in the Terminal's Moon Catalogue."));
			ConfigManager.Instance.AddItem(new ConfigItem("ShowMoonPriceInCatalogue", false, "HUD", "Display the route price of Moons in the Terminal's Moon Catalogue."));
			ConfigManager.Instance.AddItem(new ConfigItem("QuotaIncreaseSteepness", 16, "Expeditions", "Change the Quota Increase Steepness. (Highter = less steep exponential increase)", 0, 32));
			ConfigManager.Instance.AddItem(new ConfigItem("QuotaBaseIncrease", 100, "Expeditions", "Change the Quota Base Increase.", 0, 300));
			ConfigManager.Instance.AddItem(new ConfigItem("KickPlayerWithoutMod", false, "Lobby", "Kick the players without Lethal Expansion installer. (Will be kicked anyway if LoadModules is True)"));
			ConfigManager.Instance.AddItem(new ConfigItem("BrutalCompanyPlusCompatibility", false, "Compatibility", "Leave Brutal Company Plus control the Quota settings."));
			ConfigManager.Instance.AddItem(new ConfigItem("LethalAdjustmentsCompatibility", false, "Compatibility", "Leave Lethal Adjustments control the Dungeon settings."));
			ConfigManager.Instance.AddItem(new ConfigItem("CoomfyDungeonCompatibility", false, "Compatibility", "Let Coomfy Dungeons control the Dungeon size & scrap settings."));
			ConfigManager.Instance.AddItem(new ConfigItem("MoreMoneyStartCompatibility", false, "Compatibility", "Let MoreMoneyStart control the Starting credits amount."));
			ConfigManager.Instance.AddItem(new ConfigItem("SettingsDebug", false, "Debug", "Show an output of every settings in the Console. (The Console must listen Info messages)", null, null, sync: false));
			ConfigManager.Instance.AddItem(new ConfigItem("LegacyMoonLoading", false, "Modules", "Roll back to Synchronous moon loading. (Freeze the game longer and highter chance of crash)"));
			ConfigManager.Instance.AddItem(new ConfigItem("ExtraDaysToDeadline", false, "Compatibility", "Leave ExtraDaysToDeadline control the deadline days amount. (not effect automatic deadlines)"));
			ConfigManager.Instance.AddItem(new ConfigItem("HideModSettingsMenu", false, "HUD", "Hide the ModSettings menu from the Main Menu, you still can open the menu by pressing O in Main Menu. (Restart Required)", null, null, sync: false));
			ConfigManager.Instance.AddItem(new ConfigItem("AdvancedCompanyCompatibility", false, "Compatibility", "Let AdvancedCompany control some settings."));
			ConfigManager.Instance.AddItem(new ConfigItem("HideVersionNumberInMainMenu", false, "HUD", "Hide the LE version number in the main menu. (Restart Required)", null, null, sync: false));
			ConfigManager.Instance.AddItem(new ConfigItem("DisableSpaceLightInOrbit", false, "Expeditions", "Disable the SpaceLight out of the ship. (Automatically apply if the SpaceSunShine mod is installed)", null, null, sync: false));
			ConfigManager.Instance.AddItem(new ConfigItem("PatchGlobalTimeSpeedMultiplier", false, "Compatibility Advanced", "Disable the patch of Global Time Speed Multiplier for Compatibility."));
			ConfigManager.Instance.AddItem(new ConfigItem("PatchNumberOfHours", false, "Compatibility Advanced", "Disable the patch of Number Of Hours for Compatibility."));
			ConfigManager.Instance.AddItem(new ConfigItem("PatchDeadlineDaysAmount", false, "Compatibility Advanced", "Disable the patch of Deadline Days Amount for Compatibility."));
			ConfigManager.Instance.AddItem(new ConfigItem("PatchStartingQuota", false, "Compatibility Advanced", "Disable the patch of Starting Quota for Compatibility."));
			ConfigManager.Instance.AddItem(new ConfigItem("PatchStartingCredits", false, "Compatibility Advanced", "Disable the patch of Starting Credits for Compatibility."));
			ConfigManager.Instance.AddItem(new ConfigItem("PatchBaseIncrease", false, "Compatibility Advanced", "Disable the patch of Quota Base Increase for Compatibility."));
			ConfigManager.Instance.AddItem(new ConfigItem("PatchIncreaseSteepness", false, "Compatibility Advanced", "Disable the patch of Quota Increase Steepness for Compatibility."));
			ConfigManager.Instance.AddItem(new ConfigItem("PatchScrapValueMultiplier", false, "Compatibility Advanced", "Disable the patch of Scrap Value Multiplier for Compatibility."));
			ConfigManager.Instance.AddItem(new ConfigItem("PatchScrapAmountMultiplier", false, "Compatibility Advanced", "Disable the patch of Scrap Amount Multiplier for Compatibility."));
			ConfigManager.Instance.AddItem(new ConfigItem("PatchMapSizeMultiplier", false, "Compatibility Advanced", "Disable the patch of Map Size Multiplier for Compatibility."));
			ConfigManager.Instance.AddItem(new ConfigItem("PatchMaxShipItemCapacity", false, "Compatibility Advanced", "Disable the patch of Max Ship Item Capacity for Compatibility."));
			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.PatchAll(typeof(AudioReverbTrigger_Patch));
			Harmony.PatchAll(typeof(InteractTrigger_Patch));
			Harmony.PatchAll(typeof(RuntimeDungeon));
			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.3.45 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Expected O, but got Unknown
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Expected O, but got Unknown
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Expected O, but got Unknown
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_074d: Unknown result type (might be due to invalid IL or missing references)
			//IL_073c: 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 == "MainMenu")
			{
				sessionWaiting = true;
				hostDataWaiting = true;
				ishost = false;
				alreadypatched = false;
				dungeonGeneratorReady = false;
				delayedLevelChange = -1;
				isInGame = false;
				AssetGather.Instance.AddAudioMixer(GameObject.Find("Canvas/MenuManager").GetComponent<AudioSource>().outputAudioMixerGroup.audioMixer);
				SettingsMenu.Instance.InitSettingsMenu();
				if (lastKickReason != null && lastKickReason.Length > 0)
				{
					PopupManager.Instance.InstantiatePopup(scene, "Kicked from Lobby", "You have been kicked\r\nReason: " + lastKickReason, "Ok", "Ignore");
				}
				if (!ConfigManager.Instance.FindEntryValue<bool>("CoomfyDungeonCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "CoomfyDungeon"))
				{
					PopupManager instance = PopupManager.Instance;
					Scene sceneFocus = scene;
					object obj = <>c.<>9__31_0;
					if (obj == null)
					{
						UnityAction val = delegate
						{
							ConfigManager.Instance.SetItemValue("CoomfyDungeonCompatibility", value: true);
							ConfigManager.Instance.SetEntryValue("CoomfyDungeonCompatibility", value: true);
						};
						<>c.<>9__31_0 = val;
						obj = (object)val;
					}
					instance.InstantiatePopup(sceneFocus, "CoomfyDungeon mod found", "Warning: CoomfyDungeon is incompatible with LethalExpansion, Would you like to enable the compatibility mode? Otherwise dungeon generation Desync may occurs!", "Yes", "No", (UnityAction)obj, null, 20, 18);
				}
				if (loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "imabatby.lethallevelloader") && loadedPlugins.First((PluginInfo p) => p.Metadata.GUID == "imabatby.lethallevelloader").Metadata.Version.Minor == 1)
				{
					PopupManager.Instance.InstantiatePopup(scene, "LethalLevelLoader 1.1.X mod found", "Warning: LethalLevelLoader 1.1.X is incompatible with LethalExpansion, please use LethalLevelLoader 1.0.7 untill a patch is done.", "Ok", "Ignore", null, null, 20, 18);
				}
			}
			if (((Scene)(ref scene)).name == "CompanyBuilding")
			{
				if ((Object)(object)SpaceLight != (Object)null)
				{
					SpaceLight.SetActive(false);
				}
				if ((Object)(object)terrainfixer != (Object)null)
				{
					terrainfixer.SetActive(false);
				}
				dungeonGeneratorReady = true;
			}
			if (((Scene)(ref scene)).name == "SampleSceneRelay")
			{
				bool flag = true;
				if (ConfigManager.Instance.FindItemValue<bool>("DisableSpaceLightInOrbit") || loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "SpaceSunShine"))
				{
					flag = false;
				}
				if (flag)
				{
					SpaceLight = Object.Instantiate<GameObject>(AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Prefabs/SpaceLight.prefab"));
					SceneManager.MoveGameObjectToScene(SpaceLight, scene);
				}
				GameObject val2 = Object.Instantiate<GameObject>(GameObject.Find("Systems/GameSystems/TimeAndWeather/Flooding"));
				Object.Destroy((Object)(object)val2.GetComponent<FloodWeather>());
				((Object)val2).name = "WaterSurface";
				val2.transform.position = Vector3.zero;
				((Component)val2.transform.Find("Water")).GetComponent<MeshFilter>().sharedMesh = null;
				SpawnPrefab.Instance.waterSurface = val2;
				((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 val3 = terrainfixer.AddComponent<Terrain>();
				TerrainData val4 = new TerrainData();
				val4.heightmapResolution = width + 1;
				val4.size = new Vector3((float)width, (float)depth, (float)height);
				val4.SetHeights(0, 0, GenerateHeights());
				val3.terrainData = val4;
				Terminal_Patch.ResetFireExitAmounts();
				Object[] array = Resources.FindObjectsOfTypeAll(typeof(Volume));
				for (int i = 0; i < array.Length; i++)
				{
					Object obj2 = array[i];
					if ((Object)(object)((Volume)((obj2 is Volume) ? obj2 : null)).sharedProfile == (Object)null)
					{
						Object obj3 = array[i];
						((Volume)((obj3 is Volume) ? obj3 : null)).sharedProfile = AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<VolumeProfile>("Assets/Mods/LethalExpansion/Sky and Fog Global Volume Profile.asset");
					}
				}
				waitForSession().GetAwaiter();
				isInGame = true;
			}
			if (((Scene)(ref scene)).name.StartsWith("Level"))
			{
				if ((Object)(object)SpaceLight != (Object)null)
				{
					SpaceLight.SetActive(false);
				}
				if ((Object)(object)terrainfixer != (Object)null)
				{
					terrainfixer.SetActive(false);
				}
				dungeonGeneratorReady = true;
				if (ConfigManager.Instance.FindItemValue<bool>("SettingsDebug"))
				{
					foreach (ConfigItem item in ConfigManager.Instance.GetAll())
					{
						Log.LogInfo((object)"==========");
						Log.LogInfo((object)item.Key);
						Log.LogInfo(item.Value);
						Log.LogInfo(item.DefaultValue);
						Log.LogInfo((object)item.Sync);
					}
				}
			}
			if (!(((Scene)(ref scene)).name == "InitSceneLaunchOptions") || !isInGame)
			{
				return;
			}
			if ((Object)(object)SpaceLight != (Object)null)
			{
				SpaceLight.SetActive(false);
			}
			if ((Object)(object)terrainfixer != (Object)null)
			{
				terrainfixer.SetActive(false);
			}
			GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
			foreach (GameObject val5 in rootGameObjects)
			{
				val5.SetActive(false);
			}
			if (ConfigManager.Instance.FindItemValue<bool>("SettingsDebug"))
			{
				foreach (ConfigItem item2 in ConfigManager.Instance.GetAll())
				{
					Log.LogInfo((object)"==========");
					Log.LogInfo((object)item2.Key);
					Log.LogInfo(item2.Value);
					Log.LogInfo(item2.DefaultValue);
					Log.LogInfo((object)item2.Sync);
				}
			}
			if (ConfigManager.Instance.FindItemValue<bool>("LegacyMoonLoading"))
			{
				LoadCustomMoon(scene).RunSynchronously();
			}
			else
			{
				LoadCustomMoon(scene).GetAwaiter();
			}
		}

		private async Task LoadCustomMoon(Scene scene)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			await Task.Delay(400);
			try
			{
				if ((Object)(object)Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab != (Object)null && (Object)(object)Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab.transform != (Object)null)
				{
					CheckRiskyComponents(Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab.transform, Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MoonName);
					GameObject mainPrefab = Object.Instantiate<GameObject>(Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab);
					currentWaterSurface = mainPrefab.transform.Find("Environment/Water");
					if ((Object)(object)mainPrefab != (Object)null)
					{
						SceneManager.MoveGameObjectToScene(mainPrefab, scene);
						Transform DiageticBackground = mainPrefab.transform.Find("Systems/Audio/DiageticBackground");
						if ((Object)(object)DiageticBackground != (Object)null)
						{
							((Component)DiageticBackground).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null);
						}
						Terrain[] Terrains = mainPrefab.GetComponentsInChildren<Terrain>();
						if (Terrains != null && Terrains.Length != 0)
						{
							Terrain[] array = Terrains;
							foreach (Terrain terrain in array)
							{
								terrain.drawInstanced = true;
							}
						}
					}
				}
				string[] _tmp = new string[5] { "MapPropsContainer", "OutsideAINode", "SpawnDenialPoint", "ItemShipLandingNode", "OutsideLevelNavMesh" };
				string[] array2 = _tmp;
				foreach (string s in array2)
				{
					if ((Object)(object)GameObject.FindGameObjectWithTag(s) == (Object)null || GameObject.FindGameObjectsWithTag(s).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 obj = new GameObject();
						((Object)obj).name = s;
						obj.tag = s;
						obj.transform.position = new Vector3(0f, -200f, 0f);
						SceneManager.MoveGameObjectToScene(obj, scene);
					}
				}
				await Task.Delay(200);
				GameObject DropShip = GameObject.Find("ItemShipAnimContainer");
				if ((Object)(object)DropShip != (Object)null)
				{
					Transform ItemShip = DropShip.transform.Find("ItemShip");
					if ((Object)(object)ItemShip != (Object)null)
					{
						((Component)ItemShip).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null);
					}
					Transform ItemShipMusicClose = DropShip.transform.Find("ItemShip/Music");
					if ((Object)(object)ItemShipMusicClose != (Object)null)
					{
						((Component)ItemShipMusicClose).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null);
					}
					Transform ItemShipMusicFar = DropShip.transform.Find("ItemShip/Music/Music (1)");
					if ((Object)(object)ItemShipMusicFar != (Object)null)
					{
						((Component)ItemShipMusicFar).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null);
					}
				}
				await Task.Delay(200);
				RuntimeDungeon runtimeDungeon2 = Object.FindObjectOfType<RuntimeDungeon>(false);
				if ((Object)(object)runtimeDungeon2 == (Object)null)
				{
					GameObject dungeonGenerator = new GameObject();
					((Object)dungeonGenerator).name = "DungeonGenerator";
					dungeonGenerator.tag = "DungeonGenerator";
					dungeonGenerator.transform.position = new Vector3(0f, -200f, 0f);
					runtimeDungeon2 = dungeonGenerator.AddComponent<RuntimeDungeon>();
					runtimeDungeon2.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0];
					runtimeDungeon2.Generator.LengthMultiplier = 0.8f;
					runtimeDungeon2.Generator.PauseBetweenRooms = 0.2f;
					runtimeDungeon2.GenerateOnStart = false;
					runtimeDungeon2.Root = dungeonGenerator;
					runtimeDungeon2.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0];
					UnityNavMeshAdapter dungeonNavMesh = dungeonGenerator.AddComponent<UnityNavMeshAdapter>();
					dungeonNavMesh.BakeMode = (RuntimeNavMeshBakeMode)3;
					dungeonNavMesh.LayerMask = LayerMask.op_Implicit(35072);
					SceneManager.MoveGameObjectToScene(dungeonGenerator, scene);
				}
				else if ((Object)(object)runtimeDungeon2.Generator.DungeonFlow == (Object)null)
				{
					runtimeDungeon2.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0];
				}
				dungeonGeneratorReady = true;
				GameObject OutOfBounds = GameObject.CreatePrimitive((PrimitiveType)3);
				((Object)OutOfBounds).name = "OutOfBounds";
				OutOfBounds.layer = 13;
				OutOfBounds.transform.position = new Vector3(0f, -300f, 0f);
				OutOfBounds.transform.localScale = new Vector3(1000f, 5f, 1000f);
				BoxCollider boxCollider = OutOfBounds.GetComponent<BoxCollider>();
				((Collider)boxCollider).isTrigger = true;
				OutOfBounds.AddComponent<OutOfBoundsTrigger>();
				Rigidbody rigidbody = OutOfBounds.AddComponent<Rigidbody>();
				rigidbody.useGravity = false;
				rigidbody.isKinematic = true;
				rigidbody.collisionDetectionMode = (CollisionDetectionMode)1;
				SceneManager.MoveGameObjectToScene(OutOfBounds, scene);
				await Task.Delay(200);
			}
			catch (Exception ex2)
			{
				Exception ex = ex2;
				Log.LogError((object)ex);
			}
		}

		private void CheckRiskyComponents(Transform root, string objname)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			try
			{
				Component[] components = ((Component)root).GetComponents<Component>();
				Component[] array = components;
				foreach (Component component in array)
				{
					if (!ComponentWhitelists.mainWhitelist.Any((Type whitelistType) => ((object)component).GetType() == whitelistType))
					{
						Log.LogWarning((object)(((object)component).GetType().Name + " component is not native of Unity or LethalSDK. It can contains malwares. From " + objname + "."));
					}
				}
				foreach (Transform item in root)
				{
					Transform root2 = item;
					CheckRiskyComponents(root2, objname);
				}
			}
			catch (Exception ex)
			{
				Log.LogError((object)ex.Message);
			}
		}

		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))
			{
				if ((Object)(object)SpaceLight != (Object)null)
				{
					SpaceLight.SetActive(true);
				}
				if ((Object)(object)currentWaterSurface != (Object)null)
				{
					currentWaterSurface = null;
				}
				dungeonGeneratorReady = false;
				Terminal_Patch.ResetFireExitAmounts();
			}
		}

		private async Task waitForSession()
		{
			while (sessionWaiting)
			{
				await Task.Delay(1000);
			}
			for (int i = 0; i < ConfigManager.Instance.GetAll().Count; i++)
			{
				if (ConfigManager.Instance.MustBeSync(i))
				{
					ConfigManager.Instance.SetItemValue(i, ConfigManager.Instance.FindEntryValue(i));
				}
			}
			bool patchGlobalTimeSpeedMultiplier = true;
			bool patchNumberOfHours = true;
			bool patchDeadlineDaysAmount = true;
			bool patchStartingQuota = true;
			bool patchStartingCredits = true;
			bool patchBaseIncrease = true;
			bool patchIncreaseSteepness = true;
			bool patchScrapValueMultiplier = true;
			bool patchScrapAmountMultiplier = true;
			bool patchMapSizeMultiplier = true;
			bool patchMaxShipItemCapacity = true;
			if (ConfigManager.Instance.FindItemValue<bool>("PatchGlobalTimeSpeedMultiplier"))
			{
				patchGlobalTimeSpeedMultiplier = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("PatchNumberOfHours"))
			{
				patchNumberOfHours = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("PatchDeadlineDaysAmount"))
			{
				patchDeadlineDaysAmount = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("PatchStartingQuota"))
			{
				patchStartingQuota = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("PatchStartingCredits"))
			{
				patchStartingCredits = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("PatchBaseIncrease"))
			{
				patchBaseIncrease = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("PatchIncreaseSteepness"))
			{
				patchIncreaseSteepness = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("PatchScrapValueMultiplier"))
			{
				patchScrapValueMultiplier = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("PatchScrapAmountMultiplier"))
			{
				patchScrapAmountMultiplier = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("PatchMapSizeMultiplier"))
			{
				patchMapSizeMultiplier = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("PatchMaxShipItemCapacity"))
			{
				patchMaxShipItemCapacity = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("BrutalCompanyPlusCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "BrutalCompanyPlus"))
			{
				patchDeadlineDaysAmount = false;
				patchStartingQuota = false;
				patchStartingCredits = false;
				patchBaseIncrease = false;
				patchIncreaseSteepness = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("LethalAdjustmentsCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "LethalAdjustments"))
			{
				patchScrapValueMultiplier = false;
				patchScrapAmountMultiplier = false;
				patchMapSizeMultiplier = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("CoomfyDungeonCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "CoomfyDungeon"))
			{
				patchScrapAmountMultiplier = false;
				patchMapSizeMultiplier = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("MoreMoneyStartCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "299792458.MoreMoneyStart"))
			{
				patchStartingCredits = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("ExtraDaysToDeadline") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "ExtraDaysToDeadline"))
			{
				patchDeadlineDaysAmount = false;
			}
			if (ConfigManager.Instance.FindItemValue<bool>("AdvancedCompanyCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "AdvancedCompany"))
			{
				patchGlobalTimeSpeedMultiplier = false;
				patchStartingCredits = false;
				patchScrapValueMultiplier = false;
				patchScrapAmountMultiplier = false;
				patchMapSizeMultiplier = false;
			}
			if (patchGlobalTimeSpeedMultiplier)
			{
				TimeOfDay.Instance.globalTimeSpeedMultiplier = ConfigManager.Instance.FindItemValue<float>("GlobalTimeSpeedMultiplier");
			}
			if (patchNumberOfHours)
			{
				TimeOfDay.Instance.numberOfHours = ConfigManager.Instance.FindItemValue<int>("NumberOfHours");
			}
			if (patchDeadlineDaysAmount)
			{
				TimeOfDay.Instance.quotaVariables.deadlineDaysAmount = ConfigManager.Instance.FindItemValue<int>("DeadlineDaysAmount");
			}
			if (patchStartingQuota)
			{
				TimeOfDay.Instance.quotaVariables.startingQuota = ConfigManager.Instance.FindItemValue<int>("StartingQuota");
			}
			if (patchStartingCredits)
			{
				TimeOfDay.Instance.quotaVariables.startingCredits = ConfigManager.Instance.FindItemValue<int>("StartingCredits");
			}
			if (patchBaseIncrease)
			{
				TimeOfDay.Instance.quotaVariables.baseIncrease = ConfigManager.Instance.FindItemValue<int>("QuotaBaseIncrease");
			}
			if (patchIncreaseSteepness)
			{
				TimeOfDay.Instance.quotaVariables.increaseSteepness = ConfigManager.Instance.FindItemValue<int>("QuotaIncreaseSteepness");
			}
			if (patchScrapValueMultiplier)
			{
				RoundManager.Instance.scrapValueMultiplier = ConfigManager.Instance.FindItemValue<float>("ScrapValueMultiplier");
			}
			if (patchScrapAmountMultiplier)
			{
				RoundManager.Instance.scrapAmountMultiplier = ConfigManager.Instance.FindItemValue<float>("ScrapAmountMultiplier");
			}
			if (patchMapSizeMultiplier)
			{
				RoundManager.Instance.mapSizeMultiplier = ConfigManager.Instance.FindItemValue<float>("MapSizeMultiplier");
			}
			if (patchMaxShipItemCapacity)
			{
				StartOfRound.Instance.maxShipItemCapacity = ConfigManager.Instance.FindItemValue<int>("MaxItemsInShip");
			}
			if (!alreadypatched)
			{
				Terminal_Patch.MainPatch(GameObject.Find("TerminalScript").GetComponent<Terminal>());
				alreadypatched = true;
			}
			if (!ishost)
			{
				while (!sessionWaiting && hostDataWaiting)
				{
					NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.request, "hostconfig", string.Empty, 0L);
					await Task.Delay(3000);
				}
				Terminal_Patch.MainPatchPostConfig(GameObject.Find("TerminalScript").GetComponent<Terminal>());
			}
		}

		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 readonly string[] forcedNative = new string[1] { "lethalexpansion" };

		public DirectoryInfo modPath = new DirectoryInfo(Assembly.GetExecutingAssembly().Location);

		public DirectoryInfo modDirectory;

		public DirectoryInfo pluginsDirectory;

		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()
		{
			modDirectory = modPath.Parent;
			pluginsDirectory = modDirectory;
			while (pluginsDirectory != null && pluginsDirectory.Name != "plugins")
			{
				pluginsDirectory = pluginsDirectory.Parent;
			}
			if (pluginsDirectory != null)
			{
				LethalExpansion.Log.LogInfo((object)("Plugins folder found: " + pluginsDirectory.FullName));
				LethalExpansion.Log.LogInfo((object)("Mod path is: " + modDirectory.FullName));
				if (modDirectory.FullName == pluginsDirectory.FullName)
				{
					LethalExpansion.Log.LogWarning((object)("LethalExpansion is Rooting the Plugins folder, this is not recommended. " + modDirectory.FullName));
				}
				string[] files = Directory.GetFiles(pluginsDirectory.FullName, "*.lem", SearchOption.AllDirectories);
				foreach (string text in files)
				{
					if (!LethalExpansion.loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "SpaceSunShine") || !(Path.GetFileNameWithoutExtension(text).ToLower() == "spacesunshine"))
					{
						LoadBundle(text);
					}
					else
					{
						LethalExpansion.Log.LogInfo((object)"SpaceSunShine mod is found, ignoring it's lem file.");
					}
				}
			}
			else
			{
				LethalExpansion.Log.LogWarning((object)"Mod is not in a plugins folder.");
			}
		}

		public void LoadBundle(string file)
		{
			if (forcedNative.Contains<string>(Path.GetFileNameWithoutExtension(file)) && !file.Contains(modDirectory.FullName))
			{
				LethalExpansion.Log.LogWarning((object)("Illegal usage of reserved Asset Bundle name: " + Path.GetFileNameWithoutExtension(file) + " at: " + file + "."));
			}
			else
			{
				if (!(Path.GetFileName(file) != "lethalexpansion.lem"))
				{
					return;
				}
				if (!assetBundles.ContainsKey(Path.GetFileNameWithoutExtension(file)))
				{
					Stopwatch stopwatch = new Stopwatch();
					AssetBundle val = null;
					try
					{
						stopwatch.Start();
						val = AssetBundle.LoadFromFile(file);
						stopwatch.Stop();
					}
					catch (Exception ex)
					{
						LethalExpansion.Log.LogError((object)ex);
					}
					if ((Object)(object)val != (Object)null)
					{
						string text = "Assets/Mods/" + Path.GetFileNameWithoutExtension(file) + "/ModManifest.asset";
						ModManifest modManifest = val.LoadAsset<ModManifest>(text);
						if ((Object)(object)modManifest != (Object)null)
						{
							if (forcedNative.Contains(modManifest.modName.ToLower()) && !file.Contains(modDirectory.FullName))
							{
								LethalExpansion.Log.LogWarning((object)("Illegal usage of reserved Mod name: " + modManifest.modName));
								val.Unload(true);
								LethalExpansion.Log.LogInfo((object)("AssetBundle unloaded: " + Path.GetFileName(file)));
							}
							else if (!assetBundles.Any((KeyValuePair<string, (AssetBundle, ModManifest)> b) => b.Value.Item2.modName == modManifest.modName))
							{
								LethalExpansion.Log.LogInfo((object)string.Format("Module found: {0} v{1} Loaded in {2}ms", modManifest.modName, (modManifest.GetVersion() != null) ? ((object)modManifest.GetVersion()).ToString() : "0.0.0.0", stopwatch.ElapsedMilliseconds));
								if (modManifest.GetVersion() == null || ((object)modManifest.GetVersion()).ToString() == "0.0.0.0")
								{
									LethalExpansion.Log.LogWarning((object)("Module " + modManifest.modName + " have no version number, this is unsafe!"));
								}
								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 bool IncompatibleBundlesLoaded(string[] bundleNames)
		{
			foreach (string text in bundleNames)
			{
				if (assetBundles.ContainsKey(text.ToLower()))
				{
					return true;
				}
			}
			return false;
		}
	}
	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 Dictionary<string, Sprite> sprites = new Dictionary<string, Sprite>();

		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);
			}
			LethalExpansion.Log.LogInfo((object)"===Sprites===");
			foreach (KeyValuePair<string, Sprite> sprite in sprites)
			{
				LethalExpansion.Log.LogInfo((object)sprite.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 AddAudioClip(string name, AudioClip clip)
		{
			if ((Object)(object)clip != (Object)null && !audioClips.ContainsKey(name) && !audioClips.ContainsValue(clip))
			{
				audioClips.Add(name, clip);
			}
		}

		public void AddAudioClip(AudioClip[] clips)
		{
			foreach (AudioClip val in clips)
			{
				if ((Object)(object)val != (Object)null && !audioClips.ContainsKey(((Object)val).name) && !audioClips.ContainsValue(val))
				{
					audioClips.Add(((Object)val).name, val);
				}
			}
		}

		public void AddAudioClip(string[] names, AudioClip[] clips)
		{
			for (int i = 0; i < clips.Length && i < names.Length; i++)
			{
				if ((Object)(object)clips[i] != (Object)null && !audioClips.ContainsKey(names[i]) && !audioClips.ContainsValue(clips[i]))
				{
					audioClips.Add(names[i], clips[i]);
				}
			}
		}

		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 AddPlanetPrefabs(string name, GameObject prefab)
		{
			if ((Object)(object)prefab != (Object)null && !planetPrefabs.ContainsKey(name) && !planetPrefabs.ContainsValue(prefab))
			{
				planetPrefabs.Add(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);
			}
		}

		public void AddSprites(Sprite sprite)
		{
			if ((Object)(object)sprite != (Object)null && !sprites.ContainsKey(((Object)sprite).name) && !sprites.ContainsValue(sprite))
			{
				sprites.Add(((Object)sprite).name, sprite);
			}
		}

		public void AddSprites(string name, Sprite sprite)
		{
			if ((Object)(object)sprite != (Object)null && !sprites.ContainsKey(name) && !sprites.ContainsValue(sprite))
			{
				sprites.Add(name, sprite);
			}
		}
	}
	public class ChatMessageProcessor
	{
		public static bool ProcessMessage(string message)
		{
			if (Regex.IsMatch(message, "^\\[sync\\].*\\[sync\\]$"))
			{
				try
				{
					string value = Regex.Match(message, "^\\[sync\\](.*)\\[sync\\]$").Groups[1].Value;
					string[] array = value.Split('|');
					if (array.Length == 3)
					{
						NetworkPacketManager.packetType packetType = (NetworkPacketManager.packetType)int.Parse(array[0]);
						string[] array2 = array[1].Split('>');
						ulong num = ulong.Parse(array2[0]);
						long num2 = long.Parse(array2[1]);
						string[] array3 = array[2].Split('=');
						string header = array3[0];
						string packet = array3[1];
						if (num2 == -1 || num2 == (long)((NetworkBehaviour)RoundManager.Instance).NetworkManager.LocalClientId)
						{
							if (num != 0)
							{
								NetworkPacketManager.Instance.CancelTimeout((long)num);
							}
							LethalExpansion.Log.LogInfo((object)message);
							switch (packetType)
							{
							case NetworkPacketManager.packetType.request:
								ProcessRequest(num, header, packet);
								break;
							case NetworkPacketManager.packetType.data:
								ProcessData(num, header, packet);
								break;
							case NetworkPacketManager.packetType.other:
								LethalExpansion.Log.LogInfo((object)"Unsupported type.");
								break;
							default:
								LethalExpansion.Log.LogInfo((object)"Unrecognized type.");
								break;
							}
						}
					}
					return true;
				}
				catch (Exception ex)
				{
					LethalExpansion.Log.LogError((object)ex);
					return false;
				}
			}
			return false;
		}

		private static void ProcessRequest(ulong sender, string header, string packet)
		{
			try
			{
				switch (header)
				{
				case "clientinfo":
				{
					if (LethalExpansion.ishost || sender != 0)
					{
						break;
					}
					string text2 = LethalExpansion.ModVersion.ToString() + "$";
					foreach (KeyValuePair<string, (AssetBundle, ModManifest)> assetBundle in AssetBundlesManager.Instance.assetBundles)
					{
						text2 = text2 + assetBundle.Key + "v" + ((object)assetBundle.Value.Item2.GetVersion()).ToString() + "&";
					}
					if (text2.EndsWith('&'))
					{
						text2 = text2.Remove(text2.Length - 1);
					}
					NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "clientinfo", text2, 0L);
					break;
				}
				case "hostconfig":
					if (LethalExpansion.ishost && sender != 0)
					{
						NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.request, "clientinfo", string.Empty, (long)sender);
					}
					break;
				case "hostweathers":
					if (LethalExpansion.ishost && sender != 0L && LethalExpansion.weathersReadyToShare)
					{
						string text3 = string.Empty;
						int[] currentWeathers = StartOfRound_Patch.currentWeathers;
						foreach (int num2 in currentWeathers)
						{
							text3 = text3 + num2 + "&";
						}
						if (text3.EndsWith('&'))
						{
							text3 = text3.Remove(text3.Length - 1);
						}
						NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "hostweathers", text3, (long)sender, waitForAnswer: false);
					}
					break;
				case "networkobjectdata":
				{
					if (!LethalExpansion.ishost || sender == 0)
					{
						break;
					}
					string text = string.Empty;
					if (packet.Length > 0 && packet.Contains(','))
					{
						try
						{
							ulong[] array = Array.ConvertAll(packet.Split(','), ulong.Parse);
							ulong[] array2 = array;
							foreach (ulong num in array2)
							{
								text += $"{num}${NetworkDataManager.NetworkData[num].serializedData}&";
							}
							if (text.EndsWith('&'))
							{
								text = text.Remove(text.Length - 1);
							}
						}
						catch (Exception ex)
						{
							LethalExpansion.Log.LogError((object)ex);
							text = "error";
						}
						NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "networkobjectdata", text, (long)sender, waitForAnswer: false);
					}
					else
					{
						LethalExpansion.Log.LogError((object)"networkobjectdata packet error");
						text = "packet error";
					}
					break;
				}
				default:
					LethalExpansion.Log.LogInfo((object)"Unrecognized command.");
					break;
				}
			}
			catch (Exception ex2)
			{
				LethalExpansion.Log.LogError((object)ex2);
			}
		}

		private static void ProcessData(ulong sender, string header, string packet)
		{
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				switch (header)
				{
				case "clientinfo":
				{
					if (!LethalExpansion.ishost || sender == 0)
					{
						break;
					}
					string[] array2 = ((!packet.Contains('$')) ? new string[1] { packet } : packet.Split('$'));
					string text = string.Empty;
					foreach (KeyValuePair<string, (AssetBundle, ModManifest)> assetBundle in AssetBundlesManager.Instance.assetBundles)
					{
						text = text + assetBundle.Key + "v" + ((object)assetBundle.Value.Item2.GetVersion()).ToString() + "&";
					}
					if (text.Length > 0 && text.EndsWith('&'))
					{
						text = text.Remove(text.Length - 1);
					}
					if (array2[0] != LethalExpansion.ModVersion.ToString())
					{
						if (StartOfRound.Instance.ClientPlayerList.ContainsKey(sender))
						{
							LethalExpansion.Log.LogError((object)$"Kicking {sender} for wrong version.");
							NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "kickreason", "Wrong version.", (long)sender);
							StartOfRound.Instance.KickPlayer(StartOfRound.Instance.ClientPlayerList[sender]);
						}
						break;
					}
					if (array2.Length > 1 && array2[1] != text)
					{
						if (StartOfRound.Instance.ClientPlayerList.ContainsKey(sender))
						{
							LethalExpansion.Log.LogError((object)$"Kicking {sender} for wrong bundles.");
							NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "kickreason", "Wrong bundles.", (long)sender);
							StartOfRound.Instance.KickPlayer(StartOfRound.Instance.ClientPlayerList[sender]);
						}
						break;
					}
					string text2 = string.Empty;
					foreach (ConfigItem item in ConfigManager.Instance.GetAll())
					{
						switch (item.type.Name)
						{
						case "Int32":
							text2 = text2 + "i" + ((int)item.Value).ToString(CultureInfo.InvariantCulture);
							break;
						case "Single":
							text2 = text2 + "f" + ((float)item.Value).ToString(CultureInfo.InvariantCulture);
							break;
						case "Boolean":
							text2 = text2 + "b" + (bool)item.Value;
							break;
						case "String":
							text2 = text2 + "s" + item;
							break;
						}
						text2 += "&";
					}
					if (text2.EndsWith('&'))
					{
						text2 = text2.Remove(text2.Length - 1);
					}
					NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "hostconfig", text2, (long)sender);
					break;
				}
				case "hostconfig":
				{
					if (LethalExpansion.ishost || sender != 0)
					{
						break;
					}
					string[] array6 = packet.Split('&');
					LethalExpansion.Log.LogInfo((object)("Received host config: " + packet));
					for (int k = 0; k < array6.Length; k++)
					{
						if (k < ConfigManager.Instance.GetCount() && ConfigManager.Instance.MustBeSync(k))
						{
							ConfigManager.Instance.SetItemValue(k, array6[k].Substring(1), array6[k][0]);
						}
					}
					LethalExpansion.hostDataWaiting = false;
					LethalExpansion.Log.LogInfo((object)"Updated config");
					break;
				}
				case "hostweathers":
				{
					if (LethalExpansion.ishost || sender != 0)
					{
						break;
					}
					string[] array = packet.Split('&');
					LethalExpansion.Log.LogInfo((object)("Received host weathers: " + packet));
					StartOfRound_Patch.currentWeathers = new int[array.Length];
					for (int i = 0; i < array.Length; i++)
					{
						int result = 0;
						if (int.TryParse(array[i], out result))
						{
							StartOfRound_Patch.currentWeathers[i] = result;
							StartOfRound.Instance.levels[i].currentWeather = (LevelWeatherType)result;
						}
					}
					break;
				}
				case "networkobjectdata":
				{
					if (LethalExpansion.ishost || sender != 0)
					{
						break;
					}
					string[] array3 = ((!packet.Contains('&')) ? new string[1] { packet } : packet.Split('&'));
					try
					{
						string[] array4 = array3;
						foreach (string text3 in array4)
						{
							if (text3.Contains('$'))
							{
								string[] array5 = text3.Split('$');
								ulong result2 = 0uL;
								if (array5.Length >= 2 && ulong.TryParse(array5[0], out result2) && array5[1].Contains(','))
								{
									NetworkDataManager.NetworkData[result2].serializedData = array5[1];
									LethalExpansion.Log.LogDebug((object)("networkobjectdata: " + array5[0] + " data received " + array5[1]));
								}
								else
								{
									LethalExpansion.Log.LogError((object)("networkobjectdata error " + packet));
								}
							}
							else
							{
								LethalExpansion.Log.LogError((object)("networkobjectdata error " + packet));
							}
						}
						break;
					}
					catch (Exception ex)
					{
						LethalExpansion.Log.LogError((object)ex);
						break;
					}
				}
				case "kickreason":
					if (!LethalExpansion.ishost && sender == 0)
					{
						LethalExpansion.lastKickReason = packet;
					}
					break;
				default:
					LethalExpansion.Log.LogInfo((object)"Unrecognized property.");
					break;
				}
			}
			catch (Exception ex2)
			{
				LethalExpansion.Log.LogError((object)ex2);
			}
		}
	}
	public class ComponentWhitelists
	{
		public static List<Type> mainWhitelist = new List<Type>
		{
			typeof(Transform),
			typeof(MeshFilter),
			typeof(MeshRenderer),
			typeof(SkinnedMeshRenderer),
			typeof(MeshCollider),
			typeof(BoxCollider),
			typeof(SphereCollider),
			typeof(CapsuleCollider),
			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(SI_AudioReverbPresets),
			typeof(SI_AudioReverbTrigger),
			typeof(SI_DungeonGenerator),
			typeof(SI_MatchLocalPlayerPosition),
			typeof(SI_AnimatedSun),
			typeof(SI_EntranceTeleport),
			typeof(SI_ScanNode),
			typeof(SI_DoorLock),
			typeof(SI_WaterSurface),
			typeof(SI_Ladder),
			typeof(SI_ItemDropship),
			typeof(SI_NetworkPrefabInstancier),
			typeof(SI_InteractTrigger),
			typeof(SI_DamagePlayer),
			typeof(SI_SoundYDistance),
			typeof(SI_AudioOutputInterface),
			typeof(SI_NetworkDataInterfacing),
			typeof(SI_NetworkData),
			typeof(TerrainChecker),
			typeof(PlayerShip)
		};
	}
	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, CultureInfo.InvariantCulture);
						break;
					case 'f':
						items[index].Value = float.Parse(value, CultureInfo.InvariantCulture);
						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;
			}
		}
	}
	public 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;
		}
	}
	public class NetworkPacketManager
	{
		public enum packetType
		{
			request = 0,
			data = 1,
			other = -1
		}

		private static NetworkPacketManager _instance;

		private ConcurrentDictionary<long, CancellationTokenSource> timeoutDictionary = new ConcurrentDictionary<long, CancellationTokenSource>();

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

		private NetworkPacketManager()
		{
		}

		public void sendPacket(packetType type, string header, string packet, long destination = -1L, bool waitForAnswer = true)
		{
			HUDManager.Instance.AddTextToChatOnServer($"[sync]{(int)type}|{((NetworkBehaviour)RoundManager.Instance).NetworkManager.LocalClientId}>{destination}|{header}={packet}[sync]", -1);
			if ((waitForAnswer && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ConfigManager.Instance.FindItemValue<bool>("LoadModules")) || ConfigManager.Instance.FindItemValue<bool>("KickPlayerWithoutMod"))
			{
				StartTimeout(destination);
			}
		}

		public void sendPacket(packetType type, string header, string packet, long[] destinations, bool waitForAnswer = true)
		{
			for (int i = 0; i < destina

LethalSDK.dll

Decompiled 3 months 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 DunGen;
using DunGen.Adapters;
using GameNetcodeStuff;
using LethalSDK.Component;
using LethalSDK.ScriptableObjects;
using LethalSDK.Utils;
using Unity.Netcode;
using UnityEditor;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.Networking;
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 + "NavMesh") : "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."));
			}
			if (assetPath != "Assets/Mods/" + assetPath.Replace("Assets/Mods/", string.Empty).RemoveNonAlphanumeric(4))
			{
				AssetDatabase.MoveAsset(assetPath, "Assets/Mods/" + assetPath.Replace("Assets/Mods/", string.Empty).RemoveNonAlphanumeric(4));
			}
		}
		else
		{
			AssetImporter atPath2 = AssetImporter.GetAtPath(assetPath);
			if ((Object)(object)atPath2 != (Object)null)
			{
				atPath2.assetBundleName = null;
				Debug.Log((object)(assetPath + " asset removed from asset bundle."));
			}
		}
	}

	public 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)("The folder doesn't exist : " + 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)("File deleted : " + 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", false, 100)]
	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.Destroy((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 PlayerShip : MonoBehaviour
{
	public readonly Vector3 shipPosition = new Vector3(-17.5f, 5.75f, -16.55f);

	private void Start()
	{
		Object.Destroy((Object)(object)this);
	}
}
[CustomEditor(typeof(PlayerShip))]
public class PlayerShipEditor : 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();
		PlayerShip playerShip = (PlayerShip)(object)((Editor)this).target;
		if (((Component)playerShip).transform.position != playerShip.shipPosition)
		{
			((Component)playerShip).transform.position = playerShip.shipPosition;
		}
	}
}
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];

		[SerializeField]
		private PrefabInfoPair[] _networkPrefabs = new PrefabInfoPair[0];

		[HideInInspector]
		public string serializedAudioClips;

		[HideInInspector]
		public string serializedPlanetPrefabs;

		[HideInInspector]
		public string serializedNetworkPrefabs;

		private void OnValidate()
		{
			for (int i = 0; i < _audioClips.Length; i++)
			{
				_audioClips[i].AudioClipName = _audioClips[i].AudioClipName.RemoveNonAlphanumeric(1);
				_audioClips[i].AudioClipPath = _audioClips[i].AudioClipPath.RemoveNonAlphanumeric(4);
			}
			for (int j = 0; j < _planetPrefabs.Length; j++)
			{
				_planetPrefabs[j].PlanetPrefabName = _planetPrefabs[j].PlanetPrefabName.RemoveNonAlphanumeric(1);
				_planetPrefabs[j].PlanetPrefabPath = _planetPrefabs[j].PlanetPrefabPath.RemoveNonAlphanumeric(4);
			}
			for (int k = 0; k < _networkPrefabs.Length; k++)
			{
				_networkPrefabs[k].PrefabName = _networkPrefabs[k].PrefabName.RemoveNonAlphanumeric(1);
				_networkPrefabs[k].PrefabPath = _networkPrefabs[k].PrefabPath.RemoveNonAlphanumeric(4);
			}
			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)));
			serializedNetworkPrefabs = string.Join(";", _networkPrefabs.Select((PrefabInfoPair p) => ((p.PrefabName.Length != 0) ? p.PrefabName : (((Object)(object)p.Prefab != (Object)null) ? ((Object)p.Prefab).name : "")) + "," + AssetDatabase.GetAssetPath((Object)(object)p.Prefab)));
		}

		public AudioClipInfoPair[] AudioClips()
		{
			if (serializedAudioClips != null)
			{
				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();
			}
			return new AudioClipInfoPair[0];
		}

		public bool HaveAudioClip(string audioClipName)
		{
			if (serializedAudioClips != null)
			{
				return AudioClips().Any((AudioClipInfoPair a) => a.AudioClipName == audioClipName);
			}
			return false;
		}

		public string AudioClipPath(string audioClipName)
		{
			if (serializedAudioClips != null)
			{
				return AudioClips().First((AudioClipInfoPair c) => c.AudioClipName == audioClipName).AudioClipPath;
			}
			return string.Empty;
		}

		public Dictionary<string, string> AudioClipsDictionary()
		{
			if (serializedAudioClips != null)
			{
				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;
			}
			return new Dictionary<string, string>();
		}

		public PlanetPrefabInfoPair[] PlanetPrefabs()
		{
			if (serializedPlanetPrefabs != null)
			{
				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();
			}
			return new PlanetPrefabInfoPair[0];
		}

		public bool HavePlanetPrefabs(string planetPrefabName)
		{
			if (serializedPlanetPrefabs != null)
			{
				return PlanetPrefabs().Any((PlanetPrefabInfoPair a) => a.PlanetPrefabName == planetPrefabName);
			}
			return false;
		}

		public string PlanetPrefabsPath(string planetPrefabName)
		{
			if (serializedPlanetPrefabs != null)
			{
				return PlanetPrefabs().First((PlanetPrefabInfoPair c) => c.PlanetPrefabName == planetPrefabName).PlanetPrefabPath;
			}
			return string.Empty;
		}

		public Dictionary<string, string> PlanetPrefabsDictionary()
		{
			if (serializedPlanetPrefabs != null)
			{
				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;
			}
			return new Dictionary<string, string>();
		}

		public PrefabInfoPair[] NetworkPrefabs()
		{
			if (serializedNetworkPrefabs != null)
			{
				return (from s in serializedNetworkPrefabs.Split(new char[1] { ';' })
					select s.Split(new char[1] { ',' }) into split
					where split.Length == 2
					select new PrefabInfoPair(split[0], split[1])).ToArray();
			}
			return new PrefabInfoPair[0];
		}

		public bool HaveNetworkPrefabs(string networkPrefabName)
		{
			if (serializedNetworkPrefabs != null)
			{
				return NetworkPrefabs().Any((PrefabInfoPair a) => a.PrefabName == networkPrefabName);
			}
			return false;
		}

		public string NetworkPrefabsPath(string networkPrefabName)
		{
			if (serializedNetworkPrefabs != null)
			{
				return NetworkPrefabs().First((PrefabInfoPair c) => c.PrefabName == networkPrefabName).PrefabPath;
			}
			return string.Empty;
		}

		public Dictionary<string, string> NetworkPrefabsDictionary()
		{
			if (serializedNetworkPrefabs != null)
			{
				Dictionary<string, string> dictionary = new Dictionary<string, string>();
				PrefabInfoPair[] networkPrefabs = _networkPrefabs;
				for (int i = 0; i < networkPrefabs.Length; i++)
				{
					PrefabInfoPair prefabInfoPair = networkPrefabs[i];
					dictionary.Add(prefabInfoPair.PrefabName, prefabInfoPair.PrefabPath);
				}
				return dictionary;
			}
			return new Dictionary<string, string>();
		}
	}
	[CreateAssetMenu(fileName = "ModManifest", menuName = "LethalSDK/Mod Manifest")]
	public class ModManifest : ScriptableObject
	{
		public string modName = "NewMod";

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

		[HideInInspector]
		public string serializedVersion;

		[Space]
		public string author = "Author";

		[Space]
		[TextArea(5, 15)]
		public string description = "Mod Description";

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

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

		[Space]
		public AssetBank assetBank;

		private void OnValidate()
		{
			serializedVersion = version.ToString();
		}

		public SerializableVersion GetVersion()
		{
			int[] array = ((serializedVersion != null) ? serializedVersion.Split(new char[1] { '.' }).Select(int.Parse).ToArray() : new int[4]);
			return new SerializableVersion(array[0], array[1], array[2], array[3]);
		}
	}
	[CreateAssetMenu(fileName = "New Moon", menuName = "LethalSDK/Moon")]
	public class Moon : ScriptableObject
	{
		public string MoonName = "NewMoon";

		public string[] RequiredBundles;

		public string[] IncompatibleBundles;

		public bool IsEnabled = true;

		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;

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

		public VideoClip PlanetVideo;

		public string RiskLevel = "X";

		[Range(0f, 16f)]
		public float TimeToArrive = 1f;

		[Header("Time")]
		[Range(0.1f, 5f)]
		public float DaySpeedMultiplier = 1f;

		public bool PlanetHasTime = true;

		[SerializeField]
		private RandomWeatherPair[] _RandomWeatherTypes = new RandomWeatherPair[6]
		{
			new RandomWeatherPair(LevelWeatherType.None, 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")]
		[Range(1f, 5f)]
		public float FactorySizeMultiplier = 1f;

		public int FireExitsAmountOverwrite = 1;

		[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 string[] spawnableScrapBlacklist = new string[0];

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

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

		public string LevelAmbienceClips = "Level1TypeAmbience";

		[Range(0f, 30f)]
		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}}");

		[Range(0f, 30f)]
		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}}"))
		};

		[Range(0f, 30f)]
		public int MaxOutsideEnemyPowerCount = 8;

		[Range(0f, 30f)]
		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}}");

		[Range(0f, 30f)]
		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()
		{
			RequiredBundles = RequiredBundles.RemoveNonAlphanumeric(1);
			IncompatibleBundles = IncompatibleBundles.RemoveNonAlphanumeric(1);
			MoonName = MoonName.RemoveNonAlphanumeric(1);
			OrbitPrefabName = OrbitPrefabName.RemoveNonAlphanumeric(1);
			RiskLevel = RiskLevel.RemoveNonAlphanumeric();
			RouteWord = RouteWord.RemoveNonAlphanumeric(2);
			BoughtComment = BoughtComment.RemoveNonAlphanumeric();
			LevelAmbienceClips = LevelAmbienceClips.RemoveNonAlphanumeric(1);
			TimeToArrive = Mathf.Clamp(TimeToArrive, 0f, 16f);
			DaySpeedMultiplier = Mathf.Clamp(DaySpeedMultiplier, 0.1f, 5f);
			RoutePrice = Mathf.Clamp(RoutePrice, 0, int.MaxValue);
			FactorySizeMultiplier = Mathf.Clamp(FactorySizeMultiplier, 1f, 5f);
			FireExitsAmountOverwrite = Mathf.Clamp(FireExitsAmountOverwrite, 0, 20);
			MinScrap = Mathf.Clamp(MinScrap, 0, MaxScrap);
			MaxScrap = Mathf.Clamp(MaxScrap, MinScrap, 100);
			MaxEnemyPowerCount = Mathf.Clamp(MaxEnemyPowerCount, 0, 30);
			MaxOutsideEnemyPowerCount = Mathf.Clamp(MaxOutsideEnemyPowerCount, 0, 30);
			MaxDaytimeEnemyPowerCount = Mathf.Clamp(MaxDaytimeEnemyPowerCount, 0, 30);
			SpawnProbabilityRange = Mathf.Clamp(SpawnProbabilityRange, 0f, 30f);
			DaytimeEnemiesProbabilityRange = Mathf.Clamp(DaytimeEnemiesProbabilityRange, 0f, 30f);
			for (int i = 0; i < _SpawnableScrap.Length; i++)
			{
				_SpawnableScrap[i].ObjectName = _SpawnableScrap[i].ObjectName.RemoveNonAlphanumeric(1);
			}
			for (int j = 0; j < _Enemies.Length; j++)
			{
				_Enemies[j].EnemyName = _Enemies[j].EnemyName.RemoveNonAlphanumeric(1);
			}
			for (int k = 0; k < _SpawnableMapObjects.Length; k++)
			{
				_SpawnableMapObjects[k].ObjectName = _SpawnableMapObjects[k].ObjectName.RemoveNonAlphanumeric(1);
			}
			for (int l = 0; l < _SpawnableOutsideObjects.Length; l++)
			{
				_SpawnableOutsideObjects[l].ObjectName = _SpawnableOutsideObjects[l].ObjectName.RemoveNonAlphanumeric(1);
			}
			for (int m = 0; m < _OutsideEnemies.Length; m++)
			{
				_OutsideEnemies[m].EnemyName = _OutsideEnemies[m].EnemyName.RemoveNonAlphanumeric(1);
			}
			for (int n = 0; n < _DaytimeEnemies.Length; n++)
			{
				_DaytimeEnemies[n].EnemyName = _DaytimeEnemies[n].EnemyName.RemoveNonAlphanumeric(1);
			}
			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
	{
		public string[] RequiredBundles;

		public string[] IncompatibleBundles;

		[Header("Base")]
		public ScrapType scrapType = ScrapType.Normal;

		public string itemName = "NewScrap";

		public int minValue = 0;

		public int maxValue = 0;

		public bool twoHanded = false;

		public GrabAnim HandedAnimation = GrabAnim.OneHanded;

		public bool requiresBattery = false;

		public bool isConductiveMetal = false;

		public int weight = 0;

		public GameObject prefab;

		public float useCooldown = 0f;

		[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 useGlobalSpawnWeight = true;

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

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

		public string[] planetSpawnBlacklist = new string[0];

		[Header("Shovel")]
		public int shovelHitForce = 1;

		public AudioSource shovelAudio;

		public string reelUp = "ShovelReelUp";

		public string swing = "ShovelSwing";

		public string[] hitSFX = new string[2] { "ShovelHitDefault", "ShovelHitDefault2" };

		[Header("Flashlight")]
		public bool usingPlayerHelmetLight = false;

		public int flashlightInterferenceLevel = 0;

		public Light flashlightBulb;

		public Light flashlightBulbGlow;

		public AudioSource flashlightAudio;

		public string[] flashlightClips = new string[1] { "FlashlightClick" };

		public string outOfBatteriesClip = "FlashlightOutOfBatteries";

		public string flashlightFlicker = "FlashlightFlicker";

		public Material bulbLight;

		public Material bulbDark;

		public MeshRenderer flashlightMesh;

		public int flashlightTypeID = 0;

		public bool changeMaterial = true;

		[Header("Noisemaker")]
		public AudioSource noiseAudio;

		public AudioSource noiseAudioFar;

		public string[] noiseSFX = new string[1] { "ClownHorn1" };

		public string[] noiseSFXFar = new string[1] { "ClownHornFar" };

		public float noiseRange = 60f;

		public float maxLoudness = 1f;

		public float minLoudness = 0.6f;

		public float minPitch = 0.93f;

		public float maxPitch = 1f;

		public Animator triggerAnimator;

		[Header("WhoopieCushion")]
		public AudioSource whoopieCushionAudio;

		public string[] fartAudios = new string[4] { "Fart1", "Fart2", "Fart3", "Fart5" };

		[HideInInspector]
		public string serializedData;

		private void OnValidate()
		{
			RequiredBundles = RequiredBundles.RemoveNonAlphanumeric(1);
			IncompatibleBundles = IncompatibleBundles.RemoveNonAlphanumeric(1);
			itemName = itemName.RemoveNonAlphanumeric(1);
			grabSFX = grabSFX.RemoveNonAlphanumeric(1);
			dropSFX = dropSFX.RemoveNonAlphanumeric(1);
			for (int i = 0; i < _perPlanetSpawnWeight.Length; i++)
			{
				_perPlanetSpawnWeight[i].SceneName = _perPlanetSpawnWeight[i].SceneName.RemoveNonAlphanumeric(1);
			}
			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();
		}
	}
	public enum ScrapType
	{
		Normal,
		Shovel,
		Flashlight,
		Noisemaker,
		WhoopieCushion
	}
	public enum GrabAnim
	{
		OneHanded,
		TwoHanded,
		Shotgun,
		Jetpack,
		Clipboard
	}
}
namespace LethalSDK.Utils
{
	public static class AssetGatherDialog
	{
		public static Dictionary<string, AudioClip> audioClips = new Dictionary<string, AudioClip>();

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

		public static Dictionary<string, Sprite> sprites = new Dictionary<string, Sprite>();
	}
	[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;
		}
	}
	public static class NetworkDataManager
	{
		public static Dictionary<ulong, SI_NetworkData> NetworkData = new Dictionary<ulong, SI_NetworkData>();
	}
	public class SI_NetworkData : NetworkBehaviour
	{
		public StringStringPair[] data = new StringStringPair[0];

		[HideInInspector]
		public string serializedData = string.Empty;

		public string datacache = string.Empty;

		public UnityEvent dataChangeEvent = new UnityEvent();

		public void Start()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			if (dataChangeEvent != null)
			{
				dataChangeEvent.AddListener(new UnityAction(OnDataChanged));
			}
		}

		public void Update()
		{
			if (datacache != serializedData && dataChangeEvent != null)
			{
				dataChangeEvent.Invoke();
			}
		}

		public override void OnNetworkSpawn()
		{
			NetworkDataManager.NetworkData.Add(((NetworkBehaviour)this).NetworkObjectId, this);
		}

		public override void OnNetworkDespawn()
		{
			NetworkDataManager.NetworkData.Remove(((NetworkBehaviour)this).NetworkObjectId);
		}

		public virtual void OnDataChanged()
		{
			datacache = serializedData;
		}

		public override void OnDestroy()
		{
			if (dataChangeEvent != null)
			{
				((UnityEventBase)dataChangeEvent).RemoveAllListeners();
			}
		}

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

		public virtual void setData(string datastring)
		{
			if (!Enumerable.Contains(datastring, ','))
			{
				Debug.LogWarning((object)"Invalid datastring format.");
			}
			else
			{
				serializedData = datastring;
			}
		}

		public virtual void setData(StringStringPair[] dataarray)
		{
			string source = string.Join(";", dataarray.Select((StringStringPair p) => p._string1 + "," + p._string2));
			if (!Enumerable.Contains(source, ','))
			{
				Debug.LogWarning((object)"Invalid datastring format.");
			}
			else
			{
				serializedData = source;
			}
		}

		public virtual void addData(string datastring)
		{
			if (!Enumerable.Contains(datastring, ','))
			{
				Debug.LogWarning((object)"Invalid datastring format.");
				return;
			}
			serializedData += datastring;
			serializedData = serializedData.Replace(";;", string.Empty);
			if (serializedData.StartsWith(";"))
			{
				serializedData = serializedData.Substring(1);
			}
			if (serializedData.EndsWith(";"))
			{
				serializedData = serializedData.Substring(0, serializedData.Length - 1);
			}
		}

		public virtual void addData(StringStringPair[] dataarray)
		{
			string text = string.Join(";", dataarray.Select((StringStringPair p) => p._string1 + "," + p._string2)).Insert(0, ";");
			if (!Enumerable.Contains(text, ','))
			{
				Debug.LogWarning((object)"Invalid datastring format.");
				return;
			}
			serializedData += text;
			serializedData = serializedData.Replace(";;", string.Empty);
			if (serializedData.StartsWith(";"))
			{
				serializedData = serializedData.Substring(1);
			}
			if (serializedData.EndsWith(";"))
			{
				serializedData = serializedData.Substring(0, serializedData.Length - 1);
			}
		}

		public virtual void delData(string datastring)
		{
			if (!Enumerable.Contains(datastring, ','))
			{
				Debug.LogWarning((object)"Invalid datastring format.");
				return;
			}
			if (!serializedData.Contains(datastring))
			{
				Debug.Log((object)"Datastring doesn't exist in serializedData.");
				return;
			}
			serializedData = serializedData.Replace(datastring, string.Empty);
			serializedData = serializedData.Replace(";;", string.Empty);
			if (serializedData.StartsWith(";"))
			{
				serializedData = serializedData.Substring(1);
			}
			if (serializedData.EndsWith(";"))
			{
				serializedData = serializedData.Substring(0, serializedData.Length - 1);
			}
		}

		public virtual void delData(StringStringPair[] dataarray)
		{
			string text = string.Join(";", dataarray.Select((StringStringPair p) => p._string1 + "," + p._string2)).Insert(0, ";");
			if (!Enumerable.Contains(text, ','))
			{
				Debug.LogWarning((object)"Invalid datastring format.");
				return;
			}
			if (!serializedData.Contains(text))
			{
				Debug.Log((object)"Datastring doesn't exist in serializedData.");
				return;
			}
			serializedData = serializedData.Replace(text, string.Empty);
			serializedData = serializedData.Replace(";;", string.Empty);
			if (serializedData.StartsWith(";"))
			{
				serializedData = serializedData.Substring(1);
			}
			if (serializedData.EndsWith(";"))
			{
				serializedData = serializedData.Substring(0, serializedData.Length - 1);
			}
		}
	}
	[Serializable]
	public struct StringIntPair
	{
		public string _string;

		public int _int;

		public StringIntPair(string _string, int _int)
		{
			this._string = _string.RemoveNonAlphanumeric(1);
			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.RemoveNonAlphanumeric(1);
			this._string2 = _string2.RemoveNonAlphanumeric(1);
		}
	}
	[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.RemoveNonAlphanumeric(1);
			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.RemoveNonAlphanumeric(1);
			SpawnFacingAwayFromWall = spawnFacingAwayFromWall;
			SpawnRate = spawnRate;
		}
	}
	[Serializable]
	public struct SpawnableOutsideObjectPair
	{
		public string ObjectName;

		public AnimationCurve SpawnRate;

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

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

		public SpawnableEnemiesPair(string enemyName, int spawnWeight)
		{
			EnemyName = enemyName.RemoveNonAlphanumeric(1);
			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.RemoveNonAlphanumeric(1);
			SpawnWeight = Mathf.Clamp(spawnWeight, 0, 100);
		}
	}
	[Serializable]
	public struct ScrapInfoPair
	{
		public string ScrapPath;

		public Scrap Scrap;

		public ScrapInfoPair(string scrapPath, Scrap scrap)
		{
			ScrapPath = scrapPath.RemoveNonAlphanumeric(4);
			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.RemoveNonAlphanumeric(1);
			AudioClipPath = audioClipPath.RemoveNonAlphanumeric(4);
			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.RemoveNonAlphanumeric(1);
			PlanetPrefabPath = planetPrefabPath.RemoveNonAlphanumeric(4);
			PlanetPrefab = null;
		}
	}
	[Serializable]
	public struct PrefabInfoPair
	{
		public string PrefabName;

		[HideInInspector]
		public string PrefabPath;

		[SerializeField]
		public GameObject Prefab;

		public PrefabInfoPair(string prefabName, string prefabPath)
		{
			PrefabName = prefabName.RemoveNonAlphanumeric(1);
			PrefabPath = prefabPath.RemoveNonAlphanumeric(4);
			Prefab = 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;
			}
		}
	}
	public static class TypeExtensions
	{
		public enum removeType
		{
			Normal,
			Serializable,
			Keyword,
			Path,
			SerializablePath
		}

		public static readonly Dictionary<removeType, string> regexes = new Dictionary<removeType, string>
		{
			{
				removeType.Normal,
				"[^a-zA-Z0-9 ,.!?_-]"
			},
			{
				removeType.Serializable,
				"[^a-zA-Z0-9 .!_-]"
			},
			{
				removeType.Keyword,
				"[^a-zA-Z0-9._-]"
			},
			{
				removeType.Path,
				"[^a-zA-Z0-9 ,.!_/-]"
			},
			{
				removeType.SerializablePath,
				"[^a-zA-Z0-9 .!_/-]"
			}
		};

		public static string RemoveNonAlphanumeric(this string input)
		{
			if (input != null)
			{
				return Regex.Replace(input, regexes[removeType.Normal], string.Empty);
			}
			return string.Empty;
		}

		public static string[] RemoveNonAlphanumeric(this string[] input)
		{
			if (input != null)
			{
				for (int i = 0; i < input.Length; i++)
				{
					input[i] = Regex.Replace(input[i], regexes[removeType.Normal], string.Empty);
				}
				return input;
			}
			return new string[0];
		}

		public static string RemoveNonAlphanumeric(this string input, removeType removeType = removeType.Normal)
		{
			if (input != null)
			{
				return Regex.Replace(input, regexes[removeType], string.Empty);
			}
			return string.Empty;
		}

		public static string[] RemoveNonAlphanumeric(this string[] input, removeType removeType = removeType.Normal)
		{
			if (input != null)
			{
				for (int i = 0; i < input.Length; i++)
				{
					input[i] = Regex.Replace(input[i], regexes[removeType], string.Empty);
				}
				return input;
			}
			return new string[0];
		}

		public static string RemoveNonAlphanumeric(this string input, int removeType = 0)
		{
			if (input != null)
			{
				return Regex.Replace(input, regexes[(removeType)removeType], string.Empty);
			}
			return string.Empty;
		}

		public static string[] RemoveNonAlphanumeric(this string[] input, int removeType = 0)
		{
			if (input != null)
			{
				for (int i = 0; i < input.Length; i++)
				{
					input[i] = Regex.Replace(input[i], regexes[(removeType)removeType], string.Empty);
				}
				return input;
			}
			return new string[0];
		}
	}
}
namespace LethalSDK.Editor
{
	internal class CopyrightsWindow : EditorWindow
	{
		private Vector2 scrollPosition;

		private readonly Dictionary<string, string> assetAuthorList = new Dictionary<string, string>
		{
			{ "Drop Ship assets, Sun cycle animations, ScrapItem sprite, ScavengerSuit Textures/Arms Mesh and MonitorWall mesh", "Zeekerss" },
			{ "SDK Scripts, Sun Texture, CrossButton Sprite (Inspired of vanilla), OldSeaPort planet prefab texture", "HolographicWings" },
			{ "Old Sea Port asset package", "VIVID Arts" },
			{ "Survival Game Tools asset package", "cookiepopworks.com" }
		};

		[MenuItem("LethalSDK/Copyrights", false, 999)]
		public static void ShowWindow()
		{
			EditorWindow.GetWindow<CopyrightsWindow>("Copyrights");
		}

		private void OnGUI()
		{
			//IL_0018: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("List of Copyrights", EditorStyles.boldLabel, Array.Empty<GUILayoutOption>());
			scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty<GUILayoutOption>());
			EditorGUILayout.Space(5f);
			foreach (KeyValuePair<string, string> assetAuthor in assetAuthorList)
			{
				GUILayout.Label("Asset: " + assetAuthor.Key + " - By: " + assetAuthor.Value, EditorStyles.wordWrappedLabel, Array.Empty<GUILayoutOption>());
				EditorGUILayout.Space(2f);
			}
			EditorGUILayout.Space(5f);
			GUILayout.Label("This SDK do not embed any Vanilla script.", Array.Empty<GUILayoutOption>());
			GUILayout.EndScrollView();
		}
	}
	public class EditorChecker : Editor
	{
		public override void OnInspectorGUI()
		{
			((Editor)this).DrawDefaultInspector();
		}
	}
	[CustomEditor(typeof(ModManifest))]
	public class ModManifestEditor : EditorChecker
	{
		public override void OnInspectorGUI()
		{
			ModManifest modManifest = (ModManifest)(object)((Editor)this).target;
			if (modManifest.serializedVersion == "0.0.0.0")
			{
				EditorGUILayout.HelpBox("Please define a version to your mod and don't forget to increment it at each update.", (MessageType)2);
			}
			if (modManifest.modName == null || modManifest.modName.Length == 0)
			{
				EditorGUILayout.HelpBox("Your mod need a name.", (MessageType)3);
			}
			IEnumerable<string> enumerable = from e in modManifest.scraps.Where((Scrap e) => (Object)(object)e != (Object)null).ToList()
				group e by e.itemName into g
				where g.Count() > 1
				select g.Key;
			if (enumerable.Any())
			{
				string text = string.Empty;
				foreach (string item in enumerable)
				{
					text = text + item + ",";
				}
				text = text.Remove(text.Length - 1);
				EditorGUILayout.HelpBox("You are trying to register two times or more the same Scraps. Duplicated Scraps are: " + text, (MessageType)2);
			}
			IEnumerable<string> enumerable2 = from e in modManifest.moons.Where((Moon e) => (Object)(object)e != (Object)null).ToList()
				group e by e.MoonName into g
				where g.Count() > 1
				select g.Key;
			if (enumerable2.Any())
			{
				string text2 = string.Empty;
				foreach (string item2 in enumerable2)
				{
					text2 = text2 + item2 + ",";
				}
				text2 = text2.Remove(text2.Length - 1);
				EditorGUILayout.HelpBox("You are trying to register two times or more the same Moons. Duplicated Moons are: " + text2, (MessageType)2);
			}
			string text3 = string.Empty;
			Scrap[] scraps = modManifest.scraps;
			foreach (Scrap scrap in scraps)
			{
				if ((Object)(object)scrap != (Object)null && AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)scrap)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest)))
				{
					text3 = text3 + ((Object)scrap).name + ",";
				}
			}
			Moon[] moons = modManifest.moons;
			foreach (Moon moon in moons)
			{
				if ((Object)(object)moon != (Object)null && AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)moon)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest)))
				{
					text3 = text3 + ((Object)moon).name + ",";
				}
			}
			if (text3 != null && text3.Length > 0)
			{
				text3 = text3.Remove(text3.Length - 1);
				EditorGUILayout.HelpBox("You try to register a Scrap or a Moon from another mod folder. " + text3, (MessageType)2);
			}
			if ((Object)(object)modManifest.assetBank != (Object)null && AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest.assetBank)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest)))
			{
				EditorGUILayout.HelpBox("You try to register an AssetBank from another mod folder.", (MessageType)2);
			}
			base.OnInspectorGUI();
		}
	}
	[CustomEditor(typeof(AssetBank))]
	public class AssetBankEditor : EditorChecker
	{
		public override void OnInspectorGUI()
		{
			AssetBank assetBank = (AssetBank)(object)((Editor)this).target;
			IEnumerable<string> enumerable = from e in (from e in assetBank.AudioClips()
					where e.AudioClipName != null && e.AudioClipName.Length > 0
					select e).ToList()
				group e by e.AudioClipName into g
				where g.Count() > 1
				select g.Key;
			if (enumerable.Any())
			{
				string text = string.Empty;
				foreach (string item in enumerable)
				{
					text = text + item + ",";
				}
				text = text.Remove(text.Length - 1);
				EditorGUILayout.HelpBox("You are trying to register two times or more the same Audio Clip. Duplicated Clips are: " + text, (MessageType)2);
			}
			IEnumerable<string> enumerable2 = from e in (from e in assetBank.PlanetPrefabs()
					where e.PlanetPrefabName != null && e.PlanetPrefabName.Length > 0
					select e).ToList()
				group e by e.PlanetPrefabName into g
				where g.Count() > 1
				select g.Key;
			if (enumerable2.Any())
			{
				string text2 = string.Empty;
				foreach (string item2 in enumerable2)
				{
					text2 = text2 + item2 + ",";
				}
				text2 = text2.Remove(text2.Length - 1);
				EditorGUILayout.HelpBox("You are trying to register two times or more the same Planet Prefabs. Duplicated Planet Prefabs are: " + text2, (MessageType)2);
			}
			string text3 = string.Empty;
			AudioClipInfoPair[] array = assetBank.AudioClips();
			for (int i = 0; i < array.Length; i++)
			{
				AudioClipInfoPair audioClipInfoPair = array[i];
				if (audioClipInfoPair.AudioClipName != null && audioClipInfoPair.AudioClipName.Length > 0 && AssetModificationProcessor.ExtractBundleNameFromPath(audioClipInfoPair.AudioClipPath) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)assetBank)))
				{
					text3 = text3 + audioClipInfoPair.AudioClipName + ",";
				}
			}
			PlanetPrefabInfoPair[] array2 = assetBank.PlanetPrefabs();
			for (int j = 0; j < array2.Length; j++)
			{
				PlanetPrefabInfoPair planetPrefabInfoPair = array2[j];
				if (planetPrefabInfoPair.PlanetPrefabName != null && planetPrefabInfoPair.PlanetPrefabName.Length > 0 && AssetModificationProcessor.ExtractBundleNameFromPath(planetPrefabInfoPair.PlanetPrefabPath) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)assetBank)))
				{
					text3 = text3 + planetPrefabInfoPair.PlanetPrefabName + ",";
				}
			}
			if (text3 != null && text3.Length > 0)
			{
				text3 = text3.Remove(text3.Length - 1);
				EditorGUILayout.HelpBox("You try to register an Audio Clip or a Planet Prefab from another mod folder. " + text3, (MessageType)2);
			}
			base.OnInspectorGUI();
		}
	}
	[CustomEditor(typeof(SI_DungeonGenerator))]
	public class SI_DungeonGeneratorEditor : EditorChecker
	{
		public override void OnInspectorGUI()
		{
			SI_DungeonGenerator sI_DungeonGenerator = (SI_DungeonGenerator)(object)((Editor)this).target;
			string assetPath = AssetDatabase.GetAssetPath((Object)(object)sI_DungeonGenerator.DungeonRoot);
			if (assetPath != null && assetPath.Length > 0)
			{
				EditorGUILayout.HelpBox("Dungeon Root must be in the scene.", (MessageType)3);
			}
			base.OnInspectorGUI();
		}
	}
	[CustomEditor(typeof(SI_ScanNode))]
	public class SI_ScanNodeEditor : EditorChecker
	{
		public override void OnInspectorGUI()
		{
			SI_ScanNode sI_ScanNode = (SI_ScanNode)(object)((Editor)this).target;
			if (sI_ScanNode.MinRange > sI_ScanNode.MaxRange)
			{
				EditorGUILayout.HelpBox("Min Range must be smaller than Max Ranger.", (MessageType)3);
			}
			if (sI_ScanNode.CreatureScanID < -1)
			{
				EditorGUILayout.HelpBox("Creature Scan ID can't be less than -1.", (MessageType)2);
			}
			base.OnInspectorGUI();
		}
	}
	[CustomEditor(typeof(SI_AnimatedSun))]
	public class SI_AnimatedSunEditor : EditorChecker
	{
		public override void OnInspectorGUI()
		{
			SI_AnimatedSun sI_AnimatedSun = (SI_AnimatedSun)(object)((Editor)this).target;
			if ((Object)(object)sI_AnimatedSun.directLight == (Object)null || (Object)(object)sI_AnimatedSun.indirectLight == (Object)null)
			{
				EditorGUILayout.HelpBox("A direct and an indirect light must be defined.", (MessageType)2);
			}
			if ((Object)(object)((Component)sI_AnimatedSun.directLight).transform.parent != (Object)(object)((Component)sI_AnimatedSun).transform || (Object)(object)((Component)sI_AnimatedSun.indirectLight).transform.parent != (Object)(object)((Component)sI_AnimatedSun).transform)
			{
				EditorGUILayout.HelpBox("Direct and an indirect light must be a child of the AnimatedSun in the hierarchy.", (MessageType)2);
			}
			base.OnInspectorGUI();
		}
	}
	[CustomEditor(typeof(SI_EntranceTeleport))]
	public class SI_EntranceTeleportEditor : EditorChecker
	{
		public override void OnInspectorGUI()
		{
			SI_EntranceTeleport sI_EntranceTeleport = (SI_EntranceTeleport)(object)((Editor)this).target;
			IEnumerable<int> enumerable = from e in Object.FindObjectsOfType<SI_EntranceTeleport>().ToList()
				group e by e.EntranceID into g
				where g.Count() > 1
				select g.Key;
			if (enumerable.Any())
			{
				string text = string.Empty;
				foreach (int item in enumerable)
				{
					text += $"{item},";
				}
				text = text.Remove(text.Length - 1);
				EditorGUILayout.HelpBox("Two entrances or more have same Entrance ID. Duplicated entrances are: " + text, (MessageType)2);
			}
			if ((Object)(object)sI_EntranceTeleport.EntrancePoint == (Object)null)
			{
				EditorGUILayout.HelpBox("An entrance point must be defined.", (MessageType)3);
			}
			if (sI_EntranceTeleport.AudioReverbPreset < 0)
			{
				EditorGUILayout.HelpBox("Audio Reverb Preset can't be negative.", (MessageType)3);
			}
			base.OnInspectorGUI();
		}
	}
	[CustomEditor(typeof(Scrap))]
	public class ScrapEditor : EditorChecker
	{
		public override void OnInspectorGUI()
		{
			Scrap scrap = (Scrap)(object)((Editor)this).target;
			if ((Object)(object)scrap.prefab == (Object)null)
			{
				EditorGUILayout.HelpBox("You must add a Prefab to your Scrap.", (MessageType)1);
			}
			else
			{
				if ((Object)(object)scrap.prefab.GetComponent<NetworkObject>() == (Object)null)
				{
					EditorGUILayout.HelpBox("The Prefab must have a NetworkObject.", (MessageType)3);
				}
				else
				{
					NetworkObject component = scrap.prefab.GetComponent<NetworkObject>();
					string text = string.Empty;
					if (component.AlwaysReplicateAsRoot)
					{
						text += "\n- AlwaysReplicateAsRoot should be false.";
					}
					if (!component.SynchronizeTransform)
					{
						text += "\n- SynchronizeTransform should be true.";
					}
					if (component.ActiveSceneSynchronization)
					{
						text += "\n- ActiveSceneSynchronization should be false.";
					}
					if (!component.SceneMigrationSynchronization)
					{
						text += "\n- SceneMigrationSynchronization should be true.";
					}
					if (!component.SpawnWithObservers)
					{
						text += "\n- SpawnWithObservers should be true.";
					}
					if (!component.DontDestroyWithOwner)
					{
						text += "\n- DontDestroyWithOwner should be true.";
					}
					if (component.AutoObjectParentSync)
					{
						text += "\n- AutoObjectParentSync should be false.";
					}
					if (text.Length > 0)
					{
						EditorGUILayout.HelpBox("The NetworkObject of the Prefab have incorrect settings: " + text, (MessageType)2);
					}
				}
				if ((Object)(object)scrap.prefab.GetComponent<MeshFilter>() == (Object)null)
				{
					EditorGUILayout.HelpBox("The Prefab don't have a MeshFilter.", (MessageType)3);
				}
				if ((Object)(object)scrap.prefab.transform.Find("ScanNode") == (Object)null)
				{
					EditorGUILayout.HelpBox("The Prefab don't have a ScanNode.", (MessageType)2);
				}
				if (AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)scrap.prefab)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)scrap)))
				{
					EditorGUILayout.HelpBox("The Prefab must come from the same mod folder as your Scrap.", (MessageType)2);
				}
			}
			if (scrap.itemName == null || scrap.itemName.Length == 0)
			{
				EditorGUILayout.HelpBox("Your scrap must have a Name.", (MessageType)3);
			}
			if (!scrap.useGlobalSpawnWeight && !scrap.perPlanetSpawnWeight().Any((ScrapSpawnChancePerScene w) => w.SceneName != null && w.SceneName.Length > 0))
			{
				EditorGUILayout.HelpBox("Your scrap use Per Planet Spawn Weight but no planet are defined.", (MessageType)2);
			}
			base.OnInspectorGUI();
		}
	}
	[CustomEditor(typeof(Moon))]
	public class MoonEditor : EditorChecker
	{
		public override void OnInspectorGUI()
		{
			Moon moon = (Moon)(object)((Editor)this).target;
			if (moon.MoonName == null || moon.MoonName.Length == 0)
			{
				EditorGUILayout.HelpBox("Your moon must have a Name.", (MessageType)3);
			}
			if (moon.PlanetName == null || moon.PlanetName.Length == 0)
			{
				EditorGUILayout.HelpBox("Your moon must have a Planet Name.", (MessageType)3);
			}
			if (moon.RouteWord == null || moon.RouteWord.Length < 3)
			{
				EditorGUILayout.HelpBox("Your moon route word must be at least 3 characters long.", (MessageType)3);
			}
			if ((Object)(object)moon.MainPrefab == (Object)null)
			{
				EditorGUILayout.HelpBox("You must add a Main Prefab to your Scrap.", (MessageType)1);
			}
			else if (AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)moon.MainPrefab)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)moon)))
			{
				EditorGUILayout.HelpBox("The Main Prefab must come from the same mod folder as your Moon.", (MessageType)2);
			}
			base.OnInspectorGUI();
		}
	}
	[CustomEditor(typeof(SI_DoorLock))]
	public class SI_DoorLockEditor : EditorChecker
	{
		public override void OnInspectorGUI()
		{
			SI_DoorLock sI_DoorLock = (SI_DoorLock)(object)((Editor)this).target;
			EditorGUILayout.HelpBox("DoorLock is not implemented yet.", (MessageType)1);
			base.OnInspectorGUI();
		}
	}
	[CustomEditor(typeof(SI_Ladder))]
	public class SI_LadderEditor : EditorChecker
	{
		public override void OnInspectorGUI()
		{
			SI_Ladder sI_Ladder = (SI_Ladder)(object)((Editor)this).target;
			EditorGUILayout.HelpBox("Ladder is experimental.", (MessageType)1);
			base.OnInspectorGUI();
		}
	}
	[InitializeOnLoad]
	[CustomEditor(typeof(TerrainChecker))]
	public class TerrainCheckerEditor : EditorChecker
	{
		static TerrainCheckerEditor()
		{
			Selection.selectionChanged = (Action)Delegate.Combine(Selection.selectionChanged, new Action(OnSelectionChanged));
		}

		private static void OnSelectionChanged()
		{
			if (Object.op_Implicit((Object)(object)Selection.activeGameObject) && Object.op_Implicit((Object)(object)Selection.activeGameObject.GetComponent<Terrain>()))
			{
				Terrain component = Selection.activeGameObject.GetComponent<Terrain>();
				if (!Object.op_Implicit((Object)(object)((Component)component).gameObject.GetComponent<TerrainChecker>()))
				{
					((Component)component).gameObject.AddComponent<TerrainChecker>();
				}
			}
		}

		public override void OnInspectorGUI()
		{
			TerrainChecker terrainChecker = (TerrainChecker)(object)((Editor)this).target;
			if ((Object)(object)terrainChecker.terrain != (Object)null)
			{
				int num = 1024;
				if ((terrainChecker.terrain.renderingLayerMask & num) == 0)
				{
					EditorGUILayout.HelpBox("Quicksand will not show on this terrain, to fix you must enable the '10: Decal Layer 2' in Terrain Settings > Rendering Layer Mask.", (MessageType)2);
				}
				if ((Object)(object)terrainChecker.terrain.materialTemplate != (Object)null && ((Object)terrainChecker.terrain.materialTemplate.shader).name != "HDRP/UpdatedTerrainLit")
				{
					EditorGUILayout.HelpBox("To use Terrain Holes, you must change the material of the terrain with another one that use the HDRP/UpdatedTerrainLit shader in Terrain Settings > Basic Terrain > Material.", (MessageType)1);
				}
				if (!terrainChecker.terrain.drawInstanced)
				{
					EditorGUILayout.HelpBox("For performances with a lot of trees, grass and other details, it's recommended to enable Terrain Settings > Basic Terrain > Draw Instanced.", (MessageType)1);
				}
			}
		}
	}
	internal class OldAssetsRemover
	{
		private static readonly List<string> assetPaths = new List<string>
		{
			"Assets/LethalCompanyAssets", "Assets/Mods/LethalExpansion/Audio", "Assets/Mods/LethalExpansion/AudioMixerController", "Assets/Mods/LethalExpansion/Materials/Default.mat", "Assets/Mods/LethalExpansion/Prefabs/Settings", "Assets/Mods/LethalExpansion/Prefabs/EntranceTeleportA.prefab", "Assets/Mods/LethalExpansion/Prefabs/Prefabs.zip", "Assets/Mods/LethalExpansion/Scenes/ItemPlaceTest", "Assets/Mods/LethalExpansion/Sprites/HandIcon.png", "Assets/Mods/LethalExpansion/Sprites/HandIconPoint.png",
			"Assets/Mods/LethalExpansion/Sprites/HandLadderIcon.png", "Assets/Mods/TemplateMod/Moons/NavMesh-Environment.asset", "Assets/Mods/TemplateMod/Moons/OldSeaPort.asset", "Assets/Mods/TemplateMod/Moons/Sky and Fog Global Volume Profile.asset", "Assets/Mods/TemplateMod/Moons/Sky and Fog Global Volume Profile 1.asset", "Assets/Mods/TemplateMod/AssetBank.asset", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunCompanyLevel.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeB.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeBEclipse.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeBStormy.anim",
			"Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeC.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeCEclipse.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeCStormy.anim", "Assets/Mods/LethalExpansion/Skybox", "Assets/Mods/LethalExpansion/Sprites/XButton.png", "Assets/Mods/LethalExpansion/Textures/sunTexture1.png", "Assets/Mods/OldSeaPort/Materials/Maple_bark_1.mat", "Assets/Mods/OldSeaPort/Materials/maple_leaves.mat", "Assets/Mods/TemplateMod/AssetBank.asset", "Assets/Mods/OldSeaPort/EffectExamples/Shared/Scripts",
			"Assets/Mods/OldSeaPort/scenes", "Assets/Mods/OldSeaPort/prefabs/Plane (12).prefab", "Assets/Mods/LethalExpansion/Meshes/labyrinth.fbx", "Assets/Mods/ChristmasVillage/christmas-assets-free/fbx/Materials", "Assets/Mods/OldSeaPort/effectexamples/profiles", "Assets/Mods/OldSeaPort/effectexamples/shared/animation", "Assets/Mods/OldSeaPort/effectexamples/shared/fonts", "Assets/Mods/OldSeaPort/effectexamples/shared/shaders", "Assets/Mods/OldSeaPort/effectexamples/shared/sprites"
		};

		[InitializeOnLoadMethod]
		public static void CheckOldAssets()
		{
			foreach (string assetPath in assetPaths)
			{
				if (AssetDatabase.IsValidFolder(assetPath))
				{
					DeleteFolder(assetPath);
				}
				else if ((Object)(object)AssetDatabase.LoadAssetAtPath<GameObject>(assetPath) != (Object)null)
				{
					DeleteAsset(assetPath);
				}
			}
		}

		private static void DeleteFolder(string path)
		{
			if (AssetDatabase.DeleteAsset(path))
			{
				Debug.Log((object)("Deleted folder at: " + path));
			}
			else
			{
				Debug.LogError((object)("Failed to delete folder at: " + path));
			}
		}

		private static void DeleteAsset(string path)
		{
			if (AssetDatabase.DeleteAsset(path))
			{
				Debug.Log((object)("Deleted asset at: " + path));
			}
			else
			{
				Debug.LogError((object)("Failed to delete asset at: " + path));
			}
		}
	}
	public class VersionChecker : Editor
	{
		[InitializeOnLoadMethod]
		public static void CheckVersion()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			UnityWebRequest www = UnityWebRequest.Get("https://raw.githubusercontent.com/HolographicWings/LethalSDK-Unity-Project/main/last.txt");
			UnityWebRequestAsyncOperation operation = www.SendWebRequest();
			CallbackFunction callback = null;
			callback = (CallbackFunction)delegate
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Expected O, but got Unknown
				if (((AsyncOperation)operation).isDone)
				{
					EditorApplication.update = (CallbackFunction)Delegate.Remove((Delegate?)(object)EditorApplication.update, (Delegate?)(object)callback);
					OnRequestComplete(www);
				}
			};
			EditorApplication.update = (CallbackFunction)Delegate.Combine((Delegate?)(object)EditorApplication.update, (Delegate?)(object)callback);
		}

		private static void OnRequestComplete(UnityWebRequest www)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			if ((int)www.result == 2 || (int)www.result == 3)
			{
				Debug.LogError((object)("Error when getting last version number: " + www.error));
			}
			else
			{
				CompareVersions(www.downloadHandler.text);
			}
		}

		private static void CompareVersions(string onlineVersion)
		{
			if (Version.Parse(PlayerSettings.bundleVersion) < Version.Parse(onlineVersion) && EditorUtility.DisplayDialogComplex("Warning", "The SDK is not up to date: " + onlineVersion, "Update", "Ignore", "") == 0)
			{
				Application.OpenURL("https://thunderstore.io/c/lethal-company/p/HolographicWings/LethalSDK/");
			}
		}
	}
	internal class LethalSDKCategory : EditorWindow
	{
		[MenuItem("LethalSDK/Lethal SDK v1.3.0", 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", false, 100)]
		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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			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);
			if (assetBundleDirectory != null || assetBundleDirectory.Length != 0 || assetBundleDirectory != string.Empty)
			{
				AssetBundleManifest val3 = null;
				try
				{
					val3 = BuildPipeline.BuildAssetBundles(assetBundleDirectory, val, val2);
				}
				catch (Exception ex)
				{
					Debug.LogError((object)ex.Message);
				}
				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.");
			}
		}

		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);
		}
	}
	[RequireComponent(typeof(Terrain))]
	public class TerrainChecker : MonoBehaviour
	{
		[HideInInspector]
		public Terrain terrain;

		private void OnDrawGizmosSelected()
		{
			terrain = ((Component)this).GetComponent<Terrain>();
		}

		private void Awake()
		{
			Object.Destroy((Object)(object)this);
		}
	}
}
namespace LethalSDK.Component
{
	[AddComponentMenu("LethalSDK/DamagePlayer")]
	public class SI_DamagePlayer : MonoBehaviour
	{
		public bool kill = false;

		public bool dontSpawnBody = false;

		public SI_CauseOfDeath causeOfDeath = SI_CauseOfDeath.Gravity;

		public int damages = 25;

		public int numberIterations = 1;

		public int iterationCooldown = 1000;

		public int warmupCooldown = 0;

		public UnityEvent postEvent = new UnityEvent();

		public void Trigger(object player)
		{
			if (kill)
			{
				((MonoBehaviour)this).StartCoroutine(Kill(player));
			}
			else
			{
				((MonoBehaviour)this).StartCoroutine(Damage(player));
			}
		}

		public IEnumerator Kill(object player)
		{
			yield return (object)new WaitForSeconds((float)warmupCooldown / 1000f);
			((PlayerControllerB)((player is PlayerControllerB) ? player : null)).KillPlayer(Vector3.zero, !dontSpawnBody, (CauseOfDeath)causeOfDeath, 0);
			postEvent.Invoke();
		}

		public IEnumerator Damage(object player)
		{
			yield return (object)new WaitForSeconds((float)warmupCooldown / 1000f);
			int iteration = 0;
			while (iteration < numberIterations || numberIterations == -1)
			{
				((PlayerControllerB)((player is PlayerControllerB) ? player : null)).DamagePlayer(damages, true, true, (CauseOfDeath)causeOfDeath, 0, false, Vector3.zero);
				postEvent.Invoke();
				iteration++;
				yield return (object)new WaitForSeconds((float)iterationCooldown / 1000f);
			}
		}

		public void StopCounter(object player)
		{
			((MonoBehaviour)this).StopAllCoroutines();
		}
	}
	[AddComponentMenu("LethalSDK/SoundYDistance")]
	public class SI_SoundYDistance : MonoBehaviour
	{
		public AudioSource audioSource;

		public int maxDistance = 50;

		public void Awake()
		{
			if ((Object)(object)audioSource == (Object)null)
			{
				audioSource = ((Component)this).gameObject.GetComponent<AudioSource>();
				if ((Object)(object)audioSource == (Object)null)
				{
					audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
				}
			}
		}

		public void Update()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)StartOfRound.Instance != (Object)null)
			{
				audioSource.volume = 1f - Mathf.Abs(((Component)this).transform.position.y - ((Component)RoundManager.Instance.playersManager.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[((NetworkBehaviour)StartOfRound.Instance).NetworkManager.LocalClientId]].gameplayCamera).transform.position.y) / (float)maxDistance;
			}
		}
	}
	[AddComponentMenu("LethalSDK/AudioOutputInterface")]
	public class SI_AudioOutputInterface : MonoBehaviour
	{
		public AudioSource audioSource;

		public string mixerName = "Diagetic";

		public string mixerGroupName = "Master";

		public void Awake()
		{
			if ((Object)(object)audioSource == (Object)null)
			{
				audioSource = ((Component)this).gameObject.GetComponent<AudioSource>();
				if ((Object)(object)audioSource == (Object)null)
				{
					audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
				}
			}
			if (mixerName != null && mixerName.Length > 0 && mixerGroupName != null && mixerGroupName.Length > 0)
			{
				audioSource.outputAudioMixerGroup = AssetGatherDialog.audioMixers[mixerName].Item2.First((AudioMixerGroup g) => ((Object)g).name == mixerGroupName);
			}
			Object.Destroy((Object)(object)this);
		}
	}
	[AddComponentMenu("LethalSDK/NetworkPrefabInstancier")]
	public class SI_NetworkPrefabInstancier : MonoBehaviour
	{
		public GameObject prefab;

		[HideInInspector]
		public GameObject instance;

		public void Awake()
		{
			//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)
			if ((Object)(object)prefab != (Object)null)
			{
				NetworkObject component = prefab.GetComponent<NetworkObject>();
				if ((Object)(object)component != (Object)null && (Object)(object)component.NetworkManager != (Object)null)
				{
					SI_NetworkDataInterfacing component2 = ((Component)this).GetComponent<SI_NetworkDataInterfacing>();
					SI_NetworkData sI_NetworkData = null;
					if ((Object)(object)component2 != (Object)null)
					{
						sI_NetworkData = prefab.GetComponent<SI_NetworkData>();
						if ((Object)(object)sI_NetworkData == (Object)null)
						{
							prefab.AddComponent<SI_NetworkData>();
						}
					}
					if (component.NetworkManager.IsHost)
					{
						instance = Object.Instantiate<GameObject>(prefab, ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform.parent);
						SI_NetworkData component3 = instance.GetComponent<SI_NetworkData>();
						if ((Object)(object)component2 != (Object)null && (Object)(object)component3 != (Object)null)
						{
							component3.setData(component2.getData());
						}
						instance.GetComponent<NetworkObject>().Spawn(false);
					}
				}
			}
			((Component)this).gameObject.SetActive(false);
		}

		public void OnDestroy()
		{
			if ((Object)(object)instance != (Object)null)
			{
				NetworkObject component = prefab.GetComponent<NetworkObject>();
				if ((Object)(object)component != (Object)null && (Object)(object)component.NetworkManager != (Object)null && component.NetworkManager.IsHost)
				{
					instance.GetComponent<NetworkObject>().Despawn(true);
					Object.Destroy((Object)(object)instance);
				}
			}
		}
	}
	[AddComponentMenu("LethalSDK/NetworkDataInterfacing")]
	public class SI_NetworkDataInterfacing : MonoBehaviour
	{
		public StringStringPair[] data = new StringStringPair[0];

		[HideInInspector]
		public string serializedData = string.Empty;

		private void OnValidate()
		{
			serializedData = string.Join(";", data.Select((StringStringPair p) => p._string1.RemoveNonAlphanumeric(1) + "," + p._string2.RemoveNonAlphanumeric(1)));
		}

		public virtual StringStringPair[] getData()
		{
			return (from s in serializedData.Split(new char[1] { ';' })
				select s.Split(new char[1] { ',' }) into split
				where split.Length == 2
				select new StringStringPair(split[0], split[1])).ToArray();
		}
	}
	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 MaxRange;

		public int MinRange;

		public bool RequiresLineOfSight;

		public string HeaderText;

		public string SubText;

		public int ScrapValue;

		public int CreatureScanID;

		public NodeType 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 = (int)NodeType;
			base.Awake();
		}
	}
	public enum NodeType
	{
		Information = 0,
		Danger = 0,
		Ressource = 0
	}
	[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()
		{
			AudioReverbTrigger val = ((Component)this).gameObject.AddComponent<AudioReverbTrigger>();
			ReverbPreset val2 = ScriptableObject.CreateInstance<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_0081: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00c6: 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;
			if ((Object)(object)DungeonRoot != (Object)null)
			{
				_ = DungeonRoot.scene;
				if (false)
				{
					DungeonRoot = new GameObject();
					((Object)DungeonRoot).name = "DungeonRoot";
					DungeonRoot.transform.position = new Vector3(0f, -200f, 0f);
				}
			}
			val.Root = DungeonRoot;
			val.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0];
			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 = 2;

		public AudioClip[] DoorAudios = (AudioClip[])(object)new AudioClip[0];

		public override void Awake()
		{
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Expected O, but got Unknown
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Expected O, but got Unknown
			//IL_0199: Unknown result type (might be due to invalid IL or mis