Decompiled source of RetryAnywhere v1.0.2

RetryAnywhere.dll

Decompiled 3 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BTD_Mod_Helper;
using BTD_Mod_Helper.Api;
using HarmonyLib;
using Il2CppAssets.Scripts.Unity.UI_New.GameOver;
using Il2CppAssets.Scripts.Unity.UI_New.InGame;
using Il2CppAssets.Scripts.Utils;
using MelonLoader;
using Microsoft.CodeAnalysis;
using RetryAnywhere;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(RetryAnywhereMod), "Retry Anywhere", "1.0.2", "doombubbles", null)]
[assembly: MelonGame("Ninja Kiwi", "BloonsTD6")]
[assembly: MelonGame("Ninja Kiwi", "BloonsTD6-Epic")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("RetryAnywhere")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a2e26e1c33dc125a2afeff11e3428ee7e66cb674")]
[assembly: AssemblyProduct("RetryAnywhere")]
[assembly: AssemblyTitle("RetryAnywhere")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RetryAnywhere
{
	public static class ModHelperData
	{
		public const string WorksOnVersion = "55.0";

		public const string Version = "1.0.2";

		public const string Name = "Retry Anywhere";

		public const string Description = "Makes the Retry Round button show up and be usable in all modes.\nOnly works for Bosses when playing games using the Boss Rounds mod.\n\n(This is basically just a newer take on my other mod, Auto Escape)";

		public const bool SquareIcon = true;

		public const string RepoOwner = "doombubbles";

		public const string PrevRepoName = "retry-anywhere";

		public const string RepoName = "RetryAnywhere";
	}
	public class RetryAnywhereMod : BloonsTD6Mod
	{
		[HarmonyPatch]
		internal static class OverrideCreationMode
		{
			private static IEnumerable<MethodBase> TargetMethods()
			{
				yield return AccessTools.Method(typeof(DefeatScreen), "Open", (Type[])null, (Type[])null);
				yield return AccessTools.Method(typeof(InGame), "Lose", (Type[])null, (Type[])null);
				yield return MoreAccessTools.SafeGetNestedClassMethod(typeof(DefeatScreen), "Open", "MoveNext", 0);
			}

			[HarmonyPrefix]
			private static void Prefix()
			{
				overrideIsCreationMode = true;
			}

			[HarmonyPostfix]
			private static void Postfix()
			{
				overrideIsCreationMode = false;
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		internal static class ReadonlyInGameData_IsCreationMode
		{
			[HarmonyPrefix]
			private static bool Prefix(ref bool __result)
			{
				if (overrideIsCreationMode)
				{
					__result = true;
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch]
		internal static class CheckpointCosts
		{
			private static IEnumerable<MethodBase> TargetMethods()
			{
				yield return AccessTools.Method(typeof(InGame), "GetCheckpointCost", (Type[])null, (Type[])null);
				yield return AccessTools.Method(typeof(BossDefeatScreen), "GetContinueMmCost", (Type[])null, (Type[])null);
				yield return AccessTools.Method(typeof(BossDefeatScreen), "GetRetryMmCost", (Type[])null, (Type[])null);
			}

			[HarmonyPostfix]
			private static void Postfix(ref KonFuze __result)
			{
				__result.Write(0.0);
			}
		}

		public static bool overrideIsCreationMode;
	}
}