Decompiled source of Diversity v3.1.0

Diversity/Diversity Remastered.dll

Decompiled 2 weeks ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Diversity Remastered.NetcodePatcher;
using DiversityDungeonGen;
using DiversityRemastered.Items;
using DiversityRemastered.Misc;
using DiversityRemastered.Monsters;
using DiversityRemastered.Patches;
using DiversityRemastered.Player;
using DiversityRemastered.Properties;
using DiversityRemastered.ScriptableObjects;
using DunGen;
using GameNetcodeStuff;
using GraphicsAPI;
using GraphicsAPI.CustomPostProcessing;
using HarmonyLib;
using LCCutscene;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using Unity.Netcode.Samples;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.VFX;
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("Diversity Remastered")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Diversity Remastered")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2b889c96-cd65-4df4-8daf-302423eccd65")]
[assembly: AssemblyFileVersion("3.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.0.8964")]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace DiversityRemastered
{
	public class Configuration
	{
		public static ConfigEntry<bool> spiderRevamp;

		public static ConfigEntry<float> spiderSlowAmount;

		public static ConfigEntry<bool> crawlerRevamp;

		public static ConfigEntry<float> crawlerSlowAmount;

		public static ConfigEntry<bool> centipedeRevamp;

		public static ConfigEntry<int> clickAmount;

		public static ConfigEntry<int> hurtChance;

		public static ConfigEntry<bool> brakenRevamp;

		public static ConfigEntry<bool> brakenFlashight;

		public static ConfigEntry<bool> brakenSpace;

		public static ConfigEntry<bool> brakenSnatchCompatibility;

		public static ConfigEntry<float> brakenRange;

		public static ConfigEntry<bool> brakenAnger;

		public static ConfigEntry<float> brakenAngerTime;

		public static ConfigEntry<int> flickerChance;

		public static ConfigEntry<int> breakerChance;

		public static ConfigEntry<bool> apparatusAnger;

		public static ConfigEntry<bool> chaseTriggerer;

		public static ConfigEntry<bool> dressGirlRevamp;

		public static ConfigEntry<float> walkieTalkieFrequency;

		public static ConfigEntry<bool> dressGirlIsolation;

		public static ConfigEntry<float> interactRange;

		public static ConfigEntry<bool> walker;

		public static ConfigEntry<int> walkerContactAmount;

		public static ConfigEntry<float> walkerLurkTimeMultiplier;

		public static ConfigEntry<int> walkerChance;

		public static ConfigEntry<float> stairsLengthMultiplier;

		public static ConfigEntry<bool> watcher;

		public static ConfigEntry<int> watcherWeight;

		public static ConfigEntry<float> watcherSlamMultiplier;

		public static ConfigEntry<bool> speaker;

		public static ConfigEntry<bool> posters;

		public static ConfigEntry<bool> shipCutscene;

		public static ConfigEntry<bool> pufferRevamp;

		public static ConfigEntry<bool> hydrogeneRevamp;

		public static ConfigEntry<bool> introCutscene;

		public static ConfigEntry<bool> menuMusic;

		public static void Load()
		{
			spiderRevamp = Diversity.config.Bind<bool>("Spider", "SpiderRevamp", true, "Should spider revamp be enabled?");
			spiderSlowAmount = Diversity.config.Bind<float>("Spider", "SpiderSlow", 0.8f, "How much slown should spiders be on hit?");
			crawlerRevamp = Diversity.config.Bind<bool>("Crawler", "CrawlerRevamp", true, "Should crawler revamp be enabled?");
			crawlerSlowAmount = Diversity.config.Bind<float>("Crawler", "CrawlerSlow", 0.9f, "How much slown should crawlers be on hit?");
			centipedeRevamp = Diversity.config.Bind<bool>("Centipede", "CentipedeRevamp", true, "Should centipede revamp be enabled?");
			clickAmount = Diversity.config.Bind<int>("Centipede", "ClickAmount", 30, "How many times should you have to click to remove the centipede from someone's head?");
			hurtChance = Diversity.config.Bind<int>("Centipede", "HurtChance", 10, "Chance of hurting the player when trying to free the centipede.");
			brakenRevamp = Diversity.config.Bind<bool>("Bracken", "BrakenRevamp", true, "Should Bracken revamp be enabled?");
			brakenFlashight = Diversity.config.Bind<bool>("Bracken", "Braken Flashlight", true, "Should Bracken dim flashlights?");
			brakenSpace = Diversity.config.Bind<bool>("Bracken", "BrakenPersonnalSpace", true, "Should the Bracken have his own personnal space?");
			brakenSnatchCompatibility = Diversity.config.Bind<bool>("Bracken", "Braken Snatch Compatibility", false, "Enables compatibility with snatching bracken mod. (RECOMMENDED TO DISABLE IT IN SOLO!)");
			brakenRange = Diversity.config.Bind<float>("Bracken", "BrakenRange", 15f, "From how far should the Bracken be able to turn off lights?");
			brakenAnger = Diversity.config.Bind<bool>("Bracken", "BrakenAnger", true, "Should Bracken get angered from the breaker box?");
			brakenAngerTime = Diversity.config.Bind<float>("Bracken", "BrakenAngerTime", 90f, "How long should the Bracken stay angered when fully angered?");
			flickerChance = Diversity.config.Bind<int>("Bracken", "FlickerChance", 100, "Chance on flickering and turning off lights.");
			breakerChance = Diversity.config.Bind<int>("Bracken", "BreakerChance", 75, "Chance for the Bracken to turn off the breaker box.");
			apparatusAnger = Diversity.config.Bind<bool>("Bracken", "ApparatusAnger", true, "Should taking the Apparatus anger the Bracken?");
			chaseTriggerer = Diversity.config.Bind<bool>("Bracken", "ChaseTriggerer", true, "Should the Bracken chase the one who angered him?");
			dressGirlRevamp = Diversity.config.Bind<bool>("Dress Girl", "DressGirlRevamp", true, "Should Dress girl revamp be enabled?");
			walkieTalkieFrequency = Diversity.config.Bind<float>("Dress Girl", "WalkieTalkieFrequency", 1f, "How frequent should the Dress girl haunt the walkie-talkie?");
			dressGirlIsolation = Diversity.config.Bind<bool>("Dress Girl", "DressGirlIsolation", true, "Should Dress girl be able to isolate you and give you hallucinations? (Requires DressGirlRevamp to be enabled.)");
			pufferRevamp = Diversity.config.Bind<bool>("Puffer", "Puffer Revamp", true, "Should the puffer revamp be enabled?");
			hydrogeneRevamp = Diversity.config.Bind<bool>("Hydregene", "Hydrogene Revamp", true, "Should the hydrogene revamp be enabled?");
			interactRange = Diversity.config.Bind<float>("Player", "InteractRange", 3f, "How far can players remove centipede from their head?");
			walker = Diversity.config.Bind<bool>("Walker", "Walker", true, "Should the Walker be enabled?");
			walkerContactAmount = Diversity.config.Bind<int>("Walker", "Walker Contact Amount", 3, "How many contact should the walker do before sending them to the stairs?");
			walkerLurkTimeMultiplier = Diversity.config.Bind<float>("Walker", "Walker Lurk Time Multiplier", 1f, "Multiplier of the time the walker lurks before chasing its target.");
			walkerChance = Diversity.config.Bind<int>("Walker", "Walker Spawn Weight", 10, "Spawn weight of the walker.");
			stairsLengthMultiplier = Diversity.config.Bind<float>("Walker", "Walker Stairs Length", 1f, "Multiplier of the stairs length.");
			watcher = Diversity.config.Bind<bool>("Watcher", "Watcher", true, "Should the Watcher be enabled?");
			watcherWeight = Diversity.config.Bind<int>("Watcher", "Watcher Weight", 30, "Spawn weight of the Watcher.");
			watcherSlamMultiplier = Diversity.config.Bind<float>("Watcher", "Watcher Slam Multiplier", 1f, "Slam multiplier for the Watcher. (Capped between 1 to 2)");
			speaker = Diversity.config.Bind<bool>("Speaker", "Voice lines", true, "Should the speaker voice lines be enabled?");
			posters = Diversity.config.Bind<bool>("Posters", "Posters", true, "Should the posters be enabled?");
			shipCutscene = Diversity.config.Bind<bool>("Cutscene", "Ship Cutscene", true, "Should the ship cutscene be enabled?");
			introCutscene = Diversity.config.Bind<bool>("Cutscene", "Mysterious Intro Cutscene", false, "Should it always play when you start the game?");
			menuMusic = Diversity.config.Bind<bool>("Menu", "Custom Menu Music", true, "Spooky menu music yes?");
		}
	}
	public class ContentLoader
	{
		public static AssetBundle MainAssets;

		public static AssetBundle extraAssets;

		public static AssetBundle sceneAssets;

		public static void Load()
		{
			Diversity.mls.LogDebug((object)"Loading internal assets...");
			if ((Object)(object)MainAssets == (Object)null)
			{
				MainAssets = AssetBundle.LoadFromMemory(Resources.diversity);
			}
			if ((Object)(object)extraAssets == (Object)null)
			{
				extraAssets = AssetBundle.LoadFromMemory(Resources.diversity_extra);
			}
			if ((Object)(object)sceneAssets == (Object)null)
			{
				sceneAssets = AssetBundle.LoadFromMemory(Resources.diversity_scenes);
			}
			Diversity.mls.LogDebug((object)"Internal assets loaded!");
		}
	}
	public class DiversityAssets : MonoBehaviour
	{
		[Serializable]
		public class RandomSoundAudioClip
		{
			public DiversitySoundManager.SoundType soundType;

			public AudioClip[] audioClips;
		}

		[Serializable]
		public class SoundAudioClip
		{
			public DiversitySoundManager.SoundType soundType;

			public AudioClip audioClip;
		}

		public SoundAudioClip[] soundAudioClipArray;

		public RandomSoundAudioClip[] randomSoundAudioClipArray;

		public static DiversityAssets Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			}
			else
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class DiversitySoundManager : NetworkBehaviour
	{
		public enum SoundType
		{
			SteamLeak,
			LightOn,
			LightBuzz,
			Ambience,
			Fracture,
			BrokenBone,
			Hurt,
			BrackenScream,
			BrackenSpeech,
			DressGirlSpeech,
			DressGirlVoices,
			HeartBeat,
			DoorSlam,
			WalkerFootStep,
			WatcherScream,
			WatcherScreech,
			WatcherScreamHit,
			VentBanging,
			VentHit,
			GroundSlam,
			Stab,
			BloodSplat,
			HumanScream,
			SpeakerWelcome,
			SpeakerTerminal,
			SpeakerDogs,
			SpeakerShutOff,
			SpeakerEject,
			SpeakerReturn,
			SpeakerDays,
			SpeakerQuota,
			SpeakerQuotaAgain,
			LowEerie,
			Eerie
		}

		public static GameObject oneShot;

		public static AudioSource oneShotAudio;

		public static GameObject oneShotBypass;

		public static AudioSource oneShotAudioBypass;

		public static AudioSource walkerEerie;

		public List<GameObject> current3Daudios = new List<GameObject>();

		public List<GameObject> currentGirlAudios = new List<GameObject>();

		public static DiversitySoundManager Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			}
			else
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpeakerTerminalPlayOneShotSyncServerRpc(int random)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2301919732u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, random);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2301919732u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					SpeakerTerminalPlayOneShotSyncClientRpc(random);
				}
			}
		}

		[ClientRpc]
		public void SpeakerTerminalPlayOneShotSyncClientRpc(int random)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1586849932u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, random);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1586849932u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (random != -1)
				{
					StartOfRound.Instance.speakerAudioSource.PlayOneShot(GetRandomAudioClipByTypeAndId(SoundType.SpeakerTerminal, random));
				}
			}
		}

		public static float PlaySoundFloat(SoundType soundType, bool random, float volume, float pan, bool loop, Vector3 position)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX")[0];
			GameObject val = new GameObject("Sound");
			val.transform.position = position;
			AudioSource val2 = val.AddComponent<AudioSource>();
			val2.spatialBlend = 1f;
			val2.playOnAwake = false;
			val2.dopplerLevel = 0f;
			val2.spread = 70f;
			val2.reverbZoneMix = 1f;
			val2.outputAudioMixerGroup = outputAudioMixerGroup;
			val2.loop = loop;
			val2.panStereo = pan;
			if (random)
			{
				val2.clip = GetRandomAudioClipByType(soundType);
			}
			else
			{
				val2.clip = GetAudioClipByType(soundType);
			}
			val2.rolloffMode = (AudioRolloffMode)1;
			if (soundType == SoundType.LightOn)
			{
				val2.maxDistance = 100f;
			}
			else if (soundType == SoundType.SteamLeak || soundType == SoundType.LightBuzz)
			{
				val2.maxDistance = 32f;
			}
			else
			{
				val2.maxDistance = 32f;
			}
			val2.volume = volume;
			val2.Play();
			if (soundType == SoundType.DressGirlSpeech)
			{
				Instance.currentGirlAudios.Add(val);
			}
			else if (!loop)
			{
				Object.Destroy((Object)(object)val, val2.clip.length);
			}
			else
			{
				Instance.current3Daudios.Add(val);
			}
			return val2.clip.length;
		}

		public static AudioSource PlaySound(SoundType soundType, bool random, float volume, float pan, bool loop, Vector3 position, float range = 32f, float audioOffset = 0f, float destroyDelayOffset = 0f)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX")[0];
			GameObject val = new GameObject("Sound");
			val.transform.position = position;
			AudioSource val2 = val.AddComponent<AudioSource>();
			val2.spatialBlend = 1f;
			val2.playOnAwake = false;
			val2.dopplerLevel = 0f;
			val2.spread = 70f;
			val2.reverbZoneMix = 1f;
			val2.outputAudioMixerGroup = outputAudioMixerGroup;
			val2.loop = loop;
			val2.panStereo = pan;
			if (random)
			{
				val2.clip = GetRandomAudioClipByType(soundType);
			}
			else
			{
				val2.clip = GetAudioClipByType(soundType);
			}
			val2.rolloffMode = (AudioRolloffMode)1;
			if (soundType == SoundType.LightOn)
			{
				val2.maxDistance = 100f;
			}
			else if (soundType == SoundType.SteamLeak || soundType == SoundType.LightBuzz)
			{
				val2.maxDistance = 32f;
			}
			else
			{
				val2.maxDistance = range;
			}
			val2.volume = volume;
			val2.time = audioOffset;
			val2.Play();
			if (soundType == SoundType.DressGirlSpeech)
			{
				Instance.currentGirlAudios.Add(val);
			}
			else if (!loop)
			{
				float num = val2.clip.length - audioOffset + destroyDelayOffset;
				Diversity.mls.LogDebug((object)$"Audio destroy time: {num}");
				Object.Destroy((Object)(object)val, num);
			}
			else
			{
				Instance.current3Daudios.Add(val);
			}
			return val2;
		}

		public static AudioSource PlaySound(SoundType soundType, bool random, float volume, float pan, bool loop, Vector3 position, Transform parent, float range = 32f, float audioOffset = 0f, float destroyDelayOffset = 0f)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX")[0];
			GameObject val = new GameObject("Sound");
			val.transform.position = position;
			AudioSource val2 = val.AddComponent<AudioSource>();
			val2.spatialBlend = 1f;
			val2.playOnAwake = false;
			val2.dopplerLevel = 0f;
			val2.spread = 70f;
			val2.reverbZoneMix = 1f;
			val2.outputAudioMixerGroup = outputAudioMixerGroup;
			val2.loop = loop;
			val2.panStereo = pan;
			if (random)
			{
				val2.clip = GetRandomAudioClipByType(soundType);
			}
			else
			{
				val2.clip = GetAudioClipByType(soundType);
			}
			val2.rolloffMode = (AudioRolloffMode)1;
			if (soundType == SoundType.LightOn)
			{
				val2.maxDistance = 100f;
			}
			else if (soundType == SoundType.SteamLeak || soundType == SoundType.LightBuzz)
			{
				val2.maxDistance = 32f;
			}
			else
			{
				val2.maxDistance = range;
			}
			val2.volume = volume;
			val2.time = audioOffset;
			val2.Play();
			if (soundType == SoundType.DressGirlSpeech)
			{
				Instance.currentGirlAudios.Add(val);
			}
			else if (!loop)
			{
				float num = val2.clip.length - audioOffset + destroyDelayOffset;
				Diversity.mls.LogDebug((object)$"Audio destroy time: {num}");
				Object.Destroy((Object)(object)val, num);
			}
			else
			{
				Instance.current3Daudios.Add(val);
			}
			val.transform.SetParent(parent, true);
			return val2;
		}

		public static AudioSource PlaySound(SoundType soundType, bool random, float volume, float pan)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX")[0];
			if ((Object)(object)oneShot == (Object)null)
			{
				oneShot = new GameObject("OneShotSound");
				oneShotAudio = oneShot.AddComponent<AudioSource>();
			}
			oneShotAudio.outputAudioMixerGroup = outputAudioMixerGroup;
			oneShotAudio.panStereo = pan;
			if (random)
			{
				oneShotAudio.PlayOneShot(GetRandomAudioClipByType(soundType), volume);
			}
			else
			{
				oneShotAudio.PlayOneShot(GetAudioClipByType(soundType), volume);
			}
			return oneShotAudio;
		}

		public static void DeleteAudio(GameObject audio)
		{
			Object.Destroy((Object)(object)audio);
		}

		public static void PlaySoundBypass(SoundType soundType, bool random, float volume, float pan, bool loop, Vector3 position, float spatialBlend = 1f)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Sound");
			val.transform.position = position;
			AudioSource val2 = val.AddComponent<AudioSource>();
			val2.spatialBlend = spatialBlend;
			val2.playOnAwake = false;
			val2.dopplerLevel = 0f;
			val2.spread = 70f;
			val2.reverbZoneMix = 1f;
			val2.bypassListenerEffects = true;
			val2.loop = loop;
			val2.panStereo = pan;
			if (random)
			{
				val2.clip = GetRandomAudioClipByType(soundType);
			}
			else
			{
				val2.clip = GetAudioClipByType(soundType);
			}
			val2.rolloffMode = (AudioRolloffMode)1;
			if (soundType == SoundType.LightOn)
			{
				val2.maxDistance = 100f;
			}
			else if (soundType == SoundType.SteamLeak || soundType == SoundType.LightBuzz)
			{
				val2.maxDistance = 32f;
			}
			else
			{
				val2.maxDistance = 32f;
			}
			val2.volume = volume;
			val2.Play();
			switch (soundType)
			{
			case SoundType.DressGirlSpeech:
				Instance.currentGirlAudios.Add(val);
				break;
			default:
				if (soundType != SoundType.LowEerie)
				{
					if (!loop)
					{
						Object.Destroy((Object)(object)val, val2.clip.length);
					}
					else
					{
						Instance.current3Daudios.Add(val);
					}
					break;
				}
				goto case SoundType.Eerie;
			case SoundType.Eerie:
				walkerEerie = val2;
				break;
			}
		}

		public static void PlaySoundBypass(SoundType soundType, bool random, float volume = 1f, float pan = 1f)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			if ((Object)(object)oneShotBypass == (Object)null)
			{
				oneShotBypass = new GameObject("OneShotSound");
				oneShotAudioBypass = oneShotBypass.AddComponent<AudioSource>();
				oneShotAudioBypass.bypassListenerEffects = true;
			}
			oneShotAudioBypass.panStereo = pan;
			if (random)
			{
				oneShotAudioBypass.PlayOneShot(GetRandomAudioClipByType(soundType), volume);
			}
			else
			{
				oneShotAudioBypass.PlayOneShot(GetAudioClipByType(soundType), volume);
			}
		}

		public static void StopSound(AudioSource audioSource)
		{
			if ((Object)(object)audioSource != (Object)null)
			{
				audioSource.Stop();
			}
		}

		public static void StopSound()
		{
			if ((Object)(object)oneShot != (Object)null)
			{
				oneShotAudio.Stop();
			}
		}

		public static void StopSoundBypass()
		{
			if ((Object)(object)oneShot != (Object)null)
			{
				oneShotAudioBypass.Stop();
			}
		}

		public static Vector3 CheckPosition(PlayerControllerB player)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)player))
			{
				if (!player.isPlayerDead)
				{
					return ((Component)player.gameplayCamera).transform.position;
				}
				return player.spectateCameraPivot.position;
			}
			return Vector3.zero;
		}

		public static AudioClip GetAudioClipByType(SoundType soundType)
		{
			Diversity.mls.LogInfo((object)DiversityAssets.Instance.soundAudioClipArray);
			DiversityAssets.SoundAudioClip[] soundAudioClipArray = DiversityAssets.Instance.soundAudioClipArray;
			foreach (DiversityAssets.SoundAudioClip soundAudioClip in soundAudioClipArray)
			{
				if (soundAudioClip.soundType == soundType)
				{
					return soundAudioClip.audioClip;
				}
			}
			Diversity.mls.LogError((object)("No audio of type:" + soundType));
			return null;
		}

		public static AudioClip GetRandomAudioClipByType(SoundType soundType)
		{
			DiversityAssets.RandomSoundAudioClip[] randomSoundAudioClipArray = DiversityAssets.Instance.randomSoundAudioClipArray;
			foreach (DiversityAssets.RandomSoundAudioClip randomSoundAudioClip in randomSoundAudioClipArray)
			{
				if (randomSoundAudioClip.soundType == soundType)
				{
					return randomSoundAudioClip.audioClips[Random.Range(0, randomSoundAudioClip.audioClips.Length)];
				}
			}
			Diversity.mls.LogError((object)("No audio of type:" + soundType));
			return null;
		}

		public static int GetRandomAudioClipIdByType(SoundType soundType)
		{
			DiversityAssets.RandomSoundAudioClip[] randomSoundAudioClipArray = DiversityAssets.Instance.randomSoundAudioClipArray;
			foreach (DiversityAssets.RandomSoundAudioClip randomSoundAudioClip in randomSoundAudioClipArray)
			{
				if (randomSoundAudioClip.soundType == soundType)
				{
					return Random.Range(0, randomSoundAudioClip.audioClips.Length);
				}
			}
			Diversity.mls.LogError((object)("No audio of type:" + soundType));
			return -1;
		}

		public static AudioClip GetRandomAudioClipByTypeAndId(SoundType soundType, int id)
		{
			DiversityAssets.RandomSoundAudioClip[] randomSoundAudioClipArray = DiversityAssets.Instance.randomSoundAudioClipArray;
			foreach (DiversityAssets.RandomSoundAudioClip randomSoundAudioClip in randomSoundAudioClipArray)
			{
				if (randomSoundAudioClip.soundType == soundType)
				{
					return randomSoundAudioClip.audioClips[id];
				}
			}
			Diversity.mls.LogError((object)("No audio of type:" + soundType));
			return null;
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2301919732u, new RpcReceiveHandler(__rpc_handler_2301919732), "SpeakerTerminalPlayOneShotSyncServerRpc");
			((NetworkBehaviour)this).__registerRpc(1586849932u, new RpcReceiveHandler(__rpc_handler_1586849932), "SpeakerTerminalPlayOneShotSyncClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_2301919732(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int random = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref random);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DiversitySoundManager)(object)target).SpeakerTerminalPlayOneShotSyncServerRpc(random);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1586849932(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int random = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref random);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DiversitySoundManager)(object)target).SpeakerTerminalPlayOneShotSyncClientRpc(random);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "DiversitySoundManager";
		}
	}
	public class DiversityItems
	{
		private static List<string> disks = new List<string>();

		public static void Setup()
		{
			disks.Add("Ex-37");
			disks.Add("Ex-43");
			disks.Add("Ex-67");
			disks.Add("Ex-507");
			disks.Add("Sub-12");
			disks.Add("Sub-16");
			disks.Add("Sub-30");
			disks.Add("Sub-66");
			disks.Add("Sub-100");
			disks.Add("Sub-507");
			disks.Add("Never Stopping");
			Diversity.mls.LogDebug((object)"Setting up the items...");
			Register();
			Diversity.mls.LogDebug((object)"Items are setup!");
		}

		public static void Register()
		{
			foreach (string disk in disks)
			{
				GameNetworkManagerPatch.RegisterPrefab(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Remastered/Floppy Disks/Disks/" + disk + ".prefab"));
				Diversity.mls.LogDebug((object)("Registered " + disk + "!"));
			}
		}
	}
	public class Enemies
	{
		public static void Setup()
		{
			Diversity.mls.LogDebug((object)"Setting up the enemies...");
			Register();
			Diversity.mls.LogDebug((object)"Enemies are setup!");
		}

		public static void Register()
		{
			if (Configuration.watcher.Value)
			{
				DiversityAIManager.RegisterEnemy(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Watcher/Watcher.prefab"));
			}
			if (Configuration.walker.Value)
			{
				GameNetworkManagerPatch.RegisterPrefab(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/walker/Prefab/Walker.prefab"));
			}
		}

		public static void AddComponentsToExistingPrefabs()
		{
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Expected O, but got Unknown
			foreach (NetworkPrefab prefab in NetworkManager.Singleton.NetworkConfig.Prefabs.m_Prefabs)
			{
				switch (((Object)prefab.Prefab).name)
				{
				case "Flowerman":
					if (Configuration.brakenRevamp.Value)
					{
						prefab.Prefab.AddComponent<BrakenRevamp>();
					}
					break;
				case "Crawler":
					if (Configuration.crawlerRevamp.Value)
					{
						prefab.Prefab.AddComponent<CrawlerRevamp>();
					}
					break;
				case "SandSpider":
					if (Configuration.spiderRevamp.Value)
					{
						prefab.Prefab.AddComponent<SpiderRevamp>();
					}
					break;
				case "Centipede":
					if (Configuration.centipedeRevamp.Value)
					{
						prefab.Prefab.AddComponent<CentipedeRevamp>();
					}
					break;
				case "DressGirl":
					if (Configuration.dressGirlRevamp.Value)
					{
						prefab.Prefab.AddComponent<DressGirlRevamp>();
					}
					break;
				case "Blob":
				{
					if (!Configuration.hydrogeneRevamp.Value)
					{
						break;
					}
					PullObjects pull = prefab.Prefab.AddComponent<PullObjects>();
					foreach (Transform item in prefab.Prefab.transform.Find("Armature"))
					{
						Transform val = item;
						BlobRevamp component = ((Component)val).gameObject.GetComponent<BlobRevamp>();
						if (!Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)((Component)val).gameObject.GetComponent<BoxCollider>()))
						{
							component = ((Component)val).gameObject.AddComponent<BlobRevamp>();
							component.pull = pull;
						}
					}
					break;
				}
				case "Teleporter":
					prefab.Prefab.AddComponent<ShipTeleporterRevamp>();
					break;
				}
			}
		}
	}
	public static class DiversityManager
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass70_0
		{
			public float time;

			internal bool <WaitForWiderShip>b__0()
			{
				return Object.op_Implicit((Object)(object)GameObject.Find("ShipInsideBoth")) || Object.op_Implicit((Object)(object)GameObject.Find("MelanieShip")) || Time.realtimeSinceStartup >= time;
			}
		}

		[CompilerGenerated]
		private sealed class <Blink>d__87 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Blink>d__87(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Expected O, but got Unknown
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					Diversity.mls.LogDebug((object)"Blinking!");
					blinking = true;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => blinkingTime == 1f));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.3f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					blinking = false;
					Diversity.mls.LogDebug((object)"Blinking stopped!");
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <EnableSpeaker>d__76 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public float time;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <EnableSpeaker>d__76(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(time + 0.5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					speakerDisabled = false;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <GenerateRoomRoutine>d__79 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public int seed;

			public Vector3 startPos;

			public GameObject test;

			public List<GameObject> prefabs;

			public GameObject start;

			public GameObject end;

			public bool isTest;

			private int <i>5__1;

			private int <random>5__2;

			private GameObject <randomHall>5__3;

			private Vector3 <newPos>5__4;

			private GameObject <hall>5__5;

			private Transform <light>5__6;

			private Transform <obj>5__7;

			private Transform <kill>5__8;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GenerateRoomRoutine>d__79(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<randomHall>5__3 = null;
				<hall>5__5 = null;
				<light>5__6 = null;
				<obj>5__7 = null;
				<kill>5__8 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_019f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					Diversity.mls.LogDebug((object)"Generating the Bracken room!");
					Random.InitState(seed);
					if (isTest)
					{
						Object.Instantiate<GameObject>(test, startPos, Quaternion.identity);
					}
					else
					{
						<i>5__1 = 0;
						while (<i>5__1 < hallwayLength + 2)
						{
							Diversity.mls.LogDebug((object)("Generating tile " + <i>5__1 + "!"));
							<random>5__2 = Random.Range(0, 8);
							<randomHall>5__3 = prefabs[<random>5__2];
							<newPos>5__4 = startPos + new Vector3(0f, 0f, (float)(18 + 18 * <i>5__1));
							<hall>5__5 = null;
							if (<i>5__1 == 0)
							{
								<hall>5__5 = Object.Instantiate<GameObject>(start, <newPos>5__4, Quaternion.identity);
								braken = ((Component)<hall>5__5.transform.Find("bracken")).gameObject;
								brakenV2 = braken.AddComponent<BrackenV2>();
								ambience = ((Component)<hall>5__5.transform.Find("AmbienceAudio")).gameObject.GetComponent<AudioSource>();
								currentLayout.Add(<hall>5__5);
							}
							else if (<i>5__1 == 21)
							{
								<hall>5__5 = Object.Instantiate<GameObject>(end, <newPos>5__4, Quaternion.identity);
								((Component)<hall>5__5.transform.Find("brackendoor")).gameObject.AddComponent<BrackenDoor>();
								currentLayout.Add(<hall>5__5);
							}
							else
							{
								<hall>5__5 = Object.Instantiate<GameObject>(<randomHall>5__3, <newPos>5__4, Quaternion.identity);
								<light>5__6 = <hall>5__5.transform.Find("audio/lightbuzz");
								if (Object.op_Implicit((Object)(object)<light>5__6))
								{
									lightBuzz.Add(((Component)<light>5__6).gameObject);
								}
								<obj>5__7 = <hall>5__5.transform.Find("steamaudio");
								if (Object.op_Implicit((Object)(object)<obj>5__7))
								{
									steamSounds.Add(((Component)<obj>5__7).gameObject);
								}
								<kill>5__8 = <hall>5__5.transform.Find("KillTrigger");
								if (Object.op_Implicit((Object)(object)<kill>5__8))
								{
									((Component)<kill>5__8).gameObject.AddComponent<KillTriggerDiversity>();
								}
								currentLayout.Add(<hall>5__5);
								<light>5__6 = null;
								<obj>5__7 = null;
								<kill>5__8 = null;
							}
							<randomHall>5__3 = null;
							<hall>5__5 = null;
							<i>5__1++;
						}
					}
					Diversity.mls.LogDebug((object)("Bracken room generated using seed: " + seed + "!"));
					StartOfRoundRevamp.Instance.FinishGeneratingBrackenRoomServerRpc(StartOfRound.Instance.localPlayerController.actualClientId);
					<>2__current = 0;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <WaitForEveryoneGeneratingRooms>d__63 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <WaitForEveryoneGeneratingRooms>d__63(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: Expected O, but got Unknown
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (Configuration.brakenRevamp.Value && Configuration.brakenSpace.Value)
					{
						<>2__current = (object)new WaitUntil((Func<bool>)(() => StartOfRoundRevamp.PlayersFinishedGeneratingBrackenRoom.Count >= GameNetworkManager.Instance.connectedPlayers));
						<>1__state = 1;
						return true;
					}
					goto IL_0085;
				case 1:
					<>1__state = -1;
					goto IL_0085;
				case 2:
					{
						<>1__state = -1;
						break;
					}
					IL_0085:
					if (Configuration.walker.Value)
					{
						<>2__current = (object)new WaitUntil((Func<bool>)(() => StartOfRoundRevamp.PlayersFinishedGeneratingMaze.Count >= GameNetworkManager.Instance.connectedPlayers));
						<>1__state = 2;
						return true;
					}
					break;
				}
				SpawnDisks();
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <WaitForFloppyReaderAndSetup>d__61 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Vector3 pos;

			public Vector3 rot;

			public List<DiskType> data;

			private FloppyReader <fR>5__1;

			private AutoParentToShip <APTS>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <WaitForFloppyReaderAndSetup>d__61(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<fR>5__1 = null;
				<APTS>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Expected O, but got Unknown
				//IL_00ac: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => Object.op_Implicit((Object)(object)Object.FindObjectOfType<FloppyReader>())));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<fR>5__1 = Object.FindObjectOfType<FloppyReader>();
					<APTS>5__2 = ((Component)((Component)<fR>5__1).transform.parent).gameObject.GetComponentInChildren<AutoParentToShip>();
					if (Object.op_Implicit((Object)(object)<APTS>5__2))
					{
						Diversity.mls.LogDebug((object)"Loading Floppy Reader data...");
						<APTS>5__2.positionOffset = pos;
						<APTS>5__2.rotationOffset = rot;
						<fR>5__1.dataLoaded = data;
						Diversity.mls.LogDebug((object)"Loaded Floppy Reader data...");
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <WaitForGeneration>d__81 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			private DungeonTile[] <tiles>5__1;

			private float <distance>5__2;

			private TileLink <furthestLink>5__3;

			private DungeonTile[] <>s__4;

			private int <>s__5;

			private DungeonTile <tile>5__6;

			private TileLink[] <links>5__7;

			private TileLink[] <>s__8;

			private int <>s__9;

			private TileLink <link>5__10;

			private float <dist>5__11;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <WaitForGeneration>d__81(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<tiles>5__1 = null;
				<furthestLink>5__3 = null;
				<>s__4 = null;
				<tile>5__6 = null;
				<links>5__7 = null;
				<>s__8 = null;
				<link>5__10 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Expected O, but got Unknown
				//IL_0252: Unknown result type (might be due to invalid IL or missing references)
				//IL_0267: 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_0161: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => !DiversityDungeonGen.generating));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<tiles>5__1 = (from x in Object.FindObjectsOfType<DungeonTile>()
						where x.tileName != "Down Stairs" && x.tileName != "Up Stairs"
						select x).ToArray();
					<distance>5__2 = 0f;
					<furthestLink>5__3 = null;
					<>s__4 = <tiles>5__1;
					for (<>s__5 = 0; <>s__5 < <>s__4.Length; <>s__5++)
					{
						<tile>5__6 = <>s__4[<>s__5];
						<links>5__7 = <tile>5__6.tileLinks.Where((TileLink x) => x.closed).ToArray();
						if (<links>5__7.Length != 0)
						{
							<>s__8 = <links>5__7;
							for (<>s__9 = 0; <>s__9 < <>s__8.Length; <>s__9++)
							{
								<link>5__10 = <>s__8[<>s__9];
								<dist>5__11 = Vector3.Distance(startTile.transform.position, ((Component)<link>5__10).transform.position);
								if (<dist>5__11 > <distance>5__2)
								{
									<distance>5__2 = <dist>5__11;
									<furthestLink>5__3 = <link>5__10;
								}
								<link>5__10 = null;
							}
							<>s__8 = null;
						}
						<links>5__7 = null;
						<tile>5__6 = null;
					}
					<>s__4 = null;
					if (Object.op_Implicit((Object)(object)<furthestLink>5__3))
					{
						Diversity.mls.LogDebug((object)"Found furthest link. Adding other door...");
						walkerDoor2 = Object.Instantiate<GameObject>(ContentLoader.extraAssets.LoadAsset<GameObject>("Assets/custom/diversity/extras/prefabs/Walker Door.prefab"), ((Component)<furthestLink>5__3).transform);
						walkerDoor2.transform.localPosition = Vector3.zero;
						walkerDoor2.transform.localRotation = Quaternion.identity;
					}
					StartOfRoundRevamp.Instance.FinishGeneratingMazeServerRpc(StartOfRound.Instance.localPlayerController.actualClientId);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <WaitForWiderShip>d__70 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public GameObject poster;

			public GameObject poster2;

			public GameObject poster4;

			private <>c__DisplayClass70_0 <>8__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <WaitForWiderShip>d__70(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Expected O, but got Unknown
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
				//IL_0135: Unknown result type (might be due to invalid IL or missing references)
				//IL_015a: Unknown result type (might be due to invalid IL or missing references)
				//IL_015f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0184: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_023e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0263: Unknown result type (might be due to invalid IL or missing references)
				//IL_0268: Unknown result type (might be due to invalid IL or missing references)
				//IL_028d: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0301: Unknown result type (might be due to invalid IL or missing references)
				//IL_0306: Unknown result type (might be due to invalid IL or missing references)
				//IL_034a: Unknown result type (might be due to invalid IL or missing references)
				//IL_036f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0374: Unknown result type (might be due to invalid IL or missing references)
				//IL_0399: Unknown result type (might be due to invalid IL or missing references)
				//IL_03be: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass70_0();
					Diversity.mls.LogDebug((object)"Checking for WiderShip!");
					<>8__1.time = Time.realtimeSinceStartup + 15f;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => Object.op_Implicit((Object)(object)GameObject.Find("ShipInsideBoth")) || Object.op_Implicit((Object)(object)GameObject.Find("MelanieShip")) || Time.realtimeSinceStartup >= <>8__1.time));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if ((Object)(object)GameObject.Find("ShipInsideBoth") != (Object)null)
					{
						Diversity.mls.LogDebug((object)"WiderShip Detected!");
						if (GameObject.Find("ShipInsideBoth").activeSelf)
						{
							Diversity.mls.LogDebug((object)"WiderShip is active!");
							poster.transform.localPosition = new Vector3(-6.648f, 2.49f, -9.916f);
							poster.transform.localRotation = Quaternion.Euler(new Vector3(86.00002f, 0.0001223932f, 269.99994f));
							poster2.transform.localPosition = new Vector3(3.075f, 2.321f, -0.585f);
							poster2.transform.localRotation = Quaternion.Euler(new Vector3(89.68973f, 291.33038f, 49.73238f));
							poster4.transform.localPosition = new Vector3(1.139f, 2.628f, -14.1272f);
							poster4.transform.localRotation = Quaternion.Euler(new Vector3(82.978645f, 269.57513f, 847f / MathF.PI));
						}
					}
					else if ((Object)(object)GameObject.Find("MelanieShip") != (Object)null)
					{
						Diversity.mls.LogDebug((object)"MelanieShip Detected!");
						if (GameObject.Find("MelanieShip").activeSelf && FindInActiveObjectsByName("ShipInsideBoth").Length != 0)
						{
							Diversity.mls.LogDebug((object)"MelanieShip is active!");
							poster.transform.localPosition = new Vector3(8.372f, 2.289f, 1.676f);
							poster.transform.localRotation = Quaternion.Euler(new Vector3(86.00008f, 90f, 270f));
							poster2.transform.localPosition = new Vector3(1.77f, 2.25f, 0.762f);
							poster2.transform.localRotation = Quaternion.Euler(new Vector3(87.82013f, 269.99997f, 90.00099f));
							poster4.transform.localPosition = new Vector3(5.908f, 2.306f, -14.975f);
							poster4.transform.localRotation = Quaternion.Euler(new Vector3(82.97306f, 267.74652f, 267.6991f));
						}
						else if (GameObject.Find("MelanieShip").activeSelf)
						{
							poster.transform.localPosition = new Vector3(1.546f, 2.522f, -4.226f);
							poster.transform.localRotation = Quaternion.Euler(new Vector3(86.00008f, 90f, 270f));
							poster2.transform.localPosition = new Vector3(2.098f, 2.375659f, -2.237f);
							poster2.transform.localRotation = Quaternion.Euler(new Vector3(87.82013f, 270f, 90f));
						}
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static bool gameStarted = false;

		public static bool playersHidden = false;

		public static InteractTrigger it;

		public static GameObject walkerDoor;

		public static GameObject walkerDoor2;

		public static GameObject door;

		public static FloppyDisk brackenFloppyDisk = null;

		public static FloppyDisk walkerFloppyDisk = null;

		public static FloppyDisk mapDisk = null;

		private static List<string> disks = new List<string>();

		public static GameObject deadResearcher = null;

		public static List<GameObject> brackenRoomTiles = new List<GameObject>();

		public static GameObject stairs;

		public static List<GameObject> currentLayout = new List<GameObject>();

		public static List<GameObject> currentEffects = new List<GameObject>();

		public static int hallwayLength = 20;

		public static List<Animator> brackenLights = new List<Animator>();

		public static List<Animator> affectedLights = new List<Animator>();

		public static List<RadarBoosterItem> radarBoosters = new List<RadarBoosterItem>();

		public static int angerMax = 0;

		public static List<MouthDogAI> currentDogs = new List<MouthDogAI>();

		public static List<PullObjects> currentBlobs = new List<PullObjects>();

		public static List<GameObject> steamSounds = new List<GameObject>();

		public static List<GameObject> lightBuzz = new List<GameObject>();

		public static GameObject braken;

		public static BrackenV2 brakenV2;

		public static AudioSource ambience;

		public static bool speakerDisabled = false;

		public static bool dogsLinePLayed = false;

		public static bool played = false;

		public static GameObject startTile;

		public static AudioSource mazeAudio;

		public static StairsManager manager;

		public static GameObject testPrefab = ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/test.prefab");

		public static GameObject start = ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/start.prefab");

		public static GameObject end = ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/end.prefab");

		public static GameObject stairsPrefab = ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Stairs/stairs.prefab");

		public static TextMeshProUGUI tipText;

		public static Image holderBar;

		public static Image clickBar;

		private static readonly string text = "Free from head : [E]";

		private static readonly Color color = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue));

		public static Volume haunted;

		public static Volume black;

		public static CustomPassVolume pass;

		public static FullScreenCustomPass fullscreenPass;

		public static FullScreenCustomPass fullscreenPass2;

		public static FullScreenCustomPass cameraFSPass;

		public static FullScreenCustomPass eyeFSPass;

		public static FullScreenCustomPass walkerFSPass;

		public static float hauntedIntensity = 0f;

		public static float sinkingIntensity = 0f;

		public static float closedIntensity = 0f;

		public static float shakeIntensity = 0f;

		public static float staticIntensity = 0f;

		public static bool blinking = false;

		public static float blinkingTime = 0f;

		public static void ResetEverything()
		{
			gameStarted = false;
			playersHidden = false;
			it = null;
			walkerDoor = null;
			walkerDoor2 = null;
			door = null;
			brackenFloppyDisk = null;
			walkerFloppyDisk = null;
			mapDisk = null;
			disks = new List<string>();
			deadResearcher = null;
			stairs = null;
			currentLayout = new List<GameObject>();
			currentEffects = new List<GameObject>();
			brackenLights = new List<Animator>();
			affectedLights = new List<Animator>();
			radarBoosters = new List<RadarBoosterItem>();
			angerMax = 0;
			currentDogs = new List<MouthDogAI>();
			currentBlobs = new List<PullObjects>();
			steamSounds = new List<GameObject>();
			lightBuzz = new List<GameObject>();
			braken = null;
			brakenV2 = null;
			ambience = null;
			speakerDisabled = false;
			dogsLinePLayed = false;
			played = false;
			startTile = null;
			mazeAudio = null;
			manager = null;
			tipText = null;
			holderBar = null;
			clickBar = null;
			haunted = null;
			black = null;
			pass = null;
			fullscreenPass = null;
			fullscreenPass2 = null;
			cameraFSPass = null;
			eyeFSPass = null;
			walkerFSPass = null;
			hauntedIntensity = 0f;
			sinkingIntensity = 0f;
			closedIntensity = 0f;
			shakeIntensity = 0f;
			staticIntensity = 0f;
			blinking = false;
			blinkingTime = 0f;
		}

		public static void Update()
		{
			if ((Object)(object)brackenFloppyDisk != (Object)null && (((GrabbableObject)brackenFloppyDisk).isPocketed || (Object)(object)((GrabbableObject)brackenFloppyDisk).playerHeldBy != (Object)null))
			{
				brackenFloppyDisk = null;
			}
			if ((Object)(object)walkerFloppyDisk != (Object)null && (((GrabbableObject)walkerFloppyDisk).isPocketed || (Object)(object)((GrabbableObject)walkerFloppyDisk).playerHeldBy != (Object)null))
			{
				walkerFloppyDisk = null;
			}
			if ((Object)(object)mapDisk != (Object)null && (((GrabbableObject)mapDisk).isPocketed || (Object)(object)((GrabbableObject)mapDisk).playerHeldBy != (Object)null))
			{
				mapDisk = null;
			}
		}

		public static void SaveGameData()
		{
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			FloppyDisk[] array = Object.FindObjectsOfType<FloppyDisk>();
			foreach (FloppyDisk floppyDisk in array)
			{
				string diskName = ((Object)((Component)floppyDisk).gameObject).name.Replace("(Clone)", "");
				if (disks.Any((string x) => x == diskName))
				{
					Diversity.mls.LogDebug((object)("Saving disk: " + ((Object)((Component)floppyDisk).gameObject).name.Replace("(Clone)", "")));
					ES3.Save<string>(diskName, diskName, GameNetworkManager.Instance.currentSaveFileName);
					Diversity.mls.LogDebug((object)"Disk name saved");
					ES3.Save<Vector3>(diskName + "Position", ((Component)floppyDisk).gameObject.transform.position, GameNetworkManager.Instance.currentSaveFileName);
					Diversity.mls.LogDebug((object)"Disk position saved");
				}
				else
				{
					Diversity.mls.LogDebug((object)("Skipping unsupported disk : " + diskName));
				}
			}
			foreach (string item in disks.Where((string x) => !Object.FindObjectsOfType<FloppyDisk>().Any((FloppyDisk y) => ((Object)((Component)y).gameObject).name.Replace("(Clone)", "") == x)))
			{
				Diversity.mls.LogDebug((object)("Checking if " + item + " has saved data... (Save)"));
				Diversity.mls.LogDebug((object)(item + " exist? : " + ES3.KeyExists(item, GameNetworkManager.Instance.currentSaveFileName)));
				if (ES3.KeyExists(item, GameNetworkManager.Instance.currentSaveFileName))
				{
					Diversity.mls.LogDebug((object)("Deleting data of  " + item + " since it hasn't been found in game!"));
					ES3.DeleteKey(item, GameNetworkManager.Instance.currentSaveFileName);
				}
				if (ES3.KeyExists(item + "Position", GameNetworkManager.Instance.currentSaveFileName))
				{
					ES3.DeleteKey(item + "Position", GameNetworkManager.Instance.currentSaveFileName);
				}
			}
			FloppyReader floppyReader = Object.FindObjectOfType<FloppyReader>();
			if (Object.op_Implicit((Object)(object)floppyReader))
			{
				AutoParentToShip componentInChildren = ((Component)((Component)floppyReader).transform.parent).gameObject.GetComponentInChildren<AutoParentToShip>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					Diversity.mls.LogDebug((object)"Saving Floppy Reader data...");
					ES3.Save<Vector3>("FloppyReaderPosition", componentInChildren.positionOffset, GameNetworkManager.Instance.currentSaveFileName);
					ES3.Save<Vector3>("FloppyReaderRotation", componentInChildren.rotationOffset, GameNetworkManager.Instance.currentSaveFileName);
					ES3.Save<List<DiskType>>("FloppyReaderData", floppyReader.dataLoaded, GameNetworkManager.Instance.currentSaveFileName);
					Diversity.mls.LogDebug((object)"Saved Floppy Reader data...");
				}
			}
		}

		public static void LoadGameData()
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			foreach (string disk in disks)
			{
				Diversity.mls.LogDebug((object)("Checking if " + disk + " has saved data... (Load)"));
				Diversity.mls.LogDebug((object)(disk + " exist? : " + ES3.KeyExists(disk, GameNetworkManager.Instance.currentSaveFileName)));
				if (ES3.KeyExists(disk, GameNetworkManager.Instance.currentSaveFileName))
				{
					Diversity.mls.LogDebug((object)("Loading disk: " + disk));
					string text = ES3.Load<string>(disk, GameNetworkManager.Instance.currentSaveFileName);
					Vector3 val = ES3.Load<Vector3>(disk + "Position", GameNetworkManager.Instance.currentSaveFileName);
					ManualLogSource mls = Diversity.mls;
					Vector3 val2 = val;
					mls.LogDebug((object)(text + " disk loaded at position: " + ((object)(Vector3)(ref val2)).ToString()));
					if (NetworkManager.Singleton.IsHost)
					{
						SpawnDisk(text, val);
					}
				}
			}
			if (ES3.KeyExists("FloppyReaderPosition", GameNetworkManager.Instance.currentSaveFileName) && ES3.KeyExists("FloppyReaderRotation", GameNetworkManager.Instance.currentSaveFileName) && ES3.KeyExists("FloppyReaderData", GameNetworkManager.Instance.currentSaveFileName))
			{
				((MonoBehaviour)StartOfRound.Instance).StartCoroutine(WaitForFloppyReaderAndSetup(ES3.Load<Vector3>("FloppyReaderPosition", GameNetworkManager.Instance.currentSaveFileName), ES3.Load<Vector3>("FloppyReaderRotation", GameNetworkManager.Instance.currentSaveFileName), ES3.Load<List<DiskType>>("FloppyReaderData", GameNetworkManager.Instance.currentSaveFileName)));
			}
		}

		[IteratorStateMachine(typeof(<WaitForFloppyReaderAndSetup>d__61))]
		public static IEnumerator WaitForFloppyReaderAndSetup(Vector3 pos, Vector3 rot, List<DiskType> data)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitForFloppyReaderAndSetup>d__61(0)
			{
				pos = pos,
				rot = rot,
				data = data
			};
		}

		public static void SetupRound()
		{
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			if (gameStarted)
			{
				return;
			}
			gameStarted = true;
			Diversity.mls.LogDebug((object)"Setting up the round!");
			RefreshData();
			Random.InitState(StartOfRound.Instance.randomMapSeed);
			angerMax = Random.Range(1, 4);
			Diversity.mls.LogDebug((object)("Setting up max anger to: " + angerMax));
			Diversity.mls.LogDebug((object)"Choosing a random door!");
			DoorLock[] array = Object.FindObjectsOfType<DoorLock>().Where(delegate(DoorLock x)
			{
				int result;
				if (((Object)((Component)x).gameObject).name == "Cube")
				{
					Transform parent = ((Component)x).transform.parent;
					if (parent == null)
					{
						result = 0;
					}
					else
					{
						Transform parent2 = parent.parent;
						result = (((parent2 != null) ? new bool?(((Object)((Component)parent2).gameObject).name.Contains("SteelDoor")) : null).GetValueOrDefault() ? 1 : 0);
					}
				}
				else
				{
					result = 0;
				}
				return (byte)result != 0;
			}).ToArray();
			Diversity.mls.LogDebug((object)array.Length);
			if (array.Length != 0)
			{
				Random.InitState(StartOfRound.Instance.randomMapSeed);
				DoorLock val = array[Random.Range(0, array.Length)];
				door = ((Component)((Component)val).transform.parent.parent).gameObject;
				walkerDoor = Object.Instantiate<GameObject>(ContentLoader.extraAssets.LoadAsset<GameObject>("Assets/custom/diversity/extras/prefabs/Walker Door.prefab"), ((Component)val).transform.parent.parent.parent);
				it = ((Component)val).GetComponent<InteractTrigger>();
				it.hoverTip = "Use door : [LMB]\nThis door looks odd...";
				it.disabledHoverTip = "Locked\nThis door looks odd...";
				walkerDoor.SetActive(false);
				Diversity.mls.LogDebug((object)"Walker door is set up!");
			}
			EnemyVent[] array2 = Object.FindObjectsOfType<EnemyVent>();
			if (array2.Length < 1)
			{
				return;
			}
			EnemyVent[] array3 = array2;
			foreach (EnemyVent val2 in array3)
			{
				Transform val3 = ((Component)val2).transform.Find("Hinge/VentCover");
				if ((Object)(object)val3 == (Object)null)
				{
					return;
				}
				val3.localScale = new Vector3(0f - val3.localScale.x, val3.localScale.y, val3.localScale.z);
			}
			if (NetworkManager.Singleton.IsHost)
			{
				((MonoBehaviour)StartOfRound.Instance).StartCoroutine(WaitForEveryoneGeneratingRooms());
				switch (StartOfRound.Instance.currentLevel.PlanetName)
				{
				case "41 Experimentation":
					mapDisk = SpawnDisk("Ex-67", new Vector3(-66.1824f, 15.827f, 23.234f));
					break;
				case "7 Dine":
					mapDisk = SpawnDisk("Ex-37", new Vector3(41.117f, -2.091f, 65.225f));
					break;
				case "20 Adamance":
					mapDisk = SpawnDisk("Ex-507", new Vector3(-64.035f, -16.645f, 28.683f));
					break;
				case "56 Vow":
					mapDisk = SpawnDisk("Ex-43", new Vector3(-121.135f, -1.419f, 133.079f));
					break;
				case "68 Artifice":
					mapDisk = SpawnDisk("Sub-507", new Vector3(-0.44f, -3.715f, -90.972f));
					break;
				}
			}
			switch (StartOfRound.Instance.currentLevel.PlanetName)
			{
			case "41 Experimentation":
				deadResearcher = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Remastered/Researcher/Researcher Experimentation.prefab"));
				deadResearcher.transform.position = new Vector3(-66.224f, 16.119f, 23.976f);
				break;
			case "7 Dine":
				deadResearcher = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Remastered/Researcher/Researcher Dine.prefab"));
				deadResearcher.transform.position = new Vector3(38.5351f, -1.0278304f, 63.148476f);
				break;
			case "20 Adamance":
				deadResearcher = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Remastered/Researcher/Researcher Adamance.prefab"));
				deadResearcher.transform.position = new Vector3(-57.559856f, -16.093561f, 25.392748f);
				break;
			case "56 Vow":
				deadResearcher = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Remastered/DeadBodyThingIdk.prefab"));
				deadResearcher.transform.position = new Vector3(-120.842285f, -1.376f, 131.63667f);
				break;
			}
			DiversityAIManager.Instance.SpawnEnemy(ContentLoader.MainAssets.LoadAsset<DiversityEnemy>("Assets/custom/diversity/Watcher/Watcher.asset"));
		}

		[IteratorStateMachine(typeof(<WaitForEveryoneGeneratingRooms>d__63))]
		public static IEnumerator WaitForEveryoneGeneratingRooms()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitForEveryoneGeneratingRooms>d__63(0);
		}

		private static void SpawnDisks()
		{
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			Diversity.mls.LogDebug((object)"Spawning the disks!");
			if (Configuration.brakenRevamp.Value && Configuration.brakenSpace.Value && (from x in Object.FindObjectsOfType<FloppyDisk>()
				where ((Object)((Component)x).gameObject).name.Contains("Sub-16")
				select x).ToArray().Length == 0)
			{
				brackenFloppyDisk = SpawnDisk("Sub-16", currentLayout.Where((GameObject x) => ((Object)x).name.Contains("end")).ToArray()[0].transform.Find("DiskSpawn").position);
			}
			if (Configuration.walker.Value)
			{
				walkerFloppyDisk = SpawnDisk("Sub-66", walkerDoor2.transform.position - walkerDoor2.transform.forward);
			}
		}

		public static FloppyDisk SpawnDisk(string diskName, Vector3 position, bool insideShip = false, bool localPos = false, bool forceSpawn = false)
		{
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			string diskName2 = diskName;
			if (!NetworkManager.Singleton.IsHost)
			{
				Diversity.mls.LogWarning((object)"Only the host can spawn disks!");
				return null;
			}
			if (disks.Any((string x) => x == diskName2))
			{
				if ((from x in Object.FindObjectsOfType<FloppyDisk>()
					where ((Object)((Component)x).gameObject).name.Contains(diskName2)
					select x).ToArray().Length == 0 || forceSpawn)
				{
					Diversity.mls.LogDebug((object)"Spawning the disks!");
					GameObject val = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Remastered/Floppy Disks/Disks/" + diskName2 + ".prefab"), ((Component)StartOfRound.Instance.shipAnimator).gameObject.transform);
					if (insideShip)
					{
						val.transform.SetParent(((Component)StartOfRound.Instance.shipAnimator).gameObject.transform);
					}
					if (localPos)
					{
						val.transform.localPosition = position;
					}
					else
					{
						val.transform.position = position;
					}
					val.transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
					NetworkObject componentInChildren = val.GetComponentInChildren<NetworkObject>();
					if (!componentInChildren.IsSpawned)
					{
						componentInChildren.Spawn(false);
					}
					Diversity.mls.LogDebug((object)(diskName2 + " disk is spawned!"));
					return val.GetComponentInChildren<FloppyDisk>();
				}
				Diversity.mls.LogDebug((object)(diskName2 + " is already spawned!"));
				return null;
			}
			Diversity.mls.LogDebug((object)(diskName2 + " doesn't exist!"));
			return null;
		}

		public static void RefreshData()
		{
			brackenLights = RoundManager.Instance.allPoweredLightsAnimators;
			DiversityAIManager.Instance.valves = Object.FindObjectsOfType<SteamValveHazard>().ToList();
		}

		public static void ResetRound()
		{
			if (!gameStarted)
			{
				return;
			}
			gameStarted = false;
			Diversity.mls.LogDebug((object)"Resetting the round!");
			if (((NetworkBehaviour)DiversityAIManager.Instance).IsHost)
			{
				DiversityAIManager.Instance.ClearEnemies();
			}
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if ((Object)(object)val != (Object)null)
				{
					PlayerRevamp component = ((Component)val).gameObject.GetComponent<PlayerRevamp>();
					if (!Object.op_Implicit((Object)(object)component))
					{
						return;
					}
					component.ResetPlayer();
					DiversitySoundManager.Instance.current3Daudios = new List<GameObject>();
					brackenLights = new List<Animator>();
					affectedLights = new List<Animator>();
					steamSounds = new List<GameObject>();
					lightBuzz = new List<GameObject>();
					currentDogs = new List<MouthDogAI>();
					currentBlobs = new List<PullObjects>();
					DiversityAIManager.Instance.lights = new List<Light>();
					DiversityAIManager.Instance.valves = new List<SteamValveHazard>();
				}
			}
			ResetStairsAndBrackenRoom();
			DiversityDungeonGen.Instance.DeleteCurrentDungeon();
			StartOfRoundRevamp.Instance.ClearGenerationData();
			if (NetworkManager.Singleton.IsHost)
			{
				if ((Object)(object)brackenFloppyDisk != (Object)null)
				{
					((Component)brackenFloppyDisk).gameObject.GetComponentInChildren<NetworkObject>().Despawn(true);
					brackenFloppyDisk = null;
				}
				if ((Object)(object)walkerFloppyDisk != (Object)null)
				{
					((Component)walkerFloppyDisk).gameObject.GetComponentInChildren<NetworkObject>().Despawn(true);
					walkerFloppyDisk = null;
				}
				if ((Object)(object)mapDisk != (Object)null)
				{
					((Component)mapDisk).gameObject.GetComponentInChildren<NetworkObject>().Despawn(true);
					mapDisk = null;
				}
			}
			else
			{
				if ((Object)(object)brackenFloppyDisk != (Object)null)
				{
					brackenFloppyDisk = null;
				}
				if ((Object)(object)walkerFloppyDisk != (Object)null)
				{
					walkerFloppyDisk = null;
				}
				if ((Object)(object)mapDisk != (Object)null)
				{
					mapDisk = null;
				}
			}
			if ((Object)(object)deadResearcher != (Object)null)
			{
				Object.Destroy((Object)(object)deadResearcher);
				deadResearcher = null;
			}
		}

		public static void ResetUnlockables()
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			foreach (UnlockableItem item in Unlockables.RegisteredItems)
			{
				AutoParentToShip parentObject = (from x in Object.FindObjectsOfType<PlaceableShipObject>()
					where x.unlockableID == StartOfRound.Instance.unlockablesList.unlockables.FindIndex((UnlockableItem x) => x.unlockableName == item.unlockableName)
					select x).ToArray()[0].parentObject;
				string unlockableName = item.unlockableName;
				string text = unlockableName;
				if (text == "Floppy Reader")
				{
					parentObject.positionOffset = new Vector3(-1.27f, -0.032f, -5f);
					parentObject.rotationOffset = new Vector3(0f, 180f, 0f);
				}
			}
		}

		public static void SetupGame()
		{
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f8: Expected O, but got Unknown
			//IL_0566: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Expected O, but got Unknown
			//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0600: Expected O, but got Unknown
			//IL_0649: Unknown result type (might be due to invalid IL or missing references)
			//IL_0659: Unknown result type (might be due to invalid IL or missing references)
			//IL_0660: Expected O, but got Unknown
			//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06db: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0702: Expected O, but got Unknown
			//IL_0766: Unknown result type (might be due to invalid IL or missing references)
			//IL_077d: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0900: Expected O, but got Unknown
			//IL_0914: Unknown result type (might be due to invalid IL or missing references)
			//IL_0919: Unknown result type (might be due to invalid IL or missing references)
			//IL_0923: Expected O, but got Unknown
			//IL_0937: Unknown result type (might be due to invalid IL or missing references)
			//IL_093c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0944: Unknown result type (might be due to invalid IL or missing references)
			//IL_0952: Expected O, but got Unknown
			//IL_0966: Unknown result type (might be due to invalid IL or missing references)
			//IL_096b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0973: Unknown result type (might be due to invalid IL or missing references)
			//IL_0981: Expected O, but got Unknown
			//IL_0995: Unknown result type (might be due to invalid IL or missing references)
			//IL_099a: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b8: Expected O, but got Unknown
			//IL_0a65: Unknown result type (might be due to invalid IL or missing references)
			ResetEverything();
			disks.Add("Ex-37");
			disks.Add("Ex-43");
			disks.Add("Ex-67");
			disks.Add("Ex-507");
			disks.Add("Sub-12");
			disks.Add("Sub-16");
			disks.Add("Sub-30");
			disks.Add("Sub-66");
			disks.Add("Sub-100");
			disks.Add("Sub-507");
			disks.Add("Never Stopping");
			if (NetworkManager.Singleton.IsHost)
			{
				LoadGameData();
			}
			EnemyType longBoiType = ContentLoader.MainAssets.LoadAsset<EnemyType>("Assets/custom/diversity/walker/WalkerType.asset");
			DiversityEnemy enemy = ContentLoader.MainAssets.LoadAsset<DiversityEnemy>("Assets/custom/diversity/Watcher/Watcher.asset");
			if (Configuration.walker.Value)
			{
				SelectableLevel[] levels = StartOfRound.Instance.levels;
				foreach (SelectableLevel val in levels)
				{
					try
					{
						if (val.Enemies.All((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType != (Object)(object)longBoiType))
						{
							val.Enemies.Add(new SpawnableEnemyWithRarity
							{
								enemyType = longBoiType,
								rarity = Mathf.Clamp(Configuration.walkerChance.Value, 0, 100)
							});
							Diversity.mls.LogInfo((object)$"Added {longBoiType.enemyName} to {val.PlanetName} with chance of {Mathf.Clamp(Configuration.walkerChance.Value, 0, 100)} (inside)");
						}
					}
					catch (Exception arg)
					{
						Diversity.mls.LogError((object)$"Failed to add enemy to {val.PlanetName}!\n{arg}");
					}
				}
			}
			SelectableLevel[] levels2 = StartOfRound.Instance.levels;
			foreach (SelectableLevel level in levels2)
			{
				if (Configuration.watcher.Value)
				{
					DiversityAIManager.AddEnemyToLevel(enemy, level, Configuration.watcherWeight.Value);
				}
			}
			if (Configuration.posters.Value)
			{
				GameObject val2 = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Ship/Poster.prefab"), ((Component)StartOfRound.Instance.shipAnimator).gameObject.transform);
				GameObject val3 = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Ship/Poster2.prefab"), ((Component)StartOfRound.Instance.shipAnimator).gameObject.transform);
				GameObject val4 = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Ship/Poster3.prefab"), ((Component)Object.FindObjectOfType<Terminal>()).transform.parent.parent);
				GameObject val5 = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Ship/Poster4.prefab"), ((Component)StartOfRound.Instance.shipAnimator).gameObject.transform);
				val2.transform.localPosition = new Vector3(6.127f, 2.522f, -3.3222f);
				val2.transform.localRotation = Quaternion.Euler(94f, -90f, 90f);
				val2.transform.localScale = new Vector3(0.07532914f, 0.09989319f, 0.09989319f);
				val3.transform.localPosition = new Vector3(2.913536f, 2.375659f, -3.998f);
				val3.transform.localRotation = Quaternion.Euler(-267.82f, 67.851f, -90f);
				val3.transform.localScale = new Vector3(0.07f, 0.09282628f, 0.09282628f);
				val4.transform.localPosition = new Vector3(-0.5234725f, -0.5695019f, 1.313852f);
				val4.transform.localRotation = Quaternion.Euler(187.403f, -11.59302f, 90f);
				val4.transform.localScale = new Vector3(0.05222219f, 0.07079603f, 0.06852487f);
				val5.transform.localPosition = new Vector3(3.571537f, 2.2985616f, -9.593f);
				val5.transform.localRotation = Quaternion.Euler(82.973f, -70.838f, -92.301f);
				val5.transform.localScale = new Vector3(0.05f, 0.06630448f, 0.06630449f);
				((MonoBehaviour)StartOfRound.Instance).StartCoroutine(WaitForWiderShip(val2, val3, val5));
			}
			if (Configuration.brakenSpace.Value)
			{
				GameObject gameObject = ((Component)((Component)StartOfRound.Instance.mapScreenPlayerName).gameObject.transform.parent).gameObject;
				GameObject val6 = new GameObject("ErrorText");
				val6.layer = 14;
				val6.AddComponent<RectTransform>();
				val6.AddComponent<CanvasRenderer>();
				TextMeshProUGUI val7 = val6.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val7).font = ((TMP_Text)HUDManager.Instance.controlTipLines[0]).font;
				((TMP_Text)val7).fontSize = 17f;
				((TMP_Text)val7).alignment = (TextAlignmentOptions)514;
				((TMP_Text)val7).overflowMode = (TextOverflowModes)0;
				((TMP_Text)val7).text = "THEY ARE PAYING\nTHE PRICE";
				((Graphic)val7).color = Color.red;
				((Behaviour)val7).enabled = true;
				val6.transform.SetParent(gameObject.transform);
				val6.transform.localPosition = Vector3.zero;
				val6.transform.localScale = new Vector3(2f, 2f, 2f);
				val6.transform.localRotation = Quaternion.identity;
				val6.SetActive(false);
			}
			if (Configuration.speaker.Value)
			{
				SetSpeakerLines();
			}
			GameObject val8 = new GameObject("InteractText");
			val8.AddComponent<RectTransform>();
			TextMeshProUGUI val9 = val8.AddComponent<TextMeshProUGUI>();
			RectTransform rectTransform = ((TMP_Text)val9).rectTransform;
			((Transform)rectTransform).SetParent(((Component)HUDManager.Instance.UICamera).transform.parent.Find("Canvas/PlayerCursor"), false);
			rectTransform.anchoredPosition = new Vector2(0f, -51.7f);
			GameObject val10 = new GameObject("InteractBarHolder");
			val10.AddComponent<RectTransform>();
			Image val11 = val10.AddComponent<Image>();
			val11.sprite = ContentLoader.MainAssets.LoadAsset<Sprite>("Assets/custom/diversity/hud/holder.png");
			RectTransform component = ((Component)val11).GetComponent<RectTransform>();
			((Transform)component).SetParent(((Component)HUDManager.Instance.UICamera).transform.parent.Find("Canvas/PlayerCursor"), false);
			component.sizeDelta = new Vector2(133.33333f, 20f);
			component.anchoredPosition = new Vector2(0f, -81.7f);
			((Behaviour)val11).enabled = false;
			holderBar = val11;
			GameObject val12 = new GameObject("InteractBarHolder");
			val12.AddComponent<RectTransform>();
			Image val13 = val12.AddComponent<Image>();
			val13.sprite = ContentLoader.MainAssets.LoadAsset<Sprite>("Assets/custom/diversity/hud/bar.png");
			RectTransform component2 = ((Component)val13).GetComponent<RectTransform>();
			((Transform)component2).SetParent(((Component)HUDManager.Instance.UICamera).transform.parent.Find("Canvas/PlayerCursor"), false);
			component2.sizeDelta = new Vector2(133.33333f, 20f);
			component2.anchoredPosition = new Vector2(0f, -81.7f);
			((Behaviour)val13).enabled = false;
			clickBar = val13;
			((TMP_Text)val9).alignment = (TextAlignmentOptions)514;
			((TMP_Text)val9).font = ((TMP_Text)HUDManager.Instance.controlTipLines[0]).font;
			((TMP_Text)val9).fontSize = 16f;
			((TMP_Text)val9).text = text;
			((Graphic)val9).color = color;
			((TMP_Text)val9).overflowMode = (TextOverflowModes)0;
			((Behaviour)val9).enabled = false;
			tipText = val9;
			haunted = ((Component)HUDManager.Instance).gameObject.AddComponent<Volume>();
			haunted.profile = ContentLoader.MainAssets.LoadAsset<VolumeProfile>("Assets/custom/diversity/volumes/haunted.asset");
			haunted.isGlobal = true;
			haunted.weight = 0f;
			haunted.sharedProfile = ContentLoader.MainAssets.LoadAsset<VolumeProfile>("Assets/custom/diversity/volumes/haunted.asset");
			black = ((Component)HUDManager.Instance).gameObject.AddComponent<Volume>();
			black.profile = ContentLoader.MainAssets.LoadAsset<VolumeProfile>("Assets/custom/diversity/volumes/black.asset");
			black.isGlobal = true;
			black.weight = 0f;
			black.sharedProfile = ContentLoader.MainAssets.LoadAsset<VolumeProfile>("Assets/custom/diversity/volumes/black.asset");
			if (CustomPostProcessingManager.Initialized)
			{
				PostProcess val14 = new PostProcess("WalkerPass", ContentLoader.extraAssets.LoadAsset<Material>("Assets/custom/diversity/extras/materials/WalkerStains.mat"))
				{
					InjectionType = (InjectionType)6,
					Enabled = false,
					Priority = -0.05f
				};
				PostProcess val15 = new PostProcess("GlitchPass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/glitchPass.mat"))
				{
					InjectionType = (InjectionType)6
				};
				PostProcess val16 = new PostProcess("VignettePass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/Vignette.mat"))
				{
					InjectionType = (InjectionType)6,
					Priority = -0.2f
				};
				PostProcess val17 = new PostProcess("EyePass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/EyesClose.mat"))
				{
					InjectionType = (InjectionType)6,
					Priority = -0.3f
				};
				PostProcess val18 = new PostProcess("CameraPass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/Camera.mat"))
				{
					InjectionType = (InjectionType)6,
					Enabled = false,
					Priority = -0.1f
				};
				fullscreenPass2 = CustomPostProcessingManager.Instance.AddPostProcess(val15);
				fullscreenPass = CustomPostProcessingManager.Instance.AddPostProcess(val16);
				eyeFSPass = CustomPostProcessingManager.Instance.AddPostProcess(val17);
				cameraFSPass = CustomPostProcessingManager.Instance.AddPostProcess(val18);
				walkerFSPass = CustomPostProcessingManager.Instance.AddPostProcess(val14);
			}
			else
			{
				CustomPostProcessingManager.OnLoad += Cpp_OnLoad;
			}
			if (!ES3.KeyExists("Never Stopping", GameNetworkManager.Instance.currentSaveFileName))
			{
				SpawnDisk("Never Stopping", new Vector3(8.4f, 1.162f, -5.35f), insideShip: true, localPos: true);
			}
		}

		[IteratorStateMachine(typeof(<WaitForWiderShip>d__70))]
		private static IEnumerator WaitForWiderShip(GameObject poster, GameObject poster2, GameObject poster4)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitForWiderShip>d__70(0)
			{
				poster = poster,
				poster2 = poster2,
				poster4 = poster4
			};
		}

		private static GameObject[] FindInActiveObjectsByName(string name)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			List<GameObject> list = new List<GameObject>();
			Transform[] array = Resources.FindObjectsOfTypeAll<Transform>();
			for (int i = 0; i < array.Length; i++)
			{
				if ((int)((Object)array[i]).hideFlags == 0 && ((Object)((Component)array[i]).gameObject).name == name)
				{
					list.Add(((Component)array[i]).gameObject);
				}
			}
			return list.ToArray();
		}

		private static void Cpp_OnLoad(object sender, EventArgs e)
		{
			//IL_0015: 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)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00b5: Expected O, but got Unknown
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			PostProcess val = new PostProcess("WalkerPass", ContentLoader.extraAssets.LoadAsset<Material>("Assets/custom/diversity/extras/materials/WalkerStains.mat"))
			{
				InjectionType = (InjectionType)6,
				Enabled = false,
				Priority = -0.05f
			};
			PostProcess val2 = new PostProcess("GlitchPass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/glitchPass.mat"))
			{
				InjectionType = (InjectionType)6
			};
			PostProcess val3 = new PostProcess("VignettePass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/Vignette.mat"))
			{
				InjectionType = (InjectionType)6,
				Priority = -0.2f
			};
			PostProcess val4 = new PostProcess("EyePass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/EyesClose.mat"))
			{
				InjectionType = (InjectionType)6,
				Priority = -0.3f
			};
			PostProcess val5 = new PostProcess("CameraPass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/Camera.mat"))
			{
				InjectionType = (InjectionType)6,
				Enabled = false,
				Priority = -0.1f
			};
			fullscreenPass2 = CustomPostProcessingManager.Instance.AddPostProcess(val2);
			fullscreenPass = CustomPostProcessingManager.Instance.AddPostProcess(val3);
			eyeFSPass = CustomPostProcessingManager.Instance.AddPostProcess(val4);
			cameraFSPass = CustomPostProcessingManager.Instance.AddPostProcess(val5);
			walkerFSPass = CustomPostProcessingManager.Instance.AddPostProcess(val);
			CustomPostProcessingManager.OnLoad -= Cpp_OnLoad;
		}

		public static void SetupAssets()
		{
			brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall1.prefab"));
			brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall2.prefab"));
			brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall3.prefab"));
			brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall4.prefab"));
			brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall5.prefab"));
			brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall6.prefab"));
			brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall7.prefab"));
			brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall8.prefab"));
		}

		public static void ToggleWalkerDoor(bool state)
		{
			((Behaviour)it).enabled = !state;
			door.SetActive(!state);
			walkerDoor.SetActive(state);
		}

		public static void DisableSpeaker(AudioSource audio)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			if (audio.isPlaying && Configuration.speaker.Value && !speakerDisabled)
			{
				speakerDisabled = true;
				if (!played)
				{
					float time = DiversitySoundManager.PlaySoundFloat(DiversitySoundManager.SoundType.SpeakerShutOff, random: true, audio.volume, 1f, loop: false, ((Component)audio).transform.position);
					((MonoBehaviour)StartOfRound.Instance).StartCoroutine(EnableSpeaker(time));
				}
				else
				{
					speakerDisabled = false;
				}
			}
		}

		[IteratorStateMachine(typeof(<EnableSpeaker>d__76))]
		public static IEnumerator EnableSpeaker(float time)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <EnableSpeaker>d__76(0)
			{
				time = time
			};
		}

		public static void PlayShipSpeaker(DiversitySoundManager.SoundType soundType, bool random = true)
		{
			if (random)
			{
				AudioClip randomAudioClipByType = DiversitySoundManager.GetRandomAudioClipByType(soundType);
				if (Object.op_Implicit((Object)(object)randomAudioClipByType))
				{
					StartOfRound.Instance.speakerAudioSource.PlayOneShot(randomAudioClipByType);
				}
			}
			else
			{
				AudioClip audioClipByType = DiversitySoundManager.GetAudioClipByType(soundType);
				if (Object.op_Implicit((Object)(object)audioClipByType))
				{
					StartOfRound.Instance.speakerAudioSource.PlayOneShot(audioClipByType);
				}
			}
		}

		public static void GenerateRoom(int seed, Vector3 startPos, GameObject test, List<GameObject> prefabs, GameObject start, GameObject end, bool isTest)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (Configuration.brakenSpace.Value)
			{
				DiversityDungeonGen.WaitCoroutine(GenerateRoomRoutine(seed, startPos, test, prefabs, s

DiversityDungeonGen.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using DiversityLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DiversityDungeonGen")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DiversityDungeonGen")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("24bf3e0e-40d9-4d2d-a557-cd66ca058005")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace DiversityDungeonGen
{
	public class DiversityDungeonGen : MonoBehaviour
	{
		public class Dungeon
		{
			public List<GameObject> tiles = new List<GameObject>();

			public int size = 0;

			public int maxHeight = 0;

			public int maxDepth = 0;
		}

		public GameObject[] tiles;

		private bool creatingTile = false;

		public static DiversityDungeonGen Instance { get; private set; }

		public static List<GameObject> RegisteredTiles { get; private set; } = new List<GameObject>();


		public static Dungeon CurrentDungeon { get; private set; } = null;


		public static bool generating { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
				CurrentDungeon = new Dungeon();
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			}
			else
			{
				Object.Destroy((Object)(object)this);
			}
		}

		public static void RegisterTile(GameObject tile)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Scene scene = tile.scene;
			if (((Scene)(ref scene)).name == null)
			{
				if (Object.op_Implicit((Object)(object)tile.GetComponent<DungeonTile>()))
				{
					RegisteredTiles.Add(tile);
					Debug.Log((object)("tile '" + tile.GetComponent<DungeonTile>().tileName + "' has been registered!"));
				}
				else
				{
					Debug.Log((object)(((Object)tile).name + " must be a Dungeon Tile!"));
				}
			}
			else
			{
				Debug.Log((object)(((Object)tile).name + " must not be an instance of a prefab!"));
			}
		}

		public void GenerateDungeon(int seed, DungeonTile startTile, int size = 100, int maxHeight = 20, int maxDepth = 20, bool debug = false)
		{
			if (debug)
			{
				((MonoBehaviour)this).StartCoroutine(GenerateDungeonRoutine(seed, startTile, size, maxHeight, maxDepth, debug: true));
			}
			else
			{
				WaitCoroutine(GenerateDungeonRoutine(seed, startTile, size, maxHeight, maxDepth, debug: false));
			}
		}

		public static void WaitCoroutine(IEnumerator func)
		{
			while (func.MoveNext())
			{
				if (func.Current == null)
				{
					continue;
				}
				IEnumerator func2;
				try
				{
					func2 = (IEnumerator)func.Current;
				}
				catch (InvalidCastException)
				{
					if (func.Current.GetType() == typeof(WaitForSeconds))
					{
						Debug.LogWarning((object)"Skipped call to WaitForSeconds. Use WaitForSecondsRealtime instead.");
					}
					break;
				}
				WaitCoroutine(func2);
			}
		}

		private IEnumerator GenerateDungeonRoutine(int seed, DungeonTile startTile, int size, int maxHeight, int maxDepth, bool debug)
		{
			DeleteCurrentDungeon();
			Random.InitState(seed);
			generating = true;
			CurrentDungeon.tiles.Add(((Component)startTile).gameObject);
			CurrentDungeon.size = size;
			CurrentDungeon.maxHeight = maxHeight;
			CurrentDungeon.maxDepth = maxDepth;
			Debug.Log((object)"GENERATING DUNGEON!");
			while (generating)
			{
				yield return (object)new WaitUntil((Func<bool>)(() => !creatingTile));
				if (debug)
				{
					yield return (object)new WaitForSeconds(0.5f);
				}
				if (SpaceLeft() <= 0)
				{
					generating = false;
				}
				if (creatingTile)
				{
					continue;
				}
				foreach (GameObject tile in CurrentDungeon.tiles.ToList())
				{
					DungeonTile dTile = tile.GetComponent<DungeonTile>();
					foreach (TileLink link in tile.GetComponent<DungeonTile>().tileLinks.Where((TileLink x) => !x.closed))
					{
						if (Vector3.Distance(((Component)link).transform.position, ((Component)startTile).transform.position) > (float)size || ((Component)link).transform.position.y - ((Component)startTile).transform.position.y > (float)maxHeight || ((Component)link).transform.position.y - ((Component)startTile).transform.position.y < (float)(-maxDepth))
						{
							Debug.Log((object)"Closing tile link!!!");
							link.closed = true;
							if (Object.op_Implicit((Object)(object)link.wall))
							{
								link.wall.SetActive(true);
							}
						}
						else
						{
							creatingTile = true;
							CreateRandomTile(link, dTile);
						}
					}
				}
			}
			if (!generating)
			{
				Debug.Log((object)"FINISHED GENERATING DUNGEON!!! CLEANING UP!");
				CleanUp();
			}
			yield return 0;
		}

		private void CleanUp()
		{
			CheckAllLinks();
		}

		private void CheckAllLinks()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			TileLink[] allLinks = GetAllLinks();
			TileLink[] array = allLinks;
			foreach (TileLink link in array)
			{
				TileLink[] array2 = allLinks.Where((TileLink x) => (Object)(object)x != (Object)(object)link).ToArray();
				foreach (TileLink tileLink in array2)
				{
					if (Vector3.Distance(((Component)tileLink).transform.position, ((Component)link).transform.position) < 0.05f)
					{
						Debug.Log((object)"Opening walls of intersecting Links!");
						link.closed = false;
						link.wall.SetActive(false);
						tileLink.closed = false;
						tileLink.wall.SetActive(false);
					}
				}
			}
			Debug.Log((object)"FINISHED CLEANING UP THE DUNGEON!!!");
		}

		private TileLink[] GetAllLinks()
		{
			List<TileLink> list = new List<TileLink>();
			foreach (GameObject tile in CurrentDungeon.tiles)
			{
				DungeonTile component = tile.GetComponent<DungeonTile>();
				TileLink[] tileLinks = component.tileLinks;
				foreach (TileLink item in tileLinks)
				{
					list.Add(item);
				}
			}
			return list.ToArray();
		}

		public void DeleteCurrentDungeon()
		{
			if (CurrentDungeon == null)
			{
				return;
			}
			Debug.Log((object)"Deleting the dungeon!!!");
			foreach (GameObject item in CurrentDungeon.tiles.ToList())
			{
				Object.Destroy((Object)(object)item);
			}
			CurrentDungeon = new Dungeon();
		}

		private void CreateRandomTile(TileLink link, DungeonTile dTile)
		{
			//IL_0065: 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)
			Debug.Log((object)"Creating a tile!!!");
			GameObject val = SelectTile();
			if ((Object)(object)val != (Object)null)
			{
				Debug.Log((object)("Is tiled closed??:" + link.closed));
				if (SpaceLeft() > 0 && !link.closed)
				{
					if (CanUseThisTile(val))
					{
						GameObject tile = Object.Instantiate<GameObject>(val, ((Component)link).transform.position, ((Component)link).transform.rotation);
						ShouldThisTileStay(tile, link, dTile);
					}
					else
					{
						CreateRandomTile(link, dTile);
					}
				}
			}
			else
			{
				link.closed = true;
				if (Object.op_Implicit((Object)(object)link.wall))
				{
					link.wall.SetActive(true);
				}
				creatingTile = false;
			}
		}

		private void ShouldThisTileStay(GameObject tile, TileLink link, DungeonTile dTile)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			GameObject tile2 = tile;
			DungeonTile dTile2 = dTile;
			bool flag = false;
			DungeonTile component = tile2.GetComponent<DungeonTile>();
			foreach (GameObject item in CurrentDungeon.tiles.Where((GameObject x) => (Object)(object)x != (Object)(object)tile2 && (Object)(object)x != (Object)(object)((Component)dTile2).gameObject))
			{
				Bounds bounds = ((Renderer)tile2.GetComponent<DungeonTile>().meshRenderer).bounds;
				Bounds bounds2 = ((Renderer)item.GetComponent<DungeonTile>().meshRenderer).bounds;
				if (((Bounds)(ref bounds)).Intersects(bounds2))
				{
					Bounds val = default(Bounds);
					((Bounds)(ref val)).SetMinMax(Vector3.Max(((Bounds)(ref bounds)).min, ((Bounds)(ref bounds2)).min), Vector3.Min(((Bounds)(ref bounds)).max, ((Bounds)(ref bounds2)).max));
					if (DiversityLib.Volume(((Bounds)(ref val)).size) > 1f)
					{
						flag = true;
						break;
					}
				}
			}
			if (flag)
			{
				Debug.Log((object)(component.tileName + " Is intersecting and will be deleted!"));
				Object.Destroy((Object)(object)tile2);
				link.closed = true;
				if (Object.op_Implicit((Object)(object)link.wall))
				{
					link.wall.SetActive(true);
				}
			}
			else
			{
				Debug.Log((object)"Tile is good. Keeping it for the dungeon.");
				CurrentDungeon.tiles.Add(tile2);
				link.closed = true;
				CloseNearbyLink(link, tile2.GetComponent<DungeonTile>());
			}
			creatingTile = false;
		}

		private void CloseNearbyLink(TileLink link, DungeonTile tile)
		{
			//IL_0021: 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)
			float num = 1000f;
			TileLink tileLink = null;
			TileLink[] tileLinks = tile.tileLinks;
			foreach (TileLink tileLink2 in tileLinks)
			{
				float num2 = Vector3.Distance(((Component)link).transform.position, ((Component)tileLink2).transform.position);
				if (num2 < num)
				{
					num = num2;
					tileLink = tileLink2;
				}
			}
			if ((Object)(object)tileLink != (Object)null)
			{
				tileLink.closed = true;
			}
		}

		private TileLink ClosestLink(TileLink link, DungeonTile tile)
		{
			//IL_0021: 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)
			float num = 1000f;
			TileLink result = null;
			TileLink[] tileLinks = tile.tileLinks;
			foreach (TileLink tileLink in tileLinks)
			{
				float num2 = Vector3.Distance(((Component)link).transform.position, ((Component)tileLink).transform.position);
				if (num2 < num)
				{
					num = num2;
					result = tileLink;
				}
			}
			return result;
		}

		private GameObject SelectTile()
		{
			GameObject[] array = (from x in RegisteredTiles.Union(Instance.tiles.ToList())
				where x.GetComponent<DungeonTile>().isMandatory
				where CurrentDungeon.tiles.Any((GameObject y) => Object.op_Implicit((Object)(object)(x = y)))
				select x).ToArray();
			if (SpaceLeft() <= array.Length && array.Length != 0)
			{
				return array[Random.Range(0, array.Length)];
			}
			float num = (float)AmountOfTiles() / (float)(CurrentDungeon.size * (CurrentDungeon.maxHeight + CurrentDungeon.maxDepth));
			Debug.Log((object)("Does the dungeon have enough space: " + (AmountOfTiles() <= CurrentDungeon.size)));
			if (AmountOfTiles() <= CurrentDungeon.size || !(Random.value <= 0.15f + num))
			{
				return RegisteredTiles.Union(Instance.tiles.ToList()).ToList()[Random.Range(0, RegisteredTiles.Union(Instance.tiles.ToList()).ToList().Count)];
			}
			Debug.Log((object)"Not Generating This Tile!");
			return null;
		}

		private bool CanUseThisTile(GameObject tile)
		{
			GameObject tile2 = tile;
			return (CurrentDungeon.tiles.Where((GameObject x) => x.GetComponent<DungeonTile>().tileName == tile2.GetComponent<DungeonTile>().tileName).ToArray().Length < tile2.GetComponent<DungeonTile>().maxAmount && tile2.GetComponent<DungeonTile>().isLimited) || !tile2.GetComponent<DungeonTile>().isLimited;
		}

		private int SpaceLeft()
		{
			int num = 0;
			Debug.Log((object)CurrentDungeon.tiles.Count);
			if (CurrentDungeon.tiles.Count <= 0)
			{
				return 0;
			}
			foreach (GameObject tile in CurrentDungeon.tiles)
			{
				DungeonTile component = tile.GetComponent<DungeonTile>();
				if (Object.op_Implicit((Object)(object)component))
				{
					num += component.tileLinks.Where((TileLink x) => !x.closed).Count();
				}
				else
				{
					Debug.LogError((object)"Something happened when trying to look for space left while generating a dungeon!");
				}
			}
			return num;
		}

		private int AmountOfTiles()
		{
			return CurrentDungeon.tiles.Count;
		}
	}
	public class DungeonTile : MonoBehaviour
	{
		public string tileName;

		public float probability;

		public MeshRenderer meshRenderer;

		public TileLink[] tileLinks;

		public bool isMandatory;

		public bool isLimited;

		public int maxAmount;
	}
	public class TileLink : MonoBehaviour
	{
		public GameObject wall;

		public bool closed = false;
	}
}

DiversityLib.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DiversityLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DiversityLib")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f3aa347e-bdfa-4c6a-b93f-1429e4f206c4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace DiversityLib
{
	public static class DiversityLib
	{
		public static Texture2D RenderToTexture2D(this RenderTexture rTex)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(((Texture)rTex).width, ((Texture)rTex).height, (TextureFormat)4, false);
			RenderTexture.active = rTex;
			val.ReadPixels(new Rect(0f, 0f, (float)((Texture)rTex).width, (float)((Texture)rTex).height), 0, 0);
			val.Apply();
			return val;
		}

		public static Color[] GetPixels(this RenderTexture texture)
		{
			Texture2D val = texture.RenderToTexture2D();
			return val.GetPixels();
		}

		public static float CalculateAverageLuminance(this RenderTexture texture, bool useAlpha = false)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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)
			Texture2D val = texture.RenderToTexture2D();
			float num = ((Texture)val).width * ((Texture)val).height;
			float num2 = 0f;
			Color[] pixels = val.GetPixels();
			foreach (Color color in pixels)
			{
				num2 += color.CalculateLuminance(useAlpha);
			}
			return num2 / num;
		}

		public static float CalculateAverageLuminance(this Texture2D texture, bool useAlpha = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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)
			float num = ((Texture)texture).width * ((Texture)texture).height;
			float num2 = 0f;
			Color[] pixels = texture.GetPixels();
			foreach (Color color in pixels)
			{
				num2 += color.CalculateLuminance(useAlpha);
			}
			return num2 / num;
		}

		public static float CalculateAverageLuminance(this Color[] colorArray, bool useAlpha = false)
		{
			//IL_0015: 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)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			float num = colorArray.Length;
			float num2 = 0f;
			foreach (Color color in colorArray)
			{
				num2 += color.CalculateLuminance(useAlpha);
			}
			return num2 / num;
		}

		public static Color AverageDifference(this Texture2D texture, Texture2D secondTexture)
		{
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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)
			float num = ((Texture)texture).width * ((Texture)texture).height;
			float num2 = 0f;
			float num3 = 0f;
			float num4 = 0f;
			float num5 = 0f;
			for (int i = 0; i < ((Texture)texture).width; i++)
			{
				for (int j = 0; j < ((Texture)texture).height; j++)
				{
					Color pixel = texture.GetPixel(i, j);
					Color pixel2 = secondTexture.GetPixel(i, j);
					num2 += Mathf.Abs(pixel.r - pixel2.r);
					num3 += Mathf.Abs(pixel.g - pixel2.g);
					num4 += Mathf.Abs(pixel.b - pixel2.b);
					num5 += Mathf.Abs(pixel.a - pixel2.a);
				}
			}
			num2 /= num;
			num3 /= num;
			num4 /= num;
			num5 /= num;
			return new Color(num2, num3, num4, num5);
		}

		public static float BW(this Color col)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return col.r + col.g + col.b;
		}

		public static float CalculateLuminance(this Color color, bool useAlpha = false)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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)
			return 0.299f * color.r * (useAlpha ? color.a : 1f) + 0.587f * color.g * (useAlpha ? color.a : 1f) + 0.114f * color.b * (useAlpha ? color.a : 1f);
		}

		public static Color GetAverageRGBA(this RenderTexture texture)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Texture2D texture2 = texture.RenderToTexture2D();
			return texture2.GetAverageRGBA();
		}

		public static Color GetAverageRGBA(this Texture2D texture)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			float num = ((Texture)texture).width * ((Texture)texture).height;
			float num2 = 0f;
			float num3 = 0f;
			float num4 = 0f;
			float num5 = 0f;
			Color[] pixels = texture.GetPixels();
			foreach (Color val in pixels)
			{
				num2 += val.r;
				num3 += val.g;
				num4 += val.b;
				num5 += val.a;
			}
			return new Color(num2 / num, num3 / num, num4 / num, num5 / num);
		}

		public static Color GetAverageRGBA(this Color[] colorArray)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			float num = colorArray.Length;
			float num2 = 0f;
			float num3 = 0f;
			float num4 = 0f;
			float num5 = 0f;
			foreach (Color val in colorArray)
			{
				num2 += val.r;
				num3 += val.g;
				num4 += val.b;
				num5 += val.a;
			}
			return new Color(num2 / num, num3 / num, num4 / num, num5 / num);
		}

		public static float Remap(this float value, float from1, float to1, float from2, float to2)
		{
			return (value - from1) / (to1 - from1) * (to2 - from2) + from2;
		}

		public static float OneMinus(this float f)
		{
			return 1f - f;
		}

		public static float Negate(this float f)
		{
			return 0f - f;
		}

		public static uint Random(this uint u)
		{
			Random random = new Random();
			uint num = (uint)random.Next(1073741824);
			uint num2 = (uint)random.Next(4);
			return (num << 2) | num2;
		}

		public static float Volume(this Vector3 v3)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return v3.x * v3.y * v3.z;
		}
	}
}