Decompiled source of InfiniWaves v1.0.0

Mods/InfiniWaves.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2CppFemur;
using Il2CppGB.Game;
using Il2CppGB.Game.Data;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem.Collections.Generic;
using InfiniWaves;
using MelonLoader;
using MelonLoader.Preferences;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;

[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), "InfiniWaves", "1.0.0", "TheUltimateNuke", null)]
[assembly: MelonGame("Boneloaf", "Gang Beasts")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("0.0.0.0")]
[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 InfiniWaves
{
	public class Mod : MelonMod
	{
		public static class BuildInfo
		{
			public const string Name = "InfiniWaves";

			public const string Author = "TheUltimateNuke";

			public const string Version = "1.0.0";

			public const string DownloadLink = null;
		}

		private static MelonPreferences_Category _categ;

		private static MelonPreferences_Entry<int> _waveLimitPref;

		private static MelonPreferences_Entry<int> _beastPerWaveLimitPref;

		public static int WaveLimit => (int)((MelonPreferences_Entry)_waveLimitPref).BoxedValue;

		public static int BeastPerWaveLimit => (int)((MelonPreferences_Entry)_beastPerWaveLimitPref).BoxedValue;

		public static Instance Logger => Melon<Mod>.Logger;

		public override void OnInitializeMelon()
		{
			((MelonBase)this).LoggerInstance.Msg(ConsoleColor.Green, "Mod InfiniWaves initialized!");
			_categ = MelonPreferences.CreateCategory("InfiniWaves");
			_waveLimitPref = _categ.CreateEntry<int>("WaveLimit", 1000, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			_beastPerWaveLimitPref = _categ.CreateEntry<int>("BeastPerWaveLimit", 1000, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			_categ.SetFilePath(Path.Combine(MelonEnvironment.UserDataDirectory, "InfiniWavesConfig.cfg"));
			_categ.SaveToFile(true);
		}

		public override void OnDeinitializeMelon()
		{
			((MelonBase)this).OnDeinitializeMelon();
			_categ.SaveToFile(true);
		}

		public override void OnUpdate()
		{
			if (!InputControlExtensions.IsPressed((InputControl)(object)Keyboard.current.vKey, 0f))
			{
				return;
			}
			foreach (StatusHandeler item in Object.FindObjectsOfType<StatusHandeler>())
			{
				if (item.actor.IsAI)
				{
					item.Kill();
				}
			}
		}
	}
	internal static class GameMode_WavesPatches
	{
		[HarmonyPatch(typeof(GameMode_Waves), "Init")]
		private static class InitPatch
		{
			private static void Postfix(GameMode_Waves __instance)
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Expected O, but got Unknown
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Expected O, but got Unknown
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Expected O, but got Unknown
				if ((Object)(object)__instance._waveInfomation == (Object)null)
				{
					return;
				}
				List<BeastSetup> val = new List<BeastSetup>();
				for (int i = 0; i < 4; i++)
				{
					val.Add(new BeastSetup
					{
						type = Random.Range(0, 4)
					});
				}
				for (int j = 4; j < Mod.WaveLimit; j++)
				{
					Wave val2 = new Wave();
					if (val.Count < Mod.BeastPerWaveLimit)
					{
						val.Add(new BeastSetup
						{
							type = Random.Range(0, 4)
						});
					}
					val2.beasts = new List<BeastSetup>(((Il2CppObjectBase)val).Cast<IEnumerable<BeastSetup>>());
					__instance._waveInfomation.levelWaves.Add(val2);
				}
			}
		}
	}
}