Decompiled source of VoidtouchedRework v1.0.1

VoidtouchedRework.dll

Decompiled 2 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 BepInEx.Logging;
using IL.RoR2;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
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 = "")]
[assembly: AssemblyCompany("VoidtouchedRework")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("VoidtouchedRework")]
[assembly: AssemblyTitle("VoidtouchedRework")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace VoidtouchedRework;

internal static class Log
{
	internal static ManualLogSource _logSource;

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

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

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

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

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

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

	internal static void LogWarning(object data)
	{
		_logSource.LogWarning(data);
	}
}
[BepInPlugin("OakPrime.VoidtouchedRework", "VoidtouchedRework", "1.0.1")]
public class VoidtouchedRework : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

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

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

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

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

		public static Action<CharacterBody, CharacterBody, DamageInfo> <>9__4_8;

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

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

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

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

		public static Manipulator <>9__4_0;

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

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

		public static Manipulator <>9__4_1;

		public static hook_OnEnable <>9__4_2;

		public static hook_OnDisable <>9__4_3;

		internal void <Awake>b__4_0(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			MethodReference val5 = default(MethodReference);
			ILLabel val4 = default(ILLabel);
			int num3 = default(int);
			val.GotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val5),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val4),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num3)
			});
			val.Index += 3;
			val.Emit(OpCodes.Ldloc_1);
			val.Emit(OpCodes.Ldloc_2);
			val.Emit(OpCodes.Ldarg_1);
			val.EmitDelegate<Action<CharacterBody, CharacterBody, DamageInfo>>((Action<CharacterBody, CharacterBody, DamageInfo>)delegate(CharacterBody attacker, CharacterBody victim, DamageInfo info)
			{
				if (attacker.HasBuff(Buffs.EliteVoid) && Util.CheckRoll(info.procCoefficient * 100f, attacker.master))
				{
					victim.AddTimedBuff(Buffs.NullifyStack, 8f);
				}
			});
			int num2 = default(int);
			int num = default(int);
			FieldReference val3 = default(FieldReference);
			MethodReference val2 = default(MethodReference);
			val.GotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num2),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, ref val3),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2)
			});
			int index = val.Index;
			val.Index = index - 1;
			val.RemoveRange(10);
		}

		internal bool <Awake>b__4_4(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdloc(x, 1);
		}

		internal bool <Awake>b__4_5(Instruction x)
		{
			MethodReference val = default(MethodReference);
			return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val);
		}

		internal bool <Awake>b__4_6(Instruction x)
		{
			ILLabel val = default(ILLabel);
			return ILPatternMatchingExt.MatchBrfalse(x, ref val);
		}

		internal bool <Awake>b__4_7(Instruction x)
		{
			int num = default(int);
			return ILPatternMatchingExt.MatchLdarg(x, ref num);
		}

		internal void <Awake>b__4_8(CharacterBody attacker, CharacterBody victim, DamageInfo info)
		{
			if (attacker.HasBuff(Buffs.EliteVoid) && Util.CheckRoll(info.procCoefficient * 100f, attacker.master))
			{
				victim.AddTimedBuff(Buffs.NullifyStack, 8f);
			}
		}

		internal bool <Awake>b__4_9(Instruction x)
		{
			int num = default(int);
			return ILPatternMatchingExt.MatchLdloc(x, ref num);
		}

		internal bool <Awake>b__4_10(Instruction x)
		{
			int num = default(int);
			return ILPatternMatchingExt.MatchLdloc(x, ref num);
		}

		internal bool <Awake>b__4_11(Instruction x)
		{
			FieldReference val = default(FieldReference);
			return ILPatternMatchingExt.MatchLdsfld(x, ref val);
		}

		internal bool <Awake>b__4_12(Instruction x)
		{
			MethodReference val = default(MethodReference);
			return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val);
		}

		internal void <Awake>b__4_1(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel val2 = default(ILLabel);
			val.GotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 2),
				(Instruction x) => ILPatternMatchingExt.MatchBge(x, ref val2)
			});
			val.Remove();
			val.Emit(OpCodes.Ldc_I4_1);
		}

		internal bool <Awake>b__4_13(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdcI4(x, 2);
		}

		internal bool <Awake>b__4_14(Instruction x)
		{
			ILLabel val = default(ILLabel);
			return ILPatternMatchingExt.MatchBge(x, ref val);
		}

		internal void <Awake>b__4_2(orig_OnEnable orig, AffixVoidBehavior self)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (self == null)
			{
				return;
			}
			CharacterBody body = ((ItemBehavior)self).body;
			if (body != null)
			{
				Inventory inventory = body.inventory;
				if (inventory != null)
				{
					inventory.GiveItem(Items.BoostDamage.itemIndex, 3);
				}
			}
		}

		internal void <Awake>b__4_3(orig_OnDisable orig, AffixVoidBehavior self)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (self == null)
			{
				return;
			}
			CharacterBody body = ((ItemBehavior)self).body;
			if (body != null)
			{
				Inventory inventory = body.inventory;
				if (inventory != null)
				{
					inventory.RemoveItem(Items.BoostDamage.itemIndex, 3);
				}
			}
		}
	}

	public const string PluginGUID = "OakPrime.VoidtouchedRework";

	public const string PluginAuthor = "OakPrime";

	public const string PluginName = "VoidtouchedRework";

	public const string PluginVersion = "1.0.1";

	public void Awake()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Expected O, but got Unknown
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Expected O, but got Unknown
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Expected O, but got Unknown
		Log.Init(((BaseUnityPlugin)this).Logger);
		try
		{
			((BaseUnityPlugin)this).Logger.LogDebug((object)"test");
			object obj = <>c.<>9__4_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
					//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val7 = new ILCursor(il);
					MethodReference val11 = default(MethodReference);
					ILLabel val10 = default(ILLabel);
					int num3 = default(int);
					val7.GotoNext(new Func<Instruction, bool>[4]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val11),
						(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val10),
						(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num3)
					});
					val7.Index += 3;
					val7.Emit(OpCodes.Ldloc_1);
					val7.Emit(OpCodes.Ldloc_2);
					val7.Emit(OpCodes.Ldarg_1);
					val7.EmitDelegate<Action<CharacterBody, CharacterBody, DamageInfo>>((Action<CharacterBody, CharacterBody, DamageInfo>)delegate(CharacterBody attacker, CharacterBody victim, DamageInfo info)
					{
						if (attacker.HasBuff(Buffs.EliteVoid) && Util.CheckRoll(info.procCoefficient * 100f, attacker.master))
						{
							victim.AddTimedBuff(Buffs.NullifyStack, 8f);
						}
					});
					int num2 = default(int);
					int num = default(int);
					FieldReference val9 = default(FieldReference);
					MethodReference val8 = default(MethodReference);
					val7.GotoNext(new Func<Instruction, bool>[4]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num2),
						(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
						(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, ref val9),
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val8)
					});
					int index = val7.Index;
					val7.Index = index - 1;
					val7.RemoveRange(10);
				};
				<>c.<>9__4_0 = val;
				obj = (object)val;
			}
			GlobalEventManager.ProcessHitEnemy += (Manipulator)obj;
			object obj2 = <>c.<>9__4_1;
			if (obj2 == null)
			{
				Manipulator val2 = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_0061: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val5 = new ILCursor(il);
					ILLabel val6 = default(ILLabel);
					val5.GotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 2),
						(Instruction x) => ILPatternMatchingExt.MatchBge(x, ref val6)
					});
					val5.Remove();
					val5.Emit(OpCodes.Ldc_I4_1);
				};
				<>c.<>9__4_1 = val2;
				obj2 = (object)val2;
			}
			CharacterBody.AddTimedBuff_BuffDef_float += (Manipulator)obj2;
			object obj3 = <>c.<>9__4_2;
			if (obj3 == null)
			{
				hook_OnEnable val3 = delegate(orig_OnEnable orig, AffixVoidBehavior self)
				{
					//IL_002a: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self);
					if (self != null)
					{
						CharacterBody body2 = ((ItemBehavior)self).body;
						if (body2 != null)
						{
							Inventory inventory2 = body2.inventory;
							if (inventory2 != null)
							{
								inventory2.GiveItem(Items.BoostDamage.itemIndex, 3);
							}
						}
					}
				};
				<>c.<>9__4_2 = val3;
				obj3 = (object)val3;
			}
			AffixVoidBehavior.OnEnable += (hook_OnEnable)obj3;
			object obj4 = <>c.<>9__4_3;
			if (obj4 == null)
			{
				hook_OnDisable val4 = delegate(orig_OnDisable orig, AffixVoidBehavior self)
				{
					//IL_002a: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self);
					if (self != null)
					{
						CharacterBody body = ((ItemBehavior)self).body;
						if (body != null)
						{
							Inventory inventory = body.inventory;
							if (inventory != null)
							{
								inventory.RemoveItem(Items.BoostDamage.itemIndex, 3);
							}
						}
					}
				};
				<>c.<>9__4_3 = val4;
				obj4 = (object)val4;
			}
			AffixVoidBehavior.OnDisable += (hook_OnDisable)obj4;
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
		}
	}
}