Decompiled source of SeekersPatcher v1.1.1

BepInEx/patchers/SeekersPatcher/SeekersPatcher.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Cecil.Rocks;

[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 = ".NET Standard 2.0")]
[assembly: AssemblyCompany("SeekersPatcher")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SeekersPatcher")]
[assembly: AssemblyTitle("SeekersPatcher")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 SeekersPatcher
{
	public static class SeekersPatcher
	{
		internal static class Logger
		{
			private static readonly ManualLogSource logSource = Logger.CreateLogSource("SeekersPatcher");

			public static void Info(object data)
			{
				logSource.LogInfo(data);
			}

			public static void Error(object data)
			{
				logSource.LogError(data);
			}

			public static void Warn(object data)
			{
				logSource.LogWarning(data);
			}

			public static void Fatal(object data)
			{
				logSource.LogFatal(data);
			}

			public static void Message(object data)
			{
				logSource.LogMessage(data);
			}

			public static void Debug(object data)
			{
				logSource.LogDebug(data);
			}
		}

		public static MethodReference fixedDeltaTime;

		public static IEnumerable<string> TargetDLLs => new string[1] { "RoR2.dll" };

		public static void Patch(AssemblyDefinition def)
		{
			if (((AssemblyNameReference)def.Name).Name == "RoR2")
			{
				PatchRoR2(def);
			}
		}

		private static void PatchRoR2(AssemblyDefinition def)
		{
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Expected O, but got Unknown
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Expected O, but got Unknown
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Expected O, but got Unknown
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Expected O, but got Unknown
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Expected O, but got Unknown
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Expected O, but got Unknown
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Expected O, but got Unknown
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Expected O, but got Unknown
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Expected O, but got Unknown
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			AssemblyDefinition val = AssemblyDefinition.ReadAssembly(typeof(void).Assembly.Location);
			TypeReference val2 = val.MainModule.ImportReference(typeof(void));
			AssemblyDefinition val3 = AssemblyDefinition.ReadAssembly(Path.Combine(Paths.ManagedPath, "UnityEngine.CoreModule.dll"));
			TypeDefinition type = def.MainModule.GetType("RoR2.ItemDef");
			TypeReference val4 = val.MainModule.ImportReference(typeof(float));
			TypeReference val5 = val.MainModule.ImportReference(typeof(bool));
			TypeReference val6 = def.MainModule.ImportReference((TypeReference)(object)def.MainModule.GetType("RoR2.DamageColorIndex"));
			TypeReference val7 = def.MainModule.ImportReference((TypeReference)(object)val3.MainModule.GetType("UnityEngine.Vector3"));
			TypeReference val8 = def.MainModule.ImportReference((TypeReference)(object)val3.MainModule.GetType("UnityEngine.Quaternion"));
			TypeReference val9 = def.MainModule.ImportReference((TypeReference)(object)val3.MainModule.GetType("UnityEngine.GameObject"));
			TypeDefinition type2 = def.MainModule.GetType("RoR2.DLC2Content/Items");
			type2.Fields.Add(new FieldDefinition("NegateAttack", (FieldAttributes)22, def.MainModule.ImportReference((TypeReference)(object)type)));
			TypeDefinition type3 = def.MainModule.GetType("RoR2.Projectile.ProjectileManager");
			MethodDefinition val10 = new MethodDefinition("FireProjectile", (MethodAttributes)6, val2);
			((MethodReference)val10).Parameters.Add(new ParameterDefinition(val9));
			((MethodReference)val10).Parameters.Add(new ParameterDefinition(val7));
			((MethodReference)val10).Parameters.Add(new ParameterDefinition(val8));
			((MethodReference)val10).Parameters.Add(new ParameterDefinition(val9));
			((MethodReference)val10).Parameters.Add(new ParameterDefinition(val4));
			((MethodReference)val10).Parameters.Add(new ParameterDefinition(val4));
			((MethodReference)val10).Parameters.Add(new ParameterDefinition(val5));
			((MethodReference)val10).Parameters.Add(new ParameterDefinition(val6));
			((MethodReference)val10).Parameters.Add(new ParameterDefinition(val9));
			((MethodReference)val10).Parameters.Add(new ParameterDefinition(val4));
			val10.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
			type3.Methods.Add(val10);
			TypeDefinition type4 = def.MainModule.GetType("RoR2.PlayerCharacterMasterController");
			type4.Fields.Add(new FieldDefinition("wasClaimed", (FieldAttributes)6, val5));
			MethodDefinition val11 = TypeDefinitionRocks.GetMethods(type4).First((MethodDefinition x) => ((MemberReference)x).Name == "Update");
			int num = val11.Body.Instructions.Count - 1;
			val11.Body.Instructions.Insert(num, Instruction.Create(OpCodes.Ldarg_0));
			val11.Body.Instructions.Insert(num + 1, Instruction.Create(OpCodes.Ldarg_0));
			val11.Body.Instructions.Insert(num + 2, Instruction.Create(OpCodes.Ldfld, (FieldReference)(object)((IEnumerable<FieldDefinition>)type4.Fields).First((FieldDefinition x) => ((MemberReference)x).Name == "jumpWasClaimed")));
			val11.Body.Instructions.Insert(num + 3, Instruction.Create(OpCodes.Stfld, (FieldReference)(object)((IEnumerable<FieldDefinition>)type4.Fields).First((FieldDefinition x) => ((MemberReference)x).Name == "wasClaimed")));
		}
	}
}

SeekersPatcherDLL.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using On.RoR2;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Projectile;
using UnityEngine;

[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: IgnoresAccessChecksTo("RoR2")]
[assembly: AssemblyCompany("SeekersPatcherDLL")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SeekersPatcherDLL")]
[assembly: AssemblyTitle("SeekersPatcherDLL")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 SeekersPatcherDLL
{
	[BepInPlugin("___0pseudopulse.__SeekersPatcherDLL", "__SeekersPatcherDLL", "1.0.0")]
	public class _0Main : BaseUnityPlugin
	{
		public delegate void orig_FireProjectile(ProjectileManager instance, GameObject p1, Vector3 p2, Quaternion p3, GameObject p4, float p5, float p6, bool p7, DamageColorIndex p8, GameObject p9, float p10);

		public const string PluginGUID = "___0pseudopulse.__SeekersPatcherDLL";

		public const string PluginAuthor = "___0pseudopulse";

		public const string PluginName = "__SeekersPatcherDLL";

		public const string PluginVersion = "1.0.0";

		public static ManualLogSource ModLogger;

		public void Awake()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			ModLogger = ((BaseUnityPlugin)this).Logger;
			DLC2Content.LoadStaticContentAsync += new hook_LoadStaticContentAsync(OnLoadContent);
			((BaseUnityPlugin)this).Logger.LogError((object)(from x in typeof(ProjectileManager).GetMethods(BindingFlags.Instance | BindingFlags.Public)
				where x.Name == "FireProjectile"
				orderby x.GetParameters().Length
				select x).ElementAt(1));
			Hook val = new Hook((MethodBase)(from x in typeof(ProjectileManager).GetMethods(BindingFlags.Instance | BindingFlags.Public)
				where x.Name == "FireProjectile"
				orderby x.GetParameters().Length
				select x).ElementAt(1), typeof(_0Main).GetMethod("FireProjectile", BindingFlags.Static | BindingFlags.Public));
		}

		public static void FireProjectile(orig_FireProjectile orig, ProjectileManager instance, GameObject p1, Vector3 p2, Quaternion p3, GameObject p4, float p5, float p6, bool p7, DamageColorIndex p8, GameObject p9, float p10)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			ProjectileManager.instance.FireProjectile(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, (DamageTypeCombo?)null);
		}

		private IEnumerator OnLoadContent(orig_LoadStaticContentAsync orig, DLC2Content self, LoadStaticContentAsyncArgs args)
		{
			yield return orig.Invoke(self, args);
			typeof(Items).GetField("NegateAttack").SetValue(null, Items.SpeedBoostPickup);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}