using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NoRainParticles")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+59934f601cac64d0499828fc202711abc8a17992")] [assembly: AssemblyProduct("NoRainParticles")] [assembly: AssemblyTitle("NoRainParticles")] [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 NoRainParticles { [BepInPlugin("MysticDEV.NoRainParticles", "NoRainParticles", "1.0.4")] public class NoRainParticlesPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(StartOfRound), "Start")] internal class StartPatch { [HarmonyPostfix] private static void SubscribeToLandingEvent(StartOfRound __instance) { __instance.StartedLandingShip += OnShipStartedLanding; ManualLogSource? logger = NoRainParticlesPlugin.logger; if (logger != null) { logger.LogInfo((object)"Subscribed to StartedLandingShip event"); } } } [CompilerGenerated] private sealed class d__6 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: { <>1__state = -1; ManualLogSource? logger = NoRainParticlesPlugin.logger; if (logger != null) { logger.LogInfo((object)"Delayed scan executing..."); } DisableRainParticles(); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; return true; } case 2: <>1__state = -1; DisableRainParticles(); 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(); } } internal static ManualLogSource? logger; private readonly Harmony harmony = new Harmony("MysticDEV.NoRainParticles"); private static NoRainParticlesPlugin? instance; private void Awake() { instance = this; logger = ((BaseUnityPlugin)this).Logger; harmony.PatchAll(); logger.LogInfo((object)"NoRainParticles v1.0.4 is loaded!"); } private static void OnShipStartedLanding() { ManualLogSource? obj = logger; if (obj != null) { obj.LogInfo((object)"StartedLandingShip event fired - starting delayed rain particle scan..."); } NoRainParticlesPlugin? noRainParticlesPlugin = instance; if (noRainParticlesPlugin != null) { ((MonoBehaviour)noRainParticlesPlugin).StartCoroutine(DelayedDisableRainParticles()); } } [IteratorStateMachine(typeof(d__6))] private static IEnumerator DelayedDisableRainParticles() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__6(0); } public static void DisableRainParticles() { //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) try { int num = 0; ParticleSystem[] array = Object.FindObjectsOfType(); ManualLogSource? obj = logger; if (obj != null) { obj.LogInfo((object)$"Scanning {array.Length} particle systems..."); } ParticleSystem[] array2 = array; foreach (ParticleSystem val in array2) { if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null) { continue; } string text = ((Object)((Component)val).gameObject).name.ToLower(); string text2 = (((Object)(object)((Component)val).transform.parent != (Object)null) ? ((Object)((Component)val).transform.parent).name.ToLower() : ""); bool num2 = text.Contains("rain") || text2.Contains("rain") || (text2.Contains("storm") && text.Contains("particle")); bool flag = text.Contains("lightning") || text.Contains("thunder") || text.Contains("bolt") || text.Contains("strike") || text.Contains("puddle") || text.Contains("splash") || text.Contains("mud") || text.Contains("ground") || text.Contains("magnet") || text.Contains("spark") || text.Contains("electric") || text.Contains("charge") || text.Contains("static") || text.Contains("blast") || text.Contains("warning") || text.Contains("flash") || text2.Contains("magnet") || (text2.Contains("stormy") && (text.Contains("static") || text.Contains("blast") || text.Contains("warning"))); if (num2 && !flag) { val.Stop(true, (ParticleSystemStopBehavior)0); val.Clear(); EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).enabled = false; ParticleSystemRenderer component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = false; ((Renderer)component).forceRenderingOff = true; } ((Component)val).gameObject.SetActive(false); num++; ManualLogSource? obj2 = logger; if (obj2 != null) { string[] obj3 = new string[5] { "DISABLED: '", ((Object)((Component)val).gameObject).name, "' (Parent: '", null, null }; Transform parent = ((Component)val).transform.parent; obj3[3] = ((parent != null) ? ((Object)parent).name : null) ?? "None"; obj3[4] = "')"; obj2.LogInfo((object)string.Concat(obj3)); } } } ManualLogSource? obj4 = logger; if (obj4 != null) { obj4.LogInfo((object)$"Scan complete - Disabled {num} rain particle systems"); } } catch (Exception ex) { ManualLogSource? obj5 = logger; if (obj5 != null) { obj5.LogError((object)("Error disabling rain particles: " + ex.Message)); } } } } }