BepInEx\plugins\Empress-PT\EmpressPT.dll

Decompiled 12 hours 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 Unity.AI.Navigation;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.Networking;
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("EmpressPT")]
[assembly: AssemblyTitle("EmpressPT")]
[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.PT
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.empress.repo.pt", "Empress PT", "1.0.0")]
	public sealed class EmpressPTPlugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.empress.repo.pt";

		public const string PluginName = "Empress PT";

		public const string PluginVersion = "1.0.0";

		public const string PTLevelName = "Level - Empress PT";

		public const string PTDisplayName = "Empress - P.T.";

		internal const byte EntityEventCode = 180;

		internal const byte ObjectiveEventCode = 182;

		internal const byte HudEventCode = 183;

		internal const byte PlayerEventCode = 184;

		private static bool _photonEventsHooked;

		private Harmony _harmony;

		internal static EmpressPTPlugin Instance { get; private set; }

		internal static ManualLogSource Log { get; private set; }

		internal static PTSettings Settings { get; private set; }

		internal static Level PTLevel { get; private set; }

		private void Awake()
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			Settings = new PTSettings(((BaseUnityPlugin)this).Config);
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			PTLevel = PTLevelRegistry.RegisterPTLevel();
			PTAudio.Initialize(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location));
			PTLisaAssets.Initialize(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location));
			_harmony = new Harmony("com.empress.repo.pt");
			_harmony.PatchAll(typeof(EmpressPTPlugin).Assembly);
			PTRuntime.EnsureHost();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Empress PT v1.0.0 loaded. Level registered: Level - Empress PT");
		}

		private void OnDestroy()
		{
			RemovePhotonEventHook();
		}

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

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

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

		private static void OnPhotonEvent(EventData ev)
		{
			PTRuntime instance = PTRuntime.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			switch (ev.Code)
			{
			case 180:
				if (ev.CustomData is object[] data4)
				{
					instance.ReceiveEntity(data4);
				}
				break;
			case 182:
				if (ev.CustomData is object[] data2)
				{
					instance.ReceiveObjectiveEvent(data2);
				}
				break;
			case 183:
				if (ev.CustomData is object[] data3)
				{
					instance.ReceiveHudEvent(data3);
				}
				break;
			case 184:
				if (ev.CustomData is object[] data)
				{
					instance.ReceivePlayerEvent(data);
				}
				break;
			case 181:
				break;
			}
		}

		internal static void RaiseEntity(object[] data)
		{
			RaiseToAll(180, data);
		}

		internal static void RaiseObjective(object[] data)
		{
			//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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			EnsurePhotonEventHooked();
			if (!PhotonNetwork.InRoom)
			{
				PTRuntime.Instance?.ReceiveObjectiveEvent(data);
				return;
			}
			RaiseEventOptions val = new RaiseEventOptions
			{
				Receivers = (ReceiverGroup)1
			};
			PhotonNetwork.RaiseEvent((byte)182, (object)data, val, SendOptions.SendReliable);
		}

		internal static void RaiseHud(object[] data)
		{
			RaiseToAll(183, data);
		}

		internal static void RaisePlayer(object[] data)
		{
			//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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			EnsurePhotonEventHooked();
			if (!PhotonNetwork.InRoom)
			{
				PTRuntime.Instance?.ReceivePlayerEvent(data);
				return;
			}
			RaiseEventOptions val = new RaiseEventOptions
			{
				Receivers = (ReceiverGroup)1
			};
			PhotonNetwork.RaiseEvent((byte)184, (object)data, val, SendOptions.SendReliable);
		}

		private static void RaiseToAll(byte code, object payload)
		{
			//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)
			EnsurePhotonEventHooked();
			if (PhotonNetwork.InRoom)
			{
				RaiseEventOptions val = new RaiseEventOptions
				{
					Receivers = (ReceiverGroup)0
				};
				PhotonNetwork.RaiseEvent(code, payload, val, SendOptions.SendReliable);
			}
		}
	}
	internal sealed class PTSettings
	{
		public readonly ConfigEntry<bool> ForcePTLevel;

		public readonly ConfigEntry<bool> EnableEntity;

		public readonly ConfigEntry<float> EntityChaseSpeed;

		public readonly ConfigEntry<bool> SpawnValuables;

		public readonly ConfigEntry<float> MasterVolume;

		public PTSettings(ConfigFile config)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			ForcePTLevel = config.Bind<bool>("Debug", "ForcePTLevel", false, "Forces every real run level to load Empress - P.T. Useful for testing.");
			EnableEntity = config.Bind<bool>("Level", "EnableEntity", true, "Enables the stalking entity that hunts the riders.");
			EntityChaseSpeed = config.Bind<float>("Entity", "ChaseSpeed", 2.2f, new ConfigDescription("Move speed of the entity while hunting.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.8f, 4f), Array.Empty<object>()));
			SpawnValuables = config.Bind<bool>("Level", "SpawnValuables", true, "Places valuables to grab around the house.");
			MasterVolume = config.Bind<float>("Audio", "MasterVolume", 0.8f, new ConfigDescription("Volume of the Empress PT ambience and scares.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
		}
	}
	internal static class PTAccess
	{
		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 RunManagerLevelsField = AccessTools.Field(typeof(RunManager), "levels");

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

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

		private static readonly FieldInfo PlayerAvatarIsLocalField = AccessTools.Field(typeof(PlayerAvatar), "isLocal");

		private static readonly FieldInfo PlayerAvatarNameField = AccessTools.Field(typeof(PlayerAvatar), "playerName");

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

		private static readonly FieldInfo FlashlightHideField = AccessTools.Field(typeof(FlashlightController), "hideFlashlight");

		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 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 FieldInfo ItemAttributesHasIconField = AccessTools.Field(typeof(ItemAttributes), "hasIcon");

		private static readonly FieldInfo ValuableVolumeTypeField = AccessTools.Field(typeof(ValuableVolume), "VolumeType");

		private static readonly FieldInfo CameraAimHorizontalField = AccessTools.Field(typeof(CameraAim), "aimHorizontal");

		private static readonly FieldInfo CameraAimVerticalField = AccessTools.Field(typeof(CameraAim), "aimVertical");

		private static readonly FieldInfo PlayerAvatarRbField = AccessTools.Field(typeof(PlayerAvatar), "rb");

		private static readonly FieldInfo PlayerControllerRbField = AccessTools.Field(typeof(PlayerController), "rb");

		private static readonly FieldInfo PlayerAvatarVisualPositionField = AccessTools.Field(typeof(PlayerAvatarVisuals), "visualPosition");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, bool> ImpactDestroyDisableRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, bool>("destroyDisable");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, bool> ImpactDestroyDisableTeleportRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, bool>("destroyDisableTeleport");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, bool> ImpactDisableRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, bool>("impactDisable");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, bool> ImpactIsIndestructibleRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, bool>("isIndestructible");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, bool> ImpactPlayerHurtDisableRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, bool>("playerHurtDisable");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, bool> ImpactSlidingDisableRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, bool>("slidingDisable");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, UnityEvent> ImpactOnAllImpactsRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, UnityEvent>("onAllImpacts");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, UnityEvent> ImpactOnImpactLightRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, UnityEvent>("onImpactLight");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, UnityEvent> ImpactOnImpactMediumRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, UnityEvent>("onImpactMedium");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, UnityEvent> ImpactOnImpactHeavyRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, UnityEvent>("onImpactHeavy");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, UnityEvent> ImpactOnAllBreaksRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, UnityEvent>("onAllBreaks");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, UnityEvent> ImpactOnBreakLightRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, UnityEvent>("onBreakLight");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, UnityEvent> ImpactOnBreakMediumRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, UnityEvent>("onBreakMedium");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, UnityEvent> ImpactOnBreakHeavyRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, UnityEvent>("onBreakHeavy");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, UnityEvent> ImpactOnDestroyRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, UnityEvent>("onDestroy");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, UnityEvent> ImpactOnHurtColliderHitRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, UnityEvent>("onHurtColliderHit");

		private static readonly FieldRef<PhysGrabObject, bool> PhysGrabOverrideTagsAndLayersRef = AccessTools.FieldRefAccess<PhysGrabObject, bool>("overrideTagsAndLayers");

		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 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 void SetLevelPrevious(RunManager manager, Level level)
		{
			SetField(RunManagerLevelPreviousField, manager, level);
		}

		public static List<Level> GetLevels(RunManager manager)
		{
			return Get<List<Level>>(RunManagerLevelsField, manager);
		}

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

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

		public static bool GetIsLocal(PlayerAvatar avatar)
		{
			return GetBool(PlayerAvatarIsLocalField, avatar);
		}

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

		public static bool GetFlashlightHidden(FlashlightController controller)
		{
			return GetBool(FlashlightHideField, controller);
		}

		public static void SetFlashlightHidden(FlashlightController controller, bool hidden)
		{
			SetField(FlashlightHideField, controller, hidden);
		}

		public static string GetPlayerName(PlayerAvatar avatar)
		{
			if ((Object)(object)avatar == (Object)null)
			{
				return "PLAYER";
			}
			string text = Get<string>(PlayerAvatarNameField, avatar);
			if (!string.IsNullOrWhiteSpace(text))
			{
				return text;
			}
			return "PLAYER";
		}

		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 void SetValuablePresets(Level level, List<LevelValuables> presets)
		{
			SetField(LevelValuablePresetsField, level, presets);
		}

		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 (int)type switch
			{
				0 => Get<List<PrefabRef>>(LevelValuablesTinyField, valuables), 
				1 => Get<List<PrefabRef>>(LevelValuablesSmallField, valuables), 
				2 => Get<List<PrefabRef>>(LevelValuablesMediumField, valuables), 
				3 => Get<List<PrefabRef>>(LevelValuablesBigField, valuables), 
				4 => Get<List<PrefabRef>>(LevelValuablesWideField, valuables), 
				5 => Get<List<PrefabRef>>(LevelValuablesTallField, valuables), 
				_ => Get<List<PrefabRef>>(LevelValuablesVeryTallField, valuables), 
			};
		}

		public static void SetValuableVolumeType(ValuableVolume volume, Type type)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			SetField(ValuableVolumeTypeField, volume, type);
		}

		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 bool GetItemHasIcon(ItemAttributes attributes)
		{
			return GetBool(ItemAttributesHasIconField, attributes);
		}

		public static Rigidbody GetPlayerAvatarRigidbody(PlayerAvatar avatar)
		{
			return Get<Rigidbody>(PlayerAvatarRbField, avatar);
		}

		public static Rigidbody GetPlayerControllerRigidbody(PlayerController controller)
		{
			return Get<Rigidbody>(PlayerControllerRbField, controller);
		}

		public static void SetPlayerAvatarVisualPosition(PlayerAvatarVisuals visuals, Vector3 position)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			SetField(PlayerAvatarVisualPositionField, visuals, position);
		}

		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));
		}

		public static void ConfigureDoorImpact(PhysGrabObjectImpactDetector impact)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			if (!((Object)(object)impact == (Object)null))
			{
				ImpactDestroyDisableRef.Invoke(impact) = true;
				ImpactDestroyDisableTeleportRef.Invoke(impact) = true;
				ImpactDisableRef.Invoke(impact) = true;
				ImpactIsIndestructibleRef.Invoke(impact) = true;
				ImpactPlayerHurtDisableRef.Invoke(impact) = true;
				ImpactSlidingDisableRef.Invoke(impact) = true;
				ImpactOnAllImpactsRef.Invoke(impact) = new UnityEvent();
				ImpactOnImpactLightRef.Invoke(impact) = new UnityEvent();
				ImpactOnImpactMediumRef.Invoke(impact) = new UnityEvent();
				ImpactOnImpactHeavyRef.Invoke(impact) = new UnityEvent();
				ImpactOnAllBreaksRef.Invoke(impact) = new UnityEvent();
				ImpactOnBreakLightRef.Invoke(impact) = new UnityEvent();
				ImpactOnBreakMediumRef.Invoke(impact) = new UnityEvent();
				ImpactOnBreakHeavyRef.Invoke(impact) = new UnityEvent();
				ImpactOnDestroyRef.Invoke(impact) = new UnityEvent();
				ImpactOnHurtColliderHitRef.Invoke(impact) = new UnityEvent();
			}
		}

		public static void ConfigureDoorPhysGrabObject(PhysGrabObject physGrabObject)
		{
			if (!((Object)(object)physGrabObject == (Object)null))
			{
				PhysGrabOverrideTagsAndLayersRef.Invoke(physGrabObject) = true;
			}
		}

		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 PTAudio
	{
		private const int SampleRate = 44100;

		private static AudioClip _interactClip;

		private static AudioClip _phoneClip;

		private static AudioClip _knockClip;

		private static AudioClip _stingClip;

		private static AudioClip _creakClip;

		private static AudioClip _heartbeatClip;

		private static AudioClip _slamClip;

		private static AudioClip _staticClip;

		private static AudioClip _ambienceClip;

		private static bool _initialized;

		public static AudioClip AmbienceClip => _ambienceClip;

		public static void Initialize(string pluginDirectory)
		{
			if (!_initialized)
			{
				_initialized = true;
				_interactClip = LoadExternalClip(pluginDirectory, "empresspt_interact.ogg") ?? BuildInteract();
				_phoneClip = LoadExternalClip(pluginDirectory, "empresspt_phone.ogg") ?? BuildPhoneRing();
				_knockClip = LoadExternalClip(pluginDirectory, "empresspt_knock.ogg") ?? BuildKnock();
				_stingClip = LoadExternalClip(pluginDirectory, "empresspt_sting.ogg") ?? BuildSting();
				_creakClip = LoadExternalClip(pluginDirectory, "empresspt_creak.ogg") ?? BuildCreak();
				_heartbeatClip = LoadExternalClip(pluginDirectory, "empresspt_heartbeat.ogg") ?? BuildHeartbeat();
				_slamClip = LoadExternalClip(pluginDirectory, "empresspt_slam.ogg") ?? BuildSlam();
				_staticClip = LoadExternalClip(pluginDirectory, "empresspt_static.ogg") ?? BuildStatic();
				_ambienceClip = LoadExternalClip(pluginDirectory, "empresspt_ambience.ogg") ?? BuildAmbience();
			}
		}

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

		public static void PlayPhoneRing(Vector3 position)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Play(_phoneClip, position, 0.65f, 0.99f, 1.01f);
		}

		public static void PlayWhisper(Vector3 position)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			Play(PTLisaAssets.RandomCry ?? _staticClip, position, 0.5f, 0.85f, 1.05f);
		}

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

		public static void PlaySting(Vector3 position)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Play(_stingClip, position, 0.5f, 0.92f, 1.08f);
		}

		public static void PlayDoor(Vector3 position)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Play(_creakClip, position, 0.65f, 0.82f, 1.12f);
		}

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

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

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

		public static void PlayLisaStep(Vector3 position)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Play(PTLisaAssets.RandomStep, position, 0.45f, 0.92f, 1.08f);
		}

		public static void PlayLisaKill(Vector3 position)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			Play(PTLisaAssets.KillClip ?? _stingClip, position, 0.85f);
		}

		private static void Play(AudioClip clip, Vector3 position, float volume, float pitchMin = 0.97f, float pitchMax = 1.03f)
		{
			//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_00cc: Expected O, but got Unknown
			if (!((Object)(object)clip == (Object)null))
			{
				float num = ((EmpressPTPlugin.Settings != null) ? EmpressPTPlugin.Settings.MasterVolume.Value : 0.8f);
				if (!(num <= 0f))
				{
					GameObject val = new GameObject("Empress PT 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 = 1.5f;
					val2.maxDistance = 30f;
					val2.dopplerLevel = 0f;
					val2.Play();
					Object.Destroy((Object)val, clip.length / Mathf.Max(0.5f, val2.pitch) + 0.2f);
				}
			}
		}

		private static AudioClip LoadExternalClip(string pluginDirectory, string fileName)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Invalid comparison between Unknown and I4
			if (string.IsNullOrWhiteSpace(pluginDirectory))
			{
				return null;
			}
			string text = Path.Combine(pluginDirectory, fileName);
			if (!File.Exists(text))
			{
				return null;
			}
			UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip("file:///" + text.Replace('\\', '/'), (AudioType)14);
			try
			{
				UnityWebRequestAsyncOperation val = audioClip.SendWebRequest();
				while (!((AsyncOperation)val).isDone)
				{
				}
				if ((int)audioClip.result != 1)
				{
					return null;
				}
				AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip);
				if ((Object)(object)content != (Object)null)
				{
					((Object)content).name = Path.GetFileNameWithoutExtension(fileName);
				}
				return content;
			}
			finally
			{
				((IDisposable)audioClip)?.Dispose();
			}
		}

		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 void AddThump(float[] data, float startTime, float frequency, float decay, float amplitude)
		{
			int num = (int)(startTime * 44100f);
			int num2 = Mathf.Min((int)(decay * 5f * 44100f), data.Length - num);
			for (int i = 0; i < num2; i++)
			{
				float num3 = (float)i / 44100f;
				float num4 = Mathf.Exp((0f - num3) / decay);
				float num5 = Mathf.Sin(MathF.PI * 2f * frequency * num3 * (1f - num3 * 0.35f));
				float num6 = ((i < 180) ? ((Random.value * 2f - 1f) * (1f - (float)i / 180f) * 0.4f) : 0f);
				data[num + i] = Mathf.Clamp(data[num + i] + (num5 * num4 + num6 * num4) * amplitude, -1f, 1f);
			}
		}

		private static AudioClip BuildInteract()
		{
			int num = 7056;
			float[] array = new float[num];
			for (int i = 0; i < num; i++)
			{
				float num2 = Mathf.Sin((float)i / (float)num * MathF.PI);
				float num3 = Mathf.Sin((float)i / 44100f * MathF.PI * 2f * 820f);
				array[i] = Mathf.Clamp(num3 * num2, -1f, 1f) * 0.45f;
			}
			return MakeClip("EmpressPTInteract", array);
		}

		private static AudioClip BuildPhoneRing()
		{
			int num = 88200;
			float[] array = new float[num];
			for (int i = 0; i < num; i++)
			{
				float num2 = (float)i / 44100f;
				float num3 = ((num2 < 0.42f || (num2 > 0.72f && num2 < 1.14f)) ? 1f : 0f);
				float num4 = Mathf.Sin(Mathf.Clamp01(num2 % 0.72f / 0.42f) * MathF.PI);
				float num5 = Mathf.Sin(num2 * MathF.PI * 2f * 440f);
				float num6 = Mathf.Sin(num2 * MathF.PI * 2f * 480f);
				array[i] = (num5 + num6) * 0.22f * num4 * num3;
			}
			return MakeClip("EmpressPTPhone", array);
		}

		private static AudioClip BuildKnock()
		{
			float[] data = new float[27342];
			AddThump(data, 0f, 86f, 0.085f, 0.85f);
			AddThump(data, 0.17f, 80f, 0.085f, 0.7f);
			AddThump(data, 0.33f, 83f, 0.1f, 0.78f);
			return MakeClip("EmpressPTKnock", data);
		}

		private static AudioClip BuildHeartbeat()
		{
			float[] data = new float[30870];
			AddThump(data, 0f, 54f, 0.09f, 0.9f);
			AddThump(data, 0.26f, 47f, 0.11f, 0.65f);
			return MakeClip("EmpressPTHeartbeat", data);
		}

		private static AudioClip BuildSlam()
		{
			int num = 30870;
			float[] array = new float[num];
			AddThump(array, 0f, 58f, 0.22f, 1f);
			for (int i = 0; i < num; i++)
			{
				float num2 = Mathf.Exp((0f - (float)i / 44100f) / 0.06f);
				array[i] = Mathf.Clamp(array[i] + (Random.value * 2f - 1f) * num2 * 0.5f, -1f, 1f);
			}
			return MakeClip("EmpressPTSlam", array);
		}

		private static AudioClip BuildSting()
		{
			int num = 70560;
			float[] array = new float[num];
			float[] array2 = new float[5] { 523f, 528.4f, 659f, 663.7f, 783f };
			for (int i = 0; i < num; i++)
			{
				float num2 = (float)i / 44100f;
				float num3 = num2 / 1.6f;
				float num4 = ((num3 < 0.72f) ? Mathf.Pow(num3 / 0.72f, 2.2f) : Mathf.Exp((0f - (num3 - 0.72f)) * 9f));
				float num5 = 1f - 0.35f * Mathf.Clamp01(num3 * 1.6f) * (0.5f + 0.5f * Mathf.Sin(MathF.PI * 18f * num2));
				float num6 = 0f;
				for (int j = 0; j < array2.Length; j++)
				{
					num6 += Mathf.Sin(MathF.PI * 2f * array2[j] * num2 + (float)j * 1.7f);
				}
				float num7 = Mathf.Sin(MathF.PI * 130f * num2) * 0.5f;
				array[i] = Mathf.Clamp((num6 * 0.13f + num7) * num4 * num5, -1f, 1f) * 0.55f;
			}
			return MakeClip("EmpressPTSting", array);
		}

		private static AudioClip BuildCreak()
		{
			int num = 50715;
			float[] array = new float[num];
			float num2 = 0f;
			float num3 = Random.Range(0f, 50f);
			for (int i = 0; i < num; i++)
			{
				float num4 = (float)i / 44100f;
				float num5 = num4 / 1.15f;
				float num6 = 165f - 62f * num5 + 28f * (Mathf.PerlinNoise(num3, num4 * 7f) - 0.5f);
				num2 += MathF.PI * 2f * num6 / 44100f;
				float num7 = 0.45f + 0.55f * Mathf.PerlinNoise(num3 + 9f, num4 * 16f);
				float num8 = Mathf.Sin(num5 * MathF.PI);
				array[i] = Mathf.Clamp(Mathf.Sin(num2) * num7 * num8, -1f, 1f) * 0.4f;
			}
			return MakeClip("EmpressPTCreak", array);
		}

		private static AudioClip BuildStatic()
		{
			int num = 35280;
			float[] array = new float[num];
			float num2 = 0f;
			for (int i = 0; i < num; i++)
			{
				float num3 = (float)i / 44100f;
				if (i % 520 == 0)
				{
					num2 = ((Random.value < 0.62f) ? Random.Range(0.4f, 1f) : 0.08f);
				}
				float num4 = Mathf.Sin(Mathf.Clamp01(num3 / 0.8f) * MathF.PI);
				array[i] = (Random.value * 2f - 1f) * num2 * num4 * 0.42f;
			}
			return MakeClip("EmpressPTStatic", array);
		}

		private static AudioClip BuildAmbience()
		{
			int num = 352800;
			int num2 = 17640;
			float[] array = new float[num + num2];
			float num3 = 0f;
			for (int i = 0; i < array.Length; i++)
			{
				float num4 = (float)i / 44100f;
				num3 = (num3 + (Random.value * 2f - 1f) * 0.022f) / 1.012f;
				float num5 = 0.65f + 0.35f * Mathf.Sin(MathF.PI * 2f * num4 / 8f);
				float num6 = Mathf.Sin(MathF.PI * 96f * num4) * 0.05f;
				array[i] = Mathf.Clamp(num3 * 2.6f * num5 + num6, -1f, 1f) * 0.5f;
			}
			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("EmpressPTAmbience", array2);
		}
	}
	internal sealed class PTDoorSwing : MonoBehaviour
	{
		public Vector3 HandleLocal;

		public bool Locked;

		private Rigidbody _rb;

		private PhysGrabObject _physGrabObject;

		private HingeJoint _joint;

		private bool _lastLocked;

		private float _creakTimer;

		private void Awake()
		{
			_rb = ((Component)this).GetComponent<Rigidbody>();
			_physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			_joint = ((Component)this).GetComponent<HingeJoint>();
			_lastLocked = !Locked;
			ApplyLockState();
		}

		private void FixedUpdate()
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_014d: 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_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: 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_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: 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_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: 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)
			//IL_01f5: 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)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			ApplyLockState();
			if (Locked)
			{
				if ((Object)(object)_rb != (Object)null && (Object)(object)_joint != (Object)null)
				{
					float num = Vector3.Dot(_rb.angularVelocity, Vector3.up);
					_rb.AddTorque(Vector3.up * Mathf.Clamp((0f - _joint.angle) * 18f - num * 8f, -120f, 120f), (ForceMode)5);
				}
				return;
			}
			if ((Object)(object)_rb != (Object)null && Mathf.Abs(Vector3.Dot(_rb.angularVelocity, Vector3.up)) > 0.5f && Time.time >= _creakTimer)
			{
				_creakTimer = Time.time + Random.Range(1.5f, 2.6f);
				PTAudio.PlayDoor(((Component)this).transform.position);
			}
			if ((Object)(object)_rb == (Object)null || (Object)(object)_physGrabObject == (Object)null || !_physGrabObject.grabbed || _physGrabObject.playerGrabbing.Count == 0)
			{
				return;
			}
			Vector3 position = ((Component)this).transform.position;
			Vector3 val = Vector3.ProjectOnPlane(((Component)this).transform.TransformPoint(HandleLocal) - position, Vector3.up);
			Vector3 val2 = Vector3.zero;
			int num2 = 0;
			for (int i = 0; i < _physGrabObject.playerGrabbing.Count; i++)
			{
				PhysGrabber val3 = _physGrabObject.playerGrabbing[i];
				if (!((Object)(object)val3 == (Object)null))
				{
					val2 += val3.physGrabPointPullerPosition;
					num2++;
				}
			}
			if (num2 != 0 && !(((Vector3)(ref val)).sqrMagnitude < 0.001f))
			{
				val2 /= (float)num2;
				Vector3 val4 = Vector3.ProjectOnPlane(val2 - position, Vector3.up);
				if (!(((Vector3)(ref val4)).sqrMagnitude < 0.001f))
				{
					float num3 = Vector3.SignedAngle(((Vector3)(ref val)).normalized, ((Vector3)(ref val4)).normalized, Vector3.up);
					float num4 = (0f - Vector3.Dot(_rb.angularVelocity, Vector3.up)) * 8f;
					float num5 = Mathf.Clamp(num3 * 5f, -120f, 120f) + num4;
					_rb.AddTorque(Vector3.up * num5, (ForceMode)5);
					float num6 = Mathf.Clamp(Vector3.Dot(_rb.angularVelocity, Vector3.up), -3f, 3f);
					_rb.angularVelocity = new Vector3(0f, num6, 0f);
				}
			}
		}

		private void ApplyLockState()
		{
			//IL_0023: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_joint == (Object)null) && _lastLocked != Locked)
			{
				JointLimits limits = _joint.limits;
				if (Locked)
				{
					((JointLimits)(ref limits)).min = -2f;
					((JointLimits)(ref limits)).max = 2f;
				}
				else
				{
					((JointLimits)(ref limits)).min = -135f;
					((JointLimits)(ref limits)).max = 135f;
				}
				_joint.limits = limits;
				_joint.useLimits = true;
				_lastLocked = Locked;
			}
		}
	}
	internal enum PTEntityState
	{
		Hidden,
		Lurking,
		Hunting
	}
	internal sealed class PTEntity
	{
		private Transform _root;

		private Transform _head;

		private Animator _animator;

		private Light _eyeLight;

		private readonly List<Material> _materials = new List<Material>();

		private float _chaseSpeed = 3.4f;

		private float _stateTimer;

		private float _stepTimer;

		private float _flickerSeed;

		private bool _usingLisa;

		private string _lastAnimation;

		public PTEntityState State { get; private set; }

		public Vector3 Position
		{
			get
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)_root != (Object)null))
				{
					return Vector3.zero;
				}
				return _root.position;
			}
		}

		public Quaternion Rotation
		{
			get
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)_root != (Object)null))
				{
					return Quaternion.identity;
				}
				return _root.rotation;
			}
		}

		public static PTEntity Create(Transform parent, float chaseSpeed)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			PTEntity pTEntity = new PTEntity
			{
				_chaseSpeed = Mathf.Clamp(chaseSpeed, 0.8f, 4f)
			};
			GameObject val = new GameObject("Empress PT Entity");
			val.transform.SetParent(parent, false);
			pTEntity._root = val.transform;
			GameObject val2 = PTLisaAssets.InstantiateLisa(val.transform);
			if ((Object)(object)val2 != (Object)null)
			{
				pTEntity._usingLisa = true;
				pTEntity._animator = val2.GetComponentInChildren<Animator>(true);
				pTEntity._head = PTLisaAssets.FindBone(val2.transform, "ORG-head", "head", "Head") ?? pTEntity.CreateHeadAnchor(val.transform);
				pTEntity.CreateEyeLight();
				pTEntity._flickerSeed = Random.Range(0f, 100f);
				pTEntity.SetState(PTEntityState.Hidden);
				return pTEntity;
			}
			Material val3 = PTMaterials.CreateEmissive(new Color(0.32f, 0.26f, 0.24f), 0.25f);
			Material val4 = PTMaterials.CreateEmissive(new Color(0.45f, 0.06f, 0.06f), 0.3f);
			pTEntity._materials.Add(val3);
			pTEntity._materials.Add(val4);
			AddPart(val.transform, "Torso", (PrimitiveType)1, new Vector3(0f, 1.1f, 0f), new Vector3(0.5f, 0.6f, 0.35f), val4);
			pTEntity._head = AddPart(val.transform, "Head", (PrimitiveType)0, new Vector3(0f, 1.75f, 0.05f), new Vector3(0.32f, 0.38f, 0.34f), val3).transform;
			AddPart(val.transform, "Arm L", (PrimitiveType)1, new Vector3(-0.32f, 1.05f, 0f), new Vector3(0.14f, 0.5f, 0.14f), val3);
			AddPart(val.transform, "Arm R", (PrimitiveType)1, new Vector3(0.32f, 1.05f, 0f), new Vector3(0.14f, 0.5f, 0.14f), val3);
			AddPart(val.transform, "Leg L", (PrimitiveType)1, new Vector3(-0.15f, 0.45f, 0f), new Vector3(0.16f, 0.5f, 0.16f), val4);
			AddPart(val.transform, "Leg R", (PrimitiveType)1, new Vector3(0.15f, 0.45f, 0f), new Vector3(0.16f, 0.5f, 0.16f), val4);
			pTEntity.CreateEyeLight();
			pTEntity._flickerSeed = Random.Range(0f, 100f);
			pTEntity.SetState(PTEntityState.Hidden);
			return pTEntity;
		}

		public void SetState(PTEntityState state)
		{
			State = state;
			_stateTimer = 0f;
			_stepTimer = 0f;
			if ((Object)(object)_root != (Object)null)
			{
				((Component)_root).gameObject.SetActive(state != PTEntityState.Hidden);
			}
			if ((Object)(object)_animator != (Object)null && state != PTEntityState.Hidden)
			{
				PlayAnimation((state == PTEntityState.Hunting) ? "twitchWalk" : "twitchIdle");
			}
			if (state == PTEntityState.Hidden)
			{
				_lastAnimation = null;
			}
		}

		public void PlaceAt(Vector3 position, Quaternion rotation)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_root != (Object)null)
			{
				_root.position = position;
				_root.rotation = rotation;
			}
		}

		public void Tick(float dt, Vector3 target, IList<Vector3> waypoints)
		{
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_root == (Object)null || State == PTEntityState.Hidden)
			{
				return;
			}
			_stateTimer += dt;
			if ((Object)(object)_eyeLight != (Object)null)
			{
				float num = Mathf.PerlinNoise(_flickerSeed, Time.time * 6f);
				_eyeLight.intensity = ((State == PTEntityState.Hunting) ? (1.4f + num * 1.2f) : (0.7f + num * 0.5f));
			}
			if (State == PTEntityState.Lurking)
			{
				if ((Object)(object)_animator != (Object)null)
				{
					PlayAnimation("twitchIdle");
				}
				Vector3 val = target - _root.position;
				val.y = 0f;
				if (((Vector3)(ref val)).sqrMagnitude > 0.01f)
				{
					_root.rotation = Quaternion.Slerp(_root.rotation, Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up), dt * 2f);
				}
			}
			else
			{
				MoveAlong(dt, target, waypoints);
			}
		}

		private void MoveAlong(float dt, Vector3 target, IList<Vector3> waypoints)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_000d: 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_0071: 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_0077: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_005e: 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)
			Vector3 position = _root.position;
			Vector3 val = target;
			if (waypoints != null && waypoints.Count > 1 && FlatDistance(position, target) > 6f)
			{
				int num = NearestWaypoint(waypoints, position);
				int num2 = NearestWaypoint(waypoints, target);
				if (num != num2)
				{
					Vector3 val2 = waypoints[num + ((num2 > num) ? 1 : (-1))];
					((Vector3)(ref val))..ctor(val2.x, position.y, val2.z);
				}
			}
			Vector3 val3 = val - position;
			val3.y = 0f;
			float magnitude = ((Vector3)(ref val3)).magnitude;
			bool flag = false;
			if (magnitude > 0.05f)
			{
				Vector3 val4 = ((Vector3)(ref val3)).normalized * Mathf.Min(_chaseSpeed * dt, magnitude);
				Vector3 position2 = position + val4;
				position2.y = GroundHeight(position2, position.y);
				_root.position = position2;
				_root.rotation = Quaternion.Slerp(_root.rotation, Quaternion.LookRotation(((Vector3)(ref val3)).normalized, Vector3.up), dt * 6f);
				flag = true;
			}
			if ((Object)(object)_animator != (Object)null)
			{
				PlayAnimation("twitchWalk");
			}
			_stepTimer -= dt;
			if (flag && _stepTimer <= 0f)
			{
				_stepTimer = Random.Range(0.38f, 0.58f);
				PTAudio.PlayLisaStep(_root.position);
			}
			if ((Object)(object)_head != (Object)null && !_usingLisa)
			{
				_head.localRotation = Quaternion.Euler(Mathf.Sin(Time.time * 1.5f) * 4f, 0f, Mathf.Sin(Time.time * 0.8f) * 3f);
			}
		}

		public float DistanceTo(Vector3 point)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_root != (Object)null))
			{
				return float.MaxValue;
			}
			return Vector3.Distance(_root.position, point);
		}

		private static int NearestWaypoint(IList<Vector3> waypoints, Vector3 position)
		{
			//IL_000e: 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)
			int result = 0;
			float num = float.MaxValue;
			for (int i = 0; i < waypoints.Count; i++)
			{
				float num2 = FlatDistance(waypoints[i], position);
				if (num2 < num)
				{
					num = num2;
					result = i;
				}
			}
			return result;
		}

		private static float FlatDistance(Vector3 a, Vector3 b)
		{
			//IL_0018: 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)
			a.y = 0f;
			b.y = 0f;
			return Vector3.Distance(a, b);
		}

		public void Dispose()
		{
			if ((Object)(object)_root != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_root).gameObject);
			}
		}

		private static float GroundHeight(Vector3 position, float fallback)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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)
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(position + Vector3.up * 3f, Vector3.down, ref val, 6f, -1, (QueryTriggerInteraction)1) && (Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<PlayerAvatar>() == (Object)null)
			{
				return ((RaycastHit)(ref val)).point.y;
			}
			return fallback;
		}

		private static GameObject AddPart(Transform parent, string name, PrimitiveType type, Vector3 localPosition, Vector3 scale, Material material)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = GameObject.CreatePrimitive(type);
			((Object)obj).name = name;
			obj.transform.SetParent(parent, false);
			obj.transform.localPosition = localPosition;
			obj.transform.localScale = scale;
			Collider component = obj.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			Renderer component2 = obj.GetComponent<Renderer>();
			if ((Object)(object)component2 != (Object)null && (Object)(object)material != (Object)null)
			{
				component2.sharedMaterial = material;
			}
			return obj;
		}

		private void CreateEyeLight()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0041: 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)
			if (!((Object)(object)_head == (Object)null))
			{
				GameObject val = new GameObject("Entity Eyes");
				val.transform.SetParent(_head, false);
				val.transform.localPosition = new Vector3(0f, 0f, 0.18f);
				_eyeLight = val.AddComponent<Light>();
				_eyeLight.type = (LightType)2;
				_eyeLight.color = new Color(1f, 0.2f, 0.15f);
				_eyeLight.intensity = 1.4f;
				_eyeLight.range = 3.5f;
			}
		}

		private Transform CreateHeadAnchor(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)
			GameObject val = new GameObject("Lisa Head Anchor");
			val.transform.SetParent(parent, false);
			val.transform.localPosition = new Vector3(0f, 1.7f, 0.08f);
			return val.transform;
		}

		private void PlayAnimation(string stateName)
		{
			if ((Object)(object)_animator == (Object)null || string.IsNullOrWhiteSpace(stateName) || _lastAnimation == stateName)
			{
				return;
			}
			_lastAnimation = stateName;
			try
			{
				_animator.Play(stateName, 0, 0f);
			}
			catch
			{
			}
		}
	}
	internal sealed class PTEventObject
	{
		public string Id;

		public int Step;

		public string Prompt;

		public Vector3 Position;

		public float Radius;

		public GameObject Instance;
	}
	internal sealed class PTHud : MonoBehaviour
	{
		private bool _visible;

		private string _banner = string.Empty;

		private Color _bannerColor = Color.white;

		private float _bannerUntil;

		private float _bannerDuration;

		private string _subtitle = string.Empty;

		private float _subtitleUntil;

		private Color _flashColor = Color.clear;

		private float _flashUntil;

		private float _flashDuration;

		private Texture2D _solid;

		private GUIStyle _bannerStyle;

		private GUIStyle _subtitleStyle;

		private bool _stylesReady;

		public static PTHud Create()
		{
			//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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			GameObject val = new GameObject("Empress PT HUD");
			val.transform.parent = null;
			((Object)val).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)val);
			return val.AddComponent<PTHud>();
		}

		public void SetVisible(bool visible)
		{
			_visible = visible;
		}

		public void SetBanner(string text, Color color)
		{
			//IL_0011: 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)
			_banner = text ?? string.Empty;
			_bannerColor = color;
			_bannerUntil = 0f;
			_bannerDuration = 0f;
		}

		public void FlashBanner(string text, Color color, float duration)
		{
			//IL_0011: 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)
			_banner = text ?? string.Empty;
			_bannerColor = color;
			_bannerDuration = Mathf.Max(0.1f, duration);
			_bannerUntil = Time.unscaledTime + _bannerDuration;
		}

		public void FlashSubtitle(string text, float duration)
		{
			_subtitle = text ?? string.Empty;
			_subtitleUntil = Time.unscaledTime + duration;
		}

		public void FlashScreen(Color color, float duration)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			_flashColor = color;
			_flashDuration = duration;
			_flashUntil = Time.unscaledTime + duration;
		}

		private void OnGUI()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_00b5: 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_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			if (!_visible)
			{
				return;
			}
			EnsureStyles();
			float num = Screen.width;
			float num2 = Screen.height;
			if (Time.unscaledTime < _flashUntil)
			{
				float num3 = (_flashUntil - Time.unscaledTime) / Mathf.Max(0.01f, _flashDuration);
				Color flashColor = _flashColor;
				flashColor.a *= num3;
				Color color = GUI.color;
				GUI.color = flashColor;
				GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)SolidTexture());
				GUI.color = color;
			}
			if (!string.IsNullOrEmpty(_subtitle) && Time.unscaledTime < _subtitleUntil)
			{
				DrawShadowed(new Rect(0f, num2 * 0.78f, num, num2 * 0.1f), _subtitle, _subtitleStyle, new Color(0.85f, 0.82f, 0.8f));
			}
			if (string.IsNullOrEmpty(_banner))
			{
				return;
			}
			float num4 = 1f;
			if (_bannerUntil > 0f)
			{
				float num5 = _bannerUntil - Time.unscaledTime;
				if (num5 <= 0f)
				{
					_banner = string.Empty;
					return;
				}
				num4 = Mathf.Clamp01(num5 / Mathf.Min(1f, _bannerDuration));
			}
			Rect rect = new Rect(0f, num2 * 0.4f, num, num2 * 0.16f);
			Color bannerColor = _bannerColor;
			bannerColor.a *= num4;
			DrawShadowed(rect, _banner, _bannerStyle, bannerColor);
		}

		private static void DrawShadowed(Rect rect, string text, GUIStyle style, Color color)
		{
			//IL_0000: 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_004b: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			Color color2 = GUI.color;
			GUI.color = new Color(0f, 0f, 0f, 0.9f);
			GUI.Label(new Rect(((Rect)(ref rect)).x + 2f, ((Rect)(ref rect)).y + 2f, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, style);
			GUI.color = color;
			GUI.Label(rect, text, style);
			GUI.color = color2;
		}

		private Texture2D SolidTexture()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_solid == (Object)null)
			{
				_solid = new Texture2D(1, 1, (TextureFormat)4, false);
				_solid.SetPixel(0, 0, Color.white);
				_solid.Apply();
			}
			return _solid;
		}

		private void EnsureStyles()
		{
			//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_0021: 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_0034: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_005f: Expected O, but got Unknown
			if (!_stylesReady)
			{
				_bannerStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 52,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
				_subtitleStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 30,
					fontStyle = (FontStyle)2,
					alignment = (TextAnchor)4
				};
				_stylesReady = true;
			}
		}
	}
	internal static class PTLevelRegistry
	{
		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 RegisterPTLevel()
		{
			//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 PT";
			val.NarrativeName = "Empress - P.T.";
			LevelValuables val2 = ScriptableObject.CreateInstance<LevelValuables>();
			((Object)val2).name = "Valuables - Empress PT";
			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.04f, 0.035f, 0.03f));
			SetLevelField(val, "FogStartDistance", 6f);
			SetLevelField(val, "FogEndDistance", 42f);
			SetLevelField(val, "AmbientColor", (object)new Color(0.14f, 0.12f, 0.1f));
			SetLevelField(val, "AmbientColorAdaptation", (object)new Color(0.03f, 0.025f, 0.02f));
			SetLevelField(val, "ColorTemperature", 6f);
			SetLevelField(val, "ColorFilter", (object)new Color(0.95f, 0.85f, 0.7f, 1f));
			SetLevelField(val, "BloomIntensity", 1.6f);
			SetLevelField(val, "BloomThreshold", 1.05f);
			SetLevelField(val, "VignetteColor", (object)new Color(0f, 0f, 0f, 1f));
			SetLevelField(val, "VignetteIntensity", 0.5f);
			SetLevelField(val, "VignetteSmoothness", 0.9f);
			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 PT 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 ptLevel)
		{
			if ((Object)(object)ptLevel == (Object)null || (Object)(object)RunManager.instance == (Object)null)
			{
				return;
			}
			List<LevelValuables> valuablePresets = PTAccess.GetValuablePresets(ptLevel);
			if (valuablePresets != null && PoolHasContent(valuablePresets))
			{
				return;
			}
			List<Level> levels = PTAccess.GetLevels(RunManager.instance);
			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)ptLevel))
				{
					List<LevelValuables> valuablePresets2 = PTAccess.GetValuablePresets(val);
					if (valuablePresets2 != null && PoolHasContent(valuablePresets2))
					{
						PTAccess.SetValuablePresets(ptLevel, new List<LevelValuables>(valuablePresets2));
						break;
					}
				}
			}
		}

		private static bool PoolHasContent(List<LevelValuables> presets)
		{
			for (int i = 0; i < presets.Count; i++)
			{
				LevelValuables val = presets[i];
				if (!((Object)(object)val == (Object)null) && ((val.tiny != null && val.tiny.Count > 0) || (val.small != null && val.small.Count > 0) || (val.medium != null && val.medium.Count > 0) || (val.big != null && val.big.Count > 0) || (val.wide != null && val.wide.Count > 0) || (val.tall != null && val.tall.Count > 0) || (val.veryTall != null && val.veryTall.Count > 0)))
				{
					return true;
				}
			}
			return false;
		}

		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 static class PTLisaAssets
	{
		private const string BundleFileName = "empresspt_lisa.bundle";

		private static bool _loaded;

		private static AssetBundle _bundle;

		private static GameObject _prefab;

		private static Texture2D _bodyTexture;

		private static Texture2D _normalTexture;

		private static Texture2D _specTexture;

		private static AudioClip[] _cries = Array.Empty<AudioClip>();

		private static AudioClip[] _steps = Array.Empty<AudioClip>();

		private static AudioClip _kill;

		public static bool Available => (Object)(object)_prefab != (Object)null;

		public static AudioClip RandomCry => Pick(_cries);

		public static AudioClip RandomStep => Pick(_steps);

		public static AudioClip KillClip => _kill;

		public static void Initialize(string pluginDirectory)
		{
			if (_loaded)
			{
				return;
			}
			_loaded = true;
			if (string.IsNullOrWhiteSpace(pluginDirectory))
			{
				return;
			}
			string text = Path.Combine(pluginDirectory, "empresspt_lisa.bundle");
			if (!File.Exists(text))
			{
				return;
			}
			_bundle = AssetBundle.LoadFromFile(text);
			if ((Object)(object)_bundle == (Object)null)
			{
				ManualLogSource log = EmpressPTPlugin.Log;
				if (log != null)
				{
					log.LogWarning((object)"Empress PT could not load the Lisa bundle.");
				}
				return;
			}
			_prefab = LoadAsset<GameObject>("EmpressPTLisa");
			_bodyTexture = LoadAsset<Texture2D>("woman_2");
			_normalTexture = LoadAsset<Texture2D>("woman_2_normal");
			_specTexture = LoadAsset<Texture2D>("woman_2_spec");
			_kill = LoadAsset<AudioClip>("lisa_kill");
			_cries = LoadClips("womanCry1", "womanCry2", "womanCry3", "womanCry4", "womanCry5", "womanCry6");
			_steps = LoadClips("lisa_footStep", "lisa_footStep2", "lisa_footStep3", "lisa_shoeStep", "lisa_shoeStep2", "lisa_shoeStep3");
			if ((Object)(object)_prefab != (Object)null)
			{
				ManualLogSource log2 = EmpressPTPlugin.Log;
				if (log2 != null)
				{
					log2.LogInfo((object)"Empress PT loaded the PuniTy Lisa entity bundle.");
				}
			}
		}

		public static GameObject InstantiateLisa(Transform parent)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_prefab == (Object)null)
			{
				return null;
			}
			GameObject val = Object.Instantiate<GameObject>(_prefab, parent, false);
			((Object)val).name = "Empress PT Lisa";
			val.transform.localPosition = Vector3.zero;
			val.transform.localRotation = Quaternion.identity;
			val.transform.localScale = Vector3.one;
			Collider[] componentsInChildren = val.GetComponentsInChildren<Collider>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Object.Destroy((Object)(object)componentsInChildren[i]);
			}
			Renderer[] componentsInChildren2 = val.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer obj in componentsInChildren2)
			{
				obj.enabled = true;
				ApplyMaterials(obj);
				SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)(object)((obj is SkinnedMeshRenderer) ? obj : null);
				if (val2 != null)
				{
					val2.updateWhenOffscreen = true;
				}
			}
			Animator[] componentsInChildren3 = val.GetComponentsInChildren<Animator>(true);
			foreach (Animator obj2 in componentsInChildren3)
			{
				((Behaviour)obj2).enabled = true;
				obj2.applyRootMotion = false;
				obj2.cullingMode = (AnimatorCullingMode)0;
			}
			return val;
		}

		private static void ApplyMaterials(Renderer renderer)
		{
			//IL_004e: 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_0060: Expected O, but got Unknown
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			Shader val = Shader.Find("Standard") ?? Shader.Find("Diffuse");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Material[] array = renderer.sharedMaterials;
			if (array == null || array.Length == 0)
			{
				array = (Material[])(object)new Material[1];
			}
			Material[] array2 = (Material[])(object)new Material[array.Length];
			for (int i = 0; i < array.Length; i++)
			{
				Material material = array[i];
				Material val2 = new Material(val)
				{
					name = "Empress PT Lisa Material"
				};
				Texture val3 = (Texture)(((object)GetTexture(material, "_MainTex")) ?? ((object)_bodyTexture));
				if ((Object)(object)val3 != (Object)null)
				{
					val2.SetTexture("_MainTex", val3);
				}
				if (val2.HasProperty("_Color"))
				{
					val2.SetColor("_Color", GetColor(material, "_Color", new Color(0.82f, 0.72f, 0.68f, 1f)));
				}
				if (val2.HasProperty("_Glossiness"))
				{
					val2.SetFloat("_Glossiness", GetFloat(material, "_Glossiness", 0.12f));
				}
				if (val2.HasProperty("_BumpMap") && (Object)(object)_normalTexture != (Object)null)
				{
					val2.EnableKeyword("_NORMALMAP");
					val2.SetTexture("_BumpMap", (Texture)(object)_normalTexture);
					if (val2.HasProperty("_BumpScale"))
					{
						val2.SetFloat("_BumpScale", 0.3f);
					}
				}
				if (val2.HasProperty("_SpecGlossMap") && (Object)(object)_specTexture != (Object)null)
				{
					val2.EnableKeyword("_SPECGLOSSMAP");
					val2.SetTexture("_SpecGlossMap", (Texture)(object)_specTexture);
				}
				array2[i] = val2;
			}
			renderer.sharedMaterials = array2;
		}

		private static Texture GetTexture(Material material, string property)
		{
			if ((Object)(object)material == (Object)null || !material.HasProperty(property))
			{
				return null;
			}
			return material.GetTexture(property);
		}

		private static Color GetColor(Material material, string property, Color fallback)
		{
			//IL_0012: 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_001b: 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_001d: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)material == (Object)null || !material.HasProperty(property))
			{
				return fallback;
			}
			Color color = material.GetColor(property);
			if (!(color == Color.magenta))
			{
				return color;
			}
			return fallback;
		}

		private static float GetFloat(Material material, string property, float fallback)
		{
			if ((Object)(object)material == (Object)null || !material.HasProperty(property))
			{
				return fallback;
			}
			return material.GetFloat(property);
		}

		public static Transform FindBone(Transform root, params string[] names)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			if ((Object)(object)root == (Object)null || names == null)
			{
				return null;
			}
			foreach (string text in names)
			{
				if (!string.IsNullOrWhiteSpace(text) && string.Equals(((Object)root).name, text, StringComparison.OrdinalIgnoreCase))
				{
					return root;
				}
			}
			foreach (Transform item in root)
			{
				Transform val = FindBone(item, names);
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
			}
			return null;
		}

		private static T LoadAsset<T>(string name) where T : Object
		{
			if ((Object)(object)_bundle == (Object)null)
			{
				return default(T);
			}
			T val = _bundle.LoadAsset<T>(name);
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
			string[] allAssetNames = _bundle.GetAllAssetNames();
			foreach (string text in allAssetNames)
			{
				if (string.Equals(Path.GetFileNameWithoutExtension(text), name, StringComparison.OrdinalIgnoreCase))
				{
					return _bundle.LoadAsset<T>(text);
				}
			}
			return default(T);
		}

		private static AudioClip[] LoadClips(params string[] names)
		{
			List<AudioClip> list = new List<AudioClip>();
			for (int i = 0; i < names.Length; i++)
			{
				AudioClip val = LoadAsset<AudioClip>(names[i]);
				if ((Object)(object)val != (Object)null)
				{
					list.Add(val);
				}
			}
			return list.ToArray();
		}

		private static AudioClip Pick(AudioClip[] clips)
		{
			if (clips == null || clips.Length == 0)
			{
				return null;
			}
			return clips[Random.Range(0, clips.Length)];
		}
	}
	internal sealed class PTValuableSpot
	{
		public Vector3 Position;

		public Vector3 Forward;

		public Type Type;
	}
	internal sealed class PTMap
	{
		public readonly List<Vector3> SpawnPositions = new List<Vector3>();

		public readonly List<PTValuableSpot> ValuableSpots = new List<PTValuableSpot>();

		public readonly List<PTEventObject> EventObjects = new List<PTEventObject>();

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

		public readonly List<Renderer> LightFixtures = new List<Renderer>();

		public Vector3 PlayerStart = new Vector3(0f, 1f, 1f);

		public Vector3 ExitDoorPosition;

		public Vector3 ExitTriggerPoint;

		public Vector3 EntityHideSpot;

		public GameObject ExitDoorObject;

		public GameObject ExitLightObject;

		public Bounds CorridorBounds;

		public int EventId;
	}
	internal static class PTMapBuilder
	{
		private const float HW = 1.75f;

		private const float WallHeight = 3.2f;

		private const float Thickness = 0.3f;

		private const float LegZ = 26f;

		private const float LegX = 16f;

		private const float FHW = 3f;

		private const float FoyerSouth = -6f;

		private const float BathWest = -7.75f;

		private const float BathSouth = 9f;

		private const float BathNorth = 15f;

		private const float BathDoorLow = 11f;

		private const float BathDoorHigh = 13f;

		public static PTMap Build(Transform parent, int eventId)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			PTMaterials.EnsureCreated();
			PTMap pTMap = new PTMap();
			pTMap.EventId = Mathf.Abs(eventId) % 10;
			BuildFloorsAndCeilings(parent);
			BuildWalls(parent);
			BuildBathroomFixtures(parent, pTMap);
			BuildExitDoor(parent, pTMap);
			BuildProps(parent, pTMap);
			BuildHallwayEvent(parent, pTMap);
			BuildValuableSpots(pTMap);
			BuildWaypoints(pTMap);
			BuildSpawnPositions(pTMap);
			BuildLights(parent, pTMap);
			pTMap.PlayerStart = new Vector3(0f, 1f, 1f);
			pTMap.ExitDoorPosition = new Vector3(16f, 0f, 26f);
			pTMap.ExitTriggerPoint = new Vector3(18f, 0f, 26f);
			pTMap.EntityHideSpot = new Vector3(-5.25f, 0f, 12f);
			pTMap.CorridorBounds = new Bounds(new Vector3(6.4f, 1.6f, 13f), new Vector3(40f, 7.2f, 50f));
			return pTMap;
		}

		private static void BuildFloorsAndCeilings(Transform parent)
		{
			FloorCeil(parent, "Long Leg", -2.25f, 2.25f, -0.5f, 28.25f);
			FloorCeil(parent, "Short Leg", -2.25f, 18.25f, 23.75f, 28.25f);
			FloorCeil(parent, "Foyer", -3.5f, 3.5f, -6.5f, 0.5f);
			FloorCeil(parent, "Bathroom", -8.25f, -1.25f, 8.5f, 15.5f, tile: true);
		}

		private static void BuildWalls(Transform parent)
		{
			Wall(parent, "Foyer South", -3f, -6f, 3f, -6f);
			Wall(parent, "Foyer West", -3f, -6f, -3f, 0f);
			Wall(parent, "Foyer East", 3f, -6f, 3f, 0f);
			Wall(parent, "Foyer West Shoulder", -3f, 0f, -1.75f, 0f);
			Wall(parent, "Foyer East Shoulder", 3f, 0f, 1.75f, 0f);
			Wall(parent, "Long Leg East", 1.75f, 0f, 1.75f, 24.25f);
			Wall(parent, "Long Leg West A", -1.75f, 0f, -1.75f, 11f);
			Wall(parent, "Long Leg West B", -1.75f, 13f, -1.75f, 27.75f);
			DoorHeader(parent, "Bath Door Header", -1.75f, 11f, -1.75f, 13f);
			Wall(parent, "Short Leg Inner", 1.75f, 24.25f, 17.75f, 24.25f);
			Wall(parent, "Short Leg End South", 17.75f, 24.25f, 17.75f, 25.3f);
			Wall(parent, "Short Leg End North", 17.75f, 26.7f, 17.75f, 27.75f);
			DoorHeader(parent, "Short Leg End Header", 17.75f, 25.3f, 17.75f, 26.7f);
			Wall(parent, "Short Leg North", 17.75f, 27.75f, -1.75f, 27.75f);
			Wall(parent, "Bath West", -7.75f, 9f, -7.75f, 15f);
			Wall(parent, "Bath South", -7.75f, 9f, -1.75f, 9f);
			Wall(parent, "Bath North", -7.75f, 15f, -1.75f, 15f);
		}

		private static void BuildBathroomFixtures(Transform parent, PTMap map)
		{
			//IL_001c: 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_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_0031: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(-7.15f, 0f, 12f);
			CreateBox(parent, "Sink Cabinet", val + Vector3.up * 0.4f, Quaternion.identity, new Vector3(0.7f, 0.8f, 1.1f), PTMaterials.WainscotMaterial, solid: true);
			CreateBox(parent, "Sink Basin", val + Vector3.up * 0.85f, Quaternion.identity, new Vector3(0.6f, 0.18f, 1f), PTMaterials.PorcelainMaterial, solid: true);
			CreateBox(parent, "Sink Mirror", val + new Vector3(-0.32f, 1.7f, 0f), Quaternion.identity, new Vector3(0.05f, 0.9f, 0.9f), PTMaterials.MetalMaterial, solid: false);
		}

		private static void BuildExitDoor(Transform parent, PTMap map)
		{
			//IL_0015: 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_0053: 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)
			BuildExitFrame(parent);
			Material material = PTMaterials.CreateEmissive(new Color(1f, 0.02f, 0.01f), 5f);
			GameObject exitLightObject = CreateBox(parent, "Exit Red Light", new Vector3(17.51f, 2.55f, 26f), Quaternion.identity, new Vector3(0.12f, 0.18f, 0.62f), material, solid: false);
			AddLight(parent, new Vector3(17.25f, 2.5f, 26f), new Color(1f, 0.02f, 0.01f), 3f, 7f, "Exit Red Point");
			GameObject exitDoorObject = CreateHingedDoor(parent);
			BuildTransitionPocket(parent);
			map.ExitDoorObject = exitDoorObject;
			map.ExitLightObject = exitLightObject;
		}

		private static void BuildExitFrame(Transform parent)
		{
			//IL_0017: 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_0030: 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_006b: 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_0092: 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)
			float num = 17.68f;
			CreateBox(parent, "Exit Frame South Jamb", new Vector3(num, 1.12f, 25.22f), Quaternion.identity, new Vector3(0.1f, 2.25f, 0.12f), PTMaterials.DoorFrameMaterial, solid: false);
			CreateBox(parent, "Exit Frame North Jamb", new Vector3(num, 1.12f, 26.78f), Quaternion.identity, new Vector3(0.1f, 2.25f, 0.12f), PTMaterials.DoorFrameMaterial, solid: false);
			CreateBox(parent, "Exit Frame Header", new Vector3(num, 2.28f, 26f), Quaternion.identity, new Vector3(0.1f, 0.16f, 1.62f), PTMaterials.DoorFrameMaterial, solid: false);
		}

		private static void BuildTransitionPocket(Transform parent)
		{
			//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_0036: 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_005d: 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_0093: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			float num = 18f;
			CreateBox(parent, "Transition Backdrop", new Vector3(num + 0.35f, 1.6f, 26f), Quaternion.identity, new Vector3(0.08f, 3.2f, 1.55f), PTMaterials.BlackMaterial, solid: true);
			CreateBox(parent, "Transition South", new Vector3(num, 1.6f, 25.22f), Quaternion.identity, new Vector3(0.9f, 3.2f, 0.08f), PTMaterials.BlackMaterial, solid: true);
			CreateBox(parent, "Transition North", new Vector3(num, 1.6f, 26.78f), Quaternion.identity, new Vector3(0.9f, 3.2f, 0.08f), PTMaterials.BlackMaterial, solid: true);
			CreateBox(parent, "Transition Floor", new Vector3(num, -0.15f, 26f), Quaternion.identity, new Vector3(0.9f, 0.3f, 1.55f), PTMaterials.BlackMaterial, solid: true);
			CreateBox(parent, "Transition Ceiling", new Vector3(num, 3.22f, 26f), Quaternion.identity, new Vector3(0.9f, 0.08f, 1.55f), PTMateria