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 CoolerEclipse v1.2.0
CoolerEclipse.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using On.RoR2; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering.PostProcessing; using UnityEngine.SceneManagement; [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("CoolerEclipse")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+69a9d34d5e0ba1c14a26f19179afae09bfc47d8f")] [assembly: AssemblyProduct("CoolerEclipse")] [assembly: AssemblyTitle("CoolerEclipse")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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 CoolerEclipse { [BepInPlugin("com.Nuxlar.CoolerEclipse", "CoolerEclipse", "1.2.0")] public class CoolerEclipse : BaseUnityPlugin { private GameObject eclipseWeather = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/eclipseworld/Weather, Eclipse.prefab").WaitForCompletion(); public static ConfigEntry<bool> shouldBeChance; public static ConfigEntry<bool> shouldAlwaysApply; private Random rng; private static ConfigFile CEConfig { get; set; } public void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown CEConfig = new ConfigFile(Paths.ConfigPath + "\\com.Nuxlar.CoolerEclipse.cfg", true); shouldBeChance = CEConfig.Bind<bool>("General", "Chance Based", false, "Make the weather changes be a 50% chance instead of guaranteed."); shouldAlwaysApply = CEConfig.Bind<bool>("General", "Normal Runs", true, "Makes the weather changes apply to non-Eclipse runs."); rng = new Random(); eclipseWeather.AddComponent<NetworkIdentity>(); SceneDirector.Start += new hook_Start(AddSkybox); } private void AddSkybox(orig_Start orig, SceneDirector self) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0075: Invalid comparison between Unknown and I4 //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) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) GameObject[] source = Object.FindObjectsOfType<GameObject>(); Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; List<GameModeIndex> list = new List<GameModeIndex> { GameModeCatalog.FindGameModeIndex("ClassicRun(Clone)"), GameModeCatalog.FindGameModeIndex("EclipseRun(Clone)") }; if (Object.op_Implicit((Object)(object)Run.instance) && list.Contains(Run.instance.gameModeIndex) && (shouldAlwaysApply.Value || (int)Run.instance.selectedDifficulty >= 3) && name != "moon2") { int seed = (int)(Run.instance.GetStartTimeUtc().Ticks ^ (Run.instance.stageClearCount << 16)); rng = new Random(seed); if (shouldBeChance.Value && rng.NextDouble() > 0.5) { orig.Invoke(self); return; } if (source.Where((GameObject obj) => ((Object)obj).name.Contains("Weather,")).Count() > 0) { source.Where((GameObject obj) => ((Object)obj).name.Contains("Weather,")).First().SetActive(false); if (source.Where((GameObject obj) => ((Object)obj).name == "Sun").Count() > 0) { source.Where((GameObject obj) => ((Object)obj).name == "Sun").First().SetActive(false); } } else { GameObject val = GameObject.Find("Directional Light (SUN)"); GameObject val2 = GameObject.Find("PP + Amb"); GameObject val3 = GameObject.Find("Reflection Probe"); if (Object.op_Implicit((Object)(object)val) && name != "moon2" && name != "skymeadow") { val.SetActive(false); } if (Object.op_Implicit((Object)(object)val2)) { val2.SetActive(false); } if (Object.op_Implicit((Object)(object)val3)) { val3.SetActive(false); } if (Object.op_Implicit((Object)(object)GameObject.Find("Reflection Probe"))) { val3.SetActive(false); } } GameObject val4 = Object.Instantiate<GameObject>(eclipseWeather, new Vector3(0f, 0f, 0f), Quaternion.identity); Light component = ((Component)val4.transform.GetChild(1)).GetComponent<Light>(); component.shadowStrength = 0.25f; SetAmbientLight component2 = ((Component)val4.transform.GetChild(2)).GetComponent<SetAmbientLight>(); component2.ambientIntensity = 0.75f; component2.ApplyLighting(); if (name == "blackbeach" || name == "moon2") { ((Component)val4.transform.GetChild(2)).GetComponent<PostProcessVolume>().priority = 9999f; } ((Component)val4.transform.GetChild(0)).GetComponent<ReflectionProbe>().Reset(); ((Component)val4.transform.GetChild(3).GetChild(2)).gameObject.SetActive(true); if (name.Contains("blackbeach") || name.Contains("golemplains")) { component2.ambientIntensity = 1f; component2.ApplyLighting(); } if (name == "snowyforest") { component2.ambientIntensity = 0.5f; component2.ApplyLighting(); GameObject val5 = GameObject.Find("Treecards"); if (Object.op_Implicit((Object)(object)val5)) { val5.SetActive(false); } } if (name == "frozenwall") { component.intensity = 0.25f; component2.ambientIntensity = 0.25f; component2.ApplyLighting(); } if (name == "rootjungle") { ((Component)val4.transform.GetChild(0)).gameObject.SetActive(false); GameObject val6 = GameObject.Find("HOLDER: Weather Set 1"); if (Object.op_Implicit((Object)(object)val6)) { val6.gameObject.SetActive(false); } } if (name.Contains("skymeadow")) { ((Component)val4.transform.GetChild(1)).gameObject.SetActive(false); GameObject.Find("Directional Light (SUN)").GetComponent<Light>().color = component.color; component2.ambientIntensity = 1f; component2.ApplyLighting(); GameObject val7 = GameObject.Find("ShatteredMoonMesh"); if (Object.op_Implicit((Object)(object)val7)) { ((Renderer)val7.GetComponent<MeshRenderer>()).sortingOrder = -1; } } if (name == "dampcavesimple") { GameObject val8 = GameObject.Find("Main Camera(Clone)"); if (Object.op_Implicit((Object)(object)val8)) { ((Component)val8.transform.GetChild(0)).GetComponent<PostProcessLayer>().breakBeforeColorGrading = true; } if (Object.op_Implicit((Object)(object)GameObject.Find("DCPPInTunnels"))) { GameObject.Find("DCPPInTunnels").SetActive(false); } component2.ambientIntensity = 1.25f; component2.ApplyLighting(); } if (name == "moon2") { ((Component)val4.transform.GetChild(1)).gameObject.SetActive(false); GameObject.Find("Directional Light (SUN)").GetComponent<Light>().color = component.color; component2.ambientIntensity = 0.5f; component2.ApplyLighting(); GameObject val9 = GameObject.Find("Moon"); if (Object.op_Implicit((Object)(object)val9)) { ((Renderer)val9.GetComponent<MeshRenderer>()).sortingOrder = -1; } } NetworkServer.Spawn(val4); } orig.Invoke(self); } } }