Decompiled source of SpeedGrow v1.0.0

InstantGrow.dll

Decompiled 2 months ago
using 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 MelonLoader;
using PlantMod;
using ScheduleOne.Growing;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(global::PlantMod.PlantMod), "FasterGrowningDebug", "1.0", "Estonia", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: AssemblyTitle("50k")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("50k")]
[assembly: AssemblyCopyright("Copyright © Estonia 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3506c5d7-811e-4046-9fe7-9e963df141bd")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace PlantMod;

public class PlantMod : MelonMod
{
	[CompilerGenerated]
	private sealed class <ChangeGrowthTimeAfterDelay>d__2 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public PlantMod <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ChangeGrowthTimeAfterDelay>d__2(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(10f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.ChangeGrowthTime();
				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 <RegularGrowthTimeCheck>d__3 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public PlantMod <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <RegularGrowthTimeCheck>d__3(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;
				<>4__this.ChangeGrowthTime();
				break;
			}
			<>2__current = (object)new WaitForSeconds(5f);
			<>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();
		}
	}

	private const int NewGrowthTime = 1;

	public override void OnApplicationStart()
	{
		MelonLogger.Msg("Plant Growth Mod Loaded!");
		MelonCoroutines.Start(ChangeGrowthTimeAfterDelay());
		MelonCoroutines.Start(RegularGrowthTimeCheck());
	}

	[IteratorStateMachine(typeof(<ChangeGrowthTimeAfterDelay>d__2))]
	private IEnumerator ChangeGrowthTimeAfterDelay()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ChangeGrowthTimeAfterDelay>d__2(0)
		{
			<>4__this = this
		};
	}

	[IteratorStateMachine(typeof(<RegularGrowthTimeCheck>d__3))]
	private IEnumerator RegularGrowthTimeCheck()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <RegularGrowthTimeCheck>d__3(0)
		{
			<>4__this = this
		};
	}

	private void ChangeGrowthTime()
	{
		try
		{
			Type type = Type.GetType("ScheduleOne.Growing.Plant, Assembly-CSharp");
			if (type != null)
			{
				FieldInfo field = type.GetField("GrowthTime", BindingFlags.Instance | BindingFlags.Public);
				if (field != null)
				{
					Plant[] array = Object.FindObjectsOfType<Plant>(true);
					Plant[] array2 = array;
					foreach (Plant obj in array2)
					{
						field.SetValue(obj, 1);
					}
				}
				else
				{
					MelonLogger.Error("GrowthTime field not found.");
				}
			}
			else
			{
				MelonLogger.Error("Plant class not found.");
			}
		}
		catch (Exception ex)
		{
			MelonLogger.Error("Error changing GrowthTime: " + ex.Message);
		}
	}
}