Decompiled source of MixingTweaks v1.0.2

MixingTweaks.dll

Decompiled 16 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppScheduleOne.ObjectScripts;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using MixingTweaks;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(MixingTweaksMod), "Mixing Tweaks", "1.0.2", "Codex", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace MixingTweaks
{
	public sealed class MixingTweaksMod : MelonMod
	{
		internal static MelonPreferences_Entry<int> RegularMixTimePerItem { get; private set; }

		internal static MelonPreferences_Entry<int> RegularCapacity { get; private set; }

		internal static MelonPreferences_Entry<int> Mk2MixTimePerItem { get; private set; }

		internal static MelonPreferences_Entry<int> Mk2Capacity { get; private set; }

		public override void OnInitializeMelon()
		{
			MelonPreferences_Category obj = MelonPreferences.CreateCategory("MixingTweaks", "Mixing Tweaks");
			RegularMixTimePerItem = obj.CreateEntry<int>("RegularMixTimePerItem", 1, "Regular station: time per item", "Mixing time per item for the regular Mixing Station. Minimum: 1.", false, false, (ValueValidator)null, (string)null);
			RegularCapacity = obj.CreateEntry<int>("RegularCapacity", 20, "Regular station: capacity", "Maximum batch size for the regular Mixing Station. Minimum: 1.", false, false, (ValueValidator)null, (string)null);
			Mk2MixTimePerItem = obj.CreateEntry<int>("Mk2MixTimePerItem", 1, "Mk2 station: time per item", "Mixing time per item for Mixing Station Mk2. Minimum: 1.", false, false, (ValueValidator)null, (string)null);
			Mk2Capacity = obj.CreateEntry<int>("Mk2Capacity", 20, "Mk2 station: capacity", "Maximum batch size for Mixing Station Mk2. Minimum: 1.", false, false, (ValueValidator)null, (string)null);
			obj.SaveToFile(false);
			((MelonBase)this).LoggerInstance.Msg($"Ready. Regular: time {Clamp(RegularMixTimePerItem.Value)}, capacity {Clamp(RegularCapacity.Value)}; Mk2: time {Clamp(Mk2MixTimePerItem.Value)}, capacity {Clamp(Mk2Capacity.Value)}.");
		}

		internal static int Clamp(int value)
		{
			return Math.Max(1, value);
		}
	}
	[HarmonyPatch(typeof(MixingStation), "Start")]
	internal static class MixingStationStartPatch
	{
		[HarmonyPostfix]
		private static void Postfix(MixingStation __instance)
		{
			bool flag = ((Il2CppObjectBase)__instance).TryCast<MixingStationMk2>() != null;
			__instance.MixTimePerItem = MixingTweaksMod.Clamp(flag ? MixingTweaksMod.Mk2MixTimePerItem.Value : MixingTweaksMod.RegularMixTimePerItem.Value);
			__instance.MaxMixQuantity = MixingTweaksMod.Clamp(flag ? MixingTweaksMod.Mk2Capacity.Value : MixingTweaksMod.RegularCapacity.Value);
		}
	}
}