Decompiled source of TheLabModdingLib v1.0.0
TheLabModdingLib.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using UnityEngine; using UnityEngine.Audio; using UnityEngine.SceneManagement; using UnityEngine.UI; using Valve.VR; using Valve.VR.InteractionSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyVersion("0.0.0.0")] namespace TheLabModdingLib; public static class ArcheryAPI { public static ArcheryTarget[] GetAllTargets() { return Object.FindObjectsOfType<ArcheryTarget>(); } public static void ResetAllTargets() { ArcheryTarget[] allTargets = GetAllTargets(); foreach (ArcheryTarget val in allTargets) { if ((Object)(object)val != (Object)null) { ((Component)val).SendMessage("ResetTarget"); } } } public static void SetTargetActive(ArcheryTarget target, bool active) { if ((Object)(object)target != (Object)null) { ((Component)target).gameObject.SetActive(active); } } public static void ActivateAllTargets() { ArcheryTarget[] allTargets = GetAllTargets(); foreach (ArcheryTarget val in allTargets) { if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(true); } } } public static int GetActiveTargetCount() { int num = 0; ArcheryTarget[] allTargets = GetAllTargets(); foreach (ArcheryTarget val in allTargets) { if ((Object)(object)val != (Object)null && ((Behaviour)val).isActiveAndEnabled) { num++; } } return num; } public static ArcheryStaging GetStaging() { return Object.FindObjectOfType<ArcheryStaging>(); } public static void StartStaging() { ArcheryStaging staging = GetStaging(); if ((Object)(object)staging != (Object)null) { ((Component)staging).SendMessage("StartStaging"); } } public static void StopStaging() { ArcheryStaging staging = GetStaging(); if ((Object)(object)staging != (Object)null) { ((Component)staging).SendMessage("StopStaging"); } } public static Arrow[] GetAllArrows() { return Object.FindObjectsOfType<Arrow>(); } public static int GetArrowCount() { return GetAllArrows().Length; } public static void RemoveAllArrows() { Arrow[] allArrows = GetAllArrows(); foreach (Arrow val in allArrows) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } } } public static ArrowExplosive[] GetExplosiveArrows() { return Object.FindObjectsOfType<ArrowExplosive>(); } public static Quiver GetQuiver() { return Object.FindObjectOfType<Quiver>(); } public static void FillQuiver(int count = 10) { Quiver quiver = GetQuiver(); if ((Object)(object)quiver != (Object)null) { FieldInfo field = typeof(Quiver).GetField("arrowCount", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(quiver, count); } } } } public static class AudioAPI { public static void SetMasterVolume(float volume) { AudioListener.volume = Mathf.Clamp01(volume); } public static float GetMasterVolume() { return AudioListener.volume; } public static void MuteAll() { AudioListener.volume = 0f; } public static void UnmuteAll() { AudioListener.volume = 1f; } public static void SetAudioPitch(float pitch) { AudioSource globalAudioSource = GetGlobalAudioSource(); if ((Object)(object)globalAudioSource != (Object)null) { globalAudioSource.pitch = pitch; } } public static float GetAudioPitch() { AudioSource globalAudioSource = GetGlobalAudioSource(); return ((Object)(object)globalAudioSource != (Object)null) ? globalAudioSource.pitch : 1f; } public static void SetPitchToTimeScale() { AudioSource globalAudioSource = GetGlobalAudioSource(); if ((Object)(object)globalAudioSource != (Object)null) { globalAudioSource.pitch = Time.timeScale; } } public static AudioSource GetGlobalAudioSource() { Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return null; } AudioSource val = ((Component)main).GetComponent<AudioSource>(); if ((Object)(object)val == (Object)null) { val = ((Component)main).gameObject.AddComponent<AudioSource>(); } return val; } public static void PlayOneShot(AudioClip clip, float volume = 1f) { AudioSource globalAudioSource = GetGlobalAudioSource(); if ((Object)(object)globalAudioSource != (Object)null && (Object)(object)clip != (Object)null) { globalAudioSource.PlayOneShot(clip, volume); } } public static void PlayOneShotAtPosition(AudioClip clip, Vector3 position, float volume = 1f) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)clip != (Object)null) { AudioSource.PlayClipAtPoint(clip, position, volume); } } public static void PlaySoundOnGameObject(GameObject target, AudioClip clip, float volume = 1f) { if (!((Object)(object)target == (Object)null) && !((Object)(object)clip == (Object)null)) { AudioSource val = target.GetComponent<AudioSource>(); if ((Object)(object)val == (Object)null) { val = target.AddComponent<AudioSource>(); } val.PlayOneShot(clip, volume); } } public static AudioSource[] GetAllAudioSources() { return Object.FindObjectsOfType<AudioSource>(); } public static void StopAllAudio() { AudioSource[] allAudioSources = GetAllAudioSources(); foreach (AudioSource val in allAudioSources) { if ((Object)(object)val != (Object)null) { val.Stop(); } } } public static void PauseAllAudio() { AudioSource[] allAudioSources = GetAllAudioSources(); foreach (AudioSource val in allAudioSources) { if ((Object)(object)val != (Object)null) { val.Pause(); } } } public static void ResumeAllAudio() { AudioSource[] allAudioSources = GetAllAudioSources(); foreach (AudioSource val in allAudioSources) { if ((Object)(object)val != (Object)null) { val.UnPause(); } } } public static void SetAudioCategoryVolume(string category, float volume) { AudioMixer[] array = Resources.FindObjectsOfTypeAll<AudioMixer>(); AudioMixer[] array2 = array; foreach (AudioMixer val in array2) { if ((Object)(object)val != (Object)null) { val.SetFloat(category + "Volume", Mathf.Log10(Mathf.Clamp01(volume)) * 20f); } } } public static void MuteAudioCategory(string category) { SetAudioCategoryVolume(category, 0f); } public static SoundPlayOneshot[] GetAllSoundEffects() { return Object.FindObjectsOfType<SoundPlayOneshot>(); } public static void PlaySoundEffect(string name) { SoundPlayOneshot[] allSoundEffects = GetAllSoundEffects(); foreach (SoundPlayOneshot val in allSoundEffects) { if ((Object)(object)val != (Object)null && ((Object)val).name.Contains(name)) { ((Component)val).SendMessage("Play", (object)null); break; } } } public static SoundEffectVRC[] GetXortexSoundEffects() { return Object.FindObjectsOfType<SoundEffectVRC>(); } public static void SetMusicVolume(float volume) { MusicPlayerVRC[] array = Object.FindObjectsOfType<MusicPlayerVRC>(); MusicPlayerVRC[] array2 = array; foreach (MusicPlayerVRC val in array2) { if ((Object)(object)val != (Object)null) { AudioSource component = ((Component)val).GetComponent<AudioSource>(); if ((Object)(object)component != (Object)null) { component.volume = volume; } } } } public static SoundVolumeLerpController[] GetSoundVolumeControllers() { return Object.FindObjectsOfType<SoundVolumeLerpController>(); } public static void FadeOutAll(float duration = 1f) { SoundVolumeLerpController[] soundVolumeControllers = GetSoundVolumeControllers(); foreach (SoundVolumeLerpController val in soundVolumeControllers) { if ((Object)(object)val != (Object)null) { ((Component)val).SendMessage("FadeOut", (object)duration); } } } public static void FadeInAll(float duration = 1f) { SoundVolumeLerpController[] soundVolumeControllers = GetSoundVolumeControllers(); foreach (SoundVolumeLerpController val in soundVolumeControllers) { if ((Object)(object)val != (Object)null) { ((Component)val).SendMessage("FadeIn", (object)duration); } } } } public static class CreditsAPI { public static bool IsAvailable => (Object)(object)GetCredits() != (Object)null; public static Credits GetCredits() { return Object.FindObjectOfType<Credits>(); } public static bool IsPlaying() { Credits credits = GetCredits(); if ((Object)(object)credits == (Object)null) { return false; } FieldInfo field = typeof(Credits).GetField("isPlaying", BindingFlags.Instance | BindingFlags.NonPublic); return field != null && (bool)field.GetValue(credits); } public static void StartCredits() { Credits credits = GetCredits(); if ((Object)(object)credits != (Object)null) { ((Component)credits).SendMessage("StartCredits"); } } public static void StopCredits() { Credits credits = GetCredits(); if ((Object)(object)credits != (Object)null) { ((Component)credits).SendMessage("StopCredits"); } } public static void SkipToEnd() { Credits credits = GetCredits(); if ((Object)(object)credits != (Object)null) { ((Component)credits).SendMessage("SkipToEnd"); } } public static void SetScrollSpeed(float speed) { Credits credits = GetCredits(); if (!((Object)(object)credits == (Object)null)) { FieldInfo field = typeof(Credits).GetField("scrollSpeed", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(credits, speed); } } } public static float GetScrollSpeed() { Credits credits = GetCredits(); if ((Object)(object)credits == (Object)null) { return 0f; } FieldInfo field = typeof(Credits).GetField("scrollSpeed", BindingFlags.Instance | BindingFlags.NonPublic); return (field != null) ? ((float)field.GetValue(credits)) : 0f; } public static CreditsInteractive GetInteractiveCredits() { return Object.FindObjectOfType<CreditsInteractive>(); } public static void StartInteractiveCredits() { CreditsInteractive interactiveCredits = GetInteractiveCredits(); if ((Object)(object)interactiveCredits != (Object)null) { ((Component)interactiveCredits).SendMessage("StartInteractive"); } } } public static class DudeAPI { public static ApertureDudeMasterSpawner GetSpawner() { return ApertureDudeMasterSpawner.instance; } public static bool IsAssaultInProgress() { ApertureDudeMasterSpawner spawner = GetSpawner(); return (Object)(object)spawner != (Object)null && spawner.IsAssultInProgress(); } public static List<ApertureDudeAI> GetAllDudes() { ApertureDudeAI[] source = Object.FindObjectsOfType<ApertureDudeAI>(); return source.ToList(); } public static int GetDudeCount() { return GetAllDudes().Count; } public static void KillAllDudes() { foreach (ApertureDudeAI allDude in GetAllDudes()) { if ((Object)(object)allDude != (Object)null && (Object)(object)((Component)allDude).gameObject != (Object)null) { allDude.Death(); } } } public static void SetDudeDestination(ApertureDudeAI dude, Transform target) { if ((Object)(object)dude != (Object)null) { dude.SetDestination(target); } } public static void SetDudeDestination(ApertureDudeAI dude, Vector3 position) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)dude != (Object)null && (Object)(object)dude.agent != (Object)null) { dude.agent.SetDestination(position); } } public static void SetDudeSpeed(ApertureDudeAI dude, float speed) { if ((Object)(object)dude != (Object)null && (Object)(object)dude.agent != (Object)null) { dude.agent.speed = speed; } } public static void SetAllDudesSpeed(float speed) { foreach (ApertureDudeAI allDude in GetAllDudes()) { if ((Object)(object)allDude != (Object)null && (Object)(object)allDude.agent != (Object)null) { allDude.agent.speed = speed; } } } public static void SetDudeOnFire(ApertureDudeAI dude) { if ((Object)(object)dude != (Object)null) { dude.CatchOnFire(); } } public static void SetAllDudesOnFire() { foreach (ApertureDudeAI allDude in GetAllDudes()) { if ((Object)(object)allDude != (Object)null) { allDude.CatchOnFire(); } } } public static void ResetDudeDestination(ApertureDudeAI dude) { if ((Object)(object)dude != (Object)null) { dude.ResetDestination(); } } public static int GetCurrentWave() { ApertureDudeMasterSpawner spawner = GetSpawner(); return ((Object)(object)spawner != (Object)null) ? spawner.currentWave : 0; } public static int GetTotalWaves() { ApertureDudeMasterSpawner spawner = GetSpawner(); return ((Object)(object)spawner != (Object)null) ? spawner.wave.Length : 0; } public static void NextWave() { ApertureDudeMasterSpawner spawner = GetSpawner(); if ((Object)(object)spawner != (Object)null) { spawner.ReactToShot(); } } public static void TriggerPlayerLose() { ApertureDudeMasterSpawner spawner = GetSpawner(); if ((Object)(object)spawner != (Object)null) { spawner.PlayerLoses(); } } public static void InitializeLongbow() { ApertureDudeMasterSpawner spawner = GetSpawner(); if ((Object)(object)spawner != (Object)null) { spawner.Initialize(); } } public static void ShutdownLongbow() { ApertureDudeMasterSpawner spawner = GetSpawner(); if ((Object)(object)spawner != (Object)null) { spawner.ShutDown(); } } public static ApertureDudeAI SpawnDude(Vector3 position, Quaternion rotation) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) ApertureDudeMasterSpawner spawner = GetSpawner(); if ((Object)(object)spawner == (Object)null || (Object)(object)spawner.enemyBasePrefab == (Object)null) { return null; } GameObject val = Object.Instantiate<GameObject>(spawner.enemyBasePrefab, position, rotation); return val.GetComponent<ApertureDudeAI>(); } public static void SpawnDudeWave(int count) { //IL_0059: 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) ApertureDudeMasterSpawner spawner = GetSpawner(); if ((Object)(object)spawner == (Object)null || (Object)(object)spawner.enemyBasePrefab == (Object)null || spawner.spawnTransforms == null) { return; } for (int i = 0; i < count; i++) { Transform val = spawner.spawnTransforms[Random.Range(0, spawner.spawnTransforms.Length)]; if ((Object)(object)val != (Object)null) { SpawnDude(val.position, val.rotation); } } } public static void MakeDudeTaunt(ApertureDudeAI dude) { if ((Object)(object)dude != (Object)null) { dude.alwaysTaunting = !dude.alwaysTaunting; } } public static void MakeDudeMiniature(ApertureDudeAI dude, bool miniature) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)dude != (Object)null) { dude.isMiniature = miniature; ((Component)dude).transform.localScale = (miniature ? (Vector3.one * 0.3f) : Vector3.one); } } public static void SetDudeShield(ApertureDudeAI dude, bool hasShield) { if ((Object)(object)dude != (Object)null) { dude.hasShield = hasShield; } } public static void SetDudeOnFireState(ApertureDudeAI dude, bool onFire) { if (!((Object)(object)dude == (Object)null)) { if (onFire) { dude.CatchOnFire(); } else { dude.onFire = false; } } } public static void TeleportDude(ApertureDudeAI dude, Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)dude != (Object)null && (Object)(object)dude.agent != (Object)null) { dude.agent.Warp(position); } } public static void SetAllDudesDestination(Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) foreach (ApertureDudeAI allDude in GetAllDudes()) { if ((Object)(object)allDude != (Object)null) { SetDudeDestination(allDude, position); } } } public static void MakeAllDudesMiniature(bool miniature) { foreach (ApertureDudeAI allDude in GetAllDudes()) { MakeDudeMiniature(allDude, miniature); } } public static FetchBot GetFetchBot() { return Object.FindObjectOfType<FetchBot>(); } public static bool IsFetchBotValid(FetchBot bot) { return (Object)(object)bot != (Object)null && (Object)(object)((Component)bot).gameObject != (Object)null; } public static void TeleportFetchBotToPlayer(FetchBot bot) { //IL_0023: 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_003c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bot != (Object)null && (Object)(object)PlayerAPI.VRPlayerInstance != (Object)null) { ((Component)bot).transform.position = PlayerAPI.FeetPositionGuess + PlayerAPI.HMDTransform.forward * 1.5f; } } } public static class EffectsAPI { public static ParticleSystem[] GetAllParticleSystems() { return Object.FindObjectsOfType<ParticleSystem>(); } public static void PlayAllParticleSystems() { ParticleSystem[] allParticleSystems = GetAllParticleSystems(); foreach (ParticleSystem val in allParticleSystems) { if ((Object)(object)val != (Object)null) { val.Play(); } } } public static void StopAllParticleSystems() { ParticleSystem[] allParticleSystems = GetAllParticleSystems(); foreach (ParticleSystem val in allParticleSystems) { if ((Object)(object)val != (Object)null) { val.Stop(); } } } public static void PauseAllParticleSystems() { ParticleSystem[] allParticleSystems = GetAllParticleSystems(); foreach (ParticleSystem val in allParticleSystems) { if ((Object)(object)val != (Object)null) { val.Pause(); } } } public static void SpawnParticleBurst(Vector3 position, int count = 20) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0075: 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_0094: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_0039: Unknown result type (might be due to invalid IL or missing references) ParticleSystem val = ((IEnumerable<ParticleSystem>)Resources.FindObjectsOfTypeAll<ParticleSystem>()).FirstOrDefault((Func<ParticleSystem, bool>)delegate(ParticleSystem p) { //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) Scene scene = ((Component)p).gameObject.scene; return ((Scene)(ref scene)).IsValid(); }); if ((Object)(object)val != (Object)null) { ParticleSystem val2 = Object.Instantiate<ParticleSystem>(val, position, Quaternion.identity); val2.Emit(count); Object.Destroy((Object)(object)((Component)val2).gameObject, 5f); return; } GameObject val3 = new GameObject("_EffectBurst"); val3.transform.position = position; ParticleSystem val4 = val3.AddComponent<ParticleSystem>(); MainModule main = val4.main; ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(2f); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.1f); ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(1f); ((MainModule)(ref main)).maxParticles = count; EmissionModule emission = val4.emission; ((EmissionModule)(ref emission)).SetBurst(0, new Burst(0f, (short)count)); val4.Play(); Object.Destroy((Object)(object)val3, 3f); } public static void FlashScreen(Color color, float duration = 0.2f) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if (!((Object)(object)main == (Object)null)) { GameObject val = new GameObject("_ScreenFlash"); Canvas val2 = val.AddComponent<Canvas>(); val2.renderMode = (RenderMode)0; val2.sortingOrder = 999; Image val3 = val.AddComponent<Image>(); ((Graphic)val3).color = color; ((Graphic)val3).raycastTarget = false; Object.Destroy((Object)(object)val, duration); } } public static void SetBloomIntensity(float intensity) { AmplifyColorEffect[] array = Object.FindObjectsOfType<AmplifyColorEffect>(); AmplifyColorEffect[] array2 = array; foreach (AmplifyColorEffect val in array2) { if ((Object)(object)val != (Object)null) { ((Behaviour)val).enabled = intensity > 0f; } } } public static void SetVignetteEnabled(bool enabled) { AmplifyColorVolume[] array = Object.FindObjectsOfType<AmplifyColorVolume>(); AmplifyColorVolume[] array2 = array; foreach (AmplifyColorVolume val in array2) { if ((Object)(object)val != (Object)null) { ((Behaviour)val).enabled = enabled; } } } public static void SpawnLightning(Vector3 start, Vector3 end) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0037: 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_0074: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_0094: 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_00a0: 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_00af: 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) GameObject val = new GameObject("_Lightning"); val.transform.position = start; LineRenderer val2 = val.AddComponent<LineRenderer>(); ((Renderer)val2).material = new Material(Shader.Find("Sprites/Default")); val2.startColor = Color.yellow; val2.endColor = Color.white; val2.startWidth = 0.05f; val2.endWidth = 0.01f; int num = 10; Vector3[] array = (Vector3[])(object)new Vector3[num + 1]; array[0] = start; array[num] = end; for (int i = 1; i < num; i++) { float num2 = (float)i / (float)num; Vector3 val3 = Vector3.Lerp(start, end, num2); array[i] = val3 + Random.insideUnitSphere * 0.3f; } val2.positionCount = num + 1; val2.SetPositions(array); Object.Destroy((Object)(object)val, 0.3f); } public static void SetPostProcessingEnabled(bool enabled) { AmplifyColorBase[] array = Object.FindObjectsOfType<AmplifyColorBase>(); AmplifyColorBase[] array2 = array; foreach (AmplifyColorBase val in array2) { if ((Object)(object)val != (Object)null) { ((Behaviour)val).enabled = enabled; } } } public static TrailRenderer[] GetAllTrailRenderers() { return Object.FindObjectsOfType<TrailRenderer>(); } public static void ClearAllTrails() { TrailRenderer[] allTrailRenderers = GetAllTrailRenderers(); foreach (TrailRenderer val in allTrailRenderers) { if ((Object)(object)val != (Object)null) { val.Clear(); } } } public static void SpawnExplosionEffect(Vector3 position, float scale = 1f) { //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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); val.transform.position = position; val.transform.localScale = Vector3.one * scale * 0.5f; ((Object)val).name = "_ExplosionEffect"; Material val2 = new Material(Shader.Find("Particles/Additive")); val2.color = new Color(1f, 0.5f, 0f, 0.8f); ((Renderer)val.GetComponent<MeshRenderer>()).material = val2; Rigidbody val3 = val.AddComponent<Rigidbody>(); val3.useGravity = false; Object.Destroy((Object)(object)val, 1f); } public static ProFlare[] GetAllFlares() { return Object.FindObjectsOfType<ProFlare>(); } public static void SetFlareIntensity(float intensity) { ProFlare[] allFlares = GetAllFlares(); foreach (ProFlare val in allFlares) { if ((Object)(object)val != (Object)null) { ((Behaviour)val).enabled = intensity > 0f; } } } public static CFX_SpawnSystem GetSpawnSystem() { return Object.FindObjectOfType<CFX_SpawnSystem>(); } public static void SetAmbientParticlesEnabled(bool enabled) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) List<ParticleSystem> list = new List<ParticleSystem>(); list.AddRange(Object.FindObjectsOfType<ParticleSystem>()); foreach (ParticleSystem item in list) { if ((Object)(object)item != (Object)null) { MainModule main = item.main; if (((MainModule)(ref main)).loop) { EmissionModule emission = item.emission; ((EmissionModule)(ref emission)).enabled = enabled; } } } } } public static class ElevatorAPI { public static bool IsAvailable => (Object)(object)GetElevator() != (Object)null; public static Elevator GetElevator() { return Object.FindObjectOfType<Elevator>(); } public static void OpenDoors() { Elevator elevator = GetElevator(); if ((Object)(object)elevator != (Object)null) { ((Component)elevator).SendMessage("OpenDoors"); } } public static void CloseDoors() { Elevator elevator = GetElevator(); if ((Object)(object)elevator != (Object)null) { ((Component)elevator).SendMessage("CloseDoors"); } } public static void ToggleDoors() { Elevator elevator = GetElevator(); if ((Object)(object)elevator != (Object)null) { ((Component)elevator).SendMessage("ToggleDoors"); } } public static void CallElevator() { Elevator elevator = GetElevator(); if ((Object)(object)elevator != (Object)null) { ((Component)elevator).SendMessage("CallElevator"); } } public static void GoToFloor(int floor) { Elevator elevator = GetElevator(); if ((Object)(object)elevator != (Object)null) { ((Component)elevator).SendMessage("GoToFloor", (object)floor); } } public static void SetSpeed(float speed) { Elevator elevator = GetElevator(); if (!((Object)(object)elevator == (Object)null)) { FieldInfo field = typeof(Elevator).GetField("speed", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(elevator, speed); } } } public static void EmergencyStop() { Elevator elevator = GetElevator(); if ((Object)(object)elevator != (Object)null) { ((Component)elevator).SendMessage("EmergencyStop"); } } public static void SetDoorOpenDuration(float duration) { Elevator elevator = GetElevator(); if (!((Object)(object)elevator == (Object)null)) { FieldInfo field = typeof(Elevator).GetField("doorOpenDuration", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(elevator, duration); } } } public static void SetLightIntensity(float intensity) { Elevator elevator = GetElevator(); if (!((Object)(object)elevator == (Object)null)) { FieldInfo field = typeof(Elevator).GetField("lightIntensity", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(elevator, intensity); } } } public static bool AreDoorsOpen() { Elevator elevator = GetElevator(); if ((Object)(object)elevator == (Object)null) { return false; } FieldInfo field = typeof(Elevator).GetField("doorsOpen", BindingFlags.Instance | BindingFlags.NonPublic); return field != null && (bool)field.GetValue(elevator); } public static bool IsMoving() { Elevator elevator = GetElevator(); if ((Object)(object)elevator == (Object)null) { return false; } FieldInfo field = typeof(Elevator).GetField("isMoving", BindingFlags.Instance | BindingFlags.NonPublic); return field != null && (bool)field.GetValue(elevator); } public static int GetCurrentFloor() { Elevator elevator = GetElevator(); if ((Object)(object)elevator == (Object)null) { return -1; } FieldInfo field = typeof(Elevator).GetField("currentFloor", BindingFlags.Instance | BindingFlags.NonPublic); return (field != null) ? ((int)field.GetValue(elevator)) : (-1); } public static int GetTotalFloors() { Elevator elevator = GetElevator(); if ((Object)(object)elevator == (Object)null) { return 0; } FieldInfo field = typeof(Elevator).GetField("totalFloors", BindingFlags.Instance | BindingFlags.NonPublic); return (field != null) ? ((int)field.GetValue(elevator)) : 0; } } public static class FetchBotAPI { public static bool IsAvailable => (Object)(object)GetFetchBot() != (Object)null; public static FetchBot GetFetchBot() { return Object.FindObjectOfType<FetchBot>(); } public static bool IsValid(FetchBot bot) { return (Object)(object)bot != (Object)null && (Object)(object)((Component)bot).gameObject != (Object)null; } public static void SetFollowTarget(Transform target) { FetchBot fetchBot = GetFetchBot(); if ((Object)(object)fetchBot != (Object)null) { fetchBot.followObject = target; } } public static void SetLookTarget(Transform target) { FetchBot fetchBot = GetFetchBot(); if ((Object)(object)fetchBot != (Object)null) { fetchBot.lookAtObject = target; } } public static void MakePlayDead() { FetchBot fetchBot = GetFetchBot(); if ((Object)(object)fetchBot != (Object)null) { fetchBot.ApplyDamage(); } } public static void TeleportTo(Vector3 position) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) FetchBot fetchBot = GetFetchBot(); if ((Object)(object)fetchBot != (Object)null) { ((Component)fetchBot).transform.position = position; } } public static void TeleportToPlayer() { //IL_0029: 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_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) FetchBot fetchBot = GetFetchBot(); if ((Object)(object)fetchBot != (Object)null && (Object)(object)PlayerAPI.HMDTransform != (Object)null) { ((Component)fetchBot).transform.position = PlayerAPI.FeetPositionGuess + PlayerAPI.HMDTransform.forward * 1.5f; } } public static void SetDebugMode(bool enabled) { FetchBot fetchBot = GetFetchBot(); if ((Object)(object)fetchBot != (Object)null) { fetchBot.m_DebugMode = enabled; fetchBot.spewDebugText = enabled; } } public static void SetCanJump(bool canJump) { FetchBot fetchBot = GetFetchBot(); if ((Object)(object)fetchBot != (Object)null) { fetchBot.canJump = canJump; } } public static void SetMovementParameters(float frequency, float amplitude) { FetchBot fetchBot = GetFetchBot(); if ((Object)(object)fetchBot != (Object)null) { fetchBot.frequency = frequency; fetchBot.amplitude = amplitude; } } public static bool IsObjectFetchTarget(GameObject go) { FetchBot fetchBot = GetFetchBot(); return (Object)(object)fetchBot != (Object)null && fetchBot.IsObjectAFetchTarget(go); } public static void SetArrowPrefab(GameObject prefab) { FetchBot fetchBot = GetFetchBot(); if ((Object)(object)fetchBot != (Object)null) { fetchBot.arrowPrefab = prefab; } } public static int GetArrowCount() { FetchBot fetchBot = GetFetchBot(); if ((Object)(object)fetchBot == (Object)null || fetchBot.m_arrStuckArrows == null) { return 0; } return fetchBot.m_arrStuckArrows.Count; } public static void ClearArrows() { FetchBot fetchBot = GetFetchBot(); if ((Object)(object)fetchBot == (Object)null || fetchBot.m_arrStuckArrows == null) { return; } foreach (Arrow arrStuckArrow in fetchBot.m_arrStuckArrows) { if ((Object)(object)arrStuckArrow != (Object)null) { Object.Destroy((Object)(object)((Component)arrStuckArrow).gameObject); } } fetchBot.m_arrStuckArrows.Clear(); } } public static class FunAPI { public static void SpawnRainbowCube(Vector3 position, float scale = 0.2f) { //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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0067: 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) GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); val.transform.position = position; val.transform.localScale = Vector3.one * scale; ((Object)val).name = "_RainbowCube"; Rigidbody val2 = val.AddComponent<Rigidbody>(); val2.useGravity = true; Material val3 = new Material(Shader.Find("Standard")); val3.color = new Color(Random.value, Random.value, Random.value); ((Renderer)val.GetComponent<MeshRenderer>()).material = val3; val2.velocity = new Vector3(Random.Range(-2f, 2f), Random.Range(3f, 6f), Random.Range(-2f, 2f)); Object.Destroy((Object)(object)val, 10f); } public static void SpawnRainbowCubes(int count) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) Vector3 val = PlayerAPI.FeetPositionGuess; if (val == Vector3.zero) { val = Vector3.zero; } for (int i = 0; i < count; i++) { Vector3 position = val + new Vector3(Random.Range(-3f, 3f), Random.Range(0.5f, 3f), Random.Range(-3f, 3f)); SpawnRainbowCube(position); } } public static void SpawnConfettiExplosion(Vector3 position, int count = 50) { //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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < count; i++) { GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); val.transform.position = position; val.transform.localScale = new Vector3(0.03f, 0.03f, 0.1f); ((Object)val).name = "_Confetti"; Rigidbody val2 = val.AddComponent<Rigidbody>(); val2.useGravity = true; val2.velocity = Random.insideUnitSphere * 5f + Vector3.up * 3f; val2.angularVelocity = Random.insideUnitSphere * 10f; Material val3 = new Material(Shader.Find("Standard")); val3.color = new Color(Random.value, Random.value, Random.value); ((Renderer)val.GetComponent<MeshRenderer>()).material = val3; Object.Destroy((Object)(object)val, 5f); } } public static void SpawnFirework(Vector3 position) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) int num = 30; Color color = default(Color); ((Color)(ref color))..ctor(Random.value, Random.value, Random.value); for (int i = 0; i < num; i++) { GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); val.transform.position = position; val.transform.localScale = Vector3.one * Random.Range(0.05f, 0.15f); ((Object)val).name = "_Firework"; Rigidbody val2 = val.AddComponent<Rigidbody>(); val2.useGravity = true; val2.velocity = Random.insideUnitSphere * Random.Range(2f, 6f); Material val3 = new Material(Shader.Find("Standard")); val3.color = color; ((Renderer)val.GetComponent<MeshRenderer>()).material = val3; Object.Destroy((Object)(object)val, Random.Range(1f, 3f)); } } public static void SpawnFireworks(int count) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) Vector3 val = PlayerAPI.FeetPositionGuess; if (val == Vector3.zero) { val = Vector3.zero; } for (int i = 0; i < count; i++) { Vector3 position = val + new Vector3(Random.Range(-5f, 5f), Random.Range(1f, 4f), Random.Range(-5f, 5f)); SpawnFirework(position); } } public static void MakeAllObjectsBouncy(float bounciness = 1f) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) Rigidbody[] array = Object.FindObjectsOfType<Rigidbody>(); Rigidbody[] array2 = array; foreach (Rigidbody val in array2) { if ((Object)(object)val == (Object)null) { continue; } Collider[] componentsInChildren = ((Component)val).GetComponentsInChildren<Collider>(); Collider[] array3 = componentsInChildren; foreach (Collider val2 in array3) { if (!((Object)(object)val2 == (Object)null)) { PhysicMaterial val3 = (PhysicMaterial)(((object)val2.sharedMaterial) ?? ((object)new PhysicMaterial())); val3.bounciness = bounciness; val3.bounceCombine = (PhysicMaterialCombine)3; val2.sharedMaterial = val3; } } } } public static void SetRandomColorsOnAllObjects() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) MeshRenderer[] array = Object.FindObjectsOfType<MeshRenderer>(); MeshRenderer[] array2 = array; foreach (MeshRenderer val in array2) { if ((Object)(object)val == (Object)null || ((Renderer)val).materials == null) { continue; } Material[] materials = ((Renderer)val).materials; foreach (Material val2 in materials) { if ((Object)(object)val2 != (Object)null && val2.HasProperty("_Color")) { val2.color = new Color(Random.value, Random.value, Random.value); } } } } public static void MakeItemFly(GameObject item, float height = 5f) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)item == (Object)null)) { Rigidbody component = item.GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.useGravity = false; component.velocity = Vector3.zero; component.AddForce(Vector3.up * height, (ForceMode)1); } } } public static void MakeAllItemsFly() { foreach (GameObject allItem in ItemAPI.GetAllItems()) { MakeItemFly(allItem); } } public static void SpawnBalloonAnimal(Vector3 position) { //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_0025: 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_0073: Expected O, but got Unknown //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) //IL_0083: 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_00a6: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); val.transform.position = position; val.transform.localScale = Vector3.one * 0.3f; ((Object)val).name = "_BalloonAnimal"; Rigidbody val2 = val.AddComponent<Rigidbody>(); val2.useGravity = true; val2.mass = 0.1f; val2.drag = 0.5f; Material val3 = new Material(Shader.Find("Standard")); val3.color = Color.Lerp(Color.red, Color.blue, Random.value); ((Renderer)val.GetComponent<MeshRenderer>()).material = val3; val2.AddForce(Vector3.up * 2f, (ForceMode)1); Object.Destroy((Object)(object)val, 20f); } public static void SpawnBalloonAnimals(int count) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) Vector3 val = PlayerAPI.FeetPositionGuess; if (val == Vector3.zero) { val = Vector3.zero; } for (int i = 0; i < count; i++) { Vector3 position = val + new Vector3(Random.Range(-2f, 2f), 1f, Random.Range(-2f, 2f)); SpawnBalloonAnimal(position); } } public static void SpawnRainbowSphere(Vector3 position, float scale = 0.3f) { //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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); val.transform.position = position; val.transform.localScale = Vector3.one * scale; ((Object)val).name = "_RainbowSphere"; Rigidbody val2 = val.AddComponent<Rigidbody>(); val2.useGravity = true; Material val3 = new Material(Shader.Find("Standard")); val3.color = Color.HSVToRGB(Random.value, 1f, 1f); ((Renderer)val.GetComponent<MeshRenderer>()).material = val3; Object.Destroy((Object)(object)val, 15f); } public static void PlayDramaticEffect() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) WorldAPI.SlowMotion(0.1f); WorldAPI.SetAmbientLightColor(Color.red); WorldAPI.ScreenShake(1f, 0.5f); } public static void ResetDramaticEffect() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) WorldAPI.UnfreezeGame(); WorldAPI.SetAmbientLightColor(Color.white); } public static void ToggleRandomTeleport() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) Vector3 position = default(Vector3); ((Vector3)(ref position))..ctor(Random.Range(-10f, 10f), 0f, Random.Range(-10f, 10f)); PlayerAPI.TeleportTo(position); } public static void SpawnSurpriseParticles(Vector3 position) { //IL_0016: 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_002d: 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_0068: 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_0083: Expected O, but got Unknown //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_0093: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 20; i++) { GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); val.transform.position = position; val.transform.localScale = Vector3.one * 0.1f; ((Object)val).name = "_Sparkle"; Rigidbody val2 = val.AddComponent<Rigidbody>(); val2.useGravity = false; val2.velocity = Random.onUnitSphere * Random.Range(1f, 4f); Material val3 = new Material(Shader.Find("Sprites/Default")); val3.color = Color.Lerp(Color.yellow, Color.white, Random.value); ((Renderer)val.GetComponent<MeshRenderer>()).material = val3; Object.Destroy((Object)(object)val, 2f); } } public static void MakeDudesDance() { //IL_009b: 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_00c8: Unknown result type (might be due to invalid IL or missing references) foreach (ApertureDudeAI allDude in DudeAPI.GetAllDudes()) { if (!((Object)(object)allDude == (Object)null) && !((Object)(object)allDude.animator == (Object)null)) { allDude.alwaysTaunting = true; allDude.animator.SetFloat("speed", Random.Range(0.5f, 2f)); if ((Object)(object)allDude.agent != (Object)null) { allDude.agent.speed = Random.Range(3f, 8f); allDude.agent.SetDestination(((Component)allDude).transform.position + new Vector3(Random.Range(-3f, 3f), 0f, Random.Range(-3f, 3f))); } } } } } public static class GameAPI { public static class Xortex { public static GlobalManagerVRC Manager => GlobalManagerVRC.Instance; public static bool IsAvailable => (Object)(object)Manager != (Object)null; public static bool IsGameRunning => (Object)(object)Manager != (Object)null && Manager.GameIsRunning; public static bool IsInfiniteMode => (Object)(object)Manager != (Object)null && Manager.IsInfiniteMode; public static int CurrentScore => ((Object)(object)Manager != (Object)null) ? ((int)typeof(GlobalManagerVRC).GetField("currentScore", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(Manager)) : 0; public static PlayerVRC Player => (!((Object)(object)Manager != (Object)null)) ? ((PlayerVRC)null) : ((PlayerVRC)(typeof(GlobalManagerVRC).GetField("player", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(Manager))); public static bool IsPlayerUsingOverdrive => (Object)(object)Manager != (Object)null && Manager.IsPlayerUsingOverdrive; public static bool IsPlayerFightingBoss => (Object)(object)Manager != (Object)null && Manager.IsPlayerFightingBoss; public static bool IsWaitingForPlayer => (Object)(object)Manager != (Object)null && Manager.WaitingForPlayerToSpawn; public static void SpawnPlayer() { if ((Object)(object)Manager != (Object)null) { ((Component)Manager).SendMessage("Script", (object)null); } } public static void AddScore(int points) { if ((Object)(object)Manager != (Object)null) { Manager.AddScore(points); } } public static void IncrementMultiplier() { if ((Object)(object)Manager != (Object)null) { Manager.IncrementMultiplier(); } } public static void ResetMultiplier() { if ((Object)(object)Manager != (Object)null) { Manager.ResetMultiplier(); } } public static int GetMultiplier() { if ((Object)(object)Manager != (Object)null) { return (int)typeof(GlobalManagerVRC).GetField("currentMultiplier", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(Manager); } return 1; } public static void SetMultiplier(int multiplier) { if ((Object)(object)Manager != (Object)null) { FieldInfo field = typeof(GlobalManagerVRC).GetField("currentMultiplier", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(Manager, multiplier); } } } public static Vector3 GetPlayerPosition() { //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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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) if ((Object)(object)Manager != (Object)null) { Vector3? playerPosition = Manager.GetPlayerPosition(); return playerPosition.HasValue ? playerPosition.Value : Vector3.zero; } return Vector3.zero; } public static void DestroyOneNonBossEnemy() { if ((Object)(object)Manager != (Object)null) { Manager.DestroyOneNonBossEnemy(); } } public static void TriggerSpecialBlast() { if ((Object)(object)Manager != (Object)null) { Manager.TriggerSpecialBlast(); } } public static BossVRC GetBoss() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if ((Object)(object)Manager != (Object)null) { return (BossVRC)(typeof(GlobalManagerVRC).GetField("bossInstance", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(Manager)); } return null; } public static void TriggerBossFight() { if ((Object)(object)Manager != (Object)null) { ((Component)Manager).SendMessage("TriggerBoss", (object)null); } } public static void SetScore(int score) { if ((Object)(object)Manager != (Object)null) { FieldInfo field = typeof(GlobalManagerVRC).GetField("currentScore", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(Manager, score); } } } public static EnemyVRC GetTutorialEnemyPrefab() { return Manager?.TutorialEnemyPrefab; } public static EnemyVRC GetEasyShooterPrefab() { return Manager?.EasyShooterPrefab; } public static EnemyVRC GetMediumShooterPrefab() { return Manager?.MediumShooterPrefab; } public static EnemyVRC GetHardShooterPrefab() { return Manager?.HardShooterPrefab; } public static EnemyVRC GetShotgunnerPrefab() { return Manager?.ShotgunnerPrefab; } public static EnemyVRC GetBigShooterPrefab() { return Manager?.BigShooterPrefab; } public static EnemyVRC GetSeekerPrefab() { return Manager?.SeekerPrefab; } public static EnemyVRC GetSeekerSwarmPrefab() { return Manager?.SeekerSwarmPrefab; } public static EnemyVRC GetDasherPrefab() { return Manager?.DasherPrefab; } public static EnemyVRC GetMineLayerPrefab() { return Manager?.MineLayerPrefab; } public static EnemyVRC GetSlicerPrefab() { return Manager?.SlicerPrefab; } public static EnemyVRC GetSpinnerPrefab() { return Manager?.SpinnerPrefab; } public static void SpawnRandomEnemy(Vector3 position) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) EnemyVRC[] source = (EnemyVRC[])(object)new EnemyVRC[5] { GetEasyShooterPrefab(), GetMediumShooterPrefab(), GetSeekerPrefab(), GetDasherPrefab(), GetShotgunnerPrefab() }; EnemyVRC[] array = source.Where((EnemyVRC p) => (Object)(object)p != (Object)null).ToArray(); if (array.Length != 0 && (Object)(object)Manager != (Object)null) { Manager.SpawnEnemy(array[Random.Range(0, array.Length)], position); } } public static void EnableOverdrive() { if ((Object)(object)Manager != (Object)null) { ((Component)Manager).SendMessage("EnableOverdrive", (object)null); } } public static void TriggerGameOver() { if ((Object)(object)Manager != (Object)null) { ((Component)Manager).SendMessage("GameOver", (object)null); } } } public static class Longbow { public static ApertureDudeMasterSpawner Spawner => ApertureDudeMasterSpawner.instance; public static bool IsAvailable => (Object)(object)Spawner != (Object)null; public static bool IsAssaultInProgress => (Object)(object)Spawner != (Object)null && Spawner.IsAssultInProgress(); public static int CurrentWave => ((Object)(object)Spawner != (Object)null) ? Spawner.currentWave : 0; public static int TotalWaves => ((Object)(object)Spawner != (Object)null) ? Spawner.wave.Length : 0; public static void SetCurrentWave(int wave) { if ((Object)(object)Spawner != (Object)null) { Spawner.currentWave = wave; } } public static GateHealthMeter GetGateHealthMeter() { return ((Object)(object)Spawner != (Object)null) ? Spawner.gateHealthMeter : null; } public static float GetGateHealth() { GateHealthMeter gateHealthMeter = GetGateHealthMeter(); return ((Object)(object)gateHealthMeter != (Object)null) ? ((float)gateHealthMeter.GetGateHealthState()) : 0f; } public static void SetGateHealth(float health) { GateHealthMeter gateHealthMeter = GetGateHealthMeter(); if ((Object)(object)gateHealthMeter != (Object)null) { FieldInfo field = typeof(GateHealthMeter).GetField("gateHealth", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(gateHealthMeter, health); } } } public static LongbowLeaderboard GetLeaderboard() { return LongbowLeaderboard.Instance; } public static int GetLongbowScore() { if ((Object)(object)LongbowLeaderboard.Instance == (Object)null) { return 0; } FieldInfo field = typeof(LongbowLeaderboard).GetField("longbowScore", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { return (int)field.GetValue(LongbowLeaderboard.Instance); } return 0; } public static void SetLongbowScore(int score) { if ((Object)(object)LongbowLeaderboard.Instance != (Object)null) { LongbowLeaderboard.Instance.AddToLongbowScore(score - GetLongbowScore()); } } public static ArcheryTarget[] GetArcheryTargets() { return Object.FindObjectsOfType<ArcheryTarget>(); } public static void ResetAllArcheryTargets() { ArcheryTarget[] archeryTargets = GetArcheryTargets(); foreach (ArcheryTarget val in archeryTargets) { if ((Object)(object)val != (Object)null) { ((Component)val).SendMessage("ResetTarget"); } } } public static void SpawnRabble(int count) { //IL_0053: 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_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_006c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Spawner == (Object)null || Spawner.rabbleSourceGO == null) { return; } GameObject[] rabbleSourceGO = Spawner.rabbleSourceGO; foreach (GameObject val in rabbleSourceGO) { if ((Object)(object)val != (Object)null) { for (int j = 0; j < count; j++) { Object.Instantiate<GameObject>(val, val.transform.position + Random.insideUnitSphere * 0.5f, Quaternion.identity); } } } } public static void TriggerWin() { if ((Object)(object)Spawner != (Object)null && Spawner.winEvent != null) { Spawner.winEvent.Invoke(); } } public static void TriggerLose() { if ((Object)(object)Spawner != (Object)null && Spawner.loseEvent != null) { Spawner.loseEvent.Invoke(); } } } public static class Slingshot { public static SlingshotGameSequence GetGameSequence() { return Object.FindObjectOfType<SlingshotGameSequence>(); } public static SlingshotCoreToy GetCore() { return Object.FindObjectOfType<SlingshotCoreToy>(); } public static SlingshotProgressBar GetProgressBar() { return Object.FindObjectOfType<SlingshotProgressBar>(); } public static void SpawnBall() { SlingshotProgressBar progressBar = GetProgressBar(); if ((Object)(object)progressBar != (Object)null) { ((Component)progressBar).SendMessage("SpawnStartingBalls"); } } public static int GetCurrentScore() { SlingshotLeaderboard val = Object.FindObjectOfType<SlingshotLeaderboard>(); if ((Object)(object)val == (Object)null) { return 0; } FieldInfo field = typeof(SlingshotLeaderboard).GetField("score", BindingFlags.Instance | BindingFlags.NonPublic); return (field != null) ? ((int)field.GetValue(val)) : 0; } public static SlingshotAnnouncer GetAnnouncer() { return Object.FindObjectOfType<SlingshotAnnouncer>(); } public static void SpawnAllBalls() { SlingshotProgressBar progressBar = GetProgressBar(); if ((Object)(object)progressBar != (Object)null) { ((Component)progressBar).SendMessage("SpawnAllBalls", (object)null); } } public static SlingshotTower[] GetAllTowers() { return Object.FindObjectsOfType<SlingshotTower>(); } public static void ResetAllTowers() { SlingshotTower[] allTowers = GetAllTowers(); foreach (SlingshotTower val in allTowers) { if ((Object)(object)val != (Object)null) { ((Component)val).SendMessage("ResetTower", (object)null); } } } } public static class RobotRepair { public static bool IsAvailable => (Object)(object)GetGameManager() != (Object)null; public static GameManager GetGameManager() { return Object.FindObjectOfType<GameManager>(); } public static void SpawnRobot() { GameManager gameManager = GetGameManager(); if ((Object)(object)gameManager != (Object)null) { ((Component)gameManager).SendMessage("SpawnRobot", (object)null); } } public static void ResetGame() { GameManager gameManager = GetGameManager(); if ((Object)(object)gameManager != (Object)null) { ((Component)gameManager).SendMessage("ResetGame", (object)null); } } } public static class VesperPeak { public static bool IsAvailable => (Object)(object)GetManager() != (Object)null; public static VesperPeakManager GetManager() { return Object.FindObjectOfType<VesperPeakManager>(); } public static void TeleportToNorth() { //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) VesperPeakManager manager = GetManager(); if ((Object)(object)manager != (Object)null && (Object)(object)manager.vesperPeakNorthSpawnTransform != (Object)null) { PlayerAPI.TeleportTo(manager.vesperPeakNorthSpawnTransform.position, (Quaternion?)manager.vesperPeakNorthSpawnTransform.rotation); } } public static void TeleportToSouth() { //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) VesperPeakManager manager = GetManager(); if ((Object)(object)manager != (Object)null && (Object)(object)manager.vesperPeakSouthSpawnTransform != (Object)null) { PlayerAPI.TeleportTo(manager.vesperPeakSouthSpawnTransform.position, (Quaternion?)manager.vesperPeakSouthSpawnTransform.rotation); } } } public static class Chess { public static bool IsAvailable => (Object)(object)GetManager() != (Object)null; public static ChessGameManager GetManager() { return ChessGameManager.instance; } public static void ResetBoard() { ChessGameManager manager = GetManager(); if ((Object)(object)manager != (Object)null) { ((Component)manager).SendMessage("ResetBoard", (object)null); } } public static void SetPieceColors(Color black, Color white) { //IL_0019: 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) ChessGameManager manager = GetManager(); if ((Object)(object)manager != (Object)null) { manager.blackPieceMaterial.color = black; manager.whitePieceMaterial.color = white; } } public static void ScatterPieces() { //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_0054: Unknown result type (might be due to invalid IL or missing references) ChessPiece[] array = Object.FindObjectsOfType<ChessPiece>(); foreach (ChessPiece val in array) { if ((Object)(object)val != (Object)null) { Rigidbody component = ((Component)val).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; component.AddExplosionForce(200f, ((Component)val).transform.position + Vector3.up, 3f); } } } } } public static class Cheats { public static void UnlockAllLevels() { if ((Object)(object)PlayerData.instance != (Object)null) { string[] allSceneNames = MiniGamesSceneManifest.GetAllSceneNames(); string[] array = allSceneNames; foreach (string text in array) { PlayerData.instance.DebugVisitLevel(text); } PlayerData.instance.allScenesVisited = true; PlayerData.instance.allExperimentsComplete = true; PlayerData.instance.Save(); } } public static void ResetAllData() { if ((Object)(object)PlayerData.instance != (Object)null) { ((Component)PlayerData.instance).SendMessage("ResetAndSave"); } } public static void VisitAllLevels() { if ((Object)(object)PlayerData.instance != (Object)null) { ((Component)PlayerData.instance).SendMessage("VisitAllLevelsAndSave"); } } public static void AddTokens(int count) { if ((Object)(object)PlayerData.instance != (Object)null) { FieldInfo field = typeof(PlayerData).GetField("tokens", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { int num = (int)field.GetValue(PlayerData.instance); field.SetValue(PlayerData.instance, num + count); PlayerData.instance.Save(); } } } public static void UnlockAllPostcards() { if ((Object)(object)PlayerData.instance != (Object)null) { FieldInfo field = typeof(PlayerData).GetField("unlockedPostcards", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(PlayerData.instance, MiniGamesSceneManifest.GetAllSceneNames().ToArray()); } PlayerData.instance.Save(); } } public static void MaxAllStats() { UnlockAllLevels(); AddTokens(9999); UnlockAllPostcards(); } } } public static class HubAPI { internal class DeskItemDef { public string id; public string displayName; public string sceneName; public Action callback; public Color color; public GameObject prefab; } private static readonly List<DeskItemDef> _deskItems = new List<DeskItemDef>(); public static HubAnnouncer GetAnnouncer() { return HubAnnouncer.instance; } public static void TriggerAnnouncerVO(string voCategory) { HubAnnouncer announcer = GetAnnouncer(); if ((Object)(object)announcer != (Object)null) { ((Component)announcer).SendMessage("PlayCategory", (object)voCategory); } } public static IntroAnnouncer GetIntroAnnouncer() { return Object.FindObjectOfType<IntroAnnouncer>(); } public static ReturnToHubMenu GetReturnToHubMenu() { return Object.FindObjectOfType<ReturnToHubMenu>(); } public static void ShowInventory() { ReturnToHubMenu returnToHubMenu = GetReturnToHubMenu(); if ((Object)(object)returnToHubMenu != (Object)null) { ((Component)returnToHubMenu).SendMessage("ShowInventory"); } } public static void HideInventory() { ReturnToHubMenu returnToHubMenu = GetReturnToHubMenu(); if ((Object)(object)returnToHubMenu != (Object)null) { ((Component)returnToHubMenu).SendMessage("HideInventory"); } } public static void ForceHideInventory() { ReturnToHubMenu returnToHubMenu = GetReturnToHubMenu(); if ((Object)(object)returnToHubMenu != (Object)null) { returnToHubMenu.ForceHideInventory(); } } public static Elevator GetElevator() { return Object.FindObjectOfType<Elevator>(); } public static void OpenElevatorDoors() { Elevator elevator = GetElevator(); if ((Object)(object)elevator != (Object)null) { ((Component)elevator).SendMessage("OpenDoors"); } } public static void CloseElevatorDoors() { Elevator elevator = GetElevator(); if ((Object)(object)elevator != (Object)null) { ((Component)elevator).SendMessage("CloseDoors"); } } public static DeskMagnifier GetDeskMagnifier() { return Object.FindObjectOfType<DeskMagnifier>(); } public static PostcardPlug GetPostcardPlug() { return Object.FindObjectOfType<PostcardPlug>(); } public static string GetPluggedPostcardScene() { PostcardPlug postcardPlug = GetPostcardPlug(); if ((Object)(object)postcardPlug != (Object)null) { return postcardPlug.GetPluggedInPostcardScene(); } return ""; } public static Whiteboard GetWhiteboard() { return Object.FindObjectOfType<Whiteboard>(); } public static TitleScreenManager GetTitleScreenManager() { return Object.FindObjectOfType<TitleScreenManager>(); } public static HubConveyorItem[] GetAllConveyorItems() { return Object.FindObjectsOfType<HubConveyorItem>(); } public static HubCoffeeMugSpawner GetCoffeeMugSpawner() { return Object.FindObjectOfType<HubCoffeeMugSpawner>(); } public static void SpawnCoffeeMug() { HubCoffeeMugSpawner coffeeMugSpawner = GetCoffeeMugSpawner(); if ((Object)(object)coffeeMugSpawner != (Object)null) { ((Component)coffeeMugSpawner).SendMessage("SpawnMug", (object)null); } } public static DioramaSceneShift GetDioramaShift() { return Object.FindObjectOfType<DioramaSceneShift>(); } public static void TriggerDioramaShift() { DioramaSceneShift dioramaShift = GetDioramaShift(); if ((Object)(object)dioramaShift != (Object)null) { ((Component)dioramaShift).SendMessage("Shift", (object)null); } } public static ConveyorBehavior[] GetAllConveyorBelts() { return Object.FindObjectsOfType<ConveyorBehavior>(); } public static void SetConveyorSpeed(float speed) { ConveyorBehavior[] allConveyorBelts = GetAllConveyorBelts(); foreach (ConveyorBehavior val in allConveyorBelts) { if ((Object)(object)val != (Object)null) { FieldInfo field = typeof(ConveyorBehavior).GetField("speed", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(val, speed); } } } } public static void ToggleHubLights(bool on) { Light[] array = Object.FindObjectsOfType<Light>(); foreach (Light val in array) { if ((Object)(object)val != (Object)null) { ((Behaviour)val).enabled = on; } } } public static void PlayHubJingle() { HubAnnouncer announcer = GetAnnouncer(); if ((Object)(object)announcer != (Object)null) { ((Component)announcer).SendMessage("PlayJingle", (object)null); } } public static string RegisterDeskItem(string displayName, string sceneName) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return RegisterDeskItem(displayName, sceneName, Color.white); } public static string RegisterDeskItem(string displayName, string sceneName, Color color) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) string text = Guid.NewGuid().ToString("N"); _deskItems.Add(new DeskItemDef { id = text, displayName = displayName, sceneName = sceneName, color = color }); HubItemManager.OnItemsChanged(); return text; } public static string RegisterDeskItem(string displayName, Action callback) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return RegisterDeskItem(displayName, callback, Color.white); } public static string RegisterDeskItem(string displayName, Action callback, Color color) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) string text = Guid.NewGuid().ToString("N"); _deskItems.Add(new DeskItemDef { id = text, displayName = displayName, callback = callback, color = color }); HubItemManager.OnItemsChanged(); return text; } public static void UnregisterDeskItem(string id) { _deskItems.RemoveAll((DeskItemDef d) => d.id == id); HubItemManager.OnItemsChanged(); } public static string RegisterDeskItem(string displayName, GameObject prefab) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return RegisterDeskItem(displayName, prefab, Color.white); } public static string RegisterDeskItem(string displayName, GameObject prefab, Color color) { //IL_004f: 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) string text = Guid.NewGuid().ToString("N"); if ((Object)(object)prefab != (Object)null) { Object.DontDestroyOnLoad((Object)(object)prefab); DisablePrefabRenderers(prefab); } _deskItems.Add(new DeskItemDef { id = text, displayName = displayName, prefab = prefab, color = color }); HubItemManager.OnItemsChanged(); return text; } public static string RegisterDeskItem(string displayName, GameObject prefab, string sceneName) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) return RegisterDeskItem(displayName, prefab, sceneName, Color.white); } public static string RegisterDeskItem(string displayName, GameObject prefab, string sceneName, Color color) { //IL_0056: 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) string text = Guid.NewGuid().ToString("N"); if ((Object)(object)prefab != (Object)null) { Object.DontDestroyOnLoad((Object)(object)prefab); DisablePrefabRenderers(prefab); } _deskItems.Add(new DeskItemDef { id = text, displayName = displayName, prefab = prefab, sceneName = sceneName, color = color }); HubItemManager.OnItemsChanged(); return text; } public static string RegisterDeskItem(string displayName, GameObject prefab, Action callback) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) return RegisterDeskItem(displayName, prefab, callback, Color.white); } public static string RegisterDeskItem(string displayName, GameObject prefab, Action callback, Color color) { //IL_0056: 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) string text = Guid.NewGuid().ToString("N"); if ((Object)(object)prefab != (Object)null) { Object.DontDestroyOnLoad((Object)(object)prefab); DisablePrefabRenderers(prefab); } _deskItems.Add(new DeskItemDef { id = text, displayName = displayName, prefab = prefab, callback = callback, color = color }); HubItemManager.OnItemsChanged(); return text; } private static void DisablePrefabRenderers(GameObject prefab) { Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { val.enabled = false; } } public static void ClearDeskItems() { _deskItems.Clear(); HubItemManager.OnItemsChanged(); } internal static IReadOnlyList<DeskItemDef> GetDeskItems() { return _deskItems; } } internal static class HubItemManager { private static GameObject _itemsRoot; private static readonly List<GameObject> _spawnedItems; static HubItemManager() { _spawnedItems = new List<GameObject>(); Debug.Log((object)"[TheLabModdingLib] HubItemManager static constructor - subscribing to sceneLoaded"); SceneManager.sceneLoaded += OnSceneLoaded; } internal static void OnItemsChanged() { if (SceneAPI.IsInHub()) { RefreshItems(); } } private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)$"[TheLabModdingLib] OnSceneLoaded: '{((Scene)(ref scene)).name}' (mode={mode})"); if (((Scene)(ref scene)).name == "hub") { RefreshItems(); } else { Cleanup(); } } private static void RefreshItems() { //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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) Cleanup(); IReadOnlyList<HubAPI.DeskItemDef> deskItems = HubAPI.GetDeskItems(); Debug.Log((object)$"[TheLabModdingLib] RefreshItems: {deskItems.Count} registered items"); if (deskItems.Count == 0) { return; } Vector3 val = FindDeskPosition(); Debug.Log((object)$"[TheLabModdingLib] FindDeskPosition returned: {val}"); if (val == Vector3.zero) { return; } _itemsRoot = new GameObject("_ModDeskItems"); _itemsRoot.transform.position = val; float num = 0.15f; int num2 = Mathf.Min(deskItems.Count, 4); int num3 = Mathf.CeilToInt((float)deskItems.Count / (float)num2); for (int i = 0; i < deskItems.Count; i++) { HubAPI.DeskItemDef def = deskItems[i]; int num4 = i / num2; int num5 = i % num2; float num6 = ((float)num5 - (float)(num2 - 1) * 0.5f) * num; float num7 = ((float)num4 - (float)(num3 - 1) * 0.5f) * num + 0.15f; GameObject val2 = SpawnItem(def, new Vector3(num6, 0.05f, num7)); if ((Object)(object)val2 != (Object)null) { _spawnedItems.Add(val2); } } } private static Vector3 FindDeskPosition() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_0074: Unknown result type (might be due to invalid IL or missing references) DeskMagnifier val = Object.FindObjectOfType<DeskMagnifier>(); if ((Object)(object)val != (Object)null) { Vector3 position = ((Component)val).transform.position; position.y += 0.05f; return position; } DeskLampArm val2 = Object.FindObjectOfType<DeskLampArm>(); if ((Object)(object)val2 != (Object)null) { Vector3 position2 = ((Component)val2).transform.position; position2.y += 0.05f; return position2; } return Vector3.zero; } private static GameObject SpawnItem(HubAPI.DeskItemDef def, Vector3 localPos) { //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Expected O, but got Unknown //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Expected O, but got Unknown //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_025b: 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_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027c: 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) GameObject val; if ((Object)(object)def.prefab != (Object)null) { string displayName = def.displayName; MeshFilter component = def.prefab.GetComponent<MeshFilter>(); int? obj; if (component == null) { obj = null; } else { Mesh sharedMesh = component.sharedMesh; obj = ((sharedMesh != null) ? new int?(sharedMesh.vertexCount) : ((int?)null)); } Debug.Log((object)$"[HubItemManager] Spawning prefab '{displayName}' mesh={obj} verts"); val = Object.Instantiate<GameObject>(def.prefab, _itemsRoot.transform); ((Object)val).name = "ModItem_" + def.displayName; val.transform.localPosition = localPos; val.transform.localRotation = Quaternion.identity; MeshRenderer[] componentsInChildren = val.GetComponentsInChildren<MeshRenderer>(); MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val2 in array) { Material[] materials = ((Renderer)val2).materials; foreach (Material val3 in materials) { val3.color = def.color; } } } else { Debug.Log((object)("[HubItemManager] Spawning CUBE fallback for '" + def.displayName + "'")); val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = "ModItem_" + def.displayName; val.transform.SetParent(_itemsRoot.transform, false); val.transform.localPosition = localPos; val.transform.localScale = Vector3.one * 0.08f; val.transform.localRotation = Quaternion.identity; Object.DestroyImmediate((Object)(object)val.GetComponent<BoxCollider>()); MeshRenderer component2 = val.GetComponent<MeshRenderer>(); if ((Object)(object)component2 != (Object)null) { Material val4 = new Material(Shader.Find("Standard")); val4.color = def.color; ((Renderer)component2).material = val4; } } if ((Object)(object)val.GetComponent<Collider>() == (Object)null) { MeshFilter component3 = val.GetComponent<MeshFilter>(); Bounds? obj2; if (component3 == null) { obj2 = null; } else { Mesh sharedMesh2 = component3.sharedMesh; obj2 = ((sharedMesh2 != null) ? new Bounds?(sharedMesh2.bounds) : ((Bounds?)null)); } Bounds? val5 = obj2; if (val5.HasValue) { BoxCollider val6 = val.AddComponent<BoxCollider>(); Bounds value = val5.Value; val6.center = ((Bounds)(ref value)).center; value = val5.Value; val6.size = ((Bounds)(ref value)).size; } else { SphereCollider val7 = val.AddComponent<SphereCollider>(); val7.radius = 0.5f; } } if ((Object)(object)val.GetComponent<Rigidbody>() == (Object)null) { Rigidbody val8 = val.AddComponent<Rigidbody>(); val8.isKinematic = false; val8.useGravity = true; } VRInteractable interactable = val.AddComponent<VRInteractable>(); interactable.highlightOnHover = true; interactable.attachEaseIn = true; interactable.hideHandOnAttach = false; VRThrowable val9 = val.AddComponent<VRThrowable>(); val9.restoreOriginalParent = false; string itemScene = def.sceneName; Action itemCallback = def.callback; OnAttachedToHandDelegate onAttach = null; onAttach = (OnAttachedToHandDelegate)delegate { interactable.onAttachedToHand -= onAttach; if (!string.IsNullOrEmpty(itemScene)) { SceneAPI.LoadScene(itemScene); } else { itemCallback?.Invoke(); } }; interactable.onAttachedToHand += onAttach; return val; } private static void Cleanup() { foreach (GameObject spawnedItem in _spawnedItems) { if ((Object)(object)spawnedItem != (Object)null) { Object.Destroy((Object)(object)spawnedItem); } } _spawnedItems.Clear(); if ((Object)(object)_itemsRoot != (Object)null) { Object.Destroy((Object)(object)_itemsRoot); _itemsRoot = null; } } } public static class InputAPI { private static bool _initialized; public static void Initialize() { if (!_initialized) { _initialized = true; if ((SteamVR_ActionSet)(object)SteamVR_Actions.tool != (SteamVR_ActionSet)null) { ((SteamVR_ActionSet)SteamVR_Actions.tool).Activate((SteamVR_Input_Sources)0, 0, false); } } } public static void Shutdown() { if ((SteamVR_ActionSet)(object)SteamVR_Actions.tool != (SteamVR_ActionSet)null) { ((SteamVR_ActionSet)SteamVR_Actions.tool).Deactivate((SteamVR_Input_Sources)0); } _initialized = false; } public static Vector2 GetLeftThumbstickAxis() { //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_000f: Unknown result type (might be due to invalid IL or missing references) return SteamVR_Actions.tool_RadialMenuPos.GetAxis((SteamVR_Input_Sources)1); } public static Vector2 GetRightThumbstickAxis() { //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_000f: Unknown result type (might be due to invalid IL or missing references) return SteamVR_Actions.tool_RadialMenuPos.GetAxis((SteamVR_Input_Sources)2); } public static Vector2 GetLeftThumbstickAxisNormalized() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) return Normalize(GetLeftThumbstickAxis()); } public static Vector2 GetRightThumbstickAxisNormalized() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) return Normalize(GetRightThumbstickAxis()); } private static Vector2 Normalize(Vector2 axis) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) float magnitude = ((Vector2)(ref axis)).magnitude; if (magnitude > 0.15f) { return (magnitude > 1f) ? ((Vector2)(ref axis)).normalized : axis; } return Vector2.zero; } } public static class ItemAPI { private static FieldInfo _enemiesField; private static FieldInfo EnemiesField { get { if (_enemiesField == null) { _enemiesField = typeof(GlobalManagerVRC).GetField("enemies", BindingFlags.Instance | BindingFlags.NonPublic); } return _enemiesField; } } private static IEnumerable GetEnemiesInternal() { if ((Object)(object)GlobalManagerVRC.Instance == (Object)null || EnemiesField == null) { return new List<EnemyVRC>(); } return (EnemiesField.GetValue(GlobalManagerVRC.Instance) as IEnumerable) ?? new List<EnemyVRC>(); } public static List<GameObject> GetAllItems() { List<GameObject> list = new List<GameObject>(); VRThrowable[] source = Object.FindObjectsOfType<VRThrowable>(); list.AddRange(source.Select((VRThrowable t) => ((Component)t).gameObject)); return list; } public static List<GameObject> GetAllItemsWithComponent<T>() where T : Component { return (from t in Object.FindObjectsOfType<T>() select ((Component)t).gameObject).ToList(); } public static List<GameObject> GetItemsByTag(string tag) { return GameObject.FindGameObjectsWithTag(tag).ToList(); } public static List<GameObject> GetItemsByName(string name) { return (from go in Resources.FindObjectsOfTypeAll<GameObject>() where ((Object)go).name.Contains(name) select go).ToList(); } public static void DestroyItem(GameObject item) { if ((Object)(object)item != (Object)null) { Object.Destroy((Object)(object)item); } } public static void DestroyAllItems() { List<GameObject> allItems = GetAllItems(); foreach (GameObject item in allItems) { if ((Object)(object)item != (Object)null) { Object.Destroy((Object)(object)item); } } } public static void SetItemPosition(GameObject item, Vector3 position) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item != (Object)null) { item.transform.position = position; } } public static void SetItemRotation(GameObject item, Quaternion rotation) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item != (Object)null) { item.transform.rotation = rotation; } } public static Vector3 GetItemPosition(GameObject item) { //IL_0017: 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_001c: 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) return ((Object)(object)item != (Object)null) ? item.transform.position : Vector3.zero; } public static void SetItemKinematic(GameObject item, bool kinematic) { Rigidbody val = ((item != null) ? item.GetComponent<Rigidbody>() : null); if ((Object)(object)val != (Object)null) { val.isKinematic = kinematic; } } public static void SetItemVelocity(GameObject item, Vector3 velocity) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) Rigidbody val = ((item != null) ? item.GetComponent<Rigidbody>() : null); if ((Object)(object)val != (Object)null) { val.velocity = velocity; } } public static void AddForceToItem(GameObject item, Vector3 force, ForceMode mode = (ForceMode)0) { //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) Rigidbody val = ((item != null) ? item.GetComponent<Rigidbody>() : null); if ((Object)(object)val != (Object)null) { val.AddForce(force, mode); } } public static void AddTorqueToItem(GameObject item, Vector3 torque, ForceMode mode = (ForceMode)0) { //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) Rigidbody val = ((item != null) ? item.GetComponent<Rigidbody>() : null); if ((Object)(object)val != (Object)null) { val.AddTorque(torque, mode); } } public static void MakeItemBouncy(GameObject item, float bounciness = 1f) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)item == (Object)null)) { Collider[] componentsInChildren = item.GetComponentsInChildren<Collider>(); Collider[] array = componentsInChildren; foreach (Collider val in array) { PhysicMaterial val2 = (PhysicMaterial)(((object)val.sharedMaterial) ?? ((object)new PhysicMaterial())); val2.bounciness = bounciness; val2.bounceCombine = (PhysicMaterialCombine)3; val.sharedMaterial = val2; val.material = val2; } } } public static void MakeAllItemsBouncy(float bounciness = 1f) { foreach (GameObject allItem in GetAllItems()) { MakeItemBouncy(allItem, bounciness); } } public static void AddRandomForce(GameObject item, float maxForce = 10f) { //IL_0002: 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) AddForceToItem(item, Random.insideUnitSphere * maxForce, (ForceMode)1); } public static void LaunchItemUpward(GameObject item, float force = 10f) { //IL_0002: 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) AddForceToItem(item, Vector3.up * force, (ForceMode)1); } public static void SpawnExplosion(Vector3 position, float radius = 5f, float force = 500f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(position, radius); Collider[] array2 = array; foreach (Collider val in array2) { Rigidbody attachedRigidbody = val.attachedRigidbody; if ((Object)(object)attachedRigidbody != (Object)null) { attachedRigidbody.AddExplosionForce(force, position, radius, 1f); } } } public static List<Rigidbody> GetAllRigidbodies() { return Object.FindObjectsOfType<Rigidbody>().ToList(); } public static List<GameObject> GetAllBreakables() { List<GameObject> list = new List<GameObject>(); list.AddRange(from p in Object.FindObjectsOfType<PropBreakable>() select ((Component)p).gameObject); list.AddRange(from p in Object.FindObjectsOfType<PropExplosiveBarrel>() select ((Component)p).gameObject); list.AddRange(from d in Object.FindObjectsOfType<Damageable>() select ((Component)d).gameObject); return list; } public static void BreakAllBreakables() { PropBreakable[] array = Object.FindObjectsOfType<PropBreakable>(); foreach (PropBreakable val in array) { Object.Destroy((Object)(object)((Component)val).gameObject); } } public static GameObject SpawnPrimitive(PrimitiveType type, Vector3 position, Color color, float scale = 0.1f) { //IL_0001: 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_0021: 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_005f: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive(type); val.transform.position = position; val.transform.localScale = Vector3.one * scale; Rigidbody val2 = val.AddComponent<Rigidbody>(); val2.useGravity = true; MeshRenderer component = val.GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null) { Material val3 = new Material(Shader.Find("Standard")); val3.color = color; ((Renderer)component).material = val3; } return val; } public static List<EnemyVRC> GetAllEnemies() { List<EnemyVRC> list = new List<EnemyVRC>(); foreach (object item in GetEnemiesInternal()) { EnemyVRC val = (EnemyVRC)((item is EnemyVRC) ? item : null); if (val != null) { list.Add(val); } } return list; } public static int GetEnemyCount() { return GetAllEnemies().Count; } public static void DestroyAllEnemies() { foreach (EnemyVRC allEnemy in GetAllEnemies()) { if ((Object)(object)allEnemy != (Object)null) { allEnemy.DestroyUnconditionally(); } } } public static EnemyVRC SpawnEnemy(EnemyVRC prefab, Vector3 position) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GlobalManagerVRC.Instance == (Object)null) { return null; } return GlobalManagerVRC.Instance.SpawnEnemy(prefab, position); } public static void KillAllEnemies() { foreach (EnemyVRC allEnemy in GetAllEnemies()) { if ((Object)(object)allEnemy != (Object)null) { allEnemy.TakeLaserDamage(999999); } } } public static PickupVRC[] GetAllPickups() { return Object.FindObjectsOfType<PickupVRC>(); } public static Arrow[] GetAllArrows() { return Object.FindObjectsOfType<Arrow>(); } public static void RemoveAllArrows() { Arrow[] allArrows = GetAllArrows(); foreach (Arrow val in allArrows) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } } } public static SlingshotProjectile[] GetAllSlingshotProjectiles() { return Object.FindObjectsOfType<SlingshotProjectile>(); } public static void DestroyAllSlingshotProjectiles() { SlingshotProjectile[] allSlingshotProjectiles = GetAllSlingshotProjectiles(); foreach (SlingshotProjectile val in allSlingshotProjectiles) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } } } public static Balloon[] GetAllBalloons() { return Object.FindObjectsOfType<Balloon>(); } public static void PopAllBalloons() { Balloon[] allBalloons = GetAllBalloons(); foreach (Balloon val in allBalloons) { if ((Object)(object)val != (Object)null) { val.EndBalloonLife(); } } } public static Block[] GetAllBlocks() { return Object.FindObjectsOfType<Block>(); } public static void ExplodeAllBlocks() { Block[] allBlocks = GetAllBlocks(); foreach (Block val in allBlocks) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } } } } public static class ModelAPI { public static GameObject LoadOBJ(string path, string objectName = null) { //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Expected O, but got Unknown //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Expected O, but got Unknown //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_0668: Unknown result type (might be due to invalid IL or missing references) //IL_066f: Expected O, but got Unknown //IL_06f1: Unknown result type (might be due to invalid IL or missing references) //IL_06f6: Unknown result type (might be due to invalid IL or missing references) //IL_06fa: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) if (!File.Exists(path)) { Debug.LogError((object)("[ModelAPI] File not found: " + path)); return null;