Decompiled source of CustomMixingTimersIL2CPP v1.0.0

CustomMixingTimers_Il2Cpp.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using CustomMixingTimers;
using HarmonyLib;
using Il2CppScheduleOne.NPCs.Behaviour;
using Il2CppScheduleOne.ObjectScripts;
using Il2CppScheduleOne.UI.Stations;
using MelonLoader;
using MelonLoader.Preferences;
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(Mod), "CustomMixingTimers-Il2Cpp", "2.1.0", "9ate7six", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("CustomMixingTimers_Il2Cpp")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+dab02036f8cd9d1a2ad36015be35fe130b49c45c")]
[assembly: AssemblyProduct("CustomMixingTimers_Il2Cpp")]
[assembly: AssemblyTitle("CustomMixingTimers_Il2Cpp")]
[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 CustomMixingTimers
{
	public class Mod : MelonMod
	{
		private static MelonPreferences_Category category;

		public static MelonPreferences_Entry<float> manualMixTime;

		public static MelonPreferences_Entry<float> npcMixTime;

		public string Name => "Custom Mixing Timers";

		public string Description => "Control Mixing speed for both UI and NPC automation.";

		public string Author => "9ate7six";

		public string Version => "2.1.0";

		public override void OnInitializeMelon()
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			category = MelonPreferences.CreateCategory("CustomMixingTimers-Il2Cpp_CustomMixingTimers", "Custom Mixing Timers");
			manualMixTime = category.CreateEntry<float>("ManualMixTimePerItem", 3f, "Mix time per item (in-game minutes) when using the UI", (string)null, false, false, (ValueValidator)null, (string)null);
			npcMixTime = category.CreateEntry<float>("NpcMixTimePerItem", 3f, "Mix time per item (in-game minutes) for NPC-driven mixing", (string)null, false, false, (ValueValidator)null, (string)null);
			MelonPreferences.Save();
			MelonLogger.Msg($"[CustomMixingTimers] Preferences loaded: Manual={manualMixTime.Value}, NPC={npcMixTime.Value}");
			Harmony val = new Harmony("CustomMixingTimers");
			val.PatchAll();
		}
	}
	[HarmonyPatch(typeof(MixingStationCanvas), "BeginButtonPressed")]
	internal static class UI_SetMixTime
	{
		private static void Prefix(MixingStationCanvas __instance)
		{
			MixingStation val = ((__instance != null) ? __instance.MixingStation : null);
			if ((Object)(object)val != (Object)null)
			{
				val.MixTimePerItem = (int)Mod.manualMixTime.Value;
			}
		}
	}
	[HarmonyPatch(typeof(StartMixingStationBehaviour), "RpcLogic___StartCook_2166136261")]
	internal static class Patch_SetStationMixForNPC
	{
		private static void Prefix(StartMixingStationBehaviour __instance)
		{
			MixingStation targetStation = __instance.targetStation;
			if ((Object)(object)targetStation != (Object)null)
			{
				targetStation.MixTimePerItem = (int)Mod.npcMixTime.Value;
			}
		}
	}
}