Decompiled source of Fix King Mod Utilities v1.0.0

FixKingModUtilities.dll

Decompiled 3 days 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 HG.Reflection;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using NS_KingModUtilities;
using R2API.Utils;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FixKingModUtilities")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FixKingModUtilities")]
[assembly: AssemblyTitle("FixKingModUtilities")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
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 FixKingModUtilities
{
	[Serializable]
	[BepInPlugin("com.brynzananas.fixkingmodutilities", "Fix King Mod Utilities", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class FixKingModUtilities : BaseUnityPlugin
	{
		public const string ModGuid = "com.brynzananas.fixkingmodutilities";

		public const string ModName = "Fix King Mod Utilities";

		public const string ModVer = "1.0.0";

		private Harmony harmonyPatcher;

		public void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			harmonyPatcher = new Harmony("com.brynzananas.fixkingmodutilities");
			harmonyPatcher.CreateClassProcessor(typeof(Patches)).Patch();
		}
	}
	[HarmonyPatch]
	internal class Patches
	{
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyILManipulator]
		private static void SkinDef_ApplyAsync(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel iLLabel = null;
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 2),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<BonusStatHandler>(x, "m_characterBody"),
				(Instruction x) => ILPatternMatchingExt.MatchCall<Object>(x, "op_Equality"),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref iLLabel)
			}))
			{
				val.Emit(OpCodes.Ldarg_2);
				val.EmitDelegate<Func<CharacterBody, bool>>((Func<CharacterBody, bool>)fix);
				val.Emit(OpCodes.Brfalse, (object)iLLabel);
			}
			else
			{
				Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
			}
			static bool fix(CharacterBody characterBody)
			{
				return ((object)characterBody).GetType().Name == "CharacterBody";
			}
		}
	}
}