Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of InsanityEvents v3.0.0
InsanityEvents.dll
Decompiled 3 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using InsanityEvents.Events; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("InsanityEvents")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("InsanityEvents")] [assembly: AssemblyTitle("InsanityEvents")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace InsanityEvents { public class BossMusicController : MonoBehaviour { [CompilerGenerated] private sealed class <LoadBossDeathSound>d__8 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public BossMusicController <>4__this; private string <musicFolder>5__1; private string <bossSpecificDeathSound>5__2; private string <defaultDeathSound>5__3; private string <selectedFile>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadBossDeathSound>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <musicFolder>5__1 = null; <bossSpecificDeathSound>5__2 = null; <defaultDeathSound>5__3 = null; <selectedFile>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <musicFolder>5__1 = <>4__this.GetBossMusicFolder(); <bossSpecificDeathSound>5__2 = Path.Combine(<musicFolder>5__1, <>4__this.bossName + "_dead.ogg"); <defaultDeathSound>5__3 = Path.Combine(<musicFolder>5__1, "boss_dead.ogg"); <selectedFile>5__4 = null; if (File.Exists(<bossSpecificDeathSound>5__2)) { <selectedFile>5__4 = <bossSpecificDeathSound>5__2; } else if (File.Exists(<defaultDeathSound>5__3)) { <selectedFile>5__4 = <defaultDeathSound>5__3; } if (<selectedFile>5__4 == null) { Debug.LogWarning((object)"No boss death sound found. Add boss_dead.ogg."); Object.Destroy((Object)(object)((Component)<>4__this).gameObject); return false; } <>2__current = <>4__this.LoadClipIntoSource(<selectedFile>5__4, <>4__this.oneShotSource); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)<>4__this.oneShotSource.clip != (Object)null) { <>4__this.oneShotSource.Play(); <>2__current = (object)new WaitForSeconds(<>4__this.oneShotSource.clip.length + 0.5f); <>1__state = 2; return true; } break; case 2: <>1__state = -1; break; } Object.Destroy((Object)(object)((Component)<>4__this).gameObject); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LoadBossMusic>d__7 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public BossMusicController <>4__this; private string <musicFolder>5__1; private string <selectedFile>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadBossMusic>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <musicFolder>5__1 = null; <selectedFile>5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <musicFolder>5__1 = <>4__this.GetBossMusicFolder(); if (!Directory.Exists(<musicFolder>5__1)) { Debug.LogWarning((object)("BossMusic folder not found: " + <musicFolder>5__1)); return false; } <selectedFile>5__2 = <>4__this.FindBossMusicFile(<musicFolder>5__1); if (<selectedFile>5__2 == null) { Debug.LogWarning((object)("No boss music found for boss: " + <>4__this.bossName)); return false; } <>2__current = <>4__this.LoadClipIntoSource(<selectedFile>5__2, <>4__this.musicSource); <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LoadClipIntoSource>d__9 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string filePath; public AudioSource source; public BossMusicController <>4__this; private string <url>5__1; private UnityWebRequest <request>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadClipIntoSource>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <url>5__1 = null; <request>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; <url>5__1 = "file:///" + filePath.Replace("\\", "/"); <request>5__2 = UnityWebRequestMultimedia.GetAudioClip(<url>5__1, (AudioType)14); <>1__state = -3; <>2__current = <request>5__2.SendWebRequest(); <>1__state = 1; result = true; break; case 1: <>1__state = -3; if ((int)<request>5__2.result != 1) { Debug.LogError((object)("Audio load failed: " + <request>5__2.error)); result = false; <>m__Finally1(); } else { source.clip = DownloadHandlerAudioClip.GetContent(<request>5__2); <>m__Finally1(); <request>5__2 = null; result = false; } break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<request>5__2 != null) { ((IDisposable)<request>5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private Transform bossTarget; private AudioSource musicSource; private AudioSource oneShotSource; private string bossName; private bool bossDeathSoundPlayed = false; public static void Create(Transform bossTransform) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown if (InsanityEventsPlugin.EnableBossMusic.Value && !((Object)(object)bossTransform == (Object)null)) { GameObject val = new GameObject("InsanityEvents_BossMusic"); BossMusicController bossMusicController = val.AddComponent<BossMusicController>(); bossMusicController.bossTarget = bossTransform; bossMusicController.bossName = ((Object)bossTransform).name.ToLower(); Object.DontDestroyOnLoad((Object)(object)val); } } private void Awake() { musicSource = ((Component)this).gameObject.AddComponent<AudioSource>(); musicSource.loop = true; musicSource.playOnAwake = false; musicSource.spatialBlend = 0f; musicSource.volume = 0f; oneShotSource = ((Component)this).gameObject.AddComponent<AudioSource>(); oneShotSource.loop = false; oneShotSource.playOnAwake = false; oneShotSource.spatialBlend = 0f; oneShotSource.volume = Mathf.Clamp01(InsanityEventsPlugin.BossMusicVolume.Value); ((MonoBehaviour)this).StartCoroutine(LoadBossMusic()); } [IteratorStateMachine(typeof(<LoadBossMusic>d__7))] private IEnumerator LoadBossMusic() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadBossMusic>d__7(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<LoadBossDeathSound>d__8))] private IEnumerator LoadBossDeathSound() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadBossDeathSound>d__8(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<LoadClipIntoSource>d__9))] private IEnumerator LoadClipIntoSource(string filePath, AudioSource source) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadClipIntoSource>d__9(0) { <>4__this = this, filePath = filePath, source = source }; } private string GetBossMusicFolder() { return Path.Combine(Paths.PluginPath, "InsanityEvents", "BossMusic"); } private string FindBossMusicFile(string folder) { string[] files = Directory.GetFiles(folder, "*.ogg"); if (files.Length == 0) { return null; } string[] array = files; foreach (string text in array) { string text2 = Path.GetFileNameWithoutExtension(text).ToLower(); if (!(text2 == "boss_dead") && !text2.EndsWith("_dead") && (bossName.Contains(text2) || text2.Contains(bossName))) { return text; } } string[] array2 = files; foreach (string text3 in array2) { string text4 = Path.GetFileNameWithoutExtension(text3).ToLower(); if (text4 != "boss_dead" && !text4.EndsWith("_dead")) { return text3; } } return null; } private void Update() { //IL_004d: 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) if ((Object)(object)bossTarget == (Object)null) { OnBossDeadOrMissing(); return; } Transform localPlayerTransform = GetLocalPlayerTransform(); if ((Object)(object)localPlayerTransform == (Object)null) { return; } float num = Mathf.Max(1f, InsanityEventsPlugin.BossMusicRange.Value); float num2 = Vector3.Distance(localPlayerTransform.position, bossTarget.position); if (num2 <= num && (Object)(object)musicSource.clip != (Object)null) { float num3 = Mathf.Clamp01(1f - num2 / num); num3 *= Mathf.Clamp01(InsanityEventsPlugin.BossMusicVolume.Value); musicSource.volume = Mathf.Lerp(musicSource.volume, num3, Time.deltaTime * 2.5f); if (!musicSource.isPlaying) { musicSource.Play(); } } else { FadeOutMusic(); } } private Transform GetLocalPlayerTransform() { if ((Object)(object)Camera.main != (Object)null) { return ((Component)Camera.main).transform; } GameObject val = GameObject.Find("Player"); if ((Object)(object)val != (Object)null) { return val.transform; } return null; } private void OnBossDeadOrMissing() { if (!bossDeathSoundPlayed) { bossDeathSoundPlayed = true; if ((Object)(object)musicSource != (Object)null && musicSource.isPlaying) { musicSource.Stop(); } ((MonoBehaviour)this).StartCoroutine(LoadBossDeathSound()); } } private void FadeOutMusic() { if (!((Object)(object)musicSource == (Object)null)) { musicSource.volume = Mathf.Lerp(musicSource.volume, 0f, Time.deltaTime * 2.5f); if (musicSource.volume <= 0.01f && musicSource.isPlaying) { musicSource.Stop(); } } } } public static class BossUiController { public static void CreateFakeBossBar(string bossName, float healthPercent) { Debug.Log((object)("Bossbar anzeigen: " + bossName + " HP: " + healthPercent)); } } public abstract class ChaosEvent { public abstract string Name { get; } public abstract string Description { get; } public abstract int MinChaosLevel { get; } public virtual bool IsUltraEvent => false; public virtual bool IsBossEvent => false; public virtual bool IsWeatherEvent => false; public virtual bool IsHallucinationEvent => false; public virtual bool CanStack => false; public abstract void StartEvent(ChaosRunContext context); } public class ChaosRunContext { public int ChaosLevel; public int Seed; public List<string> ActiveEventNames = new List<string>(); public void Message(string title, string body) { if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.DisplayTip(title, body, false, false, "LC_Tip1"); } Debug.Log((object)("[" + title + "] " + body)); } } [HarmonyPatch(typeof(StartOfRound), "ShipLeave")] public class EventCleanup { [HarmonyPrefix] public static void CleanupBeforeLeaving() { CleanupInsanityObjects(); ResetWeatherVisuals(); Debug.Log((object)"InsanityEvents cleanup before ship leave complete."); } public static void CleanupInsanityObjects() { GameObject[] array = Object.FindObjectsOfType<GameObject>(); foreach (GameObject val in array) { if ((Object)(object)val != (Object)null && ((Object)val).name.StartsWith("InsanityEvents_")) { Object.Destroy((Object)(object)val); } } } public static void ResetWeatherVisuals() { //IL_0013: 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) RenderSettings.fog = false; RenderSettings.fogDensity = 0f; RenderSettings.fogColor = Color.gray; RenderSettings.ambientLight = Color.white; } } public static class EventCombinationSystem { public static void CheckCombinations(ChaosRunContext context) { bool flag = context.ActiveEventNames.Contains("GIANT FACILITY"); bool flag2 = context.ActiveEventNames.Contains("ENDLESS HUNT"); bool flag3 = context.ActiveEventNames.Contains("DARKNESS PROTOCOL"); bool flag4 = context.ActiveEventNames.Contains("BLOOD STORM"); bool flag5 = context.ActiveEventNames.Contains("BOSS PROTOCOL"); bool flag6 = context.ActiveEventNames.Contains("THE SWARM"); bool flag7 = context.ActiveEventNames.Contains("HALLUCINATIONS"); bool flag8 = context.ActiveEventNames.Contains("CURSED CREW"); if (flag && flag2 && flag3) { context.Message("EVENT COMBINATION", "APOCALYPSE: Riesiges Dungeon, Dunkelheit und permanente Jagd."); } if (flag4 && flag5 && flag6) { context.Message("EVENT COMBINATION", "HELL MOON: Sturm, Bosskampf und Schwarm gleichzeitig."); } if (flag7 && flag8) { context.Message("EVENT COMBINATION", "NIGHTMARE MODE: Flüche und Halluzinationen aktiv."); } } } public static class EventDatabase { public static readonly List<ChaosEvent> AllEvents = new List<ChaosEvent> { new ShotgunMadnessEvent(), new DarknessProtocolEvent(), new EndlessHuntEvent(), new WeatherChaosEvent(), new HallucinationEvent(), new GiantFacilityEvent(), new SwarmEvent(), new CursedCrewEvent(), new BossProtocolEvent() }; } [HarmonyPatch(typeof(RoundManager), "LoadNewLevel")] public class EventManager { [HarmonyPostfix] public static void OnLevelLoaded() { EventCleanup.CleanupInsanityObjects(); int chaosLevel = Mathf.Clamp(InsanityEventsPlugin.ChaosLevel.Value, 1, 10); float eventChance = GetEventChance(chaosLevel); if (Random.value > eventChance) { Debug.Log((object)$"InsanityEvents: Kein Event auf diesem Mond. Chance war {eventChance:P0}."); return; } int num = ((InsanityEventsPlugin.FixedSeed.Value != 0) ? InsanityEventsPlugin.FixedSeed.Value : Random.Range(100000, 999999)); if (InsanityEventsPlugin.EnableSeedSystem.Value) { Random.InitState(num); } ChaosRunContext chaosRunContext = new ChaosRunContext { ChaosLevel = chaosLevel, Seed = num }; chaosRunContext.Message("CHAOS SEED", num.ToString()); List<ChaosEvent> list = (from e in EventDatabase.AllEvents where e.MinChaosLevel <= chaosLevel where InsanityEventsPlugin.AllowUltraEvents.Value || !e.IsUltraEvent where InsanityEventsPlugin.AllowBossEvents.Value || !e.IsBossEvent where InsanityEventsPlugin.AllowWeatherEvents.Value || !e.IsWeatherEvent where InsanityEventsPlugin.AllowHallucinations.Value || !e.IsHallucinationEvent select e).ToList(); if (list.Count == 0) { Debug.Log((object)"InsanityEvents: Keine verfügbaren Events."); return; } int num2 = Mathf.Clamp(Random.Range(1, chaosLevel + 1), 1, Mathf.Clamp(InsanityEventsPlugin.MaxEvents.Value, 1, 20)); List<ChaosEvent> list2 = new List<ChaosEvent>(); for (int i = 0; i < num2; i++) { ChaosEvent randomEvent = list[Random.Range(0, list.Count)]; if (randomEvent.CanStack || !list2.Any((ChaosEvent e) => e.GetType() == randomEvent.GetType())) { list2.Add(randomEvent); } } foreach (ChaosEvent item in list2) { chaosRunContext.ActiveEventNames.Add(item.Name); item.StartEvent(chaosRunContext); chaosRunContext.Message("CHAOS EVENT", item.Name + "\n" + item.Description); } EventCombinationSystem.CheckCombinations(chaosRunContext); } private static float GetEventChance(int chaosLevel) { if (InsanityEventsPlugin.UseFixedEventChance.Value) { return Mathf.Clamp01(InsanityEventsPlugin.FixedEventChance.Value); } return Mathf.Clamp01(Mathf.Lerp(InsanityEventsPlugin.BaseEventChance.Value, InsanityEventsPlugin.MaxEventChance.Value, (float)chaosLevel / 10f)); } } [BepInPlugin("de.insanity.events", "InsanityEvents", "2.1.0")] public class InsanityEventsPlugin : BaseUnityPlugin { public const string PluginGuid = "de.insanity.events"; public const string PluginName = "InsanityEvents"; public const string PluginVersion = "2.1.0"; public static ConfigEntry<int> ChaosLevel; public static ConfigEntry<bool> EnableSeedSystem; public static ConfigEntry<int> FixedSeed; public static ConfigEntry<bool> UseFixedEventChance; public static ConfigEntry<float> FixedEventChance; public static ConfigEntry<float> BaseEventChance; public static ConfigEntry<float> MaxEventChance; public static ConfigEntry<int> MaxEvents; public static ConfigEntry<bool> AllowUltraEvents; public static ConfigEntry<bool> AllowBossEvents; public static ConfigEntry<bool> AllowHallucinations; public static ConfigEntry<bool> AllowWeatherEvents; public static ConfigEntry<bool> EnableBossMusic; public static ConfigEntry<float> BossMusicRange; public static ConfigEntry<float> BossMusicVolume; private void Awake() { //IL_01fa: Unknown result type (might be due to invalid IL or missing references) ChaosLevel = ((BaseUnityPlugin)this).Config.Bind<int>("General", "ChaosLevel", 5, "Chaos-Level von 1 bis 10."); EnableSeedSystem = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableSeedSystem", true, "Aktiviert das Seed-System."); FixedSeed = ((BaseUnityPlugin)this).Config.Bind<int>("General", "FixedSeed", 0, "0 = zufälliger Seed. Andere Zahl = fester Seed."); UseFixedEventChance = ((BaseUnityPlugin)this).Config.Bind<bool>("Event Chance", "UseFixedEventChance", true, "Wenn true, wird FixedEventChance genutzt. Wenn false, skaliert die Chance mit ChaosLevel."); FixedEventChance = ((BaseUnityPlugin)this).Config.Bind<float>("Event Chance", "FixedEventChance", 0.45f, "Feste Eventchance pro Mond. 0.0 = nie, 1.0 = immer."); BaseEventChance = ((BaseUnityPlugin)this).Config.Bind<float>("Event Chance", "BaseEventChance", 0.15f, "Eventchance bei niedrigem Chaos, wenn UseFixedEventChance false ist."); MaxEventChance = ((BaseUnityPlugin)this).Config.Bind<float>("Event Chance", "MaxEventChance", 0.95f, "Eventchance bei Chaos 10, wenn UseFixedEventChance false ist."); MaxEvents = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxEvents", 8, "Maximale Anzahl gleichzeitiger Events."); AllowUltraEvents = ((BaseUnityPlugin)this).Config.Bind<bool>("Events", "AllowUltraEvents", true, "Ultra-Events aktivieren."); AllowBossEvents = ((BaseUnityPlugin)this).Config.Bind<bool>("Events", "AllowBossEvents", true, "Boss-Events aktivieren."); AllowHallucinations = ((BaseUnityPlugin)this).Config.Bind<bool>("Events", "AllowHallucinations", true, "Halluzinationen aktivieren."); AllowWeatherEvents = ((BaseUnityPlugin)this).Config.Bind<bool>("Events", "AllowWeatherEvents", true, "Wetter-Events aktivieren."); EnableBossMusic = ((BaseUnityPlugin)this).Config.Bind<bool>("Boss Music", "EnableBossMusic", true, "Bossmusik aktivieren."); BossMusicRange = ((BaseUnityPlugin)this).Config.Bind<float>("Boss Music", "BossMusicRange", 35f, "Reichweite der Bossmusik um den Boss herum."); BossMusicVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Boss Music", "BossMusicVolume", 0.65f, "Lautstärke der Bossmusik von 0.0 bis 1.0."); new Harmony("de.insanity.events").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"InsanityEvents 2.1.0 loaded."); } } } namespace InsanityEvents.Events { public class BossProtocolEvent : ChaosEvent { public override string Name => "BOSS PROTOCOL"; public override string Description => "Ein zufälliger Gegner wird zum Boss. 4 Schrottflinten sollen spawnen."; public override int MinChaosLevel => 8; public override bool IsBossEvent => true; public override bool IsUltraEvent => true; public override void StartEvent(ChaosRunContext context) { Debug.Log((object)"Boss Protocol: 4 Shotguns spawnen vorbereiten."); Debug.Log((object)"Boss Protocol: Boss auswählen, HP erhöhen, Bossbar und Partikeleffekt vorbereiten."); Transform val = TryFindAnyEnemyTransform(); if ((Object)(object)val != (Object)null) { BossMusicController.Create(val); BossUiController.CreateFakeBossBar(((Object)val).name + " PRIME", 1f); context.Message("BOSS MUSIC", "Bedrohliche Musik startet, wenn du dich dem Boss näherst."); } else { Debug.LogWarning((object)"Boss Protocol: Kein Gegner gefunden. Bossmusik wird nicht gestartet."); } } private Transform TryFindAnyEnemyTransform() { EnemyAI[] array = Object.FindObjectsOfType<EnemyAI>(); if (array == null || array.Length == 0) { return null; } EnemyAI val = array[Random.Range(0, array.Length)]; if ((Object)(object)val == (Object)null) { return null; } TryBuffBoss(val); return ((Component)val).transform; } private void TryBuffBoss(EnemyAI enemy) { //IL_0019: 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_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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)enemy == (Object)null)) { Transform transform = ((Component)enemy).transform; transform.localScale *= 1.75f; ParticleSystem val = ((Component)enemy).gameObject.AddComponent<ParticleSystem>(); MainModule main = val.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.55f, 0f, 0f)); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(1.25f); ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(1.2f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(18f); Debug.Log((object)"Boss Protocol: Boss gebufft und Partikeleffekt hinzugefügt."); } } } public class CursedCrewEvent : ChaosEvent { private readonly string[] curses = new string[6] { "Reverse Controls", "Low Vision", "Random Damage", "Hallucinations", "Random Teleport", "Slow Movement" }; public override string Name => "CURSED CREW"; public override string Description => "Jeder Spieler erhält einen zufälligen Fluch."; public override int MinChaosLevel => 8; public override bool IsUltraEvent => true; public override void StartEvent(ChaosRunContext context) { if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayerScripts == null) { return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val == (Object)null)) { string text = curses[Random.Range(0, curses.Length)]; Debug.Log((object)("Cursed Crew: " + val.playerUsername + " bekommt Fluch: " + text)); } } } } public class DarknessProtocolEvent : ChaosEvent { public override string Name => "DARKNESS PROTOCOL"; public override string Description => "Die Anlage liegt in fast völliger Dunkelheit."; public override int MinChaosLevel => 4; public override void StartEvent(ChaosRunContext context) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) RenderSettings.ambientLight = Color.black; } } public class EndlessHuntEvent : ChaosEvent { public override string Name => "ENDLESS HUNT"; public override string Description => "Jede Minute soll ein neuer Gegner erscheinen."; public override int MinChaosLevel => 5; public override void StartEvent(ChaosRunContext context) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("InsanityEvents_EndlessHunt"); val.AddComponent<EndlessHuntBehaviour>(); Object.DontDestroyOnLoad((Object)(object)val); } } public class EndlessHuntBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class <Start>d__0 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public EndlessHuntBehaviour <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Start>d__0(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; Debug.Log((object)"Endless Hunt: Gegner-Spawn vorbereiten. Konkreter Spawn muss versionabhängig angebunden werden."); break; } <>2__current = (object)new WaitForSeconds(60f); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [IteratorStateMachine(typeof(<Start>d__0))] private IEnumerator Start() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Start>d__0(0) { <>4__this = this }; } } public class GiantFacilityEvent : ChaosEvent { public override string Name => "GIANT FACILITY"; public override string Description => "Die Anlage scheint endlos zu sein."; public override int MinChaosLevel => 7; public override void StartEvent(ChaosRunContext context) { if ((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.currentLevel != (Object)null) { SelectableLevel currentLevel = StartOfRound.Instance.currentLevel; currentLevel.factorySizeMultiplier *= 4f; } } } public class HallucinationEvent : ChaosEvent { public override string Name => "HALLUCINATIONS"; public override string Description => "Spieler hören und sehen Dinge, die nicht echt sind."; public override int MinChaosLevel => 6; public override bool IsHallucinationEvent => true; public override void StartEvent(ChaosRunContext context) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("InsanityEvents_Hallucinations"); val.AddComponent<HallucinationBehaviour>(); Object.DontDestroyOnLoad((Object)(object)val); } } public class HallucinationBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class <Start>d__0 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public HallucinationBehaviour <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Start>d__0(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; Debug.Log((object)"Hallucination: Fake-Geräusch/Fake-Monster vorbereiten."); break; } <>2__current = (object)new WaitForSeconds(Random.Range(20f, 60f)); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [IteratorStateMachine(typeof(<Start>d__0))] private IEnumerator Start() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Start>d__0(0) { <>4__this = this }; } } public class ShotgunMadnessEvent : ChaosEvent { public override string Name => "SHOTGUN MADNESS"; public override string Description => "Schrotflinten-Wahnsinn: Dieses Event ist als Loot-Mutator vorbereitet."; public override int MinChaosLevel => 2; public override void StartEvent(ChaosRunContext context) { Debug.Log((object)"Shotgun Madness aktiviert. Loot-Spawn muss je nach Lethal Company Version angebunden werden."); } } public class SwarmEvent : ChaosEvent { public override string Name => "THE SWARM"; public override string Description => "Ultra-Event: 100 Gegner werden vorbereitet."; public override int MinChaosLevel => 8; public override bool IsUltraEvent => true; public override void StartEvent(ChaosRunContext context) { for (int i = 0; i < 100; i++) { Debug.Log((object)("THE SWARM: Gegner #" + (i + 1) + " Spawn vorbereiten.")); } } } public class WeatherChaosEvent : ChaosEvent { public override string Name => "BLOOD STORM"; public override string Description => "Ein unnatürlicher Sturm verschlechtert Sicht und Stimmung."; public override int MinChaosLevel => 4; public override bool IsWeatherEvent => true; public override void StartEvent(ChaosRunContext context) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) RenderSettings.fog = true; RenderSettings.fogDensity = 0.08f; RenderSettings.fogColor = new Color(0.35f, 0.02f, 0.02f); } } }