Decompiled source of Remove Restock Scaling From Eclipse Light v1.0.1

NerfEclipseLight.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NerfEclipseLight")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NerfEclipseLight")]
[assembly: AssemblyTitle("NerfEclipseLight")]
[assembly: AssemblyVersion("1.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 NerfEclipseLight
{
	[Serializable]
	[BepInPlugin("com.brynzananas.nerfeclipselight", "Nerf Eclipse Light", "1.0.0")]
	public class Main : BaseUnityPlugin
	{
		public const string ModGuid = "com.brynzananas.nerfeclipselight";

		public const string ModName = "Nerf Eclipse Light";

		public const string ModVer = "1.0.0";

		private bool hooksSet;

		public void Awake()
		{
			SetHooks();
		}

		public void OnDestroy()
		{
			UnsetHooks();
		}

		public void SetHooks()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			if (!hooksSet)
			{
				hooksSet = true;
				CharacterBody.OnSkillCooldown += new Manipulator(CharacterBody_OnSkillCooldown);
			}
		}

		private void CharacterBody_OnSkillCooldown(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			ILLabel val2 = null;
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 2),
				(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
				(Instruction x) => ILPatternMatchingExt.MatchMul(x),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<HealthComponent>(x, "AddBarrierAuthority")
			}))
			{
				val.RemoveRange(3);
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
			}
		}

		public void UnsetHooks()
		{
			if (hooksSet)
			{
				hooksSet = false;
			}
		}
	}
}