Decompiled source of Chef Overcooked v1.0.1

Chef_Overcooked.dll

Decompiled 5 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using HG;
using HG.Reflection;
using IL.RoR2;
using IL.RoR2.UI;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.ExpansionManagement;
using RoR2.Items;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using RoR2BepInExPack.GameAssetPaths.Version_1_35_0;
using RoR2BepInExPack.GameAssetPathsBetter;
using ShaderSwapper;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[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: AssemblyCompany("Chef_Overcooked")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+edcec0bcbee62b3b1bc54aab3e506a534dece42b")]
[assembly: AssemblyProduct("Chef_Overcooked")]
[assembly: AssemblyTitle("Chef_Overcooked")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 ChefOvercooked
{
	public abstract class BuffBase : GenericBase<BuffDef>
	{
		protected virtual Color Color => Color.white;

		protected virtual Sprite IconSprite => null;

		protected virtual StackingDisplayMethod StackDisplay => (StackingDisplayMethod)0;

		protected virtual bool IsCooldown => false;

		protected virtual bool IsDebuff => false;

		protected virtual bool IsHidden => false;

		protected virtual bool IsStackable => false;

		protected override void Create()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			Value = ScriptableObject.CreateInstance<BuffDef>();
			((Object)Value).name = $"bd{Name}";
			Value.buffColor = Color;
			Value.iconSprite = IconSprite;
			Value.stackingDisplayMethod = StackDisplay;
			Value.isCooldown = IsCooldown;
			Value.isDebuff = IsDebuff;
			Value.isHidden = IsHidden;
			Value.canStack = IsStackable;
			ContentAddition.AddBuffDef(Value);
		}
	}
	public abstract class GenericBase<T> where T : Object
	{
		protected T Value;

		protected abstract string Name { get; }

		public GenericBase()
		{
			if (IsEnabled())
			{
				Create();
				Initialize();
			}
		}

		protected virtual bool IsEnabled()
		{
			return true;
		}

		protected virtual void Create()
		{
		}

		protected virtual void Initialize()
		{
		}

		public T Get()
		{
			return Value;
		}
	}
	public abstract class ItemBase : GenericBase<ItemDef>
	{
		protected virtual bool IsConsumed => false;

		protected virtual bool IsRemovable => false;

		protected virtual bool IsHidden => false;

		protected virtual GameObject PickupModelPrefab => null;

		protected virtual Sprite PickupIconSprite => null;

		protected virtual ItemTag[] Tags => Array.Empty<ItemTag>();

		protected virtual CombinedItemTier Tier => (ItemTier)5;

		protected virtual string DisplayName => null;

		protected virtual string Description => null;

		protected virtual string PickupText => null;

		protected virtual string Lore => null;

		protected virtual ItemDisplayRuleDict ItemDisplay()
		{
			return null;
		}

		protected override void Create()
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Expected O, but got Unknown
			Value = ScriptableObject.CreateInstance<ItemDef>();
			((Object)Value).name = Name;
			Value.isConsumed = IsConsumed;
			Value.canRemove = IsRemovable;
			Value.hidden = IsHidden;
			Value.pickupModelPrefab = PickupModelPrefab;
			Value.pickupIconSprite = PickupIconSprite;
			Value.tags = Tags;
			Value.tier = Tier;
			Value._itemTierDef = Tier;
			Value.deprecatedTier = Tier;
			if (Object.op_Implicit((Object)(object)Value))
			{
				Value.AutoPopulateTokens();
				if (!string.IsNullOrWhiteSpace(DisplayName))
				{
					Value.nameToken = HelperLanguage.LanguageAdd(Value.nameToken, DisplayName);
				}
				if (!string.IsNullOrWhiteSpace(Description))
				{
					Value.descriptionToken = HelperLanguage.LanguageAdd(Value.descriptionToken, Description);
				}
				if (!string.IsNullOrWhiteSpace(PickupText))
				{
					Value.pickupToken = HelperLanguage.LanguageAdd(Value.pickupToken, PickupText);
				}
				if (!string.IsNullOrWhiteSpace(Lore))
				{
					Value.loreToken = HelperLanguage.LanguageAdd(Value.loreToken, Lore);
				}
				LogDisplay();
			}
			ItemAPI.Add(new CustomItem(Value, ItemDisplay()));
		}

		protected virtual void LogDisplay()
		{
		}
	}
	public abstract class SkillBase : GenericBase<SkillDef>
	{
		protected virtual string DisplaySkillName => null;

		protected virtual string SkillDescription => null;

		protected virtual Sprite SkillSprite => null;

		protected virtual InterruptPriority InterruptPriority => (InterruptPriority)0;

		protected virtual string ActivationStateMachine => null;

		protected virtual SerializableEntityStateType ActivationState => default(SerializableEntityStateType);

		protected virtual bool IsCombatSkill => false;

		protected virtual bool MustKeyPress => false;

		protected virtual bool CancelSprintOnActivation => false;

		protected virtual bool ForceSprintDuringState => false;

		protected virtual bool CanceledFromSprinting => false;

		protected virtual bool CooldownOnSkillEnd => false;

		protected virtual float BaseCooldown => 0f;

		protected virtual int BaseMaxStock => 0;

		protected virtual int RechargeStock => 0;

		protected virtual int RequiredStock => 0;

		protected virtual int StockToConsume => 0;

		protected override void Create()
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			Value = ScriptableObject.CreateInstance<SkillDef>();
			Value.skillName = Name;
			Value.skillNameToken = HelperLanguage.LanguageAdd(ChefOverCookedPlugin.TokenPrefix + Name.ToUpper() + "_NAME", DisplaySkillName);
			Value.skillDescriptionToken = HelperLanguage.LanguageAdd(ChefOverCookedPlugin.TokenPrefix + Name.ToUpper() + "_DESC", SkillDescription);
			Value.icon = SkillSprite;
			Value.interruptPriority = InterruptPriority;
			Value.activationStateMachineName = ActivationStateMachine;
			Value.activationState = ActivationState;
			Value.isCombatSkill = IsCombatSkill;
			Value.mustKeyPress = MustKeyPress;
			Value.beginSkillCooldownOnSkillEnd = CooldownOnSkillEnd;
			Value.cancelSprintingOnActivation = CancelSprintOnActivation;
			Value.forceSprintDuringState = ForceSprintDuringState;
			Value.canceledFromSprinting = CanceledFromSprinting;
			Value.baseRechargeInterval = BaseCooldown;
			Value.baseMaxStock = BaseMaxStock;
			Value.rechargeStock = RechargeStock;
			Value.requiredStock = RequiredStock;
			Value.stockToConsume = StockToConsume;
			ContentAddition.AddSkillDef(Value);
		}

		protected virtual void LogDisplay()
		{
		}
	}
	public static class PluginConfig
	{
		public enum ItemOptions
		{
			FoodTier,
			Ingredients,
			Both
		}

		public enum MathProcess
		{
			Max,
			Min
		}

		public static ConfigEntry<bool> Set_Default;

		public static ConfigEntry<int> Round_To;

		public static ConfigEntry<ItemOptions> FoodDrops;

		public static ConfigEntry<int> Attack_Instances;

		public static ConfigEntry<int> Damage_Coefficient;

		public static ConfigEntry<float> Proc_Coefficient;

		public static ConfigEntry<float> Attack_Rate;

		public static ConfigEntry<float> Radius;

		public static ConfigEntry<float> Execute_Threshold;

		public static ConfigEntry<float> Execute_Leniency;

		public static ConfigEntry<float> Temp_Duration;

		public static ConfigEntry<float> Claw_Base_Bleed;

		public static ConfigEntry<float> Claw_Damage_Stack;

		public static ConfigEntry<int> Claw_Stack_Cap;

		public static ConfigEntry<int> Claw_Stack_Increase;

		public static ConfigEntry<float> Kebab_Base_Damage;

		public static ConfigEntry<float> Kebab_Stack_Damage;

		public static ConfigEntry<float> Kebab_Lem_Damage;

		public static ConfigEntry<int> Kebab_Lem_Cap;

		public static ConfigEntry<float> Golem_Percent_Barrier;

		public static ConfigEntry<float> Golem_Flat_Barrier;

		public static ConfigEntry<float> Golem_Base_Armor;

		public static ConfigEntry<float> Golem_Stack_Armor;

		public static ConfigEntry<float> Jelly_Cooldown_Base;

		public static ConfigEntry<float> Jelly_Cooldown_Stack;

		public static ConfigEntry<float> Jelly_Stun_Duration;

		public static ConfigEntry<float> Jelly_Stun_Range;

		public static void Init()
		{
			GeneralInit();
			SkillInit();
			ItemInit();
		}

		private static void GeneralInit()
		{
			string text = "! General !";
			Set_Default = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<bool>(text, "Default Configs", true, "[ True = Resets configs on launch (Except Enable Toggles) | False = Configs can be changed ]\nUseful for when Default Values get updated");
			Round_To = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<int>(text, "Item Stat Rounding", 0, "[ 0 = Whole | 1 = Tenths | 2 = Hundrenths | 3 = ... ]\nRounds item values to respective decimal point");
		}

		private static void SkillInit()
		{
			string text = "Chef Special - Cook";
			FoodDrops = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<ItemOptions>(text, "Food Items from Skill", ItemOptions.FoodTier, "[ Which Items will be temporarily created. Overwritten regardless if Alloyed Collective is disabled ]").PostConfig<ItemOptions>();
			Attack_Instances = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<int>(text, "Attack Count", 6, "[ # of Times this Skill will deal Damage ]").PostConfig(MathProcess.Max, 1);
			Damage_Coefficient = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<int>(text, "Damage Number", 150, "[ #% of Base Damage for this Skill to Deal per Attack ]").PostConfig(MathProcess.Max, 0);
			Proc_Coefficient = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text, "Proc Coefficient", 1f, "[ # Proc Coefficient set per Attack ]").PostConfig(MathProcess.Max, 0f);
			Attack_Rate = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text, "Attack Duration", 1f, "[ # Seconds this Attack will last ]").PostConfig(MathProcess.Max, 0f);
			Radius = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text, "Attack Radius", 7.5f, "[ # Meters for the Radius of this Skill ]").PostConfig(MathProcess.Max, 0f);
			Execute_Threshold = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text, "Execute Threshold", 0.1f, "[ # (0 - 1), converted to % of Execute Health when using this Skill ]").PostConfig(MathProcess.Max, 0f).PostConfig(MathProcess.Min, 1f);
			Execute_Leniency = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text, "Execute Leniency", 1f, "[ # Seconds extra to Execute when using this Skill ]").PostConfig(MathProcess.Max, 0f);
			Temp_Duration = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text, "Temp Food Stack", 0.5f, "[ One Temporary Food item is worth # compared to one stack ]").PostConfig(MathProcess.Max, 0f);
		}

		private static void ItemInit()
		{
			string text = "Item - Primitive Claws";
			Claw_Base_Bleed = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text, "Bleed Chance", 5f, "[ #% Bleed Chance ]").PostConfig(MathProcess.Max, 0f);
			Claw_Damage_Stack = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text, "Damage per Buff", 8f, "[ #% Damage Increase for each stack from inflicting Bleed ]").PostConfig(MathProcess.Max, 0f);
			Claw_Stack_Cap = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<int>(text, "Base Buff Cap", 3, "[ # of Max Buffs from inflicting Bleed ]").PostConfig(MathProcess.Max, 0);
			Claw_Stack_Increase = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<int>(text, "Buff Cap Stack", 2, "[ # of Max Buffs added per single item stack ]").PostConfig(MathProcess.Max, 0);
			string text2 = "Item - Grilled Lizard Kebab";
			Kebab_Base_Damage = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text2, "Base Damage", 30f, "[ #% Damage Dealt increased ]").PostConfig(MathProcess.Max, 0f);
			Kebab_Stack_Damage = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text2, "Damage per Stack", 15f, "[ #% Damage Dealt increased per stack of Item ]").PostConfig(MathProcess.Max, 0f);
			Kebab_Lem_Damage = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text2, "Lemurian Damage Inherit", 500f, "[ #% Damage Inherited for the Lemurian ]").PostConfig(MathProcess.Max, 0f);
			Kebab_Lem_Cap = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<int>(text2, "Lemurian Cap", 1, "[ # of Lemurians that can spawn ]").PostConfig(MathProcess.Max, 0);
			string text3 = "Item - Golem Essence with a Twist";
			Golem_Percent_Barrier = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text3, "Percent Barrier Gain", 30f, "[ #% Temporary Barrier gained on Item pickups ]").PostConfig(MathProcess.Max, 0f);
			Golem_Flat_Barrier = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text3, "Flat Barrier Gain", 30f, "[ # Temporary Barrier gained on Collectible pickups ]").PostConfig(MathProcess.Max, 0f);
			Golem_Base_Armor = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text3, "Base Armor", 40f, "[ # Armor increased ]").PostConfig(MathProcess.Max, 0f);
			Golem_Stack_Armor = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text3, "Armor per Stack", 20f, "[ # Armor per Item stack ]").PostConfig(MathProcess.Max, 0f);
			string text4 = "Item - Glowing Jelly Pasta";
			Jelly_Cooldown_Base = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text4, "Base Cooldown Reduction", 1f, "[ #s Flat Cooldown Reduction ]").PostConfig(MathProcess.Max, 0f);
			Jelly_Cooldown_Stack = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text4, "Cooldown Reduction per Stack", 0.5f, "[ #s Flat Cooldown Reduction per Item stack ]").PostConfig(MathProcess.Max, 0f);
			Jelly_Stun_Duration = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text4, "Stun Duration", 3f, "[ #s for the Stun Dration ]").PostConfig(MathProcess.Max, 0f);
			Jelly_Stun_Range = ((BaseUnityPlugin)ChefOverCookedPlugin.Instance).Config.Bind<float>(text4, "Stun Radius", 25f, "[ #m Stun Radius when Utility Skill is used ]").PostConfig(MathProcess.Max, 0f);
		}

		public static ConfigEntry<T> PostConfig<T>(this ConfigEntry<T> config)
		{
			if (Set_Default.Value)
			{
				((ConfigEntryBase)config).BoxedValue = ((ConfigEntryBase)config).DefaultValue;
			}
			return config;
		}

		public static ConfigEntry<float> PostConfig(this ConfigEntry<float> config, MathProcess capType, float capNum)
		{
			config = config.PostConfig<float>();
			if (capType == MathProcess.Max)
			{
				((ConfigEntryBase)config).BoxedValue = Mathf.Max((float)((ConfigEntryBase)config).BoxedValue, capNum);
			}
			else
			{
				((ConfigEntryBase)config).BoxedValue = Mathf.Min((float)((ConfigEntryBase)config).BoxedValue, capNum);
			}
			return config;
		}

		public static ConfigEntry<int> PostConfig(this ConfigEntry<int> config, MathProcess capType, int capNum)
		{
			config = config.PostConfig<int>();
			if (capType == MathProcess.Max)
			{
				((ConfigEntryBase)config).BoxedValue = Mathf.Max((int)((ConfigEntryBase)config).BoxedValue, capNum);
			}
			else
			{
				((ConfigEntryBase)config).BoxedValue = Mathf.Min((int)((ConfigEntryBase)config).BoxedValue, capNum);
			}
			return config;
		}
	}
	public class CookedBuff : BuffBase
	{
		public static BuffDef BuffDef;

		protected override string Name => "ChefCookedMarked";

		protected override Sprite IconSprite => ChefOverCookedPlugin.Bundle.LoadAsset<Sprite>("texChefCookedMarked");

		protected override bool IsHidden => false;

		protected override void Initialize()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			BuffDef = Value;
			GlobalEventManager.OnCharacterDeath += new Manipulator(GlobalEventManager_OnCharacterDeath);
		}

		private void GlobalEventManager_OnCharacterDeath(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int varOneIndex = -1;
			int varTwoIndex = -1;
			int varThreeIndex = -1;
			int varFourIndex = -1;
			int num = default(int);
			if (val.TryGotoNext(new Func<Instruction, bool>[10]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0f),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref varOneIndex),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0f),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref varTwoIndex),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0f),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref varThreeIndex),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0f),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref varFourIndex),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "CookingChopped")
			}))
			{
				if (val.TryGotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
					(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "CookingChopped"),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(CharacterBody), "HasBuff")
				}))
				{
					val.MoveAfterLabels();
					val.Emit(OpCodes.Ldarg_1);
					val.EmitDelegate<Func<DamageReport, bool>>((Func<DamageReport, bool>)delegate(DamageReport damageReport)
					{
						CharacterBody victimBody = damageReport.victimBody;
						return Object.op_Implicit((Object)(object)victimBody) && victimBody.HasBuff(BuffDef);
					});
					ILLabel val2 = val.MarkLabel();
					val.Emit(OpCodes.Brfalse, (object)val2);
					val.Emit(OpCodes.Ldloc, varOneIndex);
					val.EmitDelegate<Func<float, float>>((Func<float, float>)((float num) => num + 1f));
					val.Emit(OpCodes.Stloc, varOneIndex);
					val.Emit(OpCodes.Ldloc, varTwoIndex);
					val.EmitDelegate<Func<float, float>>((Func<float, float>)((float num) => num + 2f));
					val.Emit(OpCodes.Stloc, varTwoIndex);
					val.Emit(OpCodes.Ldloc, varThreeIndex);
					val.EmitDelegate<Func<float, float>>((Func<float, float>)((float num) => num + 0.04f));
					val.Emit(OpCodes.Stloc, varThreeIndex);
					val.Emit(OpCodes.Ldloc, varFourIndex);
					val.EmitDelegate<Func<float, float>>((Func<float, float>)((float num) => num + 0.75f));
					val.Emit(OpCodes.Stloc, varFourIndex);
					val.MarkLabel(val2);
				}
				else
				{
					Log.Error(((Object)BuffDef).name + " failed to ILHook #2");
				}
			}
			else
			{
				Log.Error(((Object)BuffDef).name + " failed to ILHook #1");
			}
		}
	}
	public class CookingBuff : BuffBase
	{
		public static BuffDef BuffDef;

		protected override string Name => "ChefCooking";

		protected override bool IsHidden => true;

		protected override void Initialize()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			BuffDef = Value;
			GlobalEventManager.ProcessHitEnemy += new hook_ProcessHitEnemy(GlobalEventManager_ProcessHitEnemy);
		}

		private void GlobalEventManager_ProcessHitEnemy(orig_ProcessHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			orig.Invoke(self, damageInfo, victim);
			CharacterBody val = (Object.op_Implicit((Object)(object)victim) ? victim.GetComponent<CharacterBody>() : null);
			CharacterBody val2 = (Object.op_Implicit((Object)(object)damageInfo.attacker) ? damageInfo.attacker.GetComponent<CharacterBody>() : null);
			CharacterMaster val3 = (Object.op_Implicit((Object)(object)val2) ? val2.master : null);
			if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val) && val2.HasBuff(BuffDef))
			{
				val.AddBuff(CookedBuff.BuffDef);
			}
		}
	}
	public class DamageOnBleedBuff : BuffBase
	{
		private static Material ActiveOverlay;

		public static BuffDef BuffDef;

		protected override string Name => "DamageOnBleed";

		protected override Sprite IconSprite => ChefOverCookedPlugin.Bundle.LoadAsset<Sprite>("texDamageOnBleed");

		protected override Color Color => new Color(0.91f, 0.506f, 0.239f);

		protected override bool IsHidden => false;

		protected override bool IsStackable => true;

		protected override void Initialize()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			BuffDef = Value;
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
			CharacterBody.AddTimedBuff_BuffDef_float += new hook_AddTimedBuff_BuffDef_float(CharacterBody_AddTimedBuff_BuffDef_float);
			GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy);
			CharacterModel.UpdateOverlays += new Manipulator(CharacterModel_UpdateOverlays);
			CharacterModel.UpdateOverlayStates += new Manipulator(CharacterModel_UpdateOverlayStates);
			CreateOverlay();
		}

		private void CreateOverlay()
		{
			//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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = Addressables.LoadAssetAsync<Texture2D>((object)RoR2_Base_Common_ColorRamps.texRampDroneFire_png).WaitForCompletion();
			ActiveOverlay = new Material(Addressables.LoadAssetAsync<Material>((object)RoR2_DLC2_Chef_Buffs.matChefOiledDebuffOverlay_mat).WaitForCompletion());
			ActiveOverlay.SetInt("_SrcBlend", 1);
			ActiveOverlay.SetInt("_DstBlend", 1);
			ActiveOverlay.SetFloat("_FresnelPower", 0.8f);
			ActiveOverlay.SetFloat("_AlphaBoost", 0.5f);
			ActiveOverlay.SetFloat("_AlphaBias", 1f);
			ActiveOverlay.SetColor("_TintColor", new Color(1f, 0.439f, 0f));
			ActiveOverlay.SetTexture("_RemapTex", (Texture)(object)val);
		}

		private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			args.baseDamageAdd += (float)sender.GetBuffCount(BuffDef) * PluginConfig.Claw_Damage_Stack.Value / 100f;
		}

		private void CharacterBody_AddTimedBuff_BuffDef_float(orig_AddTimedBuff_BuffDef_float orig, CharacterBody self, BuffDef buffDef, float duration)
		{
			//IL_007c: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && (Object)(object)buffDef == (Object)(object)BuffDef)
			{
				int num = (Object.op_Implicit((Object)(object)self.inventory) ? self.inventory.GetItemCountEffective(PrimitiveClawsItem.ItemDef) : 0);
				int num2 = PluginConfig.Claw_Stack_Cap.Value + PluginConfig.Claw_Stack_Increase.Value * (num - 1);
				int num3 = 0;
				int num4 = -1;
				float num5 = 999f;
				for (int i = 0; i < self.timedBuffs.Count; i++)
				{
					TimedBuff val = self.timedBuffs[i];
					if (val.buffIndex == BuffDef.buffIndex)
					{
						num3++;
						if (val.timer < num5)
						{
							num4 = i;
							num5 = val.timer;
						}
					}
				}
				if (num3 < num2)
				{
					self.timedBuffs.Add(new TimedBuff
					{
						buffIndex = BuffDef.buffIndex,
						timer = duration,
						totalDuration = duration
					});
					self.AddBuff(buffDef.buffIndex);
				}
				else if (num4 != -1)
				{
					self.timedBuffs[num4].timer = duration;
					self.timedBuffs[num4].totalDuration = duration;
				}
			}
			else
			{
				orig.Invoke(self, buffDef, duration);
			}
		}

		private void GlobalEventManager_ProcessHitEnemy(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0101: 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>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(DamageInfo), "procCoefficient"),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(CharacterBody), "get_bleedChance")
			}))
			{
				if (val.TryGotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(DamageInfo), "procChainMask"),
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num)
				}))
				{
					val.MoveAfterLabels();
					val.Emit(OpCodes.Ldarg_1);
					val.EmitDelegate<Action<DamageInfo>>((Action<DamageInfo>)delegate(DamageInfo report)
					{
						CharacterBody val2 = (Object.op_Implicit((Object)(object)report.attacker) ? report.attacker.GetComponent<CharacterBody>() : null);
						num = (Object.op_Implicit((Object)(object)val2.inventory) ? val2.inventory.GetItemCountEffective(PrimitiveClawsItem.ItemDef) : 0);
						if (num > 0)
						{
							val2.AddTimedBuff(BuffDef, 3f * report.procCoefficient);
						}
					});
				}
				else
				{
					Log.Error(((Object)BuffDef).name + "_PROCESSHITENEMY failed to ILHook #2");
				}
			}
			else
			{
				Log.Error(((Object)BuffDef).name + "_PROCESSHITENEMY failed to ILHook #1");
			}
		}

		private void CharacterModel_UpdateOverlays(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0087: 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.MatchLdfld(x, typeof(CharacterModel), "body"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "ClayGoo")
			}))
			{
				val.MoveAfterLabels();
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<CharacterModel>>((Action<CharacterModel>)delegate(CharacterModel model)
				{
					if (model.body.GetBuffCount(BuffDef) > 0)
					{
						OverlayHelper.AddOverlay(model, ActiveOverlay);
					}
				});
			}
			else
			{
				Log.Error(((Object)BuffDef).name + "_UPDATEOVERLAYS failed to ILHook");
			}
		}

		private void CharacterModel_UpdateOverlayStates(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int incrementIndex = -1;
			if (val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref incrementIndex),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, incrementIndex)
			}) && incrementIndex != -1)
			{
				if (!val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, incrementIndex)
				}))
				{
					return;
				}
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldloc, incrementIndex);
				val.EmitDelegate<Func<CharacterModel, int, int>>((Func<CharacterModel, int, int>)delegate(CharacterModel model, int index)
				{
					if (model.body.HasBuff(BuffDef))
					{
						model.activeOverlays |= 1 << index;
					}
					return index++;
				});
				val.Emit(OpCodes.Stloc, incrementIndex);
			}
			else
			{
				Log.Error(((Object)BuffDef).name + "_UPDATEOVERLAYSTATES failed to ILHook #1");
			}
		}
	}
	public class MeatTimerBuff : BuffBase
	{
		public static BuffDef BuffDef;

		protected override string Name => "MeatTimerBuff";

		protected override bool IsHidden => true;

		protected override bool IsStackable => false;

		protected override void Initialize()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			BuffDef = Value;
			CharacterBody.OnBuffFinalStackLost += new hook_OnBuffFinalStackLost(CharacterBody_OnBuffFinalStackLost);
		}

		private void CharacterBody_OnBuffFinalStackLost(orig_OnBuffFinalStackLost orig, CharacterBody self, BuffDef buffDef)
		{
			if ((Object)(object)buffDef != (Object)(object)BuffDef)
			{
				orig.Invoke(self, buffDef);
			}
			bool flag = self.HasBuff(BuffDef);
			bool flag2 = Object.op_Implicit((Object)(object)self.inventory) && self.inventory.GetItemCountEffective(MonsterMeatItem.ItemDef) > 0;
			bool flag3 = Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)((Component)self).GetComponent<ChefController>());
			if (!flag && flag2 && flag3)
			{
				EntityStateMachine.FindByCustomName(((Component)self).gameObject, "Weapon").SetState((EntityState)(object)new CookingState());
			}
			orig.Invoke(self, buffDef);
		}
	}
	public class SpectralBuff : BuffBase
	{
		private static Material ActiveOverlayOne;

		private static Material ActiveOverlayTwo;

		private static Material ActiveOverlayThree;

		public static BuffDef BuffDef;

		protected override string Name => "Spectral";

		protected override bool IsStackable => true;

		protected override void Initialize()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			BuffDef = Value;
			CharacterModel.UpdateOverlays += new Manipulator(CharacterModel_UpdateOverlays_ActiveOne);
			CharacterModel.UpdateOverlayStates += new Manipulator(CharacterModel_UpdateOverlayStates_ActiveOne);
			CharacterModel.UpdateOverlays += new Manipulator(CharacterModel_UpdateOverlays_ActiveTwo);
			CharacterModel.UpdateOverlayStates += new Manipulator(CharacterModel_UpdateOverlayStates_ActiveTwo);
			CharacterModel.UpdateOverlays += new Manipulator(CharacterModel_UpdateOverlays_ActiveThree);
			CharacterModel.UpdateOverlayStates += new Manipulator(CharacterModel_UpdateOverlayStates_ActiveThree);
			CharacterModel.UpdateOverlays += new hook_UpdateOverlays(OnCharacterModel_UpdateOverlays);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
			CreateOverlay();
		}

		private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			args.baseDamageAdd += (float)Math.Max(0, sender.GetBuffCount(BuffDef) - 1) * PluginConfig.Kebab_Lem_Damage.Value / 100f;
		}

		private void OnCharacterModel_UpdateOverlays(orig_UpdateOverlays orig, CharacterModel self)
		{
			orig.Invoke(self);
			if (self.body.HasBuff(BuffDef))
			{
				self.visibility = (VisibilityLevel)3;
			}
		}

		private void CreateOverlay()
		{
			//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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			ActiveOverlayOne = new Material(Addressables.LoadAssetAsync<Material>((object)RoR2_DLC3_Items_WyrmOnHit.matWyrmProjectile1_mat).WaitForCompletion());
			ActiveOverlayTwo = new Material(Addressables.LoadAssetAsync<Material>((object)RoR2_DLC3_Items_WyrmOnHit.matWyrmProjectile2_mat).WaitForCompletion());
			ActiveOverlayThree = new Material(Addressables.LoadAssetAsync<Material>((object)RoR2_DLC3_Items_WyrmOnHit.matWyrmProjectile3_mat).WaitForCompletion());
		}

		private void CharacterModel_UpdateOverlays_ActiveOne(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0087: 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.MatchLdfld(x, typeof(CharacterModel), "body"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "ClayGoo")
			}))
			{
				val.MoveAfterLabels();
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<CharacterModel>>((Action<CharacterModel>)delegate(CharacterModel model)
				{
					if (model.body.GetBuffCount(BuffDef) > 0)
					{
						OverlayHelper.AddOverlay(model, ActiveOverlayOne);
					}
				});
			}
			else
			{
				Log.Error(((Object)BuffDef).name + "_UPDATEOVERLAYS failed to ILHook");
			}
		}

		private void CharacterModel_UpdateOverlayStates_ActiveOne(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int incrementIndex = -1;
			if (val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref incrementIndex),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, incrementIndex)
			}) && incrementIndex != -1)
			{
				if (!val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, incrementIndex)
				}))
				{
					return;
				}
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldloc, incrementIndex);
				val.EmitDelegate<Func<CharacterModel, int, int>>((Func<CharacterModel, int, int>)delegate(CharacterModel model, int index)
				{
					if (model.body.HasBuff(BuffDef))
					{
						model.activeOverlays |= 1 << index;
					}
					return index++;
				});
				val.Emit(OpCodes.Stloc, incrementIndex);
			}
			else
			{
				Log.Error(((Object)BuffDef).name + "_UPDATEOVERLAYSTATES failed to ILHook #1");
			}
		}

		private void CharacterModel_UpdateOverlays_ActiveTwo(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0087: 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.MatchLdfld(x, typeof(CharacterModel), "body"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "ClayGoo")
			}))
			{
				val.MoveAfterLabels();
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<CharacterModel>>((Action<CharacterModel>)delegate(CharacterModel model)
				{
					if (model.body.GetBuffCount(BuffDef) > 0)
					{
						OverlayHelper.AddOverlay(model, ActiveOverlayTwo);
					}
				});
			}
			else
			{
				Log.Error(((Object)BuffDef).name + "_UPDATEOVERLAYS failed to ILHook");
			}
		}

		private void CharacterModel_UpdateOverlayStates_ActiveTwo(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int incrementIndex = -1;
			if (val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref incrementIndex),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, incrementIndex)
			}) && incrementIndex != -1)
			{
				if (!val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, incrementIndex)
				}))
				{
					return;
				}
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldloc, incrementIndex);
				val.EmitDelegate<Func<CharacterModel, int, int>>((Func<CharacterModel, int, int>)delegate(CharacterModel model, int index)
				{
					if (model.body.HasBuff(BuffDef))
					{
						model.activeOverlays |= 1 << index;
					}
					return index++;
				});
				val.Emit(OpCodes.Stloc, incrementIndex);
			}
			else
			{
				Log.Error(((Object)BuffDef).name + "_UPDATEOVERLAYSTATES failed to ILHook #1");
			}
		}

		private void CharacterModel_UpdateOverlays_ActiveThree(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0087: 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.MatchLdfld(x, typeof(CharacterModel), "body"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "ClayGoo")
			}))
			{
				val.MoveAfterLabels();
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<CharacterModel>>((Action<CharacterModel>)delegate(CharacterModel model)
				{
					if (model.body.GetBuffCount(BuffDef) > 0)
					{
						OverlayHelper.AddOverlay(model, ActiveOverlayThree);
					}
				});
			}
			else
			{
				Log.Error(((Object)BuffDef).name + "_UPDATEOVERLAYS failed to ILHook");
			}
		}

		private void CharacterModel_UpdateOverlayStates_ActiveThree(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int incrementIndex = -1;
			if (val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref incrementIndex),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, incrementIndex)
			}) && incrementIndex != -1)
			{
				if (!val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, incrementIndex)
				}))
				{
					return;
				}
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldloc, incrementIndex);
				val.EmitDelegate<Func<CharacterModel, int, int>>((Func<CharacterModel, int, int>)delegate(CharacterModel model, int index)
				{
					if (model.body.HasBuff(BuffDef))
					{
						model.activeOverlays |= 1 << index;
					}
					return index++;
				});
				val.Emit(OpCodes.Stloc, incrementIndex);
			}
			else
			{
				Log.Error(((Object)BuffDef).name + "_UPDATEOVERLAYSTATES failed to ILHook #1");
			}
		}
	}
	public class CookDamageType
	{
		public class MeatTolerance : MonoBehaviour
		{
			private CharacterBody LastAttacker;

			private float Duration;

			public CharacterBody GetAttacker()
			{
				return LastAttacker;
			}

			public void SetAttacker(CharacterBody attacker)
			{
				LastAttacker = attacker;
				Duration = PluginConfig.Execute_Leniency.Value;
			}

			public void Awake()
			{
				Duration = PluginConfig.Execute_Leniency.Value;
			}

			public void FixedUpdate()
			{
				Duration -= Time.fixedDeltaTime;
				if (Duration < 0f)
				{
					Object.Destroy((Object)(object)this);
				}
			}
		}

		public class MeatOrb : ItemTransferOrb
		{
			private static GameObject MeatEffect;

			private CharacterBody chefBody;

			public float speed;

			public static void CreatePrefab()
			{
				//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_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				MeatEffect = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Common_VFX.ItemTransferOrbEffect_prefab).WaitForCompletion(), "MeatOrbEffect");
				GameObject val = Object.Instantiate<GameObject>(ChefOverCookedPlugin.Bundle.LoadAsset<GameObject>("monsterMeatModel"), MeatEffect.transform);
				GameObject gameObject = ((Component)val.transform.Find("mdlMeat")).gameObject;
				Transform transform = gameObject.transform;
				transform.localScale *= 0.3f;
				gameObject.AddComponent<MeatSpin>();
				((Component)MeatEffect.transform.Find("BillboardBase")).gameObject.SetActive(false);
				((Component)MeatEffect.transform.Find("Trail Parent")).gameObject.SetActive(false);
				ContentAddition.AddEffect(MeatEffect);
			}

			public override void Begin()
			{
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: 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_0074: 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_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Expected I4, but got Unknown
				//IL_0092: Expected O, but got Unknown
				chefBody = (Object.op_Implicit((Object)(object)((Orb)this).target.healthComponent) ? ((Orb)this).target.healthComponent.body : null);
				((Orb)this).duration = Random.Range(1f, 1.5f);
				if (Object.op_Implicit((Object)(object)((Orb)this).target) || Object.op_Implicit((Object)(object)base.orbEffectTargetObjectOverride))
				{
					EffectData val = new EffectData
					{
						origin = ((Orb)this).origin,
						genericFloat = ((Orb)this).duration,
						genericUInt = Util.IntToUintPlusOne((int)base.itemIndex)
					};
					if (Object.op_Implicit((Object)(object)base.orbEffectTargetObjectOverride))
					{
						val.SetNetworkedObjectReference(((Component)base.orbEffectTargetObjectOverride).gameObject);
					}
					else
					{
						val.SetHurtBoxReference(((Orb)this).target);
					}
					EffectManager.SpawnEffect(MeatEffect, val, true);
				}
			}

			public override void OnArrival()
			{
				//IL_0020: 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_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				((ItemTransferOrb)this).OnArrival();
				if (!Object.op_Implicit((Object)(object)chefBody))
				{
					return;
				}
				EffectManager.SimpleSoundEffect(AllSounds.Play_Meat_Pickup.index, chefBody.corePosition, true);
				CharacterMaster master = chefBody.master;
				object obj;
				if (master == null)
				{
					obj = null;
				}
				else
				{
					PlayerCharacterMasterController playerCharacterMasterController = master.playerCharacterMasterController;
					if (playerCharacterMasterController == null)
					{
						obj = null;
					}
					else
					{
						NetworkUser networkUser = playerCharacterMasterController.networkUser;
						if (networkUser == null)
						{
							obj = null;
						}
						else
						{
							LocalUser localUser = networkUser.localUser;
							obj = ((localUser != null) ? localUser.userProfile : null);
						}
					}
				}
				UserProfile val = (UserProfile)obj;
				if (val != null)
				{
					val.DiscoverPickup(PickupCatalog.FindPickupIndex(MonsterMeatItem.ItemDef.itemIndex));
				}
				chefBody.AddTimedBuff(MeatTimerBuff.BuffDef, 1.75f);
			}
		}

		public class MeatSpin : MonoBehaviour
		{
			private Vector3 randomAxis;

			private float randomSpeed;

			public void Awake()
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				randomAxis = Random.onUnitSphere;
				randomSpeed = Random.Range(200f, 360f);
			}

			public void FixedUpdate()
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: 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)
				((Component)this).transform.Rotate(randomAxis * randomSpeed * Time.fixedDeltaTime, (Space)1);
			}
		}

		public static ModdedDamageType DamageType;

		public CookDamageType()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			DamageType = DamageAPI.ReserveDamageType();
			ItemDef.AttemptGrant += new Manipulator(ItemDef_AttemptGrant);
			HealthBar.UpdateBarInfos += new Manipulator(HealthBar_UpdateBarInfos);
			HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess);
			GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal;
			GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
			MeatOrb.CreatePrefab();
		}

		private void ItemDef_AttemptGrant(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: 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)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel breakState = null;
			int pickupDefIndex = -1;
			int duplicateIndex = -1;
			val.TryGotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(PickupDef), "itemIndex"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref pickupDefIndex)
			});
			val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "Duplicator"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(Inventory), "GetItemCountEffective"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref duplicateIndex)
			});
			int num = default(int);
			if (pickupDefIndex == -1 || duplicateIndex == -1 || !val.TryGotoNext(new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCgt(x),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchAnd(x),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref breakState)
			}) || breakState == null)
			{
				return;
			}
			val.MoveAfterLabels();
			val.Emit(OpCodes.Ldarg_0);
			val.Emit(OpCodes.Ldobj, typeof(GrantContext));
			val.Emit(OpCodes.Ldloc, pickupDefIndex);
			val.Emit(OpCodes.Ldloc, duplicateIndex);
			val.EmitDelegate<Action<GrantContext, ItemIndex, int>>((Action<GrantContext, ItemIndex, int>)delegate(GrantContext context, ItemIndex itemIndex, int itemCount)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//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_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: 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_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_004d: Expected O, but got Unknown
				//IL_0060: 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)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				bool flag = !context.controller.Duplicated;
				CharacterBody body = context.body;
				if (itemCount > 0 && flag)
				{
					EffectData val2 = new EffectData
					{
						origin = body.corePosition,
						start = body.corePosition,
						scale = body.radius
					};
					EffectManager.SpawnEffect(CommonAssets.duplicatorPrefab, val2, true);
					body.inventory.GiveItemTemp(itemIndex, context.controller.pickup.decayValue);
				}
			});
			val.Emit(OpCodes.Br, (object)breakState);
		}

		private void HealthBar_UpdateBarInfos(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int cullIndex = -1;
			int num = default(int);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(HealthBarValues), "cullFraction"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref cullIndex)
			}) && cullIndex != -1)
			{
				if (val.TryGotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdflda(x, typeof(HealthBar), "barInfoCollection"),
					(Instruction x) => ILPatternMatchingExt.MatchLdflda(x, typeof(BarInfoCollection), "cullBarInfo")
				}))
				{
					val.MoveAfterLabels();
					val.Emit(OpCodes.Ldarg_0);
					val.Emit(OpCodes.Ldloc, cullIndex);
					val.EmitDelegate<Func<HealthBar, float, float>>((Func<HealthBar, float, float>)delegate(HealthBar self, float cull)
					{
						//IL_003d: Unknown result type (might be due to invalid IL or missing references)
						//IL_0044: Unknown result type (might be due to invalid IL or missing references)
						//IL_0046: Invalid comparison between Unknown and I4
						CharacterBody val2 = (Object.op_Implicit((Object)(object)self.source) ? self.source.body : null);
						CharacterBody viewerBody = self.viewerBody;
						if ((Object)(object)val2 != (Object)null && (Object)(object)viewerBody != (Object)null)
						{
							bool flag = (val2.bodyFlags & 0x10) > 0;
							bool flag2 = Object.op_Implicit((Object)(object)((Component)viewerBody).GetComponent<ChefController>());
							if (!flag && flag2)
							{
								SkillLocator skillLocator = viewerBody.skillLocator;
								object obj;
								if (skillLocator == null)
								{
									obj = null;
								}
								else
								{
									GenericSkill special = skillLocator.special;
									obj = ((special != null) ? special.skillDef : null);
								}
								SkillDef val3 = (SkillDef)obj;
								if (Object.op_Implicit((Object)(object)val3) && (Object)(object)val3 == (Object)(object)SpecialCookSkill.SkillDef)
								{
									cull = Math.Max(cull, PluginConfig.Execute_Threshold.Value);
								}
							}
						}
						return cull;
					});
					val.Emit(OpCodes.Stloc, cullIndex);
				}
				else
				{
					Log.Error("COOKDAMAGETYPE_UPDATEBARINFOS failed to ILHook #2");
				}
			}
			else
			{
				Log.Error("COOKDAMAGETYPE_UPDATEBARINFOS failed to ILHook #1");
			}
		}

		private void HealthComponent_TakeDamageProcess(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: 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)
			ILCursor val = new ILCursor(il);
			int executeIndex = -1;
			int num = default(int);
			if (val.TryGotoNext(new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref executeIndex),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(HealthComponent), "body"),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(CharacterBody), "bodyFlags"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num)
			}) && executeIndex != -1)
			{
				ILLabel val2 = default(ILLabel);
				if (val.TryGotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchCall(x, typeof(HealthComponent), "get_isInFrozenState"),
					(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2)
				}))
				{
					val.MoveAfterLabels();
					val.Emit(OpCodes.Ldarg_0);
					val.Emit(OpCodes.Ldarg_1);
					val.Emit(OpCodes.Ldloc, executeIndex);
					val.EmitDelegate<Func<HealthComponent, DamageInfo, float, float>>((Func<HealthComponent, DamageInfo, float, float>)delegate(HealthComponent self, DamageInfo damageInfo, float damagePercent)
					{
						//IL_0002: Unknown result type (might be due to invalid IL or missing references)
						if (DamageAPI.HasModdedDamageType(damageInfo, DamageType) && damagePercent <= PluginConfig.Execute_Threshold.Value)
						{
							damagePercent = PluginConfig.Execute_Threshold.Value;
						}
						return damagePercent;
					});
					val.Emit(OpCodes.Stloc, executeIndex);
				}
				else
				{
					Log.Error("COOK_DAMAGE_TYPE_TAKEDAMAGEPROCESS failed to ILHook #2");
				}
			}
			else
			{
				Log.Error("COOKDAMAGETYPE_TAKEDAMAGEPROCESS failed to ILHook #1");
			}
		}

		private void GlobalEventManager_onCharacterDeathGlobal(DamageReport report)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody attackerBody = report.attackerBody;
			CharacterBody victimBody = report.victimBody;
			DamageInfo damageInfo = report.damageInfo;
			if ((Object)(object)attackerBody != (Object)null && (Object)(object)victimBody != (Object)null && damageInfo != null)
			{
				bool flag = DamageAPI.HasModdedDamageType(report.damageInfo, DamageType);
				bool flag2 = Object.op_Implicit((Object)(object)((Component)victimBody).GetComponent<MeatTolerance>());
				if (flag || flag2)
				{
					attackerBody = (flag2 ? ((Component)victimBody).GetComponent<MeatTolerance>().GetAttacker() : attackerBody);
					MeatOrb meatOrb = new MeatOrb
					{
						stack = 1,
						origin = victimBody.corePosition,
						target = attackerBody.mainHurtBox,
						itemIndex = MonsterMeatItem.ItemDef.itemIndex,
						inventoryToGrantTo = attackerBody.inventory
					};
					OrbManager.instance.AddOrb((Orb)(object)meatOrb);
				}
			}
		}

		private void GlobalEventManager_onServerDamageDealt(DamageReport report)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody attackerBody = report.attackerBody;
			CharacterBody victimBody = report.victimBody;
			DamageInfo damageInfo = report.damageInfo;
			if ((Object)(object)attackerBody != (Object)null && (Object)(object)victimBody != (Object)null && damageInfo != null && DamageAPI.HasModdedDamageType(report.damageInfo, DamageType))
			{
				(((Component)victimBody).GetComponent<MeatTolerance>() ?? ((Component)victimBody).gameObject.AddComponent<MeatTolerance>())?.SetAttacker(attackerBody);
			}
		}
	}
	public class CookingState : GenericCharacterMain
	{
		private class MealWeight(ItemDef itemDef)
		{
			public ItemDef itemDef = itemDef;

			public int GetFrequency()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Invalid comparison between Unknown and I4
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: 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)
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				if ((int)itemDef.tier != 10)
				{
					return (int)Mathf.Pow((float)NumFromTier(PickupCatalog.FindPickupIndex(itemDef.itemIndex)), 1f / Mathf.Log10(4f));
				}
				RecipeEntry[] array = CraftableCatalog.FindAllRelatedRecipes(PickupCatalog.FindPickupIndex(itemDef.itemIndex));
				float num = 0f;
				RecipeEntry[] array2 = array;
				foreach (RecipeEntry val in array2)
				{
					foreach (PickupIndex allPickup in val.GetAllPickups())
					{
						num = ((num == 0f) ? ((float)NumFromTier(allPickup)) : ((num + (float)NumFromTier(allPickup)) / 2f));
					}
				}
				return (int)Mathf.Pow(num, 1f / Mathf.Log10(4f));
			}

			private int NumFromTier(PickupIndex pickupIndex)
			{
				//IL_0003: 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_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Expected I4, but got Unknown
				ItemDef val = ItemCatalog.GetItemDef(((PickupIndex)(ref pickupIndex)).itemIndex);
				if (Object.op_Implicit((Object)(object)val))
				{
					ItemTier tier = val.tier;
					if (1 == 0)
					{
					}
					int result = (tier - 1) switch
					{
						0 => 3, 
						1 => 2, 
						3 => 1, 
						_ => 4, 
					};
					if (1 == 0)
					{
					}
					return result;
				}
				return 4;
			}
		}

		private static List<MealWeight> RunMealItemDefs;

		private static List<ItemDef> WeightedMealItemDefs;

		private bool hasPlayedSound;

		private bool hasPlayedAnim;

		public static void CreateEffects()
		{
			Run.onRunStartGlobal += Run_onRunStartGlobal;
		}

		private static void Run_onRunStartGlobal(Run instance)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Invalid comparison between Unknown and I4
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Invalid comparison between Unknown and I4
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Invalid comparison between Unknown and I4
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Invalid comparison between Unknown and I4
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Invalid comparison between Unknown and I4
			PluginConfig.ItemOptions value = PluginConfig.FoodDrops.Value;
			bool flag = instance.IsExpansionEnabled(ChefOverCookedPlugin.AlloyedCollective);
			RunMealItemDefs = new List<MealWeight>();
			WeightedMealItemDefs = new List<ItemDef>();
			if (value == PluginConfig.ItemOptions.Ingredients || !flag)
			{
				Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						ItemDef current = enumerator.Current;
						if (!((Object)(object)current == (Object)null) && instance.IsItemAvailable(current.itemIndex) && !current.DoesNotContainTag((ItemTag)28))
						{
							ItemTier tier = current.tier;
							ItemTier val = tier;
							if ((int)val <= 2 || (int)val == 4)
							{
								RunMealItemDefs.Add(new MealWeight(current));
							}
						}
					}
				}
				finally
				{
					((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
				}
			}
			else if (value == PluginConfig.ItemOptions.FoodTier)
			{
				Enumerator<ItemDef> enumerator2 = ItemCatalog.allItemDefs.GetEnumerator();
				try
				{
					while (enumerator2.MoveNext())
					{
						ItemDef current2 = enumerator2.Current;
						if (!((Object)(object)current2 == (Object)null) && instance.IsItemAvailable(current2.itemIndex) && (int)current2.tier == 10 && !((Object)(object)current2 == (Object)(object)MonsterMeatItem.ItemDef))
						{
							RunMealItemDefs.Add(new MealWeight(current2));
						}
					}
				}
				finally
				{
					((IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose();
				}
			}
			else
			{
				Enumerator<ItemDef> enumerator3 = ItemCatalog.allItemDefs.GetEnumerator();
				try
				{
					while (enumerator3.MoveNext())
					{
						ItemDef current3 = enumerator3.Current;
						if ((Object)(object)current3 == (Object)null || !instance.IsItemAvailable(current3.itemIndex) || (Object)(object)current3 == (Object)(object)MonsterMeatItem.ItemDef)
						{
							continue;
						}
						if ((int)current3.tier == 10)
						{
							RunMealItemDefs.Add(new MealWeight(current3));
						}
						else if (current3.ContainsTag((ItemTag)28))
						{
							ItemTier tier2 = current3.tier;
							ItemTier val2 = tier2;
							if ((int)val2 <= 2 || (int)val2 == 4)
							{
								RunMealItemDefs.Add(new MealWeight(current3));
							}
						}
					}
				}
				finally
				{
					((IDisposable)enumerator3/*cast due to .constrained prefix*/).Dispose();
				}
			}
			foreach (MealWeight runMealItemDef in RunMealItemDefs)
			{
				Log.Info($"Cook Item Pool - {((Object)runMealItemDef.itemDef).name} ... {runMealItemDef.GetFrequency()}x");
				for (int i = 0; i < runMealItemDef.GetFrequency(); i++)
				{
					WeightedMealItemDefs.Add(runMealItemDef.itemDef);
				}
			}
		}

		private PickupIndex RandomPickupIndex(CharacterMaster master = null)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: 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_00e6: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)master) || !((EntityState)this).characterBody.isPlayerControlled)
			{
				return PickupCatalog.FindPickupIndex(WeightedMealItemDefs[Random.Range(0, WeightedMealItemDefs.Count)].itemIndex);
			}
			List<PickupIndex> list = default(List<PickupIndex>);
			CollectionPool<PickupIndex, List<PickupIndex>>.RentCollection(ref list);
			NetworkUser networkUser = master.playerCharacterMasterController.networkUser;
			object obj;
			if (networkUser == null)
			{
				obj = null;
			}
			else
			{
				LocalUser localUser = networkUser.localUser;
				obj = ((localUser != null) ? localUser.userProfile : null);
			}
			UserProfile val = (UserProfile)obj;
			foreach (ItemDef weightedMealItemDef in WeightedMealItemDefs)
			{
				PickupIndex val2 = PickupCatalog.FindPickupIndex(weightedMealItemDef.itemIndex);
				if (val != null && val.HasDiscoveredPickup(val2))
				{
					list.Add(val2);
				}
			}
			return (list.Count > 0) ? list[Random.Range(0, list.Count)] : PickupCatalog.FindPickupIndex(Items.ExtraLifeConsumed.itemIndex);
		}

		public override void OnEnter()
		{
			((GenericCharacterMain)this).OnEnter();
			hasPlayedSound = false;
			hasPlayedAnim = false;
		}

		public override void OnExit()
		{
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Invalid comparison between Unknown and I4
			//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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Expected O, but got Unknown
			//IL_0154: 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)
			Inventory inventory = ((EntityState)this).characterBody.inventory;
			int itemCountEffective = inventory.GetItemCountEffective(MonsterMeatItem.ItemDef);
			if (((EntityState)this).characterBody.isPlayerControlled)
			{
				Vector3 forward = ((EntityState)this).GetModelTransform().forward;
				for (int i = 0; i < itemCountEffective; i++)
				{
					Vector3 val = forward * (float)(i + 10);
					((Vector3)(ref val))..ctor(val.x, (float)(12 + i * 2), val.z);
					UniquePickup val2 = new UniquePickup
					{
						pickupIndex = RandomPickupIndex(((EntityState)this).characterBody.master),
						decayValue = PluginConfig.Temp_Duration.Value
					};
					PickupDropletController.CreatePickupDroplet(val2, ((EntityState)this).characterBody.corePosition, val, false, false);
				}
			}
			else
			{
				string baseToken = (((int)((EntityState)this).teamComponent.teamIndex == 1) ? "PLAYER_PICKUP" : "MONSTER_PICKUP");
				for (int j = 0; j < itemCountEffective; j++)
				{
					PickupDef pickupDef = PickupCatalog.GetPickupDef(RandomPickupIndex());
					ItemIndex itemIndex = pickupDef.itemIndex;
					((EntityState)this).characterBody.inventory.GiveItemTemp(itemIndex, PluginConfig.Temp_Duration.Value);
					PlayerPickupChatMessage val3 = new PlayerPickupChatMessage();
					((SubjectChatMessage)val3).subjectAsCharacterBody = ((EntityState)this).characterBody;
					((SubjectChatMessage)val3).baseToken = baseToken;
					val3.pickupQuantity = 1u;
					val3.pickupColor = Color32.op_Implicit(pickupDef.baseColor);
					val3.pickupToken = Language.GetStringFormatted("ITEM_MODIFIER_TEMP", new object[1] { Language.GetStringFormatted(pickupDef.nameToken, Array.Empty<object>()) });
					Chat.SendBroadcastChat((ChatMessageBase)(object)val3);
				}
			}
			inventory.RemoveItemPermanent(MonsterMeatItem.ItemDef, itemCountEffective);
			((GenericCharacterMain)this).OnExit();
		}

		public override void FixedUpdate()
		{
			((GenericCharacterMain)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody.inventory) && ((EntityState)this).characterBody.inventory.GetItemCountEffective(MonsterMeatItem.ItemDef) <= 0)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			if (!hasPlayedAnim)
			{
				hasPlayedAnim = true;
				((EntityState)this).PlayAnimation("Gesture, Override", "FireYesChef", "FireYesChef.playbackRate", 1f, 0f);
			}
			if ((double)((EntityState)this).fixedAge >= 0.25 && !hasPlayedSound)
			{
				hasPlayedSound = true;
				Util.PlaySound("Play_chef_skill4_boost_activate", ((EntityState)this).gameObject);
			}
			if ((double)((EntityState)this).fixedAge >= 1.05 && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)9;
		}
	}
	public class CookState : GenericCharacterMain
	{
		private static EffectDef SpinEffect;

		private static EffectDef SliceEffect;

		private ChefController chefControl;

		private EffectComponent sliceImpact;

		private float setDuration;

		private int attackCount;

		private bool isCrit;

		public static void CreateEffects()
		{
			//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_007c: 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_0095: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_00e1: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Expected O, but got Unknown
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Expected O, but got Unknown
			GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC2_Chef.BoostedRolyPolyGhost_prefab).WaitForCompletion(), "CookSpinEffect");
			EffectComponent val2 = val.AddComponent<EffectComponent>();
			DestroyOnTimer component = val.GetComponent<DestroyOnTimer>();
			((Behaviour)component).enabled = true;
			component.duration = Math.Max(0.5f, PluginConfig.Attack_Rate.Value / (float)PluginConfig.Attack_Instances.Value);
			val2.parentToReferencedTransform = true;
			val2.positionAtReferencedTransform = true;
			val.AddComponent<VFXAttributes>();
			Object.Destroy((Object)(object)val.GetComponent<ProjectileGhostController>());
			Vector3 val3 = Vector3.one * 0.75f * PluginConfig.Radius.Value / 2f;
			((Vector3)(ref val3))..ctor(val3.x, val3.y, Mathf.Sqrt(val3.z));
			foreach (Transform componentInChild in val.GetComponentInChildren<Transform>())
			{
				Transform val4 = componentInChild;
				val4.localScale = val3;
			}
			SpinEffect = new EffectDef
			{
				prefab = val,
				prefabName = "CookSpinEffect",
				prefabEffectComponent = val2
			};
			GameObject val5 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Saw.OmniImpactVFXSawmerang_prefab).WaitForCompletion(), "CookSliceImpact");
			EffectComponent component2 = val5.GetComponent<EffectComponent>();
			Object.Destroy((Object)(object)((Component)val5.transform.Find("Scaled Hitspark 4, Directional (Random Color)")).gameObject);
			Object.Destroy((Object)(object)((Component)val5.transform.Find("Scaled Hitspark 3, Radial (Random Color)")).gameObject);
			Object.Destroy((Object)(object)((Component)val5.transform.Find("Dash, Bright")).gameObject);
			SliceEffect = new EffectDef
			{
				prefab = val5,
				prefabName = "CookSliceImpact",
				prefabEffectComponent = component2
			};
			ContentAddition.AddEffect(SpinEffect.prefab);
			ContentAddition.AddEffect(SliceEffect.prefab);
		}

		public override void OnEnter()
		{
			((GenericCharacterMain)this).OnEnter();
			chefControl = ((Component)((EntityState)this).characterBody).GetComponent<ChefController>();
			sliceImpact = SliceEffect.prefab.GetComponent<EffectComponent>();
			isCrit = Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master);
			chefControl.blockOtherSkills = true;
			setDuration = PluginConfig.Attack_Rate.Value / (float)PluginConfig.Attack_Instances.Value;
			attackCount = 0;
			Util.PlaySound("Play_chef_skill3_boosted_active_loop", ((EntityState)this).gameObject);
			((EntityState)this).PlayAnimation("Body", "BoostedRolyPoly", "FireRolyPoly.playbackRate", PluginConfig.Attack_Rate.Value, 0f);
			((EntityState)this).GetModelAnimator().SetBool("isInBoostedRolyPoly", true);
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(CookingBuff.BuffDef);
			}
		}

		public override void FixedUpdate()
		{
			((GenericCharacterMain)this).FixedUpdate();
			if ((Object)(object)chefControl == (Object)null)
			{
				return;
			}
			SlashEffectSpawn();
			((EntityState)this).characterBody.AddTimedBuff(MeatTimerBuff.BuffDef, 0.1f);
			setDuration -= ((EntityState)this).GetDeltaTime();
			if (setDuration <= 0f)
			{
				setDuration = PluginConfig.Attack_Rate.Value / (float)PluginConfig.Attack_Instances.Value;
				attackCount++;
				AreaSlash();
			}
			if (attackCount > PluginConfig.Attack_Instances.Value && ((EntityState)this).isAuthority)
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody.inventory) && ((EntityState)this).characterBody.inventory.GetItemCount(MonsterMeatItem.ItemDef) > 0)
				{
					((EntityState)this).characterBody.AddTimedBuff(MeatTimerBuff.BuffDef, 2f);
				}
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			chefControl.blockOtherSkills = false;
			Util.PlaySound("Stop_chef_skill3_boosted_active_loop", ((EntityState)this).gameObject);
			((EntityState)this).GetModelAnimator().SetBool("isInBoostedRolyPoly", false);
			((EntityState)this).PlayCrossfade("Body", "ExitRolyPoly", 0.1f);
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(CookingBuff.BuffDef);
			}
			((GenericCharacterMain)this).OnExit();
		}

		private void SlashEffectSpawn()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			EffectManager.SpawnEffect(SpinEffect.prefab, new EffectData
			{
				rootObject = ((EntityState)this).gameObject,
				origin = ((EntityState)this).characterBody.corePosition,
				rotation = Quaternion.identity
			}, true);
		}

		private void AreaSlash()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//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_003e: Unknown result type (might be due to invalid IL or missing references)
			//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_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_0054: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			//IL_00d7: 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)
			if (((EntityState)this).isAuthority)
			{
				BlastAttack val = new BlastAttack
				{
					inflictor = ((EntityState)this).gameObject,
					attacker = ((EntityState)this).gameObject,
					attackerFiltering = (AttackerFiltering)2,
					position = ((EntityState)this).characterBody.corePosition,
					teamIndex = ((BaseState)this).GetTeam(),
					radius = PluginConfig.Radius.Value,
					procCoefficient = PluginConfig.Proc_Coefficient.Value,
					baseDamage = ((BaseState)this).damageStat * (float)PluginConfig.Damage_Coefficient.Value / 100f,
					damageColorIndex = (DamageColorIndex)0,
					damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)32), (DamageTypeExtended)2097152, (DamageSource)8),
					crit = isCrit,
					falloffModel = (FalloffModel)0,
					impactEffect = sliceImpact.effectIndex
				};
				DamageAPI.AddModdedDamageType(val, CookDamageType.DamageType);
				val.Fire();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)7;
		}
	}
	public class BloodCandiedEyeItem : ItemBase
	{
		public static ItemDef ItemDef;

		public static GameObject ProjectilePrefab;

		protected override string Name => "BloodCandiedEye";

		protected override CombinedItemTier Tier => (ItemTier)10;

		protected override ItemTag[] Tags
		{
			get
			{
				ItemTag[] array = new ItemTag[3];
				RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
				return (ItemTag[])(object)array;
			}
		}

		protected override GameObject PickupModelPrefab => ChefOverCookedPlugin.Bundle.LoadAsset<GameObject>("grilledLizardKebabModel");

		protected override string PickupText => "...";

		protected override string Description => StringHelper.FuseText(new List<string>(1) { "..." });

		protected override string DisplayName => "Blood Candied Eye";

		protected override void Initialize()
		{
			ItemDef = Value;
			CreateEffect();
		}

		private static void CreateEffect()
		{
			//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)
			GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_Railgunner.RailgunnerMineAltDetonated_prefab).WaitForCompletion(), "SlowEyeEffect");
			val.GetComponent<BuffWard>().expires = false;
			val.GetComponent<SlowDownProjectiles>().slowDownCoefficient = 0.25f;
			Object.Destroy((Object)(object)val.GetComponent<ProjectileNetworkTransform>());
			ProjectilePrefab = val;
		}

		protected override void LogDisplay()
		{
			ModelPanelParameters val = PickupModelPrefab.AddComponent<ModelPanelParameters>();
			Transform child = PickupModelPrefab.transform.GetChild(0);
			if (Object.op_Implicit((Object)(object)child))
			{
				val.focusPointTransform = child;
				val.cameraPositionTransform = child;
				val.minDistance = 3f;
				val.maxDistance = 12f;
			}
		}
	}
	public class BloodCandiedEyeBehavior : BaseItemBodyBehavior
	{
		private GameObject SlowField;

		[ItemDefAssociation(useOnServer = true, useOnClient = false)]
		public static ItemDef GetItemDef()
		{
			return BloodCandiedEyeItem.ItemDef;
		}

		public void OnEnable()
		{
			SlowField = Object.Instantiate<GameObject>(BloodCandiedEyeItem.ProjectilePrefab, ((BaseItemBodyBehavior)this).body.transform);
		}

		public void FixedUpdate()
		{
		}

		public void OnDisable()
		{
			Object.Destroy((Object)(object)SlowField);
		}
	}
	public class GlowingJellyPastaItem : ItemBase
	{
		public static ItemDef ItemDef;

		private static EffectDef ShockwaveEffect;

		protected override string Name => "GlowingJellyPasta";

		protected override CombinedItemTier Tier => (ItemTier)10;

		protected override ItemTag[] Tags
		{
			get
			{
				ItemTag[] array = new ItemTag[3];
				RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
				return (ItemTag[])(object)array;
			}
		}

		protected override GameObject PickupModelPrefab => ChefOverCookedPlugin.Bundle.LoadAsset<GameObject>("glowingJellyPastaModel");

		protected override Sprite PickupIconSprite => ChefOverCookedPlugin.Bundle.LoadAsset<Sprite>("texGlowingJellyPastaIcon");

		protected override string PickupText => string.Format("Reduce skill cooldowns by {0} second" + "s".OptText(PluginConfig.Jelly_Cooldown_Base.Value > 1f) + ". Activating your Utility skill releases a stunning shockwave. Leaves an electrifying aftertaste.", StringHelper.RoundVal(PluginConfig.Jelly_Cooldown_Base.Value));

		protected override string Description
		{
			get
			{
				List<string> list = new List<string>(2);
				list.Add(string.Format("Reduce " + "skill cooldowns ".Style(HelperFontColor.FontColor.cIsUtility) + "by " + "{0} ".Style(HelperFontColor.FontColor.cIsUtility) + "({1} per stack) ".Style(HelperFontColor.FontColor.cStack) + "second" + "s".OptText(PluginConfig.Jelly_Cooldown_Base.Value > 1f) + ". ", StringHelper.RoundVal(PluginConfig.Jelly_Cooldown_Base.Value), StringHelper.RoundVal(PluginConfig.Jelly_Cooldown_Stack.Value, 1).SignVal()));
				list.Add(string.Format("Activating your " + "Utility Skill ".Style(HelperFontColor.FontColor.cIsUtility) + "releases a shockwave that " + "stuns ".Style(HelperFontColor.FontColor.cIsUtility) + "enemies for " + "{0} ".Style(HelperFontColor.FontColor.cIsUtility) + "seconds.", StringHelper.RoundVal(PluginConfig.Jelly_Stun_Duration.Value)));
				return StringHelper.FuseText(list);
			}
		}

		protected override string DisplayName => "Glowing Jelly Pasta";

		protected override void Initialize()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			ItemDef = Value;
			CreateEffect();
			CharacterBody.OnSkillActivated += new hook_OnSkillActivated(CharacterBody_OnSkillActivated);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
			RecipeCatalogChef.AddRecipe("StunChanceOnHit", "AttackSpeedAndMoveSpeed", Name);
			RecipeCatalogChef.AddRecipe("StunChanceOnHit", "BarrierOnCooldown", Name);
			RecipeCatalogChef.AddRecipe("StunChanceOnHit", "FlatHealth", Name);
			RecipeCatalogChef.AddRecipe("StunChanceOnHit", "HealWhileSafe", Name);
			RecipeCatalogChef.AddRecipe("StunChanceOnHit", "HealingPotion", Name);
			RecipeCatalogChef.AddRecipe("StunChanceOnHit", "Mushroom", Name);
			RecipeCatalogChef.AddRecipe("StunChanceOnHit", "SpeedBoostPickup", Name);
			RecipeCatalogChef.AddRecipe("StunChanceOnHit", "SprintBonus", Name);
			RecipeCatalogChef.AddRecipe("StunChanceOnHit", "Tooth", Name);
		}

		private void CreateEffect()
		{
			//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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC2_FalseSon.FalseSonMeridiansWillVortexVFX_prefab).WaitForCompletion(), "JellyShockwaveEffect");
			val.transform.Find("Distortion").localScale = Vector3.one * PluginConfig.Jelly_Stun_Range.Value / 10f;
			ShockwaveEffect = new EffectDef
			{
				prefab = val,
				prefabName = "JellyShockwaveEffect",
				prefabEffectComponent = val.GetComponent<EffectComponent>()
			};
			ContentAddition.AddEffect(ShockwaveEffect.prefab);
		}

		private void CharacterBody_OnSkillActivated(orig_OnSkillActivated orig, CharacterBody self, GenericSkill skill)
		{
			//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)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)self.inventory) && self.inventory.GetItemCountEffective(ItemDef) > 0 && (Object)(object)self.skillLocator.utility == (Object)(object)skill)
			{
				EffectManager.SimpleEffect(ShockwaveEffect.prefab, self.footPosition, Quaternion.identity, false);
				Util.PlaySound("Play_GG_Item_DroneShockDamage_Activate", ((Component)self).gameObject);
				ShockWave(self);
			}
			orig.Invoke(self, skill);
		}

		private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			int num = (Object.op_Implicit((Object)(object)sender.inventory) ? sender.inventory.GetItemCountEffective(ItemDef) : 0);
			if (num > 0)
			{
				args.cooldownReductionAdd += PluginConfig.Jelly_Cooldown_Base.Value + PluginConfig.Jelly_Cooldown_Stack.Value * (float)(num - 1);
			}
		}

		private void ShockWave(CharacterBody characterBody)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			List<HurtBox> list = default(List<HurtBox>);
			CollectionPool<HurtBox, List<HurtBox>>.RentCollection(ref list);
			SphereSearch val = new SphereSearch
			{
				radius = PluginConfig.Jelly_Stun_Range.Value,
				origin = characterBody.corePosition,
				mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
				queryTriggerInteraction = (QueryTriggerInteraction)0
			};
			val.RefreshCandidates();
			val.FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(characterBody.master.teamIndex));
			val.FilterCandidatesByDistinctHurtBoxEntities();
			val.OrderCandidatesByDistance();
			val.GetHurtBoxes(list);
			val.ClearCandidates();
			foreach (HurtBox item in list)
			{
				CharacterBody val2 = (Object.op_Implicit((Object)(object)item.healthComponent) ? item.healthComponent.body : null);
				SetStateOnHurt val3 = (Object.op_Implicit((Object)(object)val2) ? ((Component)val2).GetComponent<SetStateOnHurt>() : null);
				if (Object.op_Implicit((Object)(object)val3))
				{
					val3.SetStun(PluginConfig.Jelly_Stun_Duration.Value);
				}
			}
		}

		protected override void LogDisplay()
		{
			ModelPanelParameters val = PickupModelPrefab.AddComponent<ModelPanelParameters>();
			Transform child = PickupModelPrefab.transform.GetChild(0);
			if (Object.op_Implicit((Object)(object)child))
			{
				val.focusPointTransform = child;
				val.cameraPositionTransform = child;
				val.minDistance = 3f;
				val.maxDistance = 12f;
			}
		}
	}
	public class GolemEssenceTwistItem : ItemBase
	{
		public static ItemDef ItemDef;

		protected override string Name => "GolemEssenceTwist";

		protected override CombinedItemTier Tier => (ItemTier)10;

		protected override ItemTag[] Tags
		{
			get
			{
				ItemTag[] array = new ItemTag[4];
				RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
				return (ItemTag[])(object)array;
			}
		}

		protected override GameObject PickupModelPrefab => ChefOverCookedPlugin.Bundle.LoadAsset<GameObject>("golemEssenceTwistModel");

		protected override Sprite Pi