Decompiled source of Diversity v3.0.2
Diversity Remastered.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Diversity Remastered.NetcodePatcher; using DiversityDungeonGen; using DiversityRemastered.Items; using DiversityRemastered.Misc; using DiversityRemastered.Monsters; using DiversityRemastered.Patches; using DiversityRemastered.Player; using DiversityRemastered.Properties; using DiversityRemastered.ScriptableObjects; using DunGen; using GameNetcodeStuff; using GraphicsAPI; using GraphicsAPI.CustomPostProcessing; using HarmonyLib; using LCCutscene; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using Unity.Netcode.Samples; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.VFX; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Diversity Remastered")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Diversity Remastered")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("2b889c96-cd65-4df4-8daf-302423eccd65")] [assembly: AssemblyFileVersion("3.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.0.0.31645")] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace DiversityRemastered { public class Configuration { public static ConfigEntry<bool> spiderRevamp; public static ConfigEntry<float> spiderSlowAmount; public static ConfigEntry<bool> crawlerRevamp; public static ConfigEntry<float> crawlerSlowAmount; public static ConfigEntry<bool> centipedeRevamp; public static ConfigEntry<int> clickAmount; public static ConfigEntry<int> hurtChance; public static ConfigEntry<bool> brakenRevamp; public static ConfigEntry<bool> brakenFlashight; public static ConfigEntry<bool> brakenSpace; public static ConfigEntry<bool> brakenSnatchCompatibility; public static ConfigEntry<float> brakenRange; public static ConfigEntry<bool> brakenAnger; public static ConfigEntry<float> brakenAngerTime; public static ConfigEntry<int> flickerChance; public static ConfigEntry<int> breakerChance; public static ConfigEntry<bool> apparatusAnger; public static ConfigEntry<bool> chaseTriggerer; public static ConfigEntry<bool> dressGirlRevamp; public static ConfigEntry<float> walkieTalkieFrequency; public static ConfigEntry<bool> dressGirlIsolation; public static ConfigEntry<float> interactRange; public static ConfigEntry<bool> walker; public static ConfigEntry<int> walkerContactAmount; public static ConfigEntry<float> walkerLurkTimeMultiplier; public static ConfigEntry<int> walkerChance; public static ConfigEntry<float> stairsLengthMultiplier; public static ConfigEntry<bool> watcher; public static ConfigEntry<int> watcherWeight; public static ConfigEntry<float> watcherSlamMultiplier; public static ConfigEntry<bool> speaker; public static ConfigEntry<bool> posters; public static ConfigEntry<bool> shipCutscene; public static ConfigEntry<bool> pufferRevamp; public static ConfigEntry<bool> hydrogeneRevamp; public static ConfigEntry<bool> introCutscene; public static ConfigEntry<bool> menuMusic; public static void Load() { spiderRevamp = Diversity.config.Bind<bool>("Spider", "SpiderRevamp", true, "Should spider revamp be enabled?"); spiderSlowAmount = Diversity.config.Bind<float>("Spider", "SpiderSlow", 0.8f, "How much slown should spiders be on hit?"); crawlerRevamp = Diversity.config.Bind<bool>("Crawler", "CrawlerRevamp", true, "Should crawler revamp be enabled?"); crawlerSlowAmount = Diversity.config.Bind<float>("Crawler", "CrawlerSlow", 0.9f, "How much slown should crawlers be on hit?"); centipedeRevamp = Diversity.config.Bind<bool>("Centipede", "CentipedeRevamp", true, "Should centipede revamp be enabled?"); clickAmount = Diversity.config.Bind<int>("Centipede", "ClickAmount", 30, "How many times should you have to click to remove the centipede from someone's head?"); hurtChance = Diversity.config.Bind<int>("Centipede", "HurtChance", 10, "Chance of hurting the player when trying to free the centipede."); brakenRevamp = Diversity.config.Bind<bool>("Bracken", "BrakenRevamp", true, "Should Bracken revamp be enabled?"); brakenFlashight = Diversity.config.Bind<bool>("Bracken", "Braken Flashlight", true, "Should Bracken dim flashlights?"); brakenSpace = Diversity.config.Bind<bool>("Bracken", "BrakenPersonnalSpace", true, "Should the Bracken have his own personnal space?"); brakenSnatchCompatibility = Diversity.config.Bind<bool>("Bracken", "Braken Snatch Compatibility", false, "Enables compatibility with snatching bracken mod. (RECOMMENDED TO DISABLE IT IN SOLO!)"); brakenRange = Diversity.config.Bind<float>("Bracken", "BrakenRange", 15f, "From how far should the Bracken be able to turn off lights?"); brakenAnger = Diversity.config.Bind<bool>("Bracken", "BrakenAnger", true, "Should Bracken get angered from the breaker box?"); brakenAngerTime = Diversity.config.Bind<float>("Bracken", "BrakenAngerTime", 90f, "How long should the Bracken stay angered when fully angered?"); flickerChance = Diversity.config.Bind<int>("Bracken", "FlickerChance", 100, "Chance on flickering and turning off lights."); breakerChance = Diversity.config.Bind<int>("Bracken", "BreakerChance", 75, "Chance for the Bracken to turn off the breaker box."); apparatusAnger = Diversity.config.Bind<bool>("Bracken", "ApparatusAnger", true, "Should taking the Apparatus anger the Bracken?"); chaseTriggerer = Diversity.config.Bind<bool>("Bracken", "ChaseTriggerer", true, "Should the Bracken chase the one who angered him?"); dressGirlRevamp = Diversity.config.Bind<bool>("Dress Girl", "DressGirlRevamp", true, "Should Dress girl revamp be enabled?"); walkieTalkieFrequency = Diversity.config.Bind<float>("Dress Girl", "WalkieTalkieFrequency", 1f, "How frequent should the Dress girl haunt the walkie-talkie?"); dressGirlIsolation = Diversity.config.Bind<bool>("Dress Girl", "DressGirlIsolation", true, "Should Dress girl be able to isolate you and give you hallucinations? (Requires DressGirlRevamp to be enabled.)"); pufferRevamp = Diversity.config.Bind<bool>("Puffer", "Puffer Revamp", true, "Should the puffer revamp be enabled?"); hydrogeneRevamp = Diversity.config.Bind<bool>("Hydregene", "Hydrogene Revamp", true, "Should the hydrogene revamp be enabled?"); interactRange = Diversity.config.Bind<float>("Player", "InteractRange", 3f, "How far can players remove centipede from their head?"); walker = Diversity.config.Bind<bool>("Walker", "Walker", true, "Should the Walker be enabled?"); walkerContactAmount = Diversity.config.Bind<int>("Walker", "Walker Contact Amount", 3, "How many contact should the walker do before sending them to the stairs?"); walkerLurkTimeMultiplier = Diversity.config.Bind<float>("Walker", "Walker Lurk Time Multiplier", 1f, "Multiplier of the time the walker lurks before chasing its target."); walkerChance = Diversity.config.Bind<int>("Walker", "Walker Spawn Weight", 10, "Spawn weight of the walker."); stairsLengthMultiplier = Diversity.config.Bind<float>("Walker", "Walker Stairs Length", 1f, "Multiplier of the stairs length."); watcher = Diversity.config.Bind<bool>("Watcher", "Watcher", true, "Should the Watcher be enabled?"); watcherWeight = Diversity.config.Bind<int>("Watcher", "Watcher Weight", 30, "Spawn weight of the Watcher."); watcherSlamMultiplier = Diversity.config.Bind<float>("Watcher", "Watcher Slam Multiplier", 1f, "Slam multiplier for the Watcher. (Capped between 1 to 2)"); speaker = Diversity.config.Bind<bool>("Speaker", "Voice lines", true, "Should the speaker voice lines be enabled?"); posters = Diversity.config.Bind<bool>("Posters", "Posters", true, "Should the posters be enabled?"); shipCutscene = Diversity.config.Bind<bool>("Cutscene", "Ship Cutscene", true, "Should the ship cutscene be enabled?"); introCutscene = Diversity.config.Bind<bool>("Cutscene", "Mysterious Intro Cutscene", false, "Should it always play when you start the game?"); menuMusic = Diversity.config.Bind<bool>("Menu", "Custom Menu Music", true, "Spooky menu music yes?"); } } public class ContentLoader { public static AssetBundle MainAssets; public static AssetBundle extraAssets; public static AssetBundle sceneAssets; public static void Load() { Diversity.mls.LogDebug((object)"Loading internal assets..."); if ((Object)(object)MainAssets == (Object)null) { MainAssets = AssetBundle.LoadFromMemory(Resources.diversity); } if ((Object)(object)extraAssets == (Object)null) { extraAssets = AssetBundle.LoadFromMemory(Resources.diversity_extra); } if ((Object)(object)sceneAssets == (Object)null) { sceneAssets = AssetBundle.LoadFromMemory(Resources.diversity_scenes); } Diversity.mls.LogDebug((object)"Internal assets loaded!"); } } public class DiversityAssets : MonoBehaviour { [Serializable] public class RandomSoundAudioClip { public DiversitySoundManager.SoundType soundType; public AudioClip[] audioClips; } [Serializable] public class SoundAudioClip { public DiversitySoundManager.SoundType soundType; public AudioClip audioClip; } public SoundAudioClip[] soundAudioClipArray; public RandomSoundAudioClip[] randomSoundAudioClipArray; public static DiversityAssets Instance { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } } public class DiversitySoundManager : NetworkBehaviour { public enum SoundType { SteamLeak, LightOn, LightBuzz, Ambience, Fracture, BrokenBone, Hurt, BrackenScream, BrackenSpeech, DressGirlSpeech, DressGirlVoices, HeartBeat, DoorSlam, WalkerFootStep, WatcherScream, WatcherScreech, WatcherScreamHit, VentBanging, VentHit, GroundSlam, Stab, BloodSplat, HumanScream, SpeakerWelcome, SpeakerTerminal, SpeakerDogs, SpeakerShutOff, SpeakerEject, SpeakerReturn, SpeakerDays, SpeakerQuota, SpeakerQuotaAgain, LowEerie, Eerie } public static GameObject oneShot; public static AudioSource oneShotAudio; public static GameObject oneShotBypass; public static AudioSource oneShotAudioBypass; public static AudioSource walkerEerie; public List<GameObject> current3Daudios = new List<GameObject>(); public List<GameObject> currentGirlAudios = new List<GameObject>(); public static DiversitySoundManager Instance { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } [ServerRpc(RequireOwnership = false)] public void SpeakerTerminalPlayOneShotSyncServerRpc(int random) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2301919732u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, random); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2301919732u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SpeakerTerminalPlayOneShotSyncClientRpc(random); } } } [ClientRpc] public void SpeakerTerminalPlayOneShotSyncClientRpc(int random) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1586849932u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, random); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1586849932u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && random != -1) { StartOfRound.Instance.speakerAudioSource.PlayOneShot(GetRandomAudioClipByTypeAndId(SoundType.SpeakerTerminal, random)); } } } public static float PlaySoundFloat(SoundType soundType, bool random, float volume, float pan, bool loop, Vector3 position) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX")[0]; GameObject val = new GameObject("Sound"); val.transform.position = position; AudioSource val2 = val.AddComponent<AudioSource>(); val2.spatialBlend = 1f; val2.playOnAwake = false; val2.dopplerLevel = 0f; val2.spread = 70f; val2.reverbZoneMix = 1f; val2.outputAudioMixerGroup = outputAudioMixerGroup; val2.loop = loop; val2.panStereo = pan; if (random) { val2.clip = GetRandomAudioClipByType(soundType); } else { val2.clip = GetAudioClipByType(soundType); } val2.rolloffMode = (AudioRolloffMode)1; if (soundType == SoundType.LightOn) { val2.maxDistance = 100f; } else if (soundType == SoundType.SteamLeak || soundType == SoundType.LightBuzz) { val2.maxDistance = 32f; } else { val2.maxDistance = 32f; } val2.volume = volume; val2.Play(); if (soundType == SoundType.DressGirlSpeech) { Instance.currentGirlAudios.Add(val); } else if (!loop) { Object.Destroy((Object)(object)val, val2.clip.length); } else { Instance.current3Daudios.Add(val); } return val2.clip.length; } public static AudioSource PlaySound(SoundType soundType, bool random, float volume, float pan, bool loop, Vector3 position, float range = 32f, float audioOffset = 0f, float destroyDelayOffset = 0f) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX")[0]; GameObject val = new GameObject("Sound"); val.transform.position = position; AudioSource val2 = val.AddComponent<AudioSource>(); val2.spatialBlend = 1f; val2.playOnAwake = false; val2.dopplerLevel = 0f; val2.spread = 70f; val2.reverbZoneMix = 1f; val2.outputAudioMixerGroup = outputAudioMixerGroup; val2.loop = loop; val2.panStereo = pan; if (random) { val2.clip = GetRandomAudioClipByType(soundType); } else { val2.clip = GetAudioClipByType(soundType); } val2.rolloffMode = (AudioRolloffMode)1; if (soundType == SoundType.LightOn) { val2.maxDistance = 100f; } else if (soundType == SoundType.SteamLeak || soundType == SoundType.LightBuzz) { val2.maxDistance = 32f; } else { val2.maxDistance = range; } val2.volume = volume; val2.time = audioOffset; val2.Play(); if (soundType == SoundType.DressGirlSpeech) { Instance.currentGirlAudios.Add(val); } else if (!loop) { float num = val2.clip.length - audioOffset + destroyDelayOffset; Diversity.mls.LogDebug((object)$"Audio destroy time: {num}"); Object.Destroy((Object)(object)val, num); } else { Instance.current3Daudios.Add(val); } return val2; } public static AudioSource PlaySound(SoundType soundType, bool random, float volume, float pan, bool loop, Vector3 position, Transform parent, float range = 32f, float audioOffset = 0f, float destroyDelayOffset = 0f) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX")[0]; GameObject val = new GameObject("Sound"); val.transform.position = position; AudioSource val2 = val.AddComponent<AudioSource>(); val2.spatialBlend = 1f; val2.playOnAwake = false; val2.dopplerLevel = 0f; val2.spread = 70f; val2.reverbZoneMix = 1f; val2.outputAudioMixerGroup = outputAudioMixerGroup; val2.loop = loop; val2.panStereo = pan; if (random) { val2.clip = GetRandomAudioClipByType(soundType); } else { val2.clip = GetAudioClipByType(soundType); } val2.rolloffMode = (AudioRolloffMode)1; if (soundType == SoundType.LightOn) { val2.maxDistance = 100f; } else if (soundType == SoundType.SteamLeak || soundType == SoundType.LightBuzz) { val2.maxDistance = 32f; } else { val2.maxDistance = range; } val2.volume = volume; val2.time = audioOffset; val2.Play(); if (soundType == SoundType.DressGirlSpeech) { Instance.currentGirlAudios.Add(val); } else if (!loop) { float num = val2.clip.length - audioOffset + destroyDelayOffset; Diversity.mls.LogDebug((object)$"Audio destroy time: {num}"); Object.Destroy((Object)(object)val, num); } else { Instance.current3Daudios.Add(val); } val.transform.SetParent(parent, true); return val2; } public static AudioSource PlaySound(SoundType soundType, bool random, float volume, float pan) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX")[0]; if ((Object)(object)oneShot == (Object)null) { oneShot = new GameObject("OneShotSound"); oneShotAudio = oneShot.AddComponent<AudioSource>(); } oneShotAudio.outputAudioMixerGroup = outputAudioMixerGroup; oneShotAudio.panStereo = pan; if (random) { oneShotAudio.PlayOneShot(GetRandomAudioClipByType(soundType), volume); } else { oneShotAudio.PlayOneShot(GetAudioClipByType(soundType), volume); } return oneShotAudio; } public static void DeleteAudio(GameObject audio) { Object.Destroy((Object)(object)audio); } public static void PlaySoundBypass(SoundType soundType, bool random, float volume, float pan, bool loop, Vector3 position, float spatialBlend = 1f) { //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) GameObject val = new GameObject("Sound"); val.transform.position = position; AudioSource val2 = val.AddComponent<AudioSource>(); val2.spatialBlend = spatialBlend; val2.playOnAwake = false; val2.dopplerLevel = 0f; val2.spread = 70f; val2.reverbZoneMix = 1f; val2.bypassListenerEffects = true; val2.loop = loop; val2.panStereo = pan; if (random) { val2.clip = GetRandomAudioClipByType(soundType); } else { val2.clip = GetAudioClipByType(soundType); } val2.rolloffMode = (AudioRolloffMode)1; if (soundType == SoundType.LightOn) { val2.maxDistance = 100f; } else if (soundType == SoundType.SteamLeak || soundType == SoundType.LightBuzz) { val2.maxDistance = 32f; } else { val2.maxDistance = 32f; } val2.volume = volume; val2.Play(); switch (soundType) { case SoundType.DressGirlSpeech: Instance.currentGirlAudios.Add(val); break; default: if (soundType != SoundType.LowEerie) { if (!loop) { Object.Destroy((Object)(object)val, val2.clip.length); } else { Instance.current3Daudios.Add(val); } break; } goto case SoundType.Eerie; case SoundType.Eerie: walkerEerie = val2; break; } } public static void PlaySoundBypass(SoundType soundType, bool random, float volume = 1f, float pan = 1f) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if ((Object)(object)oneShotBypass == (Object)null) { oneShotBypass = new GameObject("OneShotSound"); oneShotAudioBypass = oneShotBypass.AddComponent<AudioSource>(); oneShotAudioBypass.bypassListenerEffects = true; } oneShotAudioBypass.panStereo = pan; if (random) { oneShotAudioBypass.PlayOneShot(GetRandomAudioClipByType(soundType), volume); } else { oneShotAudioBypass.PlayOneShot(GetAudioClipByType(soundType), volume); } } public static void StopSound(AudioSource audioSource) { if ((Object)(object)audioSource != (Object)null) { audioSource.Stop(); } } public static void StopSound() { if ((Object)(object)oneShot != (Object)null) { oneShotAudio.Stop(); } } public static void StopSoundBypass() { if ((Object)(object)oneShot != (Object)null) { oneShotAudioBypass.Stop(); } } public static Vector3 CheckPosition(PlayerControllerB player) { //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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)player)) { if (!player.isPlayerDead) { return ((Component)player.gameplayCamera).transform.position; } return player.spectateCameraPivot.position; } return Vector3.zero; } public static AudioClip GetAudioClipByType(SoundType soundType) { Diversity.mls.LogInfo((object)DiversityAssets.Instance.soundAudioClipArray); DiversityAssets.SoundAudioClip[] soundAudioClipArray = DiversityAssets.Instance.soundAudioClipArray; foreach (DiversityAssets.SoundAudioClip soundAudioClip in soundAudioClipArray) { if (soundAudioClip.soundType == soundType) { return soundAudioClip.audioClip; } } Diversity.mls.LogError((object)("No audio of type:" + soundType)); return null; } public static AudioClip GetRandomAudioClipByType(SoundType soundType) { DiversityAssets.RandomSoundAudioClip[] randomSoundAudioClipArray = DiversityAssets.Instance.randomSoundAudioClipArray; foreach (DiversityAssets.RandomSoundAudioClip randomSoundAudioClip in randomSoundAudioClipArray) { if (randomSoundAudioClip.soundType == soundType) { return randomSoundAudioClip.audioClips[Random.Range(0, randomSoundAudioClip.audioClips.Length)]; } } Diversity.mls.LogError((object)("No audio of type:" + soundType)); return null; } public static int GetRandomAudioClipIdByType(SoundType soundType) { DiversityAssets.RandomSoundAudioClip[] randomSoundAudioClipArray = DiversityAssets.Instance.randomSoundAudioClipArray; foreach (DiversityAssets.RandomSoundAudioClip randomSoundAudioClip in randomSoundAudioClipArray) { if (randomSoundAudioClip.soundType == soundType) { return Random.Range(0, randomSoundAudioClip.audioClips.Length); } } Diversity.mls.LogError((object)("No audio of type:" + soundType)); return -1; } public static AudioClip GetRandomAudioClipByTypeAndId(SoundType soundType, int id) { DiversityAssets.RandomSoundAudioClip[] randomSoundAudioClipArray = DiversityAssets.Instance.randomSoundAudioClipArray; foreach (DiversityAssets.RandomSoundAudioClip randomSoundAudioClip in randomSoundAudioClipArray) { if (randomSoundAudioClip.soundType == soundType) { return randomSoundAudioClip.audioClips[id]; } } Diversity.mls.LogError((object)("No audio of type:" + soundType)); return null; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_DiversitySoundManager() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2301919732u, new RpcReceiveHandler(__rpc_handler_2301919732)); NetworkManager.__rpc_func_table.Add(1586849932u, new RpcReceiveHandler(__rpc_handler_1586849932)); } private static void __rpc_handler_2301919732(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int random = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref random); target.__rpc_exec_stage = (__RpcExecStage)1; ((DiversitySoundManager)(object)target).SpeakerTerminalPlayOneShotSyncServerRpc(random); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1586849932(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int random = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref random); target.__rpc_exec_stage = (__RpcExecStage)2; ((DiversitySoundManager)(object)target).SpeakerTerminalPlayOneShotSyncClientRpc(random); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "DiversitySoundManager"; } } public class DiversityItems { private static List<string> disks = new List<string>(); public static void Setup() { disks.Add("Ex-37"); disks.Add("Ex-43"); disks.Add("Ex-67"); disks.Add("Ex-507"); disks.Add("Sub-12"); disks.Add("Sub-16"); disks.Add("Sub-30"); disks.Add("Sub-66"); disks.Add("Sub-100"); disks.Add("Sub-507"); disks.Add("Never Stopping"); Diversity.mls.LogDebug((object)"Setting up the items..."); Register(); Diversity.mls.LogDebug((object)"Items are setup!"); } public static void Register() { foreach (string disk in disks) { GameNetworkManagerPatch.RegisterPrefab(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Remastered/Floppy Disks/Disks/" + disk + ".prefab")); Diversity.mls.LogDebug((object)("Registered " + disk + "!")); } } } public class Enemies { public static void Setup() { Diversity.mls.LogDebug((object)"Setting up the enemies..."); Register(); Diversity.mls.LogDebug((object)"Enemies are setup!"); } public static void Register() { if (Configuration.watcher.Value) { DiversityAIManager.RegisterEnemy(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Watcher/Watcher.prefab")); } if (Configuration.walker.Value) { GameNetworkManagerPatch.RegisterPrefab(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/walker/Prefab/Walker.prefab")); } } public static void AddComponentsToExistingPrefabs() { //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Expected O, but got Unknown foreach (NetworkPrefab prefab in NetworkManager.Singleton.NetworkConfig.Prefabs.m_Prefabs) { switch (((Object)prefab.Prefab).name) { case "Flowerman": if (Configuration.brakenRevamp.Value) { prefab.Prefab.AddComponent<BrakenRevamp>(); } break; case "Crawler": if (Configuration.crawlerRevamp.Value) { prefab.Prefab.AddComponent<CrawlerRevamp>(); } break; case "SandSpider": if (Configuration.spiderRevamp.Value) { prefab.Prefab.AddComponent<SpiderRevamp>(); } break; case "Centipede": if (Configuration.centipedeRevamp.Value) { prefab.Prefab.AddComponent<CentipedeRevamp>(); } break; case "DressGirl": if (Configuration.dressGirlRevamp.Value) { prefab.Prefab.AddComponent<DressGirlRevamp>(); } break; case "Blob": { if (!Configuration.hydrogeneRevamp.Value) { break; } PullObjects pull = prefab.Prefab.AddComponent<PullObjects>(); foreach (Transform item in prefab.Prefab.transform.Find("Armature")) { Transform val = item; BlobRevamp component = ((Component)val).gameObject.GetComponent<BlobRevamp>(); if (!Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)((Component)val).gameObject.GetComponent<BoxCollider>())) { component = ((Component)val).gameObject.AddComponent<BlobRevamp>(); component.pull = pull; } } break; } case "Teleporter": prefab.Prefab.AddComponent<ShipTeleporterRevamp>(); break; } } } } public static class DiversityManager { public static bool gameStarted = false; public static bool playersHidden = false; public static InteractTrigger it; public static GameObject walkerDoor; public static GameObject walkerDoor2; public static GameObject door; public static FloppyDisk brackenFloppyDisk = null; public static FloppyDisk walkerFloppyDisk = null; public static FloppyDisk mapDisk = null; private static List<string> disks = new List<string>(); public static GameObject deadResearcher = null; public static List<GameObject> brackenRoomTiles = new List<GameObject>(); public static GameObject stairs; public static List<GameObject> currentLayout = new List<GameObject>(); public static List<GameObject> currentEffects = new List<GameObject>(); public static int hallwayLength = 20; public static List<Animator> brackenLights = new List<Animator>(); public static List<Animator> affectedLights = new List<Animator>(); public static List<RadarBoosterItem> radarBoosters = new List<RadarBoosterItem>(); public static int angerMax = 0; public static List<MouthDogAI> currentDogs = new List<MouthDogAI>(); public static List<PullObjects> currentBlobs = new List<PullObjects>(); public static List<GameObject> steamSounds = new List<GameObject>(); public static List<GameObject> lightBuzz = new List<GameObject>(); public static GameObject braken; public static BrackenV2 brakenV2; public static AudioSource ambience; public static bool speakerDisabled = false; public static bool dogsLinePLayed = false; public static bool played = false; public static GameObject startTile; public static AudioSource mazeAudio; public static StairsManager manager; public static GameObject testPrefab = ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/test.prefab"); public static GameObject start = ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/start.prefab"); public static GameObject end = ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/end.prefab"); public static GameObject stairsPrefab = ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Stairs/stairs.prefab"); public static TextMeshProUGUI tipText; public static Image holderBar; public static Image clickBar; private static readonly string text = "Free from head : [E]"; private static readonly Color color = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue)); public static Volume haunted; public static Volume black; public static CustomPassVolume pass; public static FullScreenCustomPass fullscreenPass; public static FullScreenCustomPass fullscreenPass2; public static FullScreenCustomPass cameraFSPass; public static FullScreenCustomPass eyeFSPass; public static FullScreenCustomPass walkerFSPass; public static float hauntedIntensity = 0f; public static float sinkingIntensity = 0f; public static float closedIntensity = 0f; public static float shakeIntensity = 0f; public static float staticIntensity = 0f; public static bool blinking = false; public static float blinkingTime = 0f; private static void ResetEverything() { gameStarted = false; playersHidden = false; it = null; walkerDoor = null; walkerDoor2 = null; door = null; brackenFloppyDisk = null; walkerFloppyDisk = null; mapDisk = null; disks = new List<string>(); deadResearcher = null; stairs = null; currentLayout = new List<GameObject>(); currentEffects = new List<GameObject>(); brackenLights = new List<Animator>(); affectedLights = new List<Animator>(); radarBoosters = new List<RadarBoosterItem>(); angerMax = 0; currentDogs = new List<MouthDogAI>(); currentBlobs = new List<PullObjects>(); steamSounds = new List<GameObject>(); lightBuzz = new List<GameObject>(); braken = null; brakenV2 = null; ambience = null; speakerDisabled = false; dogsLinePLayed = false; played = false; startTile = null; mazeAudio = null; manager = null; tipText = null; holderBar = null; clickBar = null; haunted = null; black = null; pass = null; fullscreenPass = null; fullscreenPass2 = null; cameraFSPass = null; eyeFSPass = null; walkerFSPass = null; hauntedIntensity = 0f; sinkingIntensity = 0f; closedIntensity = 0f; shakeIntensity = 0f; staticIntensity = 0f; blinking = false; blinkingTime = 0f; } public static void Update() { if ((Object)(object)brackenFloppyDisk != (Object)null && (((GrabbableObject)brackenFloppyDisk).isPocketed || (Object)(object)((GrabbableObject)brackenFloppyDisk).playerHeldBy != (Object)null)) { brackenFloppyDisk = null; } if ((Object)(object)walkerFloppyDisk != (Object)null && (((GrabbableObject)walkerFloppyDisk).isPocketed || (Object)(object)((GrabbableObject)walkerFloppyDisk).playerHeldBy != (Object)null)) { walkerFloppyDisk = null; } if ((Object)(object)mapDisk != (Object)null && (((GrabbableObject)mapDisk).isPocketed || (Object)(object)((GrabbableObject)mapDisk).playerHeldBy != (Object)null)) { mapDisk = null; } if (!playersHidden) { } } public static void SaveGameData() { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) FloppyDisk[] array = Object.FindObjectsOfType<FloppyDisk>(); foreach (FloppyDisk floppyDisk in array) { string diskName = ((Object)((Component)floppyDisk).gameObject).name.Replace("(Clone)", ""); if (disks.Any((string x) => x == diskName)) { Diversity.mls.LogDebug((object)("Saving disk: " + ((Object)((Component)floppyDisk).gameObject).name.Replace("(Clone)", ""))); ES3.Save<string>(diskName, diskName, GameNetworkManager.Instance.currentSaveFileName); Diversity.mls.LogDebug((object)"Disk name saved"); ES3.Save<Vector3>(diskName + "Position", ((Component)floppyDisk).gameObject.transform.position, GameNetworkManager.Instance.currentSaveFileName); Diversity.mls.LogDebug((object)"Disk position saved"); } else { Diversity.mls.LogDebug((object)("Skipping unsupported disk : " + diskName)); } } foreach (string item in disks.Where((string x) => !Object.FindObjectsOfType<FloppyDisk>().Any((FloppyDisk y) => ((Object)((Component)y).gameObject).name.Replace("(Clone)", "") == x))) { Diversity.mls.LogDebug((object)("Checking if " + item + " has saved data... (Save)")); Diversity.mls.LogDebug((object)(item + " exist? : " + ES3.KeyExists(item, GameNetworkManager.Instance.currentSaveFileName))); if (ES3.KeyExists(item, GameNetworkManager.Instance.currentSaveFileName)) { Diversity.mls.LogDebug((object)("Deleting data of " + item + " since it hasn't been found in game!")); ES3.DeleteKey(item, GameNetworkManager.Instance.currentSaveFileName); } if (ES3.KeyExists(item + "Position", GameNetworkManager.Instance.currentSaveFileName)) { ES3.DeleteKey(item + "Position", GameNetworkManager.Instance.currentSaveFileName); } } FloppyReader floppyReader = Object.FindObjectOfType<FloppyReader>(); if (Object.op_Implicit((Object)(object)floppyReader)) { AutoParentToShip componentInChildren = ((Component)((Component)floppyReader).transform.parent).gameObject.GetComponentInChildren<AutoParentToShip>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { Diversity.mls.LogDebug((object)"Saving Floppy Reader data..."); ES3.Save<Vector3>("FloppyReaderPosition", componentInChildren.positionOffset, GameNetworkManager.Instance.currentSaveFileName); ES3.Save<Vector3>("FloppyReaderRotation", componentInChildren.rotationOffset, GameNetworkManager.Instance.currentSaveFileName); ES3.Save<List<DiskType>>("FloppyReaderData", floppyReader.dataLoaded, GameNetworkManager.Instance.currentSaveFileName); Diversity.mls.LogDebug((object)"Saved Floppy Reader data..."); } } } public static void LoadGameData() { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) foreach (string disk in disks) { Diversity.mls.LogDebug((object)("Checking if " + disk + " has saved data... (Load)")); Diversity.mls.LogDebug((object)(disk + " exist? : " + ES3.KeyExists(disk, GameNetworkManager.Instance.currentSaveFileName))); if (ES3.KeyExists(disk, GameNetworkManager.Instance.currentSaveFileName)) { Diversity.mls.LogDebug((object)("Loading disk: " + disk)); string text = ES3.Load<string>(disk, GameNetworkManager.Instance.currentSaveFileName); Vector3 val = ES3.Load<Vector3>(disk + "Position", GameNetworkManager.Instance.currentSaveFileName); ManualLogSource mls = Diversity.mls; Vector3 val2 = val; mls.LogDebug((object)(text + " disk loaded at position: " + ((object)(Vector3)(ref val2)).ToString())); if (NetworkManager.Singleton.IsHost) { SpawnDisk(text, val); } } } if (ES3.KeyExists("FloppyReaderPosition", GameNetworkManager.Instance.currentSaveFileName) && ES3.KeyExists("FloppyReaderRotation", GameNetworkManager.Instance.currentSaveFileName) && ES3.KeyExists("FloppyReaderData", GameNetworkManager.Instance.currentSaveFileName)) { ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(WaitForFloppyReaderAndSetup(ES3.Load<Vector3>("FloppyReaderPosition", GameNetworkManager.Instance.currentSaveFileName), ES3.Load<Vector3>("FloppyReaderRotation", GameNetworkManager.Instance.currentSaveFileName), ES3.Load<List<DiskType>>("FloppyReaderData", GameNetworkManager.Instance.currentSaveFileName))); } } public static IEnumerator WaitForFloppyReaderAndSetup(Vector3 pos, Vector3 rot, List<DiskType> data) { //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_000e: 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) yield return (object)new WaitUntil((Func<bool>)(() => Object.op_Implicit((Object)(object)Object.FindObjectOfType<FloppyReader>()))); FloppyReader fR = Object.FindObjectOfType<FloppyReader>(); AutoParentToShip APTS = ((Component)((Component)fR).transform.parent).gameObject.GetComponentInChildren<AutoParentToShip>(); if (Object.op_Implicit((Object)(object)APTS)) { Diversity.mls.LogDebug((object)"Loading Floppy Reader data..."); APTS.positionOffset = pos; APTS.rotationOffset = rot; fR.dataLoaded = data; Diversity.mls.LogDebug((object)"Loaded Floppy Reader data..."); } } public static void SetupRound() { //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) if (gameStarted) { return; } gameStarted = true; Diversity.mls.LogDebug((object)"Setting up the round!"); RefreshData(); Random.InitState(StartOfRound.Instance.randomMapSeed); angerMax = Random.Range(1, 4); Diversity.mls.LogDebug((object)("Setting up max anger to: " + angerMax)); Diversity.mls.LogDebug((object)"Choosing a random door!"); DoorLock[] array = (from x in Object.FindObjectsOfType<DoorLock>() where ((Object)((Component)x).gameObject).name == "Cube" && ((Object)((Component)((Component)x).transform.parent.parent).gameObject).name.Contains("SteelDoor") select x).ToArray(); Diversity.mls.LogDebug((object)array.Length); if (array.Length != 0) { Random.InitState(StartOfRound.Instance.randomMapSeed); DoorLock val = array[Random.Range(0, array.Length)]; door = ((Component)((Component)val).transform.parent.parent).gameObject; walkerDoor = Object.Instantiate<GameObject>(ContentLoader.extraAssets.LoadAsset<GameObject>("Assets/custom/diversity/extras/prefabs/Walker Door.prefab"), ((Component)val).transform.parent.parent.parent); it = ((Component)val).GetComponent<InteractTrigger>(); it.hoverTip = "Use door : [LMB]\nThis door looks odd..."; it.disabledHoverTip = "Locked\nThis door looks odd..."; walkerDoor.SetActive(false); ((Renderer)((Component)((Component)val).transform.parent).GetComponent<MeshRenderer>()).materials[0].SetTexture("_MaskMap", (Texture)(object)ContentLoader.extraAssets.LoadAsset<Texture2D>("Assets/custom/diversity/extras/textures/Grunge4.png")); Diversity.mls.LogDebug((object)"Walker door is set up!"); } EnemyVent[] array2 = Object.FindObjectsOfType<EnemyVent>(); if (array2.Length < 1) { return; } EnemyVent[] array3 = array2; foreach (EnemyVent val2 in array3) { Transform val3 = ((Component)val2).transform.Find("Hinge/VentCover"); if ((Object)(object)val3 == (Object)null) { return; } val3.localScale = new Vector3(0f - val3.localScale.x, val3.localScale.y, val3.localScale.z); } if (NetworkManager.Singleton.IsHost) { ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(WaitForEveryoneGeneratingRooms()); switch (StartOfRound.Instance.currentLevel.PlanetName) { case "41 Experimentation": mapDisk = SpawnDisk("Ex-67", new Vector3(-66.1824f, 15.827f, 23.234f)); break; case "7 Dine": mapDisk = SpawnDisk("Ex-37", new Vector3(41.117f, -2.091f, 65.225f)); break; case "20 Adamance": mapDisk = SpawnDisk("Ex-507", new Vector3(-64.035f, -16.645f, 28.683f)); break; case "56 Vow": mapDisk = SpawnDisk("Ex-43", new Vector3(-121.135f, -1.419f, 133.079f)); break; case "68 Artifice": mapDisk = SpawnDisk("Sub-507", new Vector3(-0.44f, -3.715f, -90.972f)); break; } } switch (StartOfRound.Instance.currentLevel.PlanetName) { case "41 Experimentation": deadResearcher = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Remastered/Researcher/Researcher Experimentation.prefab")); deadResearcher.transform.position = new Vector3(-66.224f, 16.119f, 23.976f); break; case "7 Dine": deadResearcher = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Remastered/Researcher/Researcher Dine.prefab")); deadResearcher.transform.position = new Vector3(38.5351f, -1.0278304f, 63.148476f); break; case "20 Adamance": deadResearcher = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Remastered/Researcher/Researcher Adamance.prefab")); deadResearcher.transform.position = new Vector3(-57.559856f, -16.093561f, 25.392748f); break; case "56 Vow": deadResearcher = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Remastered/DeadBodyThingIdk.prefab")); deadResearcher.transform.position = new Vector3(-120.842285f, -1.376f, 131.63667f); break; } } public static IEnumerator WaitForEveryoneGeneratingRooms() { if (Configuration.brakenRevamp.Value && Configuration.brakenSpace.Value) { yield return (object)new WaitUntil((Func<bool>)(() => StartOfRoundRevamp.PlayersFinishedGeneratingBrackenRoom.Count >= GameNetworkManager.Instance.connectedPlayers)); } if (Configuration.walker.Value) { yield return (object)new WaitUntil((Func<bool>)(() => StartOfRoundRevamp.PlayersFinishedGeneratingMaze.Count >= GameNetworkManager.Instance.connectedPlayers)); } SpawnDisks(); } private static void SpawnDisks() { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) Diversity.mls.LogDebug((object)"Spawning the disks!"); if (Configuration.brakenRevamp.Value && Configuration.brakenSpace.Value && (from x in Object.FindObjectsOfType<FloppyDisk>() where ((Object)((Component)x).gameObject).name.Contains("Sub-16") select x).ToArray().Length == 0) { brackenFloppyDisk = SpawnDisk("Sub-16", currentLayout.Where((GameObject x) => ((Object)x).name.Contains("end")).ToArray()[0].transform.Find("DiskSpawn").position); } if (Configuration.walker.Value) { walkerFloppyDisk = SpawnDisk("Sub-66", walkerDoor2.transform.position - walkerDoor2.transform.forward); } } public static FloppyDisk SpawnDisk(string diskName, Vector3 position, bool insideShip = false, bool localPos = false) { //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) string diskName2 = diskName; if (!NetworkManager.Singleton.IsHost) { Diversity.mls.LogWarning((object)"Only the host can spawn disks!"); return null; } if (disks.Any((string x) => x == diskName2)) { if ((from x in Object.FindObjectsOfType<FloppyDisk>() where ((Object)((Component)x).gameObject).name.Contains(diskName2) select x).ToArray().Length == 0) { Diversity.mls.LogDebug((object)"Spawning the disks!"); GameObject val = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Remastered/Floppy Disks/Disks/" + diskName2 + ".prefab"), ((Component)StartOfRound.Instance.shipAnimator).gameObject.transform); if (insideShip) { val.transform.SetParent(((Component)StartOfRound.Instance.shipAnimator).gameObject.transform); } if (localPos) { val.transform.localPosition = position; } else { val.transform.position = position; } val.transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); NetworkObject componentInChildren = val.GetComponentInChildren<NetworkObject>(); if (!componentInChildren.IsSpawned) { componentInChildren.Spawn(false); } Diversity.mls.LogDebug((object)(diskName2 + " disk is spawned!")); return val.GetComponentInChildren<FloppyDisk>(); } Diversity.mls.LogDebug((object)(diskName2 + " is already spawned!")); return null; } Diversity.mls.LogDebug((object)(diskName2 + " doesn't exist!")); return null; } public static void RefreshData() { brackenLights = RoundManager.Instance.allPoweredLightsAnimators; DiversityAIManager.Instance.valves = Object.FindObjectsOfType<SteamValveHazard>().ToList(); } public static void ResetRound() { if (!gameStarted) { return; } gameStarted = false; Diversity.mls.LogDebug((object)"Resseting the round!"); if (((NetworkBehaviour)DiversityAIManager.Instance).IsHost) { DiversityAIManager.Instance.ClearEnemies(); } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null) { PlayerRevamp component = ((Component)val).gameObject.GetComponent<PlayerRevamp>(); if (!Object.op_Implicit((Object)(object)component)) { return; } component.ResetPlayer(); DiversitySoundManager.Instance.current3Daudios = new List<GameObject>(); brackenLights = new List<Animator>(); affectedLights = new List<Animator>(); steamSounds = new List<GameObject>(); lightBuzz = new List<GameObject>(); currentDogs = new List<MouthDogAI>(); currentBlobs = new List<PullObjects>(); DiversityAIManager.Instance.lights = new List<Light>(); DiversityAIManager.Instance.valves = new List<SteamValveHazard>(); } } ResetStairsAndBrackenRoom(); DiversityDungeonGen.Instance.DeleteCurrentDungeon(); StartOfRoundRevamp.Instance.ClearGenerationData(); if (NetworkManager.Singleton.IsHost) { if ((Object)(object)brackenFloppyDisk != (Object)null) { ((Component)brackenFloppyDisk).gameObject.GetComponentInChildren<NetworkObject>().Despawn(true); brackenFloppyDisk = null; } if ((Object)(object)walkerFloppyDisk != (Object)null) { ((Component)walkerFloppyDisk).gameObject.GetComponentInChildren<NetworkObject>().Despawn(true); walkerFloppyDisk = null; } if ((Object)(object)mapDisk != (Object)null) { ((Component)mapDisk).gameObject.GetComponentInChildren<NetworkObject>().Despawn(true); mapDisk = null; } } else { if ((Object)(object)brackenFloppyDisk != (Object)null) { brackenFloppyDisk = null; } if ((Object)(object)walkerFloppyDisk != (Object)null) { walkerFloppyDisk = null; } if ((Object)(object)mapDisk != (Object)null) { mapDisk = null; } } if ((Object)(object)deadResearcher != (Object)null) { Object.Destroy((Object)(object)deadResearcher); deadResearcher = null; } } public static void ResetUnlockables() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) foreach (UnlockableItem item in Unlockables.RegisteredItems) { AutoParentToShip parentObject = (from x in Object.FindObjectsOfType<PlaceableShipObject>() where x.unlockableID == StartOfRound.Instance.unlockablesList.unlockables.FindIndex((UnlockableItem x) => x.unlockableName == item.unlockableName) select x).ToArray()[0].parentObject; string unlockableName = item.unlockableName; string text = unlockableName; if (text == "Floppy Reader") { parentObject.positionOffset = new Vector3(-1.27f, -0.032f, -5f); parentObject.rotationOffset = new Vector3(0f, 180f, 0f); } } } public static void SetupGame() { //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Expected O, but got Unknown //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Expected O, but got Unknown //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_0652: Unknown result type (might be due to invalid IL or missing references) //IL_0662: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Expected O, but got Unknown //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Unknown result type (might be due to invalid IL or missing references) //IL_070d: Unknown result type (might be due to invalid IL or missing references) //IL_0714: Expected O, but got Unknown //IL_0769: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Unknown result type (might be due to invalid IL or missing references) //IL_077d: Unknown result type (might be due to invalid IL or missing references) //IL_0798: Unknown result type (might be due to invalid IL or missing references) //IL_07f0: Unknown result type (might be due to invalid IL or missing references) //IL_08f8: Unknown result type (might be due to invalid IL or missing references) //IL_08fd: Unknown result type (might be due to invalid IL or missing references) //IL_0905: Unknown result type (might be due to invalid IL or missing references) //IL_090d: Unknown result type (might be due to invalid IL or missing references) //IL_091b: Expected O, but got Unknown //IL_092f: Unknown result type (might be due to invalid IL or missing references) //IL_0934: Unknown result type (might be due to invalid IL or missing references) //IL_093e: Expected O, but got Unknown //IL_0952: Unknown result type (might be due to invalid IL or missing references) //IL_0957: Unknown result type (might be due to invalid IL or missing references) //IL_095f: Unknown result type (might be due to invalid IL or missing references) //IL_096d: Expected O, but got Unknown //IL_0981: Unknown result type (might be due to invalid IL or missing references) //IL_0986: Unknown result type (might be due to invalid IL or missing references) //IL_098e: Unknown result type (might be due to invalid IL or missing references) //IL_099c: Expected O, but got Unknown //IL_09b0: Unknown result type (might be due to invalid IL or missing references) //IL_09b5: Unknown result type (might be due to invalid IL or missing references) //IL_09bd: Unknown result type (might be due to invalid IL or missing references) //IL_09c5: Unknown result type (might be due to invalid IL or missing references) //IL_09d3: Expected O, but got Unknown //IL_0a71: Unknown result type (might be due to invalid IL or missing references) ResetEverything(); disks.Add("Ex-37"); disks.Add("Ex-43"); disks.Add("Ex-67"); disks.Add("Ex-507"); disks.Add("Sub-12"); disks.Add("Sub-16"); disks.Add("Sub-30"); disks.Add("Sub-66"); disks.Add("Sub-100"); disks.Add("Sub-507"); disks.Add("Never Stopping"); if (NetworkManager.Singleton.IsHost) { LoadGameData(); } EnemyType longBoiType = ContentLoader.MainAssets.LoadAsset<EnemyType>("Assets/custom/diversity/walker/WalkerType.asset"); DiversityEnemy enemy = ContentLoader.MainAssets.LoadAsset<DiversityEnemy>("Assets/custom/diversity/Watcher/Watcher.asset"); if (Configuration.walker.Value) { SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { try { if (val.Enemies.All((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType != (Object)(object)longBoiType)) { val.Enemies.Add(new SpawnableEnemyWithRarity { enemyType = longBoiType, rarity = Mathf.Clamp(Configuration.walkerChance.Value, 0, 100) }); Diversity.mls.LogInfo((object)$"Added {longBoiType.enemyName} to {val.PlanetName} with chance of {Mathf.Clamp(Configuration.walkerChance.Value, 0, 100)} (inside)"); } } catch (Exception arg) { Diversity.mls.LogError((object)$"Failed to add enemy to {val.PlanetName}!\n{arg}"); } } } SelectableLevel[] levels2 = StartOfRound.Instance.levels; foreach (SelectableLevel level in levels2) { if (Configuration.watcher.Value) { DiversityAIManager.AddEnemyToLevel(enemy, level, Configuration.watcherWeight.Value); } } if (Configuration.posters.Value) { GameObject val2 = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Ship/Poster.prefab"), ((Component)StartOfRound.Instance.shipAnimator).gameObject.transform); GameObject val3 = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Ship/Poster2.prefab"), ((Component)StartOfRound.Instance.shipAnimator).gameObject.transform); GameObject val4 = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Ship/Poster3.prefab"), ((Component)Object.FindObjectOfType<Terminal>()).transform.parent.parent); GameObject val5 = Object.Instantiate<GameObject>(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Ship/Poster4.prefab"), ((Component)StartOfRound.Instance.shipAnimator).gameObject.transform); val2.transform.localPosition = new Vector3(6.127f, 2.522f, -3.3222f); val2.transform.localRotation = Quaternion.Euler(94f, -90f, 90f); val2.transform.localScale = new Vector3(0.07532914f, 0.09989319f, 0.09989319f); val3.transform.localPosition = new Vector3(2.913536f, 2.375659f, -3.998f); val3.transform.localRotation = Quaternion.Euler(-267.82f, 67.851f, -90f); val3.transform.localScale = new Vector3(0.07f, 0.09282628f, 0.09282628f); val4.transform.localPosition = new Vector3(-0.5234725f, -0.5695019f, 1.313852f); val4.transform.localRotation = Quaternion.Euler(187.403f, -11.59302f, 90f); val4.transform.localScale = new Vector3(0.05222219f, 0.07079603f, 0.06852487f); val5.transform.localPosition = new Vector3(3.571537f, 2.2985616f, -9.593f); val5.transform.localRotation = Quaternion.Euler(82.973f, -70.838f, -92.301f); val5.transform.localScale = new Vector3(0.05f, 0.06630448f, 0.06630449f); ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(WaitForWiderShip(val2, val3, val5)); } if (Configuration.brakenSpace.Value) { GameObject gameObject = ((Component)((Component)StartOfRound.Instance.mapScreenPlayerName).gameObject.transform.parent).gameObject; GameObject val6 = new GameObject("ErrorText"); val6.layer = 14; val6.AddComponent<RectTransform>(); val6.AddComponent<CanvasRenderer>(); TextMeshProUGUI val7 = val6.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val7).font = ((TMP_Text)HUDManager.Instance.controlTipLines[0]).font; ((TMP_Text)val7).fontSize = 17f; ((TMP_Text)val7).alignment = (TextAlignmentOptions)514; ((TMP_Text)val7).overflowMode = (TextOverflowModes)0; ((TMP_Text)val7).text = "THEY ARE PAYING\nTHE PRICE"; ((Graphic)val7).color = Color.red; ((Behaviour)val7).enabled = true; val6.transform.SetParent(gameObject.transform); val6.transform.localPosition = Vector3.zero; val6.transform.localScale = new Vector3(2f, 2f, 2f); val6.transform.localRotation = Quaternion.identity; val6.SetActive(false); } if (Configuration.speaker.Value) { SetSpeakerLines(); } GameObject val8 = new GameObject("InteractText"); val8.AddComponent<RectTransform>(); TextMeshProUGUI val9 = val8.AddComponent<TextMeshProUGUI>(); RectTransform rectTransform = ((TMP_Text)val9).rectTransform; ((Transform)rectTransform).SetParent(((TMP_Text)HUDManager.Instance.signalTranslatorText).transform, false); Rect rect = rectTransform.rect; rectTransform.anchoredPosition = new Vector2((0f - ((Rect)(ref rect)).width) / 4f + 5f, -40f); GameObject val10 = new GameObject("InteractBarHolder"); val10.AddComponent<RectTransform>(); Image val11 = val10.AddComponent<Image>(); val11.sprite = ContentLoader.MainAssets.LoadAsset<Sprite>("Assets/custom/diversity/hud/holder.png"); RectTransform component = ((Component)val11).GetComponent<RectTransform>(); ((Transform)component).SetParent(((TMP_Text)HUDManager.Instance.signalTranslatorText).transform, false); component.sizeDelta = new Vector2(133.33333f, 20f); rect = rectTransform.rect; component.anchoredPosition = new Vector2((0f - ((Rect)(ref rect)).width) / 4f + 5f, -70f); ((Behaviour)val11).enabled = false; holderBar = val11; GameObject val12 = new GameObject("InteractBarHolder"); val12.AddComponent<RectTransform>(); Image val13 = val12.AddComponent<Image>(); val13.sprite = ContentLoader.MainAssets.LoadAsset<Sprite>("Assets/custom/diversity/hud/bar.png"); RectTransform component2 = ((Component)val13).GetComponent<RectTransform>(); ((Transform)component2).SetParent(((TMP_Text)HUDManager.Instance.signalTranslatorText).transform, false); component2.sizeDelta = new Vector2(133.33333f, 20f); rect = rectTransform.rect; component2.anchoredPosition = new Vector2((0f - ((Rect)(ref rect)).width) / 4f + 5f, -70f); ((Behaviour)val13).enabled = false; clickBar = val13; ((TMP_Text)val9).alignment = (TextAlignmentOptions)514; ((TMP_Text)val9).font = ((TMP_Text)HUDManager.Instance.controlTipLines[0]).font; ((TMP_Text)val9).fontSize = 16f; ((TMP_Text)val9).text = text; ((Graphic)val9).color = color; ((TMP_Text)val9).overflowMode = (TextOverflowModes)0; ((Behaviour)val9).enabled = false; tipText = val9; haunted = ((Component)HUDManager.Instance).gameObject.AddComponent<Volume>(); haunted.profile = ContentLoader.MainAssets.LoadAsset<VolumeProfile>("Assets/custom/diversity/volumes/haunted.asset"); haunted.isGlobal = true; haunted.weight = 0f; haunted.sharedProfile = ContentLoader.MainAssets.LoadAsset<VolumeProfile>("Assets/custom/diversity/volumes/haunted.asset"); black = ((Component)HUDManager.Instance).gameObject.AddComponent<Volume>(); black.profile = ContentLoader.MainAssets.LoadAsset<VolumeProfile>("Assets/custom/diversity/volumes/black.asset"); black.isGlobal = true; black.weight = 0f; black.sharedProfile = ContentLoader.MainAssets.LoadAsset<VolumeProfile>("Assets/custom/diversity/volumes/black.asset"); if (CustomPostProcessingManager.Initialized) { PostProcess val14 = new PostProcess("WalkerPass", ContentLoader.extraAssets.LoadAsset<Material>("Assets/custom/diversity/extras/materials/WalkerStains.mat")) { InjectionType = (InjectionType)6, Enabled = false, Priority = -0.05f }; PostProcess val15 = new PostProcess("GlitchPass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/glitchPass.mat")) { InjectionType = (InjectionType)6 }; PostProcess val16 = new PostProcess("VignettePass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/Vignette.mat")) { InjectionType = (InjectionType)6, Priority = -0.2f }; PostProcess val17 = new PostProcess("EyePass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/EyesClose.mat")) { InjectionType = (InjectionType)6, Priority = -0.3f }; PostProcess val18 = new PostProcess("CameraPass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/Camera.mat")) { InjectionType = (InjectionType)6, Enabled = false, Priority = -0.1f }; fullscreenPass2 = CustomPostProcessingManager.Instance.AddPostProcess(val15); fullscreenPass = CustomPostProcessingManager.Instance.AddPostProcess(val16); eyeFSPass = CustomPostProcessingManager.Instance.AddPostProcess(val17); cameraFSPass = CustomPostProcessingManager.Instance.AddPostProcess(val18); walkerFSPass = CustomPostProcessingManager.Instance.AddPostProcess(val14); } else { CustomPostProcessingManager.OnLoad += Cpp_OnLoad; } if (!ES3.KeyExists("Never Stopping", GameNetworkManager.Instance.currentSaveFileName)) { SpawnDisk("Never Stopping", new Vector3(8.4f, 1.162f, -5.35f), insideShip: true, localPos: true); } } private static IEnumerator WaitForWiderShip(GameObject poster, GameObject poster2, GameObject poster4) { Diversity.mls.LogDebug((object)"Checking for WiderShip!"); float time = Time.realtimeSinceStartup + 15f; yield return (object)new WaitUntil((Func<bool>)(() => Object.op_Implicit((Object)(object)GameObject.Find("ShipInsideBoth")) || Object.op_Implicit((Object)(object)GameObject.Find("MelanieShip")) || Time.realtimeSinceStartup >= time)); if ((Object)(object)GameObject.Find("ShipInsideBoth") != (Object)null) { Diversity.mls.LogDebug((object)"WiderShip Detected!"); if (GameObject.Find("ShipInsideBoth").activeSelf) { Diversity.mls.LogDebug((object)"WiderShip is active!"); poster.transform.localPosition = new Vector3(-6.648f, 2.49f, -9.916f); poster.transform.localRotation = Quaternion.Euler(new Vector3(86.00002f, 0.0001223932f, 269.99994f)); poster2.transform.localPosition = new Vector3(3.075f, 2.321f, -0.585f); poster2.transform.localRotation = Quaternion.Euler(new Vector3(89.68973f, 291.33038f, 49.73238f)); poster4.transform.localPosition = new Vector3(1.139f, 2.628f, -14.1272f); poster4.transform.localRotation = Quaternion.Euler(new Vector3(82.978645f, 269.57513f, 847f / MathF.PI)); } } else if ((Object)(object)GameObject.Find("MelanieShip") != (Object)null) { Diversity.mls.LogDebug((object)"MelanieShip Detected!"); if (GameObject.Find("MelanieShip").activeSelf && FindInActiveObjectsByName("ShipInsideBoth").Length != 0) { Diversity.mls.LogDebug((object)"MelanieShip is active!"); poster.transform.localPosition = new Vector3(8.372f, 2.289f, 1.676f); poster.transform.localRotation = Quaternion.Euler(new Vector3(86.00008f, 90f, 270f)); poster2.transform.localPosition = new Vector3(1.77f, 2.25f, 0.762f); poster2.transform.localRotation = Quaternion.Euler(new Vector3(87.82013f, 269.99997f, 90.00099f)); poster4.transform.localPosition = new Vector3(5.908f, 2.306f, -14.975f); poster4.transform.localRotation = Quaternion.Euler(new Vector3(82.97306f, 267.74652f, 267.6991f)); } else if (GameObject.Find("MelanieShip").activeSelf) { poster.transform.localPosition = new Vector3(1.546f, 2.522f, -4.226f); poster.transform.localRotation = Quaternion.Euler(new Vector3(86.00008f, 90f, 270f)); poster2.transform.localPosition = new Vector3(2.098f, 2.375659f, -2.237f); poster2.transform.localRotation = Quaternion.Euler(new Vector3(87.82013f, 270f, 90f)); } } } private static GameObject[] FindInActiveObjectsByName(string name) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 List<GameObject> list = new List<GameObject>(); Transform[] array = Resources.FindObjectsOfTypeAll<Transform>(); for (int i = 0; i < array.Length; i++) { if ((int)((Object)array[i]).hideFlags == 0 && ((Object)((Component)array[i]).gameObject).name == name) { list.Add(((Component)array[i]).gameObject); } } return list.ToArray(); } private static void Cpp_OnLoad(object sender, EventArgs e) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00c9: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown PostProcess val = new PostProcess("WalkerPass", ContentLoader.extraAssets.LoadAsset<Material>("Assets/custom/diversity/extras/materials/WalkerStains.mat")) { InjectionType = (InjectionType)6, Enabled = false, Priority = -0.05f }; PostProcess val2 = new PostProcess("GlitchPass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/glitchPass.mat")) { InjectionType = (InjectionType)6 }; PostProcess val3 = new PostProcess("VignettePass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/Vignette.mat")) { InjectionType = (InjectionType)6, Priority = -0.2f }; PostProcess val4 = new PostProcess("EyePass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/EyesClose.mat")) { InjectionType = (InjectionType)6, Priority = -0.3f }; PostProcess val5 = new PostProcess("CameraPass", ContentLoader.MainAssets.LoadAsset<Material>("Assets/custom/diversity/volumes/Camera.mat")) { InjectionType = (InjectionType)6, Enabled = false, Priority = -0.1f }; fullscreenPass2 = CustomPostProcessingManager.Instance.AddPostProcess(val2); fullscreenPass = CustomPostProcessingManager.Instance.AddPostProcess(val3); eyeFSPass = CustomPostProcessingManager.Instance.AddPostProcess(val4); cameraFSPass = CustomPostProcessingManager.Instance.AddPostProcess(val5); walkerFSPass = CustomPostProcessingManager.Instance.AddPostProcess(val); CustomPostProcessingManager.OnLoad -= Cpp_OnLoad; } public static void SetupAssets() { brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall1.prefab")); brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall2.prefab")); brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall3.prefab")); brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall4.prefab")); brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall5.prefab")); brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall6.prefab")); brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall7.prefab")); brackenRoomTiles.Add(ContentLoader.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/bracken/rooms/prefabs/hall8.prefab")); } public static void ToggleWalkerDoor(bool state) { ((Behaviour)it).enabled = !state; door.SetActive(!state); walkerDoor.SetActive(state); } public static void DisableSpeaker(AudioSource audio) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (audio.isPlaying && Configuration.speaker.Value && !speakerDisabled) { speakerDisabled = true; if (!played) { float time = DiversitySoundManager.PlaySoundFloat(DiversitySoundManager.SoundType.SpeakerShutOff, random: true, audio.volume, 1f, loop: false, ((Component)audio).transform.position); ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(EnableSpeaker(time)); } else { speakerDisabled = false; } } } public static IEnumerator EnableSpeaker(float time) { yield return (object)new WaitForSeconds(time + 0.5f); speakerDisabled = false; } public static void PlayShipSpeaker(DiversitySoundManager.SoundType soundType, bool random = true) { if (random) { AudioClip randomAudioClipByType = DiversitySoundManager.GetRandomAudioClipByType(soundType); if (Object.op_Implicit((Object)(object)randomAudioClipByType)) { StartOfRound.Instance.speakerAudioSource.PlayOneShot(randomAudioClipByType); } } else { AudioClip audioClipByType = DiversitySoundManager.GetAudioClipByType(soundType); if (Object.op_Implicit((Object)(object)audioClipByType)) { StartOfRound.Instance.speakerAudioSource.PlayOneShot(audioClipByType); } } } public static void GenerateRoom(int seed, Vector3 startPos, GameObject test, List<GameObject> prefabs, GameObject start, GameObject end, bool isTest) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (Configuration.brakenSpace.Value) { DiversityDungeonGen.WaitCoroutine(GenerateRoomRoutine(seed, startPos, test, prefabs, start, end, isTest)); } } private static IEnumerator GenerateRoomRoutine(int seed, Vector3 startPos, GameObject test, List<GameObject> prefabs, GameObject start, GameObject end, bool isTest) { //IL_000e: 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) Diversity.mls.LogDebug((object)"Generating the Bracken room!"); Random.InitState(seed); if (isTest) { Object.Instantiate<GameObject>(test, startPos, Quaternion.identity); } else { for (int i = 0; i < hallwayLength + 2; i++) { Diversity.mls.LogDebug((object)("Generating tile " + i + "!")); int random = Random.Range(0, 8); GameObject randomHall = prefabs[random]; Vector3 newPos = startPos + new Vector3(0f, 0f, (float)(18 + 18 * i)); GameObject hall3; switch (i) { case 0: hall3 = Object.Instantiate<GameObject>(start, newPos, Quaternion.identity); braken = ((Component)hall3.transform.Find("bracken")).gameObject; brakenV2 = braken.AddComponent<BrackenV2>(); ambience = ((Component)hall3.transform.Find("AmbienceAudio")).gameObject.GetComponent<AudioSource>(); currentLayout.Add(hall3); continue; case 21: hall3 = Object.Instantiate<GameObject>(end, newPos, Quaternion.identity); ((Component)hall3.transform.Find("brackendoor")).gameObject.AddComponent<BrackenDoor>(); currentLayout.Add(hall3); continue; } hall3 = Object.Instantiate<GameObject>(randomHall, newPos, Quaternion.identity); Transform light = hall3.transform.Find("audio/lightbuzz"); if (Object.op_Implicit((Object)(object)light)) { lightBuzz.Add(((Component)light).gameObject); } Transform obj = hall3.transform.Find("steamaudio"); if (Object.op_Implicit((Object)(object)obj)) { steamSounds.Add(((Component)obj).gameObject); } Transform kill = hall3.transform.Find("KillTrigger"); if (Object.op_Implicit((Object)(object)kill)) { ((Component)kill).gameObject.AddComponent<KillTriggerDiversity>(); } currentLayout.Add(hall3); } } Diversity.mls.LogDebug((object)("Bracken room generated using seed: " + seed + "!")); StartOfRoundRevamp.Instance.FinishGeneratingBrackenRoomServerRpc(StartOfRound.Instance.localPlayerController.actualClientId); yield return 0; } public static void GenerateMaze() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) startTile = Object.Instantiate<GameObject>(ContentLoader.extraAssets.LoadAsset<GameObject>("Assets/custom/diversity/extras/prefabs/Tiles/StartTile.prefab"), new Vector3(2500f, -425f, 80f), Quaternion.identity); mazeAudio = ((Component)startTile.transform.Find("AudioMaze")).gameObject.GetComponent<AudioSource>(); DiversityDungeonGen.Instance.GenerateDungeon(StartOfRound.Instance.randomMapSeed, startTile.GetComponent<DungeonTile>(), 150, 30, 30, false); ((MonoBehaviour)DiversityDungeonGen.Instance).StartCoroutine(WaitForGeneration()); } public static IEnumerator WaitForGeneration() { yield return (object)new WaitUntil((Func<bool>)(() => !DiversityDungeonGen.generating)); DungeonTile[] tiles = (from x in Object.FindObjectsOfType<DungeonTile>() where x.tileName != "Down Stairs" && x.tileName != "Up Stairs" select x).ToArray(); float distance = 0f; TileLink furthestLink = null; DungeonTile[] array = tiles; foreach (DungeonTile tile in array) { TileLink[] links = tile.tileLinks.Where((TileLink x) => x.closed).ToArray(); if (links.Length == 0) { continue; } TileLink[] array2 = links; foreach (TileLink link in array2) { float dist = Vector3.Distance(startTile.transform.position, ((Component)link).transform.position); if (dist > distance) { distance = dist; furthestLink = link; } } } if (Object.op_Implicit((Object)(object)furthestLink)) { Diversity.mls.LogDebug((object)"Found furthest link. Adding other door..."); walkerDoor2 = Object.Instantiate<GameObject>(ContentLoader.extraAssets.LoadAsset<GameObject>("Assets/custom/diversity/extras/prefabs/Walker Door.prefab"), ((Component)furthestLink).transform); walkerDoor2.transform.localPosition = Vector3.zero; walkerDoor2.transform.localRotation = Quaternion.identity; } StartOfRoundRevamp.Instance.FinishGeneratingMazeServerRpc(StartOfRound.Instance.localPlayerController.actualClientId); } public static void CreateStairs(GameObject prefab, Vector3 postition) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (Configuration.walker.Value) { GameObject val = Object.Instantiate<GameObject>(prefab, postition, Quaternion.identity); manager = val.GetComponent<StairsManager>(); manager.helmetContainer = GameObject.Find("Systems/Rendering/PlayerHUDHelmetModel"); stairs = val; } } public static void ResetStairsAndBrackenRoom() { foreach (GameObject item in currentLayout) { Object.Destroy((Object)(object)item); } currentLayout.Clear(); Object.Destroy((Object)(object)stairs); } public static void SetSpeakerLines() { StartOfRound instance = StartOfRound.Instance; if (Configuration.speaker.Value) { Random.InitState(instance.randomMapSeed); instance.shipIntroSpeechSFX = DiversitySoundManager.GetRandomAudioClipByType(DiversitySoundManager.SoundType.SpeakerWelcome); Random.InitState(instance.randomMapSeed); instance.zeroDaysLeftAlertSFX = DiversitySoundManager.GetRandomAudioClipByType(DiversitySoundManager.SoundType.SpeakerDays); Random.InitState(instance.randomMapSeed); instance.firedVoiceSFX = DiversitySoundManager.GetRandomAudioClipByType(DiversitySoundManager.SoundType.SpeakerEject); } } public static void ToggleEffects(bool on) { foreach (GameObject currentEffect in currentEffects) { currentEffect.SetActive(on); } } public static void TogglePlayers(bool on) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && val.actualClientId != StartOfRound.Instance.localPlayerController.actualClientId && val.isPlayerControlled) { ((Component)((Component)val).transform.Find("ScavengerModel")).gameObject.SetActive(on); ((Component)((Component)val).transform.Find("PlayerPhysicsBox")).gameObject.SetActive(on); } } playersHidden = !on; } public static IEnumerator Blink() { Diversity.mls.LogDebug((object)"Blinking!"); blinking = true; yield return (object)new WaitUntil((Func<bool>)(() => blinkingTime == 1f)); yield return (object)new WaitForSeconds(0.3f); blinking = false; Diversity.mls.LogDebug((object)"Blinking stopped!"); } } [BepInPlugin("Chaos.Diversity", "Diversity Remastered", "3.0.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Diversity : BaseUnityPlugin { private Version version = Assembly.GetExecutingAssembly().GetName().Version; private const string modGUID = "Chaos.Diversity"; private const string modName = "Diversity Remastered"; private const string modVersion = "3.0.2"; private readonly Harmony harmony = new Harmony("Chaos.Diversity"); public static Diversity Instance; public static ManualLogSource mls; public static ConfigFile config; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = ((BaseUnityPlugin)this).Logger; config = ((BaseUnityPlugin)this).Config; mls.LogDebug((object)("Running build: 3.0.2-B." + version.Revision)); Assembly.LoadFrom(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "DiversityDungeonGen.dll")); Configuration.Load(); ContentLoader.Load(); Enemies.Setup(); DiversityItems.Setup(); Unlockables.LoadUnlockables(); DiversityManager.SetupAssets(); mls.LogDebug((object)"Patching Diversity..."); harmony.PatchAll(typeof(BreakerBoxPatch)); harmony.PatchAll(typeof(CrawlerAIPatch)); harmony.PatchAll(typeof(DressGirlAIPatch)); harmony.PatchAll(typeof(FlowermanAIPatch)); harmony.PatchAll(typeof(GameNetworkManagerPatch)); harmony.PatchAll(typeof(GrabbableObjectPatch)); harmony.PatchAll(typeof(HUDPatch)); harmony.PatchAll(typeof(LungPropPatch)); harmony.PatchAll(typeof(ManualCameraRendererPatch)); harmony.PatchAll(typeof(MenuManagerPatch)); harmony.PatchAll(typeof(MouthDogAIPatch)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(PreInitPatch)); harmony.PatchAll(typeof(PufferAIPatch)); harmony.PatchAll(typeof(RoundManagerPatch)); harmony.PatchAll(typeof(SandSpiderAIPatch)); harmony.PatchAll(typeof(SoundManagerPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); harmony.PatchAll(typeof(TerminalPatch)); harmony.PatchAll(typeof(TimeOfDayPatch)); harmony.PatchAll(typeof(Diversity)); harmony.PatchAll(typeof(DiversityAIManagerRMPatch)); mls.LogDebug((object)"Diversity is patched!"); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } mls.LogInfo((object)"Diversity started."); } } public class Unlockables { public static List<UnlockableItem> RegisteredItems { get; private set; } = new List<UnlockableItem>(); public static void LoadUnlockables() { Diversity.mls.LogDebug((object)"Loading unlockables..."); UnlockablesList val = ContentLoader.MainAssets.LoadAsset<UnlockablesList>("Assets/custom/diversity/Remastered/Floppy Reader/Floppy Reader.asset"); RegisterUnlockable(val.unlockables[0]); Diversity.mls.LogDebug((object)"Unlockables loaded!"); } public static void RegisterUnlockable(UnlockableItem item) { GameNetworkManagerPatch.RegisterPrefab(item.prefabObject); RegisteredItems.Add(item); Diversity.mls.LogDebug((object)("Registered " + item.unlockableName + "!")); } public static void ApplyUnlockables() { foreach (UnlockableItem unlockable in RegisteredItems) { if (StartOfRound.Instance.unlockablesList.unlockables.Any((UnlockableItem x) => x.unlockableName == unlockable.unlockableName)) { continue; } Diversity.mls.LogDebug((object)"Isnt in StartOfRound."); if ((Object)(object)unlockable.prefabObject != (Object)null) { Diversity.mls.LogDebug((object)"Prefab isnt null."); PlaceableShipObject componentInChildren = unlockable.prefabObject.GetComponentInChildren<PlaceableShipObject>(); if ((Object)(object)componentInChildren != (Object)null) { Diversity.mls.LogDebug((object)"PlaceableShipObject found."); componentInChildren.unlockableID = StartOfRound.Instance.unlockablesList.unlockables.Count; StartOfRound.Instance.unlockablesList.unlockables.Add(unlockable); Diversity.mls.LogDebug((object)(unlockable.unlockableName + " has been applied!")); } } } } } } namespace DiversityRemastered.ScriptableObjects { [CreateAssetMenu(fileName = "Diversity Enemy", menuName = "ScriptableObjects/DiversityEnemy")] public class DiversityEnemy : ScriptableObject { public int enemyMaxAmount; public bool spawnAffectedByHazardLevel = true; public bool spawnAffectedByCurrentTime = true; public bool spawnAffectedAverageInsanity = true; } } namespace DiversityRemastered.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("DiversityRemastered.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] diversity { get { object @object = ResourceManager.GetObject("diversity", resourceCulture); return (byte[])@object; } } internal static byte[] diversity_extra { get { object @object = ResourceManager.GetObject("diversity_extra", resourceCulture); return (byte[])@object; } } internal static byte[] diversity_scenes { get { object @object = ResourceManager.GetObject("diversity_scenes", resourceCulture); return (byte[])@object; } } internal Resources() { } } } namespace DiversityRemastered.Player { public class PlayerRevamp : NetworkBehaviour { public PlayerControllerB player; public bool isLocalPlayer = false; public bool dressGirlHaunt = false; public float dressGirlHauntTime = 0f; public float filter = 0f; public Light lastLight; public int lastID = 0; public bool isHaunted = false; public bool wasHaunted = false; public bool kidnapped = false; public bool kidnapSequence = false; public float kidnapSequenceTime = 0f; public float flashlightTimeElapsed = 0f; public float voicesTime = 0f; public float voicesInterval = 1f; public float heartBeatInterval = 1f; public float heartBeatTime = 0f; public float heartBeatCooldown = 0f; private static float timeElapsed; private bool playersHidden = false; public List<Vector3> nearbySounds = new List<Vector3>(); private float soundCheckInterval = 0f; private bool instanciated = false; public bool updated = false; private bool unfinished = false; public bool sinkingFromWalker = false; private float sinkingTime = 0f; public float insaneMultiplier = 0f; public bool inStairs = false; public bool inMaze = false; public float mazeInterval; public bool goingInsane = false; public float intervalInsanityTime = 0f; public float intervalInsanityDuration = 5f; public bool forceLook = false; public Vector3 forceLookPosition = Vector3.zero; public Rigidbody rb; private void Awake() { player = ((Component)this).GetComponent<PlayerControllerB>(); ((MonoBehaviour)this).StartCoroutine(WaitForLocalPlayer()); } private void Start() { rb = ((Component)this).GetComponent<Rigidbody>(); } public IEnumerator WaitForLocalPlayer() { yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)StartOfRound.Instance.localPlayerController != (Object)null)); isLocalPlayer = (Object)(object)player == (Object)(object)StartOfRound.Instance.localPlayerController; } public void OnDeath() { if (!player.isPlayerDead) { return; } if (inStairs) { inStairs = false; } if (inMaze) { inMaze = false; } if (dressGirlHaunt) { dressGirlHaunt = false; } DiversityManager.TogglePlayers(on: true); if (isLocalPlayer) { DiversityManager.fullscreenPass2.fullscreenPassMaterial.SetFloat("_intensity", 0f); ((CustomPass)DiversityManager.walkerFSPass).enabled = false; DiversityManager.walkerFSPass.fullscreenPassMaterial.SetFloat("_Stain_Intensity", 20f); DiversityManager.black.weight = 0f; DiversityManager.hauntedIntensity = 0f; if ((Object)(object)DiversityManager.mazeAudio != (Object)null && DiversityManager.mazeAudio.isPlaying) { DiversityManager.mazeAudio.Stop(); } if ((Object)(object)DiversityManager.ambience != (Object)null) { ((Behaviour)DiversityManager.ambience).enabled = false; } DiversityManager.ToggleEffects(on: true); } } private void Update() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0cf9: Unknown result type (might be due to invalid IL or missing references) //IL_0cfe: Unknown result type (might be due to invalid IL or missing references) //IL_0d01: Unknown result type (might be due to invalid IL or missing references) //IL_0d0a: Unknown result type (might be due to invalid IL or missing references) //IL_0d5e: Unknown result type (might be due to invalid IL or missing references) //IL_0e5f: Unknown result type (might be due to invalid IL or missing references) //IL_0e64: Unknown result type (might be due to invalid IL or missing references) //IL_0e67: Unknown result type (might be due to invalid IL or missing references) //IL_0e70: Unknown result type (might be due to invalid IL or missing references) //IL_0d77: Unknown result type (might be due to invalid IL or missing references) //IL_0d86: Unknown result type (might be due to invalid IL or missing references) //IL_0fba: Unknown result type (might be due to invalid IL or missing references) //IL_0db6: Unknown result type (might be due to invalid IL or missing references) //IL_0ddd: Unknown result type (might be due to invalid IL or missing references) //IL_0fd3: Unknown result type (might be due to invalid IL or missing references) //IL_0fe2: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_085c: Unknown result type (might be due to invalid IL or missing references) //IL_0871: Unknown result type (might be due to invalid IL or missing references) //IL_0876: Unknown result type (might be due to invalid IL or missing references) //IL_087b: Unknown result type (might be due to invalid IL or missing references) //IL_088d: Unknown result type (might be due to invalid IL or missing references) //IL_088f: Unknown result type (might be due to invalid IL or missing references) //IL_0894: Unknown result type (might be due to invalid IL or missing references) //IL_0898: Unknown result type (might be due to invalid IL or missing references) //IL_089f: Unknown result type (might be due to invalid IL or missing references) //IL_08b1: Unknown result type (might be due to invalid IL or missing references) //IL_0ec4: Unknown result type (might be due to invalid IL or missing references) //IL_08e0: Unknown result type (might be due to invalid IL or missing references) //IL_08e7: Unknown result type (might be due to invalid IL or missing references) //IL_08f1: Unknown result type (might be due to invalid IL or missing references) //IL_0edd: Unknown result type (might be due to invalid IL or missing references) //IL_0eec: Unknown result type (might be due to invalid IL or missing references) //IL_0f1c: Unknown result type (might be due to invalid IL or missing references) //IL_0f43: Unknown result type (might be due to invalid IL or missing references) //IL_09dd: Unknown result type (might be due to invalid IL or missing references) //IL_0ada: Unknown result type (might be due to invalid IL or missing references) //IL_0adf: Unknown result type (might be due to invalid IL or missing references) //IL_0ac1: Unknown result type (might be due to invalid IL or missing references) //IL_0bda: Unknown result type (might be due to invalid IL or missing references) //IL_0be0: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)player) || !player.isPlayerControlled || (Object)(object)DiversityManager.black == (Object)nu
DiversityDungeonGen.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using DiversityLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("DiversityDungeonGen")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DiversityDungeonGen")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("24bf3e0e-40d9-4d2d-a557-cd66ca058005")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace DiversityDungeonGen { public class DiversityDungeonGen : MonoBehaviour { public class Dungeon { public List<GameObject> tiles = new List<GameObject>(); public int size = 0; public int maxHeight = 0; public int maxDepth = 0; } public GameObject[] tiles; private bool creatingTile = false; public static DiversityDungeonGen Instance { get; private set; } public static List<GameObject> RegisteredTiles { get; private set; } = new List<GameObject>(); public static Dungeon CurrentDungeon { get; private set; } = null; public static bool generating { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; CurrentDungeon = new Dungeon(); Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } else { Object.Destroy((Object)(object)this); } } public static void RegisterTile(GameObject tile) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) Scene scene = tile.scene; if (((Scene)(ref scene)).name == null) { if (Object.op_Implicit((Object)(object)tile.GetComponent<DungeonTile>())) { RegisteredTiles.Add(tile); Debug.Log((object)("tile '" + tile.GetComponent<DungeonTile>().tileName + "' has been registered!")); } else { Debug.Log((object)(((Object)tile).name + " must be a Dungeon Tile!")); } } else { Debug.Log((object)(((Object)tile).name + " must not be an instance of a prefab!")); } } public void GenerateDungeon(int seed, DungeonTile startTile, int size = 100, int maxHeight = 20, int maxDepth = 20, bool debug = false) { if (debug) { ((MonoBehaviour)this).StartCoroutine(GenerateDungeonRoutine(seed, startTile, size, maxHeight, maxDepth, debug: true)); } else { WaitCoroutine(GenerateDungeonRoutine(seed, startTile, size, maxHeight, maxDepth, debug: false)); } } public static void WaitCoroutine(IEnumerator func) { while (func.MoveNext()) { if (func.Current == null) { continue; } IEnumerator func2; try { func2 = (IEnumerator)func.Current; } catch (InvalidCastException) { if (func.Current.GetType() == typeof(WaitForSeconds)) { Debug.LogWarning((object)"Skipped call to WaitForSeconds. Use WaitForSecondsRealtime instead."); } break; } WaitCoroutine(func2); } } private IEnumerator GenerateDungeonRoutine(int seed, DungeonTile startTile, int size, int maxHeight, int maxDepth, bool debug) { DeleteCurrentDungeon(); Random.InitState(seed); generating = true; CurrentDungeon.tiles.Add(((Component)startTile).gameObject); CurrentDungeon.size = size; CurrentDungeon.maxHeight = maxHeight; CurrentDungeon.maxDepth = maxDepth; Debug.Log((object)"GENERATING DUNGEON!"); while (generating) { yield return (object)new WaitUntil((Func<bool>)(() => !creatingTile)); if (debug) { yield return (object)new WaitForSeconds(0.5f); } if (SpaceLeft() <= 0) { generating = false; } if (creatingTile) { continue; } foreach (GameObject tile in CurrentDungeon.tiles.ToList()) { DungeonTile dTile = tile.GetComponent<DungeonTile>(); foreach (TileLink link in tile.GetComponent<DungeonTile>().tileLinks.Where((TileLink x) => !x.closed)) { if (Vector3.Distance(((Component)link).transform.position, ((Component)startTile).transform.position) > (float)size || ((Component)link).transform.position.y - ((Component)startTile).transform.position.y > (float)maxHeight || ((Component)link).transform.position.y - ((Component)startTile).transform.position.y < (float)(-maxDepth)) { Debug.Log((object)"Closing tile link!!!"); link.closed = true; if (Object.op_Implicit((Object)(object)link.wall)) { link.wall.SetActive(true); } } else { creatingTile = true; CreateRandomTile(link, dTile); } } } } if (!generating) { Debug.Log((object)"FINISHED GENERATING DUNGEON!!! CLEANING UP!"); CleanUp(); } yield return 0; } private void CleanUp() { CheckAllLinks(); } private void CheckAllLinks() { //IL_0065: 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) TileLink[] allLinks = GetAllLinks(); TileLink[] array = allLinks; foreach (TileLink link in array) { TileLink[] array2 = allLinks.Where((TileLink x) => (Object)(object)x != (Object)(object)link).ToArray(); foreach (TileLink tileLink in array2) { if (Vector3.Distance(((Component)tileLink).transform.position, ((Component)link).transform.position) < 0.05f) { Debug.Log((object)"Opening walls of intersecting Links!"); link.closed = false; link.wall.SetActive(false); tileLink.closed = false; tileLink.wall.SetActive(false); } } } Debug.Log((object)"FINISHED CLEANING UP THE DUNGEON!!!"); } private TileLink[] GetAllLinks() { List<TileLink> list = new List<TileLink>(); foreach (GameObject tile in CurrentDungeon.tiles) { DungeonTile component = tile.GetComponent<DungeonTile>(); TileLink[] tileLinks = component.tileLinks; foreach (TileLink item in tileLinks) { list.Add(item); } } return list.ToArray(); } public void DeleteCurrentDungeon() { if (CurrentDungeon == null) { return; } Debug.Log((object)"Deleting the dungeon!!!"); foreach (GameObject item in CurrentDungeon.tiles.ToList()) { Object.Destroy((Object)(object)item); } CurrentDungeon = new Dungeon(); } private void CreateRandomTile(TileLink link, DungeonTile dTile) { //IL_0065: 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) Debug.Log((object)"Creating a tile!!!"); GameObject val = SelectTile(); if ((Object)(object)val != (Object)null) { Debug.Log((object)("Is tiled closed??:" + link.closed)); if (SpaceLeft() > 0 && !link.closed) { if (CanUseThisTile(val)) { GameObject tile = Object.Instantiate<GameObject>(val, ((Component)link).transform.position, ((Component)link).transform.rotation); ShouldThisTileStay(tile, link, dTile); } else { CreateRandomTile(link, dTile); } } } else { link.closed = true; if (Object.op_Implicit((Object)(object)link.wall)) { link.wall.SetActive(true); } creatingTile = false; } } private void ShouldThisTileStay(GameObject tile, TileLink link, DungeonTile dTile) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) GameObject tile2 = tile; DungeonTile dTile2 = dTile; bool flag = false; DungeonTile component = tile2.GetComponent<DungeonTile>(); foreach (GameObject item in CurrentDungeon.tiles.Where((GameObject x) => (Object)(object)x != (Object)(object)tile2 && (Object)(object)x != (Object)(object)((Component)dTile2).gameObject)) { Bounds bounds = ((Renderer)tile2.GetComponent<DungeonTile>().meshRenderer).bounds; Bounds bounds2 = ((Renderer)item.GetComponent<DungeonTile>().meshRenderer).bounds; if (((Bounds)(ref bounds)).Intersects(bounds2)) { Bounds val = default(Bounds); ((Bounds)(ref val)).SetMinMax(Vector3.Max(((Bounds)(ref bounds)).min, ((Bounds)(ref bounds2)).min), Vector3.Min(((Bounds)(ref bounds)).max, ((Bounds)(ref bounds2)).max)); if (DiversityLib.Volume(((Bounds)(ref val)).size) > 1f) { flag = true; break; } } } if (flag) { Debug.Log((object)(component.tileName + " Is intersecting and will be deleted!")); Object.Destroy((Object)(object)tile2); link.closed = true; if (Object.op_Implicit((Object)(object)link.wall)) { link.wall.SetActive(true); } } else { Debug.Log((object)"Tile is good. Keeping it for the dungeon."); CurrentDungeon.tiles.Add(tile2); link.closed = true; CloseNearbyLink(link, tile2.GetComponent<DungeonTile>()); } creatingTile = false; } private void CloseNearbyLink(TileLink link, DungeonTile tile) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) float num = 1000f; TileLink tileLink = null; TileLink[] tileLinks = tile.tileLinks; foreach (TileLink tileLink2 in tileLinks) { float num2 = Vector3.Distance(((Component)link).transform.position, ((Component)tileLink2).transform.position); if (num2 < num) { num = num2; tileLink = tileLink2; } } if ((Object)(object)tileLink != (Object)null) { tileLink.closed = true; } } private TileLink ClosestLink(TileLink link, DungeonTile tile) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) float num = 1000f; TileLink result = null; TileLink[] tileLinks = tile.tileLinks; foreach (TileLink tileLink in tileLinks) { float num2 = Vector3.Distance(((Component)link).transform.position, ((Component)tileLink).transform.position); if (num2 < num) { num = num2; result = tileLink; } } return result; } private GameObject SelectTile() { GameObject[] array = (from x in RegisteredTiles.Union(Instance.tiles.ToList()) where x.GetComponent<DungeonTile>().isMandatory where CurrentDungeon.tiles.Any((GameObject y) => Object.op_Implicit((Object)(object)(x = y))) select x).ToArray(); if (SpaceLeft() <= array.Length && array.Length != 0) { return array[Random.Range(0, array.Length)]; } float num = (float)AmountOfTiles() / (float)(CurrentDungeon.size * (CurrentDungeon.maxHeight + CurrentDungeon.maxDepth)); Debug.Log((object)("Does the dungeon have enough space: " + (AmountOfTiles() <= CurrentDungeon.size))); if (AmountOfTiles() <= CurrentDungeon.size || !(Random.value <= 0.15f + num)) { return RegisteredTiles.Union(Instance.tiles.ToList()).ToList()[Random.Range(0, RegisteredTiles.Union(Instance.tiles.ToList()).ToList().Count)]; } Debug.Log((object)"Not Generating This Tile!"); return null; } private bool CanUseThisTile(GameObject tile) { GameObject tile2 = tile; return (CurrentDungeon.tiles.Where((GameObject x) => x.GetComponent<DungeonTile>().tileName == tile2.GetComponent<DungeonTile>().tileName).ToArray().Length < tile2.GetComponent<DungeonTile>().maxAmount && tile2.GetComponent<DungeonTile>().isLimited) || !tile2.GetComponent<DungeonTile>().isLimited; } private int SpaceLeft() { int num = 0; Debug.Log((object)CurrentDungeon.tiles.Count); if (CurrentDungeon.tiles.Count <= 0) { return 0; } foreach (GameObject tile in CurrentDungeon.tiles) { DungeonTile component = tile.GetComponent<DungeonTile>(); if (Object.op_Implicit((Object)(object)component)) { num += component.tileLinks.Where((TileLink x) => !x.closed).Count(); } else { Debug.LogError((object)"Something happened when trying to look for space left while generating a dungeon!"); } } return num; } private int AmountOfTiles() { return CurrentDungeon.tiles.Count; } } public class DungeonTile : MonoBehaviour { public string tileName; public float probability; public MeshRenderer meshRenderer; public TileLink[] tileLinks; public bool isMandatory; public bool isLimited; public int maxAmount; } public class TileLink : MonoBehaviour { public GameObject wall; public bool closed = false; } }
DiversityLib.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("DiversityLib")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DiversityLib")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f3aa347e-bdfa-4c6a-b93f-1429e4f206c4")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace DiversityLib { public static class DiversityLib { public static Texture2D RenderToTexture2D(this RenderTexture rTex) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(((Texture)rTex).width, ((Texture)rTex).height, (TextureFormat)4, false); RenderTexture.active = rTex; val.ReadPixels(new Rect(0f, 0f, (float)((Texture)rTex).width, (float)((Texture)rTex).height), 0, 0); val.Apply(); return val; } public static Color[] GetPixels(this RenderTexture texture) { Texture2D val = texture.RenderToTexture2D(); return val.GetPixels(); } public static float CalculateAverageLuminance(this RenderTexture texture, bool useAlpha = false) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Texture2D val = texture.RenderToTexture2D(); float num = ((Texture)val).width * ((Texture)val).height; float num2 = 0f; Color[] pixels = val.GetPixels(); foreach (Color color in pixels) { num2 += color.CalculateLuminance(useAlpha); } return num2 / num; } public static float CalculateAverageLuminance(this Texture2D texture, bool useAlpha = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) float num = ((Texture)texture).width * ((Texture)texture).height; float num2 = 0f; Color[] pixels = texture.GetPixels(); foreach (Color color in pixels) { num2 += color.CalculateLuminance(useAlpha); } return num2 / num; } public static float CalculateAverageLuminance(this Color[] colorArray, bool useAlpha = false) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) float num = colorArray.Length; float num2 = 0f; foreach (Color color in colorArray) { num2 += color.CalculateLuminance(useAlpha); } return num2 / num; } public static Color AverageDifference(this Texture2D texture, Texture2D secondTexture) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0097: 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) float num = ((Texture)texture).width * ((Texture)texture).height; float num2 = 0f; float num3 = 0f; float num4 = 0f; float num5 = 0f; for (int i = 0; i < ((Texture)texture).width; i++) { for (int j = 0; j < ((Texture)texture).height; j++) { Color pixel = texture.GetPixel(i, j); Color pixel2 = secondTexture.GetPixel(i, j); num2 += Mathf.Abs(pixel.r - pixel2.r); num3 += Mathf.Abs(pixel.g - pixel2.g); num4 += Mathf.Abs(pixel.b - pixel2.b); num5 += Mathf.Abs(pixel.a - pixel2.a); } } num2 /= num; num3 /= num; num4 /= num; num5 /= num; return new Color(num2, num3, num4, num5); } public static float BW(this Color col) { //IL_0001: 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_000e: Unknown result type (might be due to invalid IL or missing references) return col.r + col.g + col.b; } public static float CalculateLuminance(this Color color, bool useAlpha = false) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) return 0.299f * color.r * (useAlpha ? color.a : 1f) + 0.587f * color.g * (useAlpha ? color.a : 1f) + 0.114f * color.b * (useAlpha ? color.a : 1f); } public static Color GetAverageRGBA(this RenderTexture texture) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) Texture2D texture2 = texture.RenderToTexture2D(); return texture2.GetAverageRGBA(); } public static Color GetAverageRGBA(this Texture2D texture) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0058: 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_0089: 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_0092: Unknown result type (might be due to invalid IL or missing references) float num = ((Texture)texture).width * ((Texture)texture).height; float num2 = 0f; float num3 = 0f; float num4 = 0f; float num5 = 0f; Color[] pixels = texture.GetPixels(); foreach (Color val in pixels) { num2 += val.r; num3 += val.g; num4 += val.b; num5 += val.a; } return new Color(num2 / num, num3 / num, num4 / num, num5 / num); } public static Color GetAverageRGBA(this Color[] colorArray) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) float num = colorArray.Length; float num2 = 0f; float num3 = 0f; float num4 = 0f; float num5 = 0f; foreach (Color val in colorArray) { num2 += val.r; num3 += val.g; num4 += val.b; num5 += val.a; } return new Color(num2 / num, num3 / num, num4 / num, num5 / num); } public static float Remap(this float value, float from1, float to1, float from2, float to2) { return (value - from1) / (to1 - from1) * (to2 - from2) + from2; } public static float OneMinus(this float f) { return 1f - f; } public static float Negate(this float f) { return 0f - f; } public static uint Random(this uint u) { Random random = new Random(); uint num = (uint)random.Next(1073741824); uint num2 = (uint)random.Next(4); return (num << 2) | num2; } public static float Volume(this Vector3 v3) { //IL_0001: 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_000e: Unknown result type (might be due to invalid IL or missing references) return v3.x * v3.y * v3.z; } } }