Decompiled source of GestureEnigma v1.0.2

GestureEnigma.dll

Decompiled 3 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 IL.RoR2;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Artifacts;

[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("GestureEnigma")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+bf69db9a2c8e556808c9ab44fc1a27bf22af3c30")]
[assembly: AssemblyProduct("GestureEnigma")]
[assembly: AssemblyTitle("GestureEnigma")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace GestureEnigma;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Moffein.GestureEnigma", "GestureEnigma", "1.0.2")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class Class1 : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

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

		public static Func<int, int> <>9__1_3;

		public static Manipulator <>9__1_0;

		public static hook_Init <>9__1_1;

		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
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "AutoCastEquipment")
			});
			val.Index += 2;
			val.EmitDelegate<Func<int, int>>((Func<int, int>)((int orig) => 0));
		}

		internal bool <Awake>b__1_2(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "AutoCastEquipment");
		}

		internal int <Awake>b__1_3(int orig)
		{
			return 0;
		}

		internal void <Awake>b__1_1(orig_Init orig)
		{
			orig.Invoke();
			Items.AutoCastEquipment.pickupToken = "GestureEnigma_Pickup";
			Items.AutoCastEquipment.descriptionToken = "GestureEnigma_Desc";
		}
	}

	public static bool autofireEnabled;

	public void Awake()
	{
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Expected O, but got Unknown
		autofireEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Enable Autofire (Client-Side)", false, "Gesture autofires equipment.").Value;
		if (!autofireEnabled)
		{
			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
					ILCursor val3 = new ILCursor(il);
					val3.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "AutoCastEquipment")
					});
					val3.Index += 2;
					val3.EmitDelegate<Func<int, int>>((Func<int, int>)((int orig) => 0));
				};
				<>c.<>9__1_0 = val;
				obj = (object)val;
			}
			EquipmentSlot.MyFixedUpdate += (Manipulator)obj;
		}
		LanguageAPI.Add("GestureEnigma_Pickup", "Dramatically reduce Equipment cooldown... <color=#FF7F7F>BUT it is randomized after each activation.</color>");
		LanguageAPI.Add("GestureEnigma_Desc", "<style=cIsUtility>Reduce Equipment cooldown</style> by <style=cIsUtility>50%</style> <style=cStack>(+15% per stack)</style>. Forces your Equipment to change to a <style=cIsHealth>random Equipment</style> whenever it is <style=cIsUtility>activated</style>.");
		object obj2 = <>c.<>9__1_1;
		if (obj2 == null)
		{
			hook_Init val2 = delegate(orig_Init orig)
			{
				orig.Invoke();
				Items.AutoCastEquipment.pickupToken = "GestureEnigma_Pickup";
				Items.AutoCastEquipment.descriptionToken = "GestureEnigma_Desc";
			};
			<>c.<>9__1_1 = val2;
			obj2 = (object)val2;
		}
		ItemCatalog.Init += (hook_Init)obj2;
		EquipmentSlot.onServerEquipmentActivated += EquipmentSlot_onServerEquipmentActivated;
	}

	private static void EquipmentSlot_onServerEquipmentActivated(EquipmentSlot equipmentSlot, EquipmentIndex equipmentIndex)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		if (equipmentSlot.characterBody.inventory.GetItemCount(Items.AutoCastEquipment) > 0)
		{
			EnigmaArtifactManager.OnServerEquipmentActivated(equipmentSlot, equipmentIndex);
		}
	}
}