Decompiled source of CustomLevelSecretFix v1.0.0

ultrakill-custom-level-secret-fix.dll

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ultrakill-custom-level-secret-fix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ultrakill-custom-level-secret-fix")]
[assembly: AssemblyTitle("ultrakill-custom-level-secret-fix")]
[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;
		}
	}
}
namespace CustomLevelSecretFix
{
	[BepInPlugin("com.dominicentek.customlevelsecretfix", "CustomLevelSecretFix", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private List<int> existingBonuses = new List<int>();

		public void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogMessage((object)"CustomLevelSecretFix loaded!");
			SceneManager.sceneLoaded += OnSceneLoaded;
			SceneManager.sceneUnloaded += OnSceneUnloaded;
		}

		public void OnSceneUnloaded(Scene scene)
		{
			existingBonuses.Clear();
		}

		public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			Bonus[] array = Object.FindObjectsByType<Bonus>((FindObjectsSortMode)1);
			Bonus[] array2 = array;
			foreach (Bonus val in array2)
			{
				if (val.secretNumber != -1)
				{
					existingBonuses.Add(val.secretNumber);
				}
			}
			int j = 0;
			array2 = array;
			foreach (Bonus val2 in array2)
			{
				if (val2.secretNumber == -1)
				{
					for (; existingBonuses.Contains(j); j++)
					{
					}
					val2.secretNumber = j++;
				}
			}
		}
	}
}