Decompiled source of WaxQuailMultiJump v1.0.2

WaxQuailMultiJump.dll

Decompiled 2 weeks 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.Logging;
using EntityStates;
using IL.EntityStates;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using R2API.Utils;
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("WaxQuailMultiJump")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+26230722a4ae5818dec9262bf4e8492fe62d7184")]
[assembly: AssemblyProduct("WaxQuailMultiJump")]
[assembly: AssemblyTitle("WaxQuailMultiJump")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 WaxQuailMultiJump
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.HamnT.WaxQuailMultiJump", "WaxQuailMultiJump", "1.0.2")]
	internal class WaxQuailMultiJump : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

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

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

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

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

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

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

			public static Manipulator <>9__0_0;

			internal void <Awake>b__0_0(ILContext il)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				if (val.TryGotoNext(new Func<Instruction, bool>[6]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchCall<EntityState>(x, "get_characterMotor"),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterMotor>(x, "jumpCount"),
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchCall<EntityState>(x, "get_characterBody"),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseJumpCount")
				}))
				{
					val.Index += 5;
					val.Remove();
					val.Emit<CharacterBody>(OpCodes.Callvirt, "get_maxJumpCount");
				}
				else
				{
					Log.Error("Failed to apply wax quail multi jump patch");
				}
			}

			internal bool <Awake>b__0_1(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdarg(x, 0);
			}

			internal bool <Awake>b__0_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchCall<EntityState>(x, "get_characterMotor");
			}

			internal bool <Awake>b__0_3(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdfld<CharacterMotor>(x, "jumpCount");
			}

			internal bool <Awake>b__0_4(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdarg(x, 0);
			}

			internal bool <Awake>b__0_5(Instruction x)
			{
				return ILPatternMatchingExt.MatchCall<EntityState>(x, "get_characterBody");
			}

			internal bool <Awake>b__0_6(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseJumpCount");
			}
		}

		public void Awake()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Expected O, but got Unknown
					//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val2 = new ILCursor(il);
					if (val2.TryGotoNext(new Func<Instruction, bool>[6]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
						(Instruction x) => ILPatternMatchingExt.MatchCall<EntityState>(x, "get_characterMotor"),
						(Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterMotor>(x, "jumpCount"),
						(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
						(Instruction x) => ILPatternMatchingExt.MatchCall<EntityState>(x, "get_characterBody"),
						(Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseJumpCount")
					}))
					{
						val2.Index += 5;
						val2.Remove();
						val2.Emit<CharacterBody>(OpCodes.Callvirt, "get_maxJumpCount");
					}
					else
					{
						Log.Error("Failed to apply wax quail multi jump patch");
					}
				};
				<>c.<>9__0_0 = val;
				obj = (object)val;
			}
			GenericCharacterMain.ProcessJump_bool += (Manipulator)obj;
		}
	}
}