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 ScarletDevilMoon v1.1.5
Scarlet Devil Mansion Moon.dll
Decompiled 4 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; 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("Scarlet Devil Mansion Moon")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Scarlet Devil Mansion Moon")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8f1fdb3b-3191-4c1f-b67b-e1cdf9efba92")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.1.0.0")] [BepInPlugin("napougi.SDMconfig", "Scarlet Devil Mansion Config", "1.1.6")] public class ParticleConfigPlugin : BaseUnityPlugin { private ConfigEntry<float> particlePercentage; private const string TargetSceneName = "SDM2 scene"; private Dictionary<ParticleSystem, int> originalMaxParticles = new Dictionary<ParticleSystem, int>(); private void Awake() { ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; particlePercentage = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Particle Percentage", 100f, "Percentage of max particles (Embers, and Mist flooring)."); ClearOrphanedEntries(((BaseUnityPlugin)this).Config); ((BaseUnityPlugin)this).Config.Save(); ((BaseUnityPlugin)this).Config.SaveOnConfigSet = true; SceneManager.sceneLoaded += OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (((Scene)(ref scene)).name != "SDM2 scene") { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Scene '" + ((Scene)(ref scene)).name + "' does not match target 'SDM2 scene'. Skipping particle limit adjustments.")); return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Scene '" + ((Scene)(ref scene)).name + "' matched target. Applying particle limits...")); ApplyParticleLimits(); } private void ApplyParticleLimits() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Environment"); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Could not find 'Environment' in the scene."); return; } Transform val2 = val.transform.Find("SDM particle systems"); if ((Object)(object)val2 == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"'SDM particle systems' not found inside 'Environment'."); return; } GameObject gameObject = ((Component)val2).gameObject; ParticleSystem[] componentsInChildren = gameObject.GetComponentsInChildren<ParticleSystem>(); foreach (ParticleSystem val3 in componentsInChildren) { MainModule main = val3.main; if (!originalMaxParticles.ContainsKey(val3)) { originalMaxParticles[val3] = ((MainModule)(ref main)).maxParticles; } int num = Mathf.RoundToInt((float)originalMaxParticles[val3] * (particlePercentage.Value / 100f)); if (((MainModule)(ref main)).maxParticles != num) { ((MainModule)(ref main)).maxParticles = num; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Updated {((Object)((Component)val3).gameObject).name} max particles to {num} ({particlePercentage.Value}%)."); } } } private static void ClearOrphanedEntries(ConfigFile cfg) { PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries"); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg); dictionary.Clear(); } } public class Enable_Ice : MonoBehaviour { private HashSet<GameObject> growingObjects = new HashSet<GameObject>(); private void Start() { } private void Update() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 10f); Collider[] array2 = array; foreach (Collider val in array2) { if (!(((Object)((Component)val).gameObject).name == "Ice trigger")) { continue; } Transform child = ((Component)val).transform.GetChild(0); Transform child2 = ((Component)val).transform.GetChild(1); AudioSource component = ((Component)val).gameObject.GetComponent<AudioSource>(); if (!((Component)child).gameObject.activeSelf) { ((Component)child).gameObject.SetActive(true); Debug.Log((object)(((Object)((Component)child).gameObject).name + " has been enabled")); ((Component)child2).gameObject.SetActive(true); Debug.Log((object)(((Object)((Component)child2).gameObject).name + " has been enabled")); if ((Object)(object)component != (Object)null) { component.Play(); Debug.Log((object)"Playing Ice frozen audio"); } if (!growingObjects.Contains(((Component)val).gameObject)) { growingObjects.Add(((Component)val).gameObject); ((MonoBehaviour)this).StartCoroutine(GrowObject(((Component)val).gameObject)); } } } } private IEnumerator GrowObject(GameObject obj) { Vector3 targetScale = obj.transform.localScale; Vector3 initialScale = targetScale * 0.33f; obj.transform.localScale = initialScale; float duration = 2f; float elapsed = 0f; while (elapsed < duration) { obj.transform.localScale = Vector3.Lerp(initialScale, targetScale, elapsed / duration); elapsed += Time.deltaTime; yield return null; } obj.transform.localScale = targetScale; growingObjects.Remove(obj); } } public class laugh_source : MonoBehaviour { private float targetTime; private bool has_played; private void Start() { targetTime = GetRandomTime(); } private void Update() { AudioSource val = default(AudioSource); if (!has_played && TimeOfDay.Instance.normalizedTimeOfDay >= targetTime && ((Component)this).TryGetComponent<AudioSource>(ref val)) { val.Play(); has_played = true; } } private float GetRandomTime() { Random random = new Random(StartOfRound.Instance.randomMapSeed + 727); return (float)random.NextDouble(); } }