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.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Empress")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EmpressBackrooms")] [assembly: AssemblyTitle("EmpressBackrooms")] [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.Backrooms { internal static class BackroomsAccess { private delegate void ModuleSetAllChecklistDelegate(Module module); private delegate void LevelGeneratorGenerateDoneDelegate(LevelGenerator instance, PhotonMessageInfo info); private static readonly FieldInfo EnvironmentSetupDoneField = AccessTools.Field(typeof(EnvironmentDirector), "SetupDone"); private static readonly FieldInfo EnvironmentMainCameraField = AccessTools.Field(typeof(EnvironmentDirector), "MainCamera"); private static readonly FieldInfo EnvironmentAmbientColorField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColor"); private static readonly FieldInfo EnvironmentAmbientColorNewField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorNew"); private static readonly FieldInfo EnvironmentAmbientColorPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorPrevious"); private static readonly FieldInfo EnvironmentAmbientColorAdaptationField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptation"); private static readonly FieldInfo EnvironmentAmbientColorAdaptationNewField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptationNew"); private static readonly FieldInfo EnvironmentAmbientColorAdaptationPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptationPrevious"); private static readonly FieldInfo EnvironmentDarkAdaptationLerpField = AccessTools.Field(typeof(EnvironmentDirector), "DarkAdaptationLerp"); private static readonly FieldInfo EnvironmentFogColorField = AccessTools.Field(typeof(EnvironmentDirector), "FogColor"); private static readonly FieldInfo EnvironmentFogColorNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogColorNew"); private static readonly FieldInfo EnvironmentFogColorPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogColorPrevious"); private static readonly FieldInfo EnvironmentFogStartDistanceField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistance"); private static readonly FieldInfo EnvironmentFogStartDistanceNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistanceNew"); private static readonly FieldInfo EnvironmentFogStartDistancePreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistancePrevious"); private static readonly FieldInfo EnvironmentFogEndDistanceField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistance"); private static readonly FieldInfo EnvironmentFogEndDistanceNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistanceNew"); private static readonly FieldInfo EnvironmentFogEndDistancePreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistancePrevious"); private static readonly FieldInfo LevelGeneratorAllPlayersReadyField = AccessTools.Field(typeof(LevelGenerator), "AllPlayersReady"); private static readonly FieldInfo LevelGeneratorEnemyReadyField = AccessTools.Field(typeof(LevelGenerator), "EnemyReady"); private static readonly FieldInfo LevelGeneratorModulesSpawnedField = AccessTools.Field(typeof(LevelGenerator), "ModulesSpawned"); private static readonly FieldInfo LevelGeneratorPlayerSpawnedField = AccessTools.Field(typeof(LevelGenerator), "playerSpawned"); private static readonly FieldInfo RunManagerLevelPreviousField = AccessTools.Field(typeof(RunManager), "levelPrevious"); private static readonly FieldInfo PlayerAvatarIsDisabledField = AccessTools.Field(typeof(PlayerAvatar), "isDisabled"); private static readonly FieldInfo PlayerAvatarDeadSetField = AccessTools.Field(typeof(PlayerAvatar), "deadSet"); private static readonly FieldInfo PlayerAvatarTumbleField = AccessTools.Field(typeof(PlayerAvatar), "tumble"); private static readonly FieldInfo RoundDirectorExtractionPointsField = AccessTools.Field(typeof(RoundDirector), "extractionPoints"); private static readonly FieldInfo RoundDirectorExtractionPointsCompletedField = AccessTools.Field(typeof(RoundDirector), "extractionPointsCompleted"); private static readonly FieldInfo RoundDirectorExtractionPointListField = AccessTools.Field(typeof(RoundDirector), "extractionPointList"); private static readonly FieldInfo RoundDirectorHaulGoalField = AccessTools.Field(typeof(RoundDirector), "haulGoal"); private static readonly FieldInfo RoundDirectorHaulGoalMaxField = AccessTools.Field(typeof(RoundDirector), "haulGoalMax"); private static readonly FieldInfo RoundDirectorExtractionPointActiveField = AccessTools.Field(typeof(RoundDirector), "extractionPointActive"); private static readonly FieldInfo RoundDirectorAllExtractionCompletedField = AccessTools.Field(typeof(RoundDirector), "allExtractionPointsCompleted"); private static readonly FieldInfo ValuableDirectorTargetAmountField = AccessTools.Field(typeof(ValuableDirector), "valuableTargetAmount"); private static readonly FieldInfo ValuableDirectorTotalMaxValueField = AccessTools.Field(typeof(ValuableDirector), "totalMaxValue"); private static readonly FieldInfo LevelValuablesTinyField = AccessTools.Field(typeof(LevelValuables), "tiny"); private static readonly FieldInfo LevelValuablesSmallField = AccessTools.Field(typeof(LevelValuables), "small"); private static readonly FieldInfo LevelValuablesMediumField = AccessTools.Field(typeof(LevelValuables), "medium"); private static readonly FieldInfo LevelValuablesBigField = AccessTools.Field(typeof(LevelValuables), "big"); private static readonly FieldInfo LevelValuablesWideField = AccessTools.Field(typeof(LevelValuables), "wide"); private static readonly FieldInfo LevelValuablesTallField = AccessTools.Field(typeof(LevelValuables), "tall"); private static readonly FieldInfo LevelValuablesVeryTallField = AccessTools.Field(typeof(LevelValuables), "veryTall"); private static readonly FieldInfo LevelValuablePresetsField = AccessTools.Field(typeof(Level), "ValuablePresets"); private static readonly FieldInfo ModuleSetupDoneField = AccessTools.Field(typeof(Module), "SetupDone"); private static readonly FieldInfo ModuleStartRoomField = AccessTools.Field(typeof(Module), "StartRoom"); private static readonly FieldInfo ModuleGridXField = AccessTools.Field(typeof(Module), "GridX"); private static readonly FieldInfo ModuleGridYField = AccessTools.Field(typeof(Module), "GridY"); private static readonly FieldInfo ModuleFirstField = AccessTools.Field(typeof(Module), "First"); private static readonly FieldInfo LevelPointInStartRoomField = AccessTools.Field(typeof(LevelPoint), "inStartRoom"); private static readonly FieldInfo ItemAttributesHasIconField = AccessTools.Field(typeof(ItemAttributes), "hasIcon"); 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 bool GetIsDisabled(PlayerAvatar avatar) { return GetBool(PlayerAvatarIsDisabledField, avatar); } public static bool GetDeadSet(PlayerAvatar avatar) { return GetBool(PlayerAvatarDeadSetField, avatar); } public static PlayerTumble GetPlayerTumble(PlayerAvatar avatar) { return Get(PlayerAvatarTumbleField, avatar); } public static int GetValuableTargetAmount(ValuableDirector director) { return GetInt(ValuableDirectorTargetAmountField, director); } public static float GetValuableTotalMaxValue(ValuableDirector director) { if (ValuableDirectorTotalMaxValueField == null || (Object)(object)director == (Object)null) { return 0f; } object value = ValuableDirectorTotalMaxValueField.GetValue(director); if (value is float) { return (float)value; } return 0f; } public static int GetHaulGoal(RoundDirector director) { return GetInt(RoundDirectorHaulGoalField, director); } public static int GetHaulGoalMax(RoundDirector director) { return GetInt(RoundDirectorHaulGoalMaxField, director); } public static void SetHaulGoal(RoundDirector director, int value) { SetField(RoundDirectorHaulGoalField, director, value); } public static bool GetExtractionPointActive(RoundDirector director) { return GetBool(RoundDirectorExtractionPointActiveField, director); } public static bool GetAllExtractionPointsCompleted(RoundDirector director) { return GetBool(RoundDirectorAllExtractionCompletedField, director); } public static void ResetRoundExtraction(RoundDirector director) { SetField(RoundDirectorExtractionPointsField, director, 0); SetField(RoundDirectorExtractionPointsCompletedField, director, 0); Get>(RoundDirectorExtractionPointListField, director)?.Clear(); } public static List GetValuablePresets(Level level) { return Get>(LevelValuablePresetsField, level); } 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 Get>((int)type switch { 0 => LevelValuablesTinyField, 1 => LevelValuablesSmallField, 2 => LevelValuablesMediumField, 3 => LevelValuablesBigField, 4 => LevelValuablesWideField, 5 => LevelValuablesTallField, _ => LevelValuablesVeryTallField, }, valuables); } public static void SetValuablePresets(Level level, List presets) { SetField(LevelValuablePresetsField, level, presets); } public static bool PresetHasContent(LevelValuables preset) { if ((Object)(object)preset == (Object)null) { return false; } if (CountList(LevelValuablesTinyField, preset) <= 0 && CountList(LevelValuablesSmallField, preset) <= 0 && CountList(LevelValuablesMediumField, preset) <= 0 && CountList(LevelValuablesBigField, preset) <= 0 && CountList(LevelValuablesWideField, preset) <= 0 && CountList(LevelValuablesTallField, preset) <= 0) { return CountList(LevelValuablesVeryTallField, preset) > 0; } return true; } public static void ConfigureStartRoomModule(Module module, int gridX, int gridY) { ModuleSetAllChecklistCall?.Invoke(module); SetField(ModuleSetupDoneField, module, true); SetField(ModuleStartRoomField, module, true); SetField(ModuleFirstField, module, true); SetField(ModuleGridXField, module, gridX); SetField(ModuleGridYField, module, gridY); } public static void MarkLevelPointInStartRoom(LevelPoint point, bool value) { SetField(LevelPointInStartRoomField, point, value); } public static bool GetItemHasIcon(ItemAttributes attributes) { return GetBool(ItemAttributesHasIconField, attributes); } public static void GenerateDone(LevelGenerator generator) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) LevelGeneratorGenerateDoneCall?.Invoke(generator, default(PhotonMessageInfo)); } private static int CountList(FieldInfo field, object instance) { if (!(((field != null && instance != null) ? field.GetValue(instance) : null) is ICollection collection)) { return 0; } return collection.Count; } private static T Get(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 BackroomsAudio { private const int SampleRate = 44100; private static AudioClip _hum; private static AudioClip _growl; private static AudioClip _hit; private static AudioClip _death; private static AudioClip _shift; private static AudioClip _drip; private static AudioClip _sting; private static AudioClip _whisper; private static AudioClip _bang; private static AudioClip _buzz; private static AudioClip _footstep; private static AudioClip _scream; private static AudioClip _charge; private static bool _initialized; public static AudioClip HumClip => _hum; public static void Initialize() { if (!_initialized) { _initialized = true; _hum = BuildHum(); _growl = BuildGrowl(); _hit = BuildHit(); _death = BuildDeath(); _shift = BuildShift(); _drip = BuildDrip(); _sting = BuildSting(); _whisper = BuildWhisper(); _bang = BuildBang(); _buzz = BuildBuzz(); _footstep = BuildFootstep(); _scream = BuildScream(); _charge = BuildCharge(); } } public static void PlayGrowl(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_growl, position, 0.55f, 0.8f, 1.05f); } public static void PlayHit(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_hit, position, 0.7f, 0.9f, 1.1f); } public static void PlayDeath(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_death, position, 0.8f, 0.9f, 1.05f); } public static void PlayShift(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_shift, position, 0.9f, 0.98f, 1.02f); } public static void PlayDrip(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_drip, position, 0.4f, 0.85f, 1.2f); } public static void PlaySting(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_sting, position, 0.6f, 0.95f, 1.05f); } public static void PlayWhisper(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_whisper, position, 0.5f, 0.92f, 1.12f); } public static void PlayBang(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_bang, position, 0.85f, 0.85f, 1f); } public static void PlayBuzz(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_buzz, position, 0.5f, 0.9f, 1.15f); } public static void PlayFootstep(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_footstep, position, 0.45f, 0.9f, 1.1f); } public static void PlayScream(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_scream, position, 0.7f, 0.92f, 1.08f); } public static void PlayCharge(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_charge, position, 1f, 0.95f, 1.05f); } 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 = ((EmpressBackroomsPlugin.Settings != null) ? EmpressBackroomsPlugin.Settings.MasterVolume.Value : 0.85f); if (!(num <= 0f)) { GameObject val = new GameObject("Empress Backrooms 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 = 2f; val2.maxDistance = 32f; val2.dopplerLevel = 0f; val2.Play(); Object.Destroy((Object)val, clip.length / Mathf.Max(0.5f, val2.pitch) + 0.2f); } } } private static AudioClip MakeClip(string name, float[] data) { AudioClip obj = AudioClip.Create(name, data.Length, 1, 44100, false); obj.SetData(data, 0); return obj; } private static AudioClip BuildHum() { int num = 176400; int num2 = 13230; float[] array = new float[num + num2]; for (int i = 0; i < array.Length; i++) { float num3 = (float)i / 44100f; float num4 = Mathf.Sin(MathF.PI * 120f * num3) * 0.5f; float num5 = Mathf.Sin(MathF.PI * 240f * num3) * 0.28f; float num6 = Mathf.Sign(Mathf.Sin(MathF.PI * 240f * num3)) * 0.05f; float num7 = 0.85f + 0.15f * Mathf.PerlinNoise(num3 * 7f, 0f); array[i] = (num4 + num5 + num6) * 0.18f * num7; } float[] array2 = new float[num]; Array.Copy(array, array2, num); for (int j = 0; j < num2; j++) { float num8 = (float)j / (float)num2; array2[j] = array2[j] * num8 + array[num + j] * (1f - num8); } return MakeClip("EmpressBackroomsHum", array2); } private static AudioClip BuildGrowl() { int num = 57329; float[] array = new float[num]; float num2 = 0f; float num3 = Random.Range(0f, 40f); for (int i = 0; i < num; i++) { float num4 = (float)i / 44100f; float num5 = num4 / 1.3f; float num6 = 70f + 30f * Mathf.PerlinNoise(num3, num4 * 5f) - 20f * num5; num2 += MathF.PI * 2f * num6 / 44100f; float num7 = Mathf.Sin(num2) + 0.4f * Mathf.Sin(num2 * 2.5f); float num8 = (Mathf.PerlinNoise(num3 + 3f, num4 * 60f) - 0.5f) * 0.5f; float num9 = Mathf.Sin(num5 * MathF.PI); array[i] = Mathf.Clamp((num7 * 0.4f + num8) * num9, -1f, 1f) * 0.6f; } return MakeClip("EmpressBackroomsGrowl", array); } private static AudioClip BuildHit() { int num = 15435; float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = Mathf.Exp((0f - num2) / 0.06f); float num4 = Mathf.Sin(MathF.PI * 360f * num2); float num5 = (Random.value * 2f - 1f) * Mathf.Exp((0f - num2) / 0.03f); array[i] = Mathf.Clamp((num4 * 0.5f + num5 * 0.6f) * num3, -1f, 1f) * 0.7f; } return MakeClip("EmpressBackroomsHit", array); } private static AudioClip BuildDeath() { int num = 48510; float[] array = new float[num]; float num2 = 0f; for (int i = 0; i < num; i++) { float num3 = (float)i / 44100f; float num4 = num3 / 1.1f; float num5 = 220f * Mathf.Exp((0f - num4) * 2.2f) + 40f; num2 += MathF.PI * 2f * num5 / 44100f; float num6 = Mathf.Sin(num2) + 0.3f * Mathf.Sin(num2 * 3.1f); float num7 = (Mathf.PerlinNoise(7f, num3 * 40f) - 0.5f) * (1f - num4); float num8 = Mathf.Exp((0f - num4) * 2.5f); array[i] = Mathf.Clamp((num6 * 0.4f + num7) * num8, -1f, 1f) * 0.65f; } return MakeClip("EmpressBackroomsDeath", array); } private static AudioClip BuildShift() { int num = 105840; float[] array = new float[num]; float num2 = 0f; for (int i = 0; i < num; i++) { float num3 = (float)i / 44100f; float num4 = num3 / 2.4f; float num5 = 28f + 14f * Mathf.Sin(num4 * MathF.PI); num2 += MathF.PI * 2f * num5 / 44100f; float num6 = Mathf.Sin(num2); float num7 = (Mathf.PerlinNoise(2f, num3 * 3f) - 0.5f) * 0.4f; float num8 = Mathf.Sin(num4 * MathF.PI); array[i] = Mathf.Clamp((num6 * 0.7f + num7) * num8, -1f, 1f) * 0.7f; } return MakeClip("EmpressBackroomsShift", array); } private static AudioClip BuildDrip() { int num = 26460; float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = 150f + 360f * Mathf.Exp((0f - num2) / 0.018f); float num4 = Mathf.Exp((0f - num2) / 0.09f); float num5 = Mathf.Sin(MathF.PI * 2f * num3 * num2); float num6 = Mathf.Sin(MathF.PI * 392f * num2) * Mathf.Exp((0f - num2) / 0.16f) * 0.3f; array[i] = (num5 * num4 + num6) * 0.34f; } return MakeClip("EmpressBackroomsDrip", array); } private static AudioClip BuildSting() { int num = 52920; float[] array = new float[num]; float[] array2 = new float[4] { 196f, 207f, 233f, 311f }; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = num2 / 1.2f; float num4 = ((num3 < 0.2f) ? (num3 / 0.2f) : Mathf.Exp((0f - (num3 - 0.2f)) * 3f)); float num5 = 0f; for (int j = 0; j < array2.Length; j++) { num5 += Mathf.Sin(MathF.PI * 2f * array2[j] * num2 + (float)j); } array[i] = Mathf.Clamp(num5 * 0.18f * num4, -1f, 1f) * 0.6f; } return MakeClip("EmpressBackroomsSting", array); } private static AudioClip BuildWhisper() { int num = 70560; float[] array = new float[num]; float num2 = Random.Range(0f, 50f); float num3 = 0f; for (int i = 0; i < num; i++) { float num4 = (float)i / 44100f; float num5 = num4 / 1.6f; float num6 = Random.value * 2f - 1f; num3 = num3 * 0.82f + num6 * 0.18f; float num7 = 1f + 0.6f * Mathf.Sin(MathF.PI * 9f * num4 + num2); float num8 = (Random.value * 2f - 1f) * 0.3f * Mathf.PerlinNoise(num2, num4 * 24f); float num9 = Mathf.Clamp01(Mathf.PerlinNoise(num2 + 9f, num4 * 6f) * 1.6f - 0.3f); float num10 = Mathf.Sin(num5 * MathF.PI); array[i] = Mathf.Clamp((num3 * num7 + num8) * num9 * num10, -1f, 1f) * 0.5f; } return MakeClip("EmpressBackroomsWhisper", array); } private static AudioClip BuildBang() { int num = 61740; float[] array = new float[num]; float num2 = 0f; for (int i = 0; i < num; i++) { float num3 = (float)i / 44100f; float num4 = 90f * Mathf.Exp((0f - num3) / 0.08f) + 32f; num2 += MathF.PI * 2f * num4 / 44100f; float num5 = Mathf.Sin(num2); float num6 = (Random.value * 2f - 1f) * Mathf.Exp((0f - num3) / 0.012f); float num7 = Mathf.Sin(MathF.PI * 96f * num3) * Mathf.Exp((0f - num3) / 0.5f) * 0.25f; float num8 = Mathf.Exp((0f - num3) / 0.32f); array[i] = Mathf.Clamp((num5 * 0.7f + num6 * 0.5f) * num8 + num7, -1f, 1f) * 0.8f; } return MakeClip("EmpressBackroomsBang", array); } private static AudioClip BuildBuzz() { int num = 39690; float[] array = new float[num]; float num2 = Random.Range(0f, 30f); for (int i = 0; i < num; i++) { float num3 = (float)i / 44100f; float num4 = num3 / 0.9f; float num5 = Mathf.Sign(Mathf.Sin(MathF.PI * 240f * num3)); float num6 = Mathf.Sign(Mathf.Sin(MathF.PI * 720f * num3)) * 0.4f; float num7 = ((Mathf.PerlinNoise(num2, num3 * 90f) > 0.45f) ? 1f : 0.2f); float num8 = (Random.value * 2f - 1f) * 0.35f * ((Mathf.PerlinNoise(num2 + 5f, num3 * 200f) > 0.6f) ? 1f : 0f); float num9 = (1f - num4) * (0.6f + 0.4f * Mathf.Sin(MathF.PI * 26f * num3)); array[i] = Mathf.Clamp(((num5 + num6) * num7 * 0.3f + num8) * num9, -1f, 1f) * 0.5f; } return MakeClip("EmpressBackroomsBuzz", array); } private static AudioClip BuildFootstep() { int num = 13230; float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = Mathf.Sin(MathF.PI * 190f * num2) * Mathf.Exp((0f - num2) / 0.05f); float num4 = (Random.value * 2f - 1f) * Mathf.Exp((0f - num2) / 0.02f) * 0.4f; array[i] = Mathf.Clamp(num3 * 0.7f + num4, -1f, 1f) * 0.55f; } return MakeClip("EmpressBackroomsFootstep", array); } private static AudioClip BuildScream() { int num = 66150; float[] array = new float[num]; float num2 = 0f; float num3 = Random.Range(0f, 20f); for (int i = 0; i < num; i++) { float num4 = (float)i / 44100f; float num5 = num4 / 1.5f; float num6 = 1f + 0.06f * Mathf.Sin(MathF.PI * 13f * num4); float num7 = (300f + 240f * Mathf.Sin(num5 * MathF.PI * 0.7f)) * num6; num2 += MathF.PI * 2f * num7 / 44100f; float num8 = Mathf.Sin(num2) + 0.5f * Mathf.Sin(num2 * 2f) + 0.3f * Mathf.Sin(num2 * 3f); float num9 = (Mathf.PerlinNoise(num3, num4 * 70f) - 0.5f) * 0.4f; float num10 = ((num5 < 0.15f) ? (num5 / 0.15f) : Mathf.Exp((0f - (num5 - 0.15f)) * 2.2f)); array[i] = Mathf.Clamp((num8 * 0.3f + num9) * num10, -1f, 1f) * 0.6f; } return MakeClip("EmpressBackroomsScream", array); } private static AudioClip BuildCharge() { int num = 83790; float[] array = new float[num]; float num2 = 0f; float num3 = Random.Range(0f, 25f); for (int i = 0; i < num; i++) { float num4 = (float)i / 44100f; float num5 = num4 / 1.9f; float num6 = 42f + 70f * num5 + 8f * Mathf.PerlinNoise(num3, num4 * 6f); num2 += MathF.PI * 2f * num6 / 44100f; float num7 = Mathf.Sin(num2) + 0.5f * Mathf.Sin(num2 * 2f) + 0.3f * Mathf.Sin(num2 * 3.01f); float num8 = Mathf.Sign(Mathf.Sin(num2 * 1.5f)) * 0.18f; float num9 = (Mathf.PerlinNoise(num3 + 4f, num4 * 50f) - 0.5f) * 0.6f; float num10 = Mathf.Clamp01(num5 * 3f) * (1f - 0.3f * num5); array[i] = Mathf.Clamp((num7 * 0.32f + num8 + num9) * num10, -1f, 1f) * 0.85f; } return MakeClip("EmpressBackroomsCharge", array); } } internal enum BackroomsElevatorState { Boarding, Descending, Arrived, ReturnOpen, ReturnClosing, ReturnDeparting } internal sealed class BackroomsElevator : MonoBehaviour { private const float DescentDuration = 10f; private const float Thickness = 0.3f; private BackroomsMap _map; private Transform _leftPanel; private Transform _rightPanel; private Material _buttonLens; private float _half; private float _frontZ; private float _leftClosedX; private float _rightClosedX; private float _leftOpenX; private float _rightOpenX; private float _panelZ; private BackroomsElevatorState _state; private float _doorOpen; private float _descentTimer; private float _promptTimer; private float _effectTimer; private float _exitTimer; private int _lastCountdown = -1; private bool _sealed; private bool _returnMode; private float _returnCountdown; private float _departTimer; private float _healTimer; private int _lastReturnCount = -1; private bool _departed; private bool _outsideKilled; public static BackroomsElevator Create(Transform parent, BackroomsMap map) { //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) GameObject val = new GameObject("Empress Backrooms Elevator"); val.transform.SetParent(parent, false); BackroomsElevator backroomsElevator = val.AddComponent(); backroomsElevator._map = map; backroomsElevator.Build(); return backroomsElevator; } public static BackroomsElevator CreateReturn(Transform parent, BackroomsMap map) { //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) GameObject val = new GameObject("Empress Backrooms Exit Elevator"); val.transform.SetParent(parent, false); BackroomsElevator backroomsElevator = val.AddComponent(); backroomsElevator._map = map; backroomsElevator._returnMode = true; backroomsElevator._state = BackroomsElevatorState.ReturnOpen; backroomsElevator.Build(); backroomsElevator._doorOpen = 1f; backroomsElevator.ApplyDoor(); return backroomsElevator; } private void Build() { //IL_0063: 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) //IL_00a4: 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_00e5: 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_0128: 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_0159: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_020e: 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_0254: Unknown result type (might be due to invalid IL or missing references) //IL_027d: 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_02cf: 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_030f: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) _half = _map.ElevatorDoorHalfWidth; _frontZ = _map.ElevatorDoorCenter.z; float num = _frontZ - 5.25f; float num2 = (_frontZ + num) * 0.5f; float num3 = _frontZ - num; float num4 = 3f; Box("Car Floor", new Vector3(0f, -0.15f, num2), new Vector3(_half * 2f + 0.3f, 0.3f, num3), BackroomsMaterials.ConcreteMaterial, solid: true); Box("Car Ceiling", new Vector3(0f, num4 + 0.15f, num2), new Vector3(_half * 2f + 0.3f, 0.3f, num3), BackroomsMaterials.ConcreteMaterial, solid: true); Box("Car Back", new Vector3(0f, num4 * 0.5f, num), new Vector3(_half * 2f + 0.3f, num4, 0.3f), BackroomsMaterials.MetalPanelMaterial, solid: true); Box("Car West", new Vector3(0f - _half, num4 * 0.5f, num2), new Vector3(0.3f, num4, num3), BackroomsMaterials.MetalPanelMaterial, solid: true); Box("Car East", new Vector3(_half, num4 * 0.5f, num2), new Vector3(0.3f, num4, num3), BackroomsMaterials.MetalPanelMaterial, solid: true); Box("Car Trim Back", new Vector3(0f, 1.1f, num + 0.06f), new Vector3(_half * 2f, 0.1f, 0.06f), BackroomsMaterials.TrimMaterial, solid: false); Light obj = new GameObject("Car Light").AddComponent(); ((Component)obj).transform.SetParent(((Component)this).transform, false); ((Component)obj).transform.localPosition = new Vector3(0f, num4 - 0.25f, num2); obj.type = (LightType)2; obj.color = new Color(0.9f, 0.95f, 1f); obj.intensity = 1.3f; obj.range = 8f; Box("Car Light Panel", new Vector3(0f, num4 - 0.07f, num2), new Vector3(1.4f, 0.08f, 1.4f), BackroomsMaterials.FluorescentOnMaterial, solid: false); Box("Door Frame Header", new Vector3(0f, num4 - 0.18f, _frontZ), new Vector3(_half * 2f + 0.4f, 0.36f, 0.16f), BackroomsMaterials.TrimMaterial, solid: true); Box("Door Frame West", new Vector3(0f - _half - 0.08f, num4 * 0.5f, _frontZ), new Vector3(0.16f, num4, 0.16f), BackroomsMaterials.TrimMaterial, solid: true); Box("Door Frame East", new Vector3(_half + 0.08f, num4 * 0.5f, _frontZ), new Vector3(0.16f, num4, 0.16f), BackroomsMaterials.TrimMaterial, solid: true); _panelZ = _frontZ - 0.12f; float num5 = num4 - 0.12f; _leftClosedX = (0f - _half) * 0.5f; _rightClosedX = _half * 0.5f; _leftOpenX = 0f - _half - 0.42f; _rightOpenX = _half + 0.42f; _leftPanel = Box("Door Panel Left", new Vector3(_leftClosedX, num5 * 0.5f, _panelZ), new Vector3(_half + 0.02f, num5, 0.12f), BackroomsMaterials.MetalPanelMaterial, solid: true).transform; _rightPanel = Box("Door Panel Right", new Vector3(_rightClosedX, num5 * 0.5f, _panelZ), new Vector3(_half + 0.02f, num5, 0.12f), BackroomsMaterials.MetalPanelMaterial, solid: true).transform; Box("Door Seam Left", new Vector3(0f, num5 * 0.5f, _panelZ - 0.07f), new Vector3(0.04f, num5 - 0.1f, 0.02f), BackroomsMaterials.TrimMaterial, solid: false).transform.SetParent(_leftPanel, true); Box("Door Seam Right", new Vector3(0f, num5 * 0.5f, _panelZ - 0.07f), new Vector3(0.04f, num5 - 0.1f, 0.02f), BackroomsMaterials.TrimMaterial, solid: false).transform.SetParent(_rightPanel, true); Vector3 elevatorButtonAnchor = _map.ElevatorButtonAnchor; Box("Button Housing", elevatorButtonAnchor, new Vector3(0.1f, 0.42f, 0.3f), BackroomsMaterials.TrimMaterial, solid: false); _buttonLens = BackroomsMaterials.CreateEmissive(new Color(0.4f, 1f, 0.5f), 2.4f); Box("Button Lens", elevatorButtonAnchor + new Vector3(-0.07f, 0.04f, 0f), new Vector3(0.04f, 0.16f, 0.16f), _buttonLens, solid: false); ApplyDoor(); } private GameObject Box(string name, Vector3 localPosition, Vector3 size, Material material, bool solid) { //IL_0026: 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) GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = name; val.transform.SetParent(((Component)this).transform, false); val.transform.localPosition = localPosition; val.transform.localScale = size; Renderer component = val.GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)material != (Object)null) { component.sharedMaterial = material; } if (!solid) { Collider component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } } return val; } private void Update() { if (!_sealed) { float deltaTime = Time.deltaTime; bool flag = SemiFunc.IsMasterClientOrSingleplayer(); float num = ((_state == BackroomsElevatorState.Arrived || _state == BackroomsElevatorState.ReturnOpen || _state == BackroomsElevatorState.ReturnClosing) ? 1f : 0f); _doorOpen = Mathf.MoveTowards(_doorOpen, num, deltaTime * 0.85f); ApplyDoor(); if (_returnMode) { UpdateReturn(deltaTime, flag); } else if (_state == BackroomsElevatorState.Boarding) { UpdateBoarding(deltaTime); } else if (_state == BackroomsElevatorState.Descending) { UpdateDescending(deltaTime, flag); } else if (_state == BackroomsElevatorState.Arrived && flag) { UpdateArrived(deltaTime); } UpdateButtonGlow(); } } private void ApplyDoor() { //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_003e: 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_0082: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_leftPanel != (Object)null) { Vector3 localPosition = _leftPanel.localPosition; localPosition.x = Mathf.Lerp(_leftClosedX, _leftOpenX, _doorOpen); _leftPanel.localPosition = localPosition; } if ((Object)(object)_rightPanel != (Object)null) { Vector3 localPosition2 = _rightPanel.localPosition; localPosition2.x = Mathf.Lerp(_rightClosedX, _rightOpenX, _doorOpen); _rightPanel.localPosition = localPosition2; } } private void UpdateBoarding(float dt) { //IL_0016: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = LocalAvatar(); if (!((Object)(object)val == (Object)null) && !(Vector3.Distance(((Component)val).transform.position, _map.ElevatorButtonAnchor) > 2.4f)) { _promptTimer -= dt; if (_promptTimer <= 0f) { _promptTimer = 2.5f; SemiFunc.UIFocusText("Press [Interact] to descend.", new Color(0.6f, 1f, 0.7f), Color.white, 2.5f); } if (SemiFunc.InputDown((InputKey)2)) { RequestDescent(); } } } private void RequestDescent() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (_state == BackroomsElevatorState.Boarding) { if (!AllAboard()) { SemiFunc.UIFocusText("Wait for everyone to step inside.", new Color(1f, 0.8f, 0.4f), Color.white, 2.5f); BackroomsAudio.PlayHit(_map.ElevatorButtonAnchor); } else if (SemiFunc.IsMasterClientOrSingleplayer()) { BeginDescent(); } else { EmpressBackroomsPlugin.RaiseToOthers(195, new object[1] { 1 }); } } } private void BeginDescent() { if (_state == BackroomsElevatorState.Boarding && AllAboard()) { _descentTimer = 10f; SetState(BackroomsElevatorState.Descending); EmpressBackroomsPlugin.RaiseToAll(195, new object[2] { 0, 1 }); } } private void UpdateDescending(float dt, bool host) { //IL_0065: 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) _effectTimer -= dt; if (_effectTimer <= 0f) { _effectTimer = 0.5f; SemiFunc.CameraShakeImpact(1.4f, 0.4f); if (Random.value > 0.5f) { BackroomsAudio.PlayShift(((Object)(object)LocalAvatar() != (Object)null) ? ((Component)LocalAvatar()).transform.position : ((Component)this).transform.position); } } if (host) { _descentTimer -= dt; int num = Mathf.Clamp(Mathf.CeilToInt(_descentTimer), 0, 10); if (num != _lastCountdown) { _lastCountdown = num; EmpressBackroomsPlugin.RaiseToAll(195, new object[2] { 2, num }); } if (_descentTimer <= 0f) { SetState(BackroomsElevatorState.Arrived); EmpressBackroomsPlugin.RaiseToAll(195, new object[2] { 0, 2 }); } } } private void UpdateArrived(float dt) { if (!(_doorOpen < 0.85f)) { if (NobodyAboard()) { _exitTimer += dt; } else { _exitTimer = 0f; } if (_exitTimer > 2f) { EmpressBackroomsPlugin.RaiseToAll(195, new object[1] { 3 }); } } } private void UpdateReturn(float dt, bool host) { //IL_0102: 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) HealOccupants(dt); if (_state == BackroomsElevatorState.ReturnOpen) { UpdateReturnBoarding(dt); } else if (_state == BackroomsElevatorState.ReturnClosing) { if (host) { _returnCountdown -= dt; int num = Mathf.Clamp(Mathf.CeilToInt(_returnCountdown), 0, 9); if (num != _lastReturnCount) { _lastReturnCount = num; EmpressBackroomsPlugin.RaiseToAll(195, new object[2] { 12, num }); } if (_returnCountdown <= 0f) { BeginDepart(); } } } else { if (_state != BackroomsElevatorState.ReturnDeparting) { return; } _effectTimer -= dt; if (_effectTimer <= 0f) { _effectTimer = 0.5f; SemiFunc.CameraShakeImpact(1.6f, 0.4f); if (Random.value > 0.5f) { BackroomsAudio.PlayShift(((Object)(object)LocalAvatar() != (Object)null) ? ((Component)LocalAvatar()).transform.position : ((Component)this).transform.position); } } if (!host) { return; } _departTimer -= dt; if (_departTimer <= 0f && !_departed) { _departed = true; if ((Object)(object)RunManager.instance != (Object)null) { RunManager.instance.ChangeLevel(true, false, (ChangeLevelType)0); } } } } private void UpdateReturnBoarding(float dt) { //IL_0016: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = LocalAvatar(); if (!((Object)(object)val == (Object)null) && !(Vector3.Distance(((Component)val).transform.position, _map.ElevatorButtonAnchor) > 2.4f)) { _promptTimer -= dt; if (_promptTimer <= 0f) { _promptTimer = 2.5f; SemiFunc.UIFocusText("Press [Interact] to leave the Backrooms.", new Color(0.6f, 1f, 0.7f), Color.white, 2.5f); } if (SemiFunc.InputDown((InputKey)2)) { RequestDepart(); } } } private void RequestDepart() { if (_state == BackroomsElevatorState.ReturnOpen) { if (SemiFunc.IsMasterClientOrSingleplayer()) { BeginClosing(); return; } EmpressBackroomsPlugin.RaiseToOthers(195, new object[1] { 11 }); } } private void BeginClosing() { //IL_0041: 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) if (_state == BackroomsElevatorState.ReturnOpen) { _returnCountdown = 5f; _lastReturnCount = -1; SetState(BackroomsElevatorState.ReturnClosing); SemiFunc.UIBigMessage("THE DOORS WILL CLOSE", "{v}", 26f, new Color(1f, 0.7f, 0.3f), Color.white); EmpressBackroomsPlugin.RaiseToAll(195, new object[2] { 10, 4 }); } } private void BeginDepart() { //IL_0041: 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) KillPlayersOutside(); _departTimer = 8f; _effectTimer = 0f; SetState(BackroomsElevatorState.ReturnDeparting); SemiFunc.UIBigMessage("LEAVING THE BACKROOMS", "{!}", 30f, new Color(0.6f, 1f, 0.7f), Color.white); EmpressBackroomsPlugin.RaiseToAll(195, new object[2] { 10, 5 }); } private void KillPlayersOutside() { //IL_002f: 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_007c: Unknown result type (might be due to invalid IL or missing references) if (_outsideKilled || (Object)(object)GameDirector.instance == (Object)null || GameDirector.instance.PlayerList == null) { return; } _outsideKilled = true; Bounds elevatorBounds = _map.ElevatorBounds; ((Bounds)(ref elevatorBounds)).Expand(0.5f); foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (!((Object)(object)player == (Object)null) && !BackroomsAccess.GetDeadSet(player) && !BackroomsAccess.GetIsDisabled(player) && !((Bounds)(ref elevatorBounds)).Contains(((Component)player).transform.position)) { player.PlayerDeath(-1); } } } private void HealOccupants(float dt) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) if (_state == BackroomsElevatorState.ReturnDeparting) { return; } _healTimer -= dt; if (_healTimer > 0f) { return; } _healTimer = 1f; PlayerAvatar val = LocalAvatar(); if (!((Object)(object)val == (Object)null) && !((Object)(object)val.playerHealth == (Object)null)) { Bounds elevatorBounds = _map.ElevatorBounds; ((Bounds)(ref elevatorBounds)).Expand(0.4f); if (((Bounds)(ref elevatorBounds)).Contains(((Component)val).transform.position)) { val.playerHealth.Heal(1000, true); } } } private void UpdateButtonGlow() { //IL_0041: 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_00c7: 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_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_00ac: 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) if (!((Object)(object)_buttonLens == (Object)null) && _buttonLens.HasProperty("_EmissionColor")) { Color val = ((_state != BackroomsElevatorState.Boarding && _state != BackroomsElevatorState.ReturnOpen) ? ((_state != BackroomsElevatorState.Descending && _state != BackroomsElevatorState.ReturnClosing) ? (new Color(1f, 0.2f, 0.2f) * 1.6f) : (new Color(1f, 0.5f, 0.2f) * 2.4f)) : (new Color(0.4f, 1f, 0.5f) * (2f + Mathf.Sin(Time.time * 4f) * 0.8f))); _buttonLens.SetColor("_EmissionColor", val); } } internal void OnNetwork(object[] data) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_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_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: 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) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) if (_sealed || data == null || data.Length < 1 || !(data[0] is int num)) { return; } if (num == 0 && data.Length >= 2 && data[1] is int num2) { if (num2 == 1 && _state == BackroomsElevatorState.Boarding) { SemiFunc.UIBigMessage("DESCENDING", "{v}", 26f, new Color(1f, 0.7f, 0.3f), Color.white); } SetState((BackroomsElevatorState)Mathf.Clamp(num2, 0, 2)); return; } if (num == 1 && SemiFunc.IsMasterClientOrSingleplayer()) { BeginDescent(); return; } if (num == 2 && data.Length >= 2 && data[1] is int num3) { _lastCountdown = num3; if (num3 > 0) { SemiFunc.UIFocusText(num3.ToString(), new Color(1f, 0.7f, 0.3f), Color.white, 0.9f); } else { SemiFunc.UIBigMessage("THE DOORS OPEN", "{!}", 26f, new Color(0.9f, 0.85f, 0.5f), Color.white); } return; } switch (num) { case 3: SealIntoWall(); return; case 10: { if (data.Length < 2 || !(data[1] is int num4)) { break; } BackroomsElevatorState backroomsElevatorState = (BackroomsElevatorState)Mathf.Clamp(num4, 0, 5); if (_state != backroomsElevatorState) { switch (backroomsElevatorState) { case BackroomsElevatorState.ReturnClosing: SemiFunc.UIBigMessage("THE DOORS WILL CLOSE", "{v}", 26f, new Color(1f, 0.7f, 0.3f), Color.white); break; case BackroomsElevatorState.ReturnDeparting: SemiFunc.UIBigMessage("LEAVING THE BACKROOMS", "{!}", 30f, new Color(0.6f, 1f, 0.7f), Color.white); break; } } SetState(backroomsElevatorState); return; } } if (num == 11 && SemiFunc.IsMasterClientOrSingleplayer()) { BeginClosing(); } else if (num == 12 && data.Length >= 2 && data[1] is int num5) { _lastReturnCount = num5; if (num5 > 0) { SemiFunc.UIFocusText(num5.ToString(), new Color(1f, 0.7f, 0.3f), Color.white, 0.9f); } else { SemiFunc.UIBigMessage("DOORS SEALING", "{v}", 26f, new Color(1f, 0.4f, 0.3f), Color.white); } } } private void SetState(BackroomsElevatorState state) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (_state != state) { _state = state; if (state == BackroomsElevatorState.Arrived) { BackroomsAudio.PlaySting(((Component)this).transform.position); } } } private void SealIntoWall() { //IL_00cc: 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_0089: Unknown result type (might be due to invalid IL or missing references) if (_sealed) { return; } _sealed = true; Transform parent = ((Component)this).transform.parent; if ((Object)(object)parent != (Object)null) { GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = "Empress Backrooms Elevator Seal"; val.transform.SetParent(parent, false); val.transform.localPosition = new Vector3(0f, 1.5f, _frontZ); val.transform.localScale = new Vector3(_half * 2f + 0.5f, 3f, 0.3f); Renderer component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.sharedMaterial = BackroomsMaterials.WallpaperMaterial; } if ((Object)(object)BackroomsRuntime.Instance != (Object)null) { BackroomsRuntime.Instance.RegisterElevatorSeal(val); } } BackroomsAudio.PlaySting(((Component)this).transform.position); Object.Destroy((Object)(object)((Component)this).gameObject); } private bool AllAboard() { //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_003a: Unknown result type (might be due to invalid IL or missing references) List list = PlayablePlayers(); if (list.Count == 0) { return true; } Bounds elevatorBounds = _map.ElevatorBounds; ((Bounds)(ref elevatorBounds)).Expand(0.6f); for (int i = 0; i < list.Count; i++) { if (!((Bounds)(ref elevatorBounds)).Contains(((Component)list[i]).transform.position)) { return false; } } return true; } private bool NobodyAboard() { //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_003a: Unknown result type (might be due to invalid IL or missing references) List list = PlayablePlayers(); if (list.Count == 0) { return false; } Bounds elevatorBounds = _map.ElevatorBounds; ((Bounds)(ref elevatorBounds)).Expand(0.4f); for (int i = 0; i < list.Count; i++) { if (((Bounds)(ref elevatorBounds)).Contains(((Component)list[i]).transform.position)) { return false; } } return true; } private static List PlayablePlayers() { 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 ((Object)(object)val != (Object)null && !BackroomsAccess.GetIsDisabled(val) && !BackroomsAccess.GetDeadSet(val)) { list.Add(val); } } } return list; } private static PlayerAvatar LocalAvatar() { if (!((Object)(object)PlayerController.instance != (Object)null)) { return null; } return PlayerController.instance.playerAvatarScript; } } internal static class Constants { public const float WallHeight = 3f; } internal enum BackroomsEnemyState { Idle, Search, Hunt, Recover, Dead } internal enum BackroomsEnemyKind { Smiler, SmokeCharger } internal sealed class BackroomsEnemy : MonoBehaviour { private const float SightRange = 25f; private const float LoseSightMemory = 3.6f; private const float SearchDuration = 5f; private const float AttackRange = 1.9f; private const float DesiredHeight = 2.15f; private NavMeshAgent _agent; private CapsuleCollider _trigger; private GameObject _visual; private Animation _animation; private Animator _animator; private readonly List _materials = new List(); private Vector3 _lastSeenPosition; private Vector3 _roamTarget; private Vector3 _lastAnimPosition; private Vector3 _clientPosition; private float _clientYaw; private float _clientLerp; private float _baseSpeed = 2.6f; private float _memoryTimer; private float _searchTimer; private float _attackCooldown; private float _recoverTimer; private float _reacquireTimer; private float _roamRepick; private float _vocalTimer; private float _roarTimer; private float _hurtFlash; private float _vanishTimer; private bool _charger; private bool _vanished; private bool _wantReappear; private bool _clientHidden; private bool _hasLastSeen; private bool _isHost; private bool _pendingHit; public int Id { get; private set; } public BackroomsEnemyKind Kind { get; private set; } public BackroomsEnemyState State { get; private set; } public int Health { get; private set; } public int MaxHealth { get; private set; } public bool Dead => State == BackroomsEnemyState.Dead; public bool Hidden => _vanished; public bool WantsReappear { get { if (_vanished) { return _wantReappear; } return false; } } public Vector3 Position => ((Component)this).transform.position; public float Yaw => ((Component)this).transform.eulerAngles.y; public Vector3 EyePoint => ((Component)this).transform.position + Vector3.up * 1.55f; public static BackroomsEnemy Create(Transform parent, int id, float baseSpeed, bool isHost, BackroomsEnemyKind kind = BackroomsEnemyKind.Smiler) { //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_002f: 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_00d3: 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) GameObject val = new GameObject(((kind == BackroomsEnemyKind.SmokeCharger) ? "Empress Backrooms Smoke " : "Empress Backrooms Smiler ") + id); val.transform.SetParent(parent, false); BackroomsEnemy backroomsEnemy = val.AddComponent(); backroomsEnemy.Id = id; backroomsEnemy.Kind = kind; backroomsEnemy._charger = kind == BackroomsEnemyKind.SmokeCharger; backroomsEnemy._isHost = isHost; backroomsEnemy._baseSpeed = (backroomsEnemy._charger ? Mathf.Max(baseSpeed, 3f) : baseSpeed); backroomsEnemy.MaxHealth = (backroomsEnemy._charger ? 220 : 180); backroomsEnemy.Health = backroomsEnemy.MaxHealth; backroomsEnemy.BuildBody(); CapsuleCollider val2 = val.AddComponent(); ((Collider)val2).isTrigger = true; val2.radius = 0.52f; val2.height = 2.1f; val2.center = new Vector3(0f, 1.05f, 0f); backroomsEnemy._trigger = val2; Rigidbody obj = val.AddComponent(); obj.isKinematic = true; obj.useGravity = false; obj.interpolation = (RigidbodyInterpolation)1; NavMeshAgent val3 = val.AddComponent(); val3.radius = 0.42f; val3.height = 2.05f; val3.speed = backroomsEnemy._baseSpeed; val3.angularSpeed = 540f; val3.acceleration = 22f; val3.stoppingDistance = 1.15f; val3.autoBraking = true; val3.updateRotation = false; ((Behaviour)val3).enabled = false; backroomsEnemy._agent = val3; return backroomsEnemy; } private void BuildBody() { //IL_0040: 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) _visual = (_charger ? BackroomsSmokeAssets.CreateSmoke(((Component)this).transform) : BackroomsSmilerAssets.CreateSmiler(((Component)this).transform)); if (!((Object)(object)_visual == (Object)null)) { _visual.transform.localPosition = Vector3.zero; _visual.transform.localRotation = Quaternion.identity; NormalizeVisual(); CacheMaterials(); StartAnimation(); } } private void NormalizeVisual() { //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_0026: 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_0068: 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_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_0099: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_011a: 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_0121: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = _visual.GetComponentsInChildren(true); if (componentsInChildren.Length != 0) { Bounds bounds = componentsInChildren[0].bounds; for (int i = 1; i < componentsInChildren.Length; i++) { ((Bounds)(ref bounds)).Encapsulate(componentsInChildren[i].bounds); } float num = Mathf.Max(0.01f, ((Bounds)(ref bounds)).size.y); float num2 = 2.15f / num; Transform transform = _visual.transform; transform.localScale *= num2; componentsInChildren = _visual.GetComponentsInChildren(true); bounds = componentsInChildren[0].bounds; for (int j = 1; j < componentsInChildren.Length; j++) { ((Bounds)(ref bounds)).Encapsulate(componentsInChildren[j].bounds); } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((Bounds)(ref bounds)).center.x - ((Component)this).transform.position.x, ((Bounds)(ref bounds)).min.y - ((Component)this).transform.position.y, ((Bounds)(ref bounds)).center.z - ((Component)this).transform.position.z); Transform transform2 = _visual.transform; transform2.localPosition -= val; } } private void CacheMaterials() { if (_charger) { return; } Renderer[] componentsInChildren = _visual.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] materials = componentsInChildren[i].materials; for (int j = 0; j < materials.Length; j++) { if ((Object)(object)materials[j] != (Object)null && !_materials.Contains(materials[j])) { _materials.Add(materials[j]); } } } } private void StartAnimation() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown _animation = _visual.GetComponentInChildren(true); if ((Object)(object)_animation != (Object)null) { string text = null; foreach (AnimationState item in _animation) { AnimationState val = item; if (!((TrackedReference)(object)val == (TrackedReference)null)) { val.wrapMode = (WrapMode)2; val.speed = 1f; if (text == null) { text = val.name; } } } _animation.wrapMode = (WrapMode)2; if (!string.IsNullOrEmpty(text)) { _animation.Play(text); } } _animator = _visual.GetComponentInChildren(true); if ((Object)(object)_animator != (Object)null) { _animator.speed = 1f; } } public void PlaceOnNavMesh(Vector3 position, Quaternion rotation) { //IL_0027: 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_003a: 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_0043: 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_005a: 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_0008: 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_001f: 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) NavMeshHit val = default(NavMeshHit); if (_isHost && NavMesh.SamplePosition(position, ref val, 8f, -1)) { position = ((NavMeshHit)(ref val)).position; } ((Component)this).transform.position = position; ((Component)this).transform.rotation = rotation; _clientPosition = position; _clientYaw = ((Quaternion)(ref rotation)).eulerAngles.y; _lastAnimPosition = position; _lastSeenPosition = position; if (_isHost && (Object)(object)_agent != (Object)null) { ((Behaviour)_agent).enabled = true; if (_agent.isOnNavMesh) { _agent.Warp(position); } } } public void SetState(BackroomsEnemyState state) { if (State != BackroomsEnemyState.Dead) { State = state; } } public void BeginVanish(float duration) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (State != BackroomsEnemyState.Dead) { _vanished = true; _wantReappear = false; _vanishTimer = duration; State = BackroomsEnemyState.Recover; SetVisualHidden(hidden: true); BackroomsAudio.PlaySting(((Component)this).transform.position); if ((Object)(object)_agent != (Object)null && ((Behaviour)_agent).enabled && _agent.isOnNavMesh) { _agent.isStopped = true; } } } public void Reappear(Vector3 spot) { //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_005f: 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_0066: 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_0099: Unknown result type (might be due to invalid IL or missing references) if (State != BackroomsEnemyState.Dead) { _vanished = false; _wantReappear = false; _hasLastSeen = false; _memoryTimer = 0f; _reacquireTimer = Random.Range(1.5f, 2.5f); _searchTimer = 5f; State = BackroomsEnemyState.Search; ((Component)this).transform.position = spot; _clientPosition = spot; _lastAnimPosition = spot; if ((Object)(object)_agent != (Object)null && ((Behaviour)_agent).enabled && _agent.isOnNavMesh) { _agent.Warp(spot); } SetVisualHidden(hidden: false); BackroomsAudio.PlayGrowl(spot); } } private void SetVisualHidden(bool hidden) { if ((Object)(object)_visual != (Object)null && _visual.activeSelf == hidden) { _visual.SetActive(!hidden); } if ((Object)(object)_trigger != (Object)null) { ((Collider)_trigger).enabled = !hidden; } } public bool HostThink(float dt, bool canSeeTarget, Vector3 targetPosition, float distance, IList waypoints) { //IL_00d5: 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_015e: Unknown result type (might be due to invalid IL or missing references) if (State == BackroomsEnemyState.Dead || (Object)(object)_agent == (Object)null || !((Behaviour)_agent).enabled) { return false; } if (_vanished) { _vanishTimer -= dt; if (_vanishTimer <= 0f) { _wantReappear = true; } if (_agent.isOnNavMesh) { _agent.isStopped = true; } return false; } _attackCooldown -= dt; _recoverTimer -= dt; _reacquireTimer -= dt; _vocalTimer -= dt; _roarTimer -= dt; bool flag = canSeeTarget && distance <= 25f; if (flag && _reacquireTimer <= 0f) { _lastSeenPosition = targetPosition; _hasLastSeen = true; _memoryTimer = 3.6f; _searchTimer = 5f; if (State != BackroomsEnemyState.Hunt && State != BackroomsEnemyState.Recover) { AlertVocal(); } if (State != BackroomsEnemyState.Recover) { State = BackroomsEnemyState.Hunt; } } else if (_memoryTimer > 0f) { _memoryTimer -= dt; } bool result = false; switch (State) { case BackroomsEnemyState.Hunt: result = ThinkHunt(flag, targetPosition, distance); break; case BackroomsEnemyState.Recover: ThinkRecover(); break; case BackroomsEnemyState.Search: ThinkSearch(dt, waypoints); break; default: ThinkIdle(dt, waypoints); break; } UpdateRotation(dt); UpdateAnimation(dt); UpdateMaterials(dt); return result; } private bool ThinkHunt(bool canSeeTarget, Vector3 targetPosition, float distance) { //IL_001a: 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) if (_recoverTimer > 0f) { State = BackroomsEnemyState.Recover; return false; } if (canSeeTarget) { SetDestination(targetPosition, _charger ? (_baseSpeed * 2.5f) : (_baseSpeed * ((distance > 6f) ? 1.18f : 0.92f)), stop: false); } else { if (!(_memoryTimer > 0f) || !_hasLastSeen) { State = BackroomsEnemyState.Search; _searchTimer = 5f; return false; } SetDestination(_lastSeenPosition, _baseSpeed * (_charger ? 1.4f : 0.9f), stop: false); } float num = (_charger ? 2.5f : 1.9f); if (canSeeTarget && distance <= num && _attackCooldown <= 0f) { _attackCooldown = Random.Range(4.5f, 6.5f); _recoverTimer = Random.Range(2.2f, 3.2f); _reacquireTimer = Random.Range(1.2f, 2f); State = BackroomsEnemyState.Recover; if (_charger) { ChargeRoar(); } else { Growl(); } return true; } return false; } private void ThinkRecover() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) SetDestination(((Component)this).transform.position, _baseSpeed * 0.25f, stop: true); if (_recoverTimer <= 0f) { State = (_hasLastSeen ? BackroomsEnemyState.Search : BackroomsEnemyState.Idle); _searchTimer = Mathf.Max(_searchTimer, 2.5f); } } private void ThinkSearch(float dt, IList waypoints) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) _searchTimer -= dt; if (_hasLastSeen) { SetDestination(_lastSeenPosition, _baseSpeed * 0.62f, stop: false); } else { ThinkIdle(dt, waypoints); } if (_searchTimer <= 0f || (_agent.isOnNavMesh && !_agent.pathPending && _agent.remainingDistance < 1.5f)) { _hasLastSeen = false; _memoryTimer = 0f; _reacquireTimer = Random.Range(2f, 4f); State = BackroomsEnemyState.Idle; } } private void ThinkIdle(float dt, IList waypoints) { //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_00b3: 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_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) _roamRepick -= dt; if (_roamRepick <= 0f || (_agent.isOnNavMesh && !_agent.pathPending && _agent.remainingDistance < 2f)) { _roamRepick = Random.Range(5f, 10f); if (waypoints != null && waypoints.Count > 0) { _roamTarget = waypoints[Random.Range(0, waypoints.Count)]; } } if (_roamTarget != Vector3.zero) { SetDestination(_roamTarget, _baseSpeed * 0.45f, stop: false); } else { SetDestination(((Component)this).transform.position, 0f, stop: true); } } private void SetDestination(Vector3 position, float speed, bool stop) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_agent == (Object)null) && ((Behaviour)_agent).enabled && _agent.isOnNavMesh) { _agent.speed = Mathf.Max(0f, speed); _agent.isStopped = stop; if (!stop) { _agent.SetDestination(position); } } } private void UpdateRotation(float dt) { //IL_001b: 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_0028: 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_0050: 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_005a: 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_0074: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (((Object)(object)_agent != (Object)null && ((Behaviour)_agent).enabled) ? _agent.velocity : Vector3.zero); val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.02f)) { Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, dt * 8f); } } private void UpdateAnimation(float dt) { //IL_0006: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown Vector3 val = ((Component)this).transform.position - _lastAnimPosition; float num = ((Vector3)(ref val)).magnitude / Mathf.Max(0.0001f, dt); _lastAnimPosition = ((Component)this).transform.position; float speed = ((State == BackroomsEnemyState.Dead) ? 0f : Mathf.Clamp(num / Mathf.Max(0.1f, _baseSpeed), 0.45f, 1.6f)); if ((Object)(object)_animation != (Object)null) { foreach (AnimationState item in _animation) { AnimationState val2 = item; if ((TrackedReference)(object)val2 != (TrackedReference)null) { val2.speed = speed; } } if (!_animation.isPlaying) { _animation.Play(); } } if ((Object)(object)_animator != (Object)null) { _animator.speed = speed; } } private void UpdateMaterials(float dt) { //IL_0021: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) if (_hurtFlash > 0f) { _hurtFlash -= dt * 2.4f; } Color val = Color.red * Mathf.Clamp01(_hurtFlash) * 1.4f; for (int i = 0; i < _materials.Count; i++) { Material val2 = _materials[i]; if (!((Object)(object)val2 == (Object)null) && val2.HasProperty("_EmissionColor")) { if (_hurtFlash > 0f) { val2.EnableKeyword("_EMISSION"); val2.SetColor("_EmissionColor", val); } else { val2.SetColor("_EmissionColor", Color.black); } } } } private void Growl() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!(_vocalTimer > 0f)) { _vocalTimer = Random.Range(3.5f, 6f); BackroomsAudio.PlayGrowl(((Component)this).transform.position); } } private void AlertVocal() { if (_charger) { ChargeRoar(); } else { Growl(); } } private void ChargeRoar() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!(_roarTimer > 0f)) { _roarTimer = Random.Range(2.5f, 4f); BackroomsAudio.PlayCharge(((Component)this).transform.position); } } public void ClientTick(float dt) { //IL_002a: 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_004b: 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) _clientLerp = Mathf.Min(1f, _clientLerp + dt * 12f); ((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, _clientPosition, _clientLerp); float num = Mathf.LerpAngle(((Component)this).transform.eulerAngles.y, _clientYaw, dt * 9f); ((Component)this).transform.rotation = Quaternion.Euler(0f, num, 0f); UpdateAnimation(dt); UpdateMaterials(dt); } public void ApplyClientSync(Vector3 position, float yaw, BackroomsEnemyState state, int health, bool hidden) { //IL_0039: 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_0012: Unknown result type (might be due to invalid IL or missing references) if (_clientHidden && !hidden) { ((Component)this).transform.position = position; _clientLerp = 1f; } else { _clientLerp = 0f; } _clientHidden = hidden; _clientPosition = position; _clientYaw = yaw; if (health < Health) { _hurtFlash = 1f; } Health = health; if (state == BackroomsEnemyState.Dead && State != BackroomsEnemyState.Dead) { Kill(playEffect: false); return; } State = state; SetVisualHidden(hidden); } public bool ConsumeHit() { if (!_pendingHit) { return false; } _pendingHit = false; return true; } private void OnTriggerEnter(Collider other) { //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) if (!_isHost || State == BackroomsEnemyState.Dead || (Object)(object)other == (Object)null) { return; } Rigidbody attachedRigidbody = other.attachedRigidbody; if ((Object)(object)attachedRigidbody == (Object)null || attachedRigidbody.isKinematic || (Object)(object)((Component)other).GetComponentInParent() != (Object)null || (Object)(object)((Component)other).GetComponentInParent() != (Object)null) { return; } Vector3 velocity = attachedRigidbody.velocity; float magnitude = ((Vector3)(ref velocity)).magnitude; if (!(magnitude < 3.5f)) { float num = Mathf.Clamp(attachedRigidbody.mass, 0.5f, 6f); int num2 = Mathf.RoundToInt(magnitude * num * 1.5f); if (num2 >= 6) { ApplyDamage(num2); } } } public void ApplyDamage(int damage) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (_isHost && State != BackroomsEnemyState.Dead && damage > 0) { Health -= damage; _hurtFlash = 1f; _pendingHit = true; BackroomsAudio.PlayHit(((Component)this).transform.position); if (Health <= 0) { Kill(playEffect: true); return; } _recoverTimer = Mathf.Max(_recoverTimer, 1.5f); State = BackroomsEnemyState.Recover; } } public void Kill(bool playEffect) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (State == BackroomsEnemyState.Dead) { return; } State = BackroomsEnemyState.Dead; Health = 0; if ((Object)(object)_agent != (Object)null) { if (((Behaviour)_agent).enabled && _agent.isOnNavMesh) { _agent.isStopped = true; } ((Behaviour)_agent).enabled = false; } if (playEffect) { BackroomsAudio.PlayDeath(((Component)this).transform.position); } ((MonoBehaviour)this).StartCoroutine(DeathFall()); } private IEnumerator DeathFall() { float t = 0f; Quaternion from = ((Component)this).transform.rotation; Quaternion to = from * Quaternion.Euler(0f, 0f, (Random.value > 0.5f) ? 85f : (-85f)); Vector3 fromPos = ((Component)this).transform.position; Vector3 toPos = fromPos - Vector3.up * 0.2f; while (t < 1f) { t += Time.deltaTime * 1.5f; ((Component)this).transform.rotation = Quaternion.Slerp(from, to, t); ((Component)this).transform.position = Vector3.Lerp(fromPos, toPos, t); UpdateAnimation(Time.deltaTime); yield return null; } yield return (object)new WaitForSeconds(3f); float fade = 0f; Vector3 startScale = ((Component)this).transform.localScale; while (fade < 1f) { fade += Time.deltaTime * 0.8f; ((Component)this).transform.localScale = Vector3.Lerp(startScale, startScale * 0.02f, fade); yield return null; } Object.Destroy((Object)(object)((Component)this).gameObject); } public void Dispose() { Object.Destroy((Object)(object)((Component)this).gameObject); } } internal static class BackroomsLevelRegistry { 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 RegisterLevel() { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) Level val = ScriptableObject.CreateInstance(); ((Object)val).name = "Level - Empress Backrooms"; val.NarrativeName = "Empress - The Backrooms"; LevelValuables val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = "Valuables - Empress Backrooms"; 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.16f, 0.15f, 0.07f)); SetLevelField(val, "FogStartDistance", 8f); SetLevelField(val, "FogEndDistance", 55f); SetLevelField(val, "AmbientColor", (object)new Color(0.42f, 0.39f, 0.2f)); SetLevelField(val, "AmbientColorAdaptation", (object)new Color(0.2f, 0.19f, 0.1f)); SetLevelField(val, "ColorTemperature", 4f); SetLevelField(val, "ColorFilter", (object)new Color(1f, 0.96f, 0.78f, 1f)); SetLevelField(val, "BloomIntensity", 1.1f); SetLevelField(val, "BloomThreshold", 1f); SetLevelField(val, "VignetteColor", (object)new Color(0.05f, 0.04f, 0f, 1f)); SetLevelField(val, "VignetteIntensity", 0.38f); SetLevelField(val, "VignetteSmoothness", 0.85f); SetLevelField(val, "DiscordIcon", "level"); EnsureLevelFieldInstance(val, "LoadingGraphic01"); EnsureLevelFieldInstance(val, "LoadingGraphic02"); EnsureLevelFieldInstance(val, "LoadingGraphic03"); EnsureLevelFieldInstance(val, "ConnectObject"); EnsureLevelFieldInstance(val, "BlockObject"); LevelContent val3 = ScriptableObject.CreateInstance(); ((Object)val3).name = "Empress Backrooms 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 backroomsLevel) { if ((Object)(object)backroomsLevel == (Object)null) { return; } List valuablePresets = BackroomsAccess.GetValuablePresets(backroomsLevel); if (valuablePresets == null || !PoolHasContent(valuablePresets)) { List list = CollectContentValuables(); if (list.Count > 0) { BackroomsAccess.SetValuablePresets(backroomsLevel, list); EmpressBackroomsPlugin.DebugLog("Empress Backrooms borrowed " + list.Count + " valuable group(s) from loaded assets."); } else { EmpressBackroomsPlugin.DebugLog("Empress Backrooms found no LevelValuables with content in memory."); } } } public static List FindValuablePool() { List valuablePresets = BackroomsAccess.GetValuablePresets(EmpressBackroomsPlugin.BackroomsLevel); if (valuablePresets != null && PoolHasContent(valuablePresets)) { return valuablePresets; } return CollectContentValuables(); } private static List CollectContentValuables() { List list = new List(); LevelValuables[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && BackroomsAccess.PresetHasContent(array[i]) && !list.Contains(array[i])) { list.Add(array[i]); } } return list; } public static PrefabRef FindExtractionPrefab() { Level[] array = Resources.FindObjectsOfTypeAll(); int num = 0; foreach (Level val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)EmpressBackroomsPlugin.BackroomsLevel)) { num++; PrefabRef val2 = FirstValid(val.ModulesExtraction1) ?? FirstValid(val.ModulesExtraction2) ?? FirstValid(val.ModulesExtraction3); if (val2 != null) { EmpressBackroomsPlugin.DebugLog("Empress Backrooms borrowed extraction from level '" + ((Object)val).name + "'."); return val2; } } } EmpressBackroomsPlugin.DebugLog("Empress Backrooms scanned " + num + " level(s) but found no extraction module PrefabRef."); return null; } private static PrefabRef FirstValid(List refs) { if (refs == null) { return null; } for (int i = 0; i < refs.Count; i++) { if (refs[i] != null && refs[i].IsValid()) { return refs[i]; } } return null; } private static bool PoolHasContent(List presets) { for (int i = 0; i < presets.Count; i++) { if (BackroomsAccess.PresetHasContent(presets[i])) { 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 enum BackroomsTheme { Office, Pool, Dark } internal sealed class BackroomsValuableSpot { public Vector3 Position; public Vector3 Forward; public Type Type; } internal sealed class BackroomsMap { public Vector3 PlayerStart = new Vector3(0f, 1f, 0f); public readonly List SpawnPositions = new List(); public Vector3 ExtractionPosition; public Quaternion ExtractionRotation = Quaternion.identity; public readonly List ValuableSpots = new List(); public readonly List Waypoints = new List(); public readonly List EnemySpawnPoints = new List(); public readonly List CeilingLights = new List(); public readonly List CeilingPanels = new List(); public readonly List EmergencyLights = new List(); public Bounds NavBounds; public bool HasElevator; public Vector3 ElevatorDoorCenter; public float ElevatorDoorHalfWidth = 1.6f; public Vector3 ElevatorButtonAnchor; public Bounds ElevatorBounds; } internal static class BackroomsMapBuilder { private const int GX = 10; private const int GZ = 10; private const float C = 6.5f; private const float H = 3f; private const float T = 0.3f; private const float SublevelOpenZ = 32.5f; private const float SublevelOpenHalf = 2.2f; private const float SublevelDepth = 4f; public static BackroomsMap Build(Transform parent, int seed) { //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_00c5: 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_00e9: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) BackroomsMaterials.EnsureCreated(); Random random = new Random(seed); BackroomsMap backroomsMap = new BackroomsMap(); bool[,] openV = new bool[10, 10]; bool[,] openH = new bool[10, 10]; CarveMaze(random, openV, openH); int num = 5; int num2 = 5; OpenAtrium(openV, openH, num, num2); BackroomsTheme[,] theme = AssignThemes(); BuildFloorsAndCeilings(parent, backroomsMap, theme, random); BuildWalls(parent, backroomsMap, theme, openV, openH); BuildPerimeter(parent, backroomsMap.ElevatorDoorHalfWidth, 32.5f, 2.2f); BuildPillars(parent); BuildPoolWater(parent, theme); BuildWaypointsAndSpawns(backroomsMap, theme, num, num2); BuildValuableSpots(backroomsMap, random, theme, num, num2); BuildSublevel(parent, backroomsMap); BuildElevator(parent, backroomsMap); backroomsMap.PlayerStart = new Vector3(0f, 1f, -5.5f); backroomsMap.ExtractionPosition = Cell(num, num2); backroomsMap.ExtractionRotation = Quaternion.Euler(0f, (float)random.Next(0, 4) * 90f, 0f); float num3 = 58.5f; float num4 = 58.5f; backroomsMap.NavBounds = new Bounds(new Vector3(num3 * 0.5f, 1.5f, num4 * 0.5f), new Vector3(num3 + 13f, 9f, num4 + 13f)); return backroomsMap; } private static void CarveMaze(Random rng, bool[,] openV, bool[,] openH) { //IL_0023: 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_0034: 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_00af: 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_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) bool[,] array = new bool[10, 10]; Stack stack = new Stack(); Vector2Int item = default(Vector2Int); ((Vector2Int)(ref item))..ctor(0, 0); array[0, 0] = true; stack.Push(item); while (stack.Count > 0) { Vector2Int a = stack.Peek(); List list = new List(); if (((Vector2Int)(ref a)).x > 0 && !array[((Vector2Int)(ref a)).x - 1, ((Vector2Int)(ref a)).y]) { list.Add(new Vector2Int(((Vector2Int)(ref a)).x - 1, ((Vector2Int)(ref a)).y)); } if (((Vector2Int)(ref a)).x < 9 && !array[((Vector2Int)(ref a)).x + 1, ((Vector2Int)(ref a)).y]) { list.Add(new Vector2Int(((Vector2Int)(ref a)).x + 1, ((Vector2Int)(ref a)).y)); } if (((Vector2Int)(ref a)).y > 0 && !array[((Vector2Int)(ref a)).x, ((Vector2Int)(ref a)).y - 1]) { list.Add(new Vector2Int(((Vector2Int)(ref a)).x, ((Vector2Int)(ref a)).y - 1)); } if (((Vector2Int)(ref a)).y < 9 && !array[((Vector2Int)(ref a)).x, ((Vector2Int)(ref a)).y + 1]) { list.Add(new Vector2Int(((Vector2Int)(ref a)).x, ((Vector2Int)(ref a)).y + 1)); } if (list.Count == 0) { stack.Pop(); continue; } Vector2Int val = list[rng.Next(list.Count)]; Connect(openV, openH, a, val); array[((Vector2Int)(ref val)).x, ((Vector2Int)(ref val)).y] = true; stack.Push(val); } for (int i = 0; i < 9; i++) { for (int j = 0; j < 10; j++) { if (!openV[i, j] && rng.NextDouble() < 0.32) { openV[i, j] = true; } } } for (int k = 0; k < 10; k++) { for (int l = 0; l < 9; l++) { if (!openH[k, l] && rng.NextDouble() < 0.32) { openH[k, l] = true; } } } } private static void Connect(bool[,] openV, bool[,] openH, Vector2Int a, Vector2Int b) { if (((Vector2Int)(ref a)).x == ((Vector2Int)(ref b)).x) { openH[((Vector2Int)(ref a)).x, Mathf.Min(((Vector2Int)(ref a)).y, ((Vector2Int)(ref b)).y)] = true; } else { openV[Mathf.Min(((Vector2Int)(ref a)).x, ((Vector2Int)(ref b)).x), ((Vector2Int)(ref a)).y] = true; } } private static void OpenAtrium(bool[,] openV, bool[,] openH, int ax, int az) { for (int i = ax - 1; i <= ax + 1; i++) { for (int j = az - 1; j <= az + 1; j++) { if (i >= 0 && i < 9 && j >= 0 && j < 10 && i + 1 >= ax - 1 && i + 1 <= ax + 1) { openV[i, j] = true; } if (i >= 0 && i < 10 && j >= 0 && j < 9 && j + 1 >= az - 1 && j + 1 <= az + 1) { openH[i, j] = true; } } } } private static BackroomsTheme[,] AssignThemes() { BackroomsTheme[,] array = new BackroomsTheme[10, 10]; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if (i >= 7 && j <= 2) { array[i, j] = BackroomsTheme.Pool; } else if (i <= 2 && j >= 7) { array[i, j] = BackroomsTheme.Dark; } else { array[i, j] = BackroomsTheme.Office; } } } return array; } private static Vector3 Cell(int i, int j) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) return new Vector3((float)i * 6.5f, 0f, (float)j * 6.5f); } private static void BuildFloorsAndCeilings(Transform parent, BackroomsMap map, BackroomsTheme[,] theme, Random rng) { //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_0054: 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_007b: 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_009a: 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_00b9: 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_010d: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { Vector3 val = Cell(i, j); BackroomsTheme backroomsTheme = theme[i, j]; Material material = (Material)(backroomsTheme switch { BackroomsTheme.Dark => BackroomsMaterials.ConcreteMaterial, BackroomsTheme.Pool => BackroomsMaterials.PoolFloorMaterial, _ => BackroomsMaterials.CarpetMaterial, }); float num = ((backroomsTheme == BackroomsTheme.Pool) ? (-0.32f) : (-0.15f)); CreateBox(parent, "Floor", new Vector3(val.x, num, val.z), Quaternion.identity, new Vector3(6.5f, 0.3f, 6.5f), material, solid: true); CreateBox(parent, "Ceiling", new Vector3(val.x, 3.15f, val.z), Quaternion.identity, new Vector3(6.5f, 0.3f, 6.5f), BackroomsMaterials.CeilingTileMaterial, solid: true); bool flag = backroomsTheme == BackroomsTheme.Pool || (i + j) % 2 == 0; if (backroomsTheme == BackroomsTheme.Dark) { flag = (i + j) % 3 == 0; } if (flag) { BuildCeilingLamp(parent, map, val, backroomsTheme); } if (backroomsTheme == BackroomsTheme.Dark && rng.NextDouble() < 0.5) { BuildEmergencyLight(parent, map, val); } } } } private static void BuildCeilingLamp(Transform parent, BackroomsMap map, Vector3 center, BackroomsTheme t) { //IL_0006: 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_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_0084: 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_0089: 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_00a7: 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_00b2: Unknown result type (might be due to invalid IL or missing references) Renderer component = CreateBox(parent, "Fluorescent", new Vector3(center.x, 2.94f, center.z), Quaternion.identity, new Vector3(2.4f, 0.08f, 0.6f), BackroomsMaterials.FluorescentOnMaterial, solid: false).GetComponent(); if ((Object)(object)component != (Object)null) { map.CeilingPanels.Add(component); } Color color = ((t == BackroomsTheme.Pool) ? new Color(0.8f, 0.95f, 1f) : new Color(1f, 0.97f, 0.82f)); float intensity = ((t == BackroomsTheme.Pool) ? 1.4f : 1.2f); Light item = AddLight(parent, new Vector3(center.x, 2.75f, center.z), color, intensity, 9.75f, "Fluorescent Light"); map.CeilingLights.Add(item); } private static void BuildEmergencyLight(Transform parent, BackroomsMap map, Vector3 center) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_004e: 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_007d: 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_00b8: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Emergency Light"); val.transform.SetParent(parent, false); val.transform.localPosition = new Vector3(center.x, 2.98f, center.z); Material concreteMaterial = BackroomsMaterials.ConcreteMaterial; Material material = BackroomsMaterials.CreateEmissive(new Color(1f, 0.08f, 0.04f), 3.2f); CreateBox(val.transform, "Housing", new Vector3(0f, -0.07f, 0f), Quaternion.identity, new Vector3(0.46f, 0.12f, 0.46f), concreteMaterial, solid: false); CreateBox(val.transform, "Cage Bar A", new Vector3(0f, -0.2f, 0.14f), Quaternion.identity, new Vector3(0.4f, 0.26f, 0.03f), concreteMaterial, solid: false); CreateBox(val.transform, "Cage Bar B", new Vector3(0f, -0.2f, -0.14f), Quaternion.identity, new Vector3(0.4f, 0.26f, 0.03f), concreteMaterial, solid: false); CreateCylinder(val.transform, "Lens", new Vector3(0f, -0.2f, 0f), Quaternion.identity, new Vector3(0.3f, 0.12f, 0.3f), material, solid: false); AddLight(val.transform, new Vector3(0f, -0.3f, 0f), new Color(1f, 0.12f, 0.06f), 2.2f, 8.45f, "Emergency Point"); val.SetActive(false); map.EmergencyLights.Add(val); } private static void BuildWalls(Transform parent, BackroomsMap map, BackroomsTheme[,] theme, bool[,] openV, bool[,] openH) { //IL_003a: 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_004f: 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_00ba: 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) Vector3 position = default(Vector3); for (int i = 0; i < 9; i++) { for (int j = 0; j < 10; j++) { if (!openV[i, j]) { ((Vector3)(ref position))..ctor(((float)i + 0.5f) * 6.5f, 1.5f, (float)j * 6.5f); CreateBox(parent, "Wall", position, Quaternion.identity, new Vector3(0.3f, 3f, 6.5f), WallMaterial(theme[i, j]), solid: true); } } } Vector3 position2 = default(Vector3); for (int k = 0; k < 10; k++) { for (int l = 0; l < 9; l++) { if (!openH[k, l]) { ((Vector3)(ref position2))..ctor((float)k * 6.5f, 1.5f, ((float)l + 0.5f) * 6.5f); CreateBox(parent, "Wall", position2, Quaternion.identity, new Vector3(6.5f, 3f, 0.3f), WallMaterial(theme[k, l]), solid: true); } } } } private static Material WallMaterial(BackroomsTheme t) { return (Material)(t switch { BackroomsTheme.Pool => BackroomsMaterials.PoolWallMaterial, BackroomsTheme.Dark => BackroomsMaterials.ConcreteMaterial, _ => BackroomsMaterials.WallpaperMaterial, }); } private static void BuildPerimeter(Transform parent, float doorHalf, float eastOpenZ, float eastOpenHalf) { //IL_0048: 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_0064: 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_00a6: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_0124: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: 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) float num = -3.25f; float num2 = 61.75f; float num3 = -3.25f; float num4 = 61.75f; float num5 = (num + num2) * 0.5f; float num6 = num2 - num; float num7 = 0f - doorHalf - num; float num8 = num2 - doorHalf; CreateBox(parent, "Perimeter South West", new Vector3((num - doorHalf) * 0.5f, 1.5f, num3), Quaternion.identity, new Vector3(num7 + 0.3f, 3f, 0.3f), BackroomsMaterials.WallpaperMaterial, solid: true); CreateBox(parent, "Perimeter South East", new Vector3((num2 + doorHalf) * 0.5f, 1.5f, num3), Quaternion.identity, new Vector3(num8 + 0.3f, 3f, 0.3f), BackroomsMaterials.WallpaperMaterial, solid: true); CreateBox(parent, "Perimeter North", new Vector3(num5, 1.5f, num4), Quaternion.identity, new Vector3(num6 + 0.3f, 3f, 0.3f), BackroomsMaterials.WallpaperMaterial, solid: true); CreateBox(parent, "Perimeter West", new Vector3(num, 1.5f, (num3 + num4) * 0.5f), Quaternion.identity, new Vector3(0.3f, 3f, num4 - num3 + 0.3f), BackroomsMaterials.WallpaperMaterial, solid: true); float num9 = eastOpenZ - eastOpenHalf - num3; float num10 = num4 - (eastOpenZ + eastOpenHalf); CreateBox(parent, "Perimeter East South", new Vector3(num2, 1.5f, (num3 + eastOpenZ - eastOpenHalf) * 0.5f), Quaternion.identity, new Vector3(0.3f, 3f, num9 + 0.3f), BackroomsMaterials.WallpaperMaterial, solid: true); CreateBox(parent, "Perimeter East North", new Vector3(num2, 1.5f, (num4 + eastOpenZ + eastOpenHalf) * 0.5f), Quaternion.identity, new Vector3(0.3f, 3f, num10 + 0.3f), BackroomsMaterials.WallpaperMaterial, solid: true); } private static void BuildElevator(Transform parent, BackroomsMap map) { //IL_0040: 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_0082: 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_00c4: 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_0102: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_014e: 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) float elevatorDoorHalfWidth = map.ElevatorDoorHalfWidth; float num = -3.25f; float num2 = num - 5.25f; float num3 = (num + num2) * 0.5f; float num4 = num - num2; map.SpawnPositions.Clear(); map.SpawnPositions.Add(new Vector3(0f, 1f, num3)); map.SpawnPositions.Add(new Vector3(0.85f, 1f, num3 + 0.6f)); map.SpawnPositions.Add(new Vector3(-0.85f, 1f, num3 + 0.6f)); map.SpawnPositions.Add(new Vector3(0.85f, 1f, num3 - 0.7f)); map.SpawnPositions.Add(new Vector3(-0.85f, 1f, num3 - 0.7f)); map.SpawnPositions.Add(new Vector3(0f, 1f, num3 - 1.2f)); map.HasElevator = true; map.ElevatorDoorCenter = new Vector3(0f, 0f, num); map.ElevatorButtonAnchor = new Vector3(elevatorDoorHalfWidth - 0.12f, 1.18f, num - 1.1f); map.ElevatorBounds = new Bounds(new Vector3(0f, 1.5f, num3), new Vector3(elevatorDoorHalfWidth * 2f, 3f, num4)); } private static void BuildSublevel(Transform parent, BackroomsMap map) { //IL_005e: 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_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_0099: 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_00cc: 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_0106: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: 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_02cb: 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_0307: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0425: 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_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0458: 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_0463: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: 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) float num = 61.75f; float num2 = 32.5f; float num3 = 2.2f; float num4 = -4f; float num5 = num + 17f; float num6 = num2 - 8f; float num7 = num2 + 8f; float num8 = (num + num5) * 0.5f; float num9 = (num6 + num7) * 0.5f; float num10 = num5 - num; float num11 = num7 - num6; GameObject val = new GameObject("Empress Backrooms Sublevel"); val.transform.SetParent(parent, false); Transform transform = val.transform; CreateBox(transform, "Sub Floor", new Vector3(num8, num4 - 0.15f, num9), Quaternion.identity, new Vector3(num10, 0.3f, num11), BackroomsMaterials.PoolFloorMaterial, solid: true); CreateBox(transform, "Sub Ceiling", new Vector3(num8, 3.15f, num9), Quaternion.identity, new Vector3(num10, 0.3f, num11), BackroomsMaterials.CeilingTileMaterial, solid: true); float num12 = 3f - num4; float num13 = (3f + num4) * 0.5f; CreateBox(transform, "Sub Far Wall", new Vector3(num5, num13, num9), Quaternion.identity, new Vector3(0.3f, num12, num11 + 0.3f), BackroomsMaterials.ConcreteMaterial, solid: true); CreateBox(transform, "Sub North Wall", new Vector3(num8, num13, num7), Quaternion.identity, new Vector3(num10 + 0.3f, num12, 0.3f), BackroomsMaterials.ConcreteMaterial, solid: true); CreateBox(transform, "Sub South Wall", new Vector3(num8, num13, num6), Quaternion.identity, new Vector3(num10 + 0.3f, num12, 0.3f), BackroomsMaterials.ConcreteMaterial, solid: true); float num14 = num4 * 0.5f; float num15 = num2 - num3 - num6; float num16 = num7 - (num2 + num3); CreateBox(transform, "Sub Near South", new Vector3(num, num14, (num6 + num2 - num3) * 0.5f), Quaternion.identity, new Vector3(0.3f, 4f, num15 + 0.3f), BackroomsMaterials.ConcreteMaterial, solid: true); CreateBox(transform, "Sub Near North", new Vector3(num, num14, (num7 + num2 + num3) * 0.5f), Quaternion.identity, new Vector3(0.3f, 4f, num16 + 0.3f), BackroomsMaterials.ConcreteMaterial, solid: true); float width = num3 - 0.5f; BuildRamp(transform, "Staircase Ramp", num, 8f, 4f, num2 - num3 * 0.5f, width, BackroomsMaterials.ConcreteMaterial); BuildStairTreads(transform, num, 8f, 4f, num2 - num3 * 0.5f, width); BuildRamp(transform, "Slide", num, 5.5f, 4f, num2 + num3 * 0.5f, width, BackroomsMaterials.MetalPanelMaterial); BuildSlideRails(transform, num, 5.5f, 4f, num2 + num3 * 0.5f, width); AddLight(transform, new Vector3(num8, 2.6f, num9), new Color(0.6f, 0.85f, 1f), 1.3f, 20f, "Sub Light"); AddLight(transform, new Vector3(num + 3f, 1f, num2), new Color(0.7f, 0.9f, 1f), 0.8f, 10f, "Sub Entry Light"); CreateBox(transform, "Sub Water", new Vector3(num8, num4 + 0.12f, num9), Quaternion.identity, new Vector3(num10 - 1.5f, 0.05f, num11 - 1.5f), BackroomsMaterials.WaterMaterial, solid: false); map.ValuableSpots.Add(new BackroomsValuableSpot { Position = new Vector3(num8 + 4f, num4 + 0.3f, num9), Forward = Vector3.left, Type = (Type)3 }); map.ValuableSpots.Add(new BackroomsValuableSpot { Position = new Vector3(num8 + 4f, num4 + 0.3f, num9 + 3.5f), Forward = Vector3.left, Type = (Type)2 }); map.ValuableSpots.Add(new BackroomsValuableSpot { Position = new Vector3(num8 + 4f, num4 + 0.3f, num9 - 3.5f), Forward = Vector3.left, Type = (Type)2 }); map.ValuableSpots.Add(new BackroomsValuableSpot { Position = new Vector3(num8, num4 + 0.3f, num9 + 5.5f), Forward = Vector3.back, Type = (Type)4 }); map.Waypoints.Add(new Vector3(num8, num4 + 0.1f, num9)); map.Waypoints.Add(new Vector3(num8 + 4f, num4 + 0.1f, num9 + 3.5f)); map.Waypoints.Add(new Vector3(num + 3f, num4 + 0.1f, num2)); } private static void BuildRamp(Transform parent, string name, float topX, float run, float drop, float zCenter, float width, Material material) { //IL_0041: 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) float num = Mathf.Atan2(drop, run) * 57.29578f; float num2 = Mathf.Sqrt(run * run + drop * drop) + 0.7f; Vector3 position = default(Vector3); ((Vector3)(ref position))..ctor(topX + run * 0.5f, (0f - drop) * 0.5f, zCenter); CreateBox(parent, name, position, Quaternion.Euler(0f, 0f, 0f - num), new Vector3(num2, 0.3f, width), material, solid: true); } private static void BuildStairTreads(Transform parent, float topX, float run, float drop, float zCenter, float width) { //IL_0041: 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_005c: Unknown result type (might be due to invalid IL or missing references) int num = 8; for (int i = 0; i < num; i++) { float num2 = topX + ((float)i + 0.5f) * (run / (float)num); float num3 = (0f - ((float)i + 0.5f)) * (drop / (float)num); CreateBox(parent, "Tread " + i, new Vector3(num2, num3 + 0.06f, zCenter), Quaternion.identity, new Vector3(run / (float)num + 0.06f, 0.08f, width), BackroomsMaterials.TrimMaterial, solid: false); } } private static void BuildSlideRails(Transform parent, float topX, float run, float drop, float zCenter, float width) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0070: 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) //IL_0097: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Atan2(drop, run) * 57.29578f; float num2 = Mathf.Sqrt(run * run + drop * drop) + 0.7f; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(topX + run * 0.5f, (0f - drop) * 0.5f + 0.28f, zCenter); CreateBox(parent, "Slide Rail A", val + new Vector3(0f, 0f, width * 0.5f), Quaternion.Euler(0f, 0f, 0f - num), new Vector3(num2, 0.55f, 0.1f), BackroomsMaterials.MetalPanelMaterial, solid: true); CreateBox(parent, "Slide Rail B", val + new Vector3(0f, 0f, (0f - width) * 0.5f), Quaternion.Euler(0f, 0f, 0f - num), new Vector3(num2, 0.55f, 0.1f), BackroomsMaterials.MetalPanelMaterial, solid: true); } private static void BuildPillars(Transform parent) { //IL_0036: 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_004b: Unknown result type (might be due to invalid IL or missing references) Vector3 position = default(Vector3); for (int i = -1; i < 10; i++) { for (int j = -1; j < 10; j++) { ((Vector3)(ref position))..ctor(((float)i + 0.5f) * 6.5f, 1.5f, ((float)j + 0.5f) * 6.5f); CreateBox(parent, "Pillar", position, Quaternion.identity, new Vector3(0.5f, 3f, 0.5f), BackroomsMaterials.PillarMaterial, solid: true); } } } private static void BuildPoolWater(Transform parent, BackroomsTheme[,] theme) { //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_0021: 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_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_004b: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if (theme[i, j] == BackroomsTheme.Pool) { Vector3 val = Cell(i, j); CreateBox(parent, "Water", new Vector3(val.x, 0.12f, val.z), Quaternion.identity, new Vector3(6.5f, 0.04f, 6.5f), BackroomsMaterials.WaterMaterial, solid: false); } } } } private static void BuildWaypointsAndSpawns(BackroomsMap map, BackroomsTheme[,] theme, int ax, int az) { //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_00bf: 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_00d8: 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_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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_0157: 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_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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0074: 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) for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { Vector3 val = Cell(i, j); map.Waypoints.Add(val + Vector3.up * 0.1f); int num = Mathf.Abs(i) + Mathf.Abs(j); bool flag = Mathf.Abs(i - ax) <= 1 && Mathf.Abs(j - az) <= 1; if (num >= 6 && !flag) { map.EnemySpawnPoints.Add(val + Vector3.up * 0.1f); } } } map.SpawnPositions.Add(Cell(0, 0) + Vector3.up); map.SpawnPositions.Add(Cell(0, 0) + new Vector3(1.2f, 1f, 0.6f)); map.SpawnPositions.Add(Cell(0, 0) + new Vector3(-0.6f, 1f, 1.2f)); map.SpawnPositions.Add(Cell(1, 0) + Vector3.up); map.SpawnPositions.Add(Cell(0, 1) + Vector3.up); map.SpawnPositions.Add(Cell(1, 1) + Vector3.up); if (map.EnemySpawnPoints.Count == 0) { map.EnemySpawnPoints.Add(Cell(9, 9)); } } private static void BuildValuableSpots(BackroomsMap map, Random rng, BackroomsTheme[,] theme, int ax, int az) { //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_00d0: 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_00e1: 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_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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) Type[] array = new Type[7]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); Type[] array2 = (Type[])(object)array; int num = 0; int num2 = 0; Vector3 val2 = default(Vector3); while (num < 30 && num2 < 400) { num2++; int num3 = rng.Next(10); int num4 = rng.Next(10); if (Mathf.Abs(num3 - ax) > 1 || Mathf.Abs(num4 - az) > 1 || !(rng.NextDouble() < 0.7)) { Vector3 val = Cell(num3, num4); ((Vector3)(ref val2))..ctor((float)(rng.NextDouble() - 0.5) * 4.5f, 0f, (float)(rng.NextDouble() - 0.5) * 4.5f); float num5 = ((theme[num3, num4] == BackroomsTheme.Pool) ? 0.2f : 0.3f); map.ValuableSpots.Add(new BackroomsValuableSpot { Position = new Vector3(val.x + val2.x, num5, val.z + val2.z), Forward = Vector3.forward, Type = array2[rng.Next(array2.Length)] }); num++; } } } private static Light AddLight(Transform parent, Vector3 localPosition, 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 = localPosition; 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; } } internal static class BackroomsMaterials { private static int _seed = 4040; public static Material WallpaperMaterial { get; private set; } public static Material CarpetMaterial { get; private set; } public static Material CeilingTileMaterial { get; private set; } public static Material FluorescentOnMaterial { get; private set; } public static Material FluorescentOffMaterial { get; private set; } public static Material PoolWallMaterial { get; private set; } public static Material PoolFloorMaterial { get; private set; } public static Material WaterMaterial { get; private set; } public static Material ConcreteMaterial { get; private set; } public static Material TrimMaterial { get; private set; } public static Material PillarMaterial { get; private set; } public static Material WetStainMaterial { get; private set; } public static Material MetalPanelMaterial { 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_009f: 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_00e0: 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_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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0229: 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_026f: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)WallpaperMaterial != (Object)null)) { WallpaperMaterial = OpaqueTextured(Wallpaper(new Color(0.78f, 0.69f, 0.32f), new Color(0.66f, 0.57f, 0.24f)), 0.02f, 0.18f); CarpetMaterial = OpaqueTextured(Carpet(new Color(0.55f, 0.47f, 0.18f), new Color(0.43f, 0.36f, 0.13f)), 0f, 0.05f); CeilingTileMaterial = OpaqueTextured(DropCeiling(new Color(0.82f, 0.79f, 0.66f), new Color(0.5f, 0.48f, 0.4f)), 0.02f, 0.1f); FluorescentOnMaterial = CreateEmissive(new Color(1f, 0.98f, 0.85f), 2.6f); FluorescentOffMaterial = OpaqueColor(new Color(0.3f, 0.3f, 0.28f), 0.1f, 0.2f); PoolWallMaterial = OpaqueTextured(Tiles(new Color(0.85f, 0.9f, 0.92f), new Color(0.5f, 0.62f, 0.66f), 12), 0.1f, 0.55f); PoolFloorMaterial = OpaqueTextured(Tiles(new Color(0.7f, 0.83f, 0.88f), new Color(0.42f, 0.56f, 0.62f), 16), 0.12f, 0.6f); WaterMaterial = CreateTransparent(new Color(0.3f, 0.62f, 0.72f, 0.55f)); ConcreteMaterial = OpaqueTextured(Concrete(new Color(0.26f, 0.26f, 0.27f)), 0.05f, 0.15f); TrimMaterial = OpaqueColor(new Color(0.7f, 0.62f, 0.42f), 0.05f, 0.25f); PillarMaterial = OpaqueTextured(Wallpaper(new Color(0.72f, 0.63f, 0.29f), new Color(0.58f, 0.5f, 0.21f)), 0.02f, 0.16f); WetStainMaterial = CreateTransparent(new Color(0.18f, 0.16f, 0.06f, 0.4f)); MetalPanelMaterial = OpaqueColor(new Color(0.4f, 0.42f, 0.46f), 0.65f, 0.55f); } } 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.5f, color.g * 0.5f, color.b * 0.5f, 1f); if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.4f); } 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.7f); } 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 Wallpaper(Color baseColor, Color shade) { //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_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_007d: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00b8: 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) 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.6f) * 0.04f; float num3 = Mathf.Clamp01(Noise(j / 4, i / 4) * 0.3f + 0.7f); float num4 = Mathf.Clamp01((float)i / (float)num * 0.5f + 0.5f); Color val2 = Color.Lerp(shade, baseColor, num3); val2 *= (0.85f + num2) * num4; if (Noise(j / 9, i / 9) > 0.84f) { val2 = Color.Lerp(val2, shade * 0.7f, 0.5f); } array[i * num + j] = val2; } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D Carpet(Color baseColor, Color shade) { //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_0066: 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_0072: 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_007d: 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 = (Noise(j, i) * 0.5f + 0.5f) * 0.25f; float num3 = Mathf.Clamp01(Noise(j / 12, i / 12) * 0.4f + 0.7f); Color val2 = Color.Lerp(shade, baseColor, 0.5f + num2) * num3; array[i * num + j] = val2; } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D DropCeiling(Color tile, Color grid) { //IL_0063: 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_005c: 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_00a8: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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 = 64; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { bool num3 = j % num2 < 3 || i % num2 < 3; float num4 = Mathf.Clamp01(Noise(j, i) * 0.2f + 0.85f); Color val2 = (num3 ? grid : (tile * num4)); if (!num3 && Noise(j / 16, i / 16) > 0.8f) { val2 = Color.Lerp(val2, new Color(0.4f, 0.36f, 0.2f), 0.5f); } array[i * num + j] = val2; } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D Tiles(Color tile, Color grout, int cell) { //IL_0065: 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_005e: 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) 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 flag = j % cell < 2 || i % cell < 2; float num2 = Mathf.Clamp01(Noise(j / 3, i / 3) * 0.18f + 0.9f); array[i * num + j] = (flag ? grout : (tile * num2)); } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D Concrete(Color baseColor) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0060: 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_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) 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.4f + 0.6f); Color val2 = baseColor * (0.75f + 0.25f * num2); if (Noise(j / 7, i / 7) > 0.85f) { val2 = Color.Lerp(val2, Color.black, 0.3f); } array[i * num + j] = val2; } } 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 BackroomsPatchSetRunLevel { private static void Postfix(RunManager __instance) { if (EmpressBackroomsPlugin.Settings != null && EmpressBackroomsPlugin.Settings.ForceLevel.Value && !((Object)(object)EmpressBackroomsPlugin.BackroomsLevel == (Object)null)) { __instance.levelCurrent = EmpressBackroomsPlugin.BackroomsLevel; } } } [HarmonyPatch(typeof(LevelGenerator), "Generate")] internal static class BackroomsPatchGenerate { private static bool Prefix(LevelGenerator __instance, ref IEnumerator __result) { if (!EmpressBackroomsPlugin.IsBackroomsLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { return true; } __result = BackroomsRuntime.EnsureHost().GenerateLevel(__instance); return false; } } [HarmonyPatch(typeof(LevelPoint), "NavMeshCheck")] internal static class BackroomsPatchNavMeshCheck { private static bool Prefix(ref IEnumerator __result) { if (!EmpressBackroomsPlugin.IsBackroomsLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { return true; } __result = BackroomsRuntime.EmptyCoroutine(); return false; } } [HarmonyPatch(typeof(EnvironmentDirector), "Setup")] internal static class BackroomsPatchEnvironmentSetup { private static bool Prefix(EnvironmentDirector __instance) { //IL_0043: 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_0048: 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_0053: 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_0062: 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_0077: 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_009d: 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) if (!Object.op_Implicit((Object)(object)LevelGenerator.Instance)) { return true; } Level level = LevelGenerator.Instance.Level; if (!Object.op_Implicit((Object)(object)level) || !EmpressBackroomsPlugin.IsBackroomsLevel(level)) { return true; } BackroomsRuntime instance = BackroomsRuntime.Instance; Color val = (((Object)(object)instance != (Object)null) ? instance.CurrentFogColor : level.FogColor); Color val2 = (((Object)(object)instance != (Object)null) ? instance.CurrentAmbientColor : level.AmbientColor); BackroomsAccess.SetEnvironmentFog(__instance, val, level.FogStartDistance, level.FogEndDistance); BackroomsAccess.SetEnvironmentAmbient(__instance, val2, level.AmbientColorAdaptation); RenderSettings.fogColor = val; RenderSettings.fogStartDistance = level.FogStartDistance; RenderSettings.fogEndDistance = level.FogEndDistance; RenderSettings.ambientLight = val2; Camera val3 = BackroomsAccess.GetEnvironmentMainCamera(__instance); if (!Object.op_Implicit((Object)(object)val3)) { val3 = Camera.main; BackroomsAccess.SetEnvironmentMainCamera(__instance, val3); } if (Object.op_Implicit((Object)(object)val3)) { val3.backgroundColor = RenderSettings.fogColor; val3.farClipPlane = RenderSettings.fogEndDistance + 10f; } BackroomsAccess.SetEnvironmentDarkAdaptation(__instance, 0.5f); BackroomsAccess.SetEnvironmentSetupDone(__instance, value: true); return false; } } [HarmonyPatch(typeof(LoadingUI), "LevelAnimationStart")] internal static class BackroomsPatchLoadingUi { 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 (EmpressBackroomsPlugin.IsBackroomsLevel(Object.op_Implicit((Object)(object)LevelGenerator.Instance) ? LevelGenerator.Instance.Level : null)) { if ((Object)(object)__instance.levelNumberText != (Object)null) { ((TMP_Text)__instance.levelNumberText).text = "LEVEL 0"; ((Graphic)__instance.levelNumberText).color = new Color(0.93f, 0.86f, 0.35f); ((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 - The Backrooms"; ((Graphic)__instance.levelNameText).color = new Color(0.9f, 0.85f, 0.6f); ((Component)__instance.levelNameText).gameObject.SetActive(true); ((TMP_Text)__instance.levelNameText).transform.SetAsLastSibling(); ApplyHint(__instance); } } } private static void ApplyHint(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 Backrooms 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 Backrooms Loading Hint"; } ((TMP_Text)val2).text = "Find the extraction. Mind the ones that share the walls with you."; ((Graphic)val2).color = new Color(0.66f, 0.62f, 0.45f); ((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 BackroomsPatchIconLights { private static bool Prefix(ItemManager __instance, ref IEnumerator __result) { if (!EmpressBackroomsPlugin.IsBackroomsLevel(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 && !BackroomsAccess.GetItemHasIcon(val)) { flag = true; break; } } if (!flag) { break; } yield return (object)new WaitForSeconds(0.2f); } itemManager.itemIconLights.SetActive(false); } } internal sealed class BackroomsRuntime : MonoBehaviour { private readonly Dictionary _enemies = new Dictionary(); private readonly List _syncBuffer = new List(); private int _losMask = -1; private BackroomsMap _map; private BackroomsElevator _elevator; private Transform _root; private Transform _moduleRoot; private Transform _enemyRoot; private GameObject _elevatorSeal; private AudioSource _ambience; private int _sceneHandle = -1; private bool _active; private int _seed; private float _enemySyncTimer; private float _rosterResendTimer; private float _rosterResendUntil; private float _shiftTimer; private int _shiftPhase; private float _dripTimer; private float _scareTimer; private float _haulEnforceTimer; private bool _haulGoalLocked; private bool _enemiesSpawned; private bool _extractionComplete; private bool _exitSpawned; private bool _smokeSpawned; private float _exitCheckTimer; private float _objectiveTimer; public static BackroomsRuntime Instance { get; private set; } public Color CurrentFogColor { get; private set; } = new Color(0.16f, 0.15f, 0.07f); public Color CurrentAmbientColor { get; private set; } = new Color(0.42f, 0.39f, 0.2f); public static BackroomsRuntime 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 Backrooms 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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Instance = this; GameObject val = new GameObject("Empress Backrooms Ambience"); val.transform.SetParent(((Component)this).transform, false); _ambience = val.AddComponent(); _ambience.loop = true; _ambience.playOnAwake = false; _ambience.spatialBlend = 0f; _ambience.volume = 0.3f; } private void Update() { HandleSceneTransition(); if (!_active) { return; } if (!EmpressBackroomsPlugin.IsBackroomsLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { Deactivate(); return; } float deltaTime = Time.deltaTime; bool flag = SemiFunc.IsMasterClientOrSingleplayer(); UpdateShift(deltaTime, flag); UpdateScares(deltaTime, flag); UpdateDrips(deltaTime); UpdateExitObjective(deltaTime); if (flag) { EnforceHaulGoalTick(deltaTime); CheckExtractionComplete(deltaTime); UpdateEnemyBrain(deltaTime); UpdateEnemySync(deltaTime); UpdateRosterResend(deltaTime); } else { ClientTickEnemies(deltaTime); } } private void UpdateDrips(float dt) { //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_0048: 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_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_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) _dripTimer -= dt; if (!(_dripTimer > 0f)) { _dripTimer = Random.Range(12f, 26f); PlayerAvatar val = LocalAvatar(); if ((Object)(object)val != (Object)null) { Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 val2 = ((Vector2)(ref insideUnitCircle)).normalized * Random.Range(5f, 12f); BackroomsAudio.PlayDrip(((Component)val).transform.position + new Vector3(val2.x, Random.Range(0.5f, 2.5f), val2.y)); } } } private static PlayerAvatar LocalAvatar() { if (!((Object)(object)PlayerController.instance != (Object)null)) { return null; } return PlayerController.instance.playerAvatarScript; } private static bool IsPlayable(PlayerAvatar avatar) { if ((Object)(object)avatar != (Object)null && !BackroomsAccess.GetIsDisabled(avatar)) { return !BackroomsAccess.GetDeadSet(avatar); } return false; } private List PlayablePlayers() { 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); } } } if (list.Count == 0) { PlayerAvatar val2 = LocalAvatar(); if (IsPlayable(val2)) { list.Add(val2); } } return list; } private void UpdateEnemyBrain(float dt) { //IL_0058: 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_007e: 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_00d2: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) if (_map == null) { return; } List list = PlayablePlayers(); foreach (KeyValuePair enemy in _enemies) { BackroomsEnemy value = enemy.Value; if ((Object)(object)value == (Object)null || value.Dead) { continue; } PlayerAvatar val = null; float num = float.MaxValue; for (int i = 0; i < list.Count; i++) { float num2 = Vector3.Distance(value.Position, ((Component)list[i]).transform.position); if (num2 < num && HasLineOfSight(value.EyePoint, EyeOf(list[i]))) { num = num2; val = list[i]; } } bool flag = (Object)(object)val != (Object)null; Vector3 targetPosition = (flag ? ((Component)val).transform.position : value.Position); if (value.HostThink(dt, flag, targetPosition, num, _map.Waypoints) && (Object)(object)val != (Object)null) { HostEnemyAttack(value, val, list); } if (value.WantsReappear) { value.Reappear(ComputeReappearSpot(list, value.Position)); } if (value.ConsumeHit()) { EmpressBackroomsPlugin.RaiseToOthers(193, new object[1] { -enemy.Key - 1 }); } } CleanupDeadEnemies(); } private static Vector3 EyeOf(PlayerAvatar avatar) { //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_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) return ((Component)avatar).transform.position + Vector3.up * 1.4f; } private bool HasLineOfSight(Vector3 from, Vector3 to) { //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_0029: 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_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) if (_losMask == -1) { _losMask = LayerMask.GetMask(new string[1] { "Default" }); } Vector3 val = to - from; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 1.2f) { return true; } return !Physics.Raycast(from, val / magnitude, magnitude - 1f, _losMask, (QueryTriggerInteraction)1); } private void HostEnemyAttack(BackroomsEnemy enemy, PlayerAvatar target, List players) { //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_00c4: 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_00e4: 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_00e9: 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_0087: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null || (Object)(object)target.playerHealth == (Object)null || BackroomsAccess.GetDeadSet(target)) { return; } int num = (((Object)(object)target.photonView != (Object)null) ? target.photonView.ViewID : (-1)); if (enemy.Kind == BackroomsEnemyKind.SmokeCharger) { HostChargerSlam(enemy, target, num); return; } float value = Random.value; int num2; if (value < 0.5f) { num2 = 0; PlayerTumble playerTumble = BackroomsAccess.GetPlayerTumble(target); if ((Object)(object)playerTumble != (Object)null) { playerTumble.TumbleRequest(true, false); } if (SemiFunc.IsMultiplayer()) { target.playerHealth.HurtOther(18, Vector3.zero, false, -1, false); } else { target.playerHealth.Hurt(18, false, -1, false); } } else if (value < 0.78f) { num2 = 1; Vector3 val = ComputeReappearSpot(players, ((Component)target).transform.position); Quaternion val2 = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); target.Spawn(val, val2); } else { num2 = 2; } EmpressBackroomsPlugin.RaiseToAll(192, new object[3] { num, ((Component)target).transform.position, num2 }); enemy.BeginVanish(Random.Range(4.5f, 7.5f)); } private void HostChargerSlam(BackroomsEnemy enemy, PlayerAvatar target, int viewId) { //IL_0021: 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_00cd: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0118: 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_0062: 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_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_00b4: Unknown result type (might be due to invalid IL or missing references) PlayerTumble playerTumble = BackroomsAccess.GetPlayerTumble(target); if ((Object)(object)playerTumble != (Object)null) { playerTumble.TumbleRequest(true, false); Vector3 val = ((Component)target).transform.position - enemy.Position; val.y = 0f; val = ((((Vector3)(ref val)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val)).normalized : ((Component)target).transform.forward); playerTumble.TumbleForce(val * 16f + Vector3.up * 11f); playerTumble.TumbleTorque(new Vector3(Random.Range(-9f, 9f), Random.Range(-9f, 9f), Random.Range(-9f, 9f))); } if (SemiFunc.IsMultiplayer()) { target.playerHealth.HurtOther(30, Vector3.zero, false, -1, false); } else { target.playerHealth.Hurt(30, false, -1, false); } BackroomsAudio.PlayCharge(((Component)target).transform.position); EmpressBackroomsPlugin.RaiseToAll(192, new object[3] { viewId, ((Component)target).transform.position, 3 }); enemy.BeginVanish(Random.Range(5f, 8f)); } internal void ReceivePlayerHit(object[] data) { //IL_002f: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_0100: 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_00eb: 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_0132: 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_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_0196: Unknown result type (might be due to invalid IL or missing references) if (data == null || data.Length < 3 || !(data[0] is int num) || !(data[1] is Vector3 position) || !(data[2] is int num2)) { return; } PlayerAvatar val = LocalAvatar(); if ((Object)(object)val == (Object)null) { return; } int num3 = (((Object)(object)val.photonView != (Object)null) ? val.photonView.ViewID : (-1)); if (num > 0 && num3 != num) { BackroomsAudio.PlayGrowl(position); return; } Vector3 position2 = ((Component)val).transform.position; BackroomsAudio.PlaySting(position2); switch (num2) { case 1: BackroomsAudio.PlayShift(position2); if ((Object)(object)CameraGlitch.Instance != (Object)null) { CameraGlitch.Instance.PlayLong(); } SemiFunc.UIFocusText("The walls rearranged around you.", new Color(0.85f, 0.8f, 1f), Color.white, 3.5f); break; case 2: BackroomsAudio.PlayGrowl(position2); if ((Object)(object)CameraGlitch.Instance != (Object)null) { CameraGlitch.Instance.PlayLong(); } SemiFunc.UIFocusText("Was that ever really there?", new Color(0.9f, 0.7f, 0.7f), Color.white, 3.5f); break; case 3: if ((Object)(object)CameraGlitch.Instance != (Object)null) { CameraGlitch.Instance.PlayLong(); } SemiFunc.CameraShakeImpact(3.5f, 0.5f); SemiFunc.UIFocusText("The smoke slammed through you.", new Color(0.7f, 0.85f, 1f), Color.white, 3.5f); break; default: BackroomsAudio.PlayGrowl(position2); if ((Object)(object)CameraGlitch.Instance != (Object)null) { CameraGlitch.Instance.PlayShort(); } break; } } private Vector3 ComputeReappearSpot(List players, Vector3 current) { //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_0025: 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_0109: 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_0077: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_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 (_map == null || _map.Waypoints.Count == 0 || players.Count == 0) { return current; } Vector3 result = current; float num = float.MinValue; for (int i = 0; i < 14; i++) { Vector3 val = _map.Waypoints[Random.Range(0, _map.Waypoints.Count)]; float num2 = float.MaxValue; bool flag = false; for (int j = 0; j < players.Count; j++) { float num3 = Vector3.Distance(val, ((Component)players[j]).transform.position); if (num3 < num2) { num2 = num3; } if (HasLineOfSight(val + Vector3.up * 1.5f, EyeOf(players[j]))) { flag = true; } } if (!(num2 < 7f)) { float num4 = (flag ? 0f : 100f) - Mathf.Abs(num2 - 12f); if (num4 > num) { num = num4; result = val; } } } return result; } private void UpdateEnemySync(float dt) { //IL_00b9: 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_00ef: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMultiplayer() || !PhotonNetwork.InRoom || _enemies.Count == 0) { return; } _enemySyncTimer -= dt; if (_enemySyncTimer > 0f) { return; } _enemySyncTimer = 0.1f; _syncBuffer.Clear(); _syncBuffer.Add(1); _syncBuffer.Add(_enemies.Count); foreach (KeyValuePair enemy in _enemies) { BackroomsEnemy value = enemy.Value; _syncBuffer.Add(enemy.Key); _syncBuffer.Add(value.Position.x); _syncBuffer.Add(value.Position.y); _syncBuffer.Add(value.Position.z); _syncBuffer.Add(value.Yaw); _syncBuffer.Add((int)value.State); _syncBuffer.Add(value.Health); _syncBuffer.Add(value.Hidden); } EmpressBackroomsPlugin.RaiseToOthers(190, _syncBuffer.ToArray(), reliable: false); } private void UpdateRosterResend(float dt) { if (!(Time.time > _rosterResendUntil) && SemiFunc.IsMultiplayer() && PhotonNetwork.InRoom) { _rosterResendTimer -= dt; if (!(_rosterResendTimer > 0f)) { _rosterResendTimer = 2.5f; BroadcastRoster(); } } } private void BroadcastRoster() { if (!SemiFunc.IsMultiplayer() || !PhotonNetwork.InRoom) { return; } List list = new List { 0, _enemies.Count }; foreach (KeyValuePair enemy in _enemies) { list.Add(enemy.Key); list.Add((int)(((Object)(object)enemy.Value != (Object)null) ? enemy.Value.Kind : BackroomsEnemyKind.Smiler)); } EmpressBackroomsPlugin.RaiseToOthers(190, list.ToArray()); } internal void ReceiveEnemySync(object[] data) { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer() || data == null || data.Length < 2 || !(data[0] is int num)) { return; } switch (num) { case 0: ReceiveRoster(data); break; case 1: { if (!(data[1] is int num2)) { break; } int num3 = 2; Vector3 position = default(Vector3); bool flag = default(bool); for (int i = 0; i < num2; i++) { if (num3 + 7 >= data.Length) { break; } int key = (int)data[num3]; ((Vector3)(ref position))..ctor(ToFloat(data[num3 + 1]), ToFloat(data[num3 + 2]), ToFloat(data[num3 + 3])); float yaw = ToFloat(data[num3 + 4]); int num4 = (int)data[num3 + 5]; int health = (int)data[num3 + 6]; object obj = data[num3 + 7]; int num5; if (obj is bool) { flag = (bool)obj; num5 = 1; } else { num5 = 0; } bool hidden = (byte)((uint)num5 & (flag ? 1u : 0u)) != 0; num3 += 8; if (_enemies.TryGetValue(key, out var value) && (Object)(object)value != (Object)null) { value.ApplyClientSync(position, yaw, (BackroomsEnemyState)Mathf.Clamp(num4, 0, 4), health, hidden); } } break; } } } private void ReceiveRoster(object[] data) { if (data.Length < 2 || !(data[1] is int num) || (Object)(object)_enemyRoot == (Object)null) { return; } int num2 = 2; for (int i = 0; i < num; i++) { if (num2 + 1 >= data.Length) { break; } int num3 = (int)data[num2]; int num4 = (int)data[num2 + 1]; num2 += 2; if (!_enemies.ContainsKey(num3)) { BackroomsEnemy value = BackroomsEnemy.Create(_enemyRoot, num3, EmpressBackroomsPlugin.Settings.EnemySpeed.Value, isHost: false, (BackroomsEnemyKind)Mathf.Clamp(num4, 0, 1)); _enemies[num3] = value; } } } internal void ReceiveEnemyDeath(object[] data) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (data == null || data.Length < 1 || !(data[0] is int num)) { return; } BackroomsEnemy value2; if (num < 0) { int key = -num - 1; if (_enemies.TryGetValue(key, out var value) && (Object)(object)value != (Object)null) { BackroomsAudio.PlayHit(value.Position); } } else if (_enemies.TryGetValue(num, out value2) && (Object)(object)value2 != (Object)null) { value2.Kill(playEffect: true); } } private void ClientTickEnemies(float dt) { foreach (KeyValuePair enemy in _enemies) { if ((Object)(object)enemy.Value != (Object)null) { enemy.Value.ClientTick(dt); } } } private void CleanupDeadEnemies() { List list = null; foreach (KeyValuePair enemy in _enemies) { if ((Object)(object)enemy.Value == (Object)null) { if (list == null) { list = new List(); } list.Add(enemy.Key); } else if (enemy.Value.Dead && enemy.Value.Health <= 0) { EmpressBackroomsPlugin.RaiseToOthers(193, new object[1] { enemy.Key }); if (list == null) { list = new List(); } list.Add(enemy.Key); } } if (list != null) { for (int i = 0; i < list.Count; i++) { _enemies.Remove(list[i]); } } } private static float ToFloat(object value) { if (value is float) { return (float)value; } return 0f; } private void UpdateShift(float dt, bool host) { if (host) { _shiftTimer -= dt; if (!(_shiftTimer > 0f)) { _shiftTimer = EmpressBackroomsPlugin.Settings.ShiftInterval.Value; int num = (_shiftPhase + Random.Range(1, 3)) % 3; EmpressBackroomsPlugin.RaiseToAll(191, new object[1] { num }); } } } internal void ReceiveShift(object[] data) { if (data != null && data.Length >= 1 && data[0] is int num) { ApplyShift(Mathf.Clamp(num, 0, 2), announce: true); } } private void UpdateScares(float dt, bool host) { //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_005b: 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_0077: Unknown result type (might be due to invalid IL or missing references) if (host) { _scareTimer -= dt; if (!(_scareTimer > 0f)) { _scareTimer = Random.Range(18f, 38f); int num = Random.Range(0, 13); Vector3 val = RandomWaypoint(); EmpressBackroomsPlugin.RaiseToAll(194, new object[4] { num, val.x, val.y, val.z }); } } } private Vector3 RandomWaypoint() { //IL_005d: 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_003c: Unknown result type (might be due to invalid IL or missing references) if (_map != null && _map.Waypoints.Count > 0) { return _map.Waypoints[Random.Range(0, _map.Waypoints.Count)]; } PlayerAvatar val = LocalAvatar(); if (!((Object)(object)val != (Object)null)) { return Vector3.zero; } return ((Component)val).transform.position; } internal void ReceiveElevator(object[] data) { if ((Object)(object)_elevator != (Object)null) { _elevator.OnNetwork(data); } } internal void ReceiveScare(object[] data) { //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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: 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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) if (data == null || data.Length < 1 || !(data[0] is int num)) { return; } Vector3 zero = Vector3.zero; if (data.Length >= 4 && data[1] is float num2 && data[2] is float num3 && data[3] is float num4) { ((Vector3)(ref zero))..ctor(num2, num3, num4); } switch (num) { case 0: ((MonoBehaviour)this).StartCoroutine(BlackoutRoutine(Random.Range(1f, 2.5f))); break; case 1: ((MonoBehaviour)this).StartCoroutine(ShiftFlicker()); PlayBehindLocalPlayer(growl: true); break; case 2: ((MonoBehaviour)this).StartCoroutine(LightPulseRoutine()); break; case 3: PlayBehindLocalPlayer(growl: false); if ((Object)(object)CameraGlitch.Instance != (Object)null) { CameraGlitch.Instance.PlayTiny(); } break; case 4: ((MonoBehaviour)this).StartCoroutine(ElectricalSurgeRoutine()); break; case 5: ((MonoBehaviour)this).StartCoroutine(FogRollRoutine()); break; case 6: ((MonoBehaviour)this).StartCoroutine(HallwayWaveRoutine()); break; case 7: ((MonoBehaviour)this).StartCoroutine(CirclingWhispersRoutine()); break; case 8: ((MonoBehaviour)this).StartCoroutine(ApproachRoutine()); break; case 9: BackroomsAudio.PlayBang(ScarePoint(zero)); if ((Object)(object)CameraGlitch.Instance != (Object)null) { CameraGlitch.Instance.PlayShort(); } SemiFunc.UIFocusText("Something heavy fell somewhere far off.", new Color(0.9f, 0.8f, 0.75f), Color.white, 3f); break; case 10: BackroomsAudio.PlayScream(ScarePoint(zero)); SemiFunc.UIFocusText("A scream echoes through the walls.", new Color(0.95f, 0.7f, 0.7f), Color.white, 3f); break; case 11: CreepyMessage(); break; default: ((MonoBehaviour)this).StartCoroutine(LightRecolorRoutine()); break; } } private Vector3 ScarePoint(Vector3 broadcast) { //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_000d: 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_0029: 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_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_004c: 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_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_001e: Unknown result type (might be due to invalid IL or missing references) if (broadcast != Vector3.zero) { return broadcast; } PlayerAvatar val = LocalAvatar(); if ((Object)(object)val == (Object)null) { return Vector3.zero; } Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 val2 = ((Vector2)(ref insideUnitCircle)).normalized * Random.Range(12f, 20f); return ((Component)val).transform.position + new Vector3(val2.x, 0.5f, val2.y); } private Vector3 RandomCeilingPoint(Vector3 fallback) { //IL_0063: 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_0055: Unknown result type (might be due to invalid IL or missing references) if (_map != null && _map.CeilingLights.Count > 0) { for (int i = 0; i < 4; i++) { Light val = _map.CeilingLights[Random.Range(0, _map.CeilingLights.Count)]; if ((Object)(object)val != (Object)null) { return ((Component)val).transform.position; } } } return fallback + new Vector3(Random.Range(-4f, 4f), 0f, Random.Range(-4f, 4f)); } private void CreepyMessage() { //IL_0059: 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_0082: Unknown result type (might be due to invalid IL or missing references) string[] array = new string[7] { "You have been wandering longer than you think.", "Someone wrote your name on the wall behind you.", "The hum knows you are listening.", "Do not trust the doors that were not here before.", "It is closer when the lights are on.", "You are not the first to map these halls.", "Keep moving. It remembers stillness." }; SemiFunc.UIFocusText(array[Random.Range(0, array.Length)], new Color(0.8f, 0.85f, 0.95f), Color.white, 4f); PlayerAvatar val = LocalAvatar(); if ((Object)(object)val != (Object)null) { BackroomsAudio.PlaySting(((Component)val).transform.position); } } private IEnumerator ElectricalSurgeRoutine() { PlayerAvatar val = LocalAvatar(); Vector3 at = (((Object)(object)val != (Object)null) ? (((Component)val).transform.position + Vector3.up * 2f) : Vector3.zero); BackroomsAudio.PlayBuzz(at); for (int i = 0; i < 10; i++) { SetLightsEnabled(Random.value > 0.5f); if (Random.value > 0.6f) { BackroomsAudio.PlayBuzz(RandomCeilingPoint(at)); } yield return (object)new WaitForSeconds(Random.Range(0.03f, 0.11f)); } SetLightsEnabled(enabled: false); BackroomsAudio.PlaySting(at); if ((Object)(object)CameraGlitch.Instance != (Object)null) { CameraGlitch.Instance.PlayShort(); } yield return (object)new WaitForSeconds(0.4f); SetLightsEnabled(enabled: true); } private IEnumerator FogRollRoutine() { Color baseColor = RenderSettings.fogColor; float baseDensity = RenderSettings.fogDensity; BackroomsAudio.PlayShift(((Object)(object)LocalAvatar() != (Object)null) ? ((Component)LocalAvatar()).transform.position : Vector3.zero); Color thick = baseColor * 0.4f; float duration = Random.Range(4f, 7f); float elapsed = 0f; while (elapsed < duration) { elapsed += Time.deltaTime; float num = Mathf.Sin(Mathf.Clamp01(elapsed / duration) * MathF.PI); RenderSettings.fogColor = Color.Lerp(baseColor, thick, num); RenderSettings.fogDensity = Mathf.Lerp(baseDensity, baseDensity + 0.08f, num); yield return null; } RenderSettings.fogColor = CurrentFogColor; RenderSettings.fogDensity = baseDensity; } private IEnumerator HallwayWaveRoutine() { if (_map == null || _map.CeilingLights.Count == 0) { yield break; } List lights = _map.CeilingLights; for (int i = 0; i < lights.Count; i++) { Light light = lights[i]; if (!((Object)(object)light == (Object)null)) { bool wasEnabled = ((Behaviour)light).enabled; ((Behaviour)light).enabled = false; if (i % 2 == 0) { BackroomsAudio.PlayFootstep(((Component)light).transform.position); } yield return (object)new WaitForSeconds(0.06f); ((Behaviour)light).enabled = wasEnabled; } } } private IEnumerator CirclingWhispersRoutine() { PlayerAvatar local = LocalAvatar(); if ((Object)(object)local == (Object)null) { yield break; } int steps = Random.Range(5, 8); float angle = Random.Range(0f, MathF.PI * 2f); float radius = Random.Range(2.5f, 4.5f); for (int i = 0; i < steps; i++) { if ((Object)(object)local == (Object)null) { break; } angle += Random.Range(0.6f, 1.2f); BackroomsAudio.PlayWhisper(((Component)local).transform.position + new Vector3(Mathf.Cos(angle) * radius, 1.2f, Mathf.Sin(angle) * radius)); yield return (object)new WaitForSeconds(Random.Range(0.25f, 0.5f)); } } private IEnumerator ApproachRoutine() { PlayerAvatar local = LocalAvatar(); if ((Object)(object)local == (Object)null) { yield break; } Vector3 val = new Vector3(Random.Range(-1f, 1f), 0f, Random.Range(-1f, 1f)); Vector3 dir = ((Vector3)(ref val)).normalized; if (dir == Vector3.zero) { dir = ((Component)local).transform.forward; } int steps = Random.Range(6, 9); float distance = Random.Range(9f, 13f); for (int i = 0; i < steps; i++) { if ((Object)(object)local == (Object)null) { yield break; } float num = 1f - (float)i / (float)steps; BackroomsAudio.PlayFootstep(((Component)local).transform.position + dir * (distance * num) + Vector3.up * 0.3f); yield return (object)new WaitForSeconds(Random.Range(0.28f, 0.42f)); } if (!((Object)(object)local == (Object)null)) { BackroomsAudio.PlayGrowl(((Component)local).transform.position - ((Component)local).transform.forward * 1.5f + Vector3.up); BackroomsAudio.PlaySting(((Component)local).transform.position); if ((Object)(object)CameraGlitch.Instance != (Object)null) { CameraGlitch.Instance.PlayTiny(); } } } private IEnumerator LightRecolorRoutine() { Color[] array = (Color[])(object)new Color[4] { new Color(0.5f, 1f, 0.4f), new Color(1f, 0.55f, 0.1f), new Color(0.6f, 0.3f, 1f), new Color(0.2f, 0.8f, 0.9f) }; SetCeilingLights(array[Random.Range(0, array.Length)], 1.1f); BackroomsAudio.PlaySting(((Object)(object)LocalAvatar() != (Object)null) ? ((Component)LocalAvatar()).transform.position : Vector3.zero); yield return (object)new WaitForSeconds(Random.Range(5f, 9f)); ApplyShift(_shiftPhase, announce: false); } private void PlayBehindLocalPlayer(bool growl) { //IL_0016: 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_0035: 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_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_0054: 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) PlayerAvatar val = LocalAvatar(); if (!((Object)(object)val == (Object)null)) { Vector3 position = ((Component)val).transform.position - ((Component)val).transform.forward * Random.Range(2.5f, 5f) + Vector3.up; if (growl) { BackroomsAudio.PlayGrowl(position); } else { BackroomsAudio.PlayDrip(position); } } } private IEnumerator BlackoutRoutine(float duration) { SetLightsEnabled(enabled: false); BackroomsAudio.PlayShift(((Object)(object)LocalAvatar() != (Object)null) ? ((Component)LocalAvatar()).transform.position : Vector3.zero); yield return (object)new WaitForSeconds(duration); SetLightsEnabled(enabled: true); PlayBehindLocalPlayer(growl: true); } private IEnumerator LightPulseRoutine() { SetCeilingLights(new Color(1f, 0.2f, 0.15f), 0.6f); yield return (object)new WaitForSeconds(0.25f); SetCeilingLights(new Color(1f, 0.2f, 0.15f), 1.6f); yield return (object)new WaitForSeconds(0.18f); ApplyShift(_shiftPhase, announce: false); } private void ApplyShift(int phase, bool announce) { //IL_0027: 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_005b: 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_00ac: 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_00e0: 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_012e: 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_0162: 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_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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) _shiftPhase = phase; string text; string text2; switch (phase) { case 1: CurrentFogColor = new Color(0.1f, 0.02f, 0.02f); CurrentAmbientColor = new Color(0.28f, 0.07f, 0.06f); SetCeilingLights(new Color(1f, 0.25f, 0.18f), 0.5f); SetEmergency(enabled: true); TintCarpet(new Color(0.4f, 0.16f, 0.12f)); text = "THE WALLS REMEMBER YOU"; text2 = "{!}"; break; case 2: CurrentFogColor = new Color(0.07f, 0.12f, 0.14f); CurrentAmbientColor = new Color(0.3f, 0.45f, 0.5f); SetCeilingLights(new Color(0.7f, 0.9f, 1f), 1.3f); SetEmergency(enabled: false); TintCarpet(new Color(0.35f, 0.45f, 0.5f)); text = "THE DAMP CREEPS IN"; text2 = "{~}"; break; default: CurrentFogColor = new Color(0.16f, 0.15f, 0.07f); CurrentAmbientColor = new Color(0.42f, 0.39f, 0.2f); SetCeilingLights(new Color(1f, 0.97f, 0.82f), 1.2f); SetEmergency(enabled: false); TintCarpet(Color.white); text = "ALMOST FAMILIAR"; text2 = "{?}"; break; } ApplyEnvironment(); if (announce) { ((MonoBehaviour)this).StartCoroutine(ShiftFlicker()); BackroomsAudio.PlayShift(((Object)(object)LocalAvatar() != (Object)null) ? ((Component)LocalAvatar()).transform.position : Vector3.zero); SemiFunc.UIBigMessage(text, text2, 30f, new Color(0.95f, 0.85f, 0.4f), Color.white); } } private void ApplyEnvironment() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) RenderSettings.fogColor = CurrentFogColor; RenderSettings.ambientLight = CurrentAmbientColor; if ((Object)(object)EnvironmentDirector.Instance != (Object)null) { EnvironmentDirector.Instance.Setup(); } } private void SetCeilingLights(Color color, float intensity) { //IL_0029: 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_007b: Unknown result type (might be due to invalid IL or missing references) if (_map == null) { return; } for (int i = 0; i < _map.CeilingLights.Count; i++) { Light val = _map.CeilingLights[i]; if ((Object)(object)val != (Object)null) { val.color = color; val.intensity = intensity; } } if ((Object)(object)BackroomsMaterials.FluorescentOnMaterial != (Object)null && BackroomsMaterials.FluorescentOnMaterial.HasProperty("_EmissionColor")) { BackroomsMaterials.FluorescentOnMaterial.SetColor("_EmissionColor", color * 2.4f); } } private void SetEmergency(bool enabled) { if (_map == null) { return; } for (int i = 0; i < _map.EmergencyLights.Count; i++) { if ((Object)(object)_map.EmergencyLights[i] != (Object)null) { _map.EmergencyLights[i].SetActive(enabled); } } } private void TintCarpet(Color tint) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)BackroomsMaterials.CarpetMaterial != (Object)null) { BackroomsMaterials.CarpetMaterial.color = tint; } } private IEnumerator ShiftFlicker() { for (int i = 0; i < 6; i++) { SetLightsEnabled(Random.value > 0.45f); yield return (object)new WaitForSeconds(Random.Range(0.04f, 0.13f)); } SetLightsEnabled(enabled: true); } private void SetLightsEnabled(bool enabled) { if (_map == null) { return; } for (int i = 0; i < _map.CeilingLights.Count; i++) { if ((Object)(object)_map.CeilingLights[i] != (Object)null) { ((Behaviour)_map.CeilingLights[i]).enabled = enabled; } } for (int j = 0; j < _map.CeilingPanels.Count; j++) { Renderer val = _map.CeilingPanels[j]; if ((Object)(object)val != (Object)null) { val.sharedMaterial = (enabled ? BackroomsMaterials.FluorescentOnMaterial : BackroomsMaterials.FluorescentOffMaterial); } } } public IEnumerator GenerateLevel(LevelGenerator generator) { EmpressBackroomsPlugin.EnsurePhotonHooked(); BackroomsLevelRegistry.BorrowValuablePool(EmpressBackroomsPlugin.BackroomsLevel); LogValuablePool(); yield return (object)new WaitForSeconds(0.2f); if (!SemiFunc.IsMultiplayer()) { BackroomsAccess.SetAllPlayersReady(generator, value: true); } while (!BackroomsAccess.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; BackroomsAccess.SetLevelPrevious(RunManager.instance, generator.Level); generator.Generated = false; BackroomsAccess.SetEnemyReady(generator, value: true); BackroomsAccess.SetModulesSpawned(generator, 0); BackroomsAccess.SetPlayerSpawnedCount(generator, 0); generator.LevelPathPoints = new List(); generator.LevelPathTruck = null; if (Object.op_Implicit((Object)(object)RoundDirector.instance)) { BackroomsAccess.ResetRoundExtraction(RoundDirector.instance); } generator.State = (LevelState)3; _seed = ComputeSeed(); BuildLevel(generator); BackroomsRuntime backroomsRuntime = this; Scene activeScene = SceneManager.GetActiveScene(); backroomsRuntime._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 (BackroomsAccess.GetPlayerSpawnedCount(generator) < GameDirector.instance.PlayerList.Count) { generator.State = (LevelState)13; yield return (object)new WaitForSeconds(0.1f); } SpawnExtraction(); SpawnCarts(); if ((Object)(object)ValuableDirector.instance != (Object)null && EmpressBackroomsPlugin.Settings.SpawnValuables.Value) { yield return ValuableDirector.instance.SetupHost(); EmpressBackroomsPlugin.DebugLog("Empress Backrooms valuables: director target " + BackroomsAccess.GetValuableTargetAmount(ValuableDirector.instance) + "."); SpawnExtraValuables(); } if (SemiFunc.IsMultiplayer()) { generator.PhotonView.RPC("GenerateDone", (RpcTarget)3, Array.Empty()); } else { BackroomsAccess.GenerateDone(generator); } } else { while (!generator.Generated) { yield return (object)new WaitForSeconds(0.1f); } } yield return (object)new WaitForSeconds(0.5f); Activate(); } private int ComputeSeed() { int num = 91; 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 & 0x7FFFFFFF; } 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 BuildLevel(LevelGenerator generator) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //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_00e2: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown 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 Backrooms Root"); val.transform.SetParent(generator.LevelParent.transform, false); _root = val.transform; GameObject val2 = new GameObject("Empress Backrooms Module"); val2.transform.SetParent(val.transform, false); _moduleRoot = val2.transform; val2.AddComponent().ObservedComponents = new List(); BackroomsAccess.ConfigureStartRoomModule(val2.AddComponent(), 0, 0); val2.AddComponent(); GameObject val3 = new GameObject("Empress Backrooms Room Volume"); val3.transform.SetParent(val2.transform, false); RoomVolume roomVolume = val3.AddComponent(); BoxCollider obj = val3.AddComponent(); ((Collider)obj).isTrigger = true; obj.size = new Vector3(190f, 30f, 190f); obj.center = new Vector3(30f, 7f, 30f); _map = BackroomsMapBuilder.Build(val2.transform, _seed); if (_map.HasElevator) { _elevator = BackroomsElevator.Create(val2.transform, _map); } GameObject val4 = new GameObject("Empress Backrooms Entities"); val4.transform.SetParent(val.transform, false); _enemyRoot = val4.transform; BuildValuableVolumes(val2.transform); BuildSpawnPoints(val2.transform, roomVolume, generator); } private void SpawnExtraction() { //IL_003e: 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_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_00b7: 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_005d: 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) PrefabRef val = null; try { val = BackroomsLevelRegistry.FindExtractionPrefab(); } catch (Exception ex) { EmpressBackroomsPlugin.DebugLog("Empress Backrooms extraction lookup failed: " + ex.Message); } if (val == null || _map == null) { EmpressBackroomsPlugin.DebugLog("Empress Backrooms could not find an extraction module to borrow."); return; } Vector3 extractionPosition = _map.ExtractionPosition; Quaternion extractionRotation = _map.ExtractionRotation; if (SemiFunc.IsMultiplayer()) { GameObject val2 = PhotonNetwork.InstantiateRoomObject(val.ResourcePath, extractionPosition, extractionRotation, (byte)0, (object[])null); PhotonView val3 = (((Object)(object)val2 != (Object)null) ? val2.GetComponent() : null); if ((Object)(object)val3 != (Object)null) { StripModuleToExtractor(val2); EmpressBackroomsPlugin.RaiseToOthers(196, new object[1] { val3.ViewID }); } } else { StripModuleToExtractor(Object.Instantiate(val.Prefab, extractionPosition, extractionRotation)); } EmpressBackroomsPlugin.DebugLog("Empress Backrooms placed extraction (" + val.PrefabName + ") at the atrium."); } internal void ReceiveExtractionStrip(object[] data) { if (data != null && data.Length >= 1 && data[0] is int viewId) { ((MonoBehaviour)this).StartCoroutine(StripExtractionRoutine(viewId)); } } private IEnumerator StripExtractionRoutine(int viewId) { float timeout = Time.time + 8f; while (Time.time < timeout) { PhotonView val = PhotonView.Find(viewId); if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject.GetComponentInChildren(true) != (Object)null) { StripModuleToExtractor(((Component)val).gameObject); break; } yield return (object)new WaitForSeconds(0.2f); } } private static void StripModuleToExtractor(GameObject module) { if ((Object)(object)module == (Object)null) { return; } ExtractionPoint componentInChildren = module.GetComponentInChildren(true); if ((Object)(object)componentInChildren == (Object)null) { return; } Transform transform = ((Component)componentInChildren).transform; Renderer[] componentsInChildren = module.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)componentsInChildren[i] != (Object)null && !((Component)componentsInChildren[i]).transform.IsChildOf(transform)) { componentsInChildren[i].enabled = false; } } Collider[] componentsInChildren2 = module.GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren2.Length; j++) { if ((Object)(object)componentsInChildren2[j] != (Object)null && !((Component)componentsInChildren2[j]).transform.IsChildOf(transform)) { componentsInChildren2[j].enabled = false; } } Light[] componentsInChildren3 = module.GetComponentsInChildren(true); for (int k = 0; k < componentsInChildren3.Length; k++) { if ((Object)(object)componentsInChildren3[k] != (Object)null && !((Component)componentsInChildren3[k]).transform.IsChildOf(transform)) { ((Behaviour)componentsInChildren3[k]).enabled = false; } } Rigidbody[] componentsInChildren4 = module.GetComponentsInChildren(true); for (int l = 0; l < componentsInChildren4.Length; l++) { if ((Object)(object)componentsInChildren4[l] != (Object)null && !((Component)componentsInChildren4[l]).transform.IsChildOf(transform)) { componentsInChildren4[l].isKinematic = true; } } } private void SpawnCarts() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 //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_0137: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) if (_map == null || (Object)(object)StatsManager.instance == (Object)null || StatsManager.instance.itemDictionary == null) { return; } Item val = null; foreach (KeyValuePair item in StatsManager.instance.itemDictionary) { Item value = item.Value; if (!((Object)(object)value == (Object)null) && !value.disabled && (int)value.itemType == 2 && value.prefab != null && value.prefab.IsValid()) { if (item.Key == "Item Cart Medium" || value.itemName == "Item Cart Medium") { val = value; break; } if ((Object)(object)val == (Object)null) { val = value; } } } if ((Object)(object)val == (Object)null) { EmpressBackroomsPlugin.DebugLog("Empress Backrooms found no cart item in the item dictionary."); return; } Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(1.2f, 0.6f, 2.6f); Quaternion val3 = Quaternion.Euler(0f, 0f, 0f); if (SemiFunc.IsMultiplayer()) { PhotonNetwork.InstantiateRoomObject(val.prefab.ResourcePath, val2, val3, (byte)0, (object[])null); } else { Object.Instantiate(val.prefab.Prefab, val2, val3); } EmpressBackroomsPlugin.DebugLog("Empress Backrooms spawned a cart (" + val.itemName + ")."); } private void SpawnExtraValuables() { //IL_00c1: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_013e: 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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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) if (_map == null || _map.ValuableSpots.Count == 0) { return; } List list = BackroomsLevelRegistry.FindValuablePool(); if (list == null || list.Count == 0) { EmpressBackroomsPlugin.DebugLog("Empress Backrooms valuable top-up skipped: no pool to draw from."); return; } int num = (((Object)(object)ValuableDirector.instance != (Object)null) ? BackroomsAccess.GetValuableTargetAmount(ValuableDirector.instance) : 0); int value = EmpressBackroomsPlugin.Settings.ValuableTargetMin.Value; int num2 = Mathf.Max(value, EmpressBackroomsPlugin.Settings.ValuableTargetMax.Value); int num3 = Random.Range(value, num2 + 1); int num4 = Mathf.Max(0, num3 - num); int num5 = 0; for (int i = 0; i < num4; i++) { BackroomsValuableSpot backroomsValuableSpot = _map.ValuableSpots[Random.Range(0, _map.ValuableSpots.Count)]; PrefabRef val = PickValuable(list, backroomsValuableSpot.Type) ?? PickAnyValuable(list); if (val == null || !val.IsValid()) { continue; } Vector3 val2 = backroomsValuableSpot.Position + new Vector3(Random.Range(-1.6f, 1.6f), 0.2f, Random.Range(-1.6f, 1.6f)); Quaternion val3 = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); GameObject val4 = (SemiFunc.IsMultiplayer() ? PhotonNetwork.InstantiateRoomObject(val.ResourcePath, val2, val3, (byte)0, (object[])null) : Object.Instantiate(val.Prefab, val2, val3)); if ((Object)(object)val4 != (Object)null) { ValuableObject component = val4.GetComponent(); if ((Object)(object)component != (Object)null) { component.DollarValueSetLogic(); } num5++; } } EmpressBackroomsPlugin.DebugLog("Empress Backrooms scattered " + num5 + " extra valuable(s) (target total " + num3 + ")."); } private static PrefabRef PickValuable(List presets, Type type) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) List list = new List(); for (int i = 0; i < presets.Count; i++) { List valuableList = BackroomsAccess.GetValuableList(presets[i], type); if (valuableList != null) { list.AddRange(valuableList); } } if (list.Count <= 0) { return null; } return list[Random.Range(0, list.Count)]; } private static PrefabRef PickAnyValuable(List presets) { for (int i = 0; i < 7; i++) { PrefabRef val = PickValuable(presets, (Type)i); if (val != null) { return val; } } return null; } private void EnforceHaulGoalTick(float dt) { if (_haulGoalLocked || (Object)(object)RoundDirector.instance == (Object)null) { return; } _haulEnforceTimer -= dt; if (_haulEnforceTimer > 0f) { return; } _haulEnforceTimer = 0.5f; if (BackroomsAccess.GetExtractionPointActive(RoundDirector.instance)) { _haulGoalLocked = true; EmpressBackroomsPlugin.DebugLog("Empress Backrooms haul goal locked at " + BackroomsAccess.GetHaulGoal(RoundDirector.instance) + " (extraction activated)."); return; } int haulGoalMax = BackroomsAccess.GetHaulGoalMax(RoundDirector.instance); int value = EmpressBackroomsPlugin.Settings.HaulGoalMinimum.Value; int num = Mathf.Max(value, EmpressBackroomsPlugin.Settings.HaulGoalMaximum.Value); int num2 = Mathf.Clamp(Mathf.RoundToInt((float)haulGoalMax * 0.5f), value, num); if (BackroomsAccess.GetHaulGoal(RoundDirector.instance) < num2) { BackroomsAccess.SetHaulGoal(RoundDirector.instance, num2); } } private void CheckExtractionComplete(float dt) { //IL_0066: 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_006b: 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_0087: 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_00a8: Unknown result type (might be due to invalid IL or missing references) if (_extractionComplete || (Object)(object)RoundDirector.instance == (Object)null) { return; } _exitCheckTimer -= dt; if (!(_exitCheckTimer > 0f)) { _exitCheckTimer = 0.5f; if (BackroomsAccess.GetAllExtractionPointsCompleted(RoundDirector.instance)) { _extractionComplete = true; Vector3 val = ((_map != null) ? _map.PlayerStart : Vector3.zero); EmpressBackroomsPlugin.RaiseToOthers(197, new object[3] { val.x, val.y, val.z }); OnExtractionComplete(val); EmpressBackroomsPlugin.DebugLog("Empress Backrooms extraction complete; opening the exit elevator."); } } } internal void ReceiveExtractionDone(object[] data) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) Vector3 spot = ((_map != null) ? _map.PlayerStart : Vector3.zero); if (data != null && data.Length >= 3) { ((Vector3)(ref spot))..ctor(ToFloat(data[0]), ToFloat(data[1]), ToFloat(data[2])); } _extractionComplete = true; OnExtractionComplete(spot); } private void OnExtractionComplete(Vector3 spot) { //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_005d: 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_007c: 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) if (!_exitSpawned) { _exitSpawned = true; DestroyElevatorSeal(); SpawnExitElevator(); SemiFunc.UIBigMessage("GET BACK TO THE ELEVATOR", "{!}", 40f, new Color(0.6f, 1f, 0.7f), Color.white); SemiFunc.UIFocusText("The extraction is done. The elevator is open.", new Color(0.6f, 1f, 0.7f), Color.white, 5f); _objectiveTimer = 6f; BackroomsAudio.PlaySting(spot); if (SemiFunc.IsMasterClientOrSingleplayer()) { SpawnSmokeCharger(spot); } } } private void UpdateExitObjective(float dt) { //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) if (!_extractionComplete) { return; } _objectiveTimer -= dt; if (!(_objectiveTimer > 0f)) { _objectiveTimer = 8f; if (!LocalInsideElevator()) { SemiFunc.UIFocusText("Get back to the elevator.", new Color(0.6f, 1f, 0.7f), Color.white, 4f); } } } private bool LocalInsideElevator() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (_map == null) { return false; } PlayerAvatar val = LocalAvatar(); if ((Object)(object)val == (Object)null) { return false; } Bounds elevatorBounds = _map.ElevatorBounds; ((Bounds)(ref elevatorBounds)).Expand(0.6f); return ((Bounds)(ref elevatorBounds)).Contains(((Component)val).transform.position); } private void SpawnExitElevator() { if (_map != null && _map.HasElevator) { Transform parent = (((Object)(object)_moduleRoot != (Object)null) ? _moduleRoot : (((Object)(object)_root != (Object)null) ? _root : ((Component)this).transform)); _elevator = BackroomsElevator.CreateReturn(parent, _map); } } internal void RegisterElevatorSeal(GameObject seal) { _elevatorSeal = seal; } private void DestroyElevatorSeal() { if ((Object)(object)_elevatorSeal != (Object)null) { Object.Destroy((Object)(object)_elevatorSeal); } _elevatorSeal = null; } private void SpawnSmokeCharger(Vector3 awayFrom) { //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_0077: Unknown result type (might be due to invalid IL or missing references) if (!_smokeSpawned && !((Object)(object)_enemyRoot == (Object)null) && _map != null && EmpressBackroomsPlugin.Settings.EnableEnemies.Value) { _smokeSpawned = true; BackroomsEnemy backroomsEnemy = BackroomsEnemy.Create(_enemyRoot, 100, EmpressBackroomsPlugin.Settings.EnemySpeed.Value, isHost: true, BackroomsEnemyKind.SmokeCharger); backroomsEnemy.PlaceOnNavMesh(PickSmokeSpawn(awayFrom), Quaternion.Euler(0f, Random.Range(0f, 360f), 0f)); backroomsEnemy.SetState(BackroomsEnemyState.Search); _enemies[100] = backroomsEnemy; _rosterResendUntil = Time.time + 16f; _rosterResendTimer = 0f; BroadcastRoster(); EmpressBackroomsPlugin.DebugLog("Empress Backrooms smoke charger released."); } } private Vector3 PickSmokeSpawn(Vector3 awayFrom) { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_009c: Unknown result type (might be due to invalid IL or missing references) if (_map == null || _map.EnemySpawnPoints.Count == 0) { return awayFrom + Vector3.forward * 24f; } List list = new List(); for (int i = 0; i < _map.EnemySpawnPoints.Count; i++) { if (Vector3.Distance(_map.EnemySpawnPoints[i], awayFrom) > 14f) { list.Add(_map.EnemySpawnPoints[i]); } } if (list.Count > 0) { return list[Random.Range(0, list.Count)]; } return _map.EnemySpawnPoints[Random.Range(0, _map.EnemySpawnPoints.Count)]; } private void LogValuablePool() { List valuablePresets = BackroomsAccess.GetValuablePresets(EmpressBackroomsPlugin.BackroomsLevel); int num = 0; if (valuablePresets != null) { for (int i = 0; i < valuablePresets.Count; i++) { if (BackroomsAccess.PresetHasContent(valuablePresets[i])) { num++; } } } EmpressBackroomsPlugin.DebugLog("Empress Backrooms valuable pool: " + (valuablePresets?.Count ?? 0) + " preset(s), " + num + " with content."); } private void BuildValuableVolumes(Transform parent) { //IL_0038: 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_004a: 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_0075: 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_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_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_0087: 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_009c: Unknown result type (might be due to invalid IL or missing references) if (EmpressBackroomsPlugin.Settings.SpawnValuables.Value && _map != null) { for (int i = 0; i < _map.ValuableSpots.Count; i++) { BackroomsValuableSpot backroomsValuableSpot = _map.ValuableSpots[i]; GameObject val = new GameObject("Empress Backrooms Valuable Volume"); val.transform.SetParent(parent, false); val.transform.localPosition = backroomsValuableSpot.Position; Vector3 val2 = ((((Vector3)(ref backroomsValuableSpot.Forward)).sqrMagnitude > 0.01f) ? backroomsValuableSpot.Forward : Vector3.forward); val.transform.localRotation = Quaternion.LookRotation(val2, Vector3.up); val.AddComponent().VolumeType = backroomsValuableSpot.Type; } } } private void BuildSpawnPoints(Transform parent, RoomVolume roomVolume, LevelGenerator generator) { //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_001b: 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_0037: 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) //IL_0077: 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_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) for (int i = 0; i < _map.SpawnPositions.Count; i++) { GameObject val = new GameObject("Empress Backrooms Spawn"); val.transform.SetParent(parent, false); val.transform.localPosition = _map.SpawnPositions[i]; val.transform.localRotation = Quaternion.LookRotation(Vector3.forward, Vector3.up); val.AddComponent(); } LevelPoint val2 = CreateLevelPoint(parent, roomVolume, generator, _map.PlayerStart, truck: true); LevelPoint val3 = CreateLevelPoint(parent, roomVolume, generator, _map.PlayerStart + new Vector3(0f, 0f, 6.5f), 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 Backrooms 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; BackroomsAccess.MarkLevelPointInStartRoom(val2, value: true); if (generator.LevelPathPoints == null) { generator.LevelPathPoints = new List(); } generator.LevelPathPoints.Add(val2); return val2; } private void Activate() { //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) _active = true; _shiftPhase = 0; _shiftTimer = EmpressBackroomsPlugin.Settings.ShiftInterval.Value; _enemySyncTimer = 0f; _dripTimer = 4f; _scareTimer = Random.Range(20f, 36f); _enemiesSpawned = false; ApplyShift(0, announce: false); StartAmbience(); _haulGoalLocked = false; _haulEnforceTimer = 1f; _extractionComplete = false; _exitSpawned = false; _smokeSpawned = false; _exitCheckTimer = 1f; _objectiveTimer = 0f; if (SemiFunc.IsMasterClientOrSingleplayer()) { SpawnEnemies(); } SemiFunc.UIFocusText("Find the extraction. You are not alone in here.", new Color(0.95f, 0.88f, 0.5f), Color.white, 5f); EmpressBackroomsPlugin.DebugLog("Empress Backrooms activated (" + (SemiFunc.IsMasterClientOrSingleplayer() ? "host" : "client") + "), seed " + _seed + "."); } private void SpawnEnemies() { //IL_009d: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00be: Unknown result type (might be due to invalid IL or missing references) if (!_enemiesSpawned && !((Object)(object)_enemyRoot == (Object)null) && _map != null && EmpressBackroomsPlugin.Settings.EnableEnemies.Value) { _enemiesSpawned = true; List list = new List(_map.EnemySpawnPoints); BackroomsEnemy backroomsEnemy = BackroomsEnemy.Create(_enemyRoot, 0, EmpressBackroomsPlugin.Settings.EnemySpeed.Value, isHost: true); Vector3 position = ((list.Count > 0) ? list[Random.Range(0, list.Count)] : (_map.PlayerStart + Vector3.forward * 20f)); backroomsEnemy.PlaceOnNavMesh(position, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f)); backroomsEnemy.SetState(BackroomsEnemyState.Idle); _enemies[0] = backroomsEnemy; _rosterResendUntil = Time.time + 16f; _rosterResendTimer = 0f; BroadcastRoster(); } } private void StartAmbience() { if (!((Object)(object)_ambience == (Object)null) && !((Object)(object)BackroomsAudio.HumClip == (Object)null)) { if ((Object)(object)_ambience.clip != (Object)(object)BackroomsAudio.HumClip) { _ambience.clip = BackroomsAudio.HumClip; } _ambience.volume = 0.3f * ((EmpressBackroomsPlugin.Settings != null) ? EmpressBackroomsPlugin.Settings.MasterVolume.Value : 0.85f); if (!_ambience.isPlaying) { _ambience.Play(); } } } private void StopAmbience() { if ((Object)(object)_ambience != (Object)null && _ambience.isPlaying) { _ambience.Stop(); } } 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(); } } } private void Deactivate() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (!_active) { return; } _active = false; StopAmbience(); foreach (KeyValuePair enemy in _enemies) { if ((Object)(object)enemy.Value != (Object)null) { enemy.Value.Dispose(); } } _enemies.Clear(); TintCarpet(Color.white); _map = null; _elevator = null; _root = null; _moduleRoot = null; _enemyRoot = null; _elevatorSeal = null; _enemiesSpawned = false; _extractionComplete = false; _exitSpawned = false; _smokeSpawned = false; } } internal static class BackroomsSmilerAssets { private const string BundleName = "empress_backrooms_smiler"; private static AssetBundle _bundle; private static GameObject _prefab; private static bool _loaded; public static void Load() { if (_loaded) { return; } _loaded = true; string pluginDirectory = EmpressBackroomsPlugin.PluginDirectory; if (string.IsNullOrEmpty(pluginDirectory)) { return; } string text = Path.Combine(pluginDirectory, "empress_backrooms_smiler"); if (!File.Exists(text)) { EmpressBackroomsPlugin.Log.LogWarning((object)"Empress Backrooms Smiler bundle was not found beside the DLL."); return; } _bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)_bundle == (Object)null) { EmpressBackroomsPlugin.Log.LogWarning((object)"Empress Backrooms Smiler bundle could not be loaded."); return; } _prefab = _bundle.LoadAsset("EmpressBackroomsSmiler"); if ((Object)(object)_prefab == (Object)null) { GameObject[] array = _bundle.LoadAllAssets(); if (array != null && array.Length != 0) { _prefab = array[0]; } } if ((Object)(object)_prefab == (Object)null) { EmpressBackroomsPlugin.Log.LogWarning((object)"Empress Backrooms Smiler prefab was not found in the bundle."); } } public static GameObject CreateSmiler(Transform parent) { Load(); if ((Object)(object)_prefab == (Object)null) { return null; } GameObject obj = Object.Instantiate(_prefab, parent, false); ((Object)obj).name = "Empress Backrooms Smiler"; return obj; } } internal static class BackroomsSmokeAssets { private static Texture2D _puffTexture; private static Material _bodyMaterial; private static Material _glowMaterial; public static GameObject CreateSmoke(Transform parent) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_005c: 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_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_00d8: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0260: 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_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) EnsureAssets(); GameObject val = new GameObject("Empress Backrooms Smoke"); val.transform.SetParent(parent, false); GameObject val2 = new GameObject("Column"); val2.transform.SetParent(val.transform, false); BackroomsSmokeBillow backroomsSmokeBillow = val.AddComponent(); List list = new List(); AddPuff(val2.transform, list, new Vector3(0f, 0.35f, 0f), new Vector3(1.35f, 0.9f, 1f), _bodyMaterial, 0.9f); AddPuff(val2.transform, list, new Vector3(0.18f, 0.85f, 0f), new Vector3(1.2f, 1.15f, 1f), _bodyMaterial, 1f); AddPuff(val2.transform, list, new Vector3(-0.16f, 1.25f, 0f), new Vector3(1.25f, 1.2f, 1f), _bodyMaterial, 1f); AddPuff(val2.transform, list, new Vector3(0.1f, 1.7f, 0f), new Vector3(1.1f, 1.05f, 1f), _bodyMaterial, 1f); AddPuff(val2.transform, list, new Vector3(0.62f, 1.4f, 0f), new Vector3(0.7f, 1.5f, 1f), _bodyMaterial, 0.85f); AddPuff(val2.transform, list, new Vector3(-0.6f, 1.35f, 0f), new Vector3(0.7f, 1.55f, 1f), _bodyMaterial, 0.85f); AddPuff(val2.transform, list, new Vector3(0.78f, 0.7f, 0f), new Vector3(0.55f, 1.2f, 1f), _bodyMaterial, 0.7f); AddPuff(val2.transform, list, new Vector3(-0.74f, 0.65f, 0f), new Vector3(0.55f, 1.25f, 1f), _bodyMaterial, 0.7f); AddPuff(val2.transform, list, new Vector3(0f, 2.1f, 0f), new Vector3(0.95f, 0.95f, 1f), _bodyMaterial, 1f); AddPuff(val2.transform, list, new Vector3(0.05f, 2.45f, 0.05f), new Vector3(0.7f, 0.7f, 1f), _bodyMaterial, 0.9f); AddPuff(val2.transform, list, new Vector3(0.3f, 0.15f, 0.1f), new Vector3(1.05f, 0.55f, 1f), _bodyMaterial, 0.75f); AddPuff(val2.transform, list, new Vector3(-0.3f, 0.12f, -0.1f), new Vector3(1.05f, 0.55f, 1f), _bodyMaterial, 0.75f); AddPuff(val2.transform, list, new Vector3(0f, 1.5f, -0.15f), new Vector3(1.6f, 1.7f, 1f), _glowMaterial, 0.4f); AddPuff(val2.transform, list, new Vector3(0f, 2.2f, -0.12f), new Vector3(0.9f, 0.9f, 1f), _glowMaterial, 0.45f); AddPuff(val2.transform, list, new Vector3(0.1f, 0.9f, -0.15f), new Vector3(1.3f, 1.2f, 1f), _glowMaterial, 0.35f); backroomsSmokeBillow.Configure(val2.transform, list.ToArray(), BuildEyes(val2.transform)); return val; } private static void AddPuff(Transform parent, List puffs, Vector3 localPosition, Vector3 localScale, Material material, float opacity) { //IL_003b: 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_0080: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)val).name = "Puff"; Collider component = val.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } val.transform.SetParent(parent, false); val.transform.localPosition = localPosition; val.transform.localScale = localScale; Renderer component2 = val.GetComponent(); component2.sharedMaterial = material; component2.shadowCastingMode = (ShadowCastingMode)0; component2.receiveShadows = false; puffs.Add(new BackroomsSmokePuff { Transform = val.transform, BasePosition = localPosition, BaseScale = localScale, Opacity = opacity, Seed = Random.Range(0f, 40f), SwaySpeed = Random.Range(0.7f, 1.5f) }); } private static Renderer[] BuildEyes(Transform parent) { //IL_000f: 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) //IL_009f: Unknown result type (might be due to invalid IL or missing references) Material sharedMaterial = BackroomsMaterials.CreateEmissive(new Color(0.55f, 0.95f, 1f), 4.2f); Renderer[] array = (Renderer[])(object)new Renderer[2]; for (int i = 0; i < 2; i++) { GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)obj).name = "Eye"; Collider component = obj.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } obj.transform.SetParent(parent, false); obj.transform.localPosition = new Vector3((i == 0) ? (-0.16f) : 0.16f, 2.22f, 0.34f); obj.transform.localScale = new Vector3(0.16f, 0.2f, 0.16f); Renderer component2 = obj.GetComponent(); component2.sharedMaterial = sharedMaterial; component2.shadowCastingMode = (ShadowCastingMode)0; component2.receiveShadows = false; array[i] = component2; } return array; } private static void EnsureAssets() { //IL_002c: 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) if (!((Object)(object)_bodyMaterial != (Object)null)) { _puffTexture = BuildPuffTexture(); _bodyMaterial = BuildSpriteMaterial(new Color(0.07f, 0.07f, 0.09f, 0.72f), additive: false); _glowMaterial = BuildSpriteMaterial(new Color(0.32f, 0.55f, 0.7f, 0.5f), additive: true); } } private static Material BuildSpriteMaterial(Color tint, bool additive) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0065: 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) Material val = new Material(FindShader((!additive) ? new string[3] { "Sprites/Default", "Unlit/Transparent", "Legacy Shaders/Particles/Alpha Blended" } : new string[3] { "Legacy Shaders/Particles/Additive", "Particles/Additive", "Sprites/Default" })); val.mainTexture = (Texture)(object)_puffTexture; if (val.HasProperty("_Color")) { val.color = tint; } if (val.HasProperty("_TintColor")) { val.SetColor("_TintColor", tint); } val.renderQueue = 3100; return val; } private static Shader FindShader(string[] names) { for (int i = 0; i < names.Length; i++) { Shader val = Shader.Find(names[i]); if ((Object)(object)val != (Object)null) { return val; } } return Shader.Find("Sprites/Default"); } private static Texture2D BuildPuffTexture() { //IL_0007: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //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) int num = 96; Texture2D val = new Texture2D(num, num, (TextureFormat)4, true) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; float num2 = Random.Range(0f, 100f); Color[] array = (Color[])(object)new Color[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num3 = (float)j / (float)(num - 1) * 2f - 1f; float num4 = (float)i / (float)(num - 1) * 2f - 1f; float num5 = Mathf.Clamp01(1f - Mathf.Sqrt(num3 * num3 + num4 * num4)); float num6 = num5 * num5; float num7 = Mathf.PerlinNoise(num2 + (float)j * 0.09f, num2 + (float)i * 0.09f); float num8 = Mathf.PerlinNoise(num2 + (float)j * 0.24f, num2 + (float)i * 0.24f); float num9 = num6 * (0.45f + 0.55f * num7) * (0.7f + 0.3f * num8); array[i * num + j] = new Color(1f, 1f, 1f, Mathf.Clamp01(num9)); } } val.SetPixels(array); val.Apply(); return val; } } internal struct BackroomsSmokePuff { public Transform Transform; public Vector3 BasePosition; public Vector3 BaseScale; public float Opacity; public float Seed; public float SwaySpeed; } internal sealed class BackroomsSmokeBillow : MonoBehaviour { private Transform _column; private BackroomsSmokePuff[] _puffs; private Renderer[] _eyes; private Material _eyeMaterial; private Camera _camera; private float _bobSeed; public void Configure(Transform column, BackroomsSmokePuff[] puffs, Renderer[] eyes) { _column = column; _puffs = puffs; _eyes = eyes; _bobSeed = Random.Range(0f, 30f); if (eyes != null && eyes.Length != 0 && (Object)(object)eyes[0] != (Object)null) { _eyeMaterial = eyes[0].sharedMaterial; } } private void LateUpdate() { //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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_00fb: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) if (_puffs == null) { return; } if ((Object)(object)_camera == (Object)null) { _camera = Camera.main; } Quaternion rotation = Quaternion.identity; if ((Object)(object)_camera != (Object)null) { rotation = Quaternion.LookRotation(((Component)_camera).transform.forward, Vector3.up); } float time = Time.time; for (int i = 0; i < _puffs.Length; i++) { BackroomsSmokePuff backroomsSmokePuff = _puffs[i]; if (!((Object)(object)backroomsSmokePuff.Transform == (Object)null)) { if ((Object)(object)_camera != (Object)null) { backroomsSmokePuff.Transform.rotation = rotation; } float num = 1f + 0.16f * Mathf.Sin(time * backroomsSmokePuff.SwaySpeed + backroomsSmokePuff.Seed); float num2 = 1f + 0.1f * Mathf.Sin(time * backroomsSmokePuff.SwaySpeed * 0.6f + backroomsSmokePuff.Seed * 1.7f); backroomsSmokePuff.Transform.localScale = new Vector3(backroomsSmokePuff.BaseScale.x * num, backroomsSmokePuff.BaseScale.y * num2, backroomsSmokePuff.BaseScale.z); float num3 = (Mathf.PerlinNoise(backroomsSmokePuff.Seed, time * 0.6f) - 0.5f) * 0.22f; float num4 = (Mathf.PerlinNoise(backroomsSmokePuff.Seed + 11f, time * 0.5f) - 0.5f) * 0.18f; backroomsSmokePuff.Transform.localPosition = backroomsSmokePuff.BasePosition + new Vector3(num3, num4, 0f); } } if ((Object)(object)_column != (Object)null) { float num5 = Mathf.Sin(time * 1.6f + _bobSeed) * 0.06f; float num6 = Mathf.Sin(time * 0.9f + _bobSeed) * 3.5f; _column.localPosition = new Vector3(0f, num5, 0f); _column.localRotation = Quaternion.Euler(0f, 0f, num6); } if ((Object)(object)_eyeMaterial != (Object)null && _eyeMaterial.HasProperty("_EmissionColor")) { float num7 = 3.2f + Mathf.Sin(time * 5f + _bobSeed) * 1.6f; _eyeMaterial.SetColor("_EmissionColor", new Color(0.55f, 0.95f, 1f) * num7); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.empress.repo.backrooms", "Empress Backrooms", "1.0.0")] public sealed class EmpressBackroomsPlugin : BaseUnityPlugin { public const string PluginGuid = "com.empress.repo.backrooms"; public const string PluginName = "Empress Backrooms"; public const string PluginVersion = "1.0.0"; public const string LevelName = "Level - Empress Backrooms"; public const string DisplayName = "Empress - The Backrooms"; internal const byte EnemyEventCode = 190; internal const byte ShiftEventCode = 191; internal const byte PlayerHitEventCode = 192; internal const byte EnemyDeathEventCode = 193; internal const byte ScareEventCode = 194; internal const byte ElevatorEventCode = 195; internal const byte ExtractionStripEventCode = 196; internal const byte ExtractionDoneEventCode = 197; private static bool _photonHooked; private Harmony _harmony; internal static EmpressBackroomsPlugin Instance { get; private set; } internal static ManualLogSource Log { get; private set; } internal static BackroomsSettings Settings { get; private set; } internal static Level BackroomsLevel { get; private set; } internal static string PluginDirectory { get; private set; } private void Awake() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); Settings = new BackroomsSettings(((BaseUnityPlugin)this).Config); ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); BackroomsLevel = BackroomsLevelRegistry.RegisterLevel(); BackroomsAudio.Initialize(); BackroomsSmilerAssets.Load(); _harmony = new Harmony("com.empress.repo.backrooms"); _harmony.PatchAll(typeof(EmpressBackroomsPlugin).Assembly); BackroomsRuntime.EnsureHost(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Empress Backrooms v1.0.0 loaded. Level registered: Level - Empress Backrooms"); } private void OnDestroy() { RemovePhotonHook(); } internal static bool IsBackroomsLevel(Level level) { if ((Object)(object)level != (Object)null) { return ((Object)level).name == "Level - Empress Backrooms"; } return false; } internal static void EnsurePhotonHooked() { if (!_photonHooked) { LoadBalancingClient networkingClient = PhotonNetwork.NetworkingClient; if (networkingClient != null) { networkingClient.EventReceived -= OnPhotonEvent; networkingClient.EventReceived += OnPhotonEvent; _photonHooked = true; } } } internal static void RemovePhotonHook() { if (_photonHooked) { LoadBalancingClient networkingClient = PhotonNetwork.NetworkingClient; if (networkingClient != null) { networkingClient.EventReceived -= OnPhotonEvent; } _photonHooked = false; } } private static void OnPhotonEvent(EventData ev) { if (ev.CustomData is object[] data) { Dispatch(ev.Code, data); } } private static void Dispatch(byte code, object[] data) { BackroomsRuntime instance = BackroomsRuntime.Instance; if (!((Object)(object)instance == (Object)null) && data != null) { switch (code) { case 190: instance.ReceiveEnemySync(data); break; case 191: instance.ReceiveShift(data); break; case 192: instance.ReceivePlayerHit(data); break; case 193: instance.ReceiveEnemyDeath(data); break; case 194: instance.ReceiveScare(data); break; case 195: instance.ReceiveElevator(data); break; case 196: instance.ReceiveExtractionStrip(data); break; case 197: instance.ReceiveExtractionDone(data); break; } } } internal static void DebugLog(string message) { if (Settings != null && Settings.DebugLogs.Value) { Log.LogInfo((object)message); } } internal static void RaiseToOthers(byte code, object[] data, bool reliable = true) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) EnsurePhotonHooked(); if (PhotonNetwork.InRoom) { RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; PhotonNetwork.RaiseEvent(code, (object)data, val, reliable ? SendOptions.SendReliable : SendOptions.SendUnreliable); } } internal static void RaiseToAll(byte code, object[] data) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) EnsurePhotonHooked(); if (!PhotonNetwork.InRoom) { Dispatch(code, data); return; } RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent(code, (object)data, val, SendOptions.SendReliable); } } internal sealed class BackroomsSettings { public readonly ConfigEntry ForceLevel; public readonly ConfigEntry EnableEnemies; public readonly ConfigEntry EnemyCount; public readonly ConfigEntry EnemySpeed; public readonly ConfigEntry SpawnValuables; public readonly ConfigEntry ValuableTargetMin; public readonly ConfigEntry ValuableTargetMax; public readonly ConfigEntry HaulGoalMinimum; public readonly ConfigEntry HaulGoalMaximum; public readonly ConfigEntry ShiftInterval; public readonly ConfigEntry MasterVolume; public readonly ConfigEntry DebugLogs; public BackroomsSettings(ConfigFile config) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Expected O, but got Unknown //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Expected O, but got Unknown DebugLogs = config.Bind("Debug", "DebugLogs", false, "Logs verbose generation diagnostics (valuable pool, extraction, haul goal). Off by default."); ForceLevel = config.Bind("Debug", "ForceLevel", false, "Forces every real run level to load Empress - The Backrooms. Useful for testing."); EnableEnemies = config.Bind("Level", "EnableEnemies", true, "Enables the custom Backrooms Smiler that stalks the crew."); EnemyCount = config.Bind("Enemies", "EnemyCount", 1, "Legacy setting. Empress Backrooms now uses one Smiler enemy."); EnemySpeed = config.Bind("Enemies", "Speed", 2.6f, new ConfigDescription("Base hunting move speed of the Smiler.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 5f), Array.Empty())); SpawnValuables = config.Bind("Level", "SpawnValuables", true, "Places valuables to grab around the level."); ValuableTargetMin = config.Bind("Loot", "ValuableTargetMin", 10, new ConfigDescription("Lowest total valuable target for Backrooms loot top-up.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty())); ValuableTargetMax = config.Bind("Loot", "ValuableTargetMax", 40, new ConfigDescription("Highest total valuable target for Backrooms loot top-up.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty())); HaulGoalMinimum = config.Bind("Loot", "HaulGoalMinimum", 10000, new ConfigDescription("Minimum extraction quota for Empress Backrooms.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 1000000), Array.Empty())); HaulGoalMaximum = config.Bind("Loot", "HaulGoalMaximum", 40000, new ConfigDescription("Maximum extraction quota for Empress Backrooms.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 1000000), Array.Empty())); ShiftInterval = config.Bind("Level", "ShiftInterval", 75f, new ConfigDescription("Seconds between Backrooms reality shifts.", (AcceptableValueBase)(object)new AcceptableValueRange(25f, 240f), Array.Empty())); MasterVolume = config.Bind("Audio", "MasterVolume", 0.85f, new ConfigDescription("Volume of the Backrooms ambience and entity sounds.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); } } }