Decompiled source of LeptonDaisyBuff v1.1.2

LeptonDaisyBuff.dll

Decompiled 7 months ago
using System;
using System.Collections.Generic;
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.EntityStates.TeleporterHealNovaController;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using R2API;
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("LeptonDaisyBuff")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LeptonDaisyBuff")]
[assembly: AssemblyTitle("LeptonDaisyBuff")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace LeptonDaisyBuff;

[BepInPlugin("OakPrime.LeptonDaisyBuff", "LeptonDaisyBuff", "1.1.2")]
public class LeptonDaisyBuff : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

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

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

		public static Action<HealthComponent> <>9__5_5;

		public static Manipulator <>9__5_0;

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

		public static Manipulator <>9__5_1;

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

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

		public static Func<float, float, float> <>9__5_9;

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

		public static Manipulator <>9__5_2;

		internal void <Awake>b__5_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_0069: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int num2 = default(int);
			int num = default(int);
			val.TryGotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num2),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num)
			});
			val.Index += 3;
			val.Emit(OpCodes.Ldloc_2);
			val.EmitDelegate<Action<HealthComponent>>((Action<HealthComponent>)delegate(HealthComponent healthComponent)
			{
				Util.CleanseBody(healthComponent.body, true, false, true, true, true, true);
			});
		}

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

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

		internal void <Awake>b__5_5(HealthComponent healthComponent)
		{
			Util.CleanseBody(healthComponent.body, true, false, true, true, true, true);
		}

		internal void <Awake>b__5_1(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);
			float num = default(float);
			val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num)
			});
			val.Next.Operand = 0.35f;
		}

		internal bool <Awake>b__5_6(Instruction x)
		{
			float num = default(float);
			return ILPatternMatchingExt.MatchLdcR4(x, ref num);
		}

		internal void <Awake>b__5_2(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int num = default(int);
			val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num)
			});
			val.Emit(OpCodes.Ldc_I4_2);
			val.Emit(OpCodes.Mul);
			val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchMul(x)
			});
			int index = val.Index;
			val.Index = index + 1;
			val.Emit(OpCodes.Ldarg_1);
			val.EmitDelegate<Func<float, float, float>>((Func<float, float, float>)((float nextPulseFraction, float prevPulseFraction) => (prevPulseFraction < 0.01f) ? 0.01f : nextPulseFraction));
			val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0)
			});
			index = val.Index;
			val.Index = index + 1;
			val.Emit(OpCodes.Ldc_I4_2);
			val.Emit(OpCodes.Mul);
		}

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

		internal bool <Awake>b__5_8(Instruction x)
		{
			return ILPatternMatchingExt.MatchMul(x);
		}

		internal float <Awake>b__5_9(float nextPulseFraction, float prevPulseFraction)
		{
			if (prevPulseFraction < 0.01f)
			{
				return 0.01f;
			}
			return nextPulseFraction;
		}

		internal bool <Awake>b__5_10(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdarg(x, 0);
		}
	}

	public const string PluginGUID = "OakPrime.LeptonDaisyBuff";

	public const string PluginAuthor = "OakPrime";

	public const string PluginName = "LeptonDaisyBuff";

	public const string PluginVersion = "1.1.2";

	private readonly Dictionary<string, string> DefaultLanguage = new Dictionary<string, string>();

	public void Awake()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: 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
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Expected O, but got Unknown
		Log.Init(((BaseUnityPlugin)this).Logger);
		try
		{
			object obj = <>c.<>9__5_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_0069: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val6 = new ILCursor(il);
					int num4 = default(int);
					int num3 = default(int);
					val6.TryGotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num4),
						(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num3)
					});
					val6.Index += 3;
					val6.Emit(OpCodes.Ldloc_2);
					val6.EmitDelegate<Action<HealthComponent>>((Action<HealthComponent>)delegate(HealthComponent healthComponent)
					{
						Util.CleanseBody(healthComponent.body, true, false, true, true, true, true);
					});
				};
				<>c.<>9__5_0 = val;
				obj = (object)val;
			}
			HealPulse.Update += (Manipulator)obj;
			object obj2 = <>c.<>9__5_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
					ILCursor val5 = new ILCursor(il);
					float num2 = default(float);
					val5.TryGotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num2)
					});
					val5.Next.Operand = 0.35f;
				};
				<>c.<>9__5_1 = val2;
				obj2 = (object)val2;
			}
			TeleporterHealNovaPulse.OnEnter += (Manipulator)obj2;
			object obj3 = <>c.<>9__5_2;
			if (obj3 == null)
			{
				Manipulator val3 = 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_0038: Unknown result type (might be due to invalid IL or missing references)
					//IL_0044: Unknown result type (might be due to invalid IL or missing references)
					//IL_0090: Unknown result type (might be due to invalid IL or missing references)
					//IL_0102: Unknown result type (might be due to invalid IL or missing references)
					//IL_010e: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val4 = new ILCursor(il);
					int num = default(int);
					val4.TryGotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num)
					});
					val4.Emit(OpCodes.Ldc_I4_2);
					val4.Emit(OpCodes.Mul);
					val4.TryGotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchMul(x)
					});
					int index = val4.Index;
					val4.Index = index + 1;
					val4.Emit(OpCodes.Ldarg_1);
					val4.EmitDelegate<Func<float, float, float>>((Func<float, float, float>)((float nextPulseFraction, float prevPulseFraction) => (prevPulseFraction < 0.01f) ? 0.01f : nextPulseFraction));
					val4.TryGotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0)
					});
					index = val4.Index;
					val4.Index = index + 1;
					val4.Emit(OpCodes.Ldc_I4_2);
					val4.Emit(OpCodes.Mul);
				};
				<>c.<>9__5_2 = val3;
				obj3 = (object)val3;
			}
			TeleporterHealNovaGeneratorMain.CalculateNextPulseFraction += (Manipulator)obj3;
			UpdateText();
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
		}
	}

	private void UpdateText()
	{
		ReplaceString("ITEM_TPHEALINGNOVA_DESC", "Release a <style=cIsHealing>healing nova</style> during the Teleporter event, <style=cIsHealing>cleansing</style> and <style=cIsHealing>healing</style> all nearby allies for <style=cIsHealing>35%</style> of their maximum health. Occurs <style=cIsHealing>3</style> <style=cStack>(+2 per stack)</style> times.");
	}

	private void ReplaceString(string token, string newText)
	{
		DefaultLanguage[token] = Language.GetString(token);
		LanguageAPI.Add(token, newText);
	}
}
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);
	}
}