Decompiled source of Raise Monster Level Cap v1.0.9

RaiseMonsterLevelCap.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using IL.RoR2;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using RoR2;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("RaiseMonsterLevelCap")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RaiseMonsterLevelCap")]
[assembly: AssemblyTitle("RaiseMonsterLevelCap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace RaiseMonsterLevelCap
{
	[BepInPlugin("com.Moffein.RaiseMonsterLevelCap", "Raise Monster Level Cap", "1.0.8")]
	public class RaiseMonsterLevelCap : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<Instruction, bool> <>9__1_2;

			public static Manipulator <>9__1_0;

			internal void <Awake>b__1_0(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdsfld<Run>(x, "ambientLevelCap")
				});
				val.Remove();
				val.Emit<RaiseMonsterLevelCap>(OpCodes.Ldsfld, "maxLevel");
			}

			internal bool <Awake>b__1_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdsfld<Run>(x, "ambientLevelCap");
			}
		}

		public static float maxLevel;

		public void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0036: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0070: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			maxLevel = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Settings", "Max Level"), 9999f, new ConfigDescription("Max level that monsters can reach. 99 is Vanilla, 9999 is Simulacrum.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			float stopSound = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Settings", "Max Levelup Sound"), 300f, new ConfigDescription("Max level for the levelup sound to play. This prevents sound spam later in runs", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			Run.ambientLevelCap = (int)maxLevel;
			object obj = <>c.<>9__1_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_003f: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val2 = new ILCursor(il);
					val2.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdsfld<Run>(x, "ambientLevelCap")
					});
					val2.Remove();
					val2.Emit<RaiseMonsterLevelCap>(OpCodes.Ldsfld, "maxLevel");
				};
				<>c.<>9__1_0 = val;
				obj = (object)val;
			}
			Run.RecalculateDifficultyCoefficentInternal += (Manipulator)obj;
			LevelUpEffectManager.OnRunAmbientLevelUp += (hook_OnRunAmbientLevelUp)delegate(orig_OnRunAmbientLevelUp orig, Run run)
			{
				if (run.ambientLevel <= stopSound)
				{
					orig.Invoke(run);
				}
			};
		}
	}
}
namespace R2API.Utils
{
	[AttributeUsage(AttributeTargets.Assembly)]
	public class ManualNetworkRegistrationAttribute : Attribute
	{
	}
}