RUMBLE does not support other mod managers. If you want to use a manager, you must use the RUMBLE Mod Manager, a manager specifically designed for this game.
Decompiled source of GrassEnabler v3.2.1
Mods/GrassEnabler.dll
Decompiled 3 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using GrassEnabler; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppRUMBLE.Interactions.InteractionBase; using Il2CppRUMBLE.MoveSystem; using MelonLoader; using MelonLoader.Preferences; using RumbleModdingAPI.RMAPI; using UIFramework; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Main), "GrassEnabler", "3.2.1", "UlvakSkillz", null)] [assembly: MelonGame("Buckethead Entertainment", "RUMBLE")] [assembly: MelonColor(255, 195, 0, 255)] [assembly: MelonAuthorColor(255, 195, 0, 255)] [assembly: VerifyLoaderVersion(0, 7, 2, true)] [assembly: MelonAdditionalDependencies(new string[] { "UIFramework" })] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("GrassEnabler")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+07053fb655eabc947f8604fbbb636fde11c4885d")] [assembly: AssemblyProduct("GrassEnabler")] [assembly: AssemblyTitle("GrassEnabler")] [assembly: AssemblyVersion("1.0.0.0")] namespace GrassEnabler; [RegisterTypeInIl2Cpp] public class ColliderCheck : MonoBehaviour { private void OnTriggerEnter(Collider other) { Structure val = ((Component)other).gameObject.GetComponent<Structure>(); if ((Object)(object)val == (Object)null) { val = ((Component)other).GetComponentInParent<Structure>(); if ((Object)(object)val == (Object)null) { val = ((Component)other).GetComponentInChildren<Structure>(); } } if (!((Object)(object)val == (Object)null) && Preferences.PrefRemoval.Value && (val.IsGrounded || val.IsSpawning)) { ((Component)((Component)this).transform).gameObject.SetActive(false); if (Preferences.PrefRegrow.Value) { MelonCoroutines.Start(Main.RegrowGrass(((Component)((Component)this).transform).gameObject)); } } } private void OnTriggerExit(Collider other) { if (!((Component)((Component)this).transform).gameObject.activeSelf) { return; } Structure val = ((Component)other).gameObject.GetComponent<Structure>(); if ((Object)(object)val == (Object)null) { val = ((Component)other).GetComponentInParent<Structure>(); if ((Object)(object)val == (Object)null) { val = ((Component)other).GetComponentInChildren<Structure>(); } } if (!((Object)(object)val == (Object)null) && Preferences.PrefRemoval.Value && (val.IsGrounded || val.IsSpawning)) { ((Component)((Component)this).transform).gameObject.SetActive(false); if (Preferences.PrefRegrow.Value) { MelonCoroutines.Start(Main.RegrowGrass(((Component)((Component)this).transform).gameObject)); } } } } public static class ModBuildInfo { public const string Version = "3.2.1"; } public class Main : MelonMod { [CompilerGenerated] private sealed class <InitFlatLandFound>d__21 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Main <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InitFlatLandFound>d__21(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; GameObject.Find("FlatLand/FlatLandButton/Button").GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { <>4__this.flatLandActive = true; MelonCoroutines.Start(<>4__this.SetupFlatLand()); })); 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 <MapStartGrassGrow>d__27 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Main <>4__this; private bool <isPark>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <MapStartGrassGrow>d__27(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: 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_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 1; return true; case 1: <>1__state = -1; <isPark>5__1 = false; if ((Object)(object)<>4__this.storedGrass == (Object)null) { return false; } if (<>4__this.currentScene == "Gym") { <>4__this.storedGrass.transform.position = new Vector3(0f, -0.01f - 0.039f * Preferences.PrefHeight.Value, 0f); } else if (<>4__this.currentScene == "Park") { <isPark>5__1 = true; <>4__this.storedGrass.transform.position = new Vector3(-3.1f, -5.88f - 0.039f * Preferences.PrefHeight.Value, 0.4f); <>4__this.storedLowerParkGrass.transform.position = new Vector3(1.5778f, -20.9404f - 0.039f * Preferences.PrefHeight.Value, 4.9215f); } else if (<>4__this.currentScene == "Map0") { <>4__this.storedGrass.transform.position = new Vector3(0f, -0.23f - 0.039f * Preferences.PrefHeight.Value, 0f); } else { if (!(<>4__this.currentScene == "Map1")) { return false; } <>4__this.storedGrass.transform.position = new Vector3(0f, 0f - 0.039f * Preferences.PrefHeight.Value, 0f); } <>4__this.storedGrass.SetActive(true); if (Preferences.PrefRegrow.Value) { <>4__this.storedGrass.transform.localScale = new Vector3(1f, 0f, 1f); if (<isPark>5__1) { <>4__this.storedLowerParkGrass.transform.localScale = new Vector3(1f, 0f, 1f); <>4__this.storedLowerParkGrass.SetActive(true); } goto IL_03cf; } if (<isPark>5__1) { <>4__this.storedLowerParkGrass.SetActive(true); } break; case 2: { <>1__state = -1; if ((Object)(object)<>4__this.storedGrass == (Object)null) { return false; } goto IL_03cf; } IL_0399: <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 2; return true; IL_03cf: if (!((Object)(object)<>4__this.storedGrass != (Object)null) || !(<>4__this.storedGrass.transform.localScale.y < 1f)) { break; } try { if (Preferences.PrefGrowthTime.Value == 0f) { break; } <>4__this.storedGrass.transform.localScale = new Vector3(1f, <>4__this.storedGrass.transform.localScale.y + 1f / (Preferences.PrefGrowthTime.Value * 50f), 1f); if (<isPark>5__1) { <>4__this.storedLowerParkGrass.transform.localScale = new Vector3(1f, <>4__this.storedLowerParkGrass.transform.localScale.y + 1f / (Preferences.PrefGrowthTime.Value * 50f), 1f); } goto IL_0399; } catch { } break; } try { if ((Object)(object)<>4__this.storedGrass != (Object)null) { <>4__this.storedGrass.transform.localScale = new Vector3(1f, 1f, 1f); } if (<isPark>5__1) { <>4__this.storedLowerParkGrass.transform.localScale = new Vector3(1f, 1f, 1f); } } catch { } 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 <RegrowGrass>d__22 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GameObject grass; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RegrowGrass>d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(Preferences.PrefTimeBeforeRegrow.Value); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)grass == (Object)null) { return false; } grass.transform.localScale = new Vector3(Preferences.PrefWidth.Value, 0f, Preferences.PrefWidth.Value); grass.SetActive(true); break; case 2: <>1__state = -1; if ((Object)(object)grass == (Object)null) { return false; } break; } if ((Object)(object)grass != (Object)null && grass.transform.localScale.y <= Preferences.PrefHeight.Value) { try { if (Preferences.PrefGrowthTime.Value != 0f) { grass.transform.localScale = new Vector3(Preferences.PrefWidth.Value, grass.transform.localScale.y + Preferences.PrefHeight.Value / (Preferences.PrefGrowthTime.Value * 50f), Preferences.PrefWidth.Value); goto IL_012b; } } catch { return false; } } if ((Object)(object)grass != (Object)null) { grass.transform.localScale = new Vector3(Preferences.PrefWidth.Value, Preferences.PrefHeight.Value, Preferences.PrefWidth.Value); } return false; IL_012b: <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 2; 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(); } } [CompilerGenerated] private sealed class <SetupFlatLand>d__28 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Main <>4__this; private GameObject <floor>5__1; private int <i>5__2; private float <x>5__3; private float <z>5__4; private Vector3 <grassSpot>5__5; private Quaternion <grassRotation>5__6; private GameObject <grass>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SetupFlatLand>d__28(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <floor>5__1 = null; <grass>5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; <floor>5__1 = GameObject.Find("Floor"); <>4__this.flatLandSize = (int)<floor>5__1.transform.localScale.x / 2; <i>5__2 = 0; goto IL_03c4; case 2: { <>1__state = -1; goto IL_03aa; } IL_03c4: if (<i>5__2 < Preferences.PrefUpperParkCount.Value) { <x>5__3 = <floor>5__1.transform.position.x + (float)random.Next(-<>4__this.flatLandSize, <>4__this.flatLandSize + 1); if (<x>5__3 < <floor>5__1.transform.position.x) { <x>5__3 += (float)random.NextDouble(); } else if (<x>5__3 > <floor>5__1.transform.position.x) { <x>5__3 -= (float)random.NextDouble(); } else if (random.Next(0, 2) == 0) { <x>5__3 += (float)random.NextDouble(); } else { <x>5__3 -= (float)random.NextDouble(); } <z>5__4 = <floor>5__1.transform.position.z + (float)random.Next(-<>4__this.flatLandSize, <>4__this.flatLandSize + 1); if (<z>5__4 < <floor>5__1.transform.position.z) { <z>5__4 += (float)random.NextDouble(); } else if (<z>5__4 > <floor>5__1.transform.position.z) { <z>5__4 -= (float)random.NextDouble(); } else if (random.Next(0, 2) == 0) { <z>5__4 += (float)random.NextDouble(); } else { <z>5__4 -= (float)random.NextDouble(); } <grassSpot>5__5 = new Vector3(<x>5__3, 0f, <z>5__4); <grassRotation>5__6 = Quaternion.EulerAngles(0f, (float)random.Next(0, 361), 0f); <grass>5__7 = ((Component)<>4__this.storedGrass.transform.GetChild(<i>5__2)).gameObject; <grass>5__7.transform.localPosition = <grassSpot>5__5; <grass>5__7.transform.rotation = <grassRotation>5__6; <grass>5__7.transform.localScale = new Vector3(Preferences.PrefWidth.Value, Preferences.PrefHeight.Value, Preferences.PrefWidth.Value); <grass>5__7.SetActive(true); if (<i>5__2 % 100 == 0) { <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 2; return true; } goto IL_03aa; } if (<>4__this.currentScene == "Gym") { MelonCoroutines.Start(<>4__this.MapStartGrassGrow()); } MelonCoroutines.Start(<>4__this.WatchFloorSize(<floor>5__1)); return false; IL_03aa: <grass>5__7 = null; <i>5__2++; goto IL_03c4; } } 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 <SetupMap0>d__30 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Main <>4__this; private int <i>5__1; private Vector3 <pickedSpot>5__2; private Vector3 <grassSpot>5__3; private Quaternion <grassRotation>5__4; private GameObject <grass>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SetupMap0>d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <grass>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_0159; } <>1__state = -1; <i>5__1 = 0; goto IL_0171; IL_0159: <grass>5__5 = null; <i>5__1++; goto IL_0171; IL_0171: if (<i>5__1 < Preferences.PrefRingCount.Value) { <pickedSpot>5__2 = <>4__this.CalculatePoint(11f, -0.31f); <grassSpot>5__3 = new Vector3(<pickedSpot>5__2.x, 0f, <pickedSpot>5__2.z); <grassRotation>5__4 = Quaternion.EulerAngles(0f, (float)random.Next(0, 361), 0f); <grass>5__5 = ((Component)<>4__this.storedGrass.transform.GetChild(<i>5__1)).gameObject; <grass>5__5.transform.localPosition = <grassSpot>5__3; <grass>5__5.transform.rotation = <grassRotation>5__4; <grass>5__5.transform.localScale = new Vector3(Preferences.PrefWidth.Value, Preferences.PrefHeight.Value, Preferences.PrefWidth.Value); <grass>5__5.SetActive(true); if (<i>5__1 % 100 == 0) { <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 1; return true; } goto IL_0159; } if (<>4__this.currentScene == "Map0") { MelonCoroutines.Start(<>4__this.MapStartGrassGrow()); } 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 <SetupMap1>d__31 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Main <>4__this; private int <i>5__1; private Vector3 <pickedSpot>5__2; private Vector3 <grassSpot>5__3; private Quaternion <grassRotation>5__4; private GameObject <grass>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SetupMap1>d__31(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <grass>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_0165; } <>1__state = -1; <i>5__1 = 0; goto IL_017d; IL_0165: <grass>5__5 = null; <i>5__1++; goto IL_017d; IL_017d: if (<i>5__1 < Preferences.PrefPitCount.Value) { <pickedSpot>5__2 = <>4__this.CalculatePoint(10f, -0.03f); <grassSpot>5__3 = new Vector3(<pickedSpot>5__2.x * 1.5f, 0f, <pickedSpot>5__2.z * 1.1f); <grassRotation>5__4 = Quaternion.EulerAngles(0f, (float)random.Next(0, 361), 0f); <grass>5__5 = ((Component)<>4__this.storedGrass.transform.GetChild(<i>5__1)).gameObject; <grass>5__5.transform.localPosition = <grassSpot>5__3; <grass>5__5.transform.rotation = <grassRotation>5__4; <grass>5__5.transform.localScale = new Vector3(Preferences.PrefWidth.Value, Preferences.PrefHeight.Value, Preferences.PrefWidth.Value); <grass>5__5.SetActive(true); if (<i>5__1 % 100 == 0) { <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 1; return true; } goto IL_0165; } if (<>4__this.currentScene == "Map1") { MelonCoroutines.Start(<>4__this.MapStartGrassGrow()); } 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 <SetupParkLowerGrass>d__33 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Main <>4__this; private int <i>5__1; private Vector3 <ringSpot>5__2; private Vector3 <grassSpot>5__3; private Quaternion <grassRotation>5__4; private GameObject <grass>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SetupParkLowerGrass>d__33(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <grass>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_017f; } <>1__state = -1; <i>5__1 = 0; goto IL_0197; IL_017f: <grass>5__5 = null; <i>5__1++; goto IL_0197; IL_0197: if (<i>5__1 < Preferences.PrefLowerParkCount.Value) { <ringSpot>5__2 = new Vector3(0f, -5.88f, 0f); <grassSpot>5__3 = <>4__this.CalculatePoint(25f, -0.31f); <grassRotation>5__4 = Quaternion.EulerAngles(0f, (float)random.Next(0, 361), 0f); <grass>5__5 = ((Component)<>4__this.storedLowerParkGrass.transform.GetChild(<i>5__1)).gameObject; <grass>5__5.transform.localPosition = new Vector3(<ringSpot>5__2.x + <grassSpot>5__3.x, 0f, <ringSpot>5__2.z + <grassSpot>5__3.z); <grass>5__5.transform.rotation = <grassRotation>5__4; <grass>5__5.transform.localScale = new Vector3(Preferences.PrefWidth.Value, Preferences.PrefHeight.Value, Preferences.PrefWidth.Value); <grass>5__5.SetActive(true); if (<i>5__1 % 100 == 0) { <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 1; return true; } goto IL_017f; } if (<>4__this.currentScene == "Park") { MelonCoroutines.Start(<>4__this.MapStartGrassGrow()); } 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 <SetupParkUpperGrass>d__32 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Main <>4__this; private int <i>5__1; private Vector3 <ringSpot>5__2; private Vector3 <grassSpot>5__3; private Quaternion <grassRotation>5__4; private GameObject <grass>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SetupParkUpperGrass>d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <grass>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_017f; } <>1__state = -1; <i>5__1 = 0; goto IL_0197; IL_017f: <grass>5__5 = null; <i>5__1++; goto IL_0197; IL_0197: if (<i>5__1 < Preferences.PrefUpperParkCount.Value) { <ringSpot>5__2 = new Vector3(0f, -5.88f, 0f); <grassSpot>5__3 = <>4__this.CalculatePoint(11f, -0.31f); <grassRotation>5__4 = Quaternion.EulerAngles(0f, (float)random.Next(0, 361), 0f); <grass>5__5 = ((Component)<>4__this.storedGrass.transform.GetChild(<i>5__1)).gameObject; <grass>5__5.transform.localPosition = new Vector3(<ringSpot>5__2.x + <grassSpot>5__3.x, 0f, <ringSpot>5__2.z + <grassSpot>5__3.z); <grass>5__5.transform.rotation = <grassRotation>5__4; <grass>5__5.transform.localScale = new Vector3(Preferences.PrefWidth.Value, Preferences.PrefHeight.Value, Preferences.PrefWidth.Value); <grass>5__5.SetActive(true); if (<i>5__1 % 100 == 0) { <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 1; return true; } goto IL_017f; } 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 <SetupStoredGrass>d__24 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Main <>4__this; private int <i>5__1; private int <pickedGrass>5__2; private GameObject <whichGrass>5__3; private GameObject <grass>5__4; private int <i>5__5; private int <pickedGrass>5__6; private GameObject <whichGrass>5__7; private GameObject <grass>5__8; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SetupStoredGrass>d__24(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <whichGrass>5__3 = null; <grass>5__4 = null; <whichGrass>5__7 = null; <grass>5__8 = null; <>1__state = -2; } private bool MoveNext() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Expected O, but got Unknown //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)<>4__this.storedGrass != (Object)null) { Object.Destroy((Object)(object)<>4__this.storedGrass); } <>4__this.storedGrass = new GameObject(); ((Object)<>4__this.storedGrass).name = "Grass"; <>4__this.storedGrass.SetActive(false); <i>5__1 = 0; goto IL_0210; case 1: <>1__state = -1; goto IL_01ef; case 2: { <>1__state = -1; goto IL_0490; } IL_0490: <whichGrass>5__7 = null; <grass>5__8 = null; <i>5__5++; goto IL_04b1; IL_0210: if (<i>5__1 < ((<>4__this.currentScene == "Map0") ? Preferences.PrefRingCount.Value : ((<>4__this.currentScene == "Map1") ? Preferences.PrefPitCount.Value : ((<>4__this.currentScene == "Park") ? Preferences.PrefUpperParkCount.Value : Preferences.PrefFlatLandCount.Value)))) { <pickedGrass>5__2 = random.Next(0, 2); <whichGrass>5__3 = ((!Preferences.PrefRemoval.Value) ? ((<pickedGrass>5__2 == 0) ? <>4__this.grassShortNoCollider : <>4__this.grassLongNoCollider) : ((<pickedGrass>5__2 == 0) ? <>4__this.grassShort : <>4__this.grassLong)); <grass>5__4 = Object.Instantiate<GameObject>(<whichGrass>5__3, <>4__this.storedGrass.transform); if (Preferences.PrefRandomColor.Value) { RecolorGrassToRandom(<grass>5__4); } <grass>5__4.transform.position = new Vector3(0f, 0f, 0f); <grass>5__4.transform.rotation = Quaternion.EulerAngles(0f, 0f, 0f); <grass>5__4.transform.localScale = new Vector3(Preferences.PrefWidth.Value, Preferences.PrefHeight.Value, Preferences.PrefWidth.Value); if (<i>5__1 % 1000 == 0) { <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 1; return true; } goto IL_01ef; } if (<>4__this.flatLandActive) { MelonCoroutines.Start(<>4__this.SetupFlatLand()); break; } if (<>4__this.currentScene == "Park") { if ((Object)(object)<>4__this.storedLowerParkGrass != (Object)null) { Object.Destroy((Object)(object)<>4__this.storedLowerParkGrass); } <>4__this.storedLowerParkGrass = new GameObject(); ((Object)<>4__this.storedLowerParkGrass).name = "Grass Lower Park"; <>4__this.storedLowerParkGrass.SetActive(false); <i>5__5 = 0; goto IL_04b1; } if (<>4__this.currentScene == "Map0") { MelonCoroutines.Start(<>4__this.SetupMap0()); } else if (<>4__this.currentScene == "Map1") { MelonCoroutines.Start(<>4__this.SetupMap1()); } break; IL_04b1: if (<i>5__5 < Preferences.PrefLowerParkCount.Value) { <pickedGrass>5__6 = random.Next(0, 2); if (Preferences.PrefRemoval.Value) { <whichGrass>5__7 = ((<pickedGrass>5__6 == 0) ? <>4__this.grassShort : <>4__this.grassLong); } else { <whichGrass>5__7 = ((<pickedGrass>5__6 == 0) ? <>4__this.grassShortNoCollider : <>4__this.grassLongNoCollider); } <grass>5__8 = Object.Instantiate<GameObject>(<whichGrass>5__7, <>4__this.storedLowerParkGrass.transform); <grass>5__8.transform.position = new Vector3(0f, 0f, 0f); <grass>5__8.transform.rotation = Quaternion.EulerAngles(0f, 0f, 0f); <grass>5__8.transform.localScale = new Vector3(Preferences.PrefWidth.Value, Preferences.PrefHeight.Value, Preferences.PrefWidth.Value); if (<i>5__5 % 1000 == 0) { <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 2; return true; } goto IL_0490; } MelonCoroutines.Start(<>4__this.SetupParkUpperGrass()); MelonCoroutines.Start(<>4__this.SetupParkLowerGrass()); break; IL_01ef: <whichGrass>5__3 = null; <grass>5__4 = null; <i>5__1++; goto IL_0210; } 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 <WatchFloorSize>d__29 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GameObject floor; public Main <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WatchFloorSize>d__29(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; break; } if ((Object)(object)floor != (Object)null) { <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } <>4__this.storedGrass.SetActive(false); if (<>4__this.flatLandActive) { MelonCoroutines.Start(<>4__this.SetupFlatLand()); } 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(); } } private string currentScene = "Loader"; private bool init = false; private GameObject grassParent; private GameObject grassShort; private GameObject grassLong; private GameObject grassShortNoCollider; private GameObject grassLongNoCollider; private GameObject storedGrass; private GameObject storedLowerParkGrass; internal static Random random = new Random(); public static Color grassColor = HexToColor("C0B154"); internal static bool flatLandModFound = false; private bool flatLandActive = false; private int flatLandSize = 125; public override void OnLateInitializeMelon() { Actions.onMapInitialized += MapLoaded; Actions.onMyModsGathered += SetupDDOLGrass; } public override void OnInitializeMelon() { flatLandModFound = ((IEnumerable<MelonMod>)MelonTypeBase<MelonMod>.RegisteredMelons).FirstOrDefault((Func<MelonMod, bool>)((MelonMod mod) => ((MelonBase)mod).Info.Name == "FlatLand")) != null; Preferences.InitPrefs(); ((ModelModItem)UI.Register((MelonBase)(object)this, (MelonPreferences_Category[])(object)new MelonPreferences_Category[3] { Preferences.GrassCountCategory, Preferences.GrassSettingsCategory, Preferences.GrassVisualsCategory })).OnModSaved += Save; } private void SetupDDOLGrass() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_003e: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) GameObject val = AssetBundles.LoadAssetFromStream<GameObject>((MelonMod)(object)this, "GrassEnabler.grass", "Grass"); grassParent = new GameObject(); grassLong = Object.Instantiate<GameObject>(((Component)val.transform.GetChild(0)).gameObject, new Vector3(0f, 0f, 0f), Quaternion.EulerAngles(0f, 0f, 0f)); grassShort = Object.Instantiate<GameObject>(((Component)val.transform.GetChild(1)).gameObject, new Vector3(0f, 0f, 0f), Quaternion.EulerAngles(0f, 0f, 0f)); grassLongNoCollider = Object.Instantiate<GameObject>(((Component)val.transform.GetChild(2)).gameObject, new Vector3(0f, 0f, 0f), Quaternion.EulerAngles(0f, 0f, 0f)); grassShortNoCollider = Object.Instantiate<GameObject>(((Component)val.transform.GetChild(3)).gameObject, new Vector3(0f, 0f, 0f), Quaternion.EulerAngles(0f, 0f, 0f)); ((Object)grassParent).name = "GrassParent"; ((Object)grassLong).name = "GrassLong"; ((Object)grassLongNoCollider).name = "GrassLong"; ((Object)grassShort).name = "GrassShort"; ((Object)grassShortNoCollider).name = "GrassShort"; grassLong.transform.parent = grassParent.transform; grassLongNoCollider.transform.parent = grassParent.transform; grassShort.transform.parent = grassParent.transform; grassShortNoCollider.transform.parent = grassParent.transform; SetupColliders(grassLong); SetupColliders(grassShort); List<MeshRenderer> list = new List<MeshRenderer>(); list.AddRange((IEnumerable<MeshRenderer>)((Component)grassLong.transform).GetComponentsInChildren<MeshRenderer>()); list.AddRange((IEnumerable<MeshRenderer>)((Component)grassShort.transform).GetComponentsInChildren<MeshRenderer>()); list.AddRange((IEnumerable<MeshRenderer>)((Component)grassLongNoCollider.transform).GetComponentsInChildren<MeshRenderer>()); list.AddRange((IEnumerable<MeshRenderer>)((Component)grassShortNoCollider.transform).GetComponentsInChildren<MeshRenderer>()); foreach (MeshRenderer item in list) { ((Renderer)item).material.color = grassColor; } Object.DontDestroyOnLoad((Object)(object)grassParent); grassParent.SetActive(false); init = true; } internal static Color HexToColor(string hex) { //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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) try { hex = hex.Replace("0x", "").Replace("#", ""); if (hex.Length == 3) { hex = (hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]).ToString(); } else if (hex.Length == 4) { hex = (hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3]).ToString(); } byte b = byte.Parse(hex.Substring(0, 2), NumberStyles.HexNumber); byte b2 = byte.Parse(hex.Substring(2, 2), NumberStyles.HexNumber); byte b3 = byte.Parse(hex.Substring(4, 2), NumberStyles.HexNumber); byte b4 = ((hex.Length >= 8) ? byte.Parse(hex.Substring(6, 2), NumberStyles.HexNumber) : byte.MaxValue); return Color32.op_Implicit(new Color32(b, b2, b3, b4)); } catch { return HexToColor("C0B154"); } } public void Save() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if (Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefColor) || (Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefRandomColor) && !Preferences.PrefRandomColor.Value)) { grassColor = HexToColor(Preferences.PrefColor.Value); List<MeshRenderer> list = new List<MeshRenderer>(); list.AddRange((IEnumerable<MeshRenderer>)((Component)grassLong.transform).GetComponentsInChildren<MeshRenderer>()); list.AddRange((IEnumerable<MeshRenderer>)((Component)grassShort.transform).GetComponentsInChildren<MeshRenderer>()); list.AddRange((IEnumerable<MeshRenderer>)((Component)grassLongNoCollider.transform).GetComponentsInChildren<MeshRenderer>()); list.AddRange((IEnumerable<MeshRenderer>)((Component)grassShortNoCollider.transform).GetComponentsInChildren<MeshRenderer>()); foreach (MeshRenderer item in list) { ((Renderer)item).material.color = grassColor; } } if (Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefEnabled) || (Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefRingCount) && currentScene == "Map0") || (Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefPitCount) && currentScene == "Map1") || (Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefUpperParkCount) && currentScene == "Park") || (Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefLowerParkCount) && currentScene == "Park") || (Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefFlatLandCount) && currentScene == "Gym") || Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefRemoval) || Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefColor) || Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefHeight) || Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefWidth) || Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefRandomColor)) { if ((Object)(object)storedGrass != (Object)null) { Object.DestroyImmediate((Object)(object)storedGrass); } if ((Object)(object)storedLowerParkGrass != (Object)null) { Object.DestroyImmediate((Object)(object)storedLowerParkGrass); } if (Preferences.PrefEnabled.Value) { MelonCoroutines.Start(SetupStoredGrass()); } } Preferences.StoreLastSavedPrefs(); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { currentScene = sceneName; flatLandActive = false; if (flatLandModFound && currentScene == "Gym") { MelonCoroutines.Start(InitFlatLandFound()); } } private void MapLoaded(string map) { if (init && Preferences.PrefEnabled.Value) { MelonCoroutines.Start(SetupStoredGrass()); } } [IteratorStateMachine(typeof(<InitFlatLandFound>d__21))] public IEnumerator InitFlatLandFound() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InitFlatLandFound>d__21(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<RegrowGrass>d__22))] public static IEnumerator RegrowGrass(GameObject grass) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RegrowGrass>d__22(0) { grass = grass }; } private Vector3 CalculatePoint(float radius, float height) { //IL_004a: 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_0053: Unknown result type (might be due to invalid IL or missing references) double num = random.NextDouble() * Math.PI * 2.0; double num2 = Math.Sqrt(random.NextDouble()) * (double)radius; double num3 = num2 * Math.Cos(num); double num4 = num2 * Math.Sin(num); return new Vector3((float)num3, height, (float)num4); } [IteratorStateMachine(typeof(<SetupStoredGrass>d__24))] private IEnumerator SetupStoredGrass() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SetupStoredGrass>d__24(0) { <>4__this = this }; } private static void RecolorGrassToRandom(GameObject grass) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) MeshRenderer[] array = Il2CppArrayBase<MeshRenderer>.op_Implicit(((Component)grass.transform).GetComponentsInChildren<MeshRenderer>()); MeshRenderer[] array2 = array; foreach (MeshRenderer val in array2) { ((Renderer)val).material.color = new Color((float)random.Next(0, 255) / 255f, (float)random.Next(0, 255) / 255f, (float)random.Next(0, 255) / 255f); } } private void SetupColliders(GameObject grass) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) grass.layer = 14; BoxCollider val = grass.AddComponent<BoxCollider>(); ((Collider)val).isTrigger = true; val.size = new Vector3(0.1f, 1f, 0.1f); grass.AddComponent<ColliderCheck>(); } [IteratorStateMachine(typeof(<MapStartGrassGrow>d__27))] private IEnumerator MapStartGrassGrow() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <MapStartGrassGrow>d__27(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<SetupFlatLand>d__28))] private IEnumerator SetupFlatLand() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SetupFlatLand>d__28(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<WatchFloorSize>d__29))] private IEnumerator WatchFloorSize(GameObject floor) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WatchFloorSize>d__29(0) { <>4__this = this, floor = floor }; } [IteratorStateMachine(typeof(<SetupMap0>d__30))] private IEnumerator SetupMap0() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SetupMap0>d__30(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<SetupMap1>d__31))] private IEnumerator SetupMap1() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SetupMap1>d__31(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<SetupParkUpperGrass>d__32))] private IEnumerator SetupParkUpperGrass() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SetupParkUpperGrass>d__32(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<SetupParkLowerGrass>d__33))] private IEnumerator SetupParkLowerGrass() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SetupParkLowerGrass>d__33(0) { <>4__this = this }; } } public abstract class ValueValidator<T> { public abstract bool IsValid(object value); public abstract object EnsureValid(object value); } public class HexColorValidator : ValueValidator { private static readonly Regex hexRegex = new Regex("^[0-9a-fA-F]+$", RegexOptions.Compiled); private static readonly HashSet<int> validLengths = new HashSet<int> { 3, 4, 6, 8 }; public override bool IsValid(object value) { return value is string input && IsValidHex(input); } public override object EnsureValid(object value) { if (!(value is string input) || !IsValidHex(input)) { return "#C0B154"; } return NormalizeToStandard(input); } private static string NormalizeToStandard(string input) { string text = Normalize(input); if (text.Length == 3 || text.Length == 4) { text = string.Concat(text.Select((char c) => $"{c}{c}")); } return "#" + text.ToUpper(); } private static bool IsValidHex(string input) { string text = Normalize(input); if (string.IsNullOrEmpty(text) || !validLengths.Contains(text.Length)) { return false; } return hexRegex.IsMatch(text); } private static string Normalize(string input) { if (string.IsNullOrEmpty(input)) { return null; } input = input.Trim(); if (input.StartsWith("#")) { input = input.Substring(1); } else if (input.StartsWith("0x", StringComparison.OrdinalIgnoreCase)) { input = input.Substring(2); } return input; } } public class Preferences { private const string CONFIG_FILE = "config.cfg"; private const string USER_DATA = "UserData/GrassEnabler/"; internal static Dictionary<MelonPreferences_Entry, object> LastSavedValues = new Dictionary<MelonPreferences_Entry, object>(); internal static MelonPreferences_Category GrassCountCategory; internal static MelonPreferences_Entry<bool> PrefEnabled; internal static MelonPreferences_Entry<int> PrefRingCount; internal static MelonPreferences_Entry<int> PrefPitCount; internal static MelonPreferences_Entry<int> PrefUpperParkCount; internal static MelonPreferences_Entry<int> PrefLowerParkCount; internal static MelonPreferences_Entry<int> PrefFlatLandCount; internal static MelonPreferences_Category GrassSettingsCategory; internal static MelonPreferences_Entry<float> PrefHeight; internal static MelonPreferences_Entry<float> PrefWidth; internal static MelonPreferences_Entry<string> PrefColor; internal static MelonPreferences_Entry<bool> PrefRandomColor; internal static MelonPreferences_Category GrassVisualsCategory; internal static MelonPreferences_Entry<bool> PrefRemoval; internal static MelonPreferences_Entry<bool> PrefRegrow; internal static MelonPreferences_Entry<float> PrefTimeBeforeRegrow; internal static MelonPreferences_Entry<float> PrefGrowthTime; internal static void InitPrefs() { if (!Directory.Exists("UserData/GrassEnabler/")) { Directory.CreateDirectory("UserData/GrassEnabler/"); } GrassCountCategory = MelonPreferences.CreateCategory("GrassCount", "Grass Count"); GrassCountCategory.SetFilePath(Path.Combine("UserData/GrassEnabler/", "config.cfg")); PrefEnabled = GrassCountCategory.CreateEntry<bool>("Enabled", true, "Enabled", "Toggles Grass On/Off", false, false, (ValueValidator)null, (string)null); PrefRingCount = GrassCountCategory.CreateEntry<int>("RingCount", 5000, "Ring Count", "Set the number of Grass in the Ring", false, false, (ValueValidator)(object)new ValueRange<int>(0, int.MaxValue), (string)null); PrefPitCount = GrassCountCategory.CreateEntry<int>("PitCount", 5000, "Pit Count", "Set the number of Grass in the Pit", false, false, (ValueValidator)(object)new ValueRange<int>(0, int.MaxValue), (string)null); PrefUpperParkCount = GrassCountCategory.CreateEntry<int>("UpperParkCount", 5000, "Upper Park Count", "Set the number of Grass in the Upper Park", false, false, (ValueValidator)(object)new ValueRange<int>(0, int.MaxValue), (string)null); PrefLowerParkCount = GrassCountCategory.CreateEntry<int>("LowerParkCount", 5000, "Lower Park Count", "Set the number of Grass in the Lower Park", false, false, (ValueValidator)(object)new ValueRange<int>(0, int.MaxValue), (string)null); if (Main.flatLandModFound) { PrefFlatLandCount = GrassCountCategory.CreateEntry<int>("FlatLandCount", 5000, "FlatLand Count", "Set the number of Grass in FlatLand", false, false, (ValueValidator)(object)new ValueRange<int>(0, int.MaxValue), (string)null); } GrassSettingsCategory = MelonPreferences.CreateCategory("GrassSettings", "Grass Settings"); GrassSettingsCategory.SetFilePath(Path.Combine("UserData/GrassEnabler/", "config.cfg")); PrefHeight = GrassSettingsCategory.CreateEntry<float>("GrassHeight", 0.5f, "Grass Height", "Changes Grass Height. Default: 0.5", false, false, (ValueValidator)(object)new ValueRange<float>(0f, float.MaxValue), (string)null); PrefWidth = GrassSettingsCategory.CreateEntry<float>("GrassWidth", 0.5f, "Grass Width", "Changes Grass Width. Default: 0.5", false, false, (ValueValidator)(object)new ValueRange<float>(0f, float.MaxValue), (string)null); PrefColor = GrassSettingsCategory.CreateEntry<string>("GrassColor", "C0B154", "Grass Color", "Sets the Color of the Grass. Supports (HexCode), 0x(HexCode), and #(HexCode) style inputs. Alpha included (jank). Default: C0B154", false, false, (ValueValidator)(object)new HexColorValidator(), (string)null); PrefRandomColor = GrassSettingsCategory.CreateEntry<bool>("RandomColoredGrass", false, "Random Colored Grass", "Recolors each Grass to a Random Color. Default: Off", false, false, (ValueValidator)null, (string)null); GrassVisualsCategory = MelonPreferences.CreateCategory("GrassVisuals", "GrassVisuals"); GrassVisualsCategory.SetFilePath(Path.Combine("UserData/GrassEnabler/", "config.cfg")); PrefRemoval = GrassVisualsCategory.CreateEntry<bool>("GrassRemoval", true, "Grass Removal", "Removes the Grass with Spawned and Grounded Structures. Default: On", false, false, (ValueValidator)null, (string)null); PrefRegrow = GrassVisualsCategory.CreateEntry<bool>("RegrowGrass", true, "Regrow Grass", "Regrows the Grass after it is Destroyed. Default: On", false, false, (ValueValidator)null, (string)null); PrefTimeBeforeRegrow = GrassVisualsCategory.CreateEntry<float>("TimeBeforeRegrowth", 5f, "Time Before Regrowth", "Controls how many Seconds till Grass starts Regrowing. Default: 5", false, false, (ValueValidator)(object)new ValueRange<float>(0f, float.MaxValue), (string)null); PrefGrowthTime = GrassVisualsCategory.CreateEntry<float>("GrowthTime", 10f, "Growth Time", "Controls how many Seconds till Grass is Fully Grown. Default: 10", false, false, (ValueValidator)(object)new ValueRange<float>(0f, float.MaxValue), (string)null); StoreLastSavedPrefs(); } internal static void StoreLastSavedPrefs() { List<MelonPreferences_Entry> list = new List<MelonPreferences_Entry>(); list.AddRange(GrassSettingsCategory.Entries); list.AddRange(GrassCountCategory.Entries); list.AddRange(GrassVisualsCategory.Entries); foreach (MelonPreferences_Entry item in list) { LastSavedValues[item] = item.BoxedValue; } } public static bool IsPrefChanged(MelonPreferences_Entry entry) { if (LastSavedValues.TryGetValue(entry, out var value)) { return !entry.BoxedValue.Equals(value); } return false; } }