Decompiled source of Commando IFrames v1.0.1

CommandoIFrames.dll

Decompiled 4 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 BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Commando;
using IL.EntityStates.Commando;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("CommandoIFrames")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CommandoIFrames")]
[assembly: AssemblyTitle("CommandoIFrames")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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 CommandoIFrames
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Ambition.CommandoIFrames", "CommandoIFrames", "1.0.0")]
	public class CommandoIFrames : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Action<DodgeState> <>9__16_2;

			public static Manipulator <>9__16_0;

			public static Action<SlideState> <>9__16_3;

			public static Manipulator <>9__16_1;

			internal void <Awake>b__16_0(ILContext il1)
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				if (IFrame.Value == 0f)
				{
					return;
				}
				ILCursor val = new ILCursor(il1);
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<DodgeState>>((Action<DodgeState>)delegate(DodgeState d)
				{
					if (Object.op_Implicit((Object)(object)((EntityState)d).outer) && Object.op_Implicit((Object)(object)((EntityState)d).outer.commonComponents.characterBody))
					{
						((EntityState)d).outer.commonComponents.characterBody.AddTimedBuff(Buffs.Immune, IFrame.Value);
					}
				});
			}

			internal void <Awake>b__16_2(DodgeState d)
			{
				if (Object.op_Implicit((Object)(object)((EntityState)d).outer) && Object.op_Implicit((Object)(object)((EntityState)d).outer.commonComponents.characterBody))
				{
					((EntityState)d).outer.commonComponents.characterBody.AddTimedBuff(Buffs.Immune, IFrame.Value);
				}
			}

			internal void <Awake>b__16_1(ILContext il1)
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				if (IFrame.Value == 0f)
				{
					return;
				}
				ILCursor val = new ILCursor(il1);
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<SlideState>>((Action<SlideState>)delegate(SlideState d)
				{
					if (Object.op_Implicit((Object)(object)((EntityState)d).outer) && Object.op_Implicit((Object)(object)((EntityState)d).outer.commonComponents.characterBody))
					{
						((EntityState)d).outer.commonComponents.characterBody.AddTimedBuff(Buffs.Immune, IFrame.Value);
					}
				});
			}

			internal void <Awake>b__16_3(SlideState d)
			{
				if (Object.op_Implicit((Object)(object)((EntityState)d).outer) && Object.op_Implicit((Object)(object)((EntityState)d).outer.commonComponents.characterBody))
				{
					((EntityState)d).outer.commonComponents.characterBody.AddTimedBuff(Buffs.Immune, IFrame.Value);
				}
			}
		}

		public const string PluginGUID = "Ambition.CommandoIFrames";

		public const string PluginAuthor = "Ambition";

		public const string PluginName = "CommandoIFrames";

		public const string PluginVersion = "1.0.0";

		public static ConfigEntry<float> IFrame { get; set; }

		public static ConfigEntry<bool> Roll { get; set; }

		public static ConfigEntry<bool> Slide { get; set; }

		public void Awake()
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_00b4: 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_00bf: Expected O, but got Unknown
			IFrame = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "IFrame duration", 0.5f, "Duration of iframes after using utility skill in seconds. Default is 0.5");
			Roll = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Enable Roll IFrames", true, "Set to true if you want to enable roll iframes");
			Slide = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Enable Slide IFrames", true, "Set to true if you want to enable slide iframes");
			if (Roll.Value)
			{
				object obj = <>c.<>9__16_0;
				if (obj == null)
				{
					Manipulator val = delegate(ILContext il1)
					{
						//IL_0013: Unknown result type (might be due to invalid IL or missing references)
						//IL_0018: Unknown result type (might be due to invalid IL or missing references)
						//IL_0019: Unknown result type (might be due to invalid IL or missing references)
						if (IFrame.Value != 0f)
						{
							ILCursor val4 = new ILCursor(il1);
							val4.Emit(OpCodes.Ldarg_0);
							val4.EmitDelegate<Action<DodgeState>>((Action<DodgeState>)delegate(DodgeState d)
							{
								if (Object.op_Implicit((Object)(object)((EntityState)d).outer) && Object.op_Implicit((Object)(object)((EntityState)d).outer.commonComponents.characterBody))
								{
									((EntityState)d).outer.commonComponents.characterBody.AddTimedBuff(Buffs.Immune, IFrame.Value);
								}
							});
						}
					};
					<>c.<>9__16_0 = val;
					obj = (object)val;
				}
				DodgeState.OnEnter += (Manipulator)obj;
			}
			if (!Slide.Value)
			{
				return;
			}
			object obj2 = <>c.<>9__16_1;
			if (obj2 == null)
			{
				Manipulator val2 = delegate(ILContext il1)
				{
					//IL_0013: Unknown result type (might be due to invalid IL or missing references)
					//IL_0018: Unknown result type (might be due to invalid IL or missing references)
					//IL_0019: Unknown result type (might be due to invalid IL or missing references)
					if (IFrame.Value != 0f)
					{
						ILCursor val3 = new ILCursor(il1);
						val3.Emit(OpCodes.Ldarg_0);
						val3.EmitDelegate<Action<SlideState>>((Action<SlideState>)delegate(SlideState d)
						{
							if (Object.op_Implicit((Object)(object)((EntityState)d).outer) && Object.op_Implicit((Object)(object)((EntityState)d).outer.commonComponents.characterBody))
							{
								((EntityState)d).outer.commonComponents.characterBody.AddTimedBuff(Buffs.Immune, IFrame.Value);
							}
						});
					}
				};
				<>c.<>9__16_1 = val2;
				obj2 = (object)val2;
			}
			SlideState.OnEnter += (Manipulator)obj2;
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

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

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

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

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

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

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

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