Decompiled source of Level Cap Remover v1.0.2

BepInEx/plugins/LevelCapRemover/LevelCapRemover.dll

Decompiled 2 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using RoR2;

[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("LevelCapRemover")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("Level Cap Remover")]
[assembly: AssemblyTitle("LevelCapRemover")]
[assembly: AssemblyMetadata("AI_Assisted_Creation", "Plugin code generated with OpenCode using GPT-6.2 Astra Fast.")]
[assembly: AssemblyMetadata("AI_Model_Vendor", "OpenAI")]
[assembly: AssemblyVersion("1.0.2.0")]
namespace LevelCapRemover;

[BepInPlugin("lykhoris.ror2.levelcapremover", "Level Cap Remover", "1.0.2")]
public sealed class LevelCapRemoverPlugin : BaseUnityPlugin
{
	private const int MaxAmbientLevel = 2147483520;

	private void Awake()
	{
		FieldInfo field = typeof(Run).GetField("ambientLevelCap", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
		if (field == null || field.FieldType != typeof(int) || field.IsInitOnly || field.IsLiteral)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Could not find a writable Run.ambientLevelCap (int). Check for a game update.");
			return;
		}
		int num = (int)field.GetValue(null);
		if (num != 99)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Expected the vanilla cap of 99, found {num}. Leaving it unchanged.");
			return;
		}
		field.SetValue(null, 2147483520);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Removed the level-99 ambient cap.");
	}
}
public static class MyPluginInfo
{
	public const string PLUGIN_GUID = "lykhoris.ror2.levelcapremover";

	public const string PLUGIN_NAME = "Level Cap Remover";

	public const string PLUGIN_VERSION = "1.0.2";
}