Decompiled source of VoidtouchedRework v1.0.0

VoidtouchedRework.dll

Decompiled 6 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.0", 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.0")]
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<CharacterBody, CharacterBody, DamageInfo, CharacterBody> <>9__4_7;

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

		public static Manipulator <>9__4_0;

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

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

		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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			MethodReference val2 = default(MethodReference);
			int num = default(int);
			val.GotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num)
			});
			int index = val.Index;
			val.Index = index + 1;
			val.Emit(OpCodes.Ldloc_2);
			val.Emit(OpCodes.Ldarg_1);
			val.EmitDelegate<Func<CharacterBody, CharacterBody, DamageInfo, CharacterBody>>((Func<CharacterBody, CharacterBody, DamageInfo, CharacterBody>)delegate(CharacterBody attacker, CharacterBody victim, DamageInfo info)
			{
				if (attacker.HasBuff(Buffs.EliteVoid) && Util.CheckRoll(info.procCoefficient * 100f, attacker.master))
				{
					victim.AddTimedBuff(Buffs.NullifyStack, 8f);
				}
				return attacker;
			});
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "EliteVoid")
			});
			index = val.Index;
			val.Index = index - 1;
			val.RemoveRange(8);
		}

		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)
		{
			int num = default(int);
			return ILPatternMatchingExt.MatchStloc(x, ref num);
		}

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

		internal bool <Awake>b__4_8(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "EliteVoid");
		}

		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_9(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdcI4(x, 2);
		}

		internal bool <Awake>b__4_10(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_0022: Unknown result type (might be due to invalid IL or missing references)
			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.0";

	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_008d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0099: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val7 = new ILCursor(il);
					MethodReference val8 = default(MethodReference);
					int num = default(int);
					val7.GotoNext(new Func<Instruction, bool>[3]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val8),
						(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num)
					});
					int index = val7.Index;
					val7.Index = index + 1;
					val7.Emit(OpCodes.Ldloc_2);
					val7.Emit(OpCodes.Ldarg_1);
					val7.EmitDelegate<Func<CharacterBody, CharacterBody, DamageInfo, CharacterBody>>((Func<CharacterBody, CharacterBody, DamageInfo, CharacterBody>)delegate(CharacterBody attacker, CharacterBody victim, DamageInfo info)
					{
						if (attacker.HasBuff(Buffs.EliteVoid) && Util.CheckRoll(info.procCoefficient * 100f, attacker.master))
						{
							victim.AddTimedBuff(Buffs.NullifyStack, 8f);
						}
						return attacker;
					});
					val7.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "EliteVoid")
					});
					index = val7.Index;
					val7.Index = index - 1;
					val7.RemoveRange(8);
				};
				<>c.<>9__4_0 = val;
				obj = (object)val;
			}
			GlobalEventManager.OnHitEnemy += (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_0022: Unknown result type (might be due to invalid IL or missing references)
					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));
		}
	}
}