Decompiled source of DonutMixFixIl2Cpp v1.0.0

Mods/DonutMixFix.Il2Cpp.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using DonutMixFix;
using HarmonyLib;
using Il2CppScheduleOne.Effects;
using Il2CppScheduleOne.Product;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using Microsoft.CodeAnalysis;

[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), "DonutMixFix", "1.0.0", "Foxcapades", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DonutMixFix")]
[assembly: AssemblyConfiguration("Il2Cpp")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+7ca6b9625071ad2bffb363da03983c0bc4e88ab0")]
[assembly: AssemblyProduct("DonutMixFix")]
[assembly: AssemblyTitle("DonutMixFix")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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 DonutMixFix
{
	[HarmonyPatch(typeof(EffectMixCalculator), "MixProperties")]
	public class Mod : MelonMod
	{
		public const string MOD_NAME = "DonutMixFix";

		private const string CalorieDenseEffectID = "caloriedense";

		[HarmonyPrefix]
		private static void Prefix(List<Effect> existingProperties, Effect newProperty, EDrugType drugType, out bool __state)
		{
			__state = false;
			if (newProperty.ID != "caloriedense")
			{
				return;
			}
			Enumerator<Effect> enumerator = existingProperties.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Effect current = enumerator.Current;
				if (current.ID == "caloriedense")
				{
					__state = true;
					break;
				}
			}
		}

		[HarmonyPostfix]
		private static List<Effect> Postfix(List<Effect> resultingEffects, bool __state)
		{
			if (__state)
			{
				List<Effect> val = new List<Effect>(resultingEffects.Count - 1);
				Enumerator<Effect> enumerator = resultingEffects.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Effect current = enumerator.Current;
					if (current.ID != "caloriedense")
					{
						val.Add(current);
					}
				}
				return val;
			}
			return resultingEffects;
		}
	}
}