Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Dr Who v0.5.5
tardisroom.dll
Decompiled 2 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Sirenix.Utilities; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("EmptyChildMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EmptyChildMod")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("eb22faed-b405-4d38-9eb8-cae6b316dbed")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace TARDISMod; [BepInPlugin("com.you.tardisroom", "TARDIS Room Loader", "1.0.0")] public static class PaintingGroups { public static readonly Dictionary<string, string> MaterialToGroup = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "Painting_H_Landscape", "TARGET_LANDSCAPE" }, { "Painting_V_Furman", "TARGET_FURMAN" }, { "Painting_H_crow", "GROUP_H_CROW" }, { "Painting_H_crow_0", "GROUP_H_CROW_0" }, { "PaintingMedium", "GROUP_MEDIUM" }, { "Painting_Danish_Flag", "GROUP_DANISH" }, { "Painting_Board", "GROUP_BOARD" }, { "Painting Danish Flag", "GROUP_DANISH_FLAG" }, { "Painting Board", "GROUP_PAINTING_BOARD" }, { "Shop Outside Billboard Ad", "GROUP_BILLBOARD" }, { "Museum Sign", "GROUP_MUSEUM_SIGN" }, { "Museum Painting H 01", "GROUP_MUSEUM_H_01" }, { "Museum Painting H 02", "GROUP_MUSEUM_H_02" }, { "Museum Painting H 03", "GROUP_MUSEUM_H_03" }, { "Museum Painting H 04", "GROUP_MUSEUM_H_04" }, { "Museum Painting H 05", "GROUP_MUSEUM_H_05" }, { "Museum Painting H 06", "GROUP_MUSEUM_H_06" }, { "Museum Painting H 07", "GROUP_MUSEUM_H_07" }, { "Museum Painting H 08", "GROUP_MUSEUM_H_08" }, { "Museum Painting H 09", "GROUP_MUSEUM_H_09" }, { "Museum Painting H 10", "GROUP_MUSEUM_H_10" }, { "Museum Painting H 11", "GROUP_MUSEUM_H_11" }, { "Museum Painting H 12", "GROUP_MUSEUM_H_12" }, { "Museum Painting H 13", "GROUP_MUSEUM_H_13" }, { "Museum Painting H 14", "GROUP_MUSEUM_H_14" }, { "Museum Painting H 15", "GROUP_MUSEUM_H_15" }, { "Museum Painting H 16", "GROUP_MUSEUM_H_16" }, { "Museum Painting H 17", "GROUP_MUSEUM_H_17" }, { "Museum Painting H 18", "GROUP_MUSEUM_H_18" }, { "Museum Painting H 19", "GROUP_MUSEUM_H_19" }, { "Museum Painting H 20", "GROUP_MUSEUM_H_20" }, { "Museum Painting H 21", "GROUP_MUSEUM_H_21" }, { "Museum Painting H 22", "GROUP_MUSEUM_H_22" }, { "Museum Painting H 23", "GROUP_MUSEUM_H_23" }, { "Museum Painting H 24", "GROUP_MUSEUM_H_24" }, { "Museum Painting H 25", "GROUP_MUSEUM_H_25" }, { "Museum Painting H 26", "GROUP_MUSEUM_H_26" }, { "Museum Painting H 27", "GROUP_MUSEUM_H_27" }, { "Museum Painting H 28", "GROUP_MUSEUM_H_28" }, { "Museum Painting H 29", "GROUP_MUSEUM_H_29" }, { "Museum Painting H 30", "GROUP_MUSEUM_H_30" }, { "Museum Painting H 31", "GROUP_MUSEUM_H_31" }, { "Museum Painting H 32", "GROUP_MUSEUM_H_32" }, { "Museum Painting H 33", "GROUP_MUSEUM_H_33" }, { "Museum Painting H 35", "GROUP_MUSEUM_H_35" }, { "Museum Painting H 37", "GROUP_MUSEUM_H_37" }, { "Museum Painting H 38", "GROUP_MUSEUM_H_38" }, { "Museum Painting H 39", "GROUP_MUSEUM_H_39" }, { "Museum Painting H 40", "GROUP_MUSEUM_H_40" }, { "Museum Painting H 42", "GROUP_MUSEUM_H_42" }, { "Museum Painting H 45", "GROUP_MUSEUM_H_45" }, { "Painting_S_Creep", "GROUP_S_CREEP" }, { "Painting_S_Creep 2_0", "GROUP_S_CREEP_2_0" }, { "Painting_S_Creep 2", "GROUP_S_CREEP_2" }, { "Painting Wizard Class", "GROUP_WIZARD" }, { "Picture Frame - Picture 01", "GROUP_FRAME" }, { "Painting_Aurora", "GROUP_AURORA" }, { "Painting_McJannek", "GROUP_MCJANNEK" }, { "Painting Aurora", "GROUP_AURORA_2" }, { "Painting McJannek", "GROUP_MCJANNEK_2" }, { "Museum Painting S 01", "GROUP_MUSEUM_S_01" }, { "Museum Painting S 02", "GROUP_MUSEUM_S_02" }, { "Museum Painting S 03", "GROUP_MUSEUM_S_03" }, { "Museum Painting S 04", "GROUP_MUSEUM_S_04" }, { "Museum Painting S 05", "GROUP_MUSEUM_S_05" }, { "Museum Painting S 06", "GROUP_MUSEUM_S_06" }, { "Museum Painting S 07", "GROUP_MUSEUM_S_07" }, { "Museum Painting S 08", "GROUP_MUSEUM_S_08" }, { "Museum Painting S 09", "GROUP_MUSEUM_S_09" }, { "Museum Painting S 10", "GROUP_MUSEUM_S_10" }, { "Museum Painting S 11", "GROUP_MUSEUM_S_11" }, { "Museum Painting S 12", "GROUP_MUSEUM_S_12" }, { "Museum Painting S 13", "GROUP_MUSEUM_S_13" }, { "Museum Painting S 15", "GROUP_MUSEUM_S_15" }, { "Painting_V_jannk", "GROUP_V_JANNK" }, { "Painting_V_surrealistic", "GROUP_V_SURREAL" }, { "Painting_V_surrealistic_0", "GROUP_V_SURREAL_0" }, { "painting teacher01", "GROUP_TEACHER_01" }, { "painting teacher02", "GROUP_TEACHER_02" }, { "painting teacher03", "GROUP_TEACHER_03" }, { "painting teacher04", "GROUP_TEACHER_04" }, { "Painting_S_Tree", "GROUP_S_TREE" }, { "Painting Calendar", "GROUP_CALENDAR" }, { "Magazine01", "GROUP_MAG_01" }, { "Magazine02", "GROUP_MAG_02" }, { "Magazine03", "GROUP_MAG_03" }, { "Magazine04", "GROUP_MAG_04" }, { "Magazine05", "GROUP_MAG_05" }, { "Valuable_Painting", "GROUP_VALUABLE" }, { "Museum Painting V 01", "GROUP_MUSEUM_V_01" }, { "Museum Painting V 02", "GROUP_MUSEUM_V_02" }, { "Museum Painting V 03", "GROUP_MUSEUM_V_03" }, { "Museum Painting V 05", "GROUP_MUSEUM_V_05" }, { "Museum Painting V 07", "GROUP_MUSEUM_V_07" }, { "Museum Painting V 09", "GROUP_MUSEUM_V_09" }, { "Museum Painting V 15", "GROUP_MUSEUM_V_15" }, { "Museum Painting V 16", "GROUP_MUSEUM_V_16" }, { "Museum Painting V 17", "GROUP_MUSEUM_V_17" }, { "Museum Painting V 18", "GROUP_MUSEUM_V_18" }, { "Museum Painting V 19", "GROUP_MUSEUM_V_19" }, { "Museum Painting V 20", "GROUP_MUSEUM_V_20" }, { "Museum Painting V 21", "GROUP_MUSEUM_V_21" }, { "Museum Painting V 22", "GROUP_MUSEUM_V_22" }, { "Museum Painting V 23", "GROUP_MUSEUM_V_23" }, { "Museum Painting V 24", "GROUP_MUSEUM_V_24" }, { "Museum Painting V 25", "GROUP_MUSEUM_V_25" }, { "Museum Painting V 26", "GROUP_MUSEUM_V_26" }, { "Museum Painting V 27", "GROUP_MUSEUM_V_27" }, { "Museum Painting V 28", "GROUP_MUSEUM_V_28" }, { "Museum Painting V 29", "GROUP_MUSEUM_V_29" }, { "Museum Painting V 30", "GROUP_MUSEUM_V_30" }, { "Museum Painting V 31", "GROUP_MUSEUM_V_31" }, { "Museum Painting V 32", "GROUP_MUSEUM_V_32" }, { "Museum Painting V 34", "GROUP_MUSEUM_V_34" }, { "Museum Painting V 35", "GROUP_MUSEUM_V_35" }, { "Museum Painting V 36", "GROUP_MUSEUM_V_36" } }; } [HarmonyPatch(typeof(PlayerAvatar), "LoadingLevelAnimationCompletedRPC")] public class LevelLoadedPaintingPatch { public static void Postfix() { ((MonoBehaviour)Plugin.Instance).StartCoroutine(Plugin.Instance.GlobalPaintingSweep()); } } [BepInPlugin("com.you.tardisroom", "TARDIS Room Loader", "1.0.0")] public class Plugin : BaseUnityPlugin { public class PlaySoundOnPhysGrab : MonoBehaviour { private PhysGrabObject physGrab; private AudioSource audioSource; private bool wasGrabbedLastFrame = false; private void Awake() { physGrab = ((Component)this).GetComponent<PhysGrabObject>(); audioSource = ((Component)this).gameObject.GetComponent<AudioSource>() ?? ((Component)this).gameObject.AddComponent<AudioSource>(); audioSource.playOnAwake = false; audioSource.spatialBlend = 1f; audioSource.minDistance = 1f; audioSource.maxDistance = 10f; if ((Object)(object)TARDISGrabSound != (Object)null) { audioSource.clip = TARDISGrabSound; } } private void Update() { if (!((Object)(object)physGrab == (Object)null)) { bool flag = physGrab.playerGrabbing != null && physGrab.playerGrabbing.Count > 0; if (flag && !wasGrabbedLastFrame && (Object)(object)audioSource.clip != (Object)null) { audioSource.PlayOneShot(audioSource.clip); } wasGrabbedLastFrame = flag; } } } public static class NightMusicPatch { public static void Postfix(ConstantMusic __instance, ref bool ___setup) { if (!(((Object)((Component)__instance).gameObject).name != "Outside Night Music") && ___setup && !((Object)(object)TARDISNightSound == (Object)null)) { AudioSource component = ((Component)__instance).GetComponent<AudioSource>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.clip == (Object)(object)TARDISNightSound)) { component.Stop(); component.clip = TARDISNightSound; component.loop = true; component.Play(); component.volume = 1f; Log.LogInfo((object)"TARDIS: 'Outside Night Music' found and swapped to TARDIS Night Sound."); } } } } public class ProximityLookAwayDisappear : MonoBehaviour { [CompilerGenerated] private sealed class <Dematerialise>d__17 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ProximityLookAwayDisappear <>4__this; private float <timer>5__1; private List<Renderer>.Enumerator <>s__2; private Renderer <r>5__3; private Material[] <>s__4; private int <>s__5; private Material <m>5__6; private float <progress>5__7; private float <pulse>5__8; private float <alpha>5__9; private List<Renderer>.Enumerator <>s__10; private Renderer <r>5__11; private Material[] <>s__12; private int <>s__13; private Material <m>5__14; private Color <c>5__15; private List<Renderer>.Enumerator <>s__16; private Renderer <r>5__17; private Collider[] <>s__18; private int <>s__19; private Collider <col>5__20; private Light[] <>s__21; private int <>s__22; private Light <lit>5__23; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Dematerialise>d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__2 = default(List<Renderer>.Enumerator); <r>5__3 = null; <>s__4 = null; <m>5__6 = null; <>s__10 = default(List<Renderer>.Enumerator); <r>5__11 = null; <>s__12 = null; <m>5__14 = null; <>s__16 = default(List<Renderer>.Enumerator); <r>5__17 = null; <>s__18 = null; <col>5__20 = null; <>s__21 = null; <lit>5__23 = null; <>1__state = -2; } private bool MoveNext() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(<>4__this.audioDelay); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)<>4__this.audioSource != (Object)null) { ((Component)<>4__this.audioSource).transform.SetParent((Transform)null); } <>s__2 = <>4__this.renderers.GetEnumerator(); try { while (<>s__2.MoveNext()) { <r>5__3 = <>s__2.Current; <>s__4 = <r>5__3.materials; for (<>s__5 = 0; <>s__5 < <>s__4.Length; <>s__5++) { <m>5__6 = <>s__4[<>s__5]; <>4__this.SetMaterialTransparent(<m>5__6); <m>5__6 = null; } <>s__4 = null; <r>5__3 = null; } } finally { ((IDisposable)<>s__2).Dispose(); } <>s__2 = default(List<Renderer>.Enumerator); <timer>5__1 = 0f; break; case 2: <>1__state = -1; break; } if (<timer>5__1 < <>4__this.dematDuration) { <timer>5__1 += Time.deltaTime; <progress>5__7 = <timer>5__1 / <>4__this.dematDuration; <pulse>5__8 = Mathf.Sin(<timer>5__1 * <>4__this.pulseSpeed * (float)Math.PI * 2f) * <>4__this.pulseStrength * (1f - <progress>5__7); <alpha>5__9 = Mathf.Clamp01(1f - <progress>5__7 + <pulse>5__8); <>s__10 = <>4__this.renderers.GetEnumerator(); try { while (<>s__10.MoveNext()) { <r>5__11 = <>s__10.Current; <>s__12 = <r>5__11.materials; for (<>s__13 = 0; <>s__13 < <>s__12.Length; <>s__13++) { <m>5__14 = <>s__12[<>s__13]; if (<>4__this.originalColors.TryGetValue(<m>5__14, out <c>5__15)) { if (((Object)<m>5__14).name.Contains("New Material2")) { <m>5__14.EnableKeyword("_EMISSION"); <m>5__14.SetColor("_EmissionColor", Color.white * 2f); } <c>5__15.a = <alpha>5__9; if (<m>5__14.HasProperty("_BaseColor")) { <m>5__14.SetColor("_BaseColor", <c>5__15); } else if (<m>5__14.HasProperty("_Color")) { <m>5__14.SetColor("_Color", <c>5__15); } <m>5__14 = null; } } <>s__12 = null; <r>5__11 = null; } } finally { ((IDisposable)<>s__10).Dispose(); } <>s__10 = default(List<Renderer>.Enumerator); <>2__current = null; <>1__state = 2; return true; } <>s__16 = <>4__this.renderers.GetEnumerator(); try { while (<>s__16.MoveNext()) { <r>5__17 = <>s__16.Current; <r>5__17.enabled = false; <r>5__17 = null; } } finally { ((IDisposable)<>s__16).Dispose(); } <>s__16 = default(List<Renderer>.Enumerator); <>s__18 = <>4__this.targetObject.GetComponentsInChildren<Collider>(true); for (<>s__19 = 0; <>s__19 < <>s__18.Length; <>s__19++) { <col>5__20 = <>s__18[<>s__19]; <col>5__20.enabled = false; <col>5__20 = null; } <>s__18 = null; <>s__21 = <>4__this.targetObject.GetComponentsInChildren<Light>(true); for (<>s__22 = 0; <>s__22 < <>s__21.Length; <>s__22++) { <lit>5__23 = <>s__21[<>s__22]; ((Behaviour)<lit>5__23).enabled = false; <lit>5__23 = null; } <>s__21 = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Header("Target")] public GameObject targetObject; [Header("Activation Anchor")] public Transform activationAnchor; [Header("Distances")] public float activationDistance = 2.5f; public float disappearDistance = 6f; [Header("Audio")] public AudioSource audioSource; public AudioClip disappearClip; [Header("Dematerialisation")] public float audioDelay = 1.5f; public float dematDuration = 16.5f; public float pulseStrength = 0.6f; public float pulseSpeed = 0.6f; private bool activated = false; private bool triggered = false; private List<Renderer> renderers = new List<Renderer>(); private Dictionary<Material, Color> originalColors = new Dictionary<Material, Color>(); private void Start() { //IL_00be: 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) if ((Object)(object)targetObject == (Object)null) { targetObject = ((Component)this).gameObject; } if ((Object)(object)activationAnchor == (Object)null) { activationAnchor = targetObject.transform; } renderers.AddRange(targetObject.GetComponentsInChildren<Renderer>(true)); foreach (Renderer renderer in renderers) { Material[] materials = renderer.materials; foreach (Material val in materials) { if (!originalColors.ContainsKey(val)) { if (val.HasProperty("_BaseColor")) { originalColors[val] = val.GetColor("_BaseColor"); } else if (val.HasProperty("_Color")) { originalColors[val] = val.GetColor("_Color"); } } } } } private void Update() { //IL_0027: 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) if (triggered || (Object)(object)Camera.main == (Object)null) { return; } float num = Vector3.Distance(((Component)Camera.main).transform.position, activationAnchor.position); if (!activated) { if (num <= activationDistance) { activated = true; } } else if (num >= disappearDistance) { TriggerDisappear(); } } private void TriggerDisappear() { triggered = true; if ((Object)(object)audioSource != (Object)null && (Object)(object)disappearClip != (Object)null) { audioSource.PlayOneShot(disappearClip); } ((MonoBehaviour)this).StartCoroutine(Dematerialise()); } [IteratorStateMachine(typeof(<Dematerialise>d__17))] private IEnumerator Dematerialise() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Dematerialise>d__17(0) { <>4__this = this }; } private void SetMaterialTransparent(Material mat) { if (mat.HasProperty("_Surface")) { mat.SetFloat("_Surface", 1f); mat.SetFloat("_ZWrite", 0f); mat.EnableKeyword("_SURFACE_TYPE_TRANSPARENT"); mat.renderQueue = 3000; } else { mat.SetFloat("_Mode", 3f); mat.SetInt("_SrcBlend", 5); mat.SetInt("_DstBlend", 10); mat.SetInt("_ZWrite", 0); mat.EnableKeyword("_ALPHABLEND_ON"); mat.renderQueue = 3000; } } } public static class PrefabSwapPatch { public static void Postfix(string name, Type type, ref Object __result) { if (!((Object)(object)TARDISPrefab == (Object)null) && !string.IsNullOrEmpty(name) && name.Contains("Treasure Trove")) { Log.LogInfo((object)("TARDIS: Swapping asset load -> " + name)); __result = (Object)(object)TARDISPrefab; } } } public class VideoFacePlayer : MonoBehaviour { private void Update() { if ((Object)(object)Camera.main != (Object)null) { ((Component)this).transform.LookAt(((Component)Camera.main).transform); ((Component)this).transform.Rotate(0f, 180f, 0f); } } } public static class MenuMusicPatch { public static void Postfix(ConstantMusic __instance, ref bool ___setup) { if (___setup && !((Object)(object)TARDISMenuTheme == (Object)null)) { AudioSource component = ((Component)__instance).GetComponent<AudioSource>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.clip == (Object)(object)TARDISMenuTheme)) { component.Stop(); component.clip = TARDISMenuTheme; component.loop = true; component.Play(); Log.LogInfo((object)"TARDIS: Menu music successfully swapped via manual patch."); } } } } public static class ComponentInjectorPatch { private static HashSet<int> loggedIds = new HashSet<int>(); public static void Postfix(Object original, ref Object __result) { //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_05a8: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_0ab9: Unknown result type (might be due to invalid IL or missing references) //IL_0acb: Unknown result type (might be due to invalid IL or missing references) Object obj = __result; GameObject val = (GameObject)(object)((obj is GameObject) ? obj : null); if (val == null) { return; } int instanceID = ((Object)val).GetInstanceID(); if (!loggedIds.Contains(instanceID)) { AudioSource[] componentsInChildren = val.GetComponentsInChildren<AudioSource>(true); if (componentsInChildren.Length != 0) { Log.LogInfo((object)$"[TARDIS MONITOR] {((Object)val).name} | Sounds: {componentsInChildren.Length}"); AudioSource[] array = componentsInChildren; foreach (AudioSource val2 in array) { Log.LogWarning((object)(" -> " + ((Object)((Component)val2).gameObject).name + " | Clip: " + (((Object)(object)val2.clip != (Object)null) ? ((Object)val2.clip).name : "NULL"))); } } loggedIds.Add(instanceID); } if (((Object)val).name.Contains("OutTardis")) { Log.LogInfo((object)"TARDIS: configuring OutTardis Audio..."); Transform val3 = val.transform.FindRecursive("Audio Loop Distance"); if (!((Object)(object)val3 != (Object)null)) { Log.LogWarning((object)"TARDIS: Could not find 'Audio Loop Distance' to disable wind."); } AudioSource[] componentsInChildren2 = val.GetComponentsInChildren<AudioSource>(true); AudioSource[] array2 = componentsInChildren2; foreach (AudioSource val4 in array2) { if (((Object)((Component)val4).gameObject).name == "Audio Loop Distance") { continue; } if ((Object)(object)val4.clip == (Object)null && (Object)(object)OutTardisClip != (Object)null) { val4.clip = OutTardisClip; } if ((Object)(object)val4.clip != (Object)null && ((Object)val4.clip).name.Contains("outtardis")) { AudioSource val5 = ((val3 != null) ? ((Component)val3).GetComponent<AudioSource>() : null); if ((Object)(object)val5 != (Object)null && (Object)(object)val5.outputAudioMixerGroup != (Object)null) { val4.outputAudioMixerGroup = val5.outputAudioMixerGroup; } ((Component)val4).gameObject.SetActive(true); ((Behaviour)val4).enabled = true; val4.mute = false; val4.volume = 1f; val4.spatialBlend = 0f; val4.dopplerLevel = 0.1f; val4.rolloffMode = (AudioRolloffMode)0; val4.minDistance = 5f; val4.maxDistance = 60f; val4.loop = true; if (!val4.isPlaying) { val4.Play(); Log.LogInfo((object)("TARDIS: Playing TARDIS sound on " + ((Object)((Component)val4).gameObject).name)); } } } } if (((Object)val).name.Contains("Treasure Trove") && (Object)(object)val.transform.Find("TARDIS_Model") == (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"TARDIS: Ghosting Treasure Trove (Logic stays, visuals/physics go)."); if ((Object)(object)TARDISPrefab != (Object)null) { Renderer[] componentsInChildren3 = val.GetComponentsInChildren<Renderer>(true); foreach (Renderer val6 in componentsInChildren3) { val6.enabled = false; } Collider[] componentsInChildren4 = val.GetComponentsInChildren<Collider>(true); foreach (Collider val7 in componentsInChildren4) { val7.enabled = false; } Renderer[] componentsInParent = val.GetComponentsInParent<Renderer>(true); foreach (Renderer val8 in componentsInParent) { val8.enabled = false; } Collider[] componentsInParent2 = val.GetComponentsInParent<Collider>(true); foreach (Collider val9 in componentsInParent2) { val9.enabled = false; } GameObject val10 = Object.Instantiate<GameObject>(TARDISPrefab, val.transform); val10.transform.localPosition = Vector3.zero; val10.transform.localRotation = Quaternion.identity; Instance.SetupTARDISComponents(val10); __result = (Object)(object)val10; } else { ((BaseUnityPlugin)Instance).Logger.LogError((object)"TARDIS: Prefab is null, cannot replace!"); } } else if (((Object)val).name.Contains("Tardis") || (Object)(object)val.transform.Find("TARDIS_Model") != (Object)null) { Instance.SetupTARDISComponents(val); } bool flag = ((Object)val).name.Contains("Module - Manor - DE - 2 - Outside Dead End"); if (((Object)val).name.Contains("Module - Manor - DE - 2 - Outside Dead End")) { if ((Object)(object)val.transform.Find("OutTardis_Marker") != (Object)null) { return; } ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"TARDIS: Dead End detected. Replacing visuals and updating audio..."); Renderer[] componentsInChildren5 = val.GetComponentsInChildren<Renderer>(true); foreach (Renderer val11 in componentsInChildren5) { val11.enabled = false; } Collider[] componentsInChildren6 = val.GetComponentsInChildren<Collider>(true); foreach (Collider val12 in componentsInChildren6) { val12.enabled = false; } if ((Object)(object)OutTardisPrefab != (Object)null) { GameObject val13 = Object.Instantiate<GameObject>(OutTardisPrefab, val.transform); ((Object)val13).name = "OutTardis_Marker"; val13.transform.localPosition = Vector3.zero; val13.transform.localRotation = Quaternion.identity; bool flag2 = false; if (((Object)val).name.Contains("doctorwhoShip") || ((Object)val).name.Contains("doctorwhoShip Variant") || ((Object)val).name.Contains("Cylinder001")) { Log.LogInfo((object)("TARDIS: Dalek/Ship detected (" + ((Object)val).name + "). Injecting Audio...")); Transform val14 = val.transform.FindRecursive("sound"); GameObject val15 = (((Object)(object)val14 != (Object)null) ? ((Component)val14).gameObject : val); AudioSource val16 = val15.GetComponent<AudioSource>() ?? val15.AddComponent<AudioSource>(); AudioSource componentInChildren = val.GetComponentInChildren<AudioSource>(true); SetupTardisAudioSource(val16); ((Behaviour)val16).enabled = true; val16.mute = false; val16.volume = 1f; Log.LogInfo((object)("TARDIS: AudioSource active on " + ((Object)val15).name)); } if (((Object)val).name.Contains("OutTardis")) { Transform val17 = val.transform.FindRecursive("Audio Loop Distance"); if ((Object)(object)val17 != (Object)null) { ((Component)val17).gameObject.SetActive(false); } AudioSource[] componentsInChildren7 = val.GetComponentsInChildren<AudioSource>(true); AudioSource[] array3 = componentsInChildren7; foreach (AudioSource val18 in array3) { if ((Object)(object)val18.clip != (Object)null && ((Object)val18.clip).name.Contains("outtardis")) { val18.spatialBlend = 1f; val18.rolloffMode = (AudioRolloffMode)1; val18.minDistance = 1f; val18.maxDistance = 25f; val18.loop = true; val18.volume = 0.8f; if (!val18.isPlaying) { val18.Play(); } Log.LogInfo((object)("TARDIS: Successfully tuned " + ((Object)((Component)val18).gameObject).name)); } } } AudioSource[] componentsInChildren8 = val.GetComponentsInChildren<AudioSource>(true); Log.LogInfo((object)$"TARDIS DEBUG: {((Object)val).name} spawned with {componentsInChildren8.Length} AudioSources."); AudioSource[] array4 = componentsInChildren8; foreach (AudioSource val19 in array4) { string text = (((Object)(object)val19.clip != (Object)null) ? ((Object)val19.clip).name : "NULL"); Log.LogInfo((object)(" -> Found Source on [" + ((Object)((Component)val19).gameObject).name + "] playing clip: [" + text + "]")); } if (!flag2) { Transform val20 = val13.transform.FindRecursive("sound"); if ((Object)(object)val20 != (Object)null) { Log.LogInfo((object)"TARDIS: No existing source found. Creating new AudioSource on 'sound' object."); AudioSource source = ((Component)val20).gameObject.GetComponent<AudioSource>() ?? ((Component)val20).gameObject.AddComponent<AudioSource>(); SetupTardisAudioSource(source); } } } } if (((Object)val).name.Contains("doctorwhoShip Variant") || ((Object)val).name.Contains("OutTardis")) { AudioSource componentInChildren2 = val.GetComponentInChildren<AudioSource>(); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.mute = false; componentInChildren2.volume = 0.5f; if (!componentInChildren2.isPlaying) { componentInChildren2.Play(); } Log.LogInfo((object)("TARDIS: Successfully started baked-in sound on " + ((Object)val).name)); } } if (((Object)val).name.Contains("Start Room - Manor - Kitchen Dining Room") && !((Object)(object)val.transform.Find("ShadowRoom_Marker") != (Object)null) && (Object)(object)ShadowRoomPrefab != (Object)null) { Renderer[] componentsInChildren9 = val.GetComponentsInChildren<Renderer>(true); foreach (Renderer val21 in componentsInChildren9) { val21.enabled = false; } Collider[] componentsInChildren10 = val.GetComponentsInChildren<Collider>(true); foreach (Collider val22 in componentsInChildren10) { val22.enabled = false; } Renderer[] componentsInParent3 = val.GetComponentsInParent<Renderer>(true); foreach (Renderer val23 in componentsInParent3) { val23.enabled = false; } Collider[] componentsInParent4 = val.GetComponentsInParent<Collider>(true); foreach (Collider val24 in componentsInParent4) { val24.enabled = false; } GameObject val25 = Object.Instantiate<GameObject>(ShadowRoomPrefab, val.transform); ((Object)val25).name = "ShadowRoom_Marker"; val25.transform.localPosition = Vector3.zero; val25.transform.localRotation = Quaternion.identity; AudioSource[] componentsInChildren11 = val.GetComponentsInChildren<AudioSource>(true); Log.LogInfo((object)$"TARDIS DEBUG: {((Object)val).name} spawned with {componentsInChildren11.Length} AudioSources."); AudioSource[] array5 = componentsInChildren11; foreach (AudioSource val26 in array5) { string text2 = (((Object)(object)val26.clip != (Object)null) ? ((Object)val26.clip).name : "NULL"); Log.LogInfo((object)(" -> Found Source on [" + ((Object)((Component)val26).gameObject).name + "] playing clip: [" + text2 + "]")); } Instance.SetupShadowScare(val25); } } } public class SurrealPaintingLogic : MonoBehaviour { [CompilerGenerated] private sealed class <FlickerLights>d__12 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public SurrealPaintingLogic <>4__this; private Light[] <allLights>5__1; private Light[] <nearby>5__2; private int <i>5__3; private Light[] <>s__4; private int <>s__5; private Light <l>5__6; private Light[] <>s__7; private int <>s__8; private Light <l>5__9; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FlickerLights>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <allLights>5__1 = null; <nearby>5__2 = null; <>s__4 = null; <l>5__6 = null; <>s__7 = null; <l>5__9 = null; <>1__state = -2; } private bool MoveNext() { //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <allLights>5__1 = Object.FindObjectsOfType<Light>(); <nearby>5__2 = Array.FindAll(<allLights>5__1, (Light l) => Vector3.Distance(((Component)l).transform.position, ((Component)<>4__this).transform.position) <= <>4__this.flickerRadius); <i>5__3 = 0; break; case 1: <>1__state = -1; <>s__7 = <nearby>5__2; for (<>s__8 = 0; <>s__8 < <>s__7.Length; <>s__8++) { <l>5__9 = <>s__7[<>s__8]; ((Behaviour)<l>5__9).enabled = true; <l>5__9 = null; } <>s__7 = null; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 2; return true; case 2: <>1__state = -1; <i>5__3++; break; } if (<i>5__3 < 4) { <>s__4 = <nearby>5__2; for (<>s__5 = 0; <>s__5 < <>s__4.Length; <>s__5++) { <l>5__6 = <>s__4[<>s__5]; ((Behaviour)<l>5__6).enabled = false; <l>5__6 = null; } <>s__4 = null; <>2__current = (object)new WaitForSeconds(0.08f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public Texture2D scareTexture; public float flickerRadius = 15f; private bool hasBeenClose = false; private bool isLookingAt = false; private bool hasSwapped = false; private bool hasFinished = false; private Renderer rend; private AudioSource audio; private void Start() { rend = ((Component)this).GetComponent<Renderer>(); audio = ((Component)this).gameObject.GetComponent<AudioSource>() ?? ((Component)this).gameObject.AddComponent<AudioSource>(); audio.spatialBlend = 1f; } private void Update() { //IL_0026: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (hasFinished || (Object)(object)Camera.main == (Object)null) { return; } Vector3 val = ((Component)this).transform.position - ((Component)Camera.main).transform.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude <= 3.5f) { hasBeenClose = true; } bool flag = false; if (magnitude <= 10f) { float num = Vector3.Angle(((Component)Camera.main).transform.forward, val); if (num <= 35f) { flag = true; } } if (flag && !isLookingAt) { isLookingAt = true; if (hasSwapped && !hasFinished) { TriggerSoundEffect(); } } else if (!flag && isLookingAt) { isLookingAt = false; if (hasBeenClose && !hasSwapped) { TriggerVisualScare(); } } } private void TriggerVisualScare() { hasSwapped = true; if ((Object)(object)rend != (Object)null && (Object)(object)scareTexture != (Object)null) { rend.material.mainTexture = (Texture)(object)scareTexture; } ((MonoBehaviour)this).StartCoroutine(FlickerLights()); } private void TriggerSoundEffect() { hasFinished = true; if ((Object)(object)OutTardisClip != (Object)null) { audio.PlayOneShot(TARDISscare); } } [IteratorStateMachine(typeof(<FlickerLights>d__12))] private IEnumerator FlickerLights() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FlickerLights>d__12(0) { <>4__this = this }; } } public class TARDISFlightScroller : MonoBehaviour { public class SurrealPaintingLogic : MonoBehaviour { [CompilerGenerated] private sealed class <LocalFlicker>d__8 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public SurrealPaintingLogic <>4__this; private Light[] <lights>5__1; private Light[] <nearby>5__2; private int <i>5__3; private Light[] <>s__4; private int <>s__5; private Light <l>5__6; private Light[] <>s__7; private int <>s__8; private Light <l>5__9; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LocalFlicker>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <lights>5__1 = null; <nearby>5__2 = null; <>s__4 = null; <l>5__6 = null; <>s__7 = null; <l>5__9 = null; <>1__state = -2; } private bool MoveNext() { //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <lights>5__1 = Object.FindObjectsOfType<Light>(); <nearby>5__2 = Array.FindAll(<lights>5__1, (Light l) => Vector3.Distance(((Component)l).transform.position, ((Component)<>4__this).transform.position) <= 15f); <i>5__3 = 0; break; case 1: <>1__state = -1; <>s__7 = <nearby>5__2; for (<>s__8 = 0; <>s__8 < <>s__7.Length; <>s__8++) { <l>5__9 = <>s__7[<>s__8]; ((Behaviour)<l>5__9).enabled = true; <l>5__9 = null; } <>s__7 = null; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 2; return true; case 2: <>1__state = -1; <i>5__3++; break; } if (<i>5__3 < 4) { <>s__4 = <nearby>5__2; for (<>s__5 = 0; <>s__5 < <>s__4.Length; <>s__5++) { <l>5__6 = <>s__4[<>s__5]; ((Behaviour)<l>5__6).enabled = false; <l>5__6 = null; } <>s__4 = null; <>2__current = (object)new WaitForSeconds(0.08f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private Renderer rend; private AudioSource audioSource; private bool isPrimed = false; private bool isLooking = false; private bool hasSwapped = false; private bool sfxPlayed = false; private void Start() { rend = ((Component)this).GetComponent<Renderer>(); audioSource = ((Component)this).gameObject.GetComponent<AudioSource>() ?? ((Component)this).gameObject.AddComponent<AudioSource>(); audioSource.spatialBlend = 1f; } private void Update() { //IL_0028: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (sfxPlayed || (Object)(object)Camera.main == (Object)null) { return; } Vector3 val = ((Component)this).transform.position - ((Component)Camera.main).transform.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude <= 3.5f) { isPrimed = true; } float num = Vector3.Angle(((Component)Camera.main).transform.forward, val); bool flag = magnitude <= 10f && num <= 35f; if (flag && !isLooking) { isLooking = true; if (hasSwapped && !sfxPlayed && (Object)(object)OutTardisClip != (Object)null) { audioSource.PlayOneShot(OutTardisClip); sfxPlayed = true; } } else { if (flag || !isLooking) { return; } isLooking = false; if (isPrimed && !hasSwapped) { hasSwapped = true; if ((Object)(object)rend != (Object)null && (Object)(object)ScareTexture != (Object)null) { rend.material.mainTexture = (Texture)(object)ScareTexture; } ((MonoBehaviour)this).StartCoroutine(LocalFlicker()); } } } [IteratorStateMachine(typeof(<LocalFlicker>d__8))] private IEnumerator LocalFlicker() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LocalFlicker>d__8(0) { <>4__this = this }; } } public float scrollSpeed = 11000f; public float maxDistanceX = 250f; private float offsetX = -150f; public float rotationSpeed = 460f; public float forwardTilt = 0f; public float sideLean = -20f; private float currentYRotation = 0f; private void Start() { TruckLandscapeScroller componentInParent = ((Component)this).GetComponentInParent<TruckLandscapeScroller>(); if ((Object)(object)componentInParent != (Object)null) { scrollSpeed = componentInParent.truckSpeed * 15f; } } private void Update() { //IL_0008: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_00b5: 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_00cc: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)this).transform; transform.localPosition += Vector3.right * scrollSpeed * Time.deltaTime; if (((Component)this).transform.localPosition.x > maxDistanceX) { ((Component)this).transform.localPosition = new Vector3(offsetX, ((Component)this).transform.localPosition.y, ((Component)this).transform.localPosition.z); } currentYRotation += rotationSpeed * Time.deltaTime; Quaternion val = Quaternion.Euler(0f, currentYRotation, 0f); Quaternion val2 = Quaternion.Euler(forwardTilt, 0f, sideLean); ((Component)this).transform.localRotation = val2 * val; } } public class EmptyChildShadowScare : MonoBehaviour { [CompilerGenerated] private sealed class <FlickerSequence>d__10 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public EmptyChildShadowScare <>4__this; private float[] <waits>5__1; private bool <state>5__2; private int <i>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FlickerSequence>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <waits>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <waits>5__1 = new float[11] { 0.1f, 0.1f, 0.8f, 0.05f, 0.6f, 0.2f, 0.1f, 0.2f, 0.1f, 0.2f, 0.1f }; <state>5__2 = false; <i>5__3 = 0; break; case 1: <>1__state = -1; <state>5__2 = !<state>5__2; <i>5__3++; break; } if (<i>5__3 < <waits>5__1.Length) { if (Object.op_Implicit((Object)(object)<>4__this.scareLight)) { ((Behaviour)<>4__this.scareLight).enabled = <state>5__2; } if (Object.op_Implicit((Object)(object)<>4__this.shadowObject)) { <>4__this.shadowObject.SetActive(<state>5__2); } <>2__current = (object)new WaitForSeconds(<waits>5__1[<i>5__3]); <>1__state = 1; return true; } if (Object.op_Implicit((Object)(object)<>4__this.scareLight)) { ((Behaviour)<>4__this.scareLight).enabled = true; } if (Object.op_Implicit((Object)(object)<>4__this.shadowObject)) { <>4__this.shadowObject.SetActive(false); } <>4__this.shadowGoneForever = true; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public Light scareLight; public GameObject shadowObject; public LayerMask playerLayer; public AudioSource audioSource; private bool audioTriggered = false; private bool scareTriggered = false; private bool shadowGoneForever = false; private float rangeTimer = 0f; private void Start() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)scareLight != (Object)null) { ((Behaviour)scareLight).enabled = true; } if ((Object)(object)shadowObject != (Object)null) { shadowObject.SetActive(true); } playerLayer = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Player" })); } private void Update() { //IL_0029: 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_0098: 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) if (scareTriggered || shadowGoneForever) { return; } if (!audioTriggered && Physics.CheckSphere(((Component)this).transform.position, 6f, LayerMask.op_Implicit(playerLayer))) { if ((Object)(object)audioSource != (Object)null && (Object)(object)GlassKnockClip != (Object)null) { audioSource.clip = GlassKnockClip; audioSource.Play(); } audioTriggered = true; } if (Physics.CheckSphere(((Component)this).transform.position, 5f, LayerMask.op_Implicit(playerLayer))) { rangeTimer += Time.deltaTime; if (rangeTimer >= 2f) { scareTriggered = true; ((MonoBehaviour)this).StartCoroutine(FlickerSequence()); } } else { rangeTimer = 0f; } } [IteratorStateMachine(typeof(<FlickerSequence>d__10))] private IEnumerator FlickerSequence() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FlickerSequence>d__10(0) { <>4__this = this }; } } [CompilerGenerated] private sealed class <ArenaMusicMonitor>d__39 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Plugin <>4__this; private bool <isArena>5__1; private GameObject <levelObj>5__2; private AudioSource[] <allSources>5__3; private AudioSource[] <>s__4; private int <>s__5; private AudioSource <source>5__6; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ArenaMusicMonitor>d__39(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <levelObj>5__2 = null; <allSources>5__3 = null; <>s__4 = null; <source>5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; Log.LogInfo((object)"TARDIS: Arena Monitor active."); <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; case 1: <>1__state = -1; break; case 2: <>1__state = -1; <levelObj>5__2 = null; break; } <isArena>5__1 = false; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name.Contains("Arena")) { <isArena>5__1 = true; } <levelObj>5__2 = GameObject.Find("Level Generator"); if ((Object)(object)<levelObj>5__2 != (Object)null && <levelObj>5__2.transform.childCount > 0 && ((Object)<levelObj>5__2.transform.GetChild(0)).name.Contains("Arena")) { <isArena>5__1 = true; } if (<isArena>5__1) { <allSources>5__3 = Object.FindObjectsOfType<AudioSource>(); <>s__4 = <allSources>5__3; for (<>s__5 = 0; <>s__5 < <>s__4.Length; <>s__5++) { <source>5__6 = <>s__4[<>s__5]; if (!((Object)(object)<source>5__6 == (Object)null) && !((Object)(object)<source>5__6.clip == (Object)null)) { if (((Object)<source>5__6.clip).name == "arena_music_temp" && (Object)(object)<source>5__6.clip != (Object)(object)TARDISArenaTheme) { Log.LogInfo((object)"TARDIS: Swapping Arena Music..."); <source>5__6.Stop(); <source>5__6.clip = TARDISArenaTheme; <source>5__6.bypassEffects = true; <source>5__6.bypassListenerEffects = true; <source>5__6.spatialBlend = 0f; <source>5__6.volume = 1f; <source>5__6.loop = true; <source>5__6.Play(); } <source>5__6 = null; } } <>s__4 = null; <allSources>5__3 = null; } <>2__current = (object)new WaitForSeconds(2f); <>1__state = 2; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <GlobalMusicMonitor>d__43 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Plugin <>4__this; private string <lastLevelName>5__1; private bool <tardisPrepared>5__2; private bool <musicStarted>5__3; private GameObject <tardisMusicObj>5__4; private AudioSource <tardisSource>5__5; private FieldInfo <stateField>5__6; private string <sceneName>5__7; private States <currentState>5__8; private States <currentState>5__9; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GlobalMusicMonitor>d__43(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <lastLevelName>5__1 = null; <tardisMusicObj>5__4 = null; <tardisSource>5__5 = null; <stateField>5__6 = null; <sceneName>5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_009d: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Expected O, but got Unknown //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Invalid comparison between Unknown and I4 //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: 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_02e2: Invalid comparison between Unknown and I4 //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Expected O, but got Unknown Scene activeScene; switch (<>1__state) { default: return false; case 0: <>1__state = -1; Log.LogInfo((object)"TARDIS: Arena Monitor Hooked. Standing by for Hatch trigger..."); <lastLevelName>5__1 = ""; <tardisPrepared>5__2 = false; <musicStarted>5__3 = false; <tardisMusicObj>5__4 = null; <tardisSource>5__5 = null; <stateField>5__6 = typeof(Arena).GetField("currentState", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); goto IL_038f; case 1: <>1__state = -1; break; case 2: <>1__state = -1; goto IL_038f; case 3: <>1__state = -1; goto IL_0387; case 4: { <>1__state = -1; goto IL_0387; } IL_0387: <sceneName>5__7 = null; goto IL_038f; IL_038f: activeScene = SceneManager.GetActiveScene(); <sceneName>5__7 = ((Scene)(ref activeScene)).name.ToLower(); if (<sceneName>5__7 != <lastLevelName>5__1) { <lastLevelName>5__1 = <sceneName>5__7; <tardisPrepared>5__2 = false; <musicStarted>5__3 = false; if ((Object)(object)<tardisMusicObj>5__4 != (Object)null) { Object.Destroy((Object)(object)<tardisMusicObj>5__4); } <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } break; } if ((Object)(object)Arena.instance == (Object)null) { <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 2; return true; } if (!<tardisPrepared>5__2) { if ((Object)(object)Arena.instance.musicSource != (Object)null) { Arena.instance.musicSource.Stop(); Arena.instance.musicSource.clip = null; ((Behaviour)Arena.instance.musicSource).enabled = false; Log.LogInfo((object)"TARDIS: Vanilla arena music deleted."); } <tardisMusicObj>5__4 = new GameObject("TARDIS_Arena_Controller"); <tardisSource>5__5 = <tardisMusicObj>5__4.AddComponent<AudioSource>(); <tardisSource>5__5.clip = TARDISArenaTheme; <tardisSource>5__5.volume = 0.5f; <tardisSource>5__5.loop = true; <tardisSource>5__5.spatialBlend = 0f; <tardisSource>5__5.bypassEffects = true; <tardisSource>5__5.playOnAwake = false; <tardisPrepared>5__2 = true; } if (<tardisPrepared>5__2 && !<musicStarted>5__3) { <currentState>5__8 = (States)<stateField>5__6.GetValue(Arena.instance); if ((int)<currentState>5__8 == 4) { <tardisSource>5__5.Play(); <musicStarted>5__3 = true; Log.LogInfo((object)"TARDIS: Arena Hatch Detected. Playing theme NOW."); } } if (<musicStarted>5__3) { <currentState>5__9 = (States)<stateField>5__6.GetValue(Arena.instance); if ((int)<currentState>5__9 == 8) { if ((Object)(object)<tardisSource>5__5 != (Object)null && <tardisSource>5__5.isPlaying) { <tardisSource>5__5.Stop(); Log.LogInfo((object)"TARDIS: Arena ended. Music stopped."); } <musicStarted>5__3 = false; } } if (<tardisPrepared>5__2 && !<musicStarted>5__3) { <>2__current = null; <>1__state = 3; return true; } <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 4; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <GlobalPaintingSweep>d__31 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Plugin <>4__this; private int <replacedCount>5__1; private GameObject[] <rootObjects>5__2; private GameObject[] <>s__3; private int <>s__4; private GameObject <root>5__5; private Renderer[] <allRenderers>5__6; private Renderer[] <>s__7; private int <>s__8; private Renderer <rend>5__9; private Material[] <currentMats>5__10; private bool <changed>5__11; private int <i>5__12; private string <matName>5__13; private Texture2D <strikeTexture>5__14; private SurrealPaintingLogic <logic>5__15; private BoxCollider <col>5__16; private SurrealPaintingLogic <logic>5__17; private BoxCollider <col>5__18; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GlobalPaintingSweep>d__31(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <rootObjects>5__2 = null; <>s__3 = null; <root>5__5 = null; <allRenderers>5__6 = null; <>s__7 = null; <rend>5__9 = null; <currentMats>5__10 = null; <matName>5__13 = null; <strikeTexture>5__14 = null; <logic>5__15 = null; <col>5__16 = null; <logic>5__17 = null; <col>5__18 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; case 1: { <>1__state = -1; Log.LogInfo((object)"TARDIS: Starting Texture-Strike Sweep..."); if ((Object)(object)ReplacementTexture == (Object)null || (Object)(object)LandscapeTexture == (Object)null || (Object)(object)RaphTexture == (Object)null) { Log.LogWarning((object)"TARDIS: Some custom textures are missing. Attempting sweep with what we have..."); } <replacedCount>5__1 = 0; Scene activeScene = SceneManager.GetActiveScene(); <rootObjects>5__2 = ((Scene)(ref activeScene)).GetRootGameObjects(); <>s__3 = <rootObjects>5__2; for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++) { <root>5__5 = <>s__3[<>s__4]; <allRenderers>5__6 = <root>5__5.GetComponentsInChildren<Renderer>(true); <>s__7 = <allRenderers>5__6; for (<>s__8 = 0; <>s__8 < <>s__7.Length; <>s__8++) { <rend>5__9 = <>s__7[<>s__8]; <currentMats>5__10 = <rend>5__9.materials; <changed>5__11 = false; <i>5__12 = 0; while (<i>5__12 < <currentMats>5__10.Length) { if (!((Object)(object)<currentMats>5__10[<i>5__12] == (Object)null)) { <matName>5__13 = ((Object)<currentMats>5__10[<i>5__12]).name; <strikeTexture>5__14 = null; if (StringExtensions.Contains(<matName>5__13, "Painting_V_Furman", StringComparison.OrdinalIgnoreCase)) { <strikeTexture>5__14 = ReplacementTexture; } else if (StringExtensions.Contains(<matName>5__13, "Painting_H_Landscape", StringComparison.OrdinalIgnoreCase)) { <strikeTexture>5__14 = LandscapeTexture; } else if (StringExtensions.Contains(<matName>5__13, "Painting_V_surrealistic", StringComparison.OrdinalIgnoreCase)) { <strikeTexture>5__14 = RaphTexture; <logic>5__15 = ((Component)<rend>5__9).gameObject.GetComponent<SurrealPaintingLogic>() ?? ((Component)<rend>5__9).gameObject.AddComponent<SurrealPaintingLogic>(); <logic>5__15.scareTexture = ScareTexture; if ((Object)(object)((Component)<rend>5__9).gameObject.GetComponent<Collider>() == (Object)null) { <col>5__16 = ((Component)<rend>5__9).gameObject.AddComponent<BoxCollider>(); ((Collider)<col>5__16).isTrigger = true; <col>5__16 = null; } <logic>5__15 = null; } else if (StringExtensions.Contains(<matName>5__13, "Painting_V_surrealistic_0", StringComparison.OrdinalIgnoreCase)) { <strikeTexture>5__14 = RaphTexture; <>4__this.surrealPaintingObj = ((Component)<rend>5__9).gameObject; if ((Object)(object)((Component)<rend>5__9).gameObject.GetComponent<SurrealPaintingLogic>() == (Object)null) { <logic>5__17 = ((Component)<rend>5__9).gameObject.AddComponent<SurrealPaintingLogic>(); <logic>5__17.scareTexture = ScareTexture; <logic>5__17.flickerRadius = 15f; <logic>5__17 = null; } if ((Object)(object)<>4__this.surrealPaintingObj.GetComponent<Collider>() == (Object)null) { <col>5__18 = <>4__this.surrealPaintingObj.AddComponent<BoxCollider>(); ((Collider)<col>5__18).isTrigger = true; <col>5__18 = null; } } if ((Object)(object)<strikeTexture>5__14 != (Object)null) { Log.LogInfo((object)("TARDIS STRIKE: Applying texture to " + <matName>5__13)); <currentMats>5__10[<i>5__12].mainTexture = (Texture)(object)<strikeTexture>5__14; <changed>5__11 = true; <replacedCount>5__1++; } <matName>5__13 = null; <strikeTexture>5__14 = null; } <i>5__12++; } if (<changed>5__11) { <rend>5__9.materials = <currentMats>5__10; } <currentMats>5__10 = null; <rend>5__9 = null; } <>s__7 = null; <allRenderers>5__6 = null; <root>5__5 = null; } <>s__3 = null; Log.LogInfo((object)$"TARDIS: Sweep complete. Total Replaced: {<replacedCount>5__1}"); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <MenuSpawnMonitor>d__48 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Plugin <>4__this; private GameObject <anchor>5__1; private TruckLandscapeScroller <scroller>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <MenuSpawnMonitor>d__48(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <anchor>5__1 = null; <scroller>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; <anchor>5__1 = null; break; } <anchor>5__1 = GameObject.Find("Sign - Closed Road (1)"); if ((Object)(object)<anchor>5__1 != (Object)null && (Object)(object)GameObject.Find("TARDIS_Menu_Flyby") == (Object)null) { <scroller>5__2 = Object.FindObjectOfType<TruckLandscapeScroller>(); if ((Object)(object)<scroller>5__2 != (Object)null) { <>4__this.SpawnMenuTardis(<scroller>5__2, <anchor>5__1); } <scroller>5__2 = null; } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ShopMusicMonitor>d__44 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Plugin <>4__this; private bool <shopFound>5__1; private GameObject <levelContainer>5__2; private IEnumerator <>s__3; private Transform <room>5__4; private AudioSource[] <allSources>5__5; private AudioSource[] <>s__6; private int <>s__7; private AudioSource <source>5__8; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ShopMusicMonitor>d__44(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <levelContainer>5__2 = null; <>s__3 = null; <room>5__4 = null; <allSources>5__5 = null; <>s__6 = null; <source>5__8 = null; <>1__state = -2; } private bool MoveNext() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; Log.LogInfo((object)"TARDIS: Shop Monitor starting..."); <>2__current = (object)new WaitForSeconds(5f); <>1__state = 1; return true; case 1: <>1__state = -1; break; case 2: <>1__state = -1; <levelContainer>5__2 = null; break; } <shopFound>5__1 = false; <levelContainer>5__2 = GameObject.Find("Level Generator/Level"); if ((Object)(object)<levelContainer>5__2 != (Object)null) { <>s__3 = <levelContainer>5__2.transform.GetEnumerator(); try { while (<>s__3.MoveNext()) { <room>5__4 = (Transform)<>s__3.Current; if (((Object)<room>5__4).name.Contains("Shop")) { <shopFound>5__1 = true; break; } <room>5__4 = null; } } finally { if (<>s__3 is IDisposable disposable) { disposable.Dispose(); } } <>s__3 = null; } if (<shopFound>5__1) { <allSources>5__5 = Object.FindObjectsOfType<AudioSource>(); <>s__6 = <allSources>5__5; for (<>s__7 = 0; <>s__7 < <>s__6.Length; <>s__7++) { <source>5__8 = <>s__6[<>s__7]; if (!((Object)(object)<source>5__8 == (Object)null) && !((Object)(object)<source>5__8.clip == (Object)null)) { if (((Object)((Component)<source>5__8).gameObject).name.Contains("Ambience Loop")) { Log.LogInfo((object)"TARDIS: Skipping Ambience Loop to keep environment sounds."); } else { if (((Object)<source>5__8.clip).name.ToLower().Contains("shop") && (Object)(object)<source>5__8.clip != (Object)(object)TARDISMenuTheme) { Log.LogInfo((object)("TARDIS: Swapping Shop Music on " + ((Object)((Component)<source>5__8).gameObject).name)); <source>5__8.Stop(); <source>5__8.clip = TARDISMenuTheme; <source>5__8.spatialBlend = 1f; <source>5__8.Play(); } <source>5__8 = null; } } } <>s__6 = null; <allSources>5__5 = null; } <>2__current = (object)new WaitForSeconds(3f); <>1__state = 2; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static Plugin Instance; public static GameObject TARDISPrefab; public static GameObject TARDISMenuPrefab; public static AudioClip TARDISSound; public static AudioClip TARDISGrabSound; public static GameObject ShadowRoomPrefab; public static AudioClip TARDISNightSound; public static AudioClip TARDISMenuTheme; public static AudioClip TARDISscare; public static AudioClip TARDISArenaTheme; private GameObject currentVideoPlane; public static GameObject WeepPrefab; public static GameObject OutTardisPrefab; public static AudioClip GlassKnockClip; public static AudioClip LetMeInClip; public static AudioClip OutTardisClip; public static Texture2D ScareTexture; public static Texture2D ReplacementTexture; public static Texture2D LandscapeTexture; public static VideoClip TARDISVideo; public static Texture2D RaphTexture; private bool hasBeenClose = false; public static ManualLogSource Log; private bool hasScared = false; private GameObject surrealPaintingObj; private bool isLookingAtSurreal = false; private void Awake() { //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Expected O, but got Unknown //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Expected O, but got Unknown //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Expected O, but got Unknown //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Expected O, but got Unknown //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Expected O, but got Unknown //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Expected O, but got Unknown //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Instance = this; string text = "tardisroom"; string text2 = ""; try { string[] files = Directory.GetFiles(Paths.PluginPath, text, SearchOption.AllDirectories); if (files.Length != 0) { text2 = files[0]; Log.LogInfo((object)("TARDIS: Found bundle at " + text2)); } else { Log.LogError((object)("TARDIS: Could not find '" + text + "' anywhere in " + Paths.PluginPath + "!")); } } catch (Exception ex) { Log.LogError((object)("TARDIS: Error searching for assets: " + ex.Message)); } AssetBundle val = ((!string.IsNullOrEmpty(text2)) ? AssetBundle.LoadFromFile(text2) : null); if ((Object)(object)val != (Object)null) { Material val2 = val.LoadAsset<Material>("raph"); RaphTexture = val.LoadAsset<Texture2D>("raph"); if ((Object)(object)RaphTexture != (Object)null) { Log.LogInfo((object)"TARDIS: Texture 'raph.jpg' successfully loaded."); } else { Log.LogError((object)"TARDIS ERROR: Could not find 'raph' JPG in AssetBundle! Check the name in Unity."); } Log.LogInfo((object)"--- TARDIS ASSET BUNDLE CONTENTS ---"); string[] allAssetNames = val.GetAllAssetNames(); foreach (string text3 in allAssetNames) { Log.LogInfo((object)("Bundle contains: " + text3)); } Log.LogInfo((object)"-------------------------------------"); ShadowRoomPrefab = val.LoadAsset<GameObject>("Start Room - Manor - Shadow"); if ((Object)(object)ShadowRoomPrefab == (Object)null) { Log.LogError((object)"TARDIS: Shadow Room prefab failed to load! Check the name in Unity."); } TARDISMenuPrefab = val.LoadAsset<GameObject>("tardis"); TARDISPrefab = val.LoadAsset<GameObject>("Module - Manor - N - 3 - Tardis"); ScareTexture = val.LoadAsset<Texture2D>("1201"); if ((Object)(object)ScareTexture == (Object)null) { Log.LogError((object)"TARDIS: 1201.jpg failed to load!"); } TARDISSound = LoadAudio(val, "tardis"); WeepPrefab = val.LoadAsset<GameObject>("Weep"); if ((Object)(object)WeepPrefab == (Object)null) { Log.LogError((object)"TARDIS: Weep prefab failed to load!"); } TARDISGrabSound = LoadAudio(val, "tardis_grab"); TARDISNightSound = LoadAudio(val, "tardis_night"); TARDISMenuTheme = LoadAudio(val, "tardis_menu_loop"); TARDISscare = LoadAudio(val, "scare"); TARDISArenaTheme = LoadAudio(val, "Dr_who_death"); ReplacementTexture = val.LoadAsset<Texture2D>("302854"); LandscapeTexture = val.LoadAsset<Texture2D>("images"); OutTardisPrefab = val.LoadAsset<GameObject>("Module - Manor - DE - 2 - OutTardis"); OutTardisClip = LoadAudio(val, "outtardis"); ShadowRoomPrefab = val.LoadAsset<GameObject>("Start Room - Manor - Shadow"); GlassKnockClip = val.LoadAsset<AudioClip>("glass_knocking"); LetMeInClip = val.LoadAsset<AudioClip>("please_let_me_in"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"TARDIS: Shadow Scare assets loaded successfully."); if ((Object)(object)OutTardisPrefab == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"TARDIS: Failed to load OutTardisPrefab from bundle!"); } if ((Object)(object)ReplacementTexture == (Object)null) { Log.LogError((object)"TARDIS: 302854.jpg failed to load!"); } TARDISVideo = val.LoadAsset<VideoClip>("Dr_who_video"); Log.LogInfo((object)"TARDIS: All assets loaded."); } else { ((BaseUnityPlugin)this).Logger.LogError((object)("TARDIS: Failed to load AssetBundle! Check file path: " + text2)); } ((MonoBehaviour)this).StartCoroutine(MenuSpawnMonitor()); SceneManager.sceneLoaded += OnSceneLoaded; Harmony val3 = new Harmony("com.you.tardisroom"); val3.Patch((MethodBase)AccessTools.Method(typeof(ConstantMusic), "Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MenuMusicPatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val3.Patch((MethodBase)AccessTools.Method(typeof(ConstantMusic), "Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(NightMusicPatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo = AccessTools.Method(typeof(Object), "Instantiate", new Type[3] { typeof(Object), typeof(Vector3), typeof(Quaternion) }, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(ComponentInjectorPatch), "Postfix", (Type[])null, (Type[])null); val3.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo3 = AccessTools.Method(typeof(PlayerAvatar), "LoadingLevelAnimationCompletedRPC", (Type[])null, (Type[])null); val3.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, new HarmonyMethod(typeof(LevelLoadedPaintingPatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val3.Patch((MethodBase)AccessTools.Method(typeof(ConstantMusic), "Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MenuMusicPatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val3.Patch((MethodBase)AccessTools.Method(typeof(ConstantMusic), "Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(NightMusicPatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"TARDIS: Patches applied."); } private AudioClip LoadAudio(AssetBundle bundle, string name) { return bundle.LoadAsset<AudioClip>(name) ?? bundle.LoadAsset<AudioClip>("assets/" + name + ".wav") ?? bundle.LoadAsset<AudioClip>("assets/" + name + ".mp3"); } private void Update() { TriggerArenaVideo(); } private void ExecuteShadowReset() { //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) GameObject[] array = Object.FindObjectsOfType<GameObject>(); int num = 0; GameObject[] array2 = array; foreach (GameObject val in array2) { if (((Object)val).name.IndexOf("Start Room", StringComparison.OrdinalIgnoreCase) >= 0) { Object.Destroy((Object)(object)val); num++; } } GameObject[] array3 = array; foreach (GameObject val2 in array3) { if (((Object)val2).name.IndexOf("Module", StringComparison.OrdinalIgnoreCase) >= 0) { Object.Destroy((Object)(object)val2); num++; } } Log.LogInfo((object)$"TARDIS: Purged {num} modules."); if ((Object)(object)ShadowRoomPrefab != (Object)null) { GameObject val3 = Object.Instantiate<GameObject>(ShadowRoomPrefab, Vector3.zero, Quaternion.identity); ((Object)val3).name = "Start Room - Manor - Shadow (Forced)"; SetupShadowScare(val3); Log.LogInfo((object)"TARDIS: Shadow Room spawned at origin."); } else { Log.LogError((object)"TARDIS: Cannot spawn Shadow Room - Prefab is null!"); } } private void ExecuteotherReset() { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) GameObject[] array = Object.FindObjectsOfType<GameObject>(); int num = 0; GameObject[] array2 = array; foreach (GameObject val in array2) { if (((Object)val).name.IndexOf("Start Room", StringComparison.OrdinalIgnoreCase) >= 0) { Object.Destroy((Object)(object)val); num++; } } GameObject[] array3 = array; foreach (GameObject val2 in array3) { if (((Object)val2).name.IndexOf("Start Room - Manor - Shadow", StringComparison.OrdinalIgnoreCase) >= 0) { Object.Destroy((Object)(object)val2); num++; } } GameObject[] array4 = array; foreach (GameObject val3 in array4) { if (((Object)val3).name.IndexOf("Module", StringComparison.OrdinalIgnoreCase) >= 0) { Object.Destroy((Object)(object)val3); num++; } } Log.LogInfo((object)$"TARDIS: Purged {num} modules."); if ((Object)(object)OutTardisPrefab != (Object)null) { GameObject val4 = Object.Instantiate<GameObject>(OutTardisPrefab, Vector3.zero, Quaternion.identity); ((Object)val4).name = "Module - Manor - DE - 2 - OutTardis (Forced)"; Log.LogInfo((object)"TARDIS: Dalek Room spawned at origin."); } else { Log.LogError((object)"TARDIS: Cannot spawn Shadow Room - Prefab is null!"); } } [IteratorStateMachine(typeof(<GlobalPaintingSweep>d__31))] public IEnumerator GlobalPaintingSweep() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GlobalPaintingSweep>d__31(0) { <>4__this = this }; } public void SetupShadowScare(GameObject room) { //IL_00e6: 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) EmptyChildShadowScare emptyChildShadowScare = room.AddComponent<EmptyChildShadowScare>(); if ((Object)(object)emptyChildShadowScare == (Object)null) { Log.LogError((object)"TARDIS: Failed to add EmptyChildShadowScare component!"); return; } Transform obj = room.transform.FindRecursive("light"); emptyChildShadowScare.scareLight = ((obj != null) ? ((Component)obj).GetComponent<Light>() : null); Transform obj2 = room.transform.FindRecursive("shadow"); emptyChildShadowScare.shadowObject = ((obj2 != null) ? ((Component)obj2).gameObject : null); Transform val = room.transform.FindRecursive("Plane"); if ((Object)(object)val != (Object)null) { AudioSource val2 = ((Component)val).gameObject.GetComponent<AudioSource>() ?? ((Component)val).gameObject.AddComponent<AudioSource>(); val2.spatialBlend = 1f; val2.maxDistance = 15f; val2.playOnAwake = false; emptyChildShadowScare.audioSource = val2; } emptyChildShadowScare.playerLayer = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Player" })); Log.LogInfo((object)"TARDIS: Shadow Scare Components Linked successfully."); } public void SetupTARDISComponents(GameObject newRoom) { ((Object)newRoom).name = "TARDIS_SUPER_SAVE"; Transform val = newRoom.transform.Find("TARDIS_Model") ?? newRoom.transform; ProximityLookAwayDisappear proximityLookAwayDisappear = ((Component)val).gameObject.GetComponent<ProximityLookAwayDisappear>() ?? ((Component)val).gameObject.AddComponent<ProximityLookAwayDisappear>(); AudioSource val2 = ((Component)val).gameObject.GetComponent<AudioSource>() ?? ((Component)val).gameObject.AddComponent<AudioSource>(); val2.spatialBlend = 1f; val2.maxDistance = 25f; proximityLookAwayDisappear.targetObject = ((Component)val).gameObject; proximityLookAwayDisappear.audioSource = val2; proximityLookAwayDisappear.disappearClip = TARDISSound; proximityLookAwayDisappear.activationAnchor = val; ((BaseUnityPlugin)this).Logger.LogInfo((object)"TARDIS: Components injected."); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { currentVideoPlane = null; Log.LogInfo((object)("TARDIS: Scene loaded - " + ((Scene)(ref scene)).name + ".")); ((MonoBehaviour)this).StartCoroutine(GlobalPaintingSweep()); if (((Scene)(ref scene)).name == "Main") { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(GlobalMusicMonitor()); ((MonoBehaviour)this).StartCoroutine(MenuSpawnMonitor()); ((MonoBehaviour)this).StartCoroutine(ShopMusicMonitor()); } } [IteratorStateMachine(typeof(<ArenaMusicMonitor>d__39))] private IEnumerator ArenaMusicMonitor() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ArenaMusicMonitor>d__39(0) { <>4__this = this }; } private void SpawnTARDISVideoPlane() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown if ((Object)(object)TARDISVideo == (Object)null) { Log.LogError((object)"TARDIS: VideoClip is null! Check your AssetBundle names."); return; } Log.LogInfo((object)"TARDIS: Spawning Video Plane..."); currentVideoPlane = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)currentVideoPlane).name = "TARDIS_Death_Video"; Collider component = currentVideoPlane.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } currentVideoPlane.transform.position = new Vector3(0f, -32f, 0f); currentVideoPlane.transform.localScale = new Vector3(100f, 100f, 100f); currentVideoPlane.AddComponent<VideoFacePlayer>(); VideoPlayer val = currentVideoPlane.AddComponent<VideoPlayer>(); val.clip = TARDISVideo; val.isLooping = true; val.renderMode = (VideoRenderMode)3; MeshRenderer component2 = currentVideoPlane.GetComponent<MeshRenderer>(); ((Renderer)component2).material = new Material(Shader.Find("Unlit/Texture")); val.targetMaterialRenderer = (Renderer)(object)component2; val.targetMaterialProperty = "_MainTex"; val.Play(); } public void TriggerArenaVideo() { //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) if ((Object)(object)currentVideoPlane != (Object)null) { return; } Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; bool flag = name.Contains("Arena"); if (!flag) { GameObject val = GameObject.Find("Level Generator"); if ((Object)(object)val != (Object)null && val.transform.childCount > 0 && ((Object)val.transform.GetChild(0)).name.Contains("Arena")) { flag = true; } } if (flag) { Log.LogInfo((object)"TARDIS: Arena Level confirmed. Triggering Spawn..."); SpawnTARDISVideoPlane(); } } [IteratorStateMachine(typeof(<GlobalMusicMonitor>d__43))] private IEnumerator GlobalMusicMonitor() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GlobalMusicMonitor>d__43(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<ShopMusicMonitor>d__44))] private IEnumerator ShopMusicMonitor() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ShopMusicMonitor>d__44(0) { <>4__this = this }; } private static void SetupTardisAudioSource(AudioSource source) { source.clip = OutTardisClip; source.volume = 0.5f; source.spatialBlend = 1f; source.maxDistance = 25f; source.rolloffMode = (AudioRolloffMode)0; source.loop = true; source.Play(); } [IteratorStateMachine(typeof(<MenuSpawnMonitor>d__48))] private IEnumerator MenuSpawnMonitor() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <MenuSpawnMonitor>d__48(0) { <>4__this = this }; } private void SpawnMenuTardis(TruckLandscapeScroller scroller, GameObject anchor) { //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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)TARDISMenuPrefab == (Object)null)) { GameObject val = Object.Instantiate<GameObject>(TARDISMenuPrefab, ((Component)scroller).transform); ((Object)val).name = "TARDIS_Menu_Flyby"; val.transform.position = anchor.transform.position + Vector3.up * 15f; val.AddComponent<TARDISFlightScroller>(); Log.LogInfo((object)"TARDIS: Spawned at triple height (15m) above Sign."); } } } public static class TransformExtensions { public static Transform FindRecursive(this Transform parent, string name) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown foreach (Transform item in parent) { Transform val = item; if (((Object)val).name == name) { return val; } Transform val2 = val.FindRecursive(name); if ((Object)(object)val2 != (Object)null) { return val2; } } return null; } } public class TARDISFlightScroller : MonoBehaviour { public float scrollSpeed = 12f; public float maxDistanceX = 80f; private float offsetX = -22f; public float heightOffset = 4.5f; public float rotationSpeed = 50f; public float forwardTilt = 15f; private TruckLandscapeScroller truck; private void Start() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_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) truck = ((Component)this).GetComponentInParent<TruckLandscapeScroller>(); if ((Object)(object)truck != (Object)null) { scrollSpeed *= truck.truckSpeed; } ((Component)this).transform.localPosition = new Vector3(((Component)this).transform.localPosition.x, heightOffset, ((Component)this).transform.localPosition.z); ((Component)this).transform.localRotation = Quaternion.Euler(forwardTilt, 0f, 0f); } private void Update() { //IL_0008: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_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_008a: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)this).transform; transform.localPosition += Vector3.right * scrollSpeed * Time.deltaTime; if (((Component)this).transform.localPosition.x > maxDistanceX + offsetX) { ((Component)this).transform.localPosition = new Vector3(0f - maxDistanceX + offsetX, ((Component)this).transform.localPosition.y, ((Component)this).transform.localPosition.z); } ((Component)this).transform.Rotate(Vector3.up, rotationSpeed * Time.deltaTime, (Space)1); } } [HarmonyPatch(typeof(ConstantMusic), "Update")] public static class MenuMusicPatch { private static void Postfix(ConstantMusic __instance, ref bool ___setup) { if (___setup && !((Object)(object)Plugin.TARDISMenuTheme == (Object)null)) { AudioSource component = ((Component)__instance).GetComponent<AudioSource>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.clip == (Object)(object)Plugin.TARDISMenuTheme)) { component.Stop(); component.clip = Plugin.TARDISMenuTheme; component.loop = true; component.Play(); Plugin.Log.LogInfo((object)"TARDIS: Specific menu loop applied."); } } } } [HarmonyPatch(typeof(TruckLandscapeScroller), "Start")] public static class LobbyInjectionPatch { private static void Postfix(TruckLandscapeScroller __instance) { if ((Object)(object)Plugin.TARDISMenuPrefab == (Object)null) { Plugin.Log.LogError((object)"TARDIS: Menu prefab ('tardis') missing from bundle!"); } else if (!((Object)(object)GameObject.Find("TARDIS_Menu_Flyby") != (Object)null)) { GameObject val = Object.Instantiate<GameObject>(Plugin.TARDISMenuPrefab, ((Component)__instance).transform); ((Object)val).name = "TARDIS_Menu_Flyby"; val.AddComponent<TARDISFlightScroller>(); Plugin.ProximityLookAwayDisappear componentInChildren = val.GetComponentInChildren<Plugin.ProximityLookAwayDisappear>(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)componentInChildren); } Plugin.PlaySoundOnPhysGrab componentInChildren2 = val.GetComponentInChildren<Plugin.PlaySoundOnPhysGrab>(); if ((Object)(object)componentInChildren2 != (Object)null) { Object.Destroy((Object)(object)componentInChildren2); } Plugin.Log.LogInfo((object)"TARDIS: Menu flyby injected."); } } }