Decompiled source of ConfigurableEmployees v1.0.0

BotanistPotsModIL2CPP.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BotanistPotsModIL2CPP;
using HarmonyLib;
using Il2CppScheduleOne.DevUtilities;
using Il2CppScheduleOne.Employees;
using Il2CppScheduleOne.NPCs.CharacterClasses;
using MelonLoader;
using MelonLoader.Preferences;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
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(Core), "ConfigurableEmployees", "1", "Mountain", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BotanistPotsModIL2CPP")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BotanistPotsModIL2CPP")]
[assembly: AssemblyTitle("BotanistPotsModIL2CPP")]
[assembly: NeutralResourcesLanguage("en-US")]
[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 BotanistPotsModIL2CPP
{
	public class Core : MelonMod
	{
		[HarmonyPatch(typeof(Packager), "Awake")]
		private static class Patch_Packager_Awake
		{
			private static void Postfix(Packager __instance)
			{
				__instance.MaxAssignedStations = entry2.Value;
			}
		}

		[HarmonyPatch(typeof(Fixer), "GetAdditionalSigningFee")]
		private static class ZeroSigningFeePatch
		{
			private static bool Prefix(Fixer __instance, ref float __result)
			{
				__result = 0f;
				return false;
			}
		}

		[HarmonyPatch(typeof(Botanist), "Awake")]
		private static class Patch_Awake
		{
			private static void Postfix(Botanist __instance)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Invalid comparison between Unknown and I4
				if ((int)((Employee)__instance).EmployeeType == 0)
				{
					__instance.MaxAssignedPots = entry1.Value;
					__instance.SEED_SOW_TIME = SeedSowTime.Value;
					__instance.WATER_POUR_TIME = WaterPourTime.Value;
					__instance.ADDITIVE_POUR_TIME = AdditiveTime.Value;
					__instance.HARVEST_TIME = HarvestTime.Value;
					__instance.SOIL_POUR_TIME = SoilPourTime.Value;
				}
			}
		}

		[CompilerGenerated]
		private sealed class <Coroutinethiny>d__21 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

			[DebuggerHidden]
			public <Coroutinethiny>d__21(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if ((Object)(object)NetworkSingleton<EmployeeManager>.Instance == (Object)null)
				{
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				((Employee)NetworkSingleton<EmployeeManager>.Instance.CleanerPrefab).SigningFee = Cleaner_Cost.Value;
				((Employee)NetworkSingleton<EmployeeManager>.Instance.ChemistPrefab).SigningFee = Chemist_Cost.Value;
				((Employee)NetworkSingleton<EmployeeManager>.Instance.BotanistPrefab).SigningFee = Botanist_Cost.Value;
				((Employee)NetworkSingleton<EmployeeManager>.Instance.PackagerPrefab).SigningFee = Packer_Cost.Value;
				((Employee)NetworkSingleton<EmployeeManager>.Instance.PackagerPrefab).DailyWage = Packer_Wage.Value;
				((Employee)NetworkSingleton<EmployeeManager>.Instance.ChemistPrefab).DailyWage = Chemist_Wage.Value;
				((Employee)NetworkSingleton<EmployeeManager>.Instance.BotanistPrefab).DailyWage = Botanist_Wage.Value;
				((Employee)NetworkSingleton<EmployeeManager>.Instance.CleanerPrefab).DailyWage = Cleaner_Wage.Value;
				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 MelonPreferences_Category category;

		private static MelonPreferences_Entry<int> entry1;

		private static MelonPreferences_Entry<int> entry2;

		private static MelonPreferences_Entry<float> Botanist_Cost;

		private static MelonPreferences_Entry<float> Chemist_Cost;

		private static MelonPreferences_Entry<float> Packer_Cost;

		private static MelonPreferences_Entry<float> Cleaner_Cost;

		private static MelonPreferences_Entry<float> SeedSowTime;

		private static MelonPreferences_Entry<float> WaterPourTime;

		private static MelonPreferences_Entry<float> HarvestTime;

		private static MelonPreferences_Entry<float> AdditiveTime;

		private static MelonPreferences_Entry<float> SoilPourTime;

		private static MelonPreferences_Entry<float> Cleaner_Wage;

		private static MelonPreferences_Entry<float> Packer_Wage;

		private static MelonPreferences_Entry<float> Chemist_Wage;

		private static MelonPreferences_Entry<float> Botanist_Wage;

		public override void OnInitializeMelon()
		{
			string text = Path.Combine(MelonEnvironment.UserDataDirectory, "BotanistPotsMod");
			Directory.CreateDirectory(text);
			if (category == null)
			{
				category = MelonPreferences.CreateCategory("BotanistPotsMod");
				category.SetFilePath(Path.Combine(text, "Settings.cfg"), true);
				category.LoadFromFile(true);
			}
			else
			{
				category.LoadFromFile(true);
			}
			entry1 = category.CreateEntry<int>("Amount Of Pots Botanist Can use:", 8, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			entry2 = category.CreateEntry<int>("Amount Of Stations Packager Can use:", 4, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			Botanist_Cost = category.CreateEntry<float>("Botanist Hiring Cost:", 2500f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			Chemist_Cost = category.CreateEntry<float>("Chemist Hiring Cost:", 2000f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			Packer_Cost = category.CreateEntry<float>("Packager Hiring Cost:", 1500f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			Cleaner_Cost = category.CreateEntry<float>("Cleaner Hiring Cost:", 500f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			Cleaner_Wage = category.CreateEntry<float>("Cleaner Daily Wage Cost:", 200f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			Packer_Wage = category.CreateEntry<float>("Packager Daily Wage Cost:", 200f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			Chemist_Wage = category.CreateEntry<float>("Chemist Daily Wage Cost:", 200f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			Botanist_Wage = category.CreateEntry<float>("Botanist Daily Wage Cost:", 200f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			SeedSowTime = category.CreateEntry<float>("Seed Sow Time:", 15f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			WaterPourTime = category.CreateEntry<float>("Water Pour Time:", 10f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			HarvestTime = category.CreateEntry<float>("Harvest Time:", 15f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			AdditiveTime = category.CreateEntry<float>("Additive Pour Time:", 10f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			SoilPourTime = category.CreateEntry<float>("Soil Pour Time:", 10f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			if (sceneName == "Main")
			{
				MelonCoroutines.Start(Coroutinethiny());
			}
		}

		[IteratorStateMachine(typeof(<Coroutinethiny>d__21))]
		private static IEnumerator Coroutinethiny()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Coroutinethiny>d__21(0);
		}
	}
}