Decompiled source of Empress The Hollow v1.0.0

BepInEx\plugins\Empress-Hollow\EmpressHollow.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using REPOLib.Modules;
using REPOLib.Objects.Sdk;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Empress")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EmpressHollow")]
[assembly: AssemblyTitle("EmpressHollow")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 Empress.REPO.Hollow
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.empress.repo.hollow", "Empress Hollow", "1.0.0")]
	public sealed class EmpressHollowPlugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.empress.repo.hollow";

		public const string PluginName = "Empress Hollow";

		public const string PluginVersion = "1.0.0";

		public const string LevelName = "Level - Empress Hollow";

		public const string DisplayName = "Empress - The Hollow";

		internal const byte StalkerSyncEventCode = 184;

		internal const byte GrabEventCode = 185;

		internal const byte ObserveEventCode = 186;

		internal const byte AmbientEventCode = 187;

		internal const byte NoteEventCode = 188;

		internal const byte CompletionEventCode = 189;

		private static bool _photonHooked;

		private Harmony _harmony;

		internal static EmpressHollowPlugin Instance { get; private set; }

		internal static ManualLogSource Log { get; private set; }

		internal static HollowSettings Settings { get; private set; }

		internal static Level HollowLevel { get; private set; }

		internal static string PluginDirectory { get; private set; }

		private void Awake()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			Settings = new HollowSettings(((BaseUnityPlugin)this).Config);
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			HollowLevel = HollowLevelRegistry.RegisterLevel();
			HollowAudio.Initialize();
			_harmony = new Harmony("com.empress.repo.hollow");
			_harmony.PatchAll(typeof(EmpressHollowPlugin).Assembly);
			HollowRuntime.EnsureHost();
			((MonoBehaviour)this).StartCoroutine(HollowAudio.LoadExternal());
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Empress Hollow v1.0.0 loaded. Level registered: Level - Empress Hollow");
		}

		private void OnDestroy()
		{
			RemovePhotonHook();
		}

		internal static bool IsHollowLevel(Level level)
		{
			if ((Object)(object)level != (Object)null)
			{
				return ((Object)level).name == "Level - Empress Hollow";
			}
			return false;
		}

		internal static void EnsurePhotonHooked()
		{
			if (!_photonHooked)
			{
				LoadBalancingClient networkingClient = PhotonNetwork.NetworkingClient;
				if (networkingClient != null)
				{
					networkingClient.EventReceived -= OnPhotonEvent;
					networkingClient.EventReceived += OnPhotonEvent;
					_photonHooked = true;
				}
			}
		}

		internal static void RemovePhotonHook()
		{
			if (_photonHooked)
			{
				LoadBalancingClient networkingClient = PhotonNetwork.NetworkingClient;
				if (networkingClient != null)
				{
					networkingClient.EventReceived -= OnPhotonEvent;
				}
				_photonHooked = false;
			}
		}

		private static void OnPhotonEvent(EventData ev)
		{
			if (ev.CustomData is object[] data)
			{
				Dispatch(ev.Code, data);
			}
		}

		private static void Dispatch(byte code, object[] data)
		{
			HollowRuntime instance = HollowRuntime.Instance;
			if (!((Object)(object)instance == (Object)null) && data != null)
			{
				switch (code)
				{
				case 184:
					instance.ReceiveStalkerSync(data);
					break;
				case 185:
					instance.ReceiveGrab(data);
					break;
				case 186:
					instance.ReceiveObserve(data);
					break;
				case 187:
					instance.ReceiveAmbient(data);
					break;
				case 188:
					instance.ReceiveNote(data);
					break;
				case 189:
					instance.ReceiveCompletion(data);
					break;
				}
			}
		}

		internal static void DebugLog(string message)
		{
			if (Settings != null && Settings.DebugLogs.Value)
			{
				Log.LogInfo((object)message);
			}
		}

		internal static void RaiseToOthers(byte code, object[] data, bool reliable = true)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			EnsurePhotonHooked();
			if (PhotonNetwork.InRoom)
			{
				RaiseEventOptions val = new RaiseEventOptions
				{
					Receivers = (ReceiverGroup)0
				};
				PhotonNetwork.RaiseEvent(code, (object)data, val, reliable ? SendOptions.SendReliable : SendOptions.SendUnreliable);
			}
		}

		internal static void RaiseToMaster(byte code, object[] data)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			EnsurePhotonHooked();
			if (PhotonNetwork.InRoom)
			{
				RaiseEventOptions val = new RaiseEventOptions
				{
					Receivers = (ReceiverGroup)2
				};
				PhotonNetwork.RaiseEvent(code, (object)data, val, SendOptions.SendUnreliable);
			}
		}

		internal static void RaiseToAll(byte code, object[] data)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			EnsurePhotonHooked();
			if (!PhotonNetwork.InRoom)
			{
				Dispatch(code, data);
				return;
			}
			RaiseEventOptions val = new RaiseEventOptions
			{
				Receivers = (ReceiverGroup)1
			};
			PhotonNetwork.RaiseEvent(code, (object)data, val, SendOptions.SendReliable);
		}
	}
	internal sealed class HollowSettings
	{
		public readonly ConfigEntry<bool> ForceLevel;

		public readonly ConfigEntry<int> TreeCount;

		public readonly ConfigEntry<float> ForestRadius;

		public readonly ConfigEntry<float> StalkerSpeed;

		public readonly ConfigEntry<float> GrabRange;

		public readonly ConfigEntry<float> MasterVolume;

		public readonly ConfigEntry<bool> DebugLogs;

		public HollowSettings(ConfigFile config)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			DebugLogs = config.Bind<bool>("Debug", "DebugLogs", false, "Logs verbose Empress Hollow diagnostics. Off by default.");
			ForceLevel = config.Bind<bool>("Debug", "ForceLevel", false, "Forces every real run level to load Empress - The Hollow. Useful for testing.");
			TreeCount = config.Bind<int>("Forest", "TreeCount", 240, new ConfigDescription("How many trees fill the forest. Lower this if your machine struggles.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(40, 600), Array.Empty<object>()));
			ForestRadius = config.Bind<float>("Forest", "ForestRadius", 95f, new ConfigDescription("Radius of the forest in meters.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(40f, 200f), Array.Empty<object>()));
			StalkerSpeed = config.Bind<float>("Stalker", "Speed", 3.4f, new ConfigDescription("How fast the Stalker closes in while nobody is looking.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 8f), Array.Empty<object>()));
			GrabRange = config.Bind<float>("Stalker", "GrabRange", 2.6f, new ConfigDescription("Distance at which the Stalker can reach out and grab a player.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1.5f, 5f), Array.Empty<object>()));
			MasterVolume = config.Bind<float>("Audio", "MasterVolume", 0.85f, new ConfigDescription("Volume of the forest ambience and Stalker sounds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
		}
	}
	internal static class HollowAccess
	{
		private delegate void ModuleSetAllChecklistDelegate(Module module);

		private delegate void LevelGeneratorGenerateDoneDelegate(LevelGenerator instance, PhotonMessageInfo info);

		private static readonly FieldInfo EnvironmentSetupDoneField = AccessTools.Field(typeof(EnvironmentDirector), "SetupDone");

		private static readonly FieldInfo EnvironmentMainCameraField = AccessTools.Field(typeof(EnvironmentDirector), "MainCamera");

		private static readonly FieldInfo EnvironmentAmbientColorField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColor");

		private static readonly FieldInfo EnvironmentAmbientColorNewField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorNew");

		private static readonly FieldInfo EnvironmentAmbientColorPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorPrevious");

		private static readonly FieldInfo EnvironmentAmbientColorAdaptationField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptation");

		private static readonly FieldInfo EnvironmentAmbientColorAdaptationNewField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptationNew");

		private static readonly FieldInfo EnvironmentAmbientColorAdaptationPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptationPrevious");

		private static readonly FieldInfo EnvironmentDarkAdaptationLerpField = AccessTools.Field(typeof(EnvironmentDirector), "DarkAdaptationLerp");

		private static readonly FieldInfo EnvironmentFogColorField = AccessTools.Field(typeof(EnvironmentDirector), "FogColor");

		private static readonly FieldInfo EnvironmentFogColorNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogColorNew");

		private static readonly FieldInfo EnvironmentFogColorPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogColorPrevious");

		private static readonly FieldInfo EnvironmentFogStartDistanceField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistance");

		private static readonly FieldInfo EnvironmentFogStartDistanceNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistanceNew");

		private static readonly FieldInfo EnvironmentFogStartDistancePreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistancePrevious");

		private static readonly FieldInfo EnvironmentFogEndDistanceField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistance");

		private static readonly FieldInfo EnvironmentFogEndDistanceNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistanceNew");

		private static readonly FieldInfo EnvironmentFogEndDistancePreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistancePrevious");

		private static readonly FieldInfo LevelGeneratorAllPlayersReadyField = AccessTools.Field(typeof(LevelGenerator), "AllPlayersReady");

		private static readonly FieldInfo LevelGeneratorEnemyReadyField = AccessTools.Field(typeof(LevelGenerator), "EnemyReady");

		private static readonly FieldInfo LevelGeneratorModulesSpawnedField = AccessTools.Field(typeof(LevelGenerator), "ModulesSpawned");

		private static readonly FieldInfo LevelGeneratorPlayerSpawnedField = AccessTools.Field(typeof(LevelGenerator), "playerSpawned");

		private static readonly FieldInfo RunManagerLevelPreviousField = AccessTools.Field(typeof(RunManager), "levelPrevious");

		private static readonly FieldInfo PlayerAvatarIsDisabledField = AccessTools.Field(typeof(PlayerAvatar), "isDisabled");

		private static readonly FieldInfo PlayerAvatarDeadSetField = AccessTools.Field(typeof(PlayerAvatar), "deadSet");

		private static readonly FieldInfo PlayerAvatarTumbleField = AccessTools.Field(typeof(PlayerAvatar), "tumble");

		private static readonly FieldInfo RoundDirectorExtractionPointsField = AccessTools.Field(typeof(RoundDirector), "extractionPoints");

		private static readonly FieldInfo RoundDirectorExtractionPointsCompletedField = AccessTools.Field(typeof(RoundDirector), "extractionPointsCompleted");

		private static readonly FieldInfo RoundDirectorExtractionPointListField = AccessTools.Field(typeof(RoundDirector), "extractionPointList");

		private static readonly FieldInfo RoundDirectorHaulGoalField = AccessTools.Field(typeof(RoundDirector), "haulGoal");

		private static readonly FieldInfo RoundDirectorHaulGoalMaxField = AccessTools.Field(typeof(RoundDirector), "haulGoalMax");

		private static readonly FieldInfo RoundDirectorExtractionPointActiveField = AccessTools.Field(typeof(RoundDirector), "extractionPointActive");

		private static readonly FieldInfo RoundDirectorAllExtractionCompletedField = AccessTools.Field(typeof(RoundDirector), "allExtractionPointsCompleted");

		private static readonly FieldInfo ValuableDirectorTargetAmountField = AccessTools.Field(typeof(ValuableDirector), "valuableTargetAmount");

		private static readonly FieldInfo ValuableDirectorTotalMaxValueField = AccessTools.Field(typeof(ValuableDirector), "totalMaxValue");

		private static readonly FieldInfo LevelValuablesTinyField = AccessTools.Field(typeof(LevelValuables), "tiny");

		private static readonly FieldInfo LevelValuablesSmallField = AccessTools.Field(typeof(LevelValuables), "small");

		private static readonly FieldInfo LevelValuablesMediumField = AccessTools.Field(typeof(LevelValuables), "medium");

		private static readonly FieldInfo LevelValuablesBigField = AccessTools.Field(typeof(LevelValuables), "big");

		private static readonly FieldInfo LevelValuablesWideField = AccessTools.Field(typeof(LevelValuables), "wide");

		private static readonly FieldInfo LevelValuablesTallField = AccessTools.Field(typeof(LevelValuables), "tall");

		private static readonly FieldInfo LevelValuablesVeryTallField = AccessTools.Field(typeof(LevelValuables), "veryTall");

		private static readonly FieldInfo LevelValuablePresetsField = AccessTools.Field(typeof(Level), "ValuablePresets");

		private static readonly FieldInfo ModuleSetupDoneField = AccessTools.Field(typeof(Module), "SetupDone");

		private static readonly FieldInfo ModuleStartRoomField = AccessTools.Field(typeof(Module), "StartRoom");

		private static readonly FieldInfo ModuleGridXField = AccessTools.Field(typeof(Module), "GridX");

		private static readonly FieldInfo ModuleGridYField = AccessTools.Field(typeof(Module), "GridY");

		private static readonly FieldInfo ModuleFirstField = AccessTools.Field(typeof(Module), "First");

		private static readonly FieldInfo LevelPointInStartRoomField = AccessTools.Field(typeof(LevelPoint), "inStartRoom");

		private static readonly MethodInfo ModuleSetAllChecklistMethod = AccessTools.Method(typeof(Module), "SetAllChecklist", (Type[])null, (Type[])null);

		private static readonly MethodInfo LevelGeneratorGenerateDoneMethod = AccessTools.Method(typeof(LevelGenerator), "GenerateDone", new Type[1] { typeof(PhotonMessageInfo) }, (Type[])null);

		private static readonly ModuleSetAllChecklistDelegate ModuleSetAllChecklistCall = CreateDelegate<ModuleSetAllChecklistDelegate>(ModuleSetAllChecklistMethod);

		private static readonly LevelGeneratorGenerateDoneDelegate LevelGeneratorGenerateDoneCall = CreateDelegate<LevelGeneratorGenerateDoneDelegate>(LevelGeneratorGenerateDoneMethod);

		public static void SetEnvironmentFog(EnvironmentDirector director, Color color, float startDistance, float endDistance)
		{
			//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_0028: Unknown result type (might be due to invalid IL or missing references)
			SetField(EnvironmentFogColorField, director, color);
			SetField(EnvironmentFogColorNewField, director, color);
			SetField(EnvironmentFogColorPreviousField, director, color);
			SetField(EnvironmentFogStartDistanceField, director, startDistance);
			SetField(EnvironmentFogStartDistanceNewField, director, startDistance);
			SetField(EnvironmentFogStartDistancePreviousField, director, startDistance);
			SetField(EnvironmentFogEndDistanceField, director, endDistance);
			SetField(EnvironmentFogEndDistanceNewField, director, endDistance);
			SetField(EnvironmentFogEndDistancePreviousField, director, endDistance);
		}

		public static void SetEnvironmentAmbient(EnvironmentDirector director, Color ambient, Color adaptation)
		{
			//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_0028: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			SetField(EnvironmentAmbientColorField, director, ambient);
			SetField(EnvironmentAmbientColorNewField, director, ambient);
			SetField(EnvironmentAmbientColorPreviousField, director, ambient);
			SetField(EnvironmentAmbientColorAdaptationField, director, adaptation);
			SetField(EnvironmentAmbientColorAdaptationNewField, director, adaptation);
			SetField(EnvironmentAmbientColorAdaptationPreviousField, director, adaptation);
		}

		public static void SetEnvironmentDarkAdaptation(EnvironmentDirector director, float value)
		{
			SetField(EnvironmentDarkAdaptationLerpField, director, value);
		}

		public static Camera GetEnvironmentMainCamera(EnvironmentDirector director)
		{
			return Get<Camera>(EnvironmentMainCameraField, director);
		}

		public static void SetEnvironmentMainCamera(EnvironmentDirector director, Camera camera)
		{
			SetField(EnvironmentMainCameraField, director, camera);
		}

		public static void SetEnvironmentSetupDone(EnvironmentDirector director, bool value)
		{
			SetField(EnvironmentSetupDoneField, director, value);
		}

		public static void SetAllPlayersReady(LevelGenerator generator, bool value)
		{
			SetField(LevelGeneratorAllPlayersReadyField, generator, value);
		}

		public static bool GetAllPlayersReady(LevelGenerator generator)
		{
			return GetBool(LevelGeneratorAllPlayersReadyField, generator);
		}

		public static void SetLevelPrevious(RunManager manager, Level level)
		{
			SetField(RunManagerLevelPreviousField, manager, level);
		}

		public static void SetEnemyReady(LevelGenerator generator, bool value)
		{
			SetField(LevelGeneratorEnemyReadyField, generator, value);
		}

		public static void SetModulesSpawned(LevelGenerator generator, int value)
		{
			SetField(LevelGeneratorModulesSpawnedField, generator, value);
		}

		public static void SetPlayerSpawnedCount(LevelGenerator generator, int value)
		{
			SetField(LevelGeneratorPlayerSpawnedField, generator, value);
		}

		public static int GetPlayerSpawnedCount(LevelGenerator generator)
		{
			return GetInt(LevelGeneratorPlayerSpawnedField, generator);
		}

		public static bool GetIsDisabled(PlayerAvatar avatar)
		{
			return GetBool(PlayerAvatarIsDisabledField, avatar);
		}

		public static bool GetDeadSet(PlayerAvatar avatar)
		{
			return GetBool(PlayerAvatarDeadSetField, avatar);
		}

		public static PlayerTumble GetPlayerTumble(PlayerAvatar avatar)
		{
			return Get<PlayerTumble>(PlayerAvatarTumbleField, avatar);
		}

		public static int GetValuableTargetAmount(ValuableDirector director)
		{
			return GetInt(ValuableDirectorTargetAmountField, director);
		}

		public static float GetValuableTotalMaxValue(ValuableDirector director)
		{
			if (ValuableDirectorTotalMaxValueField == null || (Object)(object)director == (Object)null)
			{
				return 0f;
			}
			object value = ValuableDirectorTotalMaxValueField.GetValue(director);
			if (value is float)
			{
				return (float)value;
			}
			return 0f;
		}

		public static int GetHaulGoal(RoundDirector director)
		{
			return GetInt(RoundDirectorHaulGoalField, director);
		}

		public static int GetHaulGoalMax(RoundDirector director)
		{
			return GetInt(RoundDirectorHaulGoalMaxField, director);
		}

		public static void SetHaulGoal(RoundDirector director, int value)
		{
			SetField(RoundDirectorHaulGoalField, director, value);
		}

		public static bool GetExtractionPointActive(RoundDirector director)
		{
			return GetBool(RoundDirectorExtractionPointActiveField, director);
		}

		public static bool GetAllExtractionPointsCompleted(RoundDirector director)
		{
			return GetBool(RoundDirectorAllExtractionCompletedField, director);
		}

		public static void ResetRoundExtraction(RoundDirector director)
		{
			SetField(RoundDirectorExtractionPointsField, director, 0);
			SetField(RoundDirectorExtractionPointsCompletedField, director, 0);
			Get<List<GameObject>>(RoundDirectorExtractionPointListField, director)?.Clear();
		}

		public static List<LevelValuables> GetValuablePresets(Level level)
		{
			return Get<List<LevelValuables>>(LevelValuablePresetsField, level);
		}

		public static List<PrefabRef> GetValuableList(LevelValuables valuables, Type type)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected I4, but got Unknown
			return Get<List<PrefabRef>>((int)type switch
			{
				0 => LevelValuablesTinyField, 
				1 => LevelValuablesSmallField, 
				2 => LevelValuablesMediumField, 
				3 => LevelValuablesBigField, 
				4 => LevelValuablesWideField, 
				5 => LevelValuablesTallField, 
				_ => LevelValuablesVeryTallField, 
			}, valuables);
		}

		public static void SetValuablePresets(Level level, List<LevelValuables> presets)
		{
			SetField(LevelValuablePresetsField, level, presets);
		}

		public static bool PresetHasContent(LevelValuables preset)
		{
			if ((Object)(object)preset == (Object)null)
			{
				return false;
			}
			if (CountList(LevelValuablesTinyField, preset) <= 0 && CountList(LevelValuablesSmallField, preset) <= 0 && CountList(LevelValuablesMediumField, preset) <= 0 && CountList(LevelValuablesBigField, preset) <= 0 && CountList(LevelValuablesWideField, preset) <= 0 && CountList(LevelValuablesTallField, preset) <= 0)
			{
				return CountList(LevelValuablesVeryTallField, preset) > 0;
			}
			return true;
		}

		public static void ConfigureStartRoomModule(Module module, int gridX, int gridY)
		{
			ModuleSetAllChecklistCall?.Invoke(module);
			SetField(ModuleSetupDoneField, module, true);
			SetField(ModuleStartRoomField, module, true);
			SetField(ModuleFirstField, module, true);
			SetField(ModuleGridXField, module, gridX);
			SetField(ModuleGridYField, module, gridY);
		}

		public static void MarkLevelPointInStartRoom(LevelPoint point, bool value)
		{
			SetField(LevelPointInStartRoomField, point, value);
		}

		public static void GenerateDone(LevelGenerator generator)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			LevelGeneratorGenerateDoneCall?.Invoke(generator, default(PhotonMessageInfo));
		}

		private static int CountList(FieldInfo field, object instance)
		{
			if (!(((field != null && instance != null) ? field.GetValue(instance) : null) is ICollection collection))
			{
				return 0;
			}
			return collection.Count;
		}

		private static T Get<T>(FieldInfo field, object instance) where T : class
		{
			if (field == null || instance == null)
			{
				return null;
			}
			return field.GetValue(instance) as T;
		}

		private static bool GetBool(FieldInfo field, object instance)
		{
			if (field == null || instance == null)
			{
				return false;
			}
			object value = field.GetValue(instance);
			bool flag = default(bool);
			int num;
			if (value is bool)
			{
				flag = (bool)value;
				num = 1;
			}
			else
			{
				num = 0;
			}
			return (byte)((uint)num & (flag ? 1u : 0u)) != 0;
		}

		private static int GetInt(FieldInfo field, object instance)
		{
			if (field == null || instance == null)
			{
				return 0;
			}
			object value = field.GetValue(instance);
			if (value is int)
			{
				return (int)value;
			}
			return 0;
		}

		private static void SetField(FieldInfo field, object instance, object value)
		{
			if (!(field == null) && instance != null)
			{
				field.SetValue(instance, value);
			}
		}

		private static TDelegate CreateDelegate<TDelegate>(MethodInfo method) where TDelegate : Delegate
		{
			if (method == null)
			{
				return null;
			}
			return AccessTools.MethodDelegate<TDelegate>(method, (object)null, true);
		}
	}
	internal static class HollowAudio
	{
		private const int SampleRate = 44100;

		private static AudioClip _wind;

		private static AudioClip _static;

		private static AudioClip _grab;

		private static AudioClip _sink;

		private static AudioClip _creak;

		private static AudioClip _heartbeat;

		private static AudioClip _whisper;

		private static AudioClip _stalkerMove;

		private static AudioClip _complete;

		private static bool _initialized;

		public static AudioClip WindClip => _wind;

		public static AudioClip StaticClip => _static;

		public static AudioClip StalkerMoveClip => _stalkerMove;

		public static void Initialize()
		{
			if (!_initialized)
			{
				_initialized = true;
				_wind = BuildWind();
				_static = BuildStatic();
				_grab = BuildGrab();
				_sink = BuildSink();
				_creak = BuildCreak();
				_heartbeat = BuildHeartbeat();
				_whisper = BuildWhisper();
			}
		}

		public static IEnumerator LoadExternal()
		{
			yield return LoadClip("hollow_wind.ogg", delegate(AudioClip clip)
			{
				_wind = clip;
			});
			yield return LoadClip("hollow_static.ogg", delegate(AudioClip clip)
			{
				_static = clip;
			});
			yield return LoadClip("hollow_stalker_move.ogg", delegate(AudioClip clip)
			{
				_stalkerMove = clip;
			});
			yield return LoadClip("hollow_stalker_grab.ogg", delegate(AudioClip clip)
			{
				_grab = clip;
			});
			yield return LoadClip("hollow_stalker_sink.ogg", delegate(AudioClip clip)
			{
				_sink = clip;
			});
			yield return LoadClip("hollow_creak.ogg", delegate(AudioClip clip)
			{
				_creak = clip;
			});
			yield return LoadClip("hollow_heartbeat.ogg", delegate(AudioClip clip)
			{
				_heartbeat = clip;
			});
			yield return LoadClip("hollow_whisper.ogg", delegate(AudioClip clip)
			{
				_whisper = clip;
			});
			yield return LoadClip("hollow_complete.ogg", delegate(AudioClip clip)
			{
				_complete = clip;
			});
			HollowRuntime.Instance?.RefreshAudioClips();
		}

		public static void PlayGrab(Vector3 position)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Play(_grab, position, 1f, 0.95f, 1.05f);
		}

		public static void PlaySink(Vector3 position)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Play(_sink, position, 0.85f, 0.9f, 1.05f);
		}

		public static void PlayCreak(Vector3 position)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Play(_creak, position, Random.Range(0.42f, 0.68f), 0.7f, 1.08f, 0.18f, 55f);
		}

		public static void PlayHeartbeat(Vector3 position)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Play(_heartbeat, position, 0.7f);
		}

		public static void PlayWhisper(Vector3 position)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Play(_whisper, position, Random.Range(0.3f, 0.52f), 0.76f, 1.22f, 0.22f, 46f);
		}

		public static void PlayComplete(Vector3 position)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Play(_complete, position, 1f, 1f, 1f);
		}

		private static IEnumerator LoadClip(string fileName, Action<AudioClip> assign)
		{
			string text = Path.Combine(EmpressHollowPlugin.PluginDirectory, fileName);
			if (!File.Exists(text))
			{
				yield break;
			}
			UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(new Uri(text).AbsoluteUri, (AudioType)14);
			try
			{
				yield return request.SendWebRequest();
				if ((int)request.result != 1)
				{
					EmpressHollowPlugin.Log.LogWarning((object)("Empress Hollow could not load " + fileName + ": " + request.error));
					yield break;
				}
				AudioClip content = DownloadHandlerAudioClip.GetContent(request);
				if ((Object)(object)content != (Object)null)
				{
					((Object)content).name = "Empress Hollow " + Path.GetFileNameWithoutExtension(fileName);
					assign(content);
				}
			}
			finally
			{
				((IDisposable)request)?.Dispose();
			}
		}

		private static void Play(AudioClip clip, Vector3 position, float volume, float pitchMin = 0.97f, float pitchMax = 1.03f, float startVariation = 0f, float maxDistance = 38f)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			if ((Object)(object)clip == (Object)null)
			{
				return;
			}
			float num = ((EmpressHollowPlugin.Settings != null) ? EmpressHollowPlugin.Settings.MasterVolume.Value : 0.85f);
			if (!(num <= 0f))
			{
				GameObject val = new GameObject("Empress Hollow Audio");
				val.transform.position = position;
				AudioSource val2 = val.AddComponent<AudioSource>();
				val2.clip = clip;
				val2.volume = Mathf.Clamp01(volume * num);
				val2.pitch = Random.Range(pitchMin, pitchMax);
				val2.spatialBlend = 1f;
				val2.rolloffMode = (AudioRolloffMode)1;
				val2.minDistance = 2.5f;
				val2.maxDistance = maxDistance;
				val2.dopplerLevel = 0f;
				ApplyRepoMixer(val2);
				if (startVariation > 0f && clip.length > 0.25f)
				{
					val2.time = Random.Range(0f, Mathf.Min(clip.length * startVariation, clip.length - 0.2f));
				}
				val2.Play();
				Object.Destroy((Object)val, (clip.length - val2.time) / Mathf.Max(0.5f, val2.pitch) + 0.2f);
			}
		}

		public static void ApplyRepoMixer(AudioSource source)
		{
			if ((Object)(object)source != (Object)null && (Object)(object)AudioManager.instance != (Object)null)
			{
				source.outputAudioMixerGroup = AudioManager.instance.SoundMasterGroup;
			}
		}

		private static AudioClip MakeClip(string name, float[] data)
		{
			AudioClip obj = AudioClip.Create(name, data.Length, 1, 44100, false);
			obj.SetData(data, 0);
			return obj;
		}

		private static AudioClip BuildWind()
		{
			int num = 220500;
			int num2 = 17640;
			float[] array = new float[num + num2];
			float num3 = 0f;
			float num4 = 0f;
			for (int i = 0; i < array.Length; i++)
			{
				float num5 = (float)i / 44100f;
				float num6 = Random.value * 2f - 1f;
				num3 = num3 * 0.96f + num6 * 0.04f;
				num4 = num4 * 0.9f + num3 * 0.1f;
				float num7 = 0.5f + 0.5f * Mathf.PerlinNoise(num5 * 0.3f, 0f);
				array[i] = num4 * num7 * 0.5f;
			}
			float[] array2 = new float[num];
			Array.Copy(array, array2, num);
			for (int j = 0; j < num2; j++)
			{
				float num8 = (float)j / (float)num2;
				array2[j] = array2[j] * num8 + array[num + j] * (1f - num8);
			}
			return MakeClip("EmpressHollowWind", array2);
		}

		private static AudioClip BuildStatic()
		{
			int num = 88200;
			int num2 = 8820;
			float[] array = new float[num + num2];
			for (int i = 0; i < array.Length; i++)
			{
				float num3 = (float)i / 44100f;
				float num4 = Random.value * 2f - 1f;
				float num5 = Mathf.Sin(MathF.PI * 6000f * num3) * 0.1f;
				float num6 = 0.6f + 0.4f * Mathf.PerlinNoise(num3 * 30f, 0f);
				array[i] = (num4 * 0.5f + num5) * num6 * 0.4f;
			}
			float[] array2 = new float[num];
			Array.Copy(array, array2, num);
			for (int j = 0; j < num2; j++)
			{
				float num7 = (float)j / (float)num2;
				array2[j] = array2[j] * num7 + array[num + j] * (1f - num7);
			}
			return MakeClip("EmpressHollowStatic", array2);
		}

		private static AudioClip BuildGrab()
		{
			int num = 48510;
			float[] array = new float[num];
			float num2 = 0f;
			float num3 = Random.Range(0f, 30f);
			for (int i = 0; i < num; i++)
			{
				float num4 = (float)i / 44100f;
				float num5 = num4 / 1.1f;
				float num6 = 60f + 240f * Mathf.Exp((0f - num5) * 4f);
				num2 += MathF.PI * 2f * num6 / 44100f;
				float num7 = (Random.value * 2f - 1f) * Mathf.Exp((0f - num4) / 0.05f);
				float num8 = (Mathf.PerlinNoise(num3, num4 * 30f) - 0.5f) * (1f - num5) * 1.4f;
				float num9 = Mathf.Sin(num2) * 0.5f;
				float num10 = ((num5 < 0.08f) ? (num5 / 0.08f) : Mathf.Exp((0f - (num5 - 0.08f)) * 3f));
				array[i] = Mathf.Clamp((num7 * 0.6f + num8 + num9) * num10, -1f, 1f) * 0.85f;
			}
			return MakeClip("EmpressHollowGrab", array);
		}

		private static AudioClip BuildSink()
		{
			int num = 70560;
			float[] array = new float[num];
			float num2 = Random.Range(0f, 25f);
			for (int i = 0; i < num; i++)
			{
				float num3 = (float)i / 44100f;
				float num4 = num3 / 1.6f;
				float num5 = 90f * Mathf.Exp((0f - num4) * 1.5f) + 22f;
				float num6 = Mathf.Sin(MathF.PI * 2f * num5 * num3);
				float num7 = (Mathf.PerlinNoise(num2, num3 * 45f) - 0.5f) * 0.8f;
				float num8 = Mathf.Sin(num4 * MathF.PI);
				array[i] = Mathf.Clamp((num6 * 0.5f + num7) * num8, -1f, 1f) * 0.6f;
			}
			return MakeClip("EmpressHollowSink", array);
		}

		private static AudioClip BuildCreak()
		{
			int num = 61740;
			float[] array = new float[num];
			float num2 = 0f;
			float num3 = Random.Range(0f, 40f);
			for (int i = 0; i < num; i++)
			{
				float num4 = (float)i / 44100f;
				float num5 = num4 / 1.4f;
				float num6 = 110f + 60f * Mathf.Sin(num5 * 6f) + 30f * Mathf.PerlinNoise(num3, num4 * 4f);
				num2 += MathF.PI * 2f * num6 / 44100f;
				float num7 = Mathf.Sign(Mathf.Sin(num2)) * 0.3f + Mathf.Sin(num2) * 0.4f;
				float num8 = ((Mathf.PerlinNoise(num3 + 3f, num4 * 18f) > 0.55f) ? 1f : 0.3f);
				float num9 = Mathf.Sin(num5 * MathF.PI);
				array[i] = Mathf.Clamp(num7 * num8 * num9, -1f, 1f) * 0.4f;
			}
			return MakeClip("EmpressHollowCreak", array);
		}

		private static AudioClip BuildHeartbeat()
		{
			int num = 48510;
			float[] array = new float[num];
			for (int i = 0; i < num; i++)
			{
				float num2 = (float)i / 44100f;
				float num3 = Mathf.Sin(MathF.PI * 110f * num2) * Mathf.Exp(0f - Mathf.Pow((num2 - 0.08f) / 0.05f, 2f));
				float num4 = Mathf.Sin(MathF.PI * 100f * num2) * Mathf.Exp(0f - Mathf.Pow((num2 - 0.34f) / 0.06f, 2f));
				array[i] = Mathf.Clamp(num3 + num4 * 0.8f, -1f, 1f) * 0.7f;
			}
			return MakeClip("EmpressHollowHeartbeat", array);
		}

		private static AudioClip BuildWhisper()
		{
			int num = 70560;
			float[] array = new float[num];
			float num2 = Random.Range(0f, 50f);
			float num3 = 0f;
			for (int i = 0; i < num; i++)
			{
				float num4 = (float)i / 44100f;
				float num5 = num4 / 1.6f;
				float num6 = Random.value * 2f - 1f;
				num3 = num3 * 0.82f + num6 * 0.18f;
				float num7 = 1f + 0.6f * Mathf.Sin(MathF.PI * 9f * num4 + num2);
				float num8 = Mathf.Clamp01(Mathf.PerlinNoise(num2 + 9f, num4 * 6f) * 1.6f - 0.3f);
				float num9 = Mathf.Sin(num5 * MathF.PI);
				array[i] = Mathf.Clamp(num3 * num7 * num8 * num9, -1f, 1f) * 0.5f;
			}
			return MakeClip("EmpressHollowWhisper", array);
		}
	}
	internal sealed class HollowMap
	{
		public Transform Root;

		public Vector3 Center;

		public float Radius;

		public Vector3 PlayerStart;

		public readonly List<Vector3> SpawnPositions = new List<Vector3>();

		public readonly List<Vector3> Waypoints = new List<Vector3>();

		public readonly List<Vector3> NotePositions = new List<Vector3>();

		public readonly List<Vector3> TreePositions = new List<Vector3>();

		public Vector3 StalkerStart;

		public float Amplitude;

		public float ClearingRadius;

		public float SeedOffset;

		public float GroundHeight(float x, float z)
		{
			float num = (Mathf.PerlinNoise((x + SeedOffset) * 0.021f, (z + SeedOffset) * 0.021f) - 0.5f) * Amplitude;
			num += (Mathf.PerlinNoise((x + SeedOffset) * 0.07f, (z + SeedOffset) * 0.07f) - 0.5f) * Amplitude * 0.35f;
			float num2 = Mathf.Sqrt(x * x + z * z);
			float num3 = Mathf.SmoothStep(0f, 1f, (num2 - ClearingRadius) / Mathf.Max(1f, ClearingRadius * 0.85f));
			return Mathf.Lerp(0f, num, num3);
		}

		public Vector3 OnGround(float x, float z, float lift)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(x, GroundHeight(x, z) + lift, z);
		}
	}
	internal static class HollowForest
	{
		public static HollowMap Build(Transform parent, int seed)
		{
			//IL_0019: 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)
			HollowMaterials.EnsureCreated();
			Random random = new Random(seed);
			HollowMap hollowMap = new HollowMap
			{
				Root = parent,
				Center = Vector3.zero,
				Radius = EmpressHollowPlugin.Settings.ForestRadius.Value,
				Amplitude = 5.5f,
				ClearingRadius = 13f,
				SeedOffset = random.Next(0, 9000)
			};
			BuildGround(parent, hollowMap);
			BuildBoundary(parent, hollowMap);
			BuildSky(parent, hollowMap, random);
			BuildLights(parent);
			BuildTrees(parent, hollowMap, random);
			BuildRocks(parent, hollowMap, random);
			BuildCabins(parent, hollowMap, random);
			HollowScenery.Build(parent, hollowMap, random);
			BuildClearingProps(parent, hollowMap, random);
			BuildPlacements(hollowMap, random);
			return hollowMap;
		}

		private static void BuildGround(Transform parent, HollowMap map)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: 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_0165: Unknown result type (might be due to invalid IL or missing references)
			float num = map.Radius + 55f;
			int num2 = Mathf.Clamp(Mathf.RoundToInt(num * 2f / 2.6f), 32, 130);
			float num3 = num * 2f / (float)num2;
			HollowMesh hollowMesh = new HollowMesh();
			int num4 = num2 + 1;
			for (int i = 0; i <= num2; i++)
			{
				for (int j = 0; j <= num2; j++)
				{
					float num5 = 0f - num + (float)j * num3;
					float num6 = 0f - num + (float)i * num3;
					float num7 = map.GroundHeight(num5, num6);
					hollowMesh.AddVertex(new Vector3(num5, num7, num6), Vector3.up, new Vector2(num5 * 0.04f, num6 * 0.04f));
				}
			}
			for (int k = 0; k < num2; k++)
			{
				for (int l = 0; l < num2; l++)
				{
					int num8 = k * num4 + l;
					int num9 = num8 + num4;
					hollowMesh.AddQuad(0, num8, num9, num9 + 1, num8 + 1);
				}
			}
			GameObject val = new GameObject("Empress Hollow Ground");
			val.transform.SetParent(parent, false);
			val.layer = LayerMask.NameToLayer("Default");
			Mesh val2 = hollowMesh.ToMesh("Empress Hollow Ground Mesh");
			val2.RecalculateNormals();
			val.AddComponent<MeshFilter>().sharedMesh = val2;
			MeshRenderer obj = val.AddComponent<MeshRenderer>();
			((Renderer)obj).sharedMaterial = HollowMaterials.DirtMaterial;
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
			val.AddComponent<MeshCollider>().sharedMesh = val2;
			val.AddComponent<MaterialSurface>().Type = (Type)10;
		}

		private static void BuildBoundary(Transform parent, HollowMap map)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Empress Hollow Boundary");
			val.transform.SetParent(parent, false);
			float radius = map.Radius;
			float num = MathF.PI * 2f * radius / 48f * 1.25f;
			Vector3 val2 = default(Vector3);
			for (int i = 0; i < 48; i++)
			{
				float num2 = (float)i / 48f * MathF.PI * 2f;
				((Vector3)(ref val2))..ctor(Mathf.Cos(num2), 0f, Mathf.Sin(num2));
				GameObject val3 = new GameObject("Boundary");
				val3.transform.SetParent(val.transform, false);
				val3.transform.localPosition = val2 * radius;
				val3.transform.localRotation = Quaternion.LookRotation(val2, Vector3.up);
				val3.layer = LayerMask.NameToLayer("Default");
				BoxCollider obj = val3.AddComponent<BoxCollider>();
				obj.center = new Vector3(0f, 40f, 0f);
				obj.size = new Vector3(num, 120f, 3f);
			}
		}

		private static void BuildSky(Transform parent, HollowMap map, Random random)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Empress Hollow Sky");
			val.transform.SetParent(parent, false);
			Vector3 val2 = new Vector3(0.32f, 0.82f, -0.48f);
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			GameObject val3 = new GameObject("Empress Hollow Moon");
			val3.transform.SetParent(val.transform, false);
			val3.transform.localPosition = normalized * 38f;
			HollowMesh hollowMesh = new HollowMesh();
			hollowMesh.Blob(0, Vector3.zero, new Vector3(5.5f, 5.5f, 5.5f), 12, 8, 0f, 1);
			val3.AddComponent<MeshFilter>().sharedMesh = hollowMesh.ToMesh("Empress Hollow Moon Mesh");
			MeshRenderer obj = val3.AddComponent<MeshRenderer>();
			((Renderer)obj).sharedMaterial = HollowMaterials.MoonMaterial;
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)obj).receiveShadows = false;
			GameObject val4 = new GameObject("Empress Hollow Stars");
			val4.transform.SetParent(val.transform, false);
			HollowMesh hollowMesh2 = new HollowMesh();
			int num = 40;
			Vector3 val5 = default(Vector3);
			for (int i = 0; i < num; i++)
			{
				float num2 = (float)random.NextDouble() * MathF.PI * 2f;
				float num3 = Mathf.Lerp(0.15f, 0.75f, (float)random.NextDouble()) * MathF.PI * 0.5f;
				float num4 = 34f;
				((Vector3)(ref val5))..ctor(Mathf.Sin(num3) * Mathf.Cos(num2), Mathf.Cos(num3), Mathf.Sin(num3) * Mathf.Sin(num2));
				float num5 = 0.12f + (float)random.NextDouble() * 0.18f;
				hollowMesh2.Blob(0, val5 * num4, new Vector3(num5, num5, num5), 4, 3, 0f, random.Next());
			}
			val4.AddComponent<MeshFilter>().sharedMesh = hollowMesh2.ToMesh("Empress Hollow Stars Mesh");
			MeshRenderer obj2 = val4.AddComponent<MeshRenderer>();
			((Renderer)obj2).sharedMaterial = HollowMaterials.StarMaterial;
			((Renderer)obj2).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)obj2).receiveShadows = false;
			val.AddComponent<HollowSkyFollow>();
		}

		private static void BuildLights(Transform parent)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Empress Hollow Moonlight");
			val.transform.SetParent(parent, false);
			val.transform.rotation = Quaternion.Euler(48f, 28f, 0f);
			Light obj = val.AddComponent<Light>();
			obj.type = (LightType)1;
			obj.color = new Color(0.55f, 0.66f, 0.92f);
			obj.intensity = 0.48f;
			obj.shadows = (LightShadows)2;
			obj.shadowStrength = 0.38f;
			obj.shadowBias = 0.045f;
			obj.shadowNormalBias = 0.35f;
			obj.shadowNearPlane = 0.2f;
			GameObject val2 = new GameObject("Empress Hollow Fill");
			val2.transform.SetParent(parent, false);
			val2.transform.rotation = Quaternion.Euler(-26f, 210f, 0f);
			Light obj2 = val2.AddComponent<Light>();
			obj2.type = (LightType)1;
			obj2.color = new Color(0.16f, 0.2f, 0.32f);
			obj2.intensity = 0.22f;
			obj2.shadows = (LightShadows)0;
		}

		private static void BuildTrees(Transform parent, HollowMap map, Random random)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			TreePrototype[] prototypes = HollowTree.CreatePrototypes(8, random);
			GameObject val = new GameObject("Empress Hollow Trees");
			val.transform.SetParent(parent, false);
			int num = Mathf.Clamp(Mathf.RoundToInt((float)EmpressHollowPlugin.Settings.TreeCount.Value * 2.5f), 120, 900);
			int num2 = 0;
			int num3 = 0;
			int num4 = num * 12;
			while (num2 < num && num3 < num4)
			{
				num3++;
				float num5 = (float)random.NextDouble() * MathF.PI * 2f;
				float num6 = Mathf.Lerp(map.ClearingRadius + 1.5f, map.Radius - 4f, Mathf.Sqrt((float)random.NextDouble()));
				float x = Mathf.Cos(num5) * num6;
				float z = Mathf.Sin(num5) * num6;
				if (!NearReserved(map, x, z, 5f))
				{
					float scale = 0.8f + (float)random.NextDouble() * 0.6f;
					CreateTree(val.transform, map, random, prototypes, x, z, scale, physical: true);
					num2++;
				}
			}
			int num7 = Mathf.Clamp(Mathf.RoundToInt((float)EmpressHollowPlugin.Settings.TreeCount.Value * 1.5f), 180, 600);
			for (int i = 0; i < num7; i++)
			{
				float num8 = (float)random.NextDouble() * MathF.PI * 2f;
				float num9 = Mathf.Lerp(map.Radius + 5f, map.Radius + 50f, Mathf.Sqrt((float)random.NextDouble()));
				float x2 = Mathf.Cos(num8) * num9;
				float z2 = Mathf.Sin(num8) * num9;
				float scale2 = 0.9f + (float)random.NextDouble() * 0.8f;
				CreateTree(val.transform, map, random, prototypes, x2, z2, scale2, physical: false);
			}
			StaticBatchingUtility.Combine(val);
		}

		private static void CreateTree(Transform parent, HollowMap map, Random random, TreePrototype[] prototypes, float x, float z, float scale, bool physical)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			TreePrototype treePrototype = prototypes[random.Next(prototypes.Length)];
			GameObject val = new GameObject("Tree");
			val.transform.SetParent(parent, false);
			val.transform.localPosition = map.OnGround(x, z, -0.2f);
			val.transform.localRotation = Quaternion.Euler(0f, (float)random.NextDouble() * 360f, 0f);
			val.transform.localScale = Vector3.one * scale;
			val.layer = LayerMask.NameToLayer("Default");
			val.AddComponent<MeshFilter>().sharedMesh = treePrototype.Mesh;
			MeshRenderer obj = val.AddComponent<MeshRenderer>();
			((Renderer)obj).sharedMaterials = treePrototype.Materials;
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)(physical ? 1 : 0);
			((Renderer)obj).receiveShadows = true;
			if (physical)
			{
				CapsuleCollider obj2 = val.AddComponent<CapsuleCollider>();
				obj2.radius = Mathf.Max(0.25f, treePrototype.Radius * 0.9f);
				obj2.height = treePrototype.Height;
				obj2.center = new Vector3(0f, treePrototype.Height * 0.5f, 0f);
				map.TreePositions.Add(val.transform.localPosition);
			}
		}

		private static void BuildRocks(Transform parent, HollowMap map, Random random)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_002d: 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_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Empress Hollow Rocks");
			val.transform.SetParent(parent, false);
			Mesh[] array = (Mesh[])(object)new Mesh[8];
			for (int i = 0; i < array.Length; i++)
			{
				HollowMesh hollowMesh = new HollowMesh();
				hollowMesh.Blob(0, Vector3.zero, new Vector3(1f, 0.72f, 1.08f), 12, 7, 0.22f, random.Next());
				array[i] = hollowMesh.ToMesh("Empress Hollow Rock " + i);
			}
			int num = 46;
			Vector3 val2 = default(Vector3);
			for (int j = 0; j < num; j++)
			{
				float num2 = (float)random.NextDouble() * MathF.PI * 2f;
				float num3 = Mathf.Lerp(map.ClearingRadius + 2f, map.Radius, (float)random.NextDouble());
				float x = Mathf.Cos(num2) * num3;
				float z = Mathf.Sin(num2) * num3;
				if (!NearReserved(map, x, z, 3f))
				{
					float num4 = 0.5f + (float)random.NextDouble() * 1.8f;
					((Vector3)(ref val2))..ctor(num4 * Range(random, 0.82f, 1.28f), num4 * Range(random, 0.72f, 1.08f), num4 * Range(random, 0.84f, 1.32f));
					GameObject val3 = new GameObject("Rock");
					val3.transform.SetParent(val.transform, false);
					val3.transform.localPosition = map.OnGround(x, z, val2.y * 0.48f);
					val3.transform.localRotation = Quaternion.Euler(Range(random, -9f, 9f), Range(random, 0f, 360f), Range(random, -9f, 9f));
					val3.transform.localScale = val2;
					val3.layer = LayerMask.NameToLayer("Default");
					Mesh sharedMesh = array[random.Next(array.Length)];
					val3.AddComponent<MeshFilter>().sharedMesh = sharedMesh;
					MeshRenderer obj = val3.AddComponent<MeshRenderer>();
					((Renderer)obj).sharedMaterial = HollowMaterials.RockMaterial;
					((Renderer)obj).shadowCastingMode = (ShadowCastingMode)1;
					((Renderer)obj).receiveShadows = true;
					MeshCollider obj2 = val3.AddComponent<MeshCollider>();
					obj2.sharedMesh = sharedMesh;
					obj2.convex = true;
				}
			}
		}

		private static void BuildCabins(Transform parent, HollowMap map, Random random)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Empress Hollow Cabins");
			val.transform.SetParent(parent, false);
			int num = 3;
			for (int i = 0; i < num; i++)
			{
				float num2 = (float)random.NextDouble() * MathF.PI * 2f;
				float num3 = Mathf.Lerp(map.Radius * 0.4f, map.Radius * 0.85f, (float)random.NextDouble());
				float num4 = Mathf.Cos(num2) * num3;
				float num5 = Mathf.Sin(num2) * num3;
				BuildCabin(val.transform, map, new Vector3(num4, 0f, num5), (float)random.NextDouble() * 360f, random);
			}
		}

		private static void BuildCabin(Transform parent, HollowMap map, Vector3 spot, float yaw, Random random)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: 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_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Cabin");
			val.transform.SetParent(parent, false);
			val.layer = LayerMask.NameToLayer("Default");
			float num = 6f + (float)random.NextDouble() * 3f;
			float num2 = 5f + (float)random.NextDouble() * 3f;
			float num3 = 3.4f;
			float num4 = 0.3f;
			Quaternion val2 = Quaternion.Euler(0f, yaw, 0f);
			float num5 = float.MaxValue;
			for (int i = -1; i <= 1; i++)
			{
				for (int j = -1; j <= 1; j++)
				{
					Vector3 val3 = val2 * new Vector3(num * 0.5f * (float)i, 0f, num2 * 0.5f * (float)j);
					num5 = Mathf.Min(num5, map.GroundHeight(spot.x + val3.x, spot.z + val3.z));
				}
			}
			val.transform.localPosition = new Vector3(spot.x, num5 - 0.2f, spot.z);
			val.transform.localRotation = val2;
			HollowMesh hollowMesh = new HollowMesh();
			hollowMesh.Box(0, new Vector3(0f, num3 * 0.5f, num2 * 0.5f), new Vector3(num, num3, num4), Quaternion.identity, 3f);
			hollowMesh.Box(0, new Vector3((0f - num) * 0.5f, num3 * 0.5f, 0f), new Vector3(num4, num3, num2), Quaternion.identity, 3f);
			hollowMesh.Box(0, new Vector3(num * 0.5f, num3 * 0.5f, 0f), new Vector3(num4, num3, num2), Quaternion.identity, 3f);
			hollowMesh.Box(0, new Vector3((0f - num) * 0.3f, num3 * 0.5f, (0f - num2) * 0.5f), new Vector3(num * 0.4f, num3, num4), Quaternion.identity, 3f);
			hollowMesh.Box(0, new Vector3(num * 0.32f, num3 * 0.5f, (0f - num2) * 0.5f), new Vector3(num * 0.36f, num3, num4), Quaternion.identity, 3f);
			hollowMesh.Box(1, new Vector3(0f, num3 + 0.25f, 0f), new Vector3(num + 0.6f, 0.5f, num2 + 0.6f), Quaternion.Euler(8f, 0f, 0f), 3f);
			GameObject val4 = new GameObject("Walls");
			val4.transform.SetParent(val.transform, false);
			val4.layer = LayerMask.NameToLayer("Default");
			Mesh sharedMesh = hollowMesh.ToMesh("Empress Hollow Cabin Mesh");
			val4.AddComponent<MeshFilter>().sharedMesh = sharedMesh;
			MeshRenderer val5 = val4.AddComponent<MeshRenderer>();
			((Renderer)val5).sharedMaterials = (Material[])(object)new Material[2]
			{
				HollowMaterials.PlankMaterial,
				HollowMaterials.PlankMaterial
			};
			((Renderer)val5).shadowCastingMode = (ShadowCastingMode)1;
			((Renderer)val5).receiveShadows = true;
			AddWallCollider(val.transform, new Vector3(0f, num3 * 0.5f, num2 * 0.5f), new Vector3(num, num3, num4));
			AddWallCollider(val.transform, new Vector3((0f - num) * 0.5f, num3 * 0.5f, 0f), new Vector3(num4, num3, num2));
			AddWallCollider(val.transform, new Vector3(num * 0.5f, num3 * 0.5f, 0f), new Vector3(num4, num3, num2));
		}

		private static void AddWallCollider(Transform parent, Vector3 center, Vector3 size)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_001d: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Wall");
			val.transform.SetParent(parent, false);
			val.transform.localPosition = center;
			val.layer = LayerMask.NameToLayer("Default");
			val.AddComponent<BoxCollider>().size = size;
		}

		private static void BuildClearingProps(Transform parent, HollowMap map, Random random)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_002d: 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_0053: 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)
			GameObject val = new GameObject("Empress Hollow Stump");
			val.transform.SetParent(parent, false);
			val.transform.localPosition = map.OnGround(3.4f, -2.6f, 0f);
			HollowMesh hollowMesh = new HollowMesh();
			hollowMesh.Tube(0, Vector3.zero, new Vector3(0f, 0.9f, 0f), 0.6f, 0.5f, 8, 0f, 1f);
			val.AddComponent<MeshFilter>().sharedMesh = hollowMesh.ToMesh("Empress Hollow Stump Mesh");
			MeshRenderer obj = val.AddComponent<MeshRenderer>();
			((Renderer)obj).sharedMaterial = HollowMaterials.BarkMaterial;
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)1;
			((Renderer)obj).receiveShadows = true;
		}

		private static void BuildPlacements(HollowMap map, Random random)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			map.PlayerStart = map.OnGround(0f, -4f, 1.3f);
			for (int i = 0; i < 6; i++)
			{
				float num = (float)i / 6f * MathF.PI * 2f;
				float num2 = 4f + (float)random.NextDouble() * 5f;
				map.SpawnPositions.Add(map.OnGround(Mathf.Cos(num) * num2, Mathf.Sin(num) * num2 - 2f, 1.3f));
			}
			int num3 = 3;
			for (int j = 0; j < num3; j++)
			{
				float num4 = Mathf.Lerp(map.ClearingRadius + 8f, map.Radius - 6f, (float)j / (float)(num3 - 1));
				int num5 = 8 + j * 4;
				for (int k = 0; k < num5; k++)
				{
					float num6 = (float)k / (float)num5 * MathF.PI * 2f + (float)j * 0.4f;
					float num7 = (float)random.NextDouble() * 6f - 3f;
					float x = Mathf.Cos(num6) * (num4 + num7);
					float z = Mathf.Sin(num6) * (num4 + num7);
					map.Waypoints.Add(map.OnGround(x, z, 0f));
				}
			}
			float num8 = (float)random.NextDouble() * MathF.PI * 2f;
			float x2 = Mathf.Cos(num8) * map.Radius * 0.7f;
			float z2 = Mathf.Sin(num8) * map.Radius * 0.7f;
			map.StalkerStart = map.OnGround(x2, z2, 0f);
			int num9 = 8;
			for (int l = 0; l < num9; l++)
			{
				float num10 = (float)l / (float)num9 * MathF.PI * 2f + (float)random.NextDouble() * 0.5f;
				float num11 = Mathf.Lerp(map.ClearingRadius + 6f, map.Radius - 6f, (float)random.NextDouble());
				float x3 = Mathf.Cos(num10) * num11;
				float z3 = Mathf.Sin(num10) * num11;
				map.NotePositions.Add(map.OnGround(x3, z3, 0f));
			}
		}

		private static bool NearReserved(HollowMap map, float x, float z, float pad)
		{
			if (x * x + z * z < (map.ClearingRadius + pad) * (map.ClearingRadius + pad))
			{
				return true;
			}
			return false;
		}

		private static float Range(Random random, float min, float max)
		{
			return min + (float)random.NextDouble() * (max - min);
		}
	}
	internal static class HollowNote
	{
		public static GameObject Create(Transform parent, Vector3 position)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_0085: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Empress Hollow Note");
			val.transform.SetParent(parent, false);
			val.transform.localPosition = position;
			val.transform.localRotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
			GameObject val2 = new GameObject("Post");
			val2.transform.SetParent(val.transform, false);
			HollowMesh hollowMesh = new HollowMesh();
			hollowMesh.Tube(0, Vector3.zero, new Vector3(0f, 1.2f, 0f), 0.05f, 0.04f, 5, 0f, 1f);
			val2.AddComponent<MeshFilter>().sharedMesh = hollowMesh.ToMesh("Empress Hollow Note Post");
			MeshRenderer obj = val2.AddComponent<MeshRenderer>();
			((Renderer)obj).sharedMaterial = HollowMaterials.BarkDarkMaterial;
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
			GameObject obj2 = GameObject.CreatePrimitive((PrimitiveType)3);
			Object.Destroy((Object)(object)obj2.GetComponent<Collider>());
			((Object)obj2).name = "Paper";
			obj2.transform.SetParent(val.transform, false);
			obj2.transform.localPosition = new Vector3(0f, 1.15f, 0f);
			obj2.transform.localScale = new Vector3(0.4f, 0.52f, 0.04f);
			MeshRenderer component = obj2.GetComponent<MeshRenderer>();
			((Renderer)component).sharedMaterial = HollowMaterials.NoteMaterial;
			((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
			GameObject val3 = new GameObject("Glow");
			val3.transform.SetParent(val.transform, false);
			val3.transform.localPosition = new Vector3(0f, 1.15f, 0f);
			Light obj3 = val3.AddComponent<Light>();
			obj3.type = (LightType)2;
			obj3.color = new Color(1f, 0.92f, 0.7f);
			obj3.intensity = 1.6f;
			obj3.range = 6f;
			obj3.shadows = (LightShadows)0;
			return val;
		}
	}
	internal sealed class HollowSkyFollow : MonoBehaviour
	{
		private void LateUpdate()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			Camera main = Camera.main;
			if ((Object)(object)main != (Object)null)
			{
				((Component)this).transform.position = ((Component)main).transform.position;
			}
		}
	}
	internal static class HollowLevelRegistry
	{
		private static readonly FieldRef<LevelContent, Level> LevelContentLevelRef = AccessTools.FieldRefAccess<LevelContent, Level>("_level");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentStartRoomsRef = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_startRooms");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal1");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal2");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal3");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage1");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage2");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage3");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd1");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd2");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd3");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction1");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction2");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction3");

		private static readonly FieldRef<LevelContent, GameObject> LevelContentConnectObjectRef = AccessTools.FieldRefAccess<LevelContent, GameObject>("_connectObject");

		private static readonly FieldRef<LevelContent, GameObject> LevelContentBlockObjectRef = AccessTools.FieldRefAccess<LevelContent, GameObject>("_blockObject");

		public static Level RegisterLevel()
		{
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			Level val = ScriptableObject.CreateInstance<Level>();
			((Object)val).name = "Level - Empress Hollow";
			val.NarrativeName = "Empress - The Hollow";
			LevelValuables val2 = ScriptableObject.CreateInstance<LevelValuables>();
			((Object)val2).name = "Valuables - Empress Hollow";
			val2.tiny = new List<PrefabRef>();
			val2.small = new List<PrefabRef>();
			val2.medium = new List<PrefabRef>();
			val2.big = new List<PrefabRef>();
			val2.wide = new List<PrefabRef>();
			val2.tall = new List<PrefabRef>();
			val2.veryTall = new List<PrefabRef>();
			SetLevelField(val, "ModuleAmount", 0);
			SetLevelField(val, "PassageMaxAmount", 0);
			SetLevelField(val, "HasEnemies", false);
			SetLevelField(val, "ValuablePresets", new List<LevelValuables> { val2 });
			SetLevelField(val, "AmbiencePresets", new List<LevelAmbience>());
			SetLevelField(val, "FogColor", (object)new Color(0.045f, 0.055f, 0.08f));
			SetLevelField(val, "FogStartDistance", 7f);
			SetLevelField(val, "FogEndDistance", 58f);
			SetLevelField(val, "AmbientColor", (object)new Color(0.17f, 0.2f, 0.27f));
			SetLevelField(val, "AmbientColorAdaptation", (object)new Color(0.06f, 0.07f, 0.1f));
			SetLevelField(val, "ColorTemperature", -8f);
			SetLevelField(val, "ColorFilter", (object)new Color(0.72f, 0.82f, 1f, 1f));
			SetLevelField(val, "BloomIntensity", 1.1f);
			SetLevelField(val, "BloomThreshold", 0.95f);
			SetLevelField(val, "VignetteColor", (object)new Color(0f, 0f, 0f, 1f));
			SetLevelField(val, "VignetteIntensity", 0.42f);
			SetLevelField(val, "VignetteSmoothness", 0.85f);
			SetLevelField(val, "DiscordIcon", "level");
			EnsureLevelFieldInstance(val, "LoadingGraphic01");
			EnsureLevelFieldInstance(val, "LoadingGraphic02");
			EnsureLevelFieldInstance(val, "LoadingGraphic03");
			EnsureLevelFieldInstance(val, "ConnectObject");
			EnsureLevelFieldInstance(val, "BlockObject");
			LevelContent val3 = ScriptableObject.CreateInstance<LevelContent>();
			((Object)val3).name = "Empress Hollow Content";
			LevelContentLevelRef.Invoke(val3) = val;
			LevelContentStartRoomsRef.Invoke(val3) = new List<GameObject>();
			LevelContentModulesNormal1Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesNormal2Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesNormal3Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesPassage1Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesPassage2Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesPassage3Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesDeadEnd1Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesDeadEnd2Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesDeadEnd3Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesExtraction1Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesExtraction2Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesExtraction3Ref.Invoke(val3) = new List<GameObject>();
			LevelContentConnectObjectRef.Invoke(val3) = null;
			LevelContentBlockObjectRef.Invoke(val3) = null;
			Levels.RegisterLevel(val3);
			return val;
		}

		public static void BorrowValuablePool(Level targetLevel)
		{
			if ((Object)(object)targetLevel == (Object)null || (Object)(object)RunManager.instance == (Object)null)
			{
				return;
			}
			List<LevelValuables> valuablePresets = HollowAccess.GetValuablePresets(targetLevel);
			if (valuablePresets != null && PoolHasContent(valuablePresets))
			{
				return;
			}
			List<Level> levels = RunManager.instance.levels;
			if (levels == null)
			{
				return;
			}
			for (int i = 0; i < levels.Count; i++)
			{
				Level val = levels[i];
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)targetLevel))
				{
					List<LevelValuables> valuablePresets2 = HollowAccess.GetValuablePresets(val);
					if (valuablePresets2 != null && PoolHasContent(valuablePresets2))
					{
						HollowAccess.SetValuablePresets(targetLevel, new List<LevelValuables>(valuablePresets2));
						break;
					}
				}
			}
		}

		private static bool PoolHasContent(List<LevelValuables> presets)
		{
			for (int i = 0; i < presets.Count; i++)
			{
				if (HollowAccess.PresetHasContent(presets[i]))
				{
					return true;
				}
			}
			return false;
		}

		public static List<LevelValuables> FindValuablePool()
		{
			List<LevelValuables> valuablePresets = HollowAccess.GetValuablePresets(EmpressHollowPlugin.HollowLevel);
			if (valuablePresets != null && PoolHasContent(valuablePresets))
			{
				return valuablePresets;
			}
			List<LevelValuables> list = new List<LevelValuables>();
			LevelValuables[] array = Resources.FindObjectsOfTypeAll<LevelValuables>();
			for (int i = 0; i < array.Length; i++)
			{
				if ((Object)(object)array[i] != (Object)null && HollowAccess.PresetHasContent(array[i]) && !list.Contains(array[i]))
				{
					list.Add(array[i]);
				}
			}
			return list;
		}

		public static PrefabRef FindExtractionPrefab()
		{
			Level[] array = Resources.FindObjectsOfTypeAll<Level>();
			foreach (Level val in array)
			{
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)EmpressHollowPlugin.HollowLevel))
				{
					PrefabRef val2 = FirstValid(val.ModulesExtraction1) ?? FirstValid(val.ModulesExtraction2) ?? FirstValid(val.ModulesExtraction3);
					if (val2 != null)
					{
						return val2;
					}
				}
			}
			return null;
		}

		private static PrefabRef FirstValid(List<PrefabRef> refs)
		{
			if (refs == null)
			{
				return null;
			}
			for (int i = 0; i < refs.Count; i++)
			{
				if (refs[i] != null && refs[i].IsValid())
				{
					return refs[i];
				}
			}
			return null;
		}

		private static void SetLevelField(Level level, string fieldName, object value)
		{
			FieldInfo fieldInfo = AccessTools.Field(typeof(Level), fieldName);
			if (!(fieldInfo == null) && value != null && fieldInfo.FieldType.IsInstanceOfType(value))
			{
				fieldInfo.SetValue(level, value);
			}
		}

		private static void EnsureLevelFieldInstance(Level level, string fieldName)
		{
			FieldInfo fieldInfo = AccessTools.Field(typeof(Level), fieldName);
			if (!(fieldInfo == null) && fieldInfo.FieldType.IsClass && !(fieldInfo.FieldType == typeof(string)) && fieldInfo.GetValue(level) == null)
			{
				object uninitializedObject = FormatterServices.GetUninitializedObject(fieldInfo.FieldType);
				fieldInfo.SetValue(level, uninitializedObject);
			}
		}
	}
	internal sealed class HollowLoadingScreen : MonoBehaviour
	{
		private static readonly Color Cold = new Color(0.28f, 0.55f, 0.65f, 0.42f);

		private static readonly Color Pale = new Color(0.72f, 0.86f, 0.9f, 0.5f);

		private static readonly Color Bruise = new Color(0.38f, 0.12f, 0.2f, 0.38f);

		private static bool _active;

		private static float _muteUntil;

		private readonly List<RawImage> _bands = new List<RawImage>();

		private GameObject _root;

		private RawImage _forest;

		private Image _vignette;

		private RectTransform _eyeRoot;

		private Image _leftEye;

		private Image _rightEye;

		private AudioSource _staticAudio;

		private float _time;

		private float _glitchTimer;

		private float _eyeTimer;

		private uint _state = 2654435769u;

		public static void Show(LoadingUI loadingUI)
		{
			if (!((Object)(object)loadingUI == (Object)null))
			{
				HollowLoadingScreen hollowLoadingScreen = ((Component)loadingUI).GetComponent<HollowLoadingScreen>();
				if ((Object)(object)hollowLoadingScreen == (Object)null)
				{
					hollowLoadingScreen = ((Component)loadingUI).gameObject.AddComponent<HollowLoadingScreen>();
				}
				hollowLoadingScreen.ShowInternal(loadingUI);
			}
		}

		public static void Hide(LoadingUI loadingUI)
		{
			if (!((Object)(object)loadingUI == (Object)null))
			{
				HollowLoadingScreen component = ((Component)loadingUI).GetComponent<HollowLoadingScreen>();
				if ((Object)(object)component != (Object)null)
				{
					component.HideInternal();
				}
			}
		}

		public static bool OwnsCurrentLoading()
		{
			if (_active || Time.realtimeSinceStartup < _muteUntil)
			{
				return true;
			}
			Level val = null;
			if (Object.op_Implicit((Object)(object)LevelGenerator.Instance))
			{
				val = LevelGenerator.Instance.Level;
			}
			if (!Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)RunManager.instance))
			{
				val = RunManager.instance.levelCurrent;
			}
			return EmpressHollowPlugin.IsHollowLevel(val);
		}

		private void ShowInternal(LoadingUI loadingUI)
		{
			EnsureBuilt(((Component)loadingUI).transform);
			ClearGraphic(loadingUI.loadingGraphic01);
			ClearGraphic(loadingUI.loadingGraphic02);
			ClearGraphic(loadingUI.loadingGraphic03);
			_time = 0f;
			_glitchTimer = 0f;
			_eyeTimer = 0f;
			_active = true;
			_muteUntil = Time.realtimeSinceStartup + 18f;
			_root.SetActive(true);
			_root.transform.SetAsLastSibling();
			BringToFront(((Object)(object)loadingUI.levelNumberText != (Object)null) ? ((TMP_Text)loadingUI.levelNumberText).transform : null);
			BringToFront(((Object)(object)loadingUI.levelNameText != (Object)null) ? ((TMP_Text)loadingUI.levelNameText).transform : null);
			BringToFront((Transform)(object)loadingUI.stuckTransform);
			StartStatic();
		}

		private void HideInternal()
		{
			_active = false;
			_muteUntil = Time.realtimeSinceStartup + 1.5f;
			if ((Object)(object)_root != (Object)null)
			{
				_root.SetActive(false);
			}
			if ((Object)(object)_staticAudio != (Object)null)
			{
				_staticAudio.Stop();
			}
		}

		private void Update()
		{
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_root == (Object)null || !_root.activeSelf)
			{
				return;
			}
			if (!OwnsCurrentLoading())
			{
				HideInternal();
				return;
			}
			_time += Time.unscaledDeltaTime;
			_glitchTimer -= Time.unscaledDeltaTime;
			_eyeTimer -= Time.unscaledDeltaTime;
			if (_glitchTimer <= 0f)
			{
				Burst();
				_glitchTimer = Mathf.Lerp(0.055f, 0.24f, Next01());
			}
			if (_eyeTimer <= 0f)
			{
				MoveEyes();
				_eyeTimer = Mathf.Lerp(0.3f, 1.4f, Next01());
			}
			float num = 0.5f + Mathf.Sin(_time * 0.85f) * 0.5f;
			((Graphic)_forest).color = Color.Lerp(new Color(0.82f, 0.86f, 0.9f, 1f), new Color(0.58f, 0.7f, 0.72f, 1f), num * 0.22f);
			((Graphic)_forest).rectTransform.anchoredPosition = new Vector2(Mathf.Sin(_time * 0.7f) * 2f, Mathf.Sin(_time * 0.43f) * 1.5f);
			((Graphic)_vignette).color = new Color(1f, 1f, 1f, 0.88f + num * 0.08f);
			float num2 = Mathf.Pow(Mathf.Clamp01(Mathf.Sin(_time * 2.1f + 0.7f)), 9f);
			Color color = default(Color);
			((Color)(ref color))..ctor(0.75f, 0.93f, 1f, 0.18f + num2 * 0.82f);
			((Graphic)_leftEye).color = color;
			((Graphic)_rightEye).color = color;
			if ((Object)(object)_staticAudio != (Object)null)
			{
				if (!_staticAudio.isPlaying && (Object)(object)HollowAudio.StaticClip != (Object)null)
				{
					StartStatic();
				}
				float num3 = ((EmpressHollowPlugin.Settings != null) ? EmpressHollowPlugin.Settings.MasterVolume.Value : 0.85f);
				_staticAudio.volume = num3 * Mathf.Lerp(0.025f, 0.085f, num2);
			}
		}

		private void Burst()
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			int num = 2 + Mathf.FloorToInt(Next01() * (float)(_bands.Count - 1));
			for (int i = 0; i < _bands.Count; i++)
			{
				RawImage val = _bands[i];
				bool flag = i < num;
				((Component)val).gameObject.SetActive(flag);
				if (flag)
				{
					float num2 = Mathf.Lerp(0.06f, 0.94f, Next01());
					float num3 = Mathf.Lerp(6f, 58f, Next01() * Next01());
					RectTransform rectTransform = ((Graphic)val).rectTransform;
					rectTransform.anchorMin = new Vector2(0f, num2);
					rectTransform.anchorMax = new Vector2(1f, num2);
					rectTransform.sizeDelta = new Vector2(0f, num3);
					rectTransform.anchoredPosition = new Vector2(Mathf.Lerp(-95f, 95f, Next01()), 0f);
					val.uvRect = new Rect(Mathf.Lerp(-0.08f, 0.08f, Next01()), Mathf.Clamp01(num2 - num3 / 2160f), 1f, Mathf.Max(0.008f, num3 / 1080f));
					float num4 = Next01();
					((Graphic)val).color = ((num4 < 0.45f) ? Cold : ((num4 < 0.82f) ? Pale : Bruise));
				}
			}
		}

		private void MoveEyes()
		{
			//IL_0010: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			_eyeRoot.anchorMin = new Vector2(0.5f, 0.5f);
			_eyeRoot.anchorMax = new Vector2(0.5f, 0.5f);
			_eyeRoot.anchoredPosition = new Vector2(Mathf.Lerp(-430f, 430f, Next01()), Mathf.Lerp(-80f, 190f, Next01()));
			float num = Mathf.Lerp(0.55f, 1.2f, Next01());
			((Transform)_eyeRoot).localScale = new Vector3(num, num, 1f);
		}

		private void EnsureBuilt(Transform parent)
		{
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_root != (Object)null))
			{
				Texture2D texture = CreateForestTexture();
				_root = CreateObject("Empress Hollow Loading", parent);
				Stretch(_root.GetComponent<RectTransform>());
				GameObject val = CreateObject("Empress Hollow Loading Forest", _root.transform);
				Stretch(val.GetComponent<RectTransform>());
				_forest = val.AddComponent<RawImage>();
				((Graphic)_forest).raycastTarget = false;
				_forest.texture = (Texture)(object)texture;
				for (int i = 0; i < 14; i++)
				{
					RawImage val2 = CreateObject("Empress Hollow Loading Fracture", _root.transform).AddComponent<RawImage>();
					((Graphic)val2).raycastTarget = false;
					val2.texture = (Texture)(object)texture;
					((Component)val2).gameObject.SetActive(false);
					_bands.Add(val2);
				}
				GameObject val3 = CreateObject("Empress Hollow Loading Eyes", _root.transform);
				_eyeRoot = val3.GetComponent<RectTransform>();
				_eyeRoot.sizeDelta = new Vector2(92f, 28f);
				Sprite sprite = CreateCircleSprite(64, 0.56f);
				_leftEye = CreateImage("Empress Hollow Loading Left Eye", val3.transform, Color.clear);
				_rightEye = CreateImage("Empress Hollow Loading Right Eye", val3.transform, Color.clear);
				_leftEye.sprite = sprite;
				_rightEye.sprite = sprite;
				SetEye(((Graphic)_leftEye).rectTransform, -23f);
				SetEye(((Graphic)_rightEye).rectTransform, 23f);
				GameObject val4 = CreateObject("Empress Hollow Loading Vignette", _root.transform);
				Stretch(val4.GetComponent<RectTransform>());
				_vignette = val4.AddComponent<Image>();
				((Graphic)_vignette).raycastTarget = false;
				_vignette.sprite = CreateVignetteSprite();
				_staticAudio = _root.AddComponent<AudioSource>();
				_staticAudio.loop = true;
				_staticAudio.playOnAwake = false;
				_staticAudio.spatialBlend = 0f;
				HollowAudio.ApplyRepoMixer(_staticAudio);
				_root.SetActive(false);
			}
		}

		private void StartStatic()
		{
			if (!((Object)(object)_staticAudio == (Object)null) && !((Object)(object)HollowAudio.StaticClip == (Object)null))
			{
				HollowAudio.ApplyRepoMixer(_staticAudio);
				if ((Object)(object)_staticAudio.clip != (Object)(object)HollowAudio.StaticClip)
				{
					_staticAudio.Stop();
					_staticAudio.clip = HollowAudio.StaticClip;
				}
				if (!_staticAudio.isPlaying)
				{
					_staticAudio.Play();
				}
			}
		}

		private void BringToFront(Transform target)
		{
			if (!((Object)(object)target == (Object)null) && !((Object)(object)_root == (Object)null))
			{
				Transform parent = _root.transform.parent;
				Transform val = target;
				while ((Object)(object)val.parent != (Object)null && (Object)(object)val.parent != (Object)(object)parent)
				{
					val = val.parent;
				}
				if ((Object)(object)val.parent == (Object)(object)parent)
				{
					val.SetAsLastSibling();
				}
				target.SetAsLastSibling();
			}
		}

		private float Next01()
		{
			_state ^= _state << 13;
			_state ^= _state >> 17;
			_state ^= _state << 5;
			return (float)(_state & 0xFFFFFF) / 16777215f;
		}

		private static Texture2D CreateForestTexture()
		{
			//IL_0035: 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_004f: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: 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)
			Color[] array = (Color[])(object)new Color[131072];
			Random random = new Random(7349);
			for (int i = 0; i < 256; i++)
			{
				float num = (float)i / 255f;
				Color val = Color.Lerp(new Color(0.008f, 0.012f, 0.018f), new Color(0.04f, 0.07f, 0.085f), num);
				for (int j = 0; j < 512; j++)
				{
					float num2 = (float)((j * 37 + i * 71) & 0x1F) / 31f;
					array[i * 512 + j] = val * Mathf.Lerp(0.88f, 1.08f, num2);
				}
			}
			DrawMoon(array, 512, 256, 384, 194, 18);
			DrawForestLayer(array, 512, 256, random, 34, new Color(0.025f, 0.04f, 0.045f), 46, 188, 1, 4);
			DrawForestLayer(array, 512, 256, random, 24, new Color(0.006f, 0.009f, 0.011f), 72, 232, 3, 8);
			Texture2D val2 = new Texture2D(512, 256, (TextureFormat)4, false)
			{
				wrapMode = (TextureWrapMode)1,
				filterMode = (FilterMode)1
			};
			val2.SetPixels(array);
			val2.Apply(false, true);
			return val2;
		}

		private static void DrawForestLayer(Color[] pixels, int width, int height, Random random, int count, Color color, int minHeight, int maxHeight, int minWidth, int maxWidth)
		{
			//IL_0044: 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)
			for (int i = 0; i < count; i++)
			{
				int num = random.Next(-18, width + 18);
				int num2 = random.Next(minHeight, maxHeight);
				int num3 = random.Next(minWidth, maxWidth + 1);
				int num4 = random.Next(-9, 10);
				DrawLine(pixels, width, height, num, -8, num + num4, num2, num3, color);
				int num5 = random.Next(2, 6);
				for (int j = 0; j < num5; j++)
				{
					float num6 = Mathf.Lerp(0.38f, 0.88f, (float)random.NextDouble());
					int num7 = Mathf.RoundToInt(Mathf.Lerp((float)num, (float)(num + num4), num6));
					int num8 = Mathf.RoundToInt((float)num2 * num6);
					int num9 = ((random.Next(0, 2) != 0) ? 1 : (-1));
					int num10 = random.Next(12, 42);
					DrawLine(pixels, width, height, num7, num8, num7 + num10 * num9, num8 + random.Next(5, 28), Mathf.Max(1, num3 / 3), color);
				}
			}
		}

		private static void DrawMoon(Color[] pixels, int width, int height, int cx, int cy, int radius)
		{
			//IL_0028: 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_0079: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			int num = radius * 4;
			for (int i = Mathf.Max(0, cy - num); i < Mathf.Min(height, cy + num); i++)
			{
				for (int j = Mathf.Max(0, cx - num); j < Mathf.Min(width, cx + num); j++)
				{
					float num2 = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2((float)cx, (float)cy));
					float num3 = Mathf.Clamp01(1f - num2 / (float)num);
					Color val = ((num2 <= (float)radius) ? new Color(0.55f, 0.68f, 0.72f) : new Color(0.16f, 0.23f, 0.26f));
					pixels[i * width + j] = Color.Lerp(pixels[i * width + j], val, num3 * num3 * ((num2 <= (float)radius) ? 0.9f : 0.35f));
				}
			}
		}

		private static void DrawLine(Color[] pixels, int width, int height, int x0, int y0, int x1, int y1, int radius, Color color)
		{
			//IL_0081: 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)
			int num = Mathf.Max(Mathf.Abs(x1 - x0), Mathf.Abs(y1 - y0));
			for (int i = 0; i <= num; i++)
			{
				float num2 = ((num == 0) ? 0f : ((float)i / (float)num));
				int num3 = Mathf.RoundToInt(Mathf.Lerp((float)x0, (float)x1, num2));
				int num4 = Mathf.RoundToInt(Mathf.Lerp((float)y0, (float)y1, num2));
				for (int j = num4 - radius; j <= num4 + radius; j++)
				{
					if (j < 0 || j >= height)
					{
						continue;
					}
					for (int k = num3 - radius; k <= num3 + radius; k++)
					{
						if (k >= 0 && k < width)
						{
							pixels[j * width + k] = color;
						}
					}
				}
			}
		}

		private static Sprite CreateCircleSprite(int size, float edge)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false);
			Vector2 val2 = Vector2.one * (float)(size - 1) * 0.5f;
			float num = (float)size * 0.5f;
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num2 = Vector2.Distance(new Vector2((float)j, (float)i), val2) / num;
					float num3 = 1f - Mathf.SmoothStep(edge, 1f, num2);
					val.SetPixel(j, i, new Color(1f, 1f, 1f, num3));
				}
			}
			val.Apply(false, true);
			return Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), 100f);
		}

		private static Sprite CreateVignetteSprite()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(192, 192, (TextureFormat)4, false);
			Vector2 val2 = Vector2.one * 191f * 0.5f;
			float num = 96f;
			for (int i = 0; i < 192; i++)
			{
				for (int j = 0; j < 192; j++)
				{
					Vector2 val3 = new Vector2((float)j, (float)i) - val2;
					val3.x *= 0.72f;
					float num2 = ((Vector2)(ref val3)).magnitude / num;
					float num3 = Mathf.SmoothStep(0.32f, 1f, num2) * 0.94f;
					val.SetPixel(j, i, new Color(0f, 0f, 0f, num3));
				}
			}
			val.Apply(false, true);
			return Sprite.Create(val, new Rect(0f, 0f, 192f, 192f), new Vector2(0.5f, 0.5f), 100f);
		}

		private static GameObject CreateObject(string name, Transform parent)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			GameObject val = new GameObject(name, new Type[2]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer)
			});
			val.transform.SetParent(parent, false);
			return val;
		}

		private static Image CreateImage(string name, Transform parent, Color color)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			Image obj = CreateObject(name, parent).AddComponent<Image>();
			((Graphic)obj).raycastTarget = false;
			((Graphic)obj).color = color;
			return obj;
		}

		private static void Stretch(RectTransform rect)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or miss