Decompiled source of VanillaItemTweaks v0.1.1

VanillaItemTweaks.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
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.Missions.BrotherEncounter;
using IL.EntityStates.TeleporterHealNovaController;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Missions.BrotherEncounter;
using R2API;
using RoR2;
using RoR2.Orbs;
using UnityEngine;
using UnityEngine.Networking;
using VanillaItemTweaks.Boss;
using VanillaItemTweaks.Common;
using VanillaItemTweaks.Legendary;
using VanillaItemTweaks.Uncommon;
using VanillaItemTweaks.Void;

[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("VanillaItemTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("VanillaItemTweaks")]
[assembly: AssemblyTitle("VanillaItemTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace VanillaItemTweaks
{
	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.VanillaItemTweaks", "VanillaItemTweaks", "0.1.0")]
	public class VanillaItemTweaks : BaseUnityPlugin
	{
		public const string PluginGUID = "OakPrime.VanillaItemTweaks";

		public const string PluginAuthor = "OakPrime";

		public const string PluginName = "VanillaItemTweaks";

		public const string PluginVersion = "0.1.0";

		public static ManualLogSource logger;

		public void Awake()
		{
			logger = ((BaseUnityPlugin)this).Logger;
			Log.Init(logger);
			try
			{
				VITConfig.InitializeConfig();
				Init();
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
			}
		}

		private void Init()
		{
			if (VITConfig.enableKnurlBuff.Value)
			{
				KnurlBuff.Init();
			}
			if (VITConfig.enablePolyluteNerf.Value)
			{
				PolyluteNerf.Init();
			}
			if (VITConfig.enableHappiestMaskRework.Value)
			{
				HappiestMaskRework.Init();
			}
			if (VITConfig.enableLaserScopeBuff.Value)
			{
				LaserScopeBuff.Init();
			}
			if (VITConfig.enableDeathMarkFix.Value)
			{
				DeathMarkFix.Init();
			}
			if (VITConfig.enableHuntersHarpoonRework.Value)
			{
				HuntersHarpoonRework.Init();
			}
			if (VITConfig.enableLeechingSeedBuff.Value)
			{
				LeechingSeedBuff.Init();
			}
			if (VITConfig.enableLeptonDaisyBuff.Value)
			{
				LeptonDaisyBuff.Init();
			}
			if (VITConfig.enableRedWhipBuff.Value)
			{
				RedWhipBuff.Init();
			}
			if (VITConfig.enableOldGuillotineBuff.Value)
			{
				OldGuillotineBuff.Init();
			}
			if (VITConfig.enableRegeneratingScrapBuff.Value)
			{
				RegeneratingScrapBuff.Init();
			}
			if (VITConfig.enableWarbannerBuff.Value)
			{
				WarbannerBuff.Init();
			}
		}
	}
	internal static class VITConfig
	{
		public static ConfigEntry<bool> enableKnurlBuff;

		public static ConfigEntry<bool> enableHappiestMaskRework;

		public static ConfigEntry<bool> enableDeathMarkFix;

		public static ConfigEntry<bool> enableHuntersHarpoonRework;

		public static ConfigEntry<bool> enableLeechingSeedBuff;

		public static ConfigEntry<bool> enableLeptonDaisyBuff;

		public static ConfigEntry<bool> enablePolyluteNerf;

		public static ConfigEntry<bool> enableRedWhipBuff;

		public static ConfigEntry<bool> enableLaserScopeBuff;

		public static ConfigEntry<bool> enableWarbannerBuff;

		public static ConfigEntry<bool> enableOldGuillotineBuff;

		public static ConfigEntry<bool> enableRegeneratingScrapBuff;

		public static void InitializeConfig()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			ConfigFile val = new ConfigFile(Paths.ConfigPath + "\\OakPrime.VanillaItemTweaks.cfg", true);
			enableKnurlBuff = val.Bind<bool>("Main", "Enable Knurl Buff", true, "Gives Titanic Knurl additional +10 armor per stack.");
			enableLeechingSeedBuff = val.Bind<bool>("Main", "Enable Leeching Seed Buff", true, "Leeching seed also heals for an additional 0.2 health regardless of proc coefficient.");
			enablePolyluteNerf = val.Bind<bool>("Main", "Enable Polylute Nerf", true, "Reduces Polylute strikes from 3 to 2.");
			enableLeptonDaisyBuff = val.Bind<bool>("Main", "Enable Lepton Daisy Buff", true, "Lepton Daisy now pulses twice per item at a lower value, cleansing debuffs (including band/bear cooldown). Also heals once on holdout start.");
			enableHuntersHarpoonRework = val.Bind<bool>("Main", "Enable Hunters Harpoon Rework", true, "Harpoon speed is less intense but lasts longer.");
			enableHappiestMaskRework = val.Bind<bool>("Main", "Enable Happiest Mask Rework", true, "Happiest Mask now spawns a ghost for 30 seconds if you don't have one on enemy kill.");
			enableDeathMarkFix = val.Bind<bool>("Main", "Enable Death Mark Fix", true, "Reduces Death Mark debuffs required to 3 and reduces its damage multiplier to 1.35x.");
			enableRedWhipBuff = val.Bind<bool>("Main", "Enable Red Whip Buff", true, "Raises Red Whip speed to 40%.");
			enableLaserScopeBuff = val.Bind<bool>("Main", "Enable Laser Scope Buff", true, "Gives Laser Scope 15% non-stacking crit chance.");
			enableWarbannerBuff = val.Bind<bool>("Main", "Enable Warbanner Buff", true, "Warbanner activates when starting Mithrix fight.");
			enableOldGuillotineBuff = val.Bind<bool>("Main", "Enable Old Guillotine Buff", true, "Guillotine executes enemies at 20% health instead of 11%.");
			enableRegeneratingScrapBuff = val.Bind<bool>("Main", "Enable Regenerating Scrap Buff", true, "TBD");
		}
	}
}
namespace VanillaItemTweaks.Void
{
	public static class PolyluteNerf
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

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

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

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

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

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

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

			public static Manipulator <>9__0_0;

			internal void <Init>b__0_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);
				int num3 = default(int);
				int num2 = default(int);
				int num = default(int);
				val.TryGotoNext(new Func<Instruction, bool>[5]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num3),
					(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num2),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
					(Instruction x) => ILPatternMatchingExt.MatchMul(x),
					(Instruction x) => ILPatternMatchingExt.MatchStfld<VoidLightningOrb>(x, "totalStrikes")
				});
				val.Index += 4;
				val.EmitDelegate<Func<int, int>>((Func<int, int>)((int totalStrikes) => totalStrikes * 2 / 3));
			}

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

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

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

			internal bool <Init>b__0_4(Instruction x)
			{
				return ILPatternMatchingExt.MatchMul(x);
			}

			internal bool <Init>b__0_5(Instruction x)
			{
				return ILPatternMatchingExt.MatchStfld<VoidLightningOrb>(x, "totalStrikes");
			}

			internal int <Init>b__0_6(int totalStrikes)
			{
				return totalStrikes * 2 / 3;
			}
		}

		public static void Init()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			try
			{
				object obj = <>c.<>9__0_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 val2 = new ILCursor(il);
						int num3 = default(int);
						int num2 = default(int);
						int num = default(int);
						val2.TryGotoNext(new Func<Instruction, bool>[5]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num3),
							(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num2),
							(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
							(Instruction x) => ILPatternMatchingExt.MatchMul(x),
							(Instruction x) => ILPatternMatchingExt.MatchStfld<VoidLightningOrb>(x, "totalStrikes")
						});
						val2.Index += 4;
						val2.EmitDelegate<Func<int, int>>((Func<int, int>)((int totalStrikes) => totalStrikes * 2 / 3));
					};
					<>c.<>9__0_0 = val;
					obj = (object)val;
				}
				GlobalEventManager.ProcessHitEnemy += (Manipulator)obj;
				ReplaceText();
			}
			catch (Exception ex)
			{
				VanillaItemTweaks.logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
			}
		}

		private static void ReplaceText()
		{
			LanguageAPI.Add("ITEM_CHAINLIGHTNINGVOID_DESC", "<style=cIsDamage>25%</style> chance to fire <style=cIsDamage>lightning</style> for <style=cIsDamage>60%</style> TOTAL damage up to <style=cIsDamage>2</style> <style=cStack>(+2 per stack)</style> times. <style=cIsVoid>Corrupts all Ukeleles</style>.");
		}
	}
}
namespace VanillaItemTweaks.Uncommon
{
	public static class DeathMarkFix
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

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

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

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

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

			public static Manipulator <>9__0_0;

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

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

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

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

			public static Manipulator <>9__0_1;

			internal void <Init>b__0_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_00b2: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				ILLabel val3 = default(ILLabel);
				int num = default(int);
				ILLabel val2 = default(ILLabel);
				val.TryGotoNext(new Func<Instruction, bool>[4]
				{
					(Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val3),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
					(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 4),
					(Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2)
				});
				val.Index += 2;
				val.Next.OpCode = OpCodes.Ldc_I4_3;
			}

			internal bool <Init>b__0_2(Instruction x)
			{
				ILLabel val = default(ILLabel);
				return ILPatternMatchingExt.MatchBlt(x, ref val);
			}

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

			internal bool <Init>b__0_4(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdcI4(x, 4);
			}

			internal bool <Init>b__0_5(Instruction x)
			{
				ILLabel val = default(ILLabel);
				return ILPatternMatchingExt.MatchBlt(x, ref val);
			}

			internal void <Init>b__0_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);
				int num2 = default(int);
				int num = default(int);
				val.TryGotoNext(new Func<Instruction, bool>[4]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num2),
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1.5f),
					(Instruction x) => ILPatternMatchingExt.MatchMul(x),
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num)
				});
				int index = val.Index;
				val.Index = index + 1;
				val.Next.Operand = 1.35f;
			}

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

			internal bool <Init>b__0_7(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdcR4(x, 1.5f);
			}

			internal bool <Init>b__0_8(Instruction x)
			{
				return ILPatternMatchingExt.MatchMul(x);
			}

			internal bool <Init>b__0_9(Instruction x)
			{
				int num = default(int);
				return ILPatternMatchingExt.MatchStloc(x, ref num);
			}
		}

		public static void Init()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			try
			{
				object obj = <>c.<>9__0_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_00b2: Unknown result type (might be due to invalid IL or missing references)
						ILCursor val4 = new ILCursor(il);
						ILLabel val6 = default(ILLabel);
						int num3 = default(int);
						ILLabel val5 = default(ILLabel);
						val4.TryGotoNext(new Func<Instruction, bool>[4]
						{
							(Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val6),
							(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num3),
							(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 4),
							(Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val5)
						});
						val4.Index += 2;
						val4.Next.OpCode = OpCodes.Ldc_I4_3;
					};
					<>c.<>9__0_0 = val;
					obj = (object)val;
				}
				GlobalEventManager.ProcessHitEnemy += (Manipulator)obj;
				object obj2 = <>c.<>9__0_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 val3 = new ILCursor(il);
						int num2 = default(int);
						int num = default(int);
						val3.TryGotoNext(new Func<Instruction, bool>[4]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num2),
							(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1.5f),
							(Instruction x) => ILPatternMatchingExt.MatchMul(x),
							(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num)
						});
						int index = val3.Index;
						val3.Index = index + 1;
						val3.Next.Operand = 1.35f;
					};
					<>c.<>9__0_1 = val2;
					obj2 = (object)val2;
				}
				HealthComponent.TakeDamageProcess += (Manipulator)obj2;
				ReplaceText();
			}
			catch (Exception ex)
			{
				VanillaItemTweaks.logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
			}
		}

		private static void ReplaceText()
		{
			LanguageAPI.Add("ITEM_DEATHMARK_PICKUP", "Enemies with 3 or more debuffs are marked for death, taking bonus damage.");
			LanguageAPI.Add("ITEM_DEATHMARK_DESC", "Enemies with <style=cIsDamage>3</style> or more debuffs are <style=cIsDamage>marked for death</style>, increasing damage taken by <style=cIsDamage>35%</style> from all sources for <style=cIsUtility>7</style> <style=cStack>(+7 per stack)</style> seconds.");
		}
	}
	public static class HuntersHarpoonRework
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

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

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

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

			public static Action<int, CharacterBody> <>9__0_4;

			public static Manipulator <>9__0_0;

			internal void <Init>b__0_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_0094: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				ILLabel val2 = default(ILLabel);
				val.TryGotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 52),
					(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchBle(x, ref val2)
				});
				val.Index += 4;
				val.RemoveRange(37);
				val.Emit(OpCodes.Ldloc, 15);
				val.EmitDelegate<Action<int, CharacterBody>>((Action<int, CharacterBody>)delegate(int itemCount, CharacterBody body)
				{
					if (body != null)
					{
						body.ClearTimedBuffs(Buffs.KillMoveSpeed);
					}
					for (int i = 0; i < 4; i++)
					{
						if (body != null)
						{
							body.AddTimedBuff(Buffs.KillMoveSpeed, 2f * (float)itemCount * (float)Math.Pow(0.75, i));
						}
					}
				});
			}

			internal bool <Init>b__0_1(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdloc(x, 52);
			}

			internal bool <Init>b__0_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdcI4(x, 0);
			}

			internal bool <Init>b__0_3(Instruction x)
			{
				ILLabel val = default(ILLabel);
				return ILPatternMatchingExt.MatchBle(x, ref val);
			}

			internal void <Init>b__0_4(int itemCount, CharacterBody body)
			{
				if (body != null)
				{
					body.ClearTimedBuffs(Buffs.KillMoveSpeed);
				}
				for (int i = 0; i < 4; i++)
				{
					if (body != null)
					{
						body.AddTimedBuff(Buffs.KillMoveSpeed, 2f * (float)itemCount * (float)Math.Pow(0.75, i));
					}
				}
			}
		}

		public static void Init()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			UpdateText();
			try
			{
				object obj = <>c.<>9__0_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_0094: Unknown result type (might be due to invalid IL or missing references)
						ILCursor val2 = new ILCursor(il);
						ILLabel val3 = default(ILLabel);
						val2.TryGotoNext(new Func<Instruction, bool>[3]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 52),
							(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
							(Instruction x) => ILPatternMatchingExt.MatchBle(x, ref val3)
						});
						val2.Index += 4;
						val2.RemoveRange(37);
						val2.Emit(OpCodes.Ldloc, 15);
						val2.EmitDelegate<Action<int, CharacterBody>>((Action<int, CharacterBody>)delegate(int itemCount, CharacterBody body)
						{
							if (body != null)
							{
								body.ClearTimedBuffs(Buffs.KillMoveSpeed);
							}
							for (int i = 0; i < 4; i++)
							{
								if (body != null)
								{
									body.AddTimedBuff(Buffs.KillMoveSpeed, 2f * (float)itemCount * (float)Math.Pow(0.75, i));
								}
							}
						});
					};
					<>c.<>9__0_0 = val;
					obj = (object)val;
				}
				GlobalEventManager.OnCharacterDeath += (Manipulator)obj;
			}
			catch (Exception ex)
			{
				VanillaItemTweaks.logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
			}
		}

		private static void UpdateText()
		{
			LanguageAPI.Add("ITEM_MOVESPEEDONKILL_DESC", "Killing an enemy increases <style=cIsUtility>movement speed</style> by <style=cIsUtility>100%</style> fading over <style=cIsUtility>2</style> <style=cStack>(+2 per stack)</style> seconds.");
		}
	}
	public class LeechingSeedBuff
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

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

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

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

			public static Action<DamageInfo> <>9__0_4;

			public static Manipulator <>9__0_0;

			internal void <Init>b__0_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_007c: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				int num3 = default(int);
				int num2 = default(int);
				val.TryGotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num3),
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<HealthComponent>(x, "combinedHealth"),
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num2)
				});
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Action<DamageInfo>>((Action<DamageInfo>)delegate(DamageInfo damageInfo)
				{
					//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
					if (damageInfo != null && !((Object)(object)damageInfo.attacker == (Object)null))
					{
						CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
						CharacterMaster val2 = ((component != null) ? component.master : null);
						Inventory val3 = ((val2 != null) ? val2.inventory : null);
						if ((Object)(object)val3 != (Object)null && !((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)6))
						{
							int itemCount = val3.GetItemCount(Items.Seed);
							if (itemCount > 0)
							{
								HealthComponent val4 = ((component != null) ? ((Component)component).GetComponent<HealthComponent>() : null);
								if ((Object)(object)val4 != (Object)null && Object.op_Implicit((Object)(object)val4))
								{
									ProcChainMask procChainMask = damageInfo.procChainMask;
									((ProcChainMask)(ref procChainMask)).AddProc((ProcType)6);
									double num = val4.Heal((float)itemCount * 0.2f, procChainMask, true);
								}
							}
						}
					}
				});
			}

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

			internal bool <Init>b__0_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt<HealthComponent>(x, "combinedHealth");
			}

			internal bool <Init>b__0_3(Instruction x)
			{
				int num = default(int);
				return ILPatternMatchingExt.MatchStloc(x, ref num);
			}

			internal void <Init>b__0_4(DamageInfo damageInfo)
			{
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				if (damageInfo == null || (Object)(object)damageInfo.attacker == (Object)null)
				{
					return;
				}
				CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
				CharacterMaster val = ((component != null) ? component.master : null);
				Inventory val2 = ((val != null) ? val.inventory : null);
				if (!((Object)(object)val2 != (Object)null) || ((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)6))
				{
					return;
				}
				int itemCount = val2.GetItemCount(Items.Seed);
				if (itemCount > 0)
				{
					HealthComponent val3 = ((component != null) ? ((Component)component).GetComponent<HealthComponent>() : null);
					if ((Object)(object)val3 != (Object)null && Object.op_Implicit((Object)(object)val3))
					{
						ProcChainMask procChainMask = damageInfo.procChainMask;
						((ProcChainMask)(ref procChainMask)).AddProc((ProcType)6);
						double num = val3.Heal((float)itemCount * 0.2f, procChainMask, true);
					}
				}
			}
		}

		public static void Init()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			try
			{
				object obj = <>c.<>9__0_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_007c: Unknown result type (might be due to invalid IL or missing references)
						ILCursor val2 = new ILCursor(il);
						int num3 = default(int);
						int num2 = default(int);
						val2.TryGotoNext(new Func<Instruction, bool>[3]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num3),
							(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<HealthComponent>(x, "combinedHealth"),
							(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num2)
						});
						val2.Emit(OpCodes.Ldarg_1);
						val2.EmitDelegate<Action<DamageInfo>>((Action<DamageInfo>)delegate(DamageInfo damageInfo)
						{
							//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
							//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
							//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
							if (damageInfo != null && !((Object)(object)damageInfo.attacker == (Object)null))
							{
								CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
								CharacterMaster val3 = ((component != null) ? component.master : null);
								Inventory val4 = ((val3 != null) ? val3.inventory : null);
								if ((Object)(object)val4 != (Object)null && !((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)6))
								{
									int itemCount = val4.GetItemCount(Items.Seed);
									if (itemCount > 0)
									{
										HealthComponent val5 = ((component != null) ? ((Component)component).GetComponent<HealthComponent>() : null);
										if ((Object)(object)val5 != (Object)null && Object.op_Implicit((Object)(object)val5))
										{
											ProcChainMask procChainMask = damageInfo.procChainMask;
											((ProcChainMask)(ref procChainMask)).AddProc((ProcType)6);
											double num = val5.Heal((float)itemCount * 0.2f, procChainMask, true);
										}
									}
								}
							}
						});
					};
					<>c.<>9__0_0 = val;
					obj = (object)val;
				}
				HealthComponent.TakeDamageProcess += (Manipulator)obj;
				UpdateText();
			}
			catch (Exception ex)
			{
				VanillaItemTweaks.logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
			}
		}

		private static void UpdateText()
		{
			LanguageAPI.Add("ITEM_SEED_DESC", "Proc damage <style=cIsHealing>heals</style> you for  <style=cIsHealing>1</style> <style=cStack>(+1 per stack)</style>, <style=cIsHealing>health</style>. Also heals for <style=cIsHealing>0.2</style> <style=cStack>(+0.2 per stack)</style>on all damage instances.");
		}
	}
	public static class LeptonDaisyBuff
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

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

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

			public static Action<HealthComponent> <>9__0_5;

			public static Manipulator <>9__0_0;

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

			public static Manipulator <>9__0_1;

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

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

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

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

			public static Manipulator <>9__0_2;

			internal void <Init>b__0_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 <Init>b__0_3(Instruction x)
			{
				int num = default(int);
				return ILPatternMatchingExt.MatchLdarg(x, ref num);
			}

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

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

			internal void <Init>b__0_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 <Init>b__0_6(Instruction x)
			{
				float num = default(float);
				return ILPatternMatchingExt.MatchLdcR4(x, ref num);
			}

			internal void <Init>b__0_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 <Init>b__0_7(Instruction x)
			{
				int num = default(int);
				return ILPatternMatchingExt.MatchLdcI4(x, ref num);
			}

			internal bool <Init>b__0_8(Instruction x)
			{
				return ILPatternMatchingExt.MatchMul(x);
			}

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

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

		public static void Init()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			try
			{
				object obj = <>c.<>9__0_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__0_0 = val;
					obj = (object)val;
				}
				HealPulse.Update += (Manipulator)obj;
				object obj2 = <>c.<>9__0_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__0_1 = val2;
					obj2 = (object)val2;
				}
				TeleporterHealNovaPulse.OnEnter += (Manipulator)obj2;
				object obj3 = <>c.<>9__0_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__0_2 = val3;
					obj3 = (object)val3;
				}
				TeleporterHealNovaGeneratorMain.CalculateNextPulseFraction += (Manipulator)obj3;
				UpdateText();
			}
			catch (Exception ex)
			{
				VanillaItemTweaks.logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
			}
		}

		private static void UpdateText()
		{
			LanguageAPI.Add("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.");
		}
	}
	internal class OldGuillotineBuff
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

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

			public static Manipulator <>9__0_0;

			internal void <Init>b__0_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.TryGotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 13f)
				});
				val.Next.Operand = 25f;
			}

			internal bool <Init>b__0_1(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdcR4(x, 13f);
			}
		}

		public static void Init()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			try
			{
				object obj = <>c.<>9__0_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 val2 = new ILCursor(il);
						val2.TryGotoNext(new Func<Instruction, bool>[1]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 13f)
						});
						val2.Next.Operand = 25f;
					};
					<>c.<>9__0_0 = val;
					obj = (object)val;
				}
				CharacterBody.OnInventoryChanged += (Manipulator)obj;
				UpdateText();
			}
			catch (Exception ex)
			{
				VanillaItemTweaks.logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
			}
		}

		private static void UpdateText()
		{
			LanguageAPI.Add("ITEM_EXECUTELOWHEALTHELITE_DESC", "Instantly kill Elite monsters below <style=cIsDamage>20%</style> <style=cStack>(+20% hyperbolically per stack)</style> <style=cIsDamage>health</style>. ");
		}
	}
	public static class RedWhipBuff
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

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

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

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

			public static Manipulator <>9__0_0;

			internal void <Init>b__0_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.TryGotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.3f),
					(Instruction x) => ILPatternMatchingExt.MatchMul(x)
				});
				int index = val.Index;
				val.Index = index + 1;
				val.Next.Operand = 0.4f;
			}

			internal bool <Init>b__0_1(Instruction x)
			{
				return ILPatternMatchingExt.MatchConvR4(x);
			}

			internal bool <Init>b__0_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdcR4(x, 0.3f);
			}

			internal bool <Init>b__0_3(Instruction x)
			{
				return ILPatternMatchingExt.MatchMul(x);
			}
		}

		public static void Init()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			try
			{
				object obj = <>c.<>9__0_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 val2 = new ILCursor(il);
						val2.TryGotoNext(new Func<Instruction, bool>[3]
						{
							(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
							(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.3f),
							(Instruction x) => ILPatternMatchingExt.MatchMul(x)
						});
						int index = val2.Index;
						val2.Index = index + 1;
						val2.Next.Operand = 0.4f;
					};
					<>c.<>9__0_0 = val;
					obj = (object)val;
				}
				CharacterBody.RecalculateStats += (Manipulator)obj;
				UpdateText();
			}
			catch (Exception ex)
			{
				VanillaItemTweaks.logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
			}
		}

		public static void UpdateText()
		{
			LanguageAPI.Add("ITEM_SPRINTOUTOFCOMBAT_DESC", "Leaving combat boosts your <style=cIsUtility>movement speed</style> by <style=cIsUtility>40%</style> <style=cStack>(+40% per stack)</style>.");
		}
	}
	internal class RegeneratingScrapBuff
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

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

			public static Action<ScrapperController> <>9__0_2;

			public static Manipulator <>9__0_0;

			internal void <Init>b__0_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_0047: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				val.TryGotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchAdd(x)
				});
				val.Index += 2;
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<ScrapperController>>((Action<ScrapperController>)delegate(ScrapperController scrapper)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0058: Unknown result type (might be due to invalid IL or missing references)
					//IL_0062: Unknown result type (might be due to invalid IL or missing references)
					if (scrapper.lastScrappedItemIndex == Items.RegeneratingScrap.itemIndex)
					{
						CharacterBody component = ((Component)scrapper.interactor).GetComponent<CharacterBody>();
						for (int i = 0; i < scrapper.itemsEaten; i++)
						{
							component.inventory.GiveItem(Items.RegeneratingScrapConsumed, 1);
						}
						CharacterMasterNotificationQueue.SendTransformNotification(component.master, Items.RegeneratingScrap.itemIndex, Items.RegeneratingScrapConsumed.itemIndex, (TransformationType)5);
					}
				});
			}

			internal bool <Init>b__0_1(Instruction x)
			{
				return ILPatternMatchingExt.MatchAdd(x);
			}

			internal void <Init>b__0_2(ScrapperController scrapper)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				if (scrapper.lastScrappedItemIndex == Items.RegeneratingScrap.itemIndex)
				{
					CharacterBody component = ((Component)scrapper.interactor).GetComponent<CharacterBody>();
					for (int i = 0; i < scrapper.itemsEaten; i++)
					{
						component.inventory.GiveItem(Items.RegeneratingScrapConsumed, 1);
					}
					CharacterMasterNotificationQueue.SendTransformNotification(component.master, Items.RegeneratingScrap.itemIndex, Items.RegeneratingScrapConsumed.itemIndex, (TransformationType)5);
				}
			}
		}

		public static void Init()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			try
			{
				object obj = <>c.<>9__0_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_0047: Unknown result type (might be due to invalid IL or missing references)
						ILCursor val2 = new ILCursor(il);
						val2.TryGotoNext(new Func<Instruction, bool>[1]
						{
							(Instruction x) => ILPatternMatchingExt.MatchAdd(x)
						});
						val2.Index += 2;
						val2.Emit(OpCodes.Ldarg_0);
						val2.EmitDelegate<Action<ScrapperController>>((Action<ScrapperController>)delegate(ScrapperController scrapper)
						{
							//IL_0002: Unknown result type (might be due to invalid IL or missing references)
							//IL_000c: Unknown result type (might be due to invalid IL or missing references)
							//IL_0058: Unknown result type (might be due to invalid IL or missing references)
							//IL_0062: Unknown result type (might be due to invalid IL or missing references)
							if (scrapper.lastScrappedItemIndex == Items.RegeneratingScrap.itemIndex)
							{
								CharacterBody component = ((Component)scrapper.interactor).GetComponent<CharacterBody>();
								for (int i = 0; i < scrapper.itemsEaten; i++)
								{
									component.inventory.GiveItem(Items.RegeneratingScrapConsumed, 1);
								}
								CharacterMasterNotificationQueue.SendTransformNotification(component.master, Items.RegeneratingScrap.itemIndex, Items.RegeneratingScrapConsumed.itemIndex, (TransformationType)5);
							}
						});
					};
					<>c.<>9__0_0 = val;
					obj = (object)val;
				}
				ScrapperController.BeginScrapping += (Manipulator)obj;
				UpdateText();
			}
			catch (Exception ex)
			{
				VanillaItemTweaks.logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
			}
		}

		private static void UpdateText()
		{
		}
	}
}
namespace VanillaItemTweaks.Legendary
{
	internal class HappiestMaskBehavior : ItemBehavior
	{
		private CharacterBody _ghost;

		private void OnDisable()
		{
			if (Object.op_Implicit((Object)(object)_ghost) && (Object)(object)_ghost.healthComponent != (Object)null)
			{
				_ghost.healthComponent.health = 0f;
			}
		}

		public bool HasGhost()
		{
			return Object.op_Implicit((Object)(object)_ghost);
		}

		public void SetGhost(CharacterBody newGhost)
		{
			_ghost = newGhost;
		}
	}
	public static class HappiestMaskRework
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Action <>9__0_0;

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

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

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

			public static Action<CharacterBody> <>9__0_6;

			public static Manipulator <>9__0_1;

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

			public static Func<DamageReport, bool> <>9__0_8;

			public static Action<CharacterBody, DamageReport> <>9__0_9;

			public static Manipulator <>9__0_2;

			internal void <Init>b__0_0()
			{
				List<ItemTag> list = Items.GhostOnKill.tags.ToList();
				list.Add((ItemTag)13);
				Items.GhostOnKill.tags = list.ToArray();
			}

			internal void <Init>b__0_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_007c: 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>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num2),
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num),
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "inventory")
				});
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<CharacterBody>>((Action<CharacterBody>)delegate(CharacterBody body)
				{
					body.AddItemBehavior<HappiestMaskBehavior>(body.inventory.GetItemCount(Items.GhostOnKill));
				});
			}

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

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

			internal bool <Init>b__0_5(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "inventory");
			}

			internal void <Init>b__0_6(CharacterBody body)
			{
				body.AddItemBehavior<HappiestMaskBehavior>(body.inventory.GetItemCount(Items.GhostOnKill));
			}

			internal void <Init>b__0_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_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				val.TryGotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 7f)
				});
				val.RemoveRange(3);
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Func<DamageReport, bool>>((Func<DamageReport, bool>)delegate(DamageReport damageReport)
				{
					HappiestMaskBehavior component = damageReport.attacker.GetComponent<HappiestMaskBehavior>();
					Log.LogDebug("Behavior null?: " + (object)component == ". Has ghost?: " + component.HasGhost());
					return (Object)(object)component != (Object)null && !component.HasGhost();
				});
				val.Index += 3;
				val.Remove();
				int index = val.Index;
				val.Index = index + 1;
				val.Remove();
				index = val.Index;
				val.Index = index + 1;
				val.Remove();
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Action<CharacterBody, DamageReport>>((Action<CharacterBody, DamageReport>)delegate(CharacterBody ghostBody, DamageReport damageReport)
				{
					if ((Object)(object)ghostBody != (Object)null)
					{
						damageReport.attacker.GetComponent<HappiestMaskBehavior>().SetGhost(ghostBody);
						ghostBody.master.inventory.GiveItem(Items.BoostDamage, 75 * damageReport.attackerBody.inventory.GetItemCount(Items.GhostOnKill) - 150);
					}
				});
			}

			internal bool <Init>b__0_7(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdcR4(x, 7f);
			}

			internal bool <Init>b__0_8(DamageReport damageReport)
			{
				HappiestMaskBehavior component = damageReport.attacker.GetComponent<HappiestMaskBehavior>();
				Log.LogDebug("Behavior null?: " + (object)component == ". Has ghost?: " + component.HasGhost());
				return (Object)(object)component != (Object)null && !component.HasGhost();
			}

			internal void <Init>b__0_9(CharacterBody ghostBody, DamageReport damageReport)
			{
				if ((Object)(object)ghostBody != (Object)null)
				{
					damageReport.attacker.GetComponent<HappiestMaskBehavior>().SetGhost(ghostBody);
					ghostBody.master.inventory.GiveItem(Items.BoostDamage, 75 * damageReport.attackerBody.inventory.GetItemCount(Items.GhostOnKill) - 150);
				}
			}
		}

		public static void Init()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			try
			{
				RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
				{
					List<ItemTag> list = Items.GhostOnKill.tags.ToList();
					list.Add((ItemTag)13);
					Items.GhostOnKill.tags = list.ToArray();
				});
				object obj = <>c.<>9__0_1;
				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_007c: Unknown result type (might be due to invalid IL or missing references)
						ILCursor val4 = new ILCursor(il);
						int num2 = default(int);
						int num = default(int);
						val4.TryGotoNext(new Func<Instruction, bool>[3]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num2),
							(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num),
							(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "inventory")
						});
						val4.Emit(OpCodes.Ldarg_0);
						val4.EmitDelegate<Action<CharacterBody>>((Action<CharacterBody>)delegate(CharacterBody body)
						{
							body.AddItemBehavior<HappiestMaskBehavior>(body.inventory.GetItemCount(Items.GhostOnKill));
						});
					};
					<>c.<>9__0_1 = val;
					obj = (object)val;
				}
				CharacterBody.OnInventoryChanged += (Manipulator)obj;
				object obj2 = <>c.<>9__0_2;
				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_0040: Unknown result type (might be due to invalid IL or missing references)
						//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
						ILCursor val3 = new ILCursor(il);
						val3.TryGotoNext(new Func<Instruction, bool>[1]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 7f)
						});
						val3.RemoveRange(3);
						val3.Emit(OpCodes.Ldarg_1);
						val3.EmitDelegate<Func<DamageReport, bool>>((Func<DamageReport, bool>)delegate(DamageReport damageReport)
						{
							HappiestMaskBehavior component = damageReport.attacker.GetComponent<HappiestMaskBehavior>();
							Log.LogDebug("Behavior null?: " + (object)component == ". Has ghost?: " + component.HasGhost());
							return (Object)(object)component != (Object)null && !component.HasGhost();
						});
						val3.Index += 3;
						val3.Remove();
						int index = val3.Index;
						val3.Index = index + 1;
						val3.Remove();
						index = val3.Index;
						val3.Index = index + 1;
						val3.Remove();
						val3.Emit(OpCodes.Ldarg_1);
						val3.EmitDelegate<Action<CharacterBody, DamageReport>>((Action<CharacterBody, DamageReport>)delegate(CharacterBody ghostBody, DamageReport damageReport)
						{
							if ((Object)(object)ghostBody != (Object)null)
							{
								damageReport.attacker.GetComponent<HappiestMaskBehavior>().SetGhost(ghostBody);
								ghostBody.master.inventory.GiveItem(Items.BoostDamage, 75 * damageReport.attackerBody.inventory.GetItemCount(Items.GhostOnKill) - 150);
							}
						});
					};
					<>c.<>9__0_2 = val2;
					obj2 = (object)val2;
				}
				GlobalEventManager.OnCharacterDeath += (Manipulator)obj2;
				UpdateText();
			}
			catch (Exception ex)
			{
				VanillaItemTweaks.logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
			}
		}

		private static void UpdateText()
		{
			LanguageAPI.Add("ITEM_GHOSTONKILL_DESC", "Killing an enemy will spawn a ghost of the killed enemy with <style=cIsDamage>750%</style><style=cStack>(+750% per stack)</style> damage for <style=cIsDamage>30s</style>. ");
			LanguageAPI.Add("ITEM_GHOSTONKILL_PICKUP", "Killing an enemy spawns a ghost of them.");
		}
	}
	public static class LaserScopeBuff
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static StatHookEventHandler <>9__0_0;

			internal void <Init>b__0_0(CharacterBody sender, StatHookEventArgs args)
			{
				if ((Object)(object)sender.inventory != (Object)null && sender.inventory.GetItemCount(Items.CritDamage) > 0)
				{
					args.critAdd += 15f;
				}
			}
		}

		public static void Init()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			try
			{
				object obj = <>c.<>9__0_0;
				if (obj == null)
				{
					StatHookEventHandler val = delegate(CharacterBody sender, StatHookEventArgs args)
					{
						if ((Object)(object)sender.inventory != (Object)null && sender.inventory.GetItemCount(Items.CritDamage) > 0)
						{
							args.critAdd += 15f;
						}
					};
					<>c.<>9__0_0 = val;
					obj = (object)val;
				}
				RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
				UpdateText();
			}
			catch (Exception ex)
			{
				VanillaItemTweaks.logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
			}
		}

		private static void UpdateText()
		{
			LanguageAPI.Add("ITEM_CRITDAMAGE_DESC", "Gain <style=cIsDamage>15% critical chance</style>. <style=cIsDamage>Critical Strikes</style> deal an additional <style=cIsDamage>100% damage</style> <style=cStack>(+100% per stack)</style>.");
		}
	}
}
namespace VanillaItemTweaks.Common
{
	public static class WarbannerBuff
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnExit <>9__0_0;

			internal void <Init>b__0_0(orig_OnExit orig, PreEncounter self)
			{
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				if (!NetworkServer.active)
				{
					return;
				}
				ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)1);
				for (int i = 0; i < teamMembers.Count; i++)
				{
					TeamComponent val = teamMembers[i];
					CharacterBody body = val.body;
					if (!Object.op_Implicit((Object)(object)body))
					{
						continue;
					}
					CharacterMaster master = val.body.master;
					if (Object.op_Implicit((Object)(object)master))
					{
						int itemCount = master.inventory.GetItemCount(Items.WardOnLevel);
						if (itemCount > 0)
						{
							GameObject val2 = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/WarbannerWard"), body.transform.position, Quaternion.identity);
							val2.GetComponent<TeamFilter>().teamIndex = (TeamIndex)1;
							val2.GetComponent<BuffWard>().Networkradius = (float)(8.0 + 8.0 * (double)itemCount);
							NetworkServer.Spawn(val2);
						}
					}
				}
			}
		}

		public static void Init()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				hook_OnExit val = delegate(orig_OnExit orig, PreEncounter self)
				{
					//IL_0096: Unknown result type (might be due to invalid IL or missing references)
					//IL_009b: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self);
					if (NetworkServer.active)
					{
						ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)1);
						for (int i = 0; i < teamMembers.Count; i++)
						{
							TeamComponent val2 = teamMembers[i];
							CharacterBody body = val2.body;
							if (Object.op_Implicit((Object)(object)body))
							{
								CharacterMaster master = val2.body.master;
								if (Object.op_Implicit((Object)(object)master))
								{
									int itemCount = master.inventory.GetItemCount(Items.WardOnLevel);
									if (itemCount > 0)
									{
										GameObject val3 = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/WarbannerWard"), body.transform.position, Quaternion.identity);
										val3.GetComponent<TeamFilter>().teamIndex = (TeamIndex)1;
										val3.GetComponent<BuffWard>().Networkradius = (float)(8.0 + 8.0 * (double)itemCount);
										NetworkServer.Spawn(val3);
									}
								}
							}
						}
					}
				};
				<>c.<>9__0_0 = val;
				obj = (object)val;
			}
			PreEncounter.OnExit += (hook_OnExit)obj;
		}
	}
}
namespace VanillaItemTweaks.Boss
{
	public static class KnurlBuff
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static StatHookEventHandler <>9__0_0;

			internal void <Init>b__0_0(CharacterBody sender, StatHookEventArgs args)
			{
				if ((Object)(object)sender.inventory != (Object)null)
				{
					args.armorAdd += (float)sender.inventory.GetItemCount(Items.Knurl) * 10f;
				}
			}
		}

		public static void Init()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			try
			{
				object obj = <>c.<>9__0_0;
				if (obj == null)
				{
					StatHookEventHandler val = delegate(CharacterBody sender, StatHookEventArgs args)
					{
						if ((Object)(object)sender.inventory != (Object)null)
						{
							args.armorAdd += (float)sender.inventory.GetItemCount(Items.Knurl) * 10f;
						}
					};
					<>c.<>9__0_0 = val;
					obj = (object)val;
				}
				RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
				UpdateText();
			}
			catch (Exception ex)
			{
				VanillaItemTweaks.logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
			}
		}

		private static void UpdateText()
		{
			LanguageAPI.Add("ITEM_KNURL_PICKUP", "Boosts health, regeneration, and armor");
			LanguageAPI.Add("ITEM_KNURL_DESC", "<style=cIsHealing>Increase maximum health</style> by <style=cIsHealing>40</style> <style=cStack>(+40 per stack)</style>, <style=cIsHealing>base health regeneration</style> by <style=cIsHealing>+1.6 hp/s</style> <style=cStack>(+1.6 hp/s per stack)</style>, and <style=cIsHealing>armor</style> by <style=cIsHealing>10</style> <style=cStack>(+10 per stack)</style>.");
		}
	}
}