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 ForcePTLevel; public readonly ConfigEntry EnableEntity; public readonly ConfigEntry EntityChaseSpeed; public readonly ConfigEntry SpawnValuables; public readonly ConfigEntry 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("Debug", "ForcePTLevel", false, "Forces every real run level to load Empress - P.T. Useful for testing."); EnableEntity = config.Bind("Level", "EnableEntity", true, "Enables the stalking entity that hunts the riders."); EntityChaseSpeed = config.Bind("Entity", "ChaseSpeed", 2.2f, new ConfigDescription("Move speed of the entity while hunting.", (AcceptableValueBase)(object)new AcceptableValueRange(0.8f, 4f), Array.Empty())); SpawnValuables = config.Bind("Level", "SpawnValuables", true, "Places valuables to grab around the house."); MasterVolume = config.Bind("Audio", "MasterVolume", 0.8f, new ConfigDescription("Volume of the Empress PT ambience and scares.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); } } 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 ImpactDestroyDisableRef = AccessTools.FieldRefAccess("destroyDisable"); private static readonly FieldRef ImpactDestroyDisableTeleportRef = AccessTools.FieldRefAccess("destroyDisableTeleport"); private static readonly FieldRef ImpactDisableRef = AccessTools.FieldRefAccess("impactDisable"); private static readonly FieldRef ImpactIsIndestructibleRef = AccessTools.FieldRefAccess("isIndestructible"); private static readonly FieldRef ImpactPlayerHurtDisableRef = AccessTools.FieldRefAccess("playerHurtDisable"); private static readonly FieldRef ImpactSlidingDisableRef = AccessTools.FieldRefAccess("slidingDisable"); private static readonly FieldRef ImpactOnAllImpactsRef = AccessTools.FieldRefAccess("onAllImpacts"); private static readonly FieldRef ImpactOnImpactLightRef = AccessTools.FieldRefAccess("onImpactLight"); private static readonly FieldRef ImpactOnImpactMediumRef = AccessTools.FieldRefAccess("onImpactMedium"); private static readonly FieldRef ImpactOnImpactHeavyRef = AccessTools.FieldRefAccess("onImpactHeavy"); private static readonly FieldRef ImpactOnAllBreaksRef = AccessTools.FieldRefAccess("onAllBreaks"); private static readonly FieldRef ImpactOnBreakLightRef = AccessTools.FieldRefAccess("onBreakLight"); private static readonly FieldRef ImpactOnBreakMediumRef = AccessTools.FieldRefAccess("onBreakMedium"); private static readonly FieldRef ImpactOnBreakHeavyRef = AccessTools.FieldRefAccess("onBreakHeavy"); private static readonly FieldRef ImpactOnDestroyRef = AccessTools.FieldRefAccess("onDestroy"); private static readonly FieldRef ImpactOnHurtColliderHitRef = AccessTools.FieldRefAccess("onHurtColliderHit"); private static readonly FieldRef PhysGrabOverrideTagsAndLayersRef = AccessTools.FieldRefAccess("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(ModuleSetAllChecklistMethod); private static readonly LevelGeneratorGenerateDoneDelegate LevelGeneratorGenerateDoneCall = CreateDelegate(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(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 GetLevels(RunManager manager) { return Get>(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(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(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>(RoundDirectorExtractionPointListField, director)?.Clear(); } public static List GetValuablePresets(Level level) { return Get>(LevelValuablePresetsField, level); } public static void SetValuablePresets(Level level, List presets) { SetField(LevelValuablePresetsField, level, presets); } public static List 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>(LevelValuablesTinyField, valuables), 1 => Get>(LevelValuablesSmallField, valuables), 2 => Get>(LevelValuablesMediumField, valuables), 3 => Get>(LevelValuablesBigField, valuables), 4 => Get>(LevelValuablesWideField, valuables), 5 => Get>(LevelValuablesTallField, valuables), _ => Get>(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(PlayerAvatarRbField, avatar); } public static Rigidbody GetPlayerControllerRigidbody(PlayerController controller) { return Get(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(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(MethodInfo method) where TDelegate : Delegate { if (method == null) { return null; } return AccessTools.MethodDelegate(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(); 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(); _physGrabObject = ((Component)this).GetComponent(); _joint = ((Component)this).GetComponent(); _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 _materials = new List(); 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(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 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 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 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() == (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(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Renderer component2 = obj.GetComponent(); 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(); _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(); } 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 LevelContentLevelRef = AccessTools.FieldRefAccess("_level"); private static readonly FieldRef> LevelContentStartRoomsRef = AccessTools.FieldRefAccess>("_startRooms"); private static readonly FieldRef> LevelContentModulesNormal1Ref = AccessTools.FieldRefAccess>("_modulesNormal1"); private static readonly FieldRef> LevelContentModulesNormal2Ref = AccessTools.FieldRefAccess>("_modulesNormal2"); private static readonly FieldRef> LevelContentModulesNormal3Ref = AccessTools.FieldRefAccess>("_modulesNormal3"); private static readonly FieldRef> LevelContentModulesPassage1Ref = AccessTools.FieldRefAccess>("_modulesPassage1"); private static readonly FieldRef> LevelContentModulesPassage2Ref = AccessTools.FieldRefAccess>("_modulesPassage2"); private static readonly FieldRef> LevelContentModulesPassage3Ref = AccessTools.FieldRefAccess>("_modulesPassage3"); private static readonly FieldRef> LevelContentModulesDeadEnd1Ref = AccessTools.FieldRefAccess>("_modulesDeadEnd1"); private static readonly FieldRef> LevelContentModulesDeadEnd2Ref = AccessTools.FieldRefAccess>("_modulesDeadEnd2"); private static readonly FieldRef> LevelContentModulesDeadEnd3Ref = AccessTools.FieldRefAccess>("_modulesDeadEnd3"); private static readonly FieldRef> LevelContentModulesExtraction1Ref = AccessTools.FieldRefAccess>("_modulesExtraction1"); private static readonly FieldRef> LevelContentModulesExtraction2Ref = AccessTools.FieldRefAccess>("_modulesExtraction2"); private static readonly FieldRef> LevelContentModulesExtraction3Ref = AccessTools.FieldRefAccess>("_modulesExtraction3"); private static readonly FieldRef LevelContentConnectObjectRef = AccessTools.FieldRefAccess("_connectObject"); private static readonly FieldRef LevelContentBlockObjectRef = AccessTools.FieldRefAccess("_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(); ((Object)val).name = "Level - Empress PT"; val.NarrativeName = "Empress - P.T."; LevelValuables val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = "Valuables - Empress PT"; val2.tiny = new List(); val2.small = new List(); val2.medium = new List(); val2.big = new List(); val2.wide = new List(); val2.tall = new List(); val2.veryTall = new List(); SetLevelField(val, "ModuleAmount", 0); SetLevelField(val, "PassageMaxAmount", 0); SetLevelField(val, "HasEnemies", false); SetLevelField(val, "ValuablePresets", new List { val2 }); SetLevelField(val, "AmbiencePresets", new List()); 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(); ((Object)val3).name = "Empress PT Content"; LevelContentLevelRef.Invoke(val3) = val; LevelContentStartRoomsRef.Invoke(val3) = new List(); LevelContentModulesNormal1Ref.Invoke(val3) = new List(); LevelContentModulesNormal2Ref.Invoke(val3) = new List(); LevelContentModulesNormal3Ref.Invoke(val3) = new List(); LevelContentModulesPassage1Ref.Invoke(val3) = new List(); LevelContentModulesPassage2Ref.Invoke(val3) = new List(); LevelContentModulesPassage3Ref.Invoke(val3) = new List(); LevelContentModulesDeadEnd1Ref.Invoke(val3) = new List(); LevelContentModulesDeadEnd2Ref.Invoke(val3) = new List(); LevelContentModulesDeadEnd3Ref.Invoke(val3) = new List(); LevelContentModulesExtraction1Ref.Invoke(val3) = new List(); LevelContentModulesExtraction2Ref.Invoke(val3) = new List(); LevelContentModulesExtraction3Ref.Invoke(val3) = new List(); 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 valuablePresets = PTAccess.GetValuablePresets(ptLevel); if (valuablePresets != null && PoolHasContent(valuablePresets)) { return; } List 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 valuablePresets2 = PTAccess.GetValuablePresets(val); if (valuablePresets2 != null && PoolHasContent(valuablePresets2)) { PTAccess.SetValuablePresets(ptLevel, new List(valuablePresets2)); break; } } } } private static bool PoolHasContent(List 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(); private static AudioClip[] _steps = Array.Empty(); 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("EmpressPTLisa"); _bodyTexture = LoadAsset("woman_2"); _normalTexture = LoadAsset("woman_2_normal"); _specTexture = LoadAsset("woman_2_spec"); _kill = LoadAsset("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(_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(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i]); } Renderer[] componentsInChildren2 = val.GetComponentsInChildren(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(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(string name) where T : Object { if ((Object)(object)_bundle == (Object)null) { return default(T); } T val = _bundle.LoadAsset(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(text); } } return default(T); } private static AudioClip[] LoadClips(params string[] names) { List list = new List(); for (int i = 0; i < names.Length; i++) { AudioClip val = LoadAsset(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 SpawnPositions = new List(); public readonly List ValuableSpots = new List(); public readonly List EventObjects = new List(); public readonly List Waypoints = new List(); public readonly List LightFixtures = new List(); 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), PTMaterials.BlackMaterial, solid: false); } private static GameObject CreateHingedDoor(Transform parent) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Exit Door"); val.transform.SetParent(parent, false); val.transform.localPosition = new Vector3(17.55f, 1.05f, 25.45f); val.transform.localRotation = Quaternion.identity; SetLayer(val, "PhysGrabObject"); SetTag(val, "Phys Grab Object"); PhotonView obj = val.AddComponent(); obj.ObservedComponents = new List(); obj.Synchronization = (ViewSynchronization)3; Rigidbody obj2 = val.AddComponent(); obj2.mass = 6f; obj2.drag = 0.03f; obj2.angularDrag = 0.35f; obj2.useGravity = true; obj2.maxAngularVelocity = 8f; PhotonTransformView item = val.AddComponent(); obj.ObservedComponents.Add((Component)(object)item); HingeJoint obj3 = val.AddComponent(); ((Joint)obj3).axis = Vector3.up; ((Joint)obj3).anchor = Vector3.zero; obj3.useLimits = true; JointLimits limits = obj3.limits; ((JointLimits)(ref limits)).min = -135f; ((JointLimits)(ref limits)).max = 135f; ((JointLimits)(ref limits)).bounciness = 0.02f; obj3.limits = limits; ((Joint)obj3).breakForce = 25000f; ((Joint)obj3).breakTorque = 25000f; GameObject val2 = new GameObject("Center of Mass"); val2.transform.SetParent(val.transform, false); val2.transform.localPosition = new Vector3(0f, 0f, 0.55f); GameObject val3 = new GameObject("Force Grab Point"); val3.transform.SetParent(val.transform, false); val3.transform.localPosition = new Vector3(-0.08f, 0f, 1.02f); GameObject obj4 = CreateBox(val.transform, "Exit Door Panel", new Vector3(0f, 0f, 0.55f), Quaternion.identity, new Vector3(0.12f, 2.1f, 1.1f), PTMaterials.DoorMaterial, solid: true); SetLayer(obj4, "PhysGrabObject"); SetTag(obj4, "Phys Grab Object"); obj4.AddComponent(); SetLayer(CreateBox(val.transform, "Exit Door Handle", new Vector3(-0.09f, 0f, 0.92f), Quaternion.identity, new Vector3(0.08f, 0.16f, 0.08f), PTMaterials.MetalMaterial, solid: false), "PhysGrabObject"); PTAccess.ConfigureDoorImpact(val.AddComponent()); PhysGrabObject val4 = val.AddComponent(); PTAccess.ConfigureDoorPhysGrabObject(val4); obj.ObservedComponents.Add((Component)(object)val4); val.AddComponent().HandleLocal = val3.transform.localPosition; return val; } private static void BuildProps(Transform parent, PTMap map) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012b: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) float num = 1.5600001f; float num2 = -1.5600001f; float num3 = -5.81f; float num4 = 27.56f; CreateBox(parent, "Foyer Table Top", new Vector3(0f, 0.62f, -5.4f), Quaternion.identity, new Vector3(1.4f, 0.1f, 0.7f), PTMaterials.WainscotMaterial, solid: true); CreateBox(parent, "Foyer Table Leg", new Vector3(0f, 0.31f, -5.4f), Quaternion.identity, new Vector3(0.25f, 0.62f, 0.25f), PTMaterials.WainscotMaterial, solid: true); CreateBox(parent, "Shelf", new Vector3(14f, 1.4f, 27.5f), Quaternion.identity, new Vector3(1.6f, 0.08f, 0.4f), PTMaterials.WainscotMaterial, solid: true); BuildPicture(parent, "Middle Hall Picture", new Vector3(num, 1.8f, 13.5f), Quaternion.Euler(0f, -90f, 0f), 0); BuildPicture(parent, "Picture A", new Vector3(num, 1.9f, 8f), Quaternion.Euler(0f, -90f, 0f), 0); BuildPicture(parent, "Picture B", new Vector3(num2, 1.9f, 19f), Quaternion.Euler(0f, 90f, 6.5f), 1); BuildPicture(parent, "Picture C", new Vector3(0f, 1.9f, num3), Quaternion.Euler(0f, 0f, 0f), 2); BuildPicture(parent, "Picture D", new Vector3(8f, 1.9f, num4), Quaternion.Euler(0f, 180f, -4.5f), 3); CreateBox(parent, "Hall Runner", new Vector3(0f, 0.011f, 12.5f), Quaternion.identity, new Vector3(1.7f, 0.014f, 23f), PTMaterials.RugMaterial, solid: false); CreateBox(parent, "Corner Runner", new Vector3(9f, 0.011f, 26f), Quaternion.identity, new Vector3(13f, 0.014f, 1.5f), PTMaterials.RugMaterial, solid: false); CreateBox(parent, "Foyer Mat", new Vector3(0f, 0.011f, -2.6f), Quaternion.identity, new Vector3(2.4f, 0.014f, 3.2f), PTMaterials.RugMaterial, solid: false); CreateBox(parent, "Damp Stain East", new Vector3(num + 0.012f, 2.1f, 10.5f), Quaternion.identity, new Vector3(0.02f, 1.5f, 1.1f), PTMaterials.StainMaterial, solid: false); CreateBox(parent, "Damp Stain West", new Vector3(num2 - 0.012f, 1.6f, 22f), Quaternion.identity, new Vector3(0.02f, 2.2f, 0.9f), PTMaterials.StainMaterial, solid: false); CreateBox(parent, "Damp Stain Ceiling", new Vector3(0.4f, 3.188f, 16.5f), Quaternion.identity, new Vector3(1.4f, 0.02f, 2f), PTMaterials.StainMaterial, solid: false); } private static void BuildHallwayEvent(Transform parent, PTMap map) { //IL_0016: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0652: Unknown result type (might be due to invalid IL or missing references) //IL_0687: Unknown result type (might be due to invalid IL or missing references) //IL_06bc: Unknown result type (might be due to invalid IL or missing references) //IL_06eb: Unknown result type (might be due to invalid IL or missing references) //IL_06ff: Unknown result type (might be due to invalid IL or missing references) //IL_0730: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_0749: Unknown result type (might be due to invalid IL or missing references) //IL_0780: Unknown result type (might be due to invalid IL or missing references) //IL_0785: Unknown result type (might be due to invalid IL or missing references) //IL_0799: Unknown result type (might be due to invalid IL or missing references) //IL_07d0: Unknown result type (might be due to invalid IL or missing references) //IL_07d5: Unknown result type (might be due to invalid IL or missing references) //IL_07e9: Unknown result type (might be due to invalid IL or missing references) //IL_081f: Unknown result type (might be due to invalid IL or missing references) //IL_0824: Unknown result type (might be due to invalid IL or missing references) //IL_0838: Unknown result type (might be due to invalid IL or missing references) //IL_085a: Unknown result type (might be due to invalid IL or missing references) //IL_085f: Unknown result type (might be due to invalid IL or missing references) //IL_0873: Unknown result type (might be due to invalid IL or missing references) //IL_0890: Unknown result type (might be due to invalid IL or missing references) //IL_08a4: Unknown result type (might be due to invalid IL or missing references) //IL_08d5: Unknown result type (might be due to invalid IL or missing references) //IL_08da: Unknown result type (might be due to invalid IL or missing references) //IL_08ee: Unknown result type (might be due to invalid IL or missing references) //IL_0929: Unknown result type (might be due to invalid IL or missing references) //IL_092e: Unknown result type (might be due to invalid IL or missing references) //IL_0942: Unknown result type (might be due to invalid IL or missing references) //IL_097d: Unknown result type (might be due to invalid IL or missing references) //IL_0982: Unknown result type (might be due to invalid IL or missing references) //IL_0996: Unknown result type (might be due to invalid IL or missing references) //IL_09cb: Unknown result type (might be due to invalid IL or missing references) //IL_09df: Unknown result type (might be due to invalid IL or missing references) //IL_0a0a: Unknown result type (might be due to invalid IL or missing references) //IL_0a1e: Unknown result type (might be due to invalid IL or missing references) //IL_0a48: Unknown result type (might be due to invalid IL or missing references) //IL_0a5c: Unknown result type (might be due to invalid IL or missing references) //IL_0a8c: Unknown result type (might be due to invalid IL or missing references) //IL_0aa0: Unknown result type (might be due to invalid IL or missing references) //IL_0ad6: Unknown result type (might be due to invalid IL or missing references) //IL_0adb: Unknown result type (might be due to invalid IL or missing references) //IL_0aef: Unknown result type (might be due to invalid IL or missing references) //IL_0b26: Unknown result type (might be due to invalid IL or missing references) //IL_0b2b: Unknown result type (might be due to invalid IL or missing references) //IL_0b3f: Unknown result type (might be due to invalid IL or missing references) //IL_0b71: Unknown result type (might be due to invalid IL or missing references) //IL_0b85: Unknown result type (might be due to invalid IL or missing references) //IL_0bb5: Unknown result type (might be due to invalid IL or missing references) //IL_0bba: Unknown result type (might be due to invalid IL or missing references) //IL_0bce: Unknown result type (might be due to invalid IL or missing references) //IL_0c09: Unknown result type (might be due to invalid IL or missing references) //IL_0c1d: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) int eventId = map.EventId; PTMaterials.CreateEmissive(new Color(1f, 0f, 0f), 3f); Material val = PTMaterials.CreateEmissive(new Color(0.05f, 0.9f, 0.25f), 2.5f); Material material = PTMaterials.CreateTransparent(new Color(0.65f, 0f, 0f, 0.55f)); Material glow = PTMaterials.CreateEmissive(new Color(1f, 0.72f, 0.08f), 2.4f); switch (eventId) { case 0: AddLight(parent, new Vector3(0f, 2.4f, 12f), new Color(1f, 0f, 0f), 2.2f, 12f, "Event Red Hall"); CreateBox(parent, "Event Red Floor", new Vector3(0f, 0.015f, 12f), Quaternion.identity, new Vector3(2.2f, 0.02f, 16f), material, solid: false); Register(map, BuildPhone(parent, "Event Phone", new Vector3(0f, 0.74f, -5.4f), Quaternion.Euler(0f, 180f, 0f)), "phone", 0, "answer the phone", 1.5f); Register(map, BuildMirrorMark(parent, "Event Mirror Mark", new Vector3(-7.21f, 1.7f, 12f)), "mirror", 1, "touch the mirror", 1.45f); Register(map, map.ExitLightObject, "door", 2, "touch the red light", 1.8f); break; case 1: AddLight(parent, new Vector3(0f, 2.6f, 6f), new Color(0.05f, 0.05f, 0.08f), 0.6f, 6f, "Event Dead Light A"); AddLight(parent, new Vector3(8f, 2.6f, 26f), new Color(0.05f, 0.05f, 0.08f), 0.6f, 6f, "Event Dead Light B"); CreateBox(parent, "Event Dark Ceiling Strip", new Vector3(0f, 3.14f, 12f), Quaternion.identity, new Vector3(2.6f, 0.05f, 18f), PTMaterials.BlackMaterial, solid: false); Register(map, BuildFuseBox(parent, "Event Fuse A", new Vector3(1.5500001f, 1.4f, 5.5f), Quaternion.Euler(0f, -90f, 0f), glow), "fuse-a", 0, "restore the first fuse", 1.45f); Register(map, BuildFuseBox(parent, "Event Fuse B", new Vector3(-1.5500001f, 1.4f, 20f), Quaternion.Euler(0f, 90f, 0f), glow), "fuse-b", 1, "restore the second fuse", 1.45f); Register(map, BuildFuseBox(parent, "Event Fuse C", new Vector3(8.8f, 1.4f, 27.550001f), Quaternion.Euler(0f, 180f, 0f), glow), "fuse-c", 2, "restore the final fuse", 1.45f); break; case 2: AddLight(parent, new Vector3(-5.75f, 2f, 12f), new Color(0.1f, 0.35f, 1f), 2f, 8f, "Event Bath Glow"); Register(map, BuildMirrorMark(parent, "Event Bathroom Mirror", new Vector3(-7.21f, 1.7f, 12f)), "bath-mirror", 0, "look into the mirror", 1.45f); Register(map, BuildSinkMark(parent, "Event Sink Mark", new Vector3(-7.15f, 1.02f, 12f)), "sink", 1, "wash off the message", 1.3f); CreateBox(parent, "Event Bathroom Phone Shelf", new Vector3(-5f, 1.02f, 14.65f), Quaternion.identity, new Vector3(0.9f, 0.08f, 0.32f), PTMaterials.WainscotMaterial, solid: true); Register(map, BuildPhone(parent, "Event Bathroom Phone", new Vector3(-5f, 1.16f, 14.65f), Quaternion.Euler(0f, 180f, 0f)), "bath-phone", 2, "answer the bathroom phone", 1.35f); break; case 3: { for (int j = 0; j < 7; j++) { GameObject instance2 = BuildPicture(parent, "Event Picture " + j, new Vector3(1.5600001f, 1.55f + (float)(j % 2) * 0.45f, 4f + (float)j * 2.6f), Quaternion.Euler(0f, -90f, 0f), j); if (j == 1) { Register(map, instance2, "portrait-a", 0, "inspect the first portrait", 1.5f); } if (j == 3) { Register(map, instance2, "portrait-b", 1, "inspect the changed portrait", 1.5f); } if (j == 5) { Register(map, instance2, "portrait-c", 2, "inspect the watching portrait", 1.5f); } } break; } case 4: { for (int i = 0; i < 8; i++) { GameObject instance = CreateBox(parent, "Event Hanging Shape " + i, new Vector3((i % 2 == 0) ? (-0.8f) : 0.8f, 2.65f, 4f + (float)i * 2.5f), Quaternion.Euler(0f, (float)i * 19f, 0f), new Vector3(0.08f, 0.7f, 0.5f), PTMaterials.BlackMaterial, solid: false); if (i == 1) { Register(map, instance, "hanging-a", 0, "pull down the first shape", 1.65f); } if (i == 4) { Register(map, instance, "hanging-b", 1, "pull down the second shape", 1.65f); } if (i == 7) { Register(map, instance, "hanging-c", 2, "pull down the last shape", 1.65f); } } break; } case 5: Register(map, CreateEventMarker(parent, "Event Breath Veil A", new Vector3(0f, 1.6f, 8f)), "breath-a", 0, "stand in the cold breath", 1.7f); Register(map, CreateEventMarker(parent, "Event Breath Veil B", new Vector3(0f, 1.6f, 14f)), "breath-b", 1, "stand in the second breath", 1.7f); Register(map, CreateEventMarker(parent, "Event Breath Veil C", new Vector3(8.8f, 1.6f, 26f)), "breath-c", 2, "stand where it exhales", 1.7f); AddLight(parent, new Vector3(0f, 2.2f, 14f), new Color(0.7f, 0.85f, 1f), 1.4f, 8f, "Event Cold Light"); break; case 6: Register(map, CreateBox(parent, "Event Blood Stain A", new Vector3(0f, 0.02f, 10f), Quaternion.identity, new Vector3(0.65f, 0.03f, 0.65f), material, solid: false), "blood-a", 0, "touch the first stain", 1.35f); Register(map, CreateBox(parent, "Event Blood Stain B", new Vector3(0f, 0.02f, 18f), Quaternion.identity, new Vector3(0.65f, 0.03f, 0.65f), material, solid: false), "blood-b", 1, "touch the second stain", 1.35f); Register(map, CreateBox(parent, "Event Blood Stain C", new Vector3(8.8f, 0.02f, 26f), Quaternion.identity, new Vector3(0.9f, 0.03f, 0.5f), material, solid: false), "blood-c", 2, "touch the stain by the door", 1.35f); CreateBox(parent, "Event Door Trail A", new Vector3(8.8f, 0.018f, 26f), Quaternion.identity, new Vector3(5f, 0.02f, 0.18f), material, solid: false); CreateBox(parent, "Event Door Trail B", new Vector3(0f, 0.018f, 18f), Quaternion.identity, new Vector3(0.18f, 0.02f, 10f), material, solid: false); AddLight(parent, new Vector3(14f, 1.9f, 26f), new Color(1f, 0f, 0f), 1.5f, 8f, "Event Trail Light"); break; case 7: Register(map, CreateBox(parent, "Event Shadow A", new Vector3(1.58f, 1.65f, 8f), Quaternion.identity, new Vector3(0.04f, 2.1f, 2f), PTMaterials.BlackMaterial, solid: false), "shadow-a", 0, "touch the first shadow", 1.45f); Register(map, CreateBox(parent, "Event Shadow B", new Vector3(1.58f, 1.65f, 15f), Quaternion.identity, new Vector3(0.04f, 2.4f, 2.6f), PTMaterials.BlackMaterial, solid: false), "shadow-b", 1, "touch the second shadow", 1.45f); Register(map, CreateBox(parent, "Event Long Shadow", new Vector3(1.58f, 1.65f, 22f), Quaternion.identity, new Vector3(0.04f, 2.4f, 5f), PTMaterials.BlackMaterial, solid: false), "shadow-c", 2, "touch the moving shadow", 1.45f); AddLight(parent, new Vector3(-0.8f, 2.4f, 20f), new Color(0.08f, 0.08f, 0.12f), 1.4f, 10f, "Event Shadow Light"); break; case 8: AddLight(parent, new Vector3(0f, 2.6f, 8f), new Color(0f, 1f, 0.2f), 2f, 8f, "Event Green A"); AddLight(parent, new Vector3(8f, 2.6f, 26f), new Color(0f, 1f, 0.2f), 2f, 8f, "Event Green B"); Register(map, BuildRadio(parent, "Event Radio", new Vector3(14f, 1.55f, 27.5f), Quaternion.Euler(0f, 180f, 0f), val), "radio", 0, "tune the radio", 1.45f); Register(map, CreateBox(parent, "Event Green Signal A", new Vector3(0f, 2.3f, 9f), Quaternion.identity, new Vector3(1.4f, 0.09f, 0.09f), val, solid: false), "signal-a", 1, "touch the green signal", 1.5f); Register(map, CreateBox(parent, "Event Green Signal B", new Vector3(8f, 2.25f, 27.54f), Quaternion.identity, new Vector3(1.6f, 0.09f, 0.09f), val, solid: false), "signal-b", 2, "touch the second signal", 1.5f); break; default: AddLight(parent, new Vector3(0f, 2.4f, 18f), new Color(0.9f, 0.8f, 0.55f), 2f, 11f, "Event Warm Trap"); Register(map, CreateBox(parent, "Event False Door", new Vector3(-1.58f, 1.2f, 17f), Quaternion.identity, new Vector3(0.06f, 2.2f, 1.05f), PTMaterials.DoorMaterial, solid: false), "false-door", 0, "open the false door", 1.55f); Register(map, BuildClock(parent, "Event Clock", new Vector3(1.5500001f, 1.75f, 11.5f), Quaternion.Euler(0f, -90f, 0f), glow), "clock", 1, "stop the clock", 1.45f); Register(map, map.ExitLightObject, "final-door", 2, "touch the real door", 1.8f); break; } } private static GameObject BuildPicture(Transform parent, string name, Vector3 position, Quaternion rotation, int portraitIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = position; val.transform.localRotation = rotation; CreateBox(val.transform, name + " Frame", Vector3.zero, Quaternion.identity, new Vector3(0.86f, 1.16f, 0.08f), PTMaterials.TrimMaterial, solid: false); CreateBox(val.transform, name + " Backing", new Vector3(0f, 0f, 0.018f), Quaternion.identity, new Vector3(0.78f, 1.08f, 0.035f), PTMaterials.DoorFrameMaterial, solid: false); CreatePictureSurface(val.transform, name + " Art", new Vector3(0f, 0f, 0.055f), Quaternion.identity, new Vector2(0.74f, 1.04f), PTPortraits.PortraitMaterial(portraitIndex)); return val; } private static GameObject CreatePictureSurface(Transform parent, string name, Vector3 position, Quaternion rotation, Vector2 size, Material material) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0071: 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_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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = position; val.transform.localRotation = rotation; float num = size.x * 0.5f; float num2 = size.y * 0.5f; Mesh val2 = new Mesh(); ((Object)val2).name = name + " Mesh"; val2.vertices = (Vector3[])(object)new Vector3[8] { new Vector3(0f - num, 0f - num2, 0f), new Vector3(num, 0f - num2, 0f), new Vector3(num, num2, 0f), new Vector3(0f - num, num2, 0f), new Vector3(0f - num, 0f - num2, 0f), new Vector3(num, 0f - num2, 0f), new Vector3(num, num2, 0f), new Vector3(0f - num, num2, 0f) }; val2.uv = (Vector2[])(object)new Vector2[8] { new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f, 1f), new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f, 1f) }; val2.triangles = new int[12] { 0, 1, 2, 0, 2, 3, 6, 5, 4, 7, 6, 4 }; val2.RecalculateNormals(); val.AddComponent().sharedMesh = val2; ((Renderer)val.AddComponent()).sharedMaterial = material; return val; } private static void Register(PTMap map, GameObject instance, string id, int step, string prompt, float radius) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)instance == (Object)null)) { map.EventObjects.Add(new PTEventObject { Id = id, Step = step, Prompt = prompt, Position = instance.transform.localPosition, Radius = radius, Instance = instance }); } } private static GameObject CreateEventMarker(Transform parent, string name, Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = position; val.transform.localRotation = Quaternion.identity; return val; } private static GameObject BuildPhone(Transform parent, string name, Vector3 position, Quaternion rotation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_0154: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = position; val.transform.localRotation = rotation; CreateBox(val.transform, name + " Base", Vector3.zero, Quaternion.identity, new Vector3(0.48f, 0.12f, 0.35f), PTMaterials.BlackMaterial, solid: false); CreateBox(val.transform, name + " Face", new Vector3(0f, 0.09f, 0f), Quaternion.identity, new Vector3(0.36f, 0.08f, 0.25f), PTMaterials.MetalMaterial, solid: false); CreateBox(val.transform, name + " Receiver", new Vector3(0f, 0.2f, 0f), Quaternion.identity, new Vector3(0.62f, 0.1f, 0.12f), PTMaterials.BlackMaterial, solid: false); CreateCylinder(val.transform, name + " Dial", new Vector3(0f, 0.16f, 0.02f), Quaternion.Euler(90f, 0f, 0f), new Vector3(0.18f, 0.04f, 0.18f), PTMaterials.MetalMaterial, solid: false); return val; } private static GameObject BuildRadio(Transform parent, string name, Vector3 position, Quaternion rotation, Material glow) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = position; val.transform.localRotation = rotation; CreateBox(val.transform, name + " Body", Vector3.zero, Quaternion.identity, new Vector3(0.65f, 0.36f, 0.28f), PTMaterials.BlackMaterial, solid: false); CreateBox(val.transform, name + " Speaker", new Vector3(-0.15f, 0.02f, -0.15f), Quaternion.identity, new Vector3(0.25f, 0.23f, 0.04f), PTMaterials.MetalMaterial, solid: false); CreateBox(val.transform, name + " Screen", new Vector3(0.18f, 0.04f, -0.15f), Quaternion.identity, new Vector3(0.24f, 0.13f, 0.04f), glow, solid: false); CreateCylinder(val.transform, name + " Knob", new Vector3(0.3f, -0.1f, -0.17f), Quaternion.Euler(90f, 0f, 0f), new Vector3(0.08f, 0.05f, 0.08f), PTMaterials.MetalMaterial, solid: false); return val; } private static GameObject BuildFuseBox(Transform parent, string name, Vector3 position, Quaternion rotation, Material glow) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = position; val.transform.localRotation = rotation; CreateBox(val.transform, name + " Case", Vector3.zero, Quaternion.identity, new Vector3(0.42f, 0.58f, 0.08f), PTMaterials.MetalMaterial, solid: false); CreateBox(val.transform, name + " Lever", new Vector3(0f, 0f, 0.055f), Quaternion.Euler(0f, 0f, 25f), new Vector3(0.06f, 0.34f, 0.06f), glow, solid: false); return val; } private static GameObject BuildClock(Transform parent, string name, Vector3 position, Quaternion rotation, Material glow) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = position; val.transform.localRotation = rotation; CreateCylinder(val.transform, name + " Face", Vector3.zero, Quaternion.Euler(90f, 0f, 0f), new Vector3(0.46f, 0.05f, 0.46f), PTMaterials.PorcelainMaterial, solid: false); CreateBox(val.transform, name + " Hand A", new Vector3(0f, 0f, -0.04f), Quaternion.Euler(0f, 0f, 35f), new Vector3(0.04f, 0.32f, 0.025f), PTMaterials.BlackMaterial, solid: false); CreateBox(val.transform, name + " Hand B", new Vector3(0f, 0f, -0.05f), Quaternion.Euler(0f, 0f, -80f), new Vector3(0.035f, 0.24f, 0.025f), glow, solid: false); return val; } private static GameObject BuildMirrorMark(Transform parent, string name, Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = position; val.transform.localRotation = Quaternion.identity; Material material = PTMaterials.CreateTransparent(new Color(0.8f, 0.9f, 1f, 0.45f)); CreateBox(val.transform, name + " Slash A", Vector3.zero, Quaternion.Euler(35f, 0f, 0f), new Vector3(0.035f, 0.82f, 0.035f), material, solid: false); CreateBox(val.transform, name + " Slash B", Vector3.zero, Quaternion.Euler(-42f, 0f, 0f), new Vector3(0.03f, 0.72f, 0.035f), material, solid: false); return val; } private static GameObject BuildSinkMark(Transform parent, string name, Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = position; val.transform.localRotation = Quaternion.identity; Material material = PTMaterials.CreateTransparent(new Color(0.8f, 0f, 0f, 0.55f)); CreateBox(val.transform, name + " Pool", Vector3.zero, Quaternion.identity, new Vector3(0.45f, 0.025f, 0.75f), material, solid: false); CreateBox(val.transform, name + " Line", new Vector3(0f, 0.02f, 0.08f), Quaternion.identity, new Vector3(0.08f, 0.025f, 0.45f), material, solid: false); return val; } private static void BuildValuableSpots(PTMap map) { //IL_001b: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_006e: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00da: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) map.ValuableSpots.Add(new PTValuableSpot { Position = new Vector3(0f, 0.72f, -5.4f), Forward = Vector3.forward, Type = (Type)1 }); map.ValuableSpots.Add(new PTValuableSpot { Position = new Vector3(0.45f, 0.72f, -5.4f), Forward = Vector3.forward, Type = (Type)0 }); map.ValuableSpots.Add(new PTValuableSpot { Position = new Vector3(-7.15f, 1f, 12f), Forward = Vector3.right, Type = (Type)0 }); map.ValuableSpots.Add(new PTValuableSpot { Position = new Vector3(14f, 1.5f, 27.5f), Forward = Vector3.back, Type = (Type)1 }); map.ValuableSpots.Add(new PTValuableSpot { Position = new Vector3(17.35f, 1.45f, 25.15f), Forward = Vector3.left, Type = (Type)2 }); map.ValuableSpots.Add(new PTValuableSpot { Position = new Vector3(0f, 0.2f, 20f), Forward = Vector3.back, Type = (Type)0 }); map.ValuableSpots.Add(new PTValuableSpot { Position = new Vector3(9.6f, 0.2f, 26f), Forward = Vector3.back, Type = (Type)1 }); } private static void BuildWaypoints(PTMap map) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) map.Waypoints.Add(new Vector3(0f, 0f, 2f)); map.Waypoints.Add(new Vector3(0f, 0f, 8f)); map.Waypoints.Add(new Vector3(0f, 0f, 14f)); map.Waypoints.Add(new Vector3(0f, 0f, 20f)); map.Waypoints.Add(new Vector3(0f, 0f, 26f)); map.Waypoints.Add(new Vector3(8f, 0f, 26f)); map.Waypoints.Add(new Vector3(16f, 0f, 26f)); } private static void BuildSpawnPositions(PTMap map) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) map.SpawnPositions.Add(new Vector3(0f, 1f, 1f)); map.SpawnPositions.Add(new Vector3(0.8f, 1f, 2f)); map.SpawnPositions.Add(new Vector3(-0.8f, 1f, 2f)); map.SpawnPositions.Add(new Vector3(0f, 1f, 3f)); map.SpawnPositions.Add(new Vector3(0.8f, 1f, -2f)); map.SpawnPositions.Add(new Vector3(-0.8f, 1f, -2f)); } private static void BuildLights(Transform parent, PTMap map) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) AddCeilingLamp(parent, map, new Vector3(0f, 2.9f, 6f), new Color(1f, 0.85f, 0.6f), 1.3f, 9f, "Hall Light A"); AddCeilingLamp(parent, map, new Vector3(0f, 2.9f, 16f), new Color(1f, 0.8f, 0.55f), 1.1f, 9f, "Hall Light B"); AddCeilingLamp(parent, map, new Vector3(8f, 2.9f, 26f), new Color(1f, 0.83f, 0.6f), 1.2f, 9f, "Hall Light C"); AddCeilingLamp(parent, map, new Vector3(0f, 2.9f, -2.5f), new Color(1f, 0.78f, 0.5f), 1.1f, 8f, "Foyer Light"); AddCeilingLamp(parent, map, new Vector3(-5.25f, 2.8f, 12f), new Color(0.7f, 0.85f, 1f), 0.9f, 7f, "Bath Light"); } private static void AddCeilingLamp(Transform parent, PTMap map, Vector3 position, Color color, float intensity, float range, string name) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) AddLight(parent, position, color, intensity, range, name); CreateBox(parent, name + " Shade", new Vector3(position.x, 3.13f, position.z), Quaternion.identity, new Vector3(0.56f, 0.1f, 0.56f), PTMaterials.TrimMaterial, solid: false); Renderer component = CreateBox(parent, name + " Fixture", new Vector3(position.x, 3.0700002f, position.z), Quaternion.identity, new Vector3(0.42f, 0.05f, 0.42f), PTMaterials.FixtureOnMaterial, solid: false).GetComponent(); if ((Object)(object)component != (Object)null) { map.LightFixtures.Add(component); } } private static void Wall(Transform parent, string name, float x1, float z1, float x2, float z2) { //IL_0014: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_003b: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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) //IL_00d5: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(x1, z1); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(x2, z2); float num = Vector2.Distance(val, val2) + 0.3f; Vector2 val3 = (val + val2) * 0.5f; Vector2 val4 = val2 - val; Vector2 val5; if (!(((Vector2)(ref val4)).sqrMagnitude > 0.0001f)) { val5 = Vector2.up; } else { val4 = val2 - val; val5 = ((Vector2)(ref val4)).normalized; } Vector2 val6 = val5; Quaternion rotation = Quaternion.LookRotation(new Vector3(val6.x, 0f, val6.y), Vector3.up); CreateBox(parent, name, new Vector3(val3.x, 1.6f, val3.y), rotation, new Vector3(0.3f, 3.2f, num), PTMaterials.WallpaperMaterial, solid: true); CreateBox(parent, name + " Wainscot", new Vector3(val3.x, 0.6f, val3.y), rotation, new Vector3(0.36f, 1.2f, num), PTMaterials.WainscotMaterial, solid: false); CreateBox(parent, name + " Baseboard", new Vector3(val3.x, 0.11f, val3.y), rotation, new Vector3(0.4f, 0.22f, num), PTMaterials.TrimMaterial, solid: false); CreateBox(parent, name + " Chair Rail", new Vector3(val3.x, 1.2f, val3.y), rotation, new Vector3(0.38f, 0.08f, num), PTMaterials.TrimMaterial, solid: false); } private static void DoorHeader(Transform parent, string name, float x1, float z1, float x2, float z2) { //IL_0014: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_003b: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(x1, z1); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(x2, z2); float num = Vector2.Distance(val, val2) + 0.3f; Vector2 val3 = (val + val2) * 0.5f; Vector2 val4 = val2 - val; Vector2 val5; if (!(((Vector2)(ref val4)).sqrMagnitude > 0.0001f)) { val5 = Vector2.up; } else { val4 = val2 - val; val5 = ((Vector2)(ref val4)).normalized; } Vector2 val6 = val5; Quaternion rotation = Quaternion.LookRotation(new Vector3(val6.x, 0f, val6.y), Vector3.up); float num2 = 2.2f; CreateBox(parent, name, new Vector3(val3.x, num2 + (3.2f - num2) * 0.5f, val3.y), rotation, new Vector3(0.3f, 3.2f - num2, num), PTMaterials.WallpaperMaterial, solid: true); } private static void FloorCeil(Transform parent, string name, float minX, float maxX, float minZ, float maxZ, bool tile = false) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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) float num = (minX + maxX) * 0.5f; float num2 = (minZ + maxZ) * 0.5f; float num3 = maxX - minX; float num4 = maxZ - minZ; CreateBox(parent, name + " Floor", new Vector3(num, -0.15f, num2), Quaternion.identity, new Vector3(num3, 0.3f, num4), tile ? PTMaterials.TileMaterial : PTMaterials.FloorMaterial, solid: true); CreateBox(parent, name + " Ceiling", new Vector3(num, 3.3500001f, num2), Quaternion.identity, new Vector3(num3, 0.3f, num4), PTMaterials.CeilingMaterial, solid: true); } private static Light AddLight(Transform parent, Vector3 position, Color color, float intensity, float range, string name) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002d: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = position; Light obj = val.AddComponent(); obj.type = (LightType)2; obj.color = color; obj.intensity = intensity; obj.range = range; obj.shadows = (LightShadows)2; return obj; } private static GameObject CreateBox(Transform parent, string name, Vector3 position, Quaternion rotation, Vector3 size, Material material, bool solid) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = name; val.transform.SetParent(parent, false); val.transform.localPosition = position; val.transform.localRotation = rotation; val.transform.localScale = size; MeshRenderer component = val.GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)material != (Object)null) { ((Renderer)component).sharedMaterial = material; } if (!solid) { Collider component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } } return val; } private static GameObject CreateCylinder(Transform parent, string name, Vector3 position, Quaternion rotation, Vector3 size, Material material, bool solid) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)2); ((Object)val).name = name; val.transform.SetParent(parent, false); val.transform.localPosition = position; val.transform.localRotation = rotation; val.transform.localScale = size; MeshRenderer component = val.GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)material != (Object)null) { ((Renderer)component).sharedMaterial = material; } if (!solid) { Collider component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } } return val; } private static void SetLayer(GameObject gameObject, string layerName) { int num = LayerMask.NameToLayer(layerName); if (num >= 0) { gameObject.layer = num; } } private static void SetTag(GameObject gameObject, string tag) { try { gameObject.tag = tag; } catch { } } } internal static class PTMaterials { private static int _seed = 1337; public static Material WallpaperMaterial { get; private set; } public static Material WainscotMaterial { get; private set; } public static Material FloorMaterial { get; private set; } public static Material CeilingMaterial { get; private set; } public static Material TileMaterial { get; private set; } public static Material TrimMaterial { get; private set; } public static Material DoorMaterial { get; private set; } public static Material DoorFrameMaterial { get; private set; } public static Material MetalMaterial { get; private set; } public static Material BlackMaterial { get; private set; } public static Material PorcelainMaterial { get; private set; } public static Material FleshMaterial { get; private set; } public static Material ClothMaterial { get; private set; } public static Material FixtureOnMaterial { get; private set; } public static Material FixtureOffMaterial { get; private set; } public static Material RugMaterial { get; private set; } public static Material StainMaterial { get; private set; } public static void EnsureCreated() { //IL_001d: 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_005e: 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_00a0: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0232: 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_0282: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)WallpaperMaterial != (Object)null)) { WallpaperMaterial = OpaqueTextured(GrungeWallpaper(new Color(0.32f, 0.27f, 0.2f), new Color(0.2f, 0.16f, 0.12f)), 0.05f, 0.25f); WainscotMaterial = OpaqueTextured(WoodPlanks(new Color(0.18f, 0.12f, 0.08f), new Color(0.1f, 0.07f, 0.05f), vertical: true), 0.1f, 0.35f); FloorMaterial = OpaqueTextured(WoodPlanks(new Color(0.24f, 0.16f, 0.1f), new Color(0.14f, 0.09f, 0.05f), vertical: false), 0.12f, 0.5f); CeilingMaterial = OpaqueTextured(Stucco(new Color(0.26f, 0.24f, 0.21f)), 0.02f, 0.15f); TileMaterial = OpaqueTextured(BathroomTile(new Color(0.5f, 0.5f, 0.47f), new Color(0.2f, 0.2f, 0.2f)), 0.15f, 0.6f); TrimMaterial = OpaqueColor(new Color(0.12f, 0.09f, 0.06f), 0.1f, 0.4f); DoorMaterial = OpaqueTextured(WoodPlanks(new Color(0.16f, 0.1f, 0.06f), new Color(0.09f, 0.05f, 0.03f), vertical: false), 0.12f, 0.45f); DoorFrameMaterial = OpaqueColor(new Color(0.1f, 0.07f, 0.05f), 0.1f, 0.4f); MetalMaterial = OpaqueColor(new Color(0.35f, 0.35f, 0.38f), 0.8f, 0.7f); BlackMaterial = OpaqueColor(new Color(0.01f, 0.01f, 0.012f), 0f, 0.1f); PorcelainMaterial = OpaqueColor(new Color(0.85f, 0.85f, 0.83f), 0.05f, 0.8f); FleshMaterial = OpaqueColor(new Color(0.4f, 0.32f, 0.3f), 0.05f, 0.35f); ClothMaterial = OpaqueColor(new Color(0.5f, 0.07f, 0.07f), 0.02f, 0.2f); FixtureOnMaterial = CreateEmissive(new Color(1f, 0.82f, 0.55f), 2.4f); FixtureOffMaterial = OpaqueColor(new Color(0.14f, 0.13f, 0.11f), 0.1f, 0.25f); RugMaterial = OpaqueTextured(RugWeave(new Color(0.22f, 0.06f, 0.05f), new Color(0.1f, 0.03f, 0.025f)), 0f, 0.08f); StainMaterial = CreateTransparent(new Color(0.02f, 0.015f, 0.01f, 0.42f)); } } public static Material CreateEmissive(Color color, float strength) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0011: 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_0029: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.color = new Color(color.r * 0.4f, color.g * 0.4f, color.b * 0.4f, 1f); if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.3f); } if (val.HasProperty("_EmissionColor")) { val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", color * strength); val.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1; } return val; } public static Material CreateTransparent(Color color) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.SetFloat("_Mode", 3f); val.SetInt("_SrcBlend", 5); val.SetInt("_DstBlend", 10); val.SetInt("_ZWrite", 0); val.DisableKeyword("_ALPHATEST_ON"); val.EnableKeyword("_ALPHABLEND_ON"); val.DisableKeyword("_ALPHAPREMULTIPLY_ON"); val.renderQueue = 3000; val.color = color; if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.2f); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } return val; } private static Material OpaqueColor(Color color, float metallic, float gloss) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.color = color; if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", metallic); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", gloss); } return val; } private static Material OpaqueTextured(Texture2D texture, float metallic, float gloss) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.color = Color.white; val.mainTexture = (Texture)(object)texture; if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", metallic); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", gloss); } return val; } private static float Noise(int x, int y) { int num = x + y * 57 + _seed * 131; num = (num << 13) ^ num; return 1f - (float)((num * (num * num * 15731 + 789221) + 1376312589) & 0x7FFFFFFF) / 1.0737418E+09f; } private static Texture2D GrungeWallpaper(Color baseColor, Color shade) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) int num = 128; Texture2D val = NewTexture(num); Color[] array = (Color[])(object)new Color[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num2 = Mathf.Sin((float)j * 0.39f) * 0.5f + 0.5f; float num3 = Mathf.Clamp01(Noise(j / 3, i / 3) * 0.5f + 0.5f); float num4 = Mathf.Clamp01((float)i / (float)num * 0.6f + 0.4f); Color val2 = Color.Lerp(shade, baseColor, num2 * 0.5f + 0.5f); val2 = Color.Lerp(val2, shade, (1f - num3) * 0.5f); val2 *= 0.6f + 0.4f * num4; array[i * num + j] = val2; } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D WoodPlanks(Color baseColor, Color groove, bool vertical) { //IL_006d: 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_007b: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) int num = 128; Texture2D val = NewTexture(num); Color[] array = (Color[])(object)new Color[num * num]; int num2 = 22; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { int num3 = (vertical ? j : i); int num4 = (vertical ? i : j); bool num5 = num3 % num2 < 2; float num6 = Mathf.Sin((float)num4 * 0.7f + Noise(num3 / num2, num4 / 8) * 3f) * 0.12f; Color val2 = baseColor * (1f + num6); if (num5) { val2 = groove; } array[i * num + j] = val2; } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D Stucco(Color baseColor) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) int num = 96; Texture2D val = NewTexture(num); Color[] array = (Color[])(object)new Color[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num2 = Mathf.Clamp01(Noise(j, i) * 0.5f + 0.5f); array[i * num + j] = baseColor * (0.8f + 0.2f * num2); } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D RugWeave(Color baseColor, Color border) { //IL_0080: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_008e: 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) int num = 128; Texture2D val = NewTexture(num); Color[] array = (Color[])(object)new Color[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { bool num2 = j < 7 || j >= num - 7 || i < 7 || i >= num - 7; float num3 = (((j + i) % 4 < 2) ? 1f : 0.86f); float num4 = Mathf.Clamp01(Noise(j / 5, i / 5) * 0.25f + 0.85f); Color val2 = (num2 ? border : (baseColor * num3)); array[i * num + j] = val2 * num4; } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D BathroomTile(Color tile, Color grout) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) int num = 128; Texture2D val = NewTexture(num); Color[] array = (Color[])(object)new Color[num * num]; int num2 = 16; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { bool flag = j % num2 < 2 || i % num2 < 2; float num3 = Mathf.Clamp01(Noise(j / 4, i / 4) * 0.2f + 0.9f); array[i * num + j] = (flag ? grout : (tile * num3)); } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D NewTexture(int size) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0018: Expected O, but got Unknown return new Texture2D(size, size, (TextureFormat)4, true) { wrapMode = (TextureWrapMode)0, filterMode = (FilterMode)1 }; } } [HarmonyPatch(typeof(RunManager), "SetRunLevel")] internal static class PTPatchRunManagerSetRunLevel { private static void Postfix(RunManager __instance) { if (EmpressPTPlugin.Settings != null && EmpressPTPlugin.Settings.ForcePTLevel.Value && !((Object)(object)EmpressPTPlugin.PTLevel == (Object)null)) { __instance.levelCurrent = EmpressPTPlugin.PTLevel; } } } [HarmonyPatch(typeof(LevelGenerator), "Generate")] internal static class PTPatchLevelGeneratorGenerate { private static bool Prefix(LevelGenerator __instance, ref IEnumerator __result) { if (!EmpressPTPlugin.IsPTLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { return true; } __result = PTRuntime.EnsureHost().GeneratePTLevel(__instance); return false; } } [HarmonyPatch(typeof(LevelPoint), "NavMeshCheck")] internal static class PTPatchLevelPointNavMeshCheck { private static bool Prefix(ref IEnumerator __result) { if (!EmpressPTPlugin.IsPTLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { return true; } __result = PTRuntime.EmptyCoroutine(); return false; } } [HarmonyPatch(typeof(EnvironmentDirector), "Setup")] internal static class PTPatchEnvironmentDirectorSetup { private static bool Prefix(EnvironmentDirector __instance) { //IL_002d: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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) if (!Object.op_Implicit((Object)(object)LevelGenerator.Instance)) { return true; } Level level = LevelGenerator.Instance.Level; if (!Object.op_Implicit((Object)(object)level) || !EmpressPTPlugin.IsPTLevel(level)) { return true; } PTAccess.SetEnvironmentFog(__instance, level.FogColor, level.FogStartDistance, level.FogEndDistance); PTAccess.SetEnvironmentAmbient(__instance, level.AmbientColor, level.AmbientColorAdaptation); RenderSettings.fogColor = level.FogColor; RenderSettings.fogStartDistance = level.FogStartDistance; RenderSettings.fogEndDistance = level.FogEndDistance; RenderSettings.ambientLight = level.AmbientColor; Camera val = PTAccess.GetEnvironmentMainCamera(__instance); if (!Object.op_Implicit((Object)(object)val)) { val = Camera.main; PTAccess.SetEnvironmentMainCamera(__instance, val); } if (Object.op_Implicit((Object)(object)val)) { val.backgroundColor = RenderSettings.fogColor; val.farClipPlane = RenderSettings.fogEndDistance + 8f; } PTAccess.SetEnvironmentDarkAdaptation(__instance, 0.6f); PTAccess.SetEnvironmentSetupDone(__instance, value: true); return false; } } [HarmonyPatch(typeof(LoadingUI), "LevelAnimationStart")] internal static class PTPatchLoadingUiLevelAnimationStart { private static void Postfix(LoadingUI __instance) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if (EmpressPTPlugin.IsPTLevel(Object.op_Implicit((Object)(object)LevelGenerator.Instance) ? LevelGenerator.Instance.Level : null)) { if ((Object)(object)__instance.levelNumberText != (Object)null) { ((TMP_Text)__instance.levelNumberText).text = "ROOM"; ((Graphic)__instance.levelNumberText).color = new Color(0.75f, 0.1f, 0.1f); ((Component)__instance.levelNumberText).gameObject.SetActive(true); ((TMP_Text)__instance.levelNumberText).transform.SetAsLastSibling(); } if ((Object)(object)__instance.levelNameText != (Object)null) { ((TMP_Text)__instance.levelNameText).text = "Empress - P.T."; ((Graphic)__instance.levelNameText).color = new Color(0.8f, 0.75f, 0.7f); ((Component)__instance.levelNameText).gameObject.SetActive(true); ((TMP_Text)__instance.levelNameText).transform.SetAsLastSibling(); ApplyObjectiveHint(__instance); } } } private static void ApplyObjectiveHint(LoadingUI loadingUI) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)loadingUI == (Object)null || (Object)(object)loadingUI.levelNameText == (Object)null) { return; } Transform parent = ((TMP_Text)loadingUI.levelNameText).transform.parent; if (!((Object)(object)parent == (Object)null)) { Transform val = parent.Find("Empress PT Loading Hint"); TextMeshProUGUI val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent() : null); if ((Object)(object)val2 == (Object)null) { val2 = Object.Instantiate(loadingUI.levelNameText, parent); ((Object)val2).name = "Empress PT Loading Hint"; } ((TMP_Text)val2).text = PTRuntime.LoadingHintForCurrentRun(); ((Graphic)val2).color = new Color(0.62f, 0.58f, 0.55f); ((TMP_Text)val2).fontSize = Mathf.Max(15f, ((TMP_Text)loadingUI.levelNameText).fontSize * 0.45f); ((TMP_Text)val2).enableAutoSizing = true; ((TMP_Text)val2).fontSizeMin = 12f; ((TMP_Text)val2).fontSizeMax = ((TMP_Text)val2).fontSize; ((TMP_Text)val2).alignment = (TextAlignmentOptions)514; ((Component)val2).gameObject.SetActive(true); RectTransform rectTransform = ((TMP_Text)val2).rectTransform; RectTransform rectTransform2 = ((TMP_Text)loadingUI.levelNameText).rectTransform; rectTransform.anchorMin = rectTransform2.anchorMin; rectTransform.anchorMax = rectTransform2.anchorMax; rectTransform.pivot = rectTransform2.pivot; rectTransform.anchoredPosition = rectTransform2.anchoredPosition + new Vector2(0f, -72f); rectTransform.sizeDelta = new Vector2(Mathf.Max(rectTransform2.sizeDelta.x, 760f), 90f); ((TMP_Text)val2).transform.SetAsLastSibling(); } } } [HarmonyPatch(typeof(ItemManager), "TurnOffIconLights")] internal static class PTPatchItemManagerTurnOffIconLights { private static bool Prefix(ItemManager __instance, ref IEnumerator __result) { if (!EmpressPTPlugin.IsPTLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { return true; } __result = SafeTurnOffIconLights(__instance); return false; } private static IEnumerator SafeTurnOffIconLights(ItemManager itemManager) { if ((Object)(object)itemManager.itemIconLights == (Object)null) { yield break; } if (SemiFunc.RunIsShop() || SemiFunc.MenuLevel()) { itemManager.itemIconLights.SetActive(false); yield break; } while ((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated) { yield return (object)new WaitForSeconds(0.2f); } while (itemManager.spawnedItems != null) { itemManager.spawnedItems.RemoveAll((ItemAttributes item) => (Object)(object)item == (Object)null); bool flag = false; for (int num = 0; num < itemManager.spawnedItems.Count; num++) { ItemAttributes val = itemManager.spawnedItems[num]; if ((Object)(object)val != (Object)null && !PTAccess.GetItemHasIcon(val)) { flag = true; break; } } if (!flag) { break; } yield return (object)new WaitForSeconds(0.2f); } itemManager.itemIconLights.SetActive(false); } } internal static class PTPortraits { private static readonly List _portraits = new List(); private static bool _initialized; public static int Count => _portraits.Count; public static void Initialize(string pluginDir) { if (!_initialized) { _initialized = true; LoadFromDisk(pluginDir); if (_portraits.Count == 0) { _portraits.Add(CreateDefault()); } EmpressPTPlugin.Log.LogInfo((object)("Empress PT loaded " + _portraits.Count + " wall portrait(s).")); } } public static Material PortraitMaterial(int index) { if (_portraits.Count == 0) { return CreateDefault(); } return _portraits[index % _portraits.Count]; } private static void LoadFromDisk(string pluginDir) { if (string.IsNullOrEmpty(pluginDir)) { return; } List list = new List(); try { if (Directory.Exists(pluginDir)) { list.AddRange(Directory.GetFiles(pluginDir, "portrait*.png")); } string path = Path.Combine(pluginDir, "Portraits"); if (Directory.Exists(path)) { list.AddRange(Directory.GetFiles(path, "*.png")); } } catch { return; } list.Sort(); for (int i = 0; i < list.Count; i++) { Material val = LoadPng(list[i]); if ((Object)(object)val != (Object)null) { _portraits.Add(val); } } } private static Material LoadPng(string path) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown try { byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); if (!ImageConversion.LoadImage(val, array)) { return null; } ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; return Framed(val); } catch { return null; } } private static Material Framed(Texture2D texture) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.color = Color.white; val.mainTexture = (Texture)(object)texture; if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0.05f); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.25f); } if (val.HasProperty("_EmissionColor")) { val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", Color.white * 0.35f); val.SetTexture("_EmissionMap", (Texture)(object)texture); val.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1; } return val; } private static Material CreateDefault() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0047: 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) Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false); Random random = new Random(7); Color[] array = (Color[])(object)new Color[64 * 64]; for (int i = 0; i < array.Length; i++) { float num = (float)random.NextDouble() * 0.22f; array[i] = new Color(num, num * 0.85f, num * 0.85f, 1f); } val.SetPixels(array); val.Apply(); ((Texture)val).wrapMode = (TextureWrapMode)1; return Framed(val); } } internal enum PTPhase { Waiting, Exploring, Escaped } internal sealed class PTRuntime : MonoBehaviour { private const int ExitDoorViewId = 950; private readonly List _hallLights = new List(); private PTHud _hud; private PTMap _map; private PTEntity _entity; private AudioSource _ambience; private GameObject _apparition; private int _sceneHandle = -1; private bool _active; private PTPhase _phase; private bool _lightsEnabled = true; private string _interactKeyName = "E"; private int _hallwayEventId; private float _exitCheckTimer; private float _flashlightTimer; private float _entityThinkTimer; private float _entitySyncTimer; private bool _entityActive; private bool _entitySpawned; private int _entityTargetViewId = -1; private float _entitySpawnTimer; private float _entityGraceTimer; private float _entityAttackCooldown; private bool _entityStillApparition; private float _blackoutTimer; private float _heartbeatTimer; private float _scareTimer; private float _flickerUntil; private bool _levelSwitchTriggered; private int _eventStep; private bool _eventComplete; private float _eventPromptTimer; private float _lockedDoorTimer; private readonly HashSet _usedEventObjects = new HashSet(); private Vector3 _exitTriggerPoint; public static PTRuntime Instance { get; private set; } public static PTRuntime EnsureHost() { //IL_0018: 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_0029: 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_0037: Expected O, but got Unknown if ((Object)(object)Instance != (Object)null) { return Instance; } GameObject val = new GameObject("Empress PT Runtime"); val.transform.parent = null; ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)val); Instance = val.AddComponent(); return Instance; } public static IEnumerator EmptyCoroutine() { yield break; } private void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown Instance = this; _hud = PTHud.Create(); _hud.SetVisible(visible: false); GameObject val = new GameObject("Empress PT Ambience"); val.transform.SetParent(((Component)this).transform, false); _ambience = val.AddComponent(); _ambience.loop = true; _ambience.playOnAwake = false; _ambience.spatialBlend = 0f; _ambience.volume = 0.4f; } private void Update() { HandleSceneTransition(); if (!_active) { return; } if (!EmpressPTPlugin.IsPTLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { Deactivate(); return; } _flashlightTimer -= Time.deltaTime; if (_flashlightTimer <= 0f) { _flashlightTimer = 1f; SetFlashlightsHidden(hidden: true); } float deltaTime = Time.deltaTime; if (_phase == PTPhase.Exploring) { UpdateExitTrigger(deltaTime); UpdateEventObjective(deltaTime); if (SemiFunc.IsMasterClientOrSingleplayer()) { UpdateEntitySpawn(deltaTime); UpdateEntityCooldown(deltaTime); UpdateEntity(deltaTime); } UpdateAmbientScares(deltaTime); UpdateBlackout(deltaTime); UpdateHeartbeat(deltaTime); } } private Vector3 LocalPlayerPosition() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = LocalPlayerAvatar(); if (!((Object)(object)val != (Object)null)) { return Vector3.zero; } return ((Component)val).transform.position; } private static PlayerAvatar LocalPlayerAvatar() { if (!((Object)(object)PlayerController.instance != (Object)null)) { return null; } return PlayerController.instance.playerAvatarScript; } private static int PlayerViewId(PlayerAvatar avatar) { if (!((Object)(object)avatar != (Object)null) || !((Object)(object)avatar.photonView != (Object)null)) { return -1; } return avatar.photonView.ViewID; } private static bool IsPlayable(PlayerAvatar avatar) { if ((Object)(object)avatar != (Object)null && !PTAccess.GetIsDisabled(avatar)) { return !PTAccess.GetDeadSet(avatar); } return false; } private PlayerAvatar FindPlayerByViewId(int viewId) { if (viewId <= 0) { return null; } if ((Object)(object)GameDirector.instance != (Object)null && GameDirector.instance.PlayerList != null) { for (int i = 0; i < GameDirector.instance.PlayerList.Count; i++) { PlayerAvatar val = GameDirector.instance.PlayerList[i]; if (IsPlayable(val) && PlayerViewId(val) == viewId) { return val; } } } PlayerAvatar val2 = LocalPlayerAvatar(); if (!IsPlayable(val2) || PlayerViewId(val2) != viewId) { return null; } return val2; } private PlayerAvatar SelectEntityTarget() { List list = new List(); if ((Object)(object)GameDirector.instance != (Object)null && GameDirector.instance.PlayerList != null) { for (int i = 0; i < GameDirector.instance.PlayerList.Count; i++) { PlayerAvatar val = GameDirector.instance.PlayerList[i]; if (IsPlayable(val)) { list.Add(val); } } } PlayerAvatar val2 = ((list.Count > 0) ? list[Random.Range(0, list.Count)] : LocalPlayerAvatar()); _entityTargetViewId = PlayerViewId(val2); return val2; } private PlayerAvatar CurrentEntityTarget() { PlayerAvatar val = FindPlayerByViewId(_entityTargetViewId); if (!((Object)(object)val != (Object)null)) { return SelectEntityTarget(); } return val; } private static Vector3 PlayerPosition(PlayerAvatar avatar) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)avatar != (Object)null)) { return Vector3.zero; } return ((Component)avatar).transform.position; } private static Vector3 PlayerForward(PlayerAvatar avatar) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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)avatar != (Object)null) { Vector3 forward = ((Component)avatar).transform.forward; if (((Vector3)(ref forward)).sqrMagnitude > 0.01f) { return ((Component)avatar).transform.forward; } } return Vector3.forward; } private void UpdateExitTrigger(float dt) { _exitCheckTimer -= dt; if (_exitCheckTimer > 0f) { return; } _exitCheckTimer = 0.05f; if (SemiFunc.IsMasterClientOrSingleplayer() && AnyPlayerAtExit()) { if (!_eventComplete) { LockedDoorFeedback(); } else { CompletePTLevel(); } } } private bool AnyPlayerAtExit() { //IL_0063: 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) if ((Object)(object)GameDirector.instance != (Object)null && GameDirector.instance.PlayerList != null) { for (int i = 0; i < GameDirector.instance.PlayerList.Count; i++) { PlayerAvatar val = GameDirector.instance.PlayerList[i]; if (IsPlayable(val) && IsAtExitPoint(((Component)val).transform.position)) { return true; } } } return IsAtExitPoint(LocalPlayerPosition()); } private bool IsAtExitPoint(Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (position.x >= _exitTriggerPoint.x && Mathf.Abs(position.z - _exitTriggerPoint.z) <= 0.95f) { return position.y > -1f; } return false; } private void UpdateEventObjective(float dt) { if (_eventComplete || _map == null || !IsPlayable(LocalPlayerAvatar())) { return; } _eventPromptTimer -= dt; PTEventObject pTEventObject = FindCurrentEventTarget(); if (pTEventObject != null) { if (_eventPromptTimer <= 0f) { _eventPromptTimer = 0.25f; _hud.FlashSubtitle(_interactKeyName + " - " + pTEventObject.Prompt, 0.35f); } if (SemiFunc.InputDown((InputKey)2)) { EmpressPTPlugin.RaiseObjective(new object[2] { _hallwayEventId, pTEventObject.Id }); } } } private PTEventObject FindCurrentEventTarget() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) Vector3 a = LocalPlayerPosition(); PTEventObject result = null; float num = float.MaxValue; for (int i = 0; i < _map.EventObjects.Count; i++) { PTEventObject pTEventObject = _map.EventObjects[i]; if (pTEventObject != null && pTEventObject.Step == _eventStep && !string.IsNullOrWhiteSpace(pTEventObject.Id) && !_usedEventObjects.Contains(pTEventObject.Id)) { Vector3 b = EventObjectPosition(pTEventObject); float num2 = FlatDistance(a, b); float num3 = Mathf.Max(0.75f, pTEventObject.Radius); if (num2 <= num3 && num2 < num) { result = pTEventObject; num = num2; } } } return result; } private PTEventObject FindEventObject(string id) { if (_map == null || string.IsNullOrWhiteSpace(id)) { return null; } for (int i = 0; i < _map.EventObjects.Count; i++) { PTEventObject pTEventObject = _map.EventObjects[i]; if (pTEventObject != null && pTEventObject.Id == id) { return pTEventObject; } } return null; } private Vector3 EventObjectPosition(PTEventObject target) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (target != null && (Object)(object)target.Instance != (Object)null) { return target.Instance.transform.position; } return target?.Position ?? Vector3.zero; } 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); } internal void ReceiveObjectiveEvent(object[] data) { if (data != null && data.Length >= 2 && data[0] is int num && data[1] is string id && num == _hallwayEventId) { HandleObjectiveInteraction(id); } } internal void ReceiveHudEvent(object[] data) { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) if (data != null && data.Length >= 1 && data[0] is int num) { if (num == 0 && data.Length >= 3 && data[1] is string text && data[2] is float duration) { _hud.FlashSubtitle(text, duration); } else if (num == 1 && data.Length >= 6 && data[1] is string text2 && data[2] is float num2 && data[3] is float num3 && data[4] is float num4 && data[5] is float duration2) { _hud.FlashBanner(text2, new Color(num2, num3, num4), duration2); } } } internal void ReceivePlayerEvent(object[] data) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019c: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) if (data == null || data.Length < 2 || !(data[0] is int num) || !(data[1] is int num2)) { return; } PlayerAvatar val = LocalPlayerAvatar(); if ((Object)(object)val == (Object)null || (num2 <= 0 && SemiFunc.IsMultiplayer())) { return; } int num3 = PlayerViewId(val); if (num2 > 0 && num3 != num2) { return; } Vector3 position = ((Component)val).transform.position; if (data.Length >= 3 && data[2] is Vector3 val2) { position = val2; } switch (num) { case 0: PTAudio.PlayLisaKill(position); _hud.FlashScreen(new Color(0.4f, 0f, 0f, 0.85f), 1.2f); _hud.FlashSubtitle("CAUGHT", 2f); return; case 1: if (data.Length >= 4 && data[2] is Vector3 val3 && data[3] is Quaternion rotation) { MoveLocalAvatar(val, val3, rotation); PTAudio.PlaySting(val3); PTAudio.PlayWhisper(val3); PTAudio.PlayHeartbeat(val3); if ((Object)(object)CameraGlitch.Instance != (Object)null) { CameraGlitch.Instance.PlayShort(); } _hud.FlashScreen(new Color(0.25f, 0f, 0f, 0.72f), 0.9f); _hud.FlashSubtitle("SHE MOVED YOU", 2f); return; } break; } if (num == 2) { PTAudio.PlaySting(position); PTAudio.PlayWhisper(position); if ((Object)(object)CameraGlitch.Instance != (Object)null) { CameraGlitch.Instance.PlayTiny(); } _hud.FlashScreen(new Color(0f, 0f, 0f, 0.7f), 0.75f); _hud.FlashSubtitle("she let go", 1.8f); } } private void FlashSubtitle(string text, float duration, bool sync) { _hud.FlashSubtitle(text, duration); if (sync && SemiFunc.IsMultiplayer() && PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient) { EmpressPTPlugin.RaiseHud(new object[3] { 0, text, duration }); } } private void HandleObjectiveInteraction(string id) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (_eventComplete || _usedEventObjects.Contains(id)) { return; } PTEventObject pTEventObject = FindEventObject(id); if (pTEventObject != null && pTEventObject.Step == _eventStep) { PTAudio.PlayInteract(EventObjectPosition(pTEventObject)); _usedEventObjects.Add(id); MarkEventObject(pTEventObject); ApplyEventBeat(pTEventObject); _eventStep++; if (!HasEventStep(_eventStep)) { CompleteEventObjective(); } } } private bool HasEventStep(int step) { if (_map == null) { return false; } for (int i = 0; i < _map.EventObjects.Count; i++) { PTEventObject pTEventObject = _map.EventObjects[i]; if (pTEventObject != null && pTEventObject.Step == step && !_usedEventObjects.Contains(pTEventObject.Id)) { return true; } } return false; } private void MarkEventObject(PTEventObject target) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (target == null || (Object)(object)target.Instance == (Object)null) { return; } if (target.Id.StartsWith("hanging") || target.Id.StartsWith("breath") || target.Id.StartsWith("blood") || target.Id.StartsWith("shadow")) { target.Instance.SetActive(false); return; } Material sharedMaterial = PTMaterials.CreateEmissive(new Color(0.95f, 0.08f, 0.05f), 2.2f); Renderer[] componentsInChildren = target.Instance.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].sharedMaterial = sharedMaterial; } } private void ApplyEventBeat(PTEventObject target) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_08c9: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_08b7: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_0706: Unknown result type (might be due to invalid IL or missing references) //IL_0715: Unknown result type (might be due to invalid IL or missing references) //IL_074b: Unknown result type (might be due to invalid IL or missing references) //IL_0760: Unknown result type (might be due to invalid IL or missing references) //IL_0780: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_080a: Unknown result type (might be due to invalid IL or missing references) //IL_0819: Unknown result type (might be due to invalid IL or missing references) //IL_07c3: Unknown result type (might be due to invalid IL or missing references) //IL_07c9: Unknown result type (might be due to invalid IL or missing references) //IL_079c: Unknown result type (might be due to invalid IL or missing references) //IL_084f: Unknown result type (might be due to invalid IL or missing references) //IL_085e: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Unknown result type (might be due to invalid IL or missing references) //IL_0880: Unknown result type (might be due to invalid IL or missing references) //IL_0896: Unknown result type (might be due to invalid IL or missing references) //IL_089b: Unknown result type (might be due to invalid IL or missing references) //IL_06bb: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) Vector3 position = EventObjectPosition(target); Vector3 val = LocalPlayerPosition(); switch (target.Id) { case "phone": _hud.FlashSubtitle("the call is coming from behind the door", 3f); PTAudio.PlayWhisper(val); FlickerLights(1.2f); break; case "mirror": case "bath-mirror": _hud.FlashSubtitle("she is not in the reflection anymore", 3f); _hud.FlashScreen(new Color(0.5f, 0.7f, 1f, 0.35f), 1.2f); PTAudio.PlaySting(position); PeekEntity(); break; case "door": case "final-door": _hud.FlashSubtitle("the lock is listening", 3f); PTAudio.PlayDoor(_map.ExitDoorPosition); FlickerLights(1f); break; case "fuse-a": case "fuse-b": _hud.FlashSubtitle("the house wakes up", 2.5f); PTAudio.PlayKnock(position); FlickerLights(1.5f); break; case "fuse-c": _hud.FlashSubtitle("the house is awake", 2.5f); PTAudio.PlayKnock(position); _blackoutTimer = 2.2f; PeekEntity(); break; case "sink": _hud.FlashSubtitle("the water remembers your hands", 3f); _hud.FlashScreen(new Color(0.5f, 0f, 0f, 0.28f), 1f); PTAudio.PlayHeartbeat(position); PTAudio.PlayPhoneRing(EventObjectPosition(FindEventObject("bath-phone"))); break; case "bath-phone": _hud.FlashSubtitle("do not answer twice", 3f); PTAudio.PlayWhisper(position); ShowLisaNear(new Vector3(0f, 0f, 14f), val); break; case "portrait-a": case "portrait-b": _hud.FlashSubtitle("the portrait blinked", 2.5f); PTAudio.PlayWhisper(position); FlickerLights(0.8f); break; case "portrait-c": _hud.FlashSubtitle("it is watching you leave", 2.5f); PTAudio.PlaySting(position); FlickerLights(0.8f); PeekEntity(); break; case "hanging-a": case "hanging-b": _hud.FlashSubtitle("something fell upstairs", 2.5f); _hud.FlashScreen(new Color(0f, 0f, 0f, 0.35f), 0.9f); PTAudio.PlaySlam(position); break; case "hanging-c": _hud.FlashSubtitle("it landed behind you", 2.5f); _hud.FlashScreen(new Color(0f, 0f, 0f, 0.45f), 1f); PTAudio.PlaySlam(position); ShowLisaNear(new Vector3(0f, 0f, 20f), val); break; case "breath-a": _hud.FlashSubtitle("your breath stops for a second", 2.5f); _hud.FlashScreen(new Color(0.55f, 0.75f, 1f, 0.3f), 1f); PTAudio.PlayHeartbeat(val); break; case "breath-b": case "breath-c": _hud.FlashSubtitle("it is breathing with you", 2.5f); _hud.FlashScreen(new Color(0.55f, 0.75f, 1f, 0.3f), 1f); PTAudio.PlayHeartbeat(val); PeekEntity(); break; case "blood-a": case "blood-b": _hud.FlashSubtitle("the stain moved", 2.5f); _hud.FlashScreen(new Color(0.45f, 0f, 0f, 0.24f), 0.8f); PTAudio.PlaySting(position); break; case "blood-c": _hud.FlashSubtitle("it leads under the door", 2.5f); _hud.FlashScreen(new Color(0.45f, 0f, 0f, 0.3f), 0.9f); PTAudio.PlayKnock(_map.ExitDoorPosition); break; case "shadow-a": case "shadow-b": _hud.FlashSubtitle("the shadow is warm", 2.5f); PTAudio.PlayHeartbeat(val); break; case "shadow-c": _hud.FlashSubtitle("it was never a shadow", 2.5f); PTAudio.PlayHeartbeat(val); ShowLisaBehindTarget(5f); break; case "radio": _hud.FlashSubtitle("the radio found your room", 3f); PTAudio.PlayStatic(position); PTAudio.PlayWhisper(position); FlickerLights(1.2f); break; case "signal-a": _hud.FlashSubtitle("the signal is inside the walls", 2.5f); _hud.FlashScreen(new Color(0f, 0.6f, 0.15f, 0.25f), 0.9f); PTAudio.PlayStatic(position); break; case "signal-b": _hud.FlashSubtitle("the signal found you", 2.5f); _hud.FlashScreen(new Color(0f, 0.6f, 0.15f, 0.3f), 0.9f); PTAudio.PlayStatic(position); PeekEntity(); break; case "false-door": _hud.FlashSubtitle("that door is breathing", 3f); PTAudio.PlayDoor(position); ShowLisaNear(new Vector3(0f, 0f, 9f), val); break; case "clock": _hud.FlashSubtitle("the minute hand stopped", 2.5f); PTAudio.PlayKnock(position); _blackoutTimer = 2f; break; default: PTAudio.PlayWhisper(position); FlickerLights(0.9f); break; } } private void CompleteEventObjective() { //IL_0021: 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_005b: Unknown result type (might be due to invalid IL or missing references) _eventComplete = true; _hud.FlashBanner("GET OUT", new Color(0.85f, 0.05f, 0.04f), 3f); _hud.FlashSubtitle("the door unlocked", 3f); PTAudio.PlaySlam(_map.ExitDoorPosition); PTAudio.PlayDoor(_map.ExitDoorPosition); FlickerLights(1.4f); SetDoorLocked(locked: false); SetFinaleLighting(); if ((Object)(object)CameraGlitch.Instance != (Object)null) { CameraGlitch.Instance.PlayShort(); } if (SemiFunc.IsMasterClientOrSingleplayer()) { if (!_entitySpawned) { ActivateEntity(); } else if (!_entityActive) { _entityAttackCooldown = Mathf.Min(_entityAttackCooldown, 2.5f); } } } private void SetFinaleLighting() { //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_003a: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _hallLights.Count; i++) { Light val = _hallLights[i]; if (!((Object)(object)val == (Object)null)) { val.color = Color.Lerp(val.color, new Color(1f, 0.14f, 0.1f), 0.7f); val.intensity *= 0.85f; } } } private void LockedDoorFeedback() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (!(Time.time < _lockedDoorTimer)) { _lockedDoorTimer = Time.time + 1.35f; FlashSubtitle("the door is locked", 1.1f, sync: true); _hud.FlashScreen(new Color(0.18f, 0f, 0f, 0.2f), 0.6f); PTAudio.PlayKnock(_map.ExitDoorPosition); } } private void SetDoorLocked(bool locked) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if (_map == null || (Object)(object)_map.ExitDoorObject == (Object)null) { return; } PTDoorSwing component = _map.ExitDoorObject.GetComponent(); if ((Object)(object)component != (Object)null) { component.Locked = locked; } if ((Object)(object)_map.ExitLightObject != (Object)null) { Renderer component2 = _map.ExitLightObject.GetComponent(); if ((Object)(object)component2 != (Object)null) { Color color = (locked ? new Color(1f, 0.02f, 0.01f) : new Color(0.05f, 1f, 0.22f)); component2.sharedMaterial = PTMaterials.CreateEmissive(color, locked ? 5f : 4f); } } } private void UpdateAmbientScares(float dt) { if (!_levelSwitchTriggered) { _scareTimer -= dt; if (!(_scareTimer > 0f)) { _scareTimer = Random.Range(17f, 33f); PlayAmbientScare(); } } } private void PlayAmbientScare() { //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_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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = LocalPlayerAvatar(); if ((Object)(object)val == (Object)null) { return; } Vector3 position = ((Component)val).transform.position; Vector3 val2 = LocalForward(); bool flag = _entityActive && _entity != null && _entity.State == PTEntityState.Hunting; switch (Random.Range(0, flag ? 5 : 9)) { case 0: PTAudio.PlayKnock(position - val2 * 3.5f); if ((Object)(object)CameraGlitch.Instance != (Object)null) { CameraGlitch.Instance.PlayTiny(); } break; case 1: PTAudio.PlayWhisper(RandomWaypoint(position)); break; case 2: FlickerLights(Random.Range(0.5f, 1.1f)); break; case 3: PTAudio.PlayHeartbeat(position); _hud.FlashScreen(new Color(0.5f, 0.7f, 1f, 0.16f), 0.7f); break; case 4: PTAudio.PlayStatic(position + val2 * 2.5f); break; case 5: PTAudio.PlayDoor((_map != null) ? _map.ExitDoorPosition : position); break; case 6: _blackoutTimer = Random.Range(1.8f, 3f); PTAudio.PlaySting(position); break; case 7: if (!TryFlashApparition(val)) { PTAudio.PlayWhisper(position - val2 * 4f); } break; default: PTAudio.PlaySlam(RandomWaypoint(position)); if ((Object)(object)CameraGlitch.Instance != (Object)null) { CameraGlitch.Instance.PlayTiny(); } break; } } private Vector3 RandomWaypoint(Vector3 fallback) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (_map == null || _map.Waypoints.Count == 0) { return fallback; } return _map.Waypoints[Random.Range(0, _map.Waypoints.Count)] + Vector3.up; } private bool TryFlashApparition(PlayerAvatar avatar) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) if (!PTLisaAssets.Available || (Object)(object)_apparition != (Object)null) { return false; } if (_entityActive && _entity != null && _entity.State != PTEntityState.Hidden) { return false; } Vector3 position = ((Component)avatar).transform.position; Vector3 val = LocalForward(); float num = Random.Range(5.5f, 8.5f); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(position + Vector3.up * 1.4f, val, ref val2, num, -1, (QueryTriggerInteraction)1)) { num = Mathf.Max(2.5f, ((RaycastHit)(ref val2)).distance - 1.2f); } Vector3 val3 = GroundEntitySpot(position + val * num); Vector3 val4 = position - val3; val4.y = 0f; if (((Vector3)(ref val4)).sqrMagnitude < 0.01f) { return false; } _apparition = PTLisaAssets.InstantiateLisa(null); if ((Object)(object)_apparition == (Object)null) { return false; } _apparition.transform.position = val3; _apparition.transform.rotation = Quaternion.LookRotation(((Vector3)(ref val4)).normalized, Vector3.up); PTAudio.PlaySting(val3); PTAudio.PlayWhisper(val3); if ((Object)(object)CameraGlitch.Instance != (Object)null) { CameraGlitch.Instance.PlayTiny(); } ((MonoBehaviour)this).StartCoroutine(DespawnApparition(Random.Range(0.35f, 0.55f))); return true; } private IEnumerator DespawnApparition(float delay) { yield return (object)new WaitForSeconds(delay); if ((Object)(object)_apparition != (Object)null) { Object.Destroy((Object)(object)_apparition); _apparition = null; FlickerLights(0.4f); } } private void ShowLisaNear(Vector3 position, Vector3 lookAt) { //IL_0052: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer() && _entity != null && EmpressPTPlugin.Settings.EnableEntity.Value && _entitySpawned && !(_entityAttackCooldown > 0f)) { PlayerAvatar val = SelectEntityTarget(); if ((Object)(object)val != (Object)null) { lookAt = PlayerPosition(val); } PlaceLisaNear(position, lookAt); } } private void PlaceLisaNear(Vector3 position, Vector3 lookAt) { //IL_0009: 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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (_entity != null) { position = GroundEntitySpot(position); Vector3 val = lookAt - position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } _entityActive = true; _entityStillApparition = false; _entityGraceTimer = 2.2f; _entityThinkTimer = Random.Range(3.5f, 6f); _entity.PlaceAt(position, Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up)); _entity.SetState(PTEntityState.Lurking); SyncEntity(force: true); } } private void ShowLisaBehindTarget(float distance) { //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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer() && _entity != null && EmpressPTPlugin.Settings.EnableEntity.Value && _entitySpawned && !(_entityAttackCooldown > 0f)) { PlayerAvatar val = SelectEntityTarget(); if (!((Object)(object)val == (Object)null)) { Vector3 val2 = PlayerPosition(val); Vector3 position = val2 - PlayerForward(val) * distance; PlaceLisaNear(position, val2); } } } private void CompletePTLevel() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (!_levelSwitchTriggered) { _levelSwitchTriggered = true; _phase = PTPhase.Escaped; FlashSubtitle("the door opens somewhere else", 2.5f, sync: true); PTAudio.PlayDoor(_map.ExitDoorPosition); PrepareExitDoorForTransition(); if (_entity != null) { _entity.SetState(PTEntityState.Hidden); } _entityActive = false; SyncEntity(force: true); ((MonoBehaviour)this).StartCoroutine(ChangeLevelRoutine()); } } private IEnumerator ChangeLevelRoutine() { yield return (object)new WaitForSeconds(0.6f); PTAudio.PlaySlam((_map != null) ? _map.ExitDoorPosition : LocalPlayerPosition()); yield return (object)new WaitForSeconds(0.5f); if ((Object)(object)RunManager.instance != (Object)null && SemiFunc.IsMasterClientOrSingleplayer()) { RunManager.instance.ChangeLevel(true, false, (ChangeLevelType)0); } } private void UpdateEntity(float dt) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) if (!_entityActive || _entity == null) { return; } if (_entityGraceTimer > 0f) { _entityGraceTimer -= dt; SyncEntity(force: false); return; } _entityThinkTimer -= dt; PlayerAvatar val = CurrentEntityTarget(); Vector3 val2 = PlayerPosition(val); if (_entityStillApparition) { _entity.Tick(dt, val2, _map.Waypoints); if (_entity.DistanceTo(val2) < 2.5f) { PTAudio.PlayWhisper(val2); _hud.FlashScreen(new Color(0f, 0f, 0f, 0.55f), 0.65f); FlashSubtitle("she was already gone", 1.6f, sync: true); BeginEntityCooldown(); } else if (_entityThinkTimer <= 0f) { BeginEntityCooldown(); } else { SyncEntity(force: false); } return; } if (_entity.State == PTEntityState.Lurking && _entityThinkTimer <= 0f) { _entityThinkTimer = Random.Range(2.5f, 5f); float num = (_eventComplete ? 0.85f : 0.55f); if (Random.value < num) { val = SelectEntityTarget(); val2 = PlayerPosition(val); _entity.SetState(PTEntityState.Hunting); PTAudio.PlaySting(_entity.Position); FlashSubtitle("she sees you", 2.5f, sync: true); SyncEntity(force: true); } else { PeekEntity(); } } _entity.Tick(dt, val2, _map.Waypoints); if (_entity.State == PTEntityState.Hunting) { float num2 = _entity.DistanceTo(val2); if (num2 < 1.6f) { EntityCatch(val); } else if (num2 > 30f) { _entity.SetState(PTEntityState.Lurking); _entityThinkTimer = Random.Range(3f, 6f); SyncEntity(force: true); } } SyncEntity(force: false); } private void UpdateEntitySpawn(float dt) { if (!_entitySpawned && _entity != null && EmpressPTPlugin.Settings.EnableEntity.Value) { _entitySpawnTimer -= dt; if (_entitySpawnTimer <= 0f) { ActivateEntity(); } } } private void UpdateEntityCooldown(float dt) { if (_entitySpawned && !_entityActive && !(_entityAttackCooldown <= 0f) && _entity != null && EmpressPTPlugin.Settings.EnableEntity.Value) { _entityAttackCooldown -= dt; if (!(_entityAttackCooldown > 0f)) { ResumeEntityAfterCooldown(); } } } private void ActivateEntity() { //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_006c: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_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) if (_entity == null || _entitySpawned) { return; } _entitySpawned = true; _entityActive = true; _entityAttackCooldown = 0f; Vector3 val = PlayerPosition(SelectEntityTarget()); if (Random.value < 0.35f && PlaceStillApparition(Random.Range(8f, 14f))) { FlashSubtitle("you are not alone", 3f, sync: true); return; } Vector3 val2 = GroundEntitySpot(PickEntitySpawnSpot(val, 7f)); Vector3 val3 = val - val2; val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.forward; } _entityStillApparition = false; _entity.PlaceAt(val2, Quaternion.LookRotation(((Vector3)(ref val3)).normalized, Vector3.up)); _entity.SetState(PTEntityState.Lurking); _entityThinkTimer = Random.Range(4f, 8f); FlashSubtitle("you are not alone", 3f, sync: true); PTAudio.PlayWhisper(val2); SyncEntity(force: true); } private void ResumeEntityAfterCooldown() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (_entity == null || _phase != PTPhase.Exploring || _levelSwitchTriggered) { return; } _entityActive = true; _entityAttackCooldown = 0f; Vector3 val = PlayerPosition(SelectEntityTarget()); if (!(Random.value < 0.45f) || !PlaceStillApparition(Random.Range(8f, 16f))) { Vector3 val2 = GroundEntitySpot(PickEntitySpawnSpot(val, 8f)); Vector3 val3 = val - val2; val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.forward; } _entityStillApparition = false; _entityGraceTimer = 2.2f; _entityThinkTimer = Random.Range(5f, 9f); _entity.PlaceAt(val2, Quaternion.LookRotation(((Vector3)(ref val3)).normalized, Vector3.up)); _entity.SetState(PTEntityState.Lurking); PTAudio.PlayWhisper(val2); SyncEntity(force: true); } } private bool PlaceStillApparition(float duration) { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (_entity == null) { return false; } Vector3 val = PlayerPosition(SelectEntityTarget()); Vector3 val2 = GroundEntitySpot(PickEntitySpawnSpot(val, 5f)); Vector3 val3 = val - val2; val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.forward; } _entityActive = true; _entityStillApparition = true; _entityGraceTimer = 0.4f; _entityThinkTimer = duration; _entity.PlaceAt(val2, Quaternion.LookRotation(((Vector3)(ref val3)).normalized, Vector3.up)); _entity.SetState(PTEntityState.Lurking); PTAudio.PlayHeartbeat(val); SyncEntity(force: true); return true; } private Vector3 PickEntitySpawnSpot(Vector3 player, float minimumDistance) { //IL_0024: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) Vector3 result = (Vector3)((_map != null) ? _map.EntityHideSpot : new Vector3(0f, 0f, 10f)); if (_map == null || _map.Waypoints == null || _map.Waypoints.Count == 0) { return result; } List list = new List(); for (int i = 0; i < _map.Waypoints.Count; i++) { Vector3 val = _map.Waypoints[i]; float num = FlatDistance(player, val); if (num >= minimumDistance && num <= 22f) { list.Add(val); } } if (list.Count == 0) { return result; } return list[Random.Range(0, list.Count)]; } private static Vector3 GroundEntitySpot(Vector3 position) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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, 8f, -1, (QueryTriggerInteraction)1) && (Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponentInParent() == (Object)null) { position.y = ((RaycastHit)(ref val)).point.y; return position; } position.y = 0f; return position; } private void PeekEntity() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer() && _entity != null && _entitySpawned && !(_entityAttackCooldown > 0f)) { PlayerAvatar avatar = SelectEntityTarget(); Vector3 val = PlayerPosition(avatar); Vector3 val2 = GroundEntitySpot(val - PlayerForward(avatar) * 6f); _entityActive = true; _entityStillApparition = false; _entityGraceTimer = Mathf.Max(_entityGraceTimer, 1.2f); PTEntity entity = _entity; Vector3 val3 = val - val2; entity.PlaceAt(val2, Quaternion.LookRotation(((Vector3)(ref val3)).normalized, Vector3.up)); _entity.SetState(PTEntityState.Lurking); PTAudio.PlayHeartbeat(val); _entityThinkTimer = Random.Range(2f, 4f); SyncEntity(force: true); } } private void EntityCatch(PlayerAvatar target) { //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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null) { return; } Vector3 val = PlayerPosition(target); int num = PlayerViewId(target); float value = Random.value; if (value < 0.4f && TryMovePlayer(target)) { FlickerLights(1.2f); BeginEntityCooldown(); } else if (value < 0.75f) { PlayerTumble playerTumble = PTAccess.GetPlayerTumble(target); if ((Object)(object)playerTumble != (Object)null) { playerTumble.TumbleRequest(true, false); playerTumble.TumbleOverrideTime(2.5f); } if ((Object)(object)target.playerHealth != (Object)null && !PTAccess.GetDeadSet(target)) { if (SemiFunc.IsMultiplayer()) { target.playerHealth.HurtOther(30, Vector3.zero, false, -1, false); } else { target.playerHealth.Hurt(30, false, -1, false); } } EmpressPTPlugin.RaisePlayer(new object[3] { 0, num, val }); FlickerLights(1f); BeginEntityCooldown(); } else { EmpressPTPlugin.RaisePlayer(new object[3] { 2, num, val }); FlickerLights(0.8f); BeginEntityCooldown(); } } private void BeginEntityCooldown() { _entityAttackCooldown = (_eventComplete ? Random.Range(6f, 12f) : Random.Range(12f, 26f)); _entityActive = false; _entityStillApparition = false; _entityGraceTimer = 0f; _entityThinkTimer = 0f; if (_entity != null) { _entity.SetState(PTEntityState.Hidden); } SyncEntity(force: true); } private bool TryMovePlayer(PlayerAvatar avatar) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)avatar == (Object)null) { return false; } Vector3 val = PickHauntDestination(((Component)avatar).transform.position); Vector3 val2 = ((_map != null) ? (_map.ExitDoorPosition - val) : Vector3.forward); val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = Vector3.forward; } Quaternion val3 = Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up); if (SemiFunc.IsMultiplayer() && PhotonNetwork.IsMasterClient) { avatar.Spawn(val, val3); } EmpressPTPlugin.RaisePlayer(new object[4] { 1, PlayerViewId(avatar), val, val3 }); if (_entity != null) { Vector3 val4 = val - ((Vector3)(ref val2)).normalized * 4f; val4.y = val.y; PTEntity entity = _entity; Vector3 position = val4; Vector3 val5 = val - val4; entity.PlaceAt(position, Quaternion.LookRotation(((Vector3)(ref val5)).normalized, Vector3.up)); } return true; } private Vector3 PickHauntDestination(Vector3 current) { //IL_003d: 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_0040: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f, 1f, 3f); if (_map == null || _map.Waypoints == null || _map.Waypoints.Count == 0) { return val; } Vector3 result = val; float num = 0f; for (int i = 0; i < _map.Waypoints.Count; i++) { Vector3 val2 = _map.Waypoints[i] + Vector3.up; float num2 = FlatDistance(current, val2); if (num2 > num && num2 < 24f) { num = num2; result = val2; } } return result; } private static void MoveLocalAvatar(PlayerAvatar avatar, Vector3 destination, Quaternion rotation) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)avatar.physGrabber != (Object)null) { avatar.physGrabber.ReleaseObject(-1, 0.1f); } Rigidbody playerAvatarRigidbody = PTAccess.GetPlayerAvatarRigidbody(avatar); if ((Object)(object)playerAvatarRigidbody != (Object)null) { playerAvatarRigidbody.velocity = Vector3.zero; playerAvatarRigidbody.angularVelocity = Vector3.zero; playerAvatarRigidbody.position = destination; playerAvatarRigidbody.rotation = rotation; } ((Component)avatar).transform.position = destination; ((Component)avatar).transform.rotation = rotation; if ((Object)(object)avatar.playerTransform != (Object)null) { avatar.playerTransform.position = destination; avatar.playerTransform.rotation = rotation; } if ((Object)(object)avatar.playerAvatarVisuals != (Object)null) { ((Component)avatar.playerAvatarVisuals).transform.position = destination; PTAccess.SetPlayerAvatarVisualPosition(avatar.playerAvatarVisuals, destination); } if ((Object)(object)PlayerController.instance != (Object)null && (Object)(object)PlayerController.instance.playerAvatarScript == (Object)(object)avatar) { ((Component)PlayerController.instance).transform.position = destination; ((Component)PlayerController.instance).transform.rotation = rotation; Rigidbody playerControllerRigidbody = PTAccess.GetPlayerControllerRigidbody(PlayerController.instance); if ((Object)(object)playerControllerRigidbody != (Object)null) { playerControllerRigidbody.velocity = Vector3.zero; playerControllerRigidbody.angularVelocity = Vector3.zero; } } } private void UpdateBlackout(float dt) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (_blackoutTimer <= 0f) { if (!_lightsEnabled && _phase == PTPhase.Exploring && Time.time > _flickerUntil) { SetLightsEnabled(enabled: true); } return; } SetLightsEnabled(enabled: false); _blackoutTimer -= dt; if (_blackoutTimer <= 0f) { SetLightsEnabled(enabled: true); PTAudio.PlayKnock(LocalPlayerPosition()); } } private void UpdateHeartbeat(float dt) { //IL_0018: 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 (!_entityActive || _entity == null) { return; } float num = _entity.DistanceTo(LocalPlayerPosition()); if (!(num > 14f)) { _heartbeatTimer -= dt; if (_heartbeatTimer <= 0f) { _heartbeatTimer = Mathf.Lerp(0.4f, 1.4f, Mathf.Clamp01(num / 14f)); PTAudio.PlayHeartbeat(LocalPlayerPosition()); } } } private void FlickerLights(float duration) { _flickerUntil = Mathf.Max(_flickerUntil, Time.time + duration); ((MonoBehaviour)this).StartCoroutine(FlickerRoutine(duration)); } private IEnumerator FlickerRoutine(float duration) { float t = 0f; while (t < duration) { t += Time.deltaTime; bool flag = Random.value > 0.4f; SetLightsEnabled(_blackoutTimer <= 0f && flag); yield return (object)new WaitForSeconds(Random.Range(0.04f, 0.12f)); } if (_blackoutTimer <= 0f && (_phase == PTPhase.Exploring || _phase == PTPhase.Escaped)) { SetLightsEnabled(enabled: true); } } private void SetLightsEnabled(bool enabled) { if (_lightsEnabled == enabled) { return; } _lightsEnabled = enabled; for (int i = 0; i < _hallLights.Count; i++) { if ((Object)(object)_hallLights[i] != (Object)null) { ((Behaviour)_hallLights[i]).enabled = enabled; } } if (_map == null) { return; } Material sharedMaterial = (enabled ? PTMaterials.FixtureOnMaterial : PTMaterials.FixtureOffMaterial); for (int j = 0; j < _map.LightFixtures.Count; j++) { Renderer val = _map.LightFixtures[j]; if ((Object)(object)val != (Object)null) { val.sharedMaterial = sharedMaterial; } } } private Vector3 LocalForward() { //IL_003d: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main != (Object)null) { Vector3 forward = ((Component)main).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude > 0.01f) { return ((Vector3)(ref forward)).normalized; } } return Vector3.forward; } public IEnumerator GeneratePTLevel(LevelGenerator generator) { EmpressPTPlugin.EnsurePhotonEventHooked(); PTLevelRegistry.BorrowValuablePool(EmpressPTPlugin.PTLevel); yield return (object)new WaitForSeconds(0.2f); if (!SemiFunc.IsMultiplayer()) { PTAccess.SetAllPlayersReady(generator, value: true); } while (!PTAccess.GetAllPlayersReady(generator)) { generator.State = (LevelState)1; yield return (object)new WaitForSeconds(0.1f); } yield return (object)new WaitForSeconds(0.2f); generator.Level = RunManager.instance.levelCurrent; PTAccess.SetLevelPrevious(RunManager.instance, generator.Level); generator.Generated = false; PTAccess.SetEnemyReady(generator, value: true); PTAccess.SetModulesSpawned(generator, 0); PTAccess.SetPlayerSpawnedCount(generator, 0); generator.LevelPathPoints = new List(); generator.LevelPathTruck = null; if (Object.op_Implicit((Object)(object)RoundDirector.instance)) { PTAccess.ResetRoundExtraction(RoundDirector.instance); } generator.State = (LevelState)3; _hallwayEventId = ComputeEventId(); BuildHouse(generator); PTRuntime pTRuntime = this; Scene activeScene = SceneManager.GetActiveScene(); pTRuntime._sceneHandle = ((Scene)(ref activeScene)).handle; yield return (object)new WaitForSeconds(0.2f); if (Object.op_Implicit((Object)(object)EnvironmentDirector.Instance)) { EnvironmentDirector.Instance.Setup(); } if (Object.op_Implicit((Object)(object)PostProcessing.Instance)) { PostProcessing.Instance.Setup(); } if (Object.op_Implicit((Object)(object)LevelMusic.instance)) { LevelMusic.instance.Setup(); } if (Object.op_Implicit((Object)(object)ConstantMusic.instance)) { ConstantMusic.instance.Setup(); } if (SemiFunc.IsMasterClientOrSingleplayer()) { NavMeshSurface component = ((Component)generator).GetComponent(); if ((Object)(object)component != (Object)null) { component.collectObjects = (CollectObjects)0; component.useGeometry = (NavMeshCollectGeometry)1; component.layerMask = LayerMask.op_Implicit(-1); component.defaultArea = 0; } generator.NavMeshSetup(); yield return null; while ((Object)(object)GameDirector.instance == (Object)null || GameDirector.instance.PlayerList.Count == 0) { generator.State = (LevelState)12; yield return (object)new WaitForSeconds(0.1f); } generator.PlayerSpawn(); yield return null; while (PTAccess.GetPlayerSpawnedCount(generator) < GameDirector.instance.PlayerList.Count) { generator.State = (LevelState)13; yield return (object)new WaitForSeconds(0.1f); } if ((Object)(object)ValuableDirector.instance != (Object)null && EmpressPTPlugin.Settings.SpawnValuables.Value) { yield return ValuableDirector.instance.SetupHost(); } if (SemiFunc.IsMultiplayer()) { generator.PhotonView.RPC("GenerateDone", (RpcTarget)3, Array.Empty()); } else { PTAccess.GenerateDone(generator); } } else { while (!generator.Generated) { yield return (object)new WaitForSeconds(0.1f); } } yield return (object)new WaitForSeconds(0.5f); Activate(); } private void BuildHouse(LevelGenerator generator) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)generator.LevelParent != (Object)null) { for (int num = generator.LevelParent.transform.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)generator.LevelParent.transform.GetChild(num)).gameObject); } } GameObject val = new GameObject("Empress PT Root"); val.transform.SetParent(generator.LevelParent.transform, false); GameObject val2 = new GameObject("Empress PT Module"); val2.transform.SetParent(val.transform, false); val2.AddComponent().ObservedComponents = new List(); PTAccess.ConfigureStartRoomModule(val2.AddComponent(), 0, 0); val2.AddComponent(); GameObject val3 = new GameObject("Empress PT Room Volume"); val3.transform.SetParent(val2.transform, false); RoomVolume roomVolume = val3.AddComponent(); BoxCollider obj = val3.AddComponent(); ((Collider)obj).isTrigger = true; obj.size = new Vector3(70f, 20f, 70f); obj.center = new Vector3(0f, 8f, 14f); PTPortraits.Initialize(((Object)(object)EmpressPTPlugin.Instance != (Object)null) ? Path.GetDirectoryName(((BaseUnityPlugin)EmpressPTPlugin.Instance).Info.Location) : null); _map = PTMapBuilder.Build(val2.transform, _hallwayEventId); SetupExitDoorNetworking(); GameObject val4 = new GameObject("Empress PT Props"); val4.transform.SetParent(val.transform, false); CollectLights(val2.transform); BuildValuableVolumes(val2.transform); BuildEntity(val4.transform); BuildSpawnPoints(val2.transform, roomVolume, generator); _exitTriggerPoint = ((_map.ExitTriggerPoint == Vector3.zero) ? (_map.ExitDoorPosition + new Vector3(1.75f, 0f, 0f)) : _map.ExitTriggerPoint); } private void SetupExitDoorNetworking() { if (_map != null && !((Object)(object)_map.ExitDoorObject == (Object)null) && SemiFunc.IsMultiplayer() && PhotonNetwork.InRoom) { PhotonView component = _map.ExitDoorObject.GetComponent(); if ((Object)(object)component != (Object)null && component.ViewID != 950) { component.ViewID = 950; } } } internal static string LoadingHintForCurrentRun() { return ObjectiveHint(ComputeEventId()); } internal static int ComputeEventId() { int num = CurrentEventStamp(); int num2 = (num ^ (num >> 15)) * -2048144789; return ((num2 ^ (num2 >> 13)) & 0x7FFFFFFF) % 10; } private static int CurrentEventStamp() { int num = 31; if ((Object)(object)GameDirector.instance != (Object)null) { num = (num * 397) ^ GameDirector.instance.Seed; } if ((Object)(object)RunManager.instance != (Object)null) { num = (num * 397) ^ RunManager.instance.levelsCompleted; if ((Object)(object)RunManager.instance.levelCurrent != (Object)null) { num = (num * 397) ^ StableHash(((Object)RunManager.instance.levelCurrent).name); } } if (PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null) { num = (num * 397) ^ StableHash(PhotonNetwork.CurrentRoom.Name); } return num; } private static string ObjectiveHint(int eventId) { return (Mathf.Abs(eventId) % 10) switch { 0 => "Answer the phone, touch the mirror, then touch the red light.", 1 => "Find three fuses and restore the lights.", 2 => "Use the bathroom mirror, sink, and phone.", 3 => "Inspect the changed portraits.", 4 => "Knock down the hanging shapes.", 5 => "Stand in each cold breath.", 6 => "Follow the blood stains.", 7 => "Touch the moving shadows.", 8 => "Tune the radio and follow the green signals.", _ => "Open the false door, stop the clock, then touch the real door.", }; } private static int StableHash(string text) { int num = 23; if (text == null) { return num; } for (int i = 0; i < text.Length; i++) { num = num * 31 + text[i]; } return num; } private void CollectLights(Transform parent) { _hallLights.Clear(); Light[] componentsInChildren = ((Component)parent).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { _hallLights.Add(componentsInChildren[i]); } } private void BuildValuableVolumes(Transform parent) { //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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (EmpressPTPlugin.Settings.SpawnValuables.Value) { for (int i = 0; i < _map.ValuableSpots.Count; i++) { PTValuableSpot pTValuableSpot = _map.ValuableSpots[i]; GameObject val = new GameObject("Empress PT Valuable Volume"); val.transform.SetParent(parent, false); val.transform.localPosition = pTValuableSpot.Position; Vector3 val2 = ((((Vector3)(ref pTValuableSpot.Forward)).sqrMagnitude > 0.01f) ? pTValuableSpot.Forward : Vector3.forward); val.transform.localRotation = Quaternion.LookRotation(val2, Vector3.up); PTAccess.SetValuableVolumeType(val.AddComponent(), pTValuableSpot.Type); } } } private void BuildEntity(Transform parent) { if (EmpressPTPlugin.Settings.EnableEntity.Value) { _entity = PTEntity.Create(parent, EmpressPTPlugin.Settings.EntityChaseSpeed.Value); _entity.SetState(PTEntityState.Hidden); } } private void BuildSpawnPoints(Transform parent, RoomVolume roomVolume, LevelGenerator generator) { //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_001b: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _map.SpawnPositions.Count; i++) { Vector3 localPosition = _map.SpawnPositions[i]; GameObject val = new GameObject("Empress PT Spawn"); val.transform.SetParent(parent, false); val.transform.localPosition = localPosition; val.transform.localRotation = Quaternion.LookRotation(Vector3.forward, Vector3.up); val.AddComponent(); } LevelPoint val2 = CreateLevelPoint(parent, roomVolume, generator, new Vector3(0f, 1f, 2f), truck: true); LevelPoint val3 = CreateLevelPoint(parent, roomVolume, generator, new Vector3(0f, 1f, 10f), truck: false); val2.ConnectedPoints = new List { val3 }; val3.ConnectedPoints = new List { val2 }; } private static LevelPoint CreateLevelPoint(Transform parent, RoomVolume roomVolume, LevelGenerator generator, Vector3 localPosition, bool truck) { //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_001a: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Empress PT Level Point") { layer = LayerMask.NameToLayer("Other") }; val.transform.SetParent(parent, false); val.transform.localPosition = localPosition; SphereCollider obj = val.AddComponent(); ((Collider)obj).isTrigger = true; obj.radius = 0.35f; LevelPoint val2 = val.AddComponent(); val2.ConnectedPoints = new List(); val2.Room = roomVolume; val2.Truck = truck; val2.ModuleConnect = false; PTAccess.MarkLevelPointInStartRoom(val2, value: true); if (generator.LevelPathPoints == null) { generator.LevelPathPoints = new List(); } generator.LevelPathPoints.Add(val2); return val2; } private void Activate() { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) _active = true; _phase = PTPhase.Exploring; _exitCheckTimer = 0.5f; _entityActive = false; _entitySpawned = false; _entitySpawnTimer = Random.Range(10f, 20f); _entityGraceTimer = 0f; _entityAttackCooldown = 0f; _entityStillApparition = false; _blackoutTimer = 0f; _heartbeatTimer = 1f; _scareTimer = Random.Range(14f, 22f); _levelSwitchTriggered = false; _eventStep = 0; _eventComplete = false; _eventPromptTimer = 0f; _lockedDoorTimer = 0f; _usedEventObjects.Clear(); _lightsEnabled = true; _interactKeyName = ResolveInteractKeyName(); SetDoorLocked(locked: true); _hud.SetVisible(visible: true); _hud.SetBanner(string.Empty, Color.white); StartHallwayEvent(); _flashlightTimer = 0f; SetFlashlightsHidden(hidden: true); StartAmbience(); EmpressPTPlugin.Log.LogInfo((object)("Empress PT activated (" + (SemiFunc.IsMasterClientOrSingleplayer() ? "host" : "client") + "), event " + _hallwayEventId + ".")); } private static string ResolveInteractKeyName() { try { if ((Object)(object)InputManager.instance != (Object)null) { string text = InputManager.instance.InputDisplayGet((InputKey)2, (KeyType)0, (MovementDirection)0); if (!string.IsNullOrWhiteSpace(text) && text != "Unassigned") { return text.ToUpperInvariant(); } } } catch { } return "E"; } private void StartAmbience() { if (!((Object)(object)_ambience == (Object)null) && !((Object)(object)PTAudio.AmbienceClip == (Object)null)) { if ((Object)(object)_ambience.clip != (Object)(object)PTAudio.AmbienceClip) { _ambience.clip = PTAudio.AmbienceClip; } _ambience.volume = 0.4f * ((EmpressPTPlugin.Settings != null) ? EmpressPTPlugin.Settings.MasterVolume.Value : 0.8f); if (!_ambience.isPlaying) { _ambience.Play(); } } } private void StartHallwayEvent() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) Vector3 val = LocalPlayerPosition(); switch (_hallwayEventId) { case 0: _hud.FlashSubtitle("the phone is ringing", 4f); PTAudio.PlayPhoneRing(EventObjectPosition(FindEventObject("phone"))); break; case 1: _hud.FlashSubtitle("the lights need three fuses", 4f); FlickerLights(2f); break; case 2: _hud.FlashSubtitle("the bathroom mirror is waiting", 4f); PTAudio.PlayWhisper(new Vector3(-5f, 1.5f, 12f)); break; case 3: _hud.FlashSubtitle("the portraits changed", 4f); _hud.FlashScreen(new Color(0.15f, 0.1f, 0.06f, 0.28f), 1.2f); PTAudio.PlayWhisper(val); FlickerLights(1.1f); break; case 4: _hud.FlashSubtitle("the hanging shapes are waiting", 4f); _hud.FlashScreen(new Color(0f, 0f, 0f, 0.35f), 1f); PTAudio.PlayKnock(val + LocalForward() * 2f); FlickerLights(1.4f); break; case 5: _hud.FlashSubtitle("the hallway is breathing", 4f); _hud.FlashScreen(new Color(0.5f, 0.75f, 1f, 0.32f), 1.6f); FlickerLights(1.8f); PTAudio.PlayHeartbeat(val); break; case 6: _hud.FlashSubtitle("the trail is fresh", 4f); _hud.FlashScreen(new Color(0.4f, 0f, 0f, 0.22f), 1f); PTAudio.PlaySting(val); break; case 7: _hud.FlashSubtitle("the shadow moved", 4f); PTAudio.PlayHeartbeat(val); break; case 8: _hud.FlashSubtitle("the radio found a signal", 4f); PTAudio.PlayStatic(val + LocalForward() * 3f); FlickerLights(1.4f); break; default: _hud.FlashSubtitle("the false door is open", 4f); _hud.FlashScreen(new Color(0.3f, 0.24f, 0.14f, 0.22f), 1.2f); PTAudio.PlayWhisper(val); FlickerLights(1.2f); break; } } private void StopAmbience() { if ((Object)(object)_ambience != (Object)null && _ambience.isPlaying) { _ambience.Stop(); } } private void PrepareExitDoorForTransition() { //IL_0079: 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) if (_map != null && !((Object)(object)_map.ExitDoorObject == (Object)null)) { PhysGrabObject component = _map.ExitDoorObject.GetComponent(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = false; } PhysGrabObjectImpactDetector component2 = _map.ExitDoorObject.GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = false; } Rigidbody component3 = _map.ExitDoorObject.GetComponent(); if ((Object)(object)component3 != (Object)null) { component3.velocity = Vector3.zero; component3.angularVelocity = Vector3.zero; component3.isKinematic = true; } Collider[] componentsInChildren = _map.ExitDoorObject.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } PhotonView component4 = _map.ExitDoorObject.GetComponent(); if (SemiFunc.IsMultiplayer() && PhotonNetwork.InRoom && (Object)(object)component4 != (Object)null && component4.ViewID != 0) { PhotonNetwork.RemoveBufferedRPCs(component4.ViewID, (string)null, (int[])null); } } } private void SyncEntity(bool force) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (_entity == null || !SemiFunc.IsMultiplayer() || !PhotonNetwork.InRoom || !PhotonNetwork.IsMasterClient) { return; } if (!force) { if (Time.time < _entitySyncTimer) { return; } _entitySyncTimer = Time.time + 0.12f; } EmpressPTPlugin.RaiseEntity(new object[6] { 0, _entityActive, (int)_entity.State, _entity.Position, _entity.Rotation, _entityStillApparition }); } internal void ReceiveEntity(object[] data) { //IL_0071: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00fc: Unknown result type (might be due to invalid IL or missing references) if (data == null || data.Length < 6 || SemiFunc.IsMasterClientOrSingleplayer() || _entity == null) { return; } object obj = data[0]; if (obj is int && (int)obj == 0 && data[1] is bool flag && data[2] is int num && data[3] is Vector3 position && data[4] is Quaternion rotation && data[5] is bool entityStillApparition) { PTEntityState pTEntityState = (PTEntityState)Mathf.Clamp(num, 0, 2); _entitySpawned = true; _entityActive = flag && pTEntityState != PTEntityState.Hidden; _entityStillApparition = entityStillApparition; _entityGraceTimer = 0f; if (pTEntityState == PTEntityState.Hidden) { _entity.SetState(PTEntityState.Hidden); return; } Vector3 position2 = GroundEntitySpot(position); _entity.PlaceAt(position2, rotation); _entity.SetState(pTEntityState); } } private void Deactivate() { if (_active) { _active = false; _phase = PTPhase.Waiting; StopAmbience(); PrepareExitDoorForTransition(); if (_entity != null) { _entity.Dispose(); _entity = null; } if ((Object)(object)_apparition != (Object)null) { Object.Destroy((Object)(object)_apparition); _apparition = null; } _hallLights.Clear(); SetFlashlightsHidden(hidden: false); _hud.SetVisible(visible: false); _map = null; _lightsEnabled = true; _entityAttackCooldown = 0f; _entityStillApparition = false; } } private void HandleSceneTransition() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); int handle = ((Scene)(ref activeScene)).handle; if (handle != _sceneHandle) { _sceneHandle = handle; if (_active) { Deactivate(); } else { _hud.SetVisible(visible: false); } } } private static void SetFlashlightsHidden(bool hidden) { FlashlightController[] array = Object.FindObjectsOfType(); foreach (FlashlightController val in array) { if ((Object)(object)val != (Object)null && PTAccess.GetFlashlightHidden(val) != hidden) { PTAccess.SetFlashlightHidden(val, hidden); } } } } }