Decompiled source of SeekingItemReworks v2.0.1

SeekingItemReworks.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using HG;
using HG.Reflection;
using IL.RoR2;
using IL.RoR2.Items;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.Items;
using RoR2.Orbs;
using SeekerItems;
using SeekingItemReworks;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyInformationalVersion("1.0.0+15723cca56553ed0c05834b72117360dd75232cc")]
[assembly: AssemblyProduct("SeekingItemReworks")]
[assembly: AssemblyTitle("SeekingItemReworks")]
[assembly: AssemblyCompany("SeekingItemReworks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[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 SeekingItemReworks
{
	public static class ColorCode
	{
		public enum FontColor
		{
			cStack,
			cIsDamage,
			cIsHealth,
			cIsUtility,
			cIsHealing
		}

		public static string Style(this string self, FontColor style)
		{
			return $"<style={style}>{self}</style>";
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("noodlegemo.SeekingItemReworks", "SeekingItemReworks", "2.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "noodlegemo.SeekingItemReworks";

		public const string PluginAuthor = "noodlegemo";

		public const string PluginName = "SeekingItemReworks";

		public const string PluginVersion = "2.0.1";

		public void Awake()
		{
			MainConfig.SetUp((BaseUnityPlugin)(object)this);
			if (MainConfig.EnableLogs.Value)
			{
				Log.Init(((BaseUnityPlugin)this).Logger);
			}
			ItemInfo.SetUp();
			SetUpCommon();
			SetUpUncommon();
			SetUpLegendary();
			SetUpEquipment();
		}

		private void SetUpCommon()
		{
			WarpedEchoBehavior.Init();
			ChronicExpansionBehavior.Init();
			KnockbackFinBehavior.Init();
			BolsteringLanternBehavior.Init();
			AntlerShieldBehavior.Init();
		}

		private void SetUpUncommon()
		{
			ChanceDollBehavior.Init();
			SaleStarBehavior.Init();
			UnstableTransmitterBehavior.Init();
			NoxiousThornBehavior.Init();
			OldWarStealthkitBehavior.Init();
		}

		private void SetUpLegendary()
		{
			GrowthNectarBehavior.Init();
			WarBondsBehavior.Init();
			BensRaincoatBehavior.Init();
		}

		private void SetUpEquipment()
		{
			SeedOfLifeBehavior.Init();
		}
	}
}
namespace SeekerItems
{
	internal class AntlerShield : ItemTemplate
	{
		public static string StaticName = "Antler Shield";

		public static ConfigEntry<int> Rework;

		public static ConfigEntry<float> Armor_Percent_Base;

		public static ConfigEntry<float> Armor_Percent_Stack;

		public static ConfigEntry<float> Movement_Base;

		public static ConfigEntry<float> Movement_Stack;

		public AntlerShield(int descType)
		{
			ItemInternal = "NEGATEATTACK";
			if (descType == 1)
			{
				ItemInfo = "Gain armor from movement speed, and increase movement speed.";
				ItemDesc = string.Format("Increase " + "armor ".Style(ColorCode.FontColor.cIsHealing) + "by " + "{0}% ".Style(ColorCode.FontColor.cIsHealing) + "(+{1}% per stack) ".Style(ColorCode.FontColor.cStack) + "of " + "current movement speed".Style(ColorCode.FontColor.cIsUtility) + ". Increase " + "movement speed ".Style(ColorCode.FontColor.cIsUtility) + "by " + "{2}% ".Style(ColorCode.FontColor.cIsUtility) + "(+{3}% per stack)".Style(ColorCode.FontColor.cStack) + ".", ItemTemplate.RoundVal(Armor_Percent_Base.Value), ItemTemplate.RoundVal(Armor_Percent_Stack.Value), ItemTemplate.RoundVal(Movement_Base.Value), ItemTemplate.RoundVal(Movement_Stack.Value));
			}
		}
	}
	public static class AntlerShieldBehavior
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__RemoveEffect;

			public static StatHookEventHandler <1>__StatCoefficients;
		}

		public static void Init()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			if (AntlerShield.Rework.Value == 1)
			{
				object obj = <>O.<0>__RemoveEffect;
				if (obj == null)
				{
					Manipulator val = RemoveEffect;
					<>O.<0>__RemoveEffect = val;
					obj = (object)val;
				}
				HealthComponent.TakeDamageProcess += (Manipulator)obj;
				object obj2 = <>O.<1>__StatCoefficients;
				if (obj2 == null)
				{
					StatHookEventHandler val2 = StatCoefficients;
					<>O.<1>__StatCoefficients = val2;
					obj2 = (object)val2;
				}
				RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj2;
			}
		}

		private static void RemoveEffect(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int num2 = default(int);
			ILLabel val4 = default(ILLabel);
			if (val.TryGotoNext(new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num2),
				(Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val4),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdflda<HealthComponent>(x, "itemCounts"),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(ItemCounts), "antlerShield")
			}))
			{
				int index = val.Index;
				int num = default(int);
				ILLabel val3 = default(ILLabel);
				if (val.TryGotoNext(new Func<Instruction, bool>[5]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
					(Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val3),
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdflda<HealthComponent>(x, "itemCounts"),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(ItemCounts), "noxiousThorn")
				}))
				{
					ILLabel val2 = val.MarkLabel();
					val.Goto(index, (MoveType)0, false);
					val.MoveAfterLabels();
					val.Emit(OpCodes.Br, (object)val2);
				}
				else
				{
					Log.Warning(AntlerShield.StaticName + " #1 - IL Fail #2");
				}
			}
			else
			{
				Log.Warning(AntlerShield.StaticName + " #1 - IL Fail #1");
			}
		}

		private static void StatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.master) && Object.op_Implicit((Object)(object)sender.master.inventory))
			{
				int itemCount = sender.inventory.GetItemCount(Items.NegateAttack);
				if (itemCount > 0)
				{
					args.armorAdd += (AntlerShield.Armor_Percent_Base.Value + AntlerShield.Armor_Percent_Stack.Value * (float)(itemCount - 1)) / 100f * sender.moveSpeed;
					args.moveSpeedMultAdd += (AntlerShield.Movement_Base.Value + AntlerShield.Movement_Stack.Value * (float)(itemCount - 1)) / 100f;
				}
			}
		}
	}
	internal class BolsteringLantern : ItemTemplate
	{
		public static string StaticName = "Bolstering Lantern";

		public static ConfigEntry<int> Rework;

		public static ConfigEntry<int> LowHealth;

		public static ConfigEntry<int> HighHealth;

		public static ConfigEntry<float> Damage_Base;

		public static ConfigEntry<float> Damage_Stack;

		public static ConfigEntry<float> Chance_Base;

		public static ConfigEntry<float> Chance_Stack;

		public BolsteringLantern(int descType)
		{
			ItemInternal = "LOWERHEALTHHIGHERDAMAGE";
			switch (descType)
			{
			case 1:
				ItemInfo = $"Ignite enemies at low health until health is restored {HighHealth.Value}%.";
				ItemDesc = string.Format("Falling below " + "{0}% health".Style(ColorCode.FontColor.cIsHealth) + " grants a buff that " + "ignites ".Style(ColorCode.FontColor.cIsDamage) + "enemies for " + "{1}% ".Style(ColorCode.FontColor.cIsDamage) + "(+{2}% per stack) ".Style(ColorCode.FontColor.cStack) + "base damage on hit, until " + "health ".Style(ColorCode.FontColor.cIsHealing) + "is restored to " + "{3}%".Style(ColorCode.FontColor.cIsHealing) + ".", LowHealth.Value, ItemTemplate.RoundVal(Damage_Base.Value), ItemTemplate.RoundVal(Damage_Stack.Value), HighHealth.Value);
				break;
			case 2:
				ItemInfo = "Chance on hit to ignite. Inherited by allies.";
				ItemDesc = string.Format("{0}% ".Style(ColorCode.FontColor.cIsDamage) + "(+{1}% per stack) ".Style(ColorCode.FontColor.cStack) + "chance on hit to " + "ignite ".Style(ColorCode.FontColor.cIsDamage) + "enemies for " + "{2}% ".Style(ColorCode.FontColor.cIsDamage) + "(+{3}% per stack) ".Style(ColorCode.FontColor.cStack) + "base damage. This item is " + "inherited by allies ".Style(ColorCode.FontColor.cIsUtility) + "and is boosted with " + "Ignition Tank".Style(ColorCode.FontColor.cIsUtility) + ".", ItemTemplate.RoundVal(Chance_Base.Value), ItemTemplate.RoundVal(Chance_Stack.Value), ItemTemplate.RoundVal(Damage_Base.Value), ItemTemplate.RoundVal(Damage_Stack.Value));
				break;
			}
		}
	}
	public static class BolsteringLanternBehavior
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__RemoveEffect;

			public static Manipulator <1>__RemoveDamage;

			public static hook_UpdateLowerHealthHigherDamage <2>__HealthTrigger;

			public static hook_ProcessHitEnemy <3>__InflictFire;

			public static Manipulator <4>__RemoveBuff;

			public static hook_FixedUpdate <5>__MinionApply;

			public static hook_ProcessHitEnemy <6>__FireProc;
		}

		public static void Init()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			if (BolsteringLantern.Rework.Value != 0)
			{
				object obj = <>O.<0>__RemoveEffect;
				if (obj == null)
				{
					Manipulator val = RemoveEffect;
					<>O.<0>__RemoveEffect = val;
					obj = (object)val;
				}
				CharacterBody.RecalculateStats += (Manipulator)obj;
				object obj2 = <>O.<1>__RemoveDamage;
				if (obj2 == null)
				{
					Manipulator val2 = RemoveDamage;
					<>O.<1>__RemoveDamage = val2;
					obj2 = (object)val2;
				}
				HealthComponent.TakeDamageProcess += (Manipulator)obj2;
			}
			if (BolsteringLantern.Rework.Value == 1)
			{
				object obj3 = <>O.<2>__HealthTrigger;
				if (obj3 == null)
				{
					hook_UpdateLowerHealthHigherDamage val3 = HealthTrigger;
					<>O.<2>__HealthTrigger = val3;
					obj3 = (object)val3;
				}
				CharacterBody.UpdateLowerHealthHigherDamage += (hook_UpdateLowerHealthHigherDamage)obj3;
				object obj4 = <>O.<3>__InflictFire;
				if (obj4 == null)
				{
					hook_ProcessHitEnemy val4 = InflictFire;
					<>O.<3>__InflictFire = val4;
					obj4 = (object)val4;
				}
				GlobalEventManager.ProcessHitEnemy += (hook_ProcessHitEnemy)obj4;
			}
			else if (BolsteringLantern.Rework.Value == 2)
			{
				new LanternCountBuff();
				object obj5 = <>O.<4>__RemoveBuff;
				if (obj5 == null)
				{
					Manipulator val5 = RemoveBuff;
					<>O.<4>__RemoveBuff = val5;
					obj5 = (object)val5;
				}
				CharacterBody.UpdateLowerHealthHigherDamage += (Manipulator)obj5;
				object obj6 = <>O.<5>__MinionApply;
				if (obj6 == null)
				{
					hook_FixedUpdate val6 = MinionApply;
					<>O.<5>__MinionApply = val6;
					obj6 = (object)val6;
				}
				CharacterBody.FixedUpdate += (hook_FixedUpdate)obj6;
				object obj7 = <>O.<6>__FireProc;
				if (obj7 == null)
				{
					hook_ProcessHitEnemy val7 = FireProc;
					<>O.<6>__FireProc = val7;
					obj7 = (object)val7;
				}
				GlobalEventManager.ProcessHitEnemy += (hook_ProcessHitEnemy)obj7;
			}
		}

		private static void RemoveEffect(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "LowerHealthHigherDamageBuff"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "HasBuff")
			}))
			{
				int index = val.Index;
				if (val.TryGotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "tamperedHeartActive"),
					(Instruction x) => ILPatternMatchingExt.MatchPop(x)
				}))
				{
					ILLabel val2 = val.MarkLabel();
					val.Goto(index, (MoveType)0, false);
					val.Emit(OpCodes.Br, (object)val2);
				}
				else
				{
					Log.Warning(BolsteringLantern.StaticName + " #0 - IL Fail #2");
				}
			}
			else
			{
				Log.Warning(BolsteringLantern.StaticName + " #0 - IL Fail #1");
			}
		}

		private static void RemoveDamage(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterMaster>(x, "GetBody"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "LowerHealthHigherDamageBuff"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "HasBuff")
			}))
			{
				int index = val.Index;
				float num = default(float);
				if (val.TryGotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld<DamageInfo>(x, "procCoefficient"),
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num)
				}))
				{
					ILLabel val2 = val.MarkLabel();
					val.Goto(index, (MoveType)0, false);
					val.MoveAfterLabels();
					val.Emit(OpCodes.Br, (object)val2);
				}
				else
				{
					Log.Warning(BolsteringLantern.StaticName + " #0 - IL Fail #4");
				}
			}
			else
			{
				Log.Warning(BolsteringLantern.StaticName + " #0 - IL Fail #3");
			}
		}

		private static void RemoveBuff(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			int itemIndex = -1;
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref itemIndex)
			}))
			{
				val.EmitDelegate<Func<int, int>>((Func<int, int>)((int self) => 0));
			}
		}

		private static void HealthTrigger(orig_UpdateLowerHealthHigherDamage orig, CharacterBody self)
		{
			if (!NetworkServer.active)
			{
				return;
			}
			int num = (Object.op_Implicit((Object)(object)self.inventory) ? self.inventory.GetItemCount(Items.LowerHealthHigherDamage) : 0);
			if (num > 0)
			{
				float normalizedHealth = self.healthComponent.GetNormalizedHealth();
				if (normalizedHealth <= (float)BolsteringLantern.LowHealth.Value / 100f && !self.HasBuff(Buffs.LowerHealthHigherDamageBuff))
				{
					self.AddBuff(Buffs.LowerHealthHigherDamageBuff);
					Util.PlaySound("Play_item_proc_lowerHealthHigherDamage_proc", ((Component)self).gameObject);
				}
				else if (normalizedHealth >= (float)BolsteringLantern.HighHealth.Value / 100f && self.HasBuff(Buffs.LowerHealthHigherDamageBuff))
				{
					self.RemoveBuff(Buffs.LowerHealthHigherDamageBuff);
				}
			}
			else if (num <= 0 && self.HasBuff(Buffs.LowerHealthHigherDamageBuff))
			{
				self.RemoveBuff(Buffs.LowerHealthHigherDamageBuff);
			}
		}

		private static void InflictFire(orig_ProcessHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, damageInfo, victim);
			if (Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.damage > 0f)
			{
				CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component) && component.HasBuff(Buffs.LowerHealthHigherDamageBuff))
				{
					int itemCount = component.inventory.GetItemCount(Items.LowerHealthHigherDamage);
					InflictDotInfo val = default(InflictDotInfo);
					val.attackerObject = damageInfo.attacker;
					val.victimObject = victim;
					val.totalDamage = damageInfo.damage * (BolsteringLantern.Damage_Base.Value + BolsteringLantern.Damage_Stack.Value * (float)(itemCount - 1)) / 100f;
					val.damageMultiplier = 1f;
					val.duration = 0.1f;
					val.dotIndex = (DotIndex)1;
					InflictDotInfo val2 = val;
					StrengthenBurnUtils.CheckDotForUpgrade(component.inventory, ref val2);
					DotController.InflictDot(ref val2);
				}
			}
		}

		private static void MinionApply(orig_FixedUpdate orig, CharacterBody self)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			int num = (Object.op_Implicit((Object)(object)self.inventory) ? self.inventory.GetItemCount(Items.LowerHealthHigherDamage) : 0);
			if (num <= 0)
			{
				return;
			}
			MinionGroup val = MinionGroup.FindGroup(self.masterObjectId);
			self.SetBuffCount(LanternCountBuff.LanternCounter.buffIndex, num);
			if (val == null)
			{
				return;
			}
			MinionOwnership[] members = val.members;
			foreach (MinionOwnership val2 in members)
			{
				if (!((Object)(object)val2 == (Object)null))
				{
					CharacterMaster component = ((Component)val2).GetComponent<CharacterMaster>();
					if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory) && Object.op_Implicit((Object)(object)component.GetBody()))
					{
						component.GetBody().SetBuffCount(LanternCountBuff.LanternCounter.buffIndex, num);
					}
				}
			}
		}

		private static void FireProc(orig_ProcessHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, damageInfo, victim);
			if (Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.procCoefficient > 0f && damageInfo.damage > 0f)
			{
				CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
				int num = (Object.op_Implicit((Object)(object)component) ? component.GetBuffCount(LanternCountBuff.LanternCounter) : 0);
				if (Object.op_Implicit((Object)(object)component) && num > 0 && Util.CheckRoll(BolsteringLantern.Chance_Base.Value + BolsteringLantern.Chance_Stack.Value * (float)(num - 1), 0f, (CharacterMaster)null))
				{
					Inventory val = ((component.master.minionOwnership.group != null && Object.op_Implicit((Object)(object)component.master.minionOwnership.group.resolvedOwnerMaster)) ? component.master.minionOwnership.group.resolvedOwnerMaster.inventory : component.inventory);
					InflictDotInfo val2 = default(InflictDotInfo);
					val2.attackerObject = damageInfo.attacker;
					val2.victimObject = victim;
					val2.totalDamage = damageInfo.damage * (BolsteringLantern.Damage_Base.Value + BolsteringLantern.Damage_Stack.Value * (float)(num - 1)) / 100f;
					val2.damageMultiplier = 1f;
					val2.duration = 0.1f;
					val2.dotIndex = (DotIndex)1;
					InflictDotInfo val3 = val2;
					StrengthenBurnUtils.CheckDotForUpgrade(val, ref val3);
					DotController.InflictDot(ref val3);
				}
			}
		}
	}
	public class LanternCountBuff
	{
		public static BuffDef LanternCounter;

		private static readonly Sprite spriteIcon = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/DLC2/Items/LowerHealthHigherDamage/texBuffLowerHealthHigherDamageIcon.png").WaitForCompletion();

		public LanternCountBuff()
		{
			LanternCounter = ScriptableObject.CreateInstance<BuffDef>();
			((Object)LanternCounter).name = "AllyLanternCount";
			LanternCounter.canStack = true;
			LanternCounter.isCooldown = false;
			LanternCounter.isDebuff = false;
			LanternCounter.ignoreGrowthNectar = false;
			LanternCounter.iconSprite = spriteIcon;
			ContentAddition.AddBuffDef(LanternCounter);
		}
	}
	internal class ChronicExpansion : ItemTemplate
	{
		public static string StaticName = "Chronic Expansion";

		public static ConfigEntry<int> Rework;

		public static ConfigEntry<bool> TallyKills;

		public static ConfigEntry<float> Damage_Base;

		public static ConfigEntry<float> Damage_Stack;

		public ChronicExpansion(int descType)
		{
			ItemInternal = "INCREASEDAMAGEONMULTIKILL";
			if (descType == 1)
			{
				ItemInfo = "Gain stacking damage after killing 5 enemies while in combat.";
				ItemDesc = string.Format("Killing 5 enemies ".Style(ColorCode.FontColor.cIsDamage) + "in combat buffs damage by " + "{0}% ".Style(ColorCode.FontColor.cIsDamage) + "(+{1}% per stack) ".Style(ColorCode.FontColor.cStack) + "temporarily each time, until leaving combat.", ItemTemplate.RoundVal(Damage_Base.Value), ItemTemplate.RoundVal(Damage_Stack.Value));
			}
		}
	}
	public static class ChronicExpansionBehavior
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__DamageFormula;

			public static Manipulator <1>__RemoveSync;

			public static hook_UpdateMultiKill <2>__AddCounterVFX;
		}

		public static void Init()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			if (ChronicExpansion.Rework.Value == 1)
			{
				object obj = <>O.<0>__DamageFormula;
				if (obj == null)
				{
					Manipulator val = DamageFormula;
					<>O.<0>__DamageFormula = val;
					obj = (object)val;
				}
				CharacterBody.RecalculateStats += (Manipulator)obj;
			}
			if (ChronicExpansion.TallyKills.Value)
			{
				object obj2 = <>O.<1>__RemoveSync;
				if (obj2 == null)
				{
					Manipulator val2 = RemoveSync;
					<>O.<1>__RemoveSync = val2;
					obj2 = (object)val2;
				}
				CharacterBody.OnClientBuffsChanged += (Manipulator)obj2;
				object obj3 = <>O.<2>__AddCounterVFX;
				if (obj3 == null)
				{
					hook_UpdateMultiKill val3 = AddCounterVFX;
					<>O.<2>__AddCounterVFX = val3;
					obj3 = (object)val3;
				}
				CharacterBody.UpdateMultiKill += (hook_UpdateMultiKill)obj3;
			}
		}

		private static void RemoveSync(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int num = default(int);
			if (val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "increaseDamageOnMultiKillItemDisplayUpdater"),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<IncreaseDamageOnMultiKillItemDisplayUpdater>(x, "UpdateKillCounterText")
			}))
			{
				int index = val.Index;
				if (val.TryGotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0)
				}))
				{
					ILLabel val2 = val.MarkLabel();
					val.Goto(index, (MoveType)0, false);
					val.Emit(OpCodes.Br, val2.Target);
				}
			}
			else
			{
				Log.Warning(ChronicExpansion.StaticName + " #1 - IL Fail #1");
			}
		}

		private static void DamageFormula(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int itemIndex = -1;
			if (!val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "IncreaseDamageOnMultiKill"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Inventory>(x, "GetItemCount"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref itemIndex)
			}))
			{
				Log.Warning(ChronicExpansion.StaticName + " #1 - IL Fail #2");
			}
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "IncreaseDamageBuff"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "GetBuffCount")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldloc, itemIndex);
				val.EmitDelegate<Action<CharacterBody, int>>((Action<CharacterBody, int>)delegate(CharacterBody body, int itemCount)
				{
					int buffCount = body.GetBuffCount(Buffs.IncreaseDamageBuff);
					float num2 = (float)buffCount * (ChronicExpansion.Damage_Base.Value + ChronicExpansion.Damage_Stack.Value * (float)(itemCount - 1)) / 100f;
					body.damage *= 1f + num2;
					if (body.oldComboMeter < buffCount)
					{
						body.oldComboMeter = buffCount;
					}
				});
				int index = val.Index;
				int num = default(int);
				if (val.TryGotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
					(Instruction x) => ILPatternMatchingExt.MatchStfld<CharacterBody>(x, "oldComboMeter")
				}))
				{
					ILLabel val2 = val.MarkLabel();
					val.Goto(index, (MoveType)0, false);
					val.Emit(OpCodes.Br, val2.Target);
				}
			}
			else
			{
				Log.Warning(ChronicExpansion.StaticName + " #1 - IL Fail #3");
			}
		}

		private static void AddCounterVFX(orig_UpdateMultiKill orig, CharacterBody self, float deltaTime)
		{
			orig.Invoke(self, deltaTime);
			int num = (Object.op_Implicit((Object)(object)self.inventory) ? self.inventory.GetItemCount(Items.IncreaseDamageOnMultiKill) : 0);
			if (Object.op_Implicit((Object)(object)self.increaseDamageOnMultiKillItemDisplayUpdater) && num > 0)
			{
				self.increaseDamageOnMultiKillItemDisplayUpdater.UpdateKillCounterText(self.increasedDamageKillCount);
			}
		}
	}
	internal class KnockbackFin : ItemTemplate
	{
		public static string StaticName = "Knockback Fin";

		public static ConfigEntry<int> Rework;

		public static ConfigEntry<bool> DamageColor;

		public static ConfigEntry<bool> IsHyperbolic;

		public static ConfigEntry<float> Chance_Base;

		public static ConfigEntry<float> Chance_Stack;

		public static ConfigEntry<float> Damage_Base;

		public static ConfigEntry<float> Damage_Stack;

		public KnockbackFin(int descType)
		{
			ItemInternal = "KNOCKBACKHITENEMIES";
			switch (descType)
			{
			case 1:
				ItemInfo = "Chance on hit to knock enemies into the air.\nDeal bonus damage to airborne enemies.";
				ItemDesc = string.Format("{0}% ".Style(ColorCode.FontColor.cIsUtility) + "(+{1}% per stack) ".Style(ColorCode.FontColor.cStack) + "chance on hit to " + "knock enemies into the air".Style(ColorCode.FontColor.cIsUtility) + ". Deal " + "+{2}% ".Style(ColorCode.FontColor.cIsDamage) + "(+{3}% per stack) ".Style(ColorCode.FontColor.cStack) + "damage to " + "airborne ".Style(ColorCode.FontColor.cIsUtility) + "enemies.", ItemTemplate.RoundVal(Chance_Base.Value), ItemTemplate.RoundVal(Chance_Stack.Value), ItemTemplate.RoundVal(Damage_Base.Value), ItemTemplate.RoundVal(Damage_Stack.Value));
				break;
			case -1:
				ItemInfo = "Chance on hit to knock up enemies.\nDeal bonus damage to airborne enemies.";
				ItemDesc = string.Format("{0}% ".Style(ColorCode.FontColor.cIsUtility) + "(+{1}% per stack) ".Style(ColorCode.FontColor.cStack) + "chance on hit to " + "knock up enemies".Style(ColorCode.FontColor.cIsUtility) + ". Deal " + "+{2}% ".Style(ColorCode.FontColor.cIsDamage) + "(+{3}% per stack) ".Style(ColorCode.FontColor.cStack) + "damage to " + "airborne ".Style(ColorCode.FontColor.cIsUtility) + "enemies.", ItemTemplate.RoundVal(Chance_Base.Value), ItemTemplate.RoundVal(Chance_Stack.Value), ItemTemplate.RoundVal(Damage_Base.Value), ItemTemplate.RoundVal(Damage_Stack.Value));
				break;
			}
		}
	}
	public static class KnockbackFinBehavior
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__DamageAirborne;

			public static Manipulator <1>__RemoveEffect;

			public static hook_ProcessHitEnemy <2>__KnockEffect;
		}

		private static EffectDef airborneVFX;

		private static DamageColorIndex airborneDamage;

		public static void Init()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			if (KnockbackFin.Rework.Value == 1)
			{
				ExposeModifyEffect();
				object obj = <>O.<0>__DamageAirborne;
				if (obj == null)
				{
					Manipulator val = DamageAirborne;
					<>O.<0>__DamageAirborne = val;
					obj = (object)val;
				}
				HealthComponent.TakeDamageProcess += (Manipulator)obj;
				object obj2 = <>O.<1>__RemoveEffect;
				if (obj2 == null)
				{
					Manipulator val2 = RemoveEffect;
					<>O.<1>__RemoveEffect = val2;
					obj2 = (object)val2;
				}
				GlobalEventManager.ProcessHitEnemy += (Manipulator)obj2;
				object obj3 = <>O.<2>__KnockEffect;
				if (obj3 == null)
				{
					hook_ProcessHitEnemy val3 = KnockEffect;
					<>O.<2>__KnockEffect = val3;
					obj3 = (object)val3;
				}
				GlobalEventManager.ProcessHitEnemy += (hook_ProcessHitEnemy)obj3;
			}
		}

		private static void ExposeModifyEffect()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Merc/MercExposeConsumeEffect.prefab").WaitForCompletion(), "KnockbackFinAirborne", true);
			EffectComponent component = val.GetComponent<EffectComponent>();
			component.soundName = "";
			airborneVFX = new EffectDef
			{
				prefab = val,
				prefabName = "KnockbackFinAirborne",
				prefabEffectComponent = component
			};
			if (KnockbackFin.DamageColor.Value)
			{
				ContentAddition.AddEffect(airborneVFX.prefab);
				airborneDamage = ColorsAPI.RegisterDamageColor(new Color(0.3f, 0.65f, 1f));
			}
		}

		private static void RemoveEffect(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int num2 = default(int);
			if (val.TryGotoNext(new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 2),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(GameObject), "GetComponent"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num2),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 2),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(GameObject), "GetComponent")
			}))
			{
				int index = val.Index;
				int num = default(int);
				if (val.TryGotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchPop(x),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
					(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "StunAndPierce")
				}))
				{
					ILLabel val2 = val.MarkLabel();
					val.Goto(index, (MoveType)0, false);
					val.Emit(OpCodes.Br, val2.Target);
				}
			}
			else
			{
				Log.Warning(KnockbackFin.StaticName + " #1 - IL Fail #1");
			}
		}

		private static void KnockEffect(orig_ProcessHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Invalid comparison between Unknown and I4
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Expected O, but got Unknown
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Invalid comparison between Unknown and I4
			orig.Invoke(self, damageInfo, victim);
			if (!Object.op_Implicit((Object)(object)damageInfo.attacker) || !Object.op_Implicit((Object)(object)victim) || !(damageInfo.procCoefficient > 0f))
			{
				return;
			}
			CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
			CharacterBody component2 = victim.GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component2))
			{
				return;
			}
			int num = (Object.op_Implicit((Object)(object)component.inventory) ? component.inventory.GetItemCount(Items.KnockBackHitEnemies) : 0);
			if (num > 0)
			{
				CharacterMotor component3 = victim.GetComponent<CharacterMotor>();
				victim.GetComponent<RigidbodyMotor>();
				float num2 = (KnockbackFin.Chance_Base.Value + KnockbackFin.Chance_Stack.Value * (float)(num - 1)) * damageInfo.procCoefficient;
				if (KnockbackFin.IsHyperbolic.Value)
				{
					num2 = Util.ConvertAmplificationPercentageIntoReductionPercentage(num2);
				}
				if (Object.op_Implicit((Object)(object)component3) && component3.isGrounded && !component2.isChampion && (component2.bodyFlags & 1) == 0 && Util.CheckRoll(num2, 0f, (CharacterMaster)null))
				{
					float scale = (((int)component2.hullClassification == 0) ? 1f : (((int)component2.hullClassification == 1) ? 5f : (((int)component2.hullClassification == 2) ? 10f : 1f)));
					Util.PlaySound("Play_item_proc_knockBackHitEnemies", ((Component)component).gameObject);
					EffectManager.SpawnEffect(CommonAssets.knockbackFinEffect, new EffectData
					{
						origin = ((Component)component2).gameObject.transform.position,
						scale = scale
					}, true);
					Vector3 val = default(Vector3);
					((Vector3)(ref val))..ctor(0f, 1f, 0f);
					float num3 = component3.mass * 25f;
					component3.ApplyForce(num3 * val, false, false);
				}
			}
		}

		private static void DamageAirborne(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int damageIndex = -1;
			int num4 = default(int);
			if (!val.TryGotoNext(new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref damageIndex),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num4),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<HealthComponent>(x, "body"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_teamComponent")
			}))
			{
				Log.Warning(KnockbackFin.StaticName + " #1 - IL Fail #2");
			}
			int num3 = default(int);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num3),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<HealthComponent>(x, "get_fullCombinedHealth")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldarg_1);
				val.Emit(OpCodes.Ldloc, damageIndex);
				val.EmitDelegate<Func<HealthComponent, DamageInfo, float, float>>((Func<HealthComponent, DamageInfo, float, float>)delegate(HealthComponent healthComponent, DamageInfo damageInfo, float damage)
				{
					//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
					//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
					//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
					float num = damage;
					CharacterBody val2 = (Object.op_Implicit((Object)(object)damageInfo.attacker) ? damageInfo.attacker.GetComponent<CharacterBody>() : null);
					int num2 = ((Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.inventory)) ? val2.inventory.GetItemCount(Items.KnockBackHitEnemies) : 0);
					if (num2 > 0 && (healthComponent.body.isFlying || ((Object)(object)healthComponent.body.characterMotor != (Object)null && !healthComponent.body.characterMotor.isGrounded)))
					{
						if (KnockbackFin.DamageColor.Value)
						{
							damageInfo.damageColorIndex = airborneDamage;
						}
						EffectManager.SimpleImpactEffect(airborneVFX.prefab, damageInfo.position, Vector3.up, true);
						num *= 1f + (KnockbackFin.Damage_Base.Value + KnockbackFin.Damage_Stack.Value * (float)(num2 - 1)) / 100f;
					}
					return num;
				});
				val.Emit(OpCodes.Stloc, damageIndex);
			}
			else
			{
				Log.Warning(KnockbackFin.StaticName + " #1 - IL Fail #3");
			}
		}
	}
	internal class WarpedEcho : ItemTemplate
	{
		public static string StaticName = "Warped Echo";

		public static ConfigEntry<int> Rework;

		public static ConfigEntry<float> Delay_Base;

		public static ConfigEntry<int> Instance_Stack;

		public WarpedEcho(int descType)
		{
			ItemInternal = "DELAYEDDAMAGE";
			if (descType == 1)
			{
				ItemInfo = "Half of incoming damage is delayed.";
				ItemDesc = string.Format("Incoming damage ".Style(ColorCode.FontColor.cIsDamage) + "is split " + "50%".Style(ColorCode.FontColor.cIsDamage) + ", with the other " + "50% ".Style(ColorCode.FontColor.cIsDamage) + "delayed for " + "{0}s ".Style(ColorCode.FontColor.cIsDamage) + "(+{1} instances per stack)".Style(ColorCode.FontColor.cStack) + ". Recharges one instance after delayed damage.", ItemTemplate.RoundVal(Delay_Base.Value), Instance_Stack.Value);
			}
		}
	}
	public static class WarpedEchoBehavior
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__RemoveOriginalVFX;

			public static hook_SpawnDelayedDamageEffect <1>__RemoveBehaviorVFX;

			public static Manipulator <2>__SetDelayTimer;

			public static Manipulator <3>__ImmediateRefresh;

			public static hook_UpdateDelayedDamage <4>__BuffLogic;
		}

		private static GameObject delayedVFX;

		public static void Init()
		{
			//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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			if (WarpedEcho.Rework.Value != 1)
			{
				return;
			}
			SpeedModifyEffect();
			if ((Object)(object)delayedVFX != (Object)null)
			{
				object obj = <>O.<0>__RemoveOriginalVFX;
				if (obj == null)
				{
					Manipulator val = RemoveOriginalVFX;
					<>O.<0>__RemoveOriginalVFX = val;
					obj = (object)val;
				}
				HealthComponent.TakeDamageProcess += (Manipulator)obj;
			}
			if ((Object)(object)delayedVFX != (Object)null)
			{
				object obj2 = <>O.<1>__RemoveBehaviorVFX;
				if (obj2 == null)
				{
					hook_SpawnDelayedDamageEffect val2 = RemoveBehaviorVFX;
					<>O.<1>__RemoveBehaviorVFX = val2;
					obj2 = (object)val2;
				}
				DelayedDamageEffectUpdater.SpawnDelayedDamageEffect += (hook_SpawnDelayedDamageEffect)obj2;
			}
			object obj3 = <>O.<2>__SetDelayTimer;
			if (obj3 == null)
			{
				Manipulator val3 = SetDelayTimer;
				<>O.<2>__SetDelayTimer = val3;
				obj3 = (object)val3;
			}
			CharacterBody.SecondHalfOfDelayedDamage += (Manipulator)obj3;
			object obj4 = <>O.<3>__ImmediateRefresh;
			if (obj4 == null)
			{
				Manipulator val4 = ImmediateRefresh;
				<>O.<3>__ImmediateRefresh = val4;
				obj4 = (object)val4;
			}
			CharacterBody.UpdateSecondHalfOfDamage += (Manipulator)obj4;
			object obj5 = <>O.<4>__BuffLogic;
			if (obj5 == null)
			{
				hook_UpdateDelayedDamage val5 = BuffLogic;
				<>O.<4>__BuffLogic = val5;
				obj5 = (object)val5;
			}
			CharacterBody.UpdateDelayedDamage += (hook_UpdateDelayedDamage)obj5;
		}

		private static void SpeedModifyEffect()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			delayedVFX = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Items/DelayedDamage/DelayedDamageIndicator.prefab").WaitForCompletion(), "SlowDelayedDamageIndicator", true);
			Transform val = delayedVFX.gameObject.transform.Find("VFX");
			Transform val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).transform.Find("Ring") : null);
			if (Object.op_Implicit((Object)(object)val2))
			{
				ParticleSystem component = ((Component)val2).GetComponent<ParticleSystem>();
				if ((Object)(object)component != (Object)null)
				{
					MainModule main = component.main;
					((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(WarpedEcho.Delay_Base.Value);
					((MainModule)(ref main)).startSizeMultiplier = 3f;
				}
			}
			for (int i = 0; i < val2.childCount; i++)
			{
				Transform child = val2.GetChild(i);
				ParticleSystem val3 = (Object.op_Implicit((Object)(object)child) ? ((Component)child).GetComponent<ParticleSystem>() : null);
				if (Object.op_Implicit((Object)(object)val3))
				{
					MainModule main2 = val3.main;
					((MainModule)(ref main2)).startDelay = MinMaxCurve.op_Implicit(WarpedEcho.Delay_Base.Value);
					((MainModule)(ref main2)).startSizeMultiplier = 3f;
				}
			}
		}

		private static void SetDelayTimer(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int damageIndex = -1;
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref damageIndex),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchStfld(x, typeof(DelayedDamageInfo), "halfDamage")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldloc, damageIndex);
				val.EmitDelegate<Action<CharacterBody, DelayedDamageInfo>>((Action<CharacterBody, DelayedDamageInfo>)delegate(CharacterBody body, DelayedDamageInfo damageInfo)
				{
					//IL_0036: Unknown result type (might be due to invalid IL or missing references)
					//IL_003b: Unknown result type (might be due to invalid IL or missing references)
					//IL_005c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0061: Unknown result type (might be due to invalid IL or missing references)
					damageInfo.timeUntilDamage = WarpedEcho.Delay_Base.Value;
					if (Object.op_Implicit((Object)(object)delayedVFX) && Object.op_Implicit((Object)(object)body))
					{
						Object.Instantiate<GameObject>(delayedVFX, body.transform.position, Quaternion.identity, ((Component)body.mainHurtBox).transform);
						Object.Instantiate<GameObject>(delayedVFX, body.transform.position, Quaternion.identity, ((Component)body.mainHurtBox).transform);
					}
				});
			}
			else
			{
				Log.Warning(WarpedEcho.StaticName + " #1 - IL Fail #1");
			}
		}

		private static void ImmediateRefresh(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<CharacterBody>(x, "RemoveBuff")
			}))
			{
				Log.Warning(WarpedEcho.StaticName + " #1 - IL Fail #2");
			}
			int num = default(int);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "incomingDamageList"),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num)
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<CharacterBody>>((Action<CharacterBody>)delegate(CharacterBody body)
				{
					body.AddBuff(Buffs.DelayedDamageBuff);
				});
			}
			else
			{
				Log.Warning(WarpedEcho.StaticName + " #1 - IL Fail #3");
			}
		}

		private static void RemoveOriginalVFX(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/Effects/DelayedDamageIndicator")
			}))
			{
				int index = val.Index;
				if (val.TryGotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchPop(x)
				}))
				{
					ILLabel val2 = val.MarkLabel();
					val.Goto(index, (MoveType)0, false);
					val.Emit(OpCodes.Br, val2.Target);
				}
			}
			else
			{
				Log.Warning(WarpedEcho.StaticName + " #1 - IL Fail #4");
			}
		}

		private static void BuffLogic(orig_UpdateDelayedDamage orig, CharacterBody self, float deltaTime)
		{
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)self.inventory))
			{
				return;
			}
			int itemCount = self.inventory.GetItemCount(Items.DelayedDamage);
			if (itemCount > 0)
			{
				itemCount = 1 + WarpedEcho.Instance_Stack.Value * (itemCount - 1);
				if (self.oldDelayedDamageCount != itemCount)
				{
					int num = itemCount - self.oldDelayedDamageCount;
					if (num > 0)
					{
						for (int i = 0; i < Math.Abs(num); i++)
						{
							self.AddBuff(Buffs.DelayedDamageBuff);
						}
					}
					else
					{
						for (int j = 0; j < Math.Abs(num); j++)
						{
							self.RemoveBuff(Buffs.DelayedDamageBuff);
						}
					}
				}
				self.oldDelayedDamageCount = itemCount;
			}
			else
			{
				self.oldDelayedDamageCount = 0;
				self.RemoveBuff(Buffs.DelayedDamageBuff);
				self.RemoveBuff(Buffs.DelayedDamageDebuff);
				self.RemoveOldestTimedBuff(Buffs.DelayedDamageDebuff);
			}
		}

		private static void RemoveBehaviorVFX(orig_SpawnDelayedDamageEffect orig, DelayedDamageEffectUpdater self)
		{
		}
	}
	internal class SeedOfLife : ItemTemplate
	{
		public static string StaticName = "Seed of Life";

		public static ConfigEntry<int> Rework;

		public SeedOfLife(int descType)
		{
			ItemInternal = "HEALANDREVIVE";
			if (descType == 1)
			{
				ItemInfo = "Revives user or allies. Consume on use.";
				ItemDesc = "All allies and yourself " + "return to life".Style(ColorCode.FontColor.cIsHealing) + ". Forces activation " + "upon death".Style(ColorCode.FontColor.cIsUtility) + ". Equipment is " + "consumed ".Style(ColorCode.FontColor.cIsUtility) + "on use.";
			}
		}
	}
	public static class SeedOfLifeBehavior
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__ReviveAll;
		}

		public static void Init()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			if (SeedOfLife.Rework.Value == 1)
			{
				object obj = <>O.<0>__ReviveAll;
				if (obj == null)
				{
					Manipulator val = ReviveAll;
					<>O.<0>__ReviveAll = val;
					obj = (object)val;
				}
				CharacterMaster.OnBodyDeath += (Manipulator)obj;
			}
		}

		private static void ReviveAll(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterMaster>(x, "get_inventory"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Equipment), "HealAndReviveConsumed")
			}))
			{
				val.Emit(OpCodes.Ldarg, 1);
				val.EmitDelegate<Action<CharacterBody>>((Action<CharacterBody>)delegate(CharacterBody self)
				{
					self.equipmentSlot.FireHealAndRevive();
				});
			}
			else
			{
				Log.Warning(SeedOfLife.StaticName + " #1 - IL Fail #1");
			}
		}
	}
	internal class SeedOfLifeConsumed : ItemTemplate
	{
		public static string StaticName = "Seed of Life Consumed";

		public static ConfigEntry<int> Rework;

		public SeedOfLifeConsumed(int descType)
		{
			ItemInternal = "HEALANDREVIVECONSUMED";
			if (descType == 1)
			{
				ItemInfo = "Spawn healing orbs temporarily.";
				ItemDesc = "Place down a sprout that drops " + "10 healing orbs ".Style(ColorCode.FontColor.cIsHealing) + "overtime.";
			}
		}
	}
	internal class BensRaincoat : ItemTemplate
	{
		public static string StaticName = "Bens Raincoat";

		public static ConfigEntry<int> Rework;
	}
	public static class BensRaincoatBehavior
	{
		public static void Init()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (BensRaincoat.Rework.Value == 1)
			{
				BuffDef val = Addressables.LoadAsset<BuffDef>((object)"RoR2/DLC2/bdDisableAllSkills.asset").WaitForCompletion();
				val.isDebuff = true;
			}
		}
	}
	internal class GrowthNectar : ItemTemplate
	{
		public static string StaticName = "Growth Nectar";

		public static ConfigEntry<int> Rework;

		public static ConfigEntry<float> Stat_Base;

		public static ConfigEntry<float> Stat_Stack;

		public static ConfigEntry<float> Charge_Stat_Increase;

		public static ConfigEntry<float> Charge_Cap_Base;

		public static ConfigEntry<float> Charge_Cap_Stack;

		public GrowthNectar(int descType)
		{
			ItemInternal = "BOOSTALLSTATS";
			if (descType == 1)
			{
				ItemInfo = "Not using an equipment increases ALL of your stats. Scales with equipment charges.";
				ItemDesc = string.Format("When your Equipment is off " + "cooldown".Style(ColorCode.FontColor.cIsUtility) + ", increase " + "ALL stats ".Style(ColorCode.FontColor.cIsUtility) + "by " + "{0}% ".Style(ColorCode.FontColor.cIsUtility) + "(+{1}% per stack)".Style(ColorCode.FontColor.cStack) + ", and by " + "{2}% ".Style(ColorCode.FontColor.cIsUtility) + "per " + "Equipment charge".Style(ColorCode.FontColor.cIsUtility) + ", up to a maximum of " + "{3}% ".Style(ColorCode.FontColor.cIsUtility) + "(+{4}% per stack)".Style(ColorCode.FontColor.cStack) + ".", ItemTemplate.RoundVal(Stat_Base.Value), ItemTemplate.RoundVal(Stat_Stack.Value), ItemTemplate.RoundVal(Charge_Stat_Increase.Value), ItemTemplate.RoundVal(Charge_Cap_Base.Value), ItemTemplate.RoundVal(Charge_Cap_Stack.Value));
			}
		}
	}
	public static class GrowthNectarBehavior
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_MyFixedUpdate <0>__NonEquipUse;

			public static hook_UpdateBoostAllStatsTimer <1>__ReplaceEffect;

			public static Manipulator <2>__ReplaceTrigger;

			public static Manipulator <3>__ReplaceStats;
		}

		public static void Init()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			if (GrowthNectar.Rework.Value == 1)
			{
				object obj = <>O.<0>__NonEquipUse;
				if (obj == null)
				{
					hook_MyFixedUpdate val = NonEquipUse;
					<>O.<0>__NonEquipUse = val;
					obj = (object)val;
				}
				EquipmentSlot.MyFixedUpdate += (hook_MyFixedUpdate)obj;
				object obj2 = <>O.<1>__ReplaceEffect;
				if (obj2 == null)
				{
					hook_UpdateBoostAllStatsTimer val2 = ReplaceEffect;
					<>O.<1>__ReplaceEffect = val2;
					obj2 = (object)val2;
				}
				CharacterBody.UpdateBoostAllStatsTimer += (hook_UpdateBoostAllStatsTimer)obj2;
				object obj3 = <>O.<2>__ReplaceTrigger;
				if (obj3 == null)
				{
					Manipulator val3 = ReplaceTrigger;
					<>O.<2>__ReplaceTrigger = val3;
					obj3 = (object)val3;
				}
				CharacterBody.RecalculateStats += (Manipulator)obj3;
				object obj4 = <>O.<3>__ReplaceStats;
				if (obj4 == null)
				{
					Manipulator val4 = ReplaceStats;
					<>O.<3>__ReplaceStats = val4;
					obj4 = (object)val4;
				}
				CharacterBody.RecalculateStats += (Manipulator)obj4;
			}
		}

		private static void NonEquipUse(orig_MyFixedUpdate orig, EquipmentSlot self, float deltaTime)
		{
			orig.Invoke(self, deltaTime);
			if (NetworkServer.active && Object.op_Implicit((Object)(object)self.characterBody.inventory))
			{
				int itemCount = self.characterBody.inventory.GetItemCount(Items.BoostAllStats);
				bool flag = self.cooldownTimer == float.PositiveInfinity || self.cooldownTimer == float.NegativeInfinity;
				bool flag2 = self.characterBody.HasBuff(Buffs.BoostAllStatsBuff);
				if (itemCount > 0 && !flag2 && (self.cooldownTimer <= 0f || flag))
				{
					self.characterBody.AddBuff(Buffs.BoostAllStatsBuff);
				}
				else if ((itemCount <= 0 || !flag) && flag2)
				{
					self.characterBody.RemoveBuff(Buffs.BoostAllStatsBuff);
				}
			}
		}

		private static void ReplaceEffect(orig_UpdateBoostAllStatsTimer orig, CharacterBody self, float timer)
		{
		}

		private static void ReplaceTrigger(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);
			ILLabel val2 = default(ILLabel);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchBle(x, ref val2),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "BoostAllStatsBuff")
			}))
			{
				val.EmitDelegate<Func<int, int>>((Func<int, int>)((int stack) => int.MaxValue));
			}
			else
			{
				Log.Warning(GrowthNectar.StaticName + " #1 - IL Fail #1");
			}
		}

		private static void ReplaceStats(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int num5 = default(int);
			if (val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num5),
				(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "boostAllStatsMultiplier")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<CharacterBody>>((Action<CharacterBody>)delegate(CharacterBody self)
				{
					EquipmentSlot equipmentSlot = self.equipmentSlot;
					int num = (Object.op_Implicit((Object)(object)self.inventory) ? self.inventory.GetItemCount(Items.BoostAllStats) : 0);
					float num2 = GrowthNectar.Stat_Base.Value + GrowthNectar.Stat_Stack.Value * (float)(num - 1);
					float num3 = Math.Min(GrowthNectar.Charge_Stat_Increase.Value * (float)(equipmentSlot.maxStock - 1), GrowthNectar.Charge_Cap_Base.Value + GrowthNectar.Charge_Cap_Stack.Value * (float)(num - 1));
					float num4 = (num2 + num3) / 100f;
					self.armor += self.armor * num4;
					self.maxHealth += self.maxHealth * num4;
					self.regen += self.regen * num4;
					self.moveSpeed += self.moveSpeed * num4;
					self.attackSpeed += self.attackSpeed * num4;
					self.damage += self.damage * num4;
					self.crit += self.crit * num4;
				});
				int index = val.Index;
				if (val.TryGotoNext(new Func<Instruction, bool>[4]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_maxHealth"),
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "set_maxBonusHealth")
				}))
				{
					ILLabel val2 = val.MarkLabel();
					val.Goto(index, (MoveType)0, false);
					val.Emit(OpCodes.Br, val2.Target);
				}
				else
				{
					Log.Warning(GrowthNectar.StaticName + " #1 - IL Fail #3");
				}
			}
			else
			{
				Log.Warning(GrowthNectar.StaticName + " #1 - IL Fail #2");
			}
		}
	}
	internal class WarBonds : ItemTemplate
	{
		public static string StaticName = "War Bonds";

		public static ConfigEntry<int> Rework;

		public static ConfigEntry<bool> Free_Purchase_VFX;

		public static ConfigEntry<int> Purchase_Base;

		public static ConfigEntry<int> Purchase_Stack;

		public static ConfigEntry<float> Experience_Percent_Base;

		public static ConfigEntry<float> Experience_Percent_Stack;

		public WarBonds(int descType)
		{
			ItemInternal = "GOLDONSTAGESTART";
			if (descType == 1)
			{
				ItemInfo = $"Gain free purchases at the start of each stage.\nGain {ItemTemplate.RoundVal(Experience_Percent_Base.Value)}% experience on cash spent on all purchases.";
				ItemDesc = string.Format("Gain " + "{0} ".Style(ColorCode.FontColor.cIsUtility) + "(+{1} per stack) ".Style(ColorCode.FontColor.cStack) + "free purchases ".Style(ColorCode.FontColor.cIsUtility) + "at the " + "start of each stage".Style(ColorCode.FontColor.cIsUtility) + ". When making a gold purchase, get " + "{2}% ".Style(ColorCode.FontColor.cIsUtility) + "(+{3}% per stack) ".Style(ColorCode.FontColor.cStack) + "of spent gold as " + "experience".Style(ColorCode.FontColor.cIsUtility) + ".", Purchase_Base.Value, Purchase_Stack.Value, ItemTemplate.RoundVal(Experience_Percent_Base.Value), ItemTemplate.RoundVal(Experience_Percent_Stack.Value));
			}
		}
	}
	public static class WarBondsBehavior
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__InteractBegin;

			public static Manipulator <1>__ReplaceEffect;

			public static hook_Start <2>__FreeUnlocks;
		}

		public static void Init()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			if (WarBonds.Rework.Value == 1)
			{
				object obj = <>O.<0>__InteractBegin;
				if (obj == null)
				{
					Manipulator val = InteractBegin;
					<>O.<0>__InteractBegin = val;
					obj = (object)val;
				}
				PurchaseInteraction.OnInteractionBegin += (Manipulator)obj;
				object obj2 = <>O.<1>__ReplaceEffect;
				if (obj2 == null)
				{
					Manipulator val2 = ReplaceEffect;
					<>O.<1>__ReplaceEffect = val2;
					obj2 = (object)val2;
				}
				CharacterBody.Start += (Manipulator)obj2;
				object obj3 = <>O.<2>__FreeUnlocks;
				if (obj3 == null)
				{
					hook_Start val3 = FreeUnlocks;
					<>O.<2>__FreeUnlocks = val3;
					obj3 = (object)val3;
				}
				CharacterBody.Start += (hook_Start)obj3;
			}
		}

		private static void InteractBegin(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int costIndex = -1;
			if (!val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<PurchaseInteraction>(x, "cost"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref costIndex)
			}))
			{
				Log.Warning(WarBonds.StaticName + " #1 - IL Fail #1");
			}
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0)
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Action<PurchaseInteraction, Interactor>>((Action<PurchaseInteraction, Interactor>)delegate(PurchaseInteraction interact, Interactor activator)
				{
					//IL_0012: Unknown result type (might be due to invalid IL or missing references)
					//IL_0018: Invalid comparison between Unknown and I4
					//IL_0060: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
					//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
					//IL_00f4: Expected O, but got Unknown
					if (Object.op_Implicit((Object)(object)activator) && Object.op_Implicit((Object)(object)interact) && (int)interact.costType == 1)
					{
						CharacterBody component = ((Component)activator).GetComponent<CharacterBody>();
						int num = (Object.op_Implicit((Object)(object)component.inventory) ? component.inventory.GetItemCount(Items.GoldOnStageStart) : 0);
						if (num > 0)
						{
							ExperienceManager.instance.AwardExperience(((Component)interact).transform.position, component, (ulong)((float)interact.cost * (WarBonds.Experience_Percent_Base.Value + WarBonds.Experience_Percent_Stack.Value * (float)(num - 1)) / 100f));
						}
						if (component.HasBuff(Buffs.FreeUnlocks) && WarBonds.Free_Purchase_VFX.Value)
						{
							Util.PlaySound("Play_item_proc_goldOnStageStart", ((Component)component).gameObject);
							EffectManager.SpawnEffect(AssetReferences.gainCoinsImpactEffectPrefab, new EffectData
							{
								origin = component.transform.position,
								scale = 2f
							}, false);
						}
					}
				});
			}
			else
			{
				Log.Warning(WarBonds.StaticName + " #1 - IL Fail #2");
			}
		}

		private static void ReplaceEffect(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);
			ILLabel val2 = default(ILLabel);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchBle(x, ref val2),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "GoldOnStageStart")
			}))
			{
				val.EmitDelegate<Func<int, int>>((Func<int, int>)((int stack) => int.MaxValue));
			}
			else
			{
				Log.Warning(WarBonds.StaticName + " #1 - IL Fail #3");
			}
		}

		private static void FreeUnlocks(orig_Start orig, CharacterBody self)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (NetworkServer.active && Object.op_Implicit((Object)(object)self.master) && Object.op_Implicit((Object)(object)self.master.inventory))
			{
				int itemCount = self.master.inventory.GetItemCount(Items.GoldOnStageStart);
				if (itemCount > 0)
				{
					self.SetBuffCount(Buffs.FreeUnlocks.buffIndex, WarBonds.Purchase_Base.Value + WarBonds.Purchase_Stack.Value * (itemCount - 1));
				}
			}
		}
	}
	internal class ChanceDoll : ItemTemplate
	{
		public static string StaticName = "Chance Doll";

		public static ConfigEntry<int> Rework;

		public static ConfigEntry<int> Max_Upgrade;

		public static ConfigEntry<float> Hidden_Chance;

		public static ConfigEntry<float> Chance_Base;

		public static ConfigEntry<float> Chance_Stack;

		public static ConfigEntry<int> Karma_Required;

		public static ConfigEntry<int> Karma_Base_Cap;

		public static ConfigEntry<int> Karma_Stack_Cap;

		public static ConfigEntry<int> Luck_Per;

		public ChanceDoll(int descType)
		{
			ItemInternal = "EXTRASHRINEITEM";
			if (descType == 1)
			{
				string arg = "Common";
				if (Max_Upgrade.Value == 1)
				{
					arg = "Uncommon".Style(ColorCode.FontColor.cIsHealing);
				}
				if (Max_Upgrade.Value == 2)
				{
					arg = "Legendary".Style(ColorCode.FontColor.cIsHealth);
				}
				if (Max_Upgrade.Value == 3)
				{
					arg = "Boss".Style(ColorCode.FontColor.cIsDamage);
				}
				ItemInfo = "Chance to upgrade the item reward on failing a Shrine.";
				ItemDesc = string.Format("Failing a Shrine increases the chance for the item reward to " + "upgrade ".Style(ColorCode.FontColor.cIsUtility) + "by " + "{0}% ".Style(ColorCode.FontColor.cIsUtility) + "(+{1}% per stack)".Style(ColorCode.FontColor.cStack) + ", up to a {2} item.", ItemTemplate.RoundVal(Chance_Base.Value), ItemTemplate.RoundVal(Chance_Stack.Value), arg);
			}
			if (descType == 2)
			{
				ItemInfo = $"Activating {ItemTemplate.RoundVal(Karma_Required.Value)} Shrines permanently increases your luck.";
				ItemDesc = string.Format("When using " + "{0} ".Style(ColorCode.FontColor.cIsUtility) + "Shrines, all random effects are rerolled " + "+{1} ".Style(ColorCode.FontColor.cIsUtility) + "times for a " + "favorable outcome permanently".Style(ColorCode.FontColor.cIsUtility) + ", up to a " + "maximum ".Style(ColorCode.FontColor.cIsUtility) + "of " + "{2} ".Style(ColorCode.FontColor.cIsUtility) + "(+{3} per stack) ".Style(ColorCode.FontColor.cStack) + "times.", ItemTemplate.RoundVal(Karma_Required.Value), ItemTemplate.RoundVal(Luck_Per.Value), ItemTemplate.RoundVal(Karma_Base_Cap.Value), ItemTemplate.RoundVal(Karma_Stack_Cap.Value));
			}
		}
	}
	public static class ChanceDollBehavior
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__AddCounter;

			public static hook_AddShrineStack <1>__ReplaceBehavior;

			public static Manipulator <2>__RemoveBehavior;

			public static hook_OnInteractionBegin <3>__IncreaseKarma;

			public static hook_OnInventoryChanged <4>__LuckCount;
		}

		public static void Init()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			if (ChanceDoll.Rework.Value == 1)
			{
				LanguageAPI.Add("SHRINE_CHANCE_DOLL_2P", "<style=cShrine>Your Chance Doll upgrades the shrine, granting a reward!</color>");
				LanguageAPI.Add("SHRINE_CHANCE_DOLL", "<style=cShrine>{0}'s Chance Doll upgrades the shrine, granting a reward!</color>");
				object obj = <>O.<0>__AddCounter;
				if (obj == null)
				{
					hook_Awake val = AddCounter;
					<>O.<0>__AddCounter = val;
					obj = (object)val;
				}
				ShrineChanceBehavior.Awake += (hook_Awake)obj;
				object obj2 = <>O.<1>__ReplaceBehavior;
				if (obj2 == null)
				{
					hook_AddShrineStack val2 = ReplaceBehavior;
					<>O.<1>__ReplaceBehavior = val2;
					obj2 = (object)val2;
				}
				ShrineChanceBehavior.AddShrineStack += (hook_AddShrineStack)obj2;
			}
			else if (ChanceDoll.Rework.Value == 2)
			{
				object obj3 = <>O.<2>__RemoveBehavior;
				if (obj3 == null)
				{
					Manipulator val3 = RemoveBehavior;
					<>O.<2>__RemoveBehavior = val3;
					obj3 = (object)val3;
				}
				ShrineChanceBehavior.AddShrineStack += (Manipulator)obj3;
				object obj4 = <>O.<3>__IncreaseKarma;
				if (obj4 == null)
				{
					hook_OnInteractionBegin val4 = IncreaseKarma;
					<>O.<3>__IncreaseKarma = val4;
					obj4 = (object)val4;
				}
				GlobalEventManager.OnInteractionBegin += (hook_OnInteractionBegin)obj4;
				object obj5 = <>O.<4>__LuckCount;
				if (obj5 == null)
				{
					hook_OnInventoryChanged val5 = LuckCount;
					<>O.<4>__LuckCount = val5;
					obj5 = (object)val5;
				}
				CharacterMaster.OnInventoryChanged += (hook_OnInventoryChanged)obj5;
			}
		}

		private static void AddCounter(orig_Awake orig, ShrineChanceBehavior self)
		{
			orig.Invoke(self);
			ShrineFailCount shrineFailCount = ((Component)self).gameObject.AddComponent<ShrineFailCount>();
			shrineFailCount.FailCount = 0;
		}

		private static void ReplaceBehavior(orig_AddShrineStack orig, ShrineChanceBehavior self, Interactor activator)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Expected O, but got Unknown
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Expected O, but got Unknown
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Expected O, but got Unknown
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Expected O, but got Unknown
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Invalid comparison between Unknown and I4
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Invalid comparison between Unknown and I4
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Invalid comparison between Unknown and I4
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)((Component)activator).GetComponent<HealthComponent>()))
			{
				return;
			}
			CharacterBody component = ((Component)activator).GetComponent<CharacterBody>();
			PickupIndex val = PickupIndex.none;
			if (!Object.op_Implicit((Object)(object)component.inventory))
			{
				return;
			}
			self.chanceDollWin = false;
			if (Object.op_Implicit((Object)(object)self.dropTable))
			{
				ShrineFailCount component2 = ((Component)self).gameObject.GetComponent<ShrineFailCount>();
				int itemCount = component.inventory.GetItemCount(Items.ExtraShrineItem);
				if (self.rng.nextNormalizedFloat > self.failureChance)
				{
					val = self.dropTable.GenerateDrop(self.rng);
					float num = (ChanceDoll.Chance_Base.Value + ChanceDoll.Chance_Stack.Value * (float)(itemCount - 1)) * (float)component2.FailCount;
					if (Util.CheckRoll((itemCount > 0) ? Math.Max(num, ChanceDoll.Hidden_Chance.Value) : 0f, component.master))
					{
						int num2 = (Util.CheckRoll(num % 100f, 0f, (CharacterMaster)null) ? 1 : 0);
						double num3 = Math.Round(num / 100f);
						ItemTier val2 = ((ChanceDoll.Max_Upgrade.Value == 3 && num3 + (double)num2 > 2.0) ? ((ItemTier)4) : ((ChanceDoll.Max_Upgrade.Value >= 2 && num3 + (double)num2 > 1.0) ? ((ItemTier)2) : ((ChanceDoll.Max_Upgrade.Value < 1 || !(num3 + (double)num2 <= 1.0)) ? ((ItemTier)0) : ((ItemTier)1))));
						List<PickupIndex> list = new List<PickupIndex>(Run.instance.availableTier1DropList);
						List<PickupIndex> list2 = new List<PickupIndex>(Run.instance.availableTier2DropList);
						List<PickupIndex> list3 = new List<PickupIndex>(Run.instance.availableTier3DropList);
						List<PickupIndex> list4 = new List<PickupIndex>(Run.instance.availableBossDropList);
						List<PickupIndex> list5 = (((int)val2 == 0) ? list : (((int)val2 == 1) ? list2 : (((int)val2 != 2) ? list4 : list3)));
						Util.ShuffleList<PickupIndex>(list5);
						val = list5[0];
						self.chanceDollWin = true;
					}
				}
				else
				{
					component2.FailCount++;
					if (itemCount > 0)
					{
						EffectManager.SpawnEffect(self.effectPrefabShrineRewardNormal, new EffectData
						{
							origin = ((Component)self).gameObject.transform.position,
							rotation = Quaternion.identity,
							scale = 3f,
							color = Color32.op_Implicit(self.colorShrineRewardJackpot)
						}, true);
					}
				}
			}
			string baseToken;
			if (val == PickupIndex.none)
			{
				baseToken = "SHRINE_CHANCE_FAIL_MESSAGE";
			}
			else
			{
				baseToken = ((!self.chanceDollWin) ? "SHRINE_CHANCE_SUCCESS_MESSAGE" : "SHRINE_CHANCE_DOLL");
				self.successfulPurchaseCount++;
				PickupDropletController.CreatePickupDroplet(val, self.dropletOrigin.position, self.dropletOrigin.forward * 20f);
			}
			Chat.SendBroadcastChat((ChatMessageBase)new SubjectFormatChatMessage
			{
				subjectAsCharacterBody = component,
				baseToken = baseToken
			});
			self.waitingForRefresh = true;
			self.refreshTimer = 2f;
			if (self.chanceDollWin)
			{
				EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ExtraStatsOnLevelUpEffect"), new EffectData
				{
					origin = ((Component)self).gameObject.transform.position,
					rotation = Quaternion.identity,
					scale = 3f,
					color = Color32.op_Implicit(self.colorShrineRewardJackpot)
				}, true);
			}
			else
			{
				EffectManager.SpawnEffect(self.effectPrefabShrineRewardNormal, new EffectData
				{
					origin = ((Component)self).gameObject.transform.position,
					rotation = Quaternion.identity,
					scale = 1.5f,
					color = Color32.op_Implicit(self.colorShrineRewardNormal)
				}, true);
			}
			if (self.successfulPurchaseCount >= self.maxPurchaseCount)
			{
				((Component)self.symbolTransform).gameObject.SetActive(false);
				((ShrineBehavior)self).CallRpcSetPingable(false);
			}
		}

		private static void RemoveBehavior(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);
			ILLabel val2 = default(ILLabel);
			int num = default(int);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchBle(x, ref val2),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ExtraShrineItem")
			}))
			{
				val.EmitDelegate<Func<int, int>>((Func<int, int>)((int self) => int.MaxValue));
			}
			else
			{
				Log.Warning(ChanceDoll.StaticName + " #2 - IL Fail #1");
			}
		}

		private static void IncreaseKarma(orig_OnInteractionBegin orig, GlobalEventManager self, Interactor interactor, IInteractable interactable, GameObject interactObject)
		{
			orig.Invoke(self, interactor, interactable, interactObject);
			PurchaseInteraction val = (Object.op_Implicit((Object)(object)interactObject) ? interactObject.GetComponent<PurchaseInteraction>() : null);
			if (interactable == null || !Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			CharacterBody component = ((Component)interactor).GetComponent<CharacterBody>();
			int num = (Object.op_Implicit((Object)(object)component.inventory) ? component.inventory.GetItemCount(Items.ExtraShrineItem) : 0);
			if (Object.op_Implicit((Object)(object)component) && num > 0 && val.isShrine)
			{
				PlayerCharacterMasterController playerCharacterMasterController = component.master.playerCharacterMasterController;
				KarmaDollBehavior karmaDollBehavior = ((Component)playerCharacterMasterController).GetComponent<KarmaDollBehavior>();
				if (!Object.op_Implicit((Object)(object)karmaDollBehavior))
				{
					karmaDollBehavior = ((Component)playerCharacterMasterController).gameObject.AddComponent<KarmaDollBehavior>();
				}
				karmaDollBehavior.KarmaOrb(component, interactObject);
			}
			else if (Object.op_Implicit((Object)(object)component) && num <= 0)
			{
				PlayerCharacterMasterController playerCharacterMasterController2 = component.master.playerCharacterMasterController;
				KarmaDollBehavior component2 = ((Component)playerCharacterMasterController2).GetComponent<KarmaDollBehavior>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					component2.UpdateLuck();
				}
			}
		}

		private static void LuckCount(orig_OnInventoryChanged orig, CharacterMaster self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)self.playerCharacterMasterController))
			{
				KarmaDollBehavior component = ((Component)self.playerCharacterMasterController).GetComponent<KarmaDollBehavior>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.UpdateLuck();
					self.luck += (float)component.luckStat;
				}
			}
		}
	}
	public class ShrineFailCount : NetworkBehaviour
	{
		public int FailCount;

		private void UNetVersion()
		{
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			bool result = default(bool);
			return result;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
		}
	}
	public class KarmaDollBehavior : MonoBehaviour
	{
		private CharacterBody owner;

		public int luckStat;

		private int karmaCount;

		private int ItemCount => (Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)owner.inventory)) ? owner.inventory.GetItemCount(Items.ExtraShrineItem) : 0;

		private void OnEnable()
		{
			ReattachOwner();
		}

		public void KarmaOrb(CharacterBody body, GameObject interactableObject)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			ReattachOwner();
			if ((Object.op_Implicit((Object)(object)body) || Object.op_Implicit((Object)(object)interactableObject)) && luckStat < ItemCount)
			{
				KarmaDollOrb karmaDollOrb = new KarmaDollOrb
				{
					origin = interactableObject.transform.position,
					target = body.mainHurtBox,
					arrivalTime = 5f
				};
				OrbManager.instance.AddOrb((Orb)(object)karmaDollOrb);
			}
		}

		public void IncreaseKarma()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			karmaCount++;
			if (karmaCount >= ChanceDoll.Karma_Required.Value)
			{
				karmaCount = 0;
				UpdateLuck(ChanceDoll.Luck_Per.Value);
				owner.master.OnInventoryChanged();
				EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ExtraStatsOnLevelUpEffect"), new EffectData
				{
					origin = ((Component)owner).gameObject.transform.position,
					rotation = Quaternion.identity,
					scale = 1f,
					color = Color32.op_Implicit(new Color(0.245f, 0.215f, 0.1275f))
				}, true);
			}
		}

		public void UpdateLuck(int increase = 0)
		{
			luckStat = Math.Min(luckStat + increase, ChanceDoll.Karma_Base_Cap.Value * ((ItemCount > 0) ? 1 : 0) + ChanceDoll.Karma_Stack_Cap.Value * (ItemCount - 1));
		}

		private void ReattachOwner()
		{
			if (!Object.op_Implicit((Object)(object)owner))
			{
				owner = ((Component)this).GetComponent<CharacterMaster>().GetBody();
			}
		}
	}
	public class KarmaDollOrb : Orb
	{
		private KarmaDollBehavior karmaBehavior;

		private static GameObject orbEffect;

		[InitDuringStartup]
		private static void Init()
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Expected O, but got Unknown
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Expected O, but got Unknown
			orbEffect = PrefabAPI.InstantiateClone(Resources.Load<GameObject>("Prefabs/Effects/OrbEffects/InfusionOrbEffect"), "KarmaDollOrbEffect", true);
			if (!Object.op_Implicit((Object)(object)orbEffect.GetComponent<NetworkIdentity>()))
			{
				orbEffect.AddComponent<NetworkIdentity>();
			}
			Color val = default(Color);
			((Color)(ref val))..ctor(23f / 75f, 0.26f, 0.14f);
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0.98f, 0.86f, 0.51f);
			ParticleSystemRenderer component = ((Component)orbEffect.transform.Find("VFX").Find("Core")).GetComponent<ParticleSystemRenderer>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Material val3 = new Material(((Renderer)component).sharedMaterial);
				val3.DisableKeyword("VERTEXCOLOR");
				val3.SetColor("_TintColor", val2);
				val3.SetColor("_Color", val2);
				((Renderer)component).sharedMaterial = val3;
			}
			ParticleSystem component2 = ((Component)orbEffect.transform.Find("VFX").Find("PulseGlow")).GetComponent<ParticleSystem>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				MainModule main = component2.main;
				((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(val);
				((MainModule)(ref main)).startSizeMultiplier = 0.01f;
			}
			TrailRenderer component3 = ((Component)orbEffect.transform.Find("TrailParent").Find("Trail")).GetComponent<TrailRenderer>();
			if (Object.op_Implicit((Object)(object)component3))
			{
				Material val4 = new Material(((Renderer)component3).sharedMaterial);
				val4.DisableKeyword("VERTEXCOLOR");
				val4.SetColor("_TintColor", val);
				val4.SetColor("_Color", val);
				val4.SetTexture("_RemapTex", ((Renderer)component).sharedMaterial.GetTexture("_RemapTex"));
				((Renderer)component3).sharedMaterial = val4;
				component3.widthMultiplier = 1f;
			}
			OrbEffect component4 = orbEffect.GetComponent<OrbEffect>();
			if (Object.op_Implicit((Object)(object)component4))
			{
				component4.onArrival = new UnityEvent();
			}
			new EffectDef
			{
				prefab = orbEffect,
				prefabName = "KarmaDollOrbEffect",
				prefabEffectComponent = orbEffect.GetComponent<EffectComponent>()
			};
			ContentAddition.AddEffect(orbEffect);
		}

		public override void Begin()
		{
			//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_001c: 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_0034: Expected O, but got Unknown
			((Orb)this).duration = ((Orb)this).distanceToTarget / base.arrivalTime;
			EffectData val = new EffectData
			{
				origin = base.origin,
				genericFloat = ((Orb)this).duration
			};
			val.SetHurtBoxReference(base.target);
			EffectManager.SpawnEffect(orbEffect, val, true);
			HurtBox component = ((Component)base.target).GetComponent<HurtBox>();
			CharacterBody val2 = ((component != null) ? ((Component)component.healthComponent).GetComponent<CharacterBody>() : null);
			if (Object.op_Implicit((Object)(object)val2))
			{
				karmaBehavior = ((Component)val2.master.playerCharacterMasterController).GetComponent<KarmaDollBehavior>();
			}
		}

		public override void OnArrival()
		{
			((Orb)this).OnArrival();
			if (Object.op_Implicit((Object)(object)karmaBehavior))
			{
				karmaBehavior.IncreaseKarma();
			}
		}
	}
	internal class NoxiousThorn : ItemTemplate
	{
		public static string StaticName = "Noxious Thorn";

		public static ConfigEntry<int> Rework;

		public static ConfigEntry<int> Inflict_Type;

		public static ConfigEntry<float> Refresh;

		public static ConfigEntry<float> Damage_Frequency;

		public static ConfigEntry<float> Damage_Base;

		public static ConfigEntry<float> Damage_Stack;

		public static ConfigEntry<float> Initial_Range;

		public static ConfigEntry<float> Range_Increment;

		public static ConfigEntry<float> Base_Cap;

		public static ConfigEntry<float> Stack_Cap;

		public NoxiousThorn(int descType)
		{
			ItemInternal = "TRIGGERENEMYDEBUFFS";
			string text = "bleed ".Style(ColorCode.FontColor.cIsDamage) + "enemies ";
			if (Inflict_Type.Value == 1)
			{
				text = "apply " + "poison ".Style(ColorCode.FontColor.cIsDamage);
			}
			if (Inflict_Type.Value == 2)
			{
				text = "apply " + "blight ".Style(ColorCode.FontColor.cIsDamage);
			}
			if (descType == 1)
			{
				ItemInfo = "Taking damage surrounds yourself in a ring of thorns.";
				ItemDesc = string.Format("Getting hit surrounds you in a " + "ring of thorns ".Style(ColorCode.FontColor.cIsDamage) + "that {0}for " + "{1}% ".Style(ColorCode.FontColor.cIsDamage) + "(+{2}% per stack) ".Style(ColorCode.FontColor.cStack) + "damage. The ring " + "grows when taking damage".Style(ColorCode.FontColor.cIsDamage) + ", increasing its radius by " + "{3}m".Style(ColorCode.FontColor.cIsDamage) + ". Stacks up to " + "{4}m ".Style(ColorCode.FontColor.cIsDamage) + "(+{5}m per stack)".Style(ColorCode.FontColor.cStack) + ".", text, ItemTemplate.RoundVal(Damage_Base.Value), ItemTemplate.RoundVal(Damage_Stack.Value), ItemTemplate.RoundVal(Range_Increment.Value), ItemTemplate.RoundVal(Base_Cap.Value), ItemTemplate.RoundVal(Stack_Cap.Value));
			}
		}
	}
	public static class NoxiousThornBehavior
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__ReplaceEffect;
		}

		public static void Init()
		{
			//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
			if (NoxiousThorn.Rework.Value == 1)
			{
				object obj = <>O.<0>__ReplaceEffect;
				if (obj == null)
				{
					Manipulator val = ReplaceEffect;
					<>O.<0>__ReplaceEffect = val;
					obj = (object)val;
				}
				HealthComponent.TakeDamageProcess += (Manipulator)obj;
			}
		}

		private static void ReplaceEffect(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);
			ILLabel val3 = default(ILLabel);
			float num2 = default(float);
			float num = default(float);
			ILLabel val2 = default(ILLabel);
			if (val.TryGotoNext(new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchBle(x, ref val3),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num2),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchLdnull(x),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Util), "CheckRoll"),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2)
			}))
			{
				val.EmitDelegate<Func<int, int>>((Func<int, int>)((int stack) => int.MaxValue));
			}
			else
			{
				Log.Warning(NoxiousThorn.StaticName + " #1 - IL Fail #1");
			}
		}
	}
	public class NoxiousAuraItemBehavior : BaseItemBodyBehavior
	{
		private static GameObject auraEffect;

		private ThornAuraController clonedAura;

		[ItemDefAssociation(useOnServer = true, useOnClient = false)]
		public static ItemDef GetItemDef()
		{
			return (NoxiousThorn.Rework.Value == 1) ? Items.TriggerEnemyDebuffs : null;
		}

		[InitDuringStartup]
		private static void Init()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to in