Decompiled source of TooManyItems v0.5.7

plugins/TooManyItems.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG;
using LookingGlass.ItemStatsNameSpace;
using On.RoR2;
using On.RoR2.Items;
using On.RoR2.UI.LogBook;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RoR2;
using RoR2.ExpansionManagement;
using RoR2.UI.LogBook;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("TooManyItems")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TooManyItems")]
[assembly: AssemblyTitle("TooManyItems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace TooManyItems;

internal class Integrations
{
	internal static bool lookingGlassEnabled;

	internal static void Init()
	{
		Dictionary<string, PluginInfo> pluginInfos = Chainloader.PluginInfos;
		if (pluginInfos.ContainsKey("droppod.lookingglass"))
		{
			try
			{
				Log.Debug("Running code injection for LookingGlass.");
				LookingGlassIntegration.Init();
				lookingGlassEnabled = true;
			}
			catch (Exception data)
			{
				Log.Error(data);
			}
		}
	}
}
internal static class LookingGlassIntegration
{
	public static class LookingGlassStats
	{
		public static void RegisterStats()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected I4, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Expected O, but got Unknown
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Expected I4, but got Unknown
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Expected O, but got Unknown
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Expected I4, but got Unknown
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Expected O, but got Unknown
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Expected I4, but got Unknown
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Expected O, but got Unknown
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Expected I4, but got Unknown
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b7: Expected O, but got Unknown
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Expected I4, but got Unknown
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Expected O, but got Unknown
			//IL_0443: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Expected I4, but got Unknown
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ed: Expected O, but got Unknown
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Expected I4, but got Unknown
			//IL_056a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Expected O, but got Unknown
			//IL_054b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: Expected I4, but got Unknown
			//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f5: Expected O, but got Unknown
			//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05db: Expected I4, but got Unknown
			//IL_0675: Unknown result type (might be due to invalid IL or missing references)
			//IL_067c: Expected O, but got Unknown
			//IL_0653: Unknown result type (might be due to invalid IL or missing references)
			//IL_065f: Expected I4, but got Unknown
			//IL_0727: Unknown result type (might be due to invalid IL or missing references)
			//IL_072e: Expected O, but got Unknown
			//IL_0708: Unknown result type (might be due to invalid IL or missing references)
			//IL_0714: Expected I4, but got Unknown
			//IL_07ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b2: Expected O, but got Unknown
			//IL_078c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0798: Expected I4, but got Unknown
			//IL_0832: Unknown result type (might be due to invalid IL or missing references)
			//IL_0839: Expected O, but got Unknown
			//IL_0810: Unknown result type (might be due to invalid IL or missing references)
			//IL_081c: Expected I4, but got Unknown
			//IL_0a2a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a31: Expected O, but got Unknown
			//IL_0a08: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a14: Expected I4, but got Unknown
			//IL_0adc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae3: Expected O, but got Unknown
			//IL_0abd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac9: Expected I4, but got Unknown
			//IL_0b60: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b67: Expected O, but got Unknown
			//IL_0b41: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b4d: Expected I4, but got Unknown
			//IL_0be4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0beb: Expected O, but got Unknown
			//IL_0bc5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd1: Expected I4, but got Unknown
			//IL_0c6b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c72: Expected O, but got Unknown
			//IL_0c49: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c55: Expected I4, but got Unknown
			//IL_0d1d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d24: Expected O, but got Unknown
			//IL_0cfe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d0a: Expected I4, but got Unknown
			//IL_0da4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dab: Expected O, but got Unknown
			//IL_0d82: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d8e: Expected I4, but got Unknown
			//IL_0e56: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e5d: Expected O, but got Unknown
			//IL_0e37: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e43: Expected I4, but got Unknown
			//IL_0ede: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ee5: Expected O, but got Unknown
			//IL_0ebc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ec8: Expected I4, but got Unknown
			//IL_0f90: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f97: Expected O, but got Unknown
			//IL_0f71: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f7d: Expected I4, but got Unknown
			//IL_1014: Unknown result type (might be due to invalid IL or missing references)
			//IL_101b: Expected O, but got Unknown
			//IL_0ff5: Unknown result type (might be due to invalid IL or missing references)
			//IL_1001: Expected I4, but got Unknown
			//IL_109b: Unknown result type (might be due to invalid IL or missing references)
			//IL_10a2: Expected O, but got Unknown
			//IL_1079: Unknown result type (might be due to invalid IL or missing references)
			//IL_1085: Expected I4, but got Unknown
			//IL_1150: Unknown result type (might be due to invalid IL or missing references)
			//IL_1157: Expected O, but got Unknown
			//IL_112e: Unknown result type (might be due to invalid IL or missing references)
			//IL_113a: Expected I4, but got Unknown
			//IL_1202: Unknown result type (might be due to invalid IL or missing references)
			//IL_1209: Expected O, but got Unknown
			//IL_11e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_11ef: Expected I4, but got Unknown
			//IL_1267: Unknown result type (might be due to invalid IL or missing references)
			//IL_1273: Expected I4, but got Unknown
			if (AncientCoin.isEnabled.Value)
			{
				ItemStatsDef val = new ItemStatsDef();
				val.descriptions.Add("Gold Gain: ");
				val.valueTypes.Add((ValueType)16);
				val.measurementUnits.Add((MeasurementUnits)1);
				val.descriptions.Add("Damage Taken: ");
				val.valueTypes.Add((ValueType)11);
				val.measurementUnits.Add((MeasurementUnits)1);
				val.calculateValues = (CharacterMaster master, int itemCount) => new List<float>
				{
					AncientCoin.goldMultiplierAsPercent * (float)itemCount,
					AncientCoin.damageMultiplierAsPercent * (float)itemCount
				};
				ItemDefinitions.allItemDefinitions.Add((int)AncientCoin.itemDef.itemIndex, val);
			}
			if (BloodDice.isEnabled.Value)
			{
				ItemStatsDef val2 = new ItemStatsDef();
				val2.descriptions.Add("Permanent Health: ");
				val2.valueTypes.Add((ValueType)3);
				val2.measurementUnits.Add((MeasurementUnits)2);
				val2.calculateValues = delegate(CharacterMaster master, int itemCount)
				{
					List<float> list14 = new List<float>();
					if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory) && Object.op_Implicit((Object)(object)((Component)master.inventory).GetComponent<BloodDice.Statistics>()))
					{
						BloodDice.Statistics component9 = ((Component)master.inventory).GetComponent<BloodDice.Statistics>();
						list14.Add(component9.PermanentHealth);
					}
					else
					{
						list14.Add(0f);
					}
					return list14;
				};
				ItemDefinitions.allItemDefinitions.Add((int)BloodDice.itemDef.itemIndex, val2);
			}
			if (BottleCap.isEnabled.Value)
			{
				ItemStatsDef val3 = new ItemStatsDef();
				val3.descriptions.Add("Cooldown Reduction: ");
				val3.valueTypes.Add((ValueType)2);
				val3.measurementUnits.Add((MeasurementUnits)1);
				val3.calculateValues = (CharacterMaster master, int itemCount) => new List<float> { Utils.GetHyperbolicStacking(BottleCap.specialCDRPercent, itemCount) };
				ItemDefinitions.allItemDefinitions.Add((int)BottleCap.itemDef.itemIndex, val3);
			}
			if (BrassKnuckles.isEnabled.Value)
			{
				ItemStatsDef val4 = new ItemStatsDef();
				val4.descriptions.Add("Bonus Damage: ");
				val4.valueTypes.Add((ValueType)1);
				val4.measurementUnits.Add((MeasurementUnits)1);
				val4.calculateValues = (CharacterMaster master, int itemCount) => new List<float> { BrassKnuckles.heavyHitBonusPercent * (float)itemCount };
				ItemDefinitions.allItemDefinitions.Add((int)BrassKnuckles.itemDef.itemIndex, val4);
			}
			if (BreadLoaf.isEnabled.Value)
			{
				ItemStatsDef val5 = new ItemStatsDef();
				val5.descriptions.Add("Gold On-Kill: ");
				val5.valueTypes.Add((ValueType)16);
				val5.measurementUnits.Add((MeasurementUnits)4);
				val5.descriptions.Add("Kills Remaining: ");
				val5.valueTypes.Add((ValueType)2);
				val5.measurementUnits.Add((MeasurementUnits)4);
				val5.calculateValues = delegate(CharacterMaster master, int itemCount)
				{
					List<float> list13 = new List<float>();
					if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory) && Object.op_Implicit((Object)(object)((Component)master.inventory).GetComponent<BreadLoaf.Statistics>()))
					{
						BreadLoaf.Statistics component8 = ((Component)master.inventory).GetComponent<BreadLoaf.Statistics>();
						list13.Add(BreadLoaf.goldGainOnKill.Value * itemCount);
						list13.Add((int)BreadLoaf.killsNeededToScrap - component8.KillsCounter);
					}
					else
					{
						list13.Add(BreadLoaf.goldGainOnKill.Value * itemCount);
						list13.Add(0f);
					}
					return list13;
				};
				ItemDefinitions.allItemDefinitions.Add((int)BreadLoaf.itemDef.itemIndex, val5);
			}
			if (BrokenMask.isEnabled.Value)
			{
				ItemStatsDef val6 = new ItemStatsDef();
				val6.descriptions.Add("Burn Damage: ");
				val6.valueTypes.Add((ValueType)1);
				val6.measurementUnits.Add((MeasurementUnits)1);
				val6.descriptions.Add("Damage Dealt: ");
				val6.valueTypes.Add((ValueType)1);
				val6.measurementUnits.Add((MeasurementUnits)4);
				val6.calculateValues = delegate(CharacterMaster master, int itemCount)
				{
					List<float> list12 = new List<float>();
					if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory) && Object.op_Implicit((Object)(object)((Component)master.inventory).GetComponent<BrokenMask.Statistics>()))
					{
						BrokenMask.Statistics component7 = ((Component)master.inventory).GetComponent<BrokenMask.Statistics>();
						list12.Add(BrokenMask.burnDamagePercent * (float)itemCount);
						list12.Add(component7.TotalDamageDealt);
					}
					else
					{
						list12.Add(BrokenMask.burnDamagePercent * (float)itemCount);
						list12.Add(0f);
					}
					return list12;
				};
				ItemDefinitions.allItemDefinitions.Add((int)BrokenMask.itemDef.itemIndex, val6);
			}
			if (CarvingBlade.isEnabled.Value)
			{
				ItemStatsDef val7 = new ItemStatsDef();
				val7.descriptions.Add("On-Hit Damage Cap: ");
				val7.valueTypes.Add((ValueType)1);
				val7.measurementUnits.Add((MeasurementUnits)1);
				val7.descriptions.Add("Damage Dealt: ");
				val7.valueTypes.Add((ValueType)1);
				val7.measurementUnits.Add((MeasurementUnits)4);
				val7.calculateValues = delegate(CharacterMaster master, int itemCount)
				{
					List<float> list11 = new List<float>();
					if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory) && Object.op_Implicit((Object)(object)((Component)master.inventory).GetComponent<CarvingBlade.Statistics>()))
					{
						CarvingBlade.Statistics component6 = ((Component)master.inventory).GetComponent<CarvingBlade.Statistics>();
						list11.Add(CarvingBlade.CalculateDamageCapPercent(itemCount));
						list11.Add(Mathf.Max(component6.TotalDamageDealt, 0f));
					}
					else
					{
						list11.Add(CarvingBlade.CalculateDamageCapPercent(itemCount));
						list11.Add(0f);
					}
					return list11;
				};
				ItemDefinitions.allItemDefinitions.Add((int)CarvingBlade.itemDef.itemIndex, val7);
			}
			if (Crucifix.isEnabled.Value)
			{
				ItemStatsDef val8 = new ItemStatsDef();
				val8.descriptions.Add("Burn Duration: ");
				val8.valueTypes.Add((ValueType)2);
				val8.measurementUnits.Add((MeasurementUnits)5);
				val8.calculateValues = (CharacterMaster master, int itemCount) => new List<float> { (int)Crucifix.fireDuration * itemCount };
				ItemDefinitions.allItemDefinitions.Add((int)Crucifix.itemDef.itemIndex, val8);
			}
			if (DebitCard.isEnabled.Value)
			{
				ItemStatsDef val9 = new ItemStatsDef();
				val9.descriptions.Add("Rebate: ");
				val9.valueTypes.Add((ValueType)2);
				val9.measurementUnits.Add((MeasurementUnits)1);
				val9.calculateValues = (CharacterMaster master, int itemCount) => new List<float> { DebitCard.rebatePercent * (float)itemCount };
				ItemDefinitions.allItemDefinitions.Add((int)DebitCard.itemDef.itemIndex, val9);
			}
			if (EdibleGlue.isEnabled.Value)
			{
				ItemStatsDef val10 = new ItemStatsDef();
				val10.descriptions.Add("Slow Range: ");
				val10.valueTypes.Add((ValueType)2);
				val10.measurementUnits.Add((MeasurementUnits)0);
				val10.calculateValues = (CharacterMaster master, int itemCount) => new List<float> { EdibleGlue.GetSlowRadius(itemCount) };
				ItemDefinitions.allItemDefinitions.Add((int)EdibleGlue.itemDef.itemIndex, val10);
			}
			if (Epinephrine.isEnabled.Value)
			{
				ItemStatsDef val11 = new ItemStatsDef();
				val11.descriptions.Add("Buff Duration: ");
				val11.valueTypes.Add((ValueType)2);
				val11.measurementUnits.Add((MeasurementUnits)5);
				val11.calculateValues = (CharacterMaster master, int itemCount) => new List<float> { (float)Epinephrine.buffDuration * (float)itemCount };
				ItemDefinitions.allItemDefinitions.Add((int)Epinephrine.itemDef.itemIndex, val11);
			}
			if (Hoodie.isEnabled.Value)
			{
				ItemStatsDef val12 = new ItemStatsDef();
				val12.descriptions.Add("Duration Bonus: ");
				val12.valueTypes.Add((ValueType)2);
				val12.measurementUnits.Add((MeasurementUnits)1);
				val12.descriptions.Add("Cooldown: ");
				val12.valueTypes.Add((ValueType)2);
				val12.measurementUnits.Add((MeasurementUnits)5);
				val12.calculateValues = (CharacterMaster master, int itemCount) => new List<float>
				{
					Hoodie.durationIncreasePercent * (float)itemCount,
					Hoodie.CalculateHoodieCooldown(itemCount)
				};
				ItemDefinitions.allItemDefinitions.Add((int)Hoodie.itemDef.itemIndex, val12);
			}
			if (GlassMarbles.isEnabled.Value)
			{
				ItemStatsDef val13 = new ItemStatsDef();
				val13.descriptions.Add("Base Damage: ");
				val13.valueTypes.Add((ValueType)1);
				val13.measurementUnits.Add((MeasurementUnits)4);
				val13.calculateValues = delegate(CharacterMaster master, int itemCount)
				{
					List<float> list10 = new List<float>();
					if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.GetBody()))
					{
						list10.Add((float)GlassMarbles.damagePerLevelPerStack * (float)itemCount * master.GetBody().level);
					}
					else
					{
						list10.Add(0f);
					}
					return list10;
				};
				ItemDefinitions.allItemDefinitions.Add((int)GlassMarbles.itemDef.itemIndex, val13);
			}
			if (HolyWater.isEnabled.Value)
			{
				ItemStatsDef val14 = new ItemStatsDef();
				val14.descriptions.Add("Experience Gained: ");
				val14.valueTypes.Add((ValueType)3);
				val14.measurementUnits.Add((MeasurementUnits)6);
				val14.calculateValues = (CharacterMaster master, int itemCount) => new List<float> { HolyWater.CalculateExperienceMultiplier(itemCount) };
				ItemDefinitions.allItemDefinitions.Add((int)HolyWater.itemDef.itemIndex, val14);
			}
			if (Horseshoe.isEnabled.Value)
			{
				ItemStatsDef val15 = new ItemStatsDef();
				val15.descriptions.Add("Health: ");
				val15.valueTypes.Add((ValueType)3);
				val15.measurementUnits.Add((MeasurementUnits)2);
				val15.descriptions.Add("Base Damage: ");
				val15.valueTypes.Add((ValueType)1);
				val15.measurementUnits.Add((MeasurementUnits)4);
				val15.descriptions.Add("Attack Speed: ");
				val15.valueTypes.Add((ValueType)1);
				val15.measurementUnits.Add((MeasurementUnits)1);
				val15.descriptions.Add("Crit Chance: ");
				val15.valueTypes.Add((ValueType)1);
				val15.measurementUnits.Add((MeasurementUnits)1);
				val15.descriptions.Add("Crit Damage: ");
				val15.valueTypes.Add((ValueType)1);
				val15.measurementUnits.Add((MeasurementUnits)1);
				val15.descriptions.Add("Armor: ");
				val15.valueTypes.Add((ValueType)15);
				val15.measurementUnits.Add((MeasurementUnits)4);
				val15.descriptions.Add("Regeneration: ");
				val15.valueTypes.Add((ValueType)0);
				val15.measurementUnits.Add((MeasurementUnits)3);
				val15.descriptions.Add("Shield: ");
				val15.valueTypes.Add((ValueType)2);
				val15.measurementUnits.Add((MeasurementUnits)2);
				val15.descriptions.Add("Movement Speed: ");
				val15.valueTypes.Add((ValueType)2);
				val15.measurementUnits.Add((MeasurementUnits)1);
				val15.calculateValues = delegate(CharacterMaster master, int itemCount)
				{
					List<float> list8 = new List<float> { 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f };
					if (!Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)master.inventory) || !Object.op_Implicit((Object)(object)master.GetBody()))
					{
						return list8;
					}
					List<float> list9 = new List<float>();
					HorseshoeStatistics component5 = ((Component)master.inventory).GetComponent<HorseshoeStatistics>();
					if (Object.op_Implicit((Object)(object)component5))
					{
						list9.Add(Horseshoe.GetScaledValue(component5.MaxHealthBonus, master.GetBody().level, itemCount));
						list9.Add(Horseshoe.GetScaledValue(component5.BaseDamageBonus, master.GetBody().level, itemCount));
						list9.Add(Horseshoe.GetScaledValue(component5.AttackSpeedPercentBonus, master.GetBody().level, itemCount));
						list9.Add(Horseshoe.GetScaledValue(component5.CritChanceBonus, master.GetBody().level, itemCount) / 100f);
						list9.Add(Horseshoe.GetScaledValue(component5.CritDamageBonus, master.GetBody().level, itemCount));
						list9.Add(Horseshoe.GetScaledValue(component5.ArmorBonus, master.GetBody().level, itemCount));
						list9.Add(Horseshoe.GetScaledValue(component5.RegenerationBonus, master.GetBody().level, itemCount));
						list9.Add(Horseshoe.GetScaledValue(component5.ShieldBonus, master.GetBody().level, itemCount));
						list9.Add(Horseshoe.GetScaledValue(component5.MoveSpeedPercentBonus, master.GetBody().level, itemCount));
					}
					else
					{
						list9 = list8;
					}
					return list9;
				};
				ItemDefinitions.allItemDefinitions.Add((int)Horseshoe.itemDef.itemIndex, val15);
			}
			if (IronHeart.isEnabled.Value)
			{
				ItemStatsDef val16 = new ItemStatsDef();
				val16.descriptions.Add("On-Hit Damage: ");
				val16.valueTypes.Add((ValueType)3);
				val16.measurementUnits.Add((MeasurementUnits)6);
				val16.descriptions.Add("Damage Dealt: ");
				val16.valueTypes.Add((ValueType)1);
				val16.measurementUnits.Add((MeasurementUnits)4);
				val16.calculateValues = delegate(CharacterMaster master, int itemCount)
				{
					List<float> list7 = new List<float>();
					if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory) && Object.op_Implicit((Object)(object)((Component)master.inventory).GetComponent<IronHeart.Statistics>()))
					{
						IronHeart.Statistics component4 = ((Component)master.inventory).GetComponent<IronHeart.Statistics>();
						list7.Add(IronHeart.multiplierPerStack * (float)itemCount);
						list7.Add(component4.TotalDamageDealt);
					}
					else
					{
						list7.Add(IronHeart.multiplierPerStack * (float)itemCount);
						list7.Add(0f);
					}
					return list7;
				};
				ItemDefinitions.allItemDefinitions.Add((int)IronHeart.itemDef.itemIndex, val16);
			}
			if (MilkCarton.isEnabled.Value)
			{
				ItemStatsDef val17 = new ItemStatsDef();
				val17.descriptions.Add("Damage Reduction: ");
				val17.valueTypes.Add((ValueType)2);
				val17.measurementUnits.Add((MeasurementUnits)1);
				val17.calculateValues = (CharacterMaster master, int itemCount) => new List<float> { Utils.GetHyperbolicStacking(MilkCarton.eliteDamageReductionPercent, itemCount) };
				ItemDefinitions.allItemDefinitions.Add((int)MilkCarton.itemDef.itemIndex, val17);
			}
			if (MagnifyingGlass.isEnabled.Value)
			{
				ItemStatsDef val18 = new ItemStatsDef();
				val18.descriptions.Add("Analyze Chance: ");
				val18.valueTypes.Add((ValueType)2);
				val18.measurementUnits.Add((MeasurementUnits)1);
				val18.calculateValues = delegate(CharacterMaster master, int itemCount)
				{
					List<float> list6 = new List<float>();
					if (Object.op_Implicit((Object)(object)master))
					{
						list6.Add(Utils.GetChanceAfterLuck(MagnifyingGlass.analyzeChancePercent * (float)itemCount, master.luck));
					}
					else
					{
						list6.Add(MagnifyingGlass.analyzeChancePercent * (float)itemCount);
					}
					return list6;
				};
				ItemDefinitions.allItemDefinitions.Add((int)MagnifyingGlass.itemDef.itemIndex, val18);
			}
			if (PaperPlane.isEnabled.Value)
			{
				ItemStatsDef val19 = new ItemStatsDef();
				val19.descriptions.Add("Bonus Damage: ");
				val19.valueTypes.Add((ValueType)1);
				val19.measurementUnits.Add((MeasurementUnits)1);
				val19.calculateValues = (CharacterMaster master, int itemCount) => new List<float> { PaperPlane.damageBonusPercent * (float)itemCount };
				ItemDefinitions.allItemDefinitions.Add((int)PaperPlane.itemDef.itemIndex, val19);
			}
			if (Permafrost.isEnabled.Value)
			{
				ItemStatsDef val20 = new ItemStatsDef();
				val20.descriptions.Add("Freeze Chance: ");
				val20.valueTypes.Add((ValueType)2);
				val20.measurementUnits.Add((MeasurementUnits)1);
				val20.descriptions.Add("Bonus Damage: ");
				val20.valueTypes.Add((ValueType)1);
				val20.measurementUnits.Add((MeasurementUnits)1);
				val20.calculateValues = delegate(CharacterMaster master, int itemCount)
				{
					List<float> list5 = new List<float>();
					if (Object.op_Implicit((Object)(object)master))
					{
						list5.Add(Utils.GetChanceAfterLuck(Utils.GetHyperbolicStacking(Permafrost.freezeChancePercent, itemCount), master.luck));
					}
					else
					{
						list5.Add(Utils.GetHyperbolicStacking(Permafrost.freezeChancePercent, itemCount));
					}
					list5.Add(Permafrost.frozenDamageMultiplierPercent * (float)itemCount);
					return list5;
				};
				ItemDefinitions.allItemDefinitions.Add((int)Permafrost.itemDef.itemIndex, val20);
			}
			if (Photodiode.isEnabled.Value)
			{
				ItemStatsDef val21 = new ItemStatsDef();
				val21.descriptions.Add("Max Attack Speed: ");
				val21.valueTypes.Add((ValueType)1);
				val21.measurementUnits.Add((MeasurementUnits)1);
				val21.calculateValues = (CharacterMaster master, int itemCount) => new List<float> { Photodiode.maxAttackSpeedAllowedPercent * (float)itemCount };
				ItemDefinitions.allItemDefinitions.Add((int)Photodiode.itemDef.itemIndex, val21);
			}
			if (RedBlueGlasses.isEnabled.Value)
			{
				ItemStatsDef val22 = new ItemStatsDef();
				val22.descriptions.Add("Crit Chance: ");
				val22.valueTypes.Add((ValueType)1);
				val22.measurementUnits.Add((MeasurementUnits)1);
				val22.descriptions.Add("Crit Damage: ");
				val22.valueTypes.Add((ValueType)1);
				val22.measurementUnits.Add((MeasurementUnits)1);
				val22.calculateValues = (CharacterMaster master, int itemCount) => new List<float>
				{
					RedBlueGlasses.critChancePercent * (float)itemCount,
					RedBlueGlasses.critDamagePercent * (float)itemCount
				};
				ItemDefinitions.allItemDefinitions.Add((int)RedBlueGlasses.itemDef.itemIndex, val22);
			}
			if (RubberDucky.isEnabled.Value)
			{
				ItemStatsDef val23 = new ItemStatsDef();
				val23.descriptions.Add("Bonus Armor: ");
				val23.valueTypes.Add((ValueType)17);
				val23.measurementUnits.Add((MeasurementUnits)4);
				val23.calculateValues = (CharacterMaster master, int itemCount) => new List<float> { (int)RubberDucky.armorPerStack * itemCount };
				ItemDefinitions.allItemDefinitions.Add((int)RubberDucky.itemDef.itemIndex, val23);
			}
			if (RustyTrowel.isEnabled.Value)
			{
				ItemStatsDef val24 = new ItemStatsDef();
				val24.descriptions.Add("Cooldown: ");
				val24.valueTypes.Add((ValueType)2);
				val24.measurementUnits.Add((MeasurementUnits)5);
				val24.descriptions.Add("Healing Done: ");
				val24.valueTypes.Add((ValueType)0);
				val24.measurementUnits.Add((MeasurementUnits)2);
				val24.calculateValues = delegate(CharacterMaster master, int itemCount)
				{
					List<float> list4 = new List<float>();
					if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory) && Object.op_Implicit((Object)(object)((Component)master.inventory).GetComponent<RustyTrowel.Statistics>()))
					{
						RustyTrowel.Statistics component3 = ((Component)master.inventory).GetComponent<RustyTrowel.Statistics>();
						list4.Add(RustyTrowel.CalculateCooldownInSec(itemCount));
						list4.Add(component3.TotalHealingDone);
					}
					else
					{
						list4.Add(RustyTrowel.CalculateCooldownInSec(itemCount));
						list4.Add(0f);
					}
					return list4;
				};
				ItemDefinitions.allItemDefinitions.Add((int)RustyTrowel.itemDef.itemIndex, val24);
			}
			if (ShadowCrest.isEnabled.Value)
			{
				ItemStatsDef val25 = new ItemStatsDef();
				val25.descriptions.Add("Missing Health Regen: ");
				val25.valueTypes.Add((ValueType)0);
				val25.measurementUnits.Add((MeasurementUnits)1);
				val25.calculateValues = (CharacterMaster master, int itemCount) => new List<float> { Utils.GetHyperbolicStacking(ShadowCrest.regenPerSecondPercent, itemCount) };
				ItemDefinitions.allItemDefinitions.Add((int)ShadowCrest.itemDef.itemIndex, val25);
			}
			if (SoulRing.isEnabled.Value)
			{
				ItemStatsDef val26 = new ItemStatsDef();
				val26.descriptions.Add("Bonus Regeneration: ");
				val26.valueTypes.Add((ValueType)0);
				val26.measurementUnits.Add((MeasurementUnits)3);
				val26.calculateValues = delegate(CharacterMaster master, int itemCount)
				{
					List<float> list3 = new List<float>();
					if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory) && Object.op_Implicit((Object)(object)((Component)master.inventory).GetComponent<SoulRing.Statistics>()))
					{
						SoulRing.Statistics component2 = ((Component)master.inventory).GetComponent<SoulRing.Statistics>();
						list3.Add(component2.HealthRegen);
					}
					else
					{
						list3.Add(0f);
					}
					return list3;
				};
				ItemDefinitions.allItemDefinitions.Add((int)SoulRing.itemDef.itemIndex, val26);
			}
			if (SpiritStone.isEnabled.Value)
			{
				ItemStatsDef val27 = new ItemStatsDef();
				val27.descriptions.Add("Permanent Shield: ");
				val27.valueTypes.Add((ValueType)2);
				val27.measurementUnits.Add((MeasurementUnits)2);
				val27.descriptions.Add("Health Penalty: ");
				val27.valueTypes.Add((ValueType)3);
				val27.measurementUnits.Add((MeasurementUnits)6);
				val27.calculateValues = delegate(CharacterMaster master, int itemCount)
				{
					List<float> list2 = new List<float>();
					if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory) && Object.op_Implicit((Object)(object)((Component)master.inventory).GetComponent<SpiritStone.Statistics>()))
					{
						SpiritStone.Statistics component = ((Component)master.inventory).GetComponent<SpiritStone.Statistics>();
						list2.Add(component.PermanentShield);
					}
					else
					{
						list2.Add(0f);
					}
					list2.Add(Utils.GetExponentialStacking(SpiritStone.maxHealthLostPercent, itemCount));
					return list2;
				};
				ItemDefinitions.allItemDefinitions.Add((int)SpiritStone.itemDef.itemIndex, val27);
			}
			if (Thumbtack.isEnabled.Value)
			{
				ItemStatsDef val28 = new ItemStatsDef();
				val28.descriptions.Add("Bleed Chance: ");
				val28.valueTypes.Add((ValueType)1);
				val28.measurementUnits.Add((MeasurementUnits)1);
				val28.descriptions.Add("Bonus Duration: ");
				val28.valueTypes.Add((ValueType)2);
				val28.measurementUnits.Add((MeasurementUnits)5);
				val28.calculateValues = (CharacterMaster master, int itemCount) => new List<float>
				{
					Thumbtack.bleedChancePercent * (float)itemCount,
					Thumbtack.bleedDurationBonus.Value * (float)itemCount
				};
				ItemDefinitions.allItemDefinitions.Add((int)Thumbtack.itemDef.itemIndex, val28);
			}
			if (!IronHeartVoid.isEnabled.Value)
			{
				return;
			}
			ItemStatsDef val29 = new ItemStatsDef();
			val29.descriptions.Add("Base Damage: ");
			val29.valueTypes.Add((ValueType)1);
			val29.measurementUnits.Add((MeasurementUnits)4);
			val29.calculateValues = delegate(CharacterMaster master, int itemCount)
			{
				List<float> list = new List<float>();
				if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.GetBody()))
				{
					list.Add(IronHeartVoid.CalculateDamageBonus(master.GetBody(), itemCount));
				}
				else
				{
					list.Add(0f);
				}
				return list;
			};
			ItemDefinitions.allItemDefinitions.Add((int)IronHeartVoid.itemDef.itemIndex, val29);
		}
	}

	internal static void Init()
	{
		RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(LookingGlassStats.RegisterStats));
	}
}
internal class BuffTotem
{
	public enum Result
	{
		ARMOR,
		DAMAGE,
		ATTACK_SPEED,
		HEALTH_REGEN
	}

	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_PerformEquipmentAction <>9__20_0;

		public static StatHookEventHandler <>9__20_1;

		internal bool <Hooks>b__20_0(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipDef)
		{
			if (NetworkServer.active && (Object)(object)equipDef == (Object)(object)equipmentDef)
			{
				return OnUse(self);
			}
			return orig.Invoke(self, equipDef);
		}

		internal void <Hooks>b__20_1(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
			{
				if (sender.HasBuff(armorBuff))
				{
					args.armorAdd += armorIncrease.Value;
				}
				if (sender.HasBuff(damageBuff))
				{
					args.damageMultAdd += damageIncreasePercent;
				}
				if (sender.HasBuff(attackSpeedBuff))
				{
					args.attackSpeedMultAdd += attackSpeedIncreasePercent;
				}
				if (sender.HasBuff(healthRegenBuff))
				{
					args.baseRegenAdd += regenIncreasePercent * sender.healthComponent.fullCombinedHealth;
				}
			}
		}
	}

	public static EquipmentDef equipmentDef;

	public static BuffDef armorBuff;

	public static BuffDef damageBuff;

	public static BuffDef attackSpeedBuff;

	public static BuffDef healthRegenBuff;

	public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Equipment: Totem of Prayer", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string> { "EQUIPMENT_BUFFTOTEM_DESC" });

	public static ConfigurableValue<float> armorIncrease = new ConfigurableValue<float>("Equipment: Totem of Prayer", "Armor Increase", 100f, "Armor increase if rolled.", new List<string> { "EQUIPMENT_BUFFTOTEM_DESC" });

	public static ConfigurableValue<float> damageIncrease = new ConfigurableValue<float>("Equipment: Totem of Prayer", "Damage Increase", 25f, "Percent damage increase if rolled.", new List<string> { "EQUIPMENT_BUFFTOTEM_DESC" });

	public static ConfigurableValue<float> attackSpeedIncrease = new ConfigurableValue<float>("Equipment: Totem of Prayer", "Attack Speed Increase", 75f, "Percent attack speed increase if rolled.", new List<string> { "EQUIPMENT_BUFFTOTEM_DESC" });

	public static ConfigurableValue<float> regenIncrease = new ConfigurableValue<float>("Equipment: Totem of Prayer", "Health Regen Increase", 10f, "Health regeneration bonus (as max HP/s) if rolled.", new List<string> { "EQUIPMENT_BUFFTOTEM_DESC" });

	public static ConfigurableValue<float> buffDuration = new ConfigurableValue<float>("Equipment: Totem of Prayer", "Buff Duration", 12f, "Duration of the buff given.", new List<string> { "EQUIPMENT_BUFFTOTEM_DESC" });

	public static ConfigurableValue<int> equipCooldown = new ConfigurableValue<int>("Equipment: Totem of Prayer", "Cooldown", 55, "Equipment cooldown.", new List<string> { "EQUIPMENT_BUFFTOTEM_DESC" });

	public static float damageIncreasePercent = damageIncrease.Value / 100f;

	public static float attackSpeedIncreasePercent = attackSpeedIncrease.Value / 100f;

	public static float regenIncreasePercent = regenIncrease.Value / 100f;

	public static Result lastBuffGiven = Result.ARMOR;

	internal static void Init()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		GenerateEquipment();
		GenerateBuff();
		ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
		ItemAPI.Add(new CustomEquipment(equipmentDef, val));
		ContentAddition.AddBuffDef(armorBuff);
		ContentAddition.AddBuffDef(damageBuff);
		ContentAddition.AddBuffDef(attackSpeedBuff);
		ContentAddition.AddBuffDef(healthRegenBuff);
		Hooks();
	}

	private static void GenerateEquipment()
	{
		equipmentDef = ScriptableObject.CreateInstance<EquipmentDef>();
		((Object)equipmentDef).name = "BUFFTOTEM";
		equipmentDef.AutoPopulateTokens();
		equipmentDef.pickupIconSprite = AssetHandler.bundle.LoadAsset<Sprite>("HealTotem.png");
		equipmentDef.pickupModelPrefab = AssetHandler.bundle.LoadAsset<GameObject>("BuffTotem.prefab");
		equipmentDef.appearsInMultiPlayer = true;
		equipmentDef.appearsInSinglePlayer = true;
		equipmentDef.canBeRandomlyTriggered = true;
		equipmentDef.enigmaCompatible = true;
		equipmentDef.canDrop = true;
		equipmentDef.cooldown = equipCooldown.Value;
	}

	private static void GenerateBuff()
	{
		armorBuff = ScriptableObject.CreateInstance<BuffDef>();
		((Object)armorBuff).name = "Prayer of Defense";
		armorBuff.iconSprite = AssetHandler.bundle.LoadAsset<Sprite>("DefensePrayer.png");
		armorBuff.canStack = false;
		armorBuff.isHidden = false;
		armorBuff.isDebuff = false;
		armorBuff.isCooldown = false;
		damageBuff = ScriptableObject.CreateInstance<BuffDef>();
		((Object)damageBuff).name = "Prayer of Power";
		damageBuff.iconSprite = AssetHandler.bundle.LoadAsset<Sprite>("DamagePrayer.png");
		damageBuff.canStack = false;
		damageBuff.isHidden = false;
		damageBuff.isDebuff = false;
		damageBuff.isCooldown = false;
		attackSpeedBuff = ScriptableObject.CreateInstance<BuffDef>();
		((Object)attackSpeedBuff).name = "Prayer of Cadence";
		attackSpeedBuff.iconSprite = AssetHandler.bundle.LoadAsset<Sprite>("CadencePrayer.png");
		attackSpeedBuff.canStack = false;
		attackSpeedBuff.isHidden = false;
		attackSpeedBuff.isDebuff = false;
		attackSpeedBuff.isCooldown = false;
		healthRegenBuff = ScriptableObject.CreateInstance<BuffDef>();
		((Object)healthRegenBuff).name = "Prayer of Remedy";
		healthRegenBuff.iconSprite = AssetHandler.bundle.LoadAsset<Sprite>("RemedyPrayer.png");
		healthRegenBuff.canStack = false;
		healthRegenBuff.isHidden = false;
		healthRegenBuff.isDebuff = false;
		healthRegenBuff.isCooldown = false;
	}

	public static void Hooks()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Expected O, but got Unknown
		object obj = <>c.<>9__20_0;
		if (obj == null)
		{
			hook_PerformEquipmentAction val = (orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipDef) => (NetworkServer.active && (Object)(object)equipDef == (Object)(object)equipmentDef) ? OnUse(self) : orig.Invoke(self, equipDef);
			<>c.<>9__20_0 = val;
			obj = (object)val;
		}
		EquipmentSlot.PerformEquipmentAction += (hook_PerformEquipmentAction)obj;
		object obj2 = <>c.<>9__20_1;
		if (obj2 == null)
		{
			StatHookEventHandler val2 = delegate(CharacterBody sender, StatHookEventArgs args)
			{
				if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
				{
					if (sender.HasBuff(armorBuff))
					{
						args.armorAdd += armorIncrease.Value;
					}
					if (sender.HasBuff(damageBuff))
					{
						args.damageMultAdd += damageIncreasePercent;
					}
					if (sender.HasBuff(attackSpeedBuff))
					{
						args.attackSpeedMultAdd += attackSpeedIncreasePercent;
					}
					if (sender.HasBuff(healthRegenBuff))
					{
						args.baseRegenAdd += regenIncreasePercent * sender.healthComponent.fullCombinedHealth;
					}
				}
			};
			<>c.<>9__20_1 = val2;
			obj2 = (object)val2;
		}
		RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj2;
	}

	private static bool OnUse(EquipmentSlot slot)
	{
		CharacterBody characterBody = slot.characterBody;
		if (Object.op_Implicit((Object)(object)characterBody))
		{
			Array values = Enum.GetValues(typeof(Result));
			Result result;
			for (result = (Result)values.GetValue(TooManyItems.RandGen.Next(values.Length)); result == lastBuffGiven; result = (Result)values.GetValue(TooManyItems.RandGen.Next(values.Length)))
			{
			}
			lastBuffGiven = result;
			switch (result)
			{
			case Result.ARMOR:
				characterBody.AddTimedBuff(armorBuff, buffDuration.Value);
				break;
			case Result.DAMAGE:
				characterBody.AddTimedBuff(damageBuff, buffDuration.Value);
				break;
			case Result.ATTACK_SPEED:
				characterBody.AddTimedBuff(attackSpeedBuff, buffDuration.Value);
				break;
			case Result.HEALTH_REGEN:
				characterBody.AddTimedBuff(healthRegenBuff, buffDuration.Value);
				break;
			}
			Utils.ForceRecalculate(characterBody);
			return true;
		}
		return false;
	}
}
internal class Chalice
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_PerformEquipmentAction <>9__12_0;

		public static StatHookEventHandler <>9__12_1;

		internal bool <Hooks>b__12_0(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipDef)
		{
			if (NetworkServer.active && (Object)(object)equipDef == (Object)(object)equipmentDef)
			{
				return OnUse(self);
			}
			return orig.Invoke(self, equipDef);
		}

		internal void <Hooks>b__12_1(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory) && sender.HasBuff(consecratedBuff))
			{
				args.attackSpeedMultAdd += consecrateAttackSpeedBonus.Value / 100f;
				args.damageMultAdd += consecrateDamageBonus.Value / 100f;
			}
		}
	}

	public static EquipmentDef equipmentDef;

	public static BuffDef consecratedBuff;

	public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Equipment: Chalice", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string> { "EQUIPMENT_CHALICE_DESC" });

	public static ConfigurableValue<float> consecrateDuration = new ConfigurableValue<float>("Equipment: Chalice", "Consecrate Duration", 10f, "Duration of the Consecrate buff given.", new List<string> { "EQUIPMENT_CHALICE_DESC" });

	public static ConfigurableValue<float> consecrateDamageBonus = new ConfigurableValue<float>("Equipment: Chalice", "Consecrate Damage Bonus", 30f, "Percent bonus damage dealt while Consecrated.", new List<string> { "EQUIPMENT_CHALICE_DESC" });

	public static ConfigurableValue<float> consecrateAttackSpeedBonus = new ConfigurableValue<float>("Equipment: Chalice", "Consecrate Attack Speed Bonus", 90f, "Percent bonus attack speed gained while Consecrated.", new List<string> { "EQUIPMENT_CHALICE_DESC" });

	public static ConfigurableValue<float> currentHealthCost = new ConfigurableValue<float>("Equipment: Chalice", "Current Health Loss", 90f, "Percent of current health lost as payment when Consecrated.", new List<string> { "EQUIPMENT_CHALICE_DESC" });

	public static ConfigurableValue<int> equipCooldown = new ConfigurableValue<int>("Equipment: Chalice", "Cooldown", 70, "Equipment cooldown.", new List<string> { "EQUIPMENT_CHALICE_DESC" });

	public static float currentHealthCostPercent = currentHealthCost.Value / 100f;

	internal static void Init()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		GenerateEquipment();
		GenerateBuff();
		ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
		ItemAPI.Add(new CustomEquipment(equipmentDef, val));
		ContentAddition.AddBuffDef(consecratedBuff);
		Hooks();
	}

	private static void GenerateEquipment()
	{
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		equipmentDef = ScriptableObject.CreateInstance<EquipmentDef>();
		((Object)equipmentDef).name = "CHALICE";
		equipmentDef.AutoPopulateTokens();
		equipmentDef.pickupIconSprite = AssetHandler.bundle.LoadAsset<Sprite>("Chalice.png");
		equipmentDef.pickupModelPrefab = AssetHandler.bundle.LoadAsset<GameObject>("Chalice.prefab");
		equipmentDef.isLunar = true;
		equipmentDef.colorIndex = (ColorIndex)4;
		equipmentDef.appearsInMultiPlayer = true;
		equipmentDef.appearsInSinglePlayer = true;
		equipmentDef.canBeRandomlyTriggered = false;
		equipmentDef.enigmaCompatible = true;
		equipmentDef.canDrop = true;
		equipmentDef.cooldown = equipCooldown.Value;
	}

	private static void GenerateBuff()
	{
		consecratedBuff = ScriptableObject.CreateInstance<BuffDef>();
		((Object)consecratedBuff).name = "Consecrated";
		consecratedBuff.iconSprite = AssetHandler.bundle.LoadAsset<Sprite>("ConsecratedBuff.png");
		consecratedBuff.canStack = false;
		consecratedBuff.isHidden = false;
		consecratedBuff.isDebuff = false;
		consecratedBuff.isCooldown = false;
	}

	public static void Hooks()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Expected O, but got Unknown
		object obj = <>c.<>9__12_0;
		if (obj == null)
		{
			hook_PerformEquipmentAction val = (orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipDef) => (NetworkServer.active && (Object)(object)equipDef == (Object)(object)equipmentDef) ? OnUse(self) : orig.Invoke(self, equipDef);
			<>c.<>9__12_0 = val;
			obj = (object)val;
		}
		EquipmentSlot.PerformEquipmentAction += (hook_PerformEquipmentAction)obj;
		object obj2 = <>c.<>9__12_1;
		if (obj2 == null)
		{
			StatHookEventHandler val2 = delegate(CharacterBody sender, StatHookEventArgs args)
			{
				if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory) && sender.HasBuff(consecratedBuff))
				{
					args.attackSpeedMultAdd += consecrateAttackSpeedBonus.Value / 100f;
					args.damageMultAdd += consecrateDamageBonus.Value / 100f;
				}
			};
			<>c.<>9__12_1 = val2;
			obj2 = (object)val2;
		}
		RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj2;
	}

	private static bool OnUse(EquipmentSlot slot)
	{
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: 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_006c: 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_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: 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_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: 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_0098: 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_00a3: Expected O, but got Unknown
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		CharacterBody characterBody = slot.characterBody;
		if (Object.op_Implicit((Object)(object)characterBody))
		{
			float num = characterBody.healthComponent.health * currentHealthCostPercent;
			if (characterBody.healthComponent.combinedHealth <= num)
			{
				return false;
			}
			DamageInfo val = new DamageInfo
			{
				damage = num,
				attacker = null,
				inflictor = null,
				procCoefficient = 0f,
				position = characterBody.corePosition,
				crit = false,
				damageColorIndex = (DamageColorIndex)0,
				procChainMask = default(ProcChainMask),
				damageType = DamageTypeCombo.op_Implicit((DamageType)2048)
			};
			characterBody.healthComponent.TakeDamage(val);
			foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(slot.characterBody.teamComponent.teamIndex))
			{
				teamMember.body.AddTimedBuff(consecratedBuff, consecrateDuration.Value);
			}
			return true;
		}
		return false;
	}
}
internal class Vanity
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_Start <>9__16_0;

		public static hook_Update <>9__16_1;

		public static hook_PerformEquipmentAction <>9__16_2;

		public static StatHookEventHandler <>9__16_3;

		public static hook_HandleOnKillEffectsServer <>9__16_4;

		internal void <Hooks>b__16_0(orig_Start orig, EquipmentSlot self)
		{
			orig.Invoke(self);
			((Component)self).gameObject.AddComponent<EquipmentTargeter>();
		}

		internal void <Hooks>b__16_1(orig_Update orig, EquipmentSlot self)
		{
			//IL_0028: 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)
			orig.Invoke(self);
			EquipmentTargeter component = ((Component)self).gameObject.GetComponent<EquipmentTargeter>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			if (equipmentDef.equipmentIndex == self.equipmentIndex)
			{
				if (self.stock > 0)
				{
					component.ConfigureTargetFinderForEnemies(self);
					HurtBox val = component.search.GetResults().FirstOrDefault();
					if (Object.op_Implicit((Object)(object)val))
					{
						component.obj = ((Component)val.healthComponent).gameObject;
						component.indicator.visualizerPrefab = vanityTargetIndicatorPrefab;
						component.indicator.targetTransform = ((Component)val).transform;
					}
					else
					{
						component.Invalidate();
					}
					component.indicator.active = Object.op_Implicit((Object)(object)val);
				}
				else
				{
					component.Invalidate();
					component.indicator.active = false;
				}
			}
			else
			{
				component.Invalidate();
				component.indicator.active = false;
			}
		}

		internal bool <Hooks>b__16_2(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipDef)
		{
			if (NetworkServer.active && (Object)(object)equipDef == (Object)(object)equipmentDef)
			{
				return OnUse(self);
			}
			return orig.Invoke(self, equipDef);
		}

		internal void <Hooks>b__16_3(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
			{
				args.damageMultAdd -= Utils.GetExponentialStacking(damageLostPercentPerStack, sender.GetBuffCount(hubrisDebuff));
			}
		}

		internal void <Hooks>b__16_4(orig_HandleOnKillEffectsServer orig, CharacterBody self, DamageReport damageReport)
		{
			//IL_0025: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, damageReport);
			if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.equipmentSlot) && self.equipmentSlot.equipmentIndex == equipmentDef.equipmentIndex && !DamageAPI.HasModdedDamageType(damageReport.damageInfo, damageType))
			{
				self.AddBuff(hubrisDebuff);
			}
		}
	}

	public static EquipmentDef equipmentDef;

	public static BuffDef hubrisDebuff;

	public static GameObject vanityTargetIndicatorPrefab;

	public static GameObject implosionEffectObject;

	public static ModdedDamageType damageType;

	public static DamageColorIndex damageColor = DamageColorAPI.RegisterDamageColor(Utils.VANITY_COLOR);

	public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Equipment: Crown of Vanity", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string> { "EQUIPMENT_VANITY_DESC" });

	public static ConfigurableValue<float> damageLostPerStack = new ConfigurableValue<float>("Equipment: Crown of Vanity", "Base Damage Lost", 3f, "Percent base damage lost for each stack of Hubris.", new List<string> { "EQUIPMENT_VANITY_DESC" });

	public static float damageLostPercentPerStack = damageLostPerStack.Value / 100f;

	public static ConfigurableValue<float> damageDealtPerStack = new ConfigurableValue<float>("Equipment: Crown of Vanity", "Damage Dealt", 200f, "Percent damage dealt for each stack of Hubris accrued.", new List<string> { "EQUIPMENT_VANITY_DESC" });

	public static float damageDealtPercentPerStack = damageDealtPerStack.Value / 100f;

	public static ConfigurableValue<float> coefficient = new ConfigurableValue<float>("Equipment: Crown of Vanity", "Proc Coefficient", 2f, "Proc coefficient for the single damage instance on equipment use.", new List<string> { "EQUIPMENT_VANITY_DESC" });

	public static ConfigurableValue<int> equipCooldown = new ConfigurableValue<int>("Equipment: Crown of Vanity", "Cooldown", 30, "Equipment cooldown.", new List<string> { "EQUIPMENT_VANITY_DESC" });

	internal static void Init()
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: 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_007a: Expected O, but got Unknown
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Expected O, but got Unknown
		//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)
		GenerateEquipment();
		GenerateBuff();
		vanityTargetIndicatorPrefab = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/WoodSpriteIndicator"), "TooManyItems_vanityTargetIndicator", false);
		vanityTargetIndicatorPrefab.GetComponentInChildren<SpriteRenderer>().color = Utils.VANITY_COLOR;
		((Graphic)vanityTargetIndicatorPrefab.GetComponentInChildren<TextMeshPro>()).color = Utils.VANITY_COLOR;
		implosionEffectObject = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteIce/AffixWhiteExplosion.prefab").WaitForCompletion();
		ContentAddition.AddEffect(implosionEffectObject);
		ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
		ItemAPI.Add(new CustomEquipment(equipmentDef, val));
		ContentAddition.AddBuffDef(hubrisDebuff);
		damageType = DamageAPI.ReserveDamageType();
		Hooks();
	}

	private static void GenerateEquipment()
	{
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		equipmentDef = ScriptableObject.CreateInstance<EquipmentDef>();
		((Object)equipmentDef).name = "VANITY";
		equipmentDef.AutoPopulateTokens();
		equipmentDef.pickupIconSprite = AssetHandler.bundle.LoadAsset<Sprite>("Vanity.png");
		equipmentDef.pickupModelPrefab = AssetHandler.bundle.LoadAsset<GameObject>("Vanity.prefab");
		equipmentDef.isLunar = true;
		equipmentDef.colorIndex = (ColorIndex)4;
		equipmentDef.appearsInMultiPlayer = true;
		equipmentDef.appearsInSinglePlayer = true;
		equipmentDef.canBeRandomlyTriggered = false;
		equipmentDef.enigmaCompatible = false;
		equipmentDef.canDrop = true;
		equipmentDef.cooldown = equipCooldown.Value;
	}

	private static void GenerateBuff()
	{
		hubrisDebuff = ScriptableObject.CreateInstance<BuffDef>();
		((Object)hubrisDebuff).name = "Hubris";
		hubrisDebuff.iconSprite = AssetHandler.bundle.LoadAsset<Sprite>("Hubris.png");
		hubrisDebuff.canStack = true;
		hubrisDebuff.isHidden = false;
		hubrisDebuff.isDebuff = true;
		hubrisDebuff.isCooldown = false;
	}

	public static void Hooks()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Expected O, but got Unknown
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Expected O, but got Unknown
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Expected O, but got Unknown
		//IL_00a9: 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_00b4: Expected O, but got Unknown
		object obj = <>c.<>9__16_0;
		if (obj == null)
		{
			hook_Start val = delegate(orig_Start orig, EquipmentSlot self)
			{
				orig.Invoke(self);
				((Component)self).gameObject.AddComponent<EquipmentTargeter>();
			};
			<>c.<>9__16_0 = val;
			obj = (object)val;
		}
		EquipmentSlot.Start += (hook_Start)obj;
		object obj2 = <>c.<>9__16_1;
		if (obj2 == null)
		{
			hook_Update val2 = delegate(orig_Update orig, EquipmentSlot self)
			{
				//IL_0028: 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)
				orig.Invoke(self);
				EquipmentTargeter component = ((Component)self).gameObject.GetComponent<EquipmentTargeter>();
				if (Object.op_Implicit((Object)(object)component))
				{
					if (equipmentDef.equipmentIndex == self.equipmentIndex)
					{
						if (self.stock > 0)
						{
							component.ConfigureTargetFinderForEnemies(self);
							HurtBox val6 = component.search.GetResults().FirstOrDefault();
							if (Object.op_Implicit((Object)(object)val6))
							{
								component.obj = ((Component)val6.healthComponent).gameObject;
								component.indicator.visualizerPrefab = vanityTargetIndicatorPrefab;
								component.indicator.targetTransform = ((Component)val6).transform;
							}
							else
							{
								component.Invalidate();
							}
							component.indicator.active = Object.op_Implicit((Object)(object)val6);
						}
						else
						{
							component.Invalidate();
							component.indicator.active = false;
						}
					}
					else
					{
						component.Invalidate();
						component.indicator.active = false;
					}
				}
			};
			<>c.<>9__16_1 = val2;
			obj2 = (object)val2;
		}
		EquipmentSlot.Update += (hook_Update)obj2;
		object obj3 = <>c.<>9__16_2;
		if (obj3 == null)
		{
			hook_PerformEquipmentAction val3 = (orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipDef) => (NetworkServer.active && (Object)(object)equipDef == (Object)(object)equipmentDef) ? OnUse(self) : orig.Invoke(self, equipDef);
			<>c.<>9__16_2 = val3;
			obj3 = (object)val3;
		}
		EquipmentSlot.PerformEquipmentAction += (hook_PerformEquipmentAction)obj3;
		object obj4 = <>c.<>9__16_3;
		if (obj4 == null)
		{
			StatHookEventHandler val4 = delegate(CharacterBody sender, StatHookEventArgs args)
			{
				if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
				{
					args.damageMultAdd -= Utils.GetExponentialStacking(damageLostPercentPerStack, sender.GetBuffCount(hubrisDebuff));
				}
			};
			<>c.<>9__16_3 = val4;
			obj4 = (object)val4;
		}
		RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj4;
		object obj5 = <>c.<>9__16_4;
		if (obj5 == null)
		{
			hook_HandleOnKillEffectsServer val5 = delegate(orig_HandleOnKillEffectsServer orig, CharacterBody self, DamageReport damageReport)
			{
				//IL_0025: 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_003c: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, damageReport);
				if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.equipmentSlot) && self.equipmentSlot.equipmentIndex == equipmentDef.equipmentIndex && !DamageAPI.HasModdedDamageType(damageReport.damageInfo, damageType))
				{
					self.AddBuff(hubrisDebuff);
				}
			};
			<>c.<>9__16_4 = val5;
			obj5 = (object)val5;
		}
		CharacterBody.HandleOnKillEffectsServer += (hook_HandleOnKillEffectsServer)obj5;
	}

	private static bool OnUse(EquipmentSlot slot)
	{
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: 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_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Expected O, but got Unknown
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: 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_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Expected O, but got Unknown
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		EquipmentTargeter component = ((Component)slot).GetComponent<EquipmentTargeter>();
		CharacterBody val = ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.obj)) ? component.obj.GetComponent<CharacterBody>() : null);
		CharacterBody characterBody = slot.characterBody;
		if (Object.op_Implicit((Object)(object)characterBody) && Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent))
		{
			int buffCount = characterBody.GetBuffCount(hubrisDebuff);
			EffectManager.SpawnEffect(implosionEffectObject, new EffectData
			{
				origin = val.corePosition,
				scale = 0.2f * (float)buffCount + val.radius,
				color = Color32.op_Implicit(Utils.VANITY_COLOR)
			}, true);
			characterBody.SetBuffCount(hubrisDebuff.buffIndex, 0);
			float damage = characterBody.damage * damageDealtPercentPerStack * (float)buffCount;
			DamageInfo val2 = new DamageInfo
			{
				damage = damage,
				attacker = ((Component)characterBody).gameObject,
				inflictor = ((Component)characterBody).gameObject,
				procCoefficient = coefficient.Value,
				position = val.corePosition,
				crit = characterBody.RollCrit(),
				damageColorIndex = damageColor,
				procChainMask = default(ProcChainMask),
				damageType = DamageTypeCombo.op_Implicit((DamageType)264258)
			};
			DamageAPI.AddModdedDamageType(val2, damageType);
			val.healthComponent.TakeDamage(val2);
			return true;
		}
		return false;
	}
}
internal class TatteredScroll
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_PerformEquipmentAction <>9__11_0;

		public static Action<DamageReport> <>9__11_1;

		internal bool <Hooks>b__11_0(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipDef)
		{
			if (NetworkServer.active && (Object)(object)equipDef == (Object)(object)equipmentDef)
			{
				return OnUse(self);
			}
			return orig.Invoke(self, equipDef);
		}

		internal void <Hooks>b__11_1(DamageReport damageReport)
		{
			if (NetworkServer.active && Object.op_Implicit((Object)(object)damageReport.victimBody) && damageReport.victimBody.HasBuff(curseDebuff) && Object.op_Implicit((Object)(object)damageReport.attackerMaster))
			{
				damageReport.attackerMaster.GiveMoney(Utils.ScaleGoldWithDifficulty(goldGranted.Value));
			}
		}
	}

	public static EquipmentDef equipmentDef;

	public static BuffDef curseDebuff;

	public static DamageColorIndex damageColor = DamageColorAPI.RegisterDamageColor(Utils.TATTERED_SCROLL_COLOR);

	public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Equipment: Tattered Scroll", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string> { "EQUIPMENT_TATTEREDSCROLL_DESC" });

	public static ConfigurableValue<int> curseDistance = new ConfigurableValue<int>("Equipment: Tattered Scroll", "Curse Distance", 60, "Max distance that the curse can reach.", new List<string> { "EQUIPMENT_TATTEREDSCROLL_DESC" });

	public static ConfigurableValue<float> curseDuration = new ConfigurableValue<float>("Equipment: Tattered Scroll", "Curse Duration", 10f, "Duration of the curse.", new List<string> { "EQUIPMENT_TATTEREDSCROLL_DESC" });

	public static ConfigurableValue<int> goldGranted = new ConfigurableValue<int>("Equipment: Tattered Scroll", "Gold Granted", 20, "Gold gained for each cursed enemy killed.", new List<string> { "EQUIPMENT_TATTEREDSCROLL_DESC" });

	public static ConfigurableValue<int> equipCooldown = new ConfigurableValue<int>("Equipment: Tattered Scroll", "Cooldown", 100, "Equipment cooldown.", new List<string> { "EQUIPMENT_TATTEREDSCROLL_DESC" });

	internal static void Init()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		GenerateEquipment();
		GenerateBuff();
		ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
		ItemAPI.Add(new CustomEquipment(equipmentDef, val));
		ContentAddition.AddBuffDef(curseDebuff);
		Hooks();
	}

	private static void GenerateEquipment()
	{
		equipmentDef = ScriptableObject.CreateInstance<EquipmentDef>();
		((Object)equipmentDef).name = "TATTEREDSCROLL";
		equipmentDef.AutoPopulateTokens();
		equipmentDef.pickupIconSprite = AssetHandler.bundle.LoadAsset<Sprite>("TatteredScroll.png");
		equipmentDef.pickupModelPrefab = AssetHandler.bundle.LoadAsset<GameObject>("TatteredScroll.prefab");
		equipmentDef.appearsInMultiPlayer = true;
		equipmentDef.appearsInSinglePlayer = true;
		equipmentDef.canBeRandomlyTriggered = true;
		equipmentDef.enigmaCompatible = true;
		equipmentDef.canDrop = true;
		equipmentDef.cooldown = equipCooldown.Value;
	}

	private static void GenerateBuff()
	{
		curseDebuff = ScriptableObject.CreateInstance<BuffDef>();
		((Object)curseDebuff).name = "Siphon";
		curseDebuff.iconSprite = AssetHandler.bundle.LoadAsset<Sprite>("TatteredCurse.png");
		curseDebuff.canStack = false;
		curseDebuff.isHidden = false;
		curseDebuff.isDebuff = true;
		curseDebuff.isCooldown = false;
	}

	public static void Hooks()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		object obj = <>c.<>9__11_0;
		if (obj == null)
		{
			hook_PerformEquipmentAction val = (orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipDef) => (NetworkServer.active && (Object)(object)equipDef == (Object)(object)equipmentDef) ? OnUse(self) : orig.Invoke(self, equipDef);
			<>c.<>9__11_0 = val;
			obj = (object)val;
		}
		EquipmentSlot.PerformEquipmentAction += (hook_PerformEquipmentAction)obj;
		GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport damageReport)
		{
			if (NetworkServer.active && Object.op_Implicit((Object)(object)damageReport.victimBody) && damageReport.victimBody.HasBuff(curseDebuff) && Object.op_Implicit((Object)(object)damageReport.attackerMaster))
			{
				damageReport.attackerMaster.GiveMoney(Utils.ScaleGoldWithDifficulty(goldGranted.Value));
			}
		};
	}

	private static bool OnUse(EquipmentSlot slot)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: 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_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_002e: 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_00a6: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: 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_00f8: 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_00fe: 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_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Expected O, but got Unknown
		HurtBox[] hurtBoxes = new SphereSearch
		{
			mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
			origin = slot.characterBody.corePosition,
			queryTriggerInteraction = (QueryTriggerInteraction)2,
			radius = curseDistance.Value
		}.RefreshCandidates().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes();
		HurtBox[] array = hurtBoxes;
		foreach (HurtBox val in array)
		{
			CharacterBody body = val.healthComponent.body;
			if (Object.op_Implicit((Object)(object)body) && (Object)(object)body != (Object)(object)slot.characterBody && !body.isPlayerControlled)
			{
				body.healthComponent.TakeDamage(new DamageInfo
				{
					damage = slot.characterBody.damage,
					attacker = ((Component)slot.characterBody).gameObject,
					inflictor = ((Component)slot.characterBody).gameObject,
					procCoefficient = 0f,
					position = body.corePosition,
					crit = false,
					damageColorIndex = damageColor,
					procChainMask = default(ProcChainMask),
					damageType = DamageTypeCombo.op_Implicit((DamageType)2048)
				});
				body.AddTimedBuff(curseDebuff, curseDuration.Value);
			}
		}
		return true;
	}
}
internal class AncientCoin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static GenericGameEvents.DamageAttackerVictimEventHandler <>9__8_0;

		public static hook_GiveMoney <>9__8_1;

		internal void <Hooks>b__8_0(DamageInfo damageInfo, TooManyItems.GenericCharacterInfo attackerInfo, TooManyItems.GenericCharacterInfo victimInfo)
		{
			if (!((Object)(object)victimInfo.inventory == (Object)null) && !((Object)(object)victimInfo.body == (Object)null))
			{
				int itemCount = victimInfo.inventory.GetItemCount(itemDef);
				if (itemCount > 0)
				{
					damageInfo.damage *= 1f + (float)itemCount * damageMultiplierAsPercent;
				}
			}
		}

		internal void <Hooks>b__8_1(orig_GiveMoney orig, CharacterMaster self, uint amount)
		{
			if (!((Object)(object)self.inventory == (Object)null))
			{
				int itemCount = self.inventory.GetItemCount(itemDef);
				if (itemCount > 0)
				{
					float num = 1f + (float)itemCount * goldMultiplierAsPercent;
					amount = Convert.ToUInt32((float)amount * num);
				}
				orig.Invoke(self, amount);
			}
		}
	}

	public static ItemDef itemDef;

	public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Item: Ancient Coin", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string> { "ITEM_ANCIENTCOIN_DESC" });

	public static ConfigurableValue<float> goldMultiplierPerStack = new ConfigurableValue<float>("Item: Ancient Coin", "Gold Multiplier", 100f, "Gold generation increase as a percentage.", new List<string> { "ITEM_ANCIENTCOIN_DESC" });

	public static ConfigurableValue<float> damageMultiplierPerStack = new ConfigurableValue<float>("Item: Ancient Coin", "Damage Multiplier", 25f, "Damage taken increase as a percentage.", new List<string> { "ITEM_ANCIENTCOIN_DESC" });

	public static float goldMultiplierAsPercent = goldMultiplierPerStack.Value / 100f;

	public static float damageMultiplierAsPercent = damageMultiplierPerStack.Value / 100f;

	internal static void Init()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Expected O, but got Unknown
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		GenerateItem();
		ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
		ItemAPI.Add(new CustomItem(itemDef, val));
		Hooks();
	}

	private static void GenerateItem()
	{
		itemDef = ScriptableObject.CreateInstance<ItemDef>();
		((Object)itemDef).name = "ANCIENTCOIN";
		itemDef.AutoPopulateTokens();
		Utils.SetItemTier(itemDef, (ItemTier)3);
		itemDef.pickupIconSprite = AssetHandler.bundle.LoadAsset<Sprite>("AncientCoin.png");
		itemDef.pickupModelPrefab = AssetHandler.bundle.LoadAsset<GameObject>("AncientCoin.prefab");
		itemDef.canRemove = true;
		itemDef.hidden = false;
	}

	public static void Hooks()
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Expected O, but got Unknown
		GenericGameEvents.BeforeTakeDamage += delegate(DamageInfo damageInfo, TooManyItems.GenericCharacterInfo attackerInfo, TooManyItems.GenericCharacterInfo victimInfo)
		{
			if (!((Object)(object)victimInfo.inventory == (Object)null) && !((Object)(object)victimInfo.body == (Object)null))
			{
				int itemCount2 = victimInfo.inventory.GetItemCount(itemDef);
				if (itemCount2 > 0)
				{
					damageInfo.damage *= 1f + (float)itemCount2 * damageMultiplierAsPercent;
				}
			}
		};
		object obj = <>c.<>9__8_1;
		if (obj == null)
		{
			hook_GiveMoney val = delegate(orig_GiveMoney orig, CharacterMaster self, uint amount)
			{
				if (!((Object)(object)self.inventory == (Object)null))
				{
					int itemCount = self.inventory.GetItemCount(itemDef);
					if (itemCount > 0)
					{
						float num = 1f + (float)itemCount * goldMultiplierAsPercent;
						amount = Convert.ToUInt32((float)amount * num);
					}
					orig.Invoke(self, amount);
				}
			};
			<>c.<>9__8_1 = val;
			obj = (object)val;
		}
		CharacterMaster.GiveMoney += (hook_GiveMoney)obj;
	}
}
internal class CarvingBlade
{
	public class Statistics : MonoBehaviour
	{
		public class Sync : INetMessage, ISerializableObject
		{
			private NetworkInstanceId objId;

			private float totalDamageDealt;

			public Sync()
			{
			}

			public Sync(NetworkInstanceId objId, float totalDamage)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				this.objId = objId;
				totalDamageDealt = totalDamage;
			}

			public void Deserialize(NetworkReader reader)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				objId = reader.ReadNetworkId();
				totalDamageDealt = reader.ReadSingle();
			}

			public void OnReceived()
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				if (NetworkServer.active)
				{
					return;
				}
				GameObject val = Util.FindNetworkObject(objId);
				if ((Object)(object)val != (Object)null)
				{
					Statistics component = val.GetComponent<Statistics>();
					if ((Object)(object)component != (Object)null)
					{
						component.TotalDamageDealt = totalDamageDealt;
					}
				}
			}

			public void Serialize(NetworkWriter writer)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				writer.Write(objId);
				writer.Write(totalDamageDealt);
				writer.FinishMessage();
			}
		}

		private float _totalDamageDealt;

		public float TotalDamageDealt
		{
			get
			{
				return _totalDamageDealt;
			}
			set
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				_totalDamageDealt = value;
				if (NetworkServer.active)
				{
					NetMessageExtensions.Send((INetMessage)(object)new Sync(((Component)this).gameObject.GetComponent<NetworkIdentity>().netId, value), (NetworkDestination)1);
				}
			}
		}
	}

	public static ItemDef itemDef;

	public static ModdedDamageType damageType;

	public static DamageColorIndex damageColor = DamageColorAPI.RegisterDamageColor(Utils.CARVING_BLADE_COLOR);

	public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Item: Carving Blade", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string> { "ITEM_CARVINGBLADE_DESC" });

	public static ConfigurableValue<float> currentHPDamage = new ConfigurableValue<float>("Item: Carving Blade", "On-Hit Damage Scaling", 2f, "Percent of enemy's current health dealt as bonus on-hit damage.", new List<string> { "ITEM_CARVINGBLADE_DESC" });

	public static ConfigurableValue<float> damageCapMultiplier = new ConfigurableValue<float>("Item: Carving Blade", "Damage Cap", 2000f, "Maximum damage on-hit. This value is displayed as a percentage of the user's base damage (100 = 1x your base damage).", new List<string> { "ITEM_CARVINGBLADE_DESC" });

	public static ConfigurableValue<float> damageCapMultiplierExtraStacks = new ConfigurableValue<float>("Item: Carving Blade", "Damage Cap Extra Stacks", 1000f, "Maximum damage on-hit with extra stacks. This value is displayed as a percentage of the user's base damage (100 = 1x your base damage).", new List<string> { "ITEM_CARVINGBLADE_DESC" });

	public static float currentHPDamageAsPercent = currentHPDamage.Value / 100f;

	public static float damageCapMultAsPercent = damageCapMultiplier.Value / 100f;

	public static float damageCapMultExtraStacksAsPercent = damageCapMultiplierExtraStacks.Value / 100f;

	internal static void Init()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Expected O, but got Unknown
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		//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)
		GenerateItem();
		ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
		ItemAPI.Add(new CustomItem(itemDef, val));
		NetworkingAPI.RegisterMessageType<Statistics.Sync>();
		damageType = DamageAPI.ReserveDamageType();
		Hooks();
	}

	private static void GenerateItem()
	{
		itemDef = ScriptableObject.CreateInstance<ItemDef>();
		((Object)itemDef).name = "CARVINGBLADE";
		itemDef.AutoPopulateTokens();
		Utils.SetItemTier(itemDef, (ItemTier)3);
		itemDef.pickupIconSprite = AssetHandler.bundle.LoadAsset<Sprite>("CarvingBlade.png");
		itemDef.pickupModelPrefab = AssetHandler.bundle.LoadAsset<GameObject>("CarvingBlade.prefab");
		itemDef.canRemove = true;
		itemDef.hidden = false;
	}

	public static float CalculateDamageCapPercent(int itemCount)
	{
		return damageCapMultAsPercent + damageCapMultExtraStacksAsPercent * (float)(itemCount - 1);
	}

	public static void Hooks()
	{
		CharacterMaster.onStartGlobal += delegate(CharacterMaster obj)
		{
			Inventory inventory = obj.inventory;
			if (inventory != null)
			{
				((Component)inventory).gameObject.AddComponent<Statistics>();
			}
		};
		GenericGameEvents.BeforeTakeDamage += delegate(DamageInfo damageInfo, TooManyItems.GenericCharacterInfo attackerInfo, TooManyItems.GenericCharacterInfo victimInfo)
		{
			if (Object.op_Implicit((Object)(object)attackerInfo.inventory) && attackerInfo.inventory.GetItemCount(itemDef) > 0)
			{
				damageInfo.crit = false;
			}
		};
		GenericGameEvents.OnHitEnemy += delegate(DamageInfo damageInfo, TooManyItems.GenericCharacterInfo attackerInfo, TooManyItems.GenericCharacterInfo victimInfo)
		{
			//IL_004c: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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_00f8: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)attackerInfo.body) && Object.op_Implicit((Object)(object)victimInfo.body) && Object.op_Implicit((Object)(object)attackerInfo.inventory))
			{
				int itemCount = attackerInfo.inventory.GetItemCount(itemDef);
				if (itemCount > 0 && attackerInfo.teamComponent.teamIndex != victimInfo.teamComponent.teamIndex)
				{
					float num = Mathf.Max(victimInfo.body.healthComponent.health * currentHPDamageAsPercent, 0.01f);
					if (damageCapMultiplier.Value < 0f)
					{
						damageCapMultAsPercent = 40f;
					}
					num = Mathf.Min(num, attackerInfo.body.damage * CalculateDamageCapPercent(itemCount));
					DamageInfo val = new DamageInfo
					{
						damage = num,
						attacker = attackerInfo.gameObject,
						inflictor = attackerInfo.gameObject,
						procCoefficient = 0f,
						position = damageInfo.position,
						crit = false,
						damageColorIndex = damageColor,
						procChainMask = damageInfo.procChainMask,
						damageType = DamageTypeCombo.op_Implicit((DamageType)2048)
					};
					DamageAPI.AddModdedDamageType(val, damageType);
					victimInfo.healthComponent.TakeDamage(val);
					CharacterBody minionOwnershipParentBody = Utils.GetMinionOwnershipParentBody(attackerInfo.body);
					((Component)minionOwnershipParentBody.inventory).GetComponent<Statistics>().TotalDamageDealt += num;
				}
			}
		};
	}
}
internal class Crucifix
{
	public static ItemDef itemDef;

	public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Item: Crucifix", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string> { "ITEM_CRUCIFIX_DESC" });

	public static ConfigurableValue<float> damageReduction = new ConfigurableValue<float>("Item: Crucifix", "Damage Reduction", 40f, "Percentage of damage reduced.", new List<string> { "ITEM_CRUCIFIX_DESC" });

	public static ConfigurableValue<float> maxHealthBurnAmount = new ConfigurableValue<float>("Item: Crucifix", "Burn Amount", 5f, "Percentage of max health taken over the duration of the burn.", new List<string> { "ITEM_CRUCIFIX_DESC" });

	public static ConfigurableValue<int> fireDuration = new ConfigurableValue<int>("Item: Crucifix", "Duration of Fire", 3, "Duration of fire debuff after taking damage.", new List<string> { "ITEM_CRUCIFIX_DESC" });

	public static float damageReductionPercent = damageReduction.Value / 100f;

	internal static void Init()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Expected O, but got Unknown
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		GenerateItem();
		ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
		ItemAPI.Add(new CustomItem(itemDef, val));
		Hooks();
	}

	private static void GenerateItem()
	{
		itemDef = ScriptableObject.CreateInstance<ItemDef>();
		((Object)itemDef).name = "CRUCIFIX";
		itemDef.AutoPopulateTokens();
		Utils.SetItemTier(itemDef, (ItemTier)3);
		itemDef.pickupIconSprite = AssetHandler.bundle.LoadAsset<Sprite>("Crucifix.png");
		itemDef.pickupModelPrefab = AssetHandler.bundle.LoadAsset<GameObject>("Crucifix.prefab");
		itemDef.canRemove = true;
		itemDef.hidden = false;
	}

	public static void Hooks()
	{
		GenericGameEvents.BeforeTakeDamage += delegate(DamageInfo damageInfo, TooManyItems.GenericCharacterInfo attackerInfo, TooManyItems.GenericCharacterInfo victimInfo)
		{
			//IL_0080: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)victimInfo.inventory == (Object)null) && !((Object)(object)victimInfo.body == (Object)null) && !((Object)(object)attackerInfo.body == (Object)null))
			{
				int itemCount = victimInfo.inventory.GetItemCount(itemDef);
				if (itemCount > 0 && (Object)(object)attackerInfo.body != (Object)(object)victimInfo.body)
				{
					damageInfo.damage *= 1f - damageReductionPercent;
					InflictDotInfo val = default(InflictDotInfo);
					val.victimObject = ((Component)victimInfo.body).gameObject;
					val.attackerObject = ((Component)victimInfo.body).gameObject;
					val.totalDamage = victimInfo.body.healthComponent.fullCombinedHealth * maxHealthBurnAmount.Value / 100f;
					val.dotIndex = (DotIndex)1;
					val.duration = fireDuration.Value * itemCount;
					val.damageMultiplier = 1f;
					InflictDotInfo val2 = val;
					DotController.InflictDot(ref val2);
				}
			}
		};
	}
}
internal class SpiritStone
{
	public class Statistics : MonoBehaviour
	{
		public class Sync : INetMessage, ISerializableObject
		{
			private NetworkInstanceId objId;

			private float permanentShield;

			public Sync()
			{
			}

			public Sync(NetworkInstanceId objId, float shield)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				this.objId = objId;
				permanentShield = shield;
			}

			public void Deserialize(NetworkReader reader)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				objId = reader.ReadNetworkId();
				permanentShield = reader.ReadSingle();
			}

			public void OnReceived()
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				if (NetworkServer.active)
				{
					return;
				}
				GameObject val = Util.FindNetworkObject(objId);
				if ((Object)(object)val != (Object)null)
				{
					Statistics component = val.GetComponent<Statistics>();
					if ((Object)(object)component != (Object)null)
					{
						component.PermanentShield = permanentShield;
					}
				}
			}

			public void Serialize(NetworkWriter writer)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				writer.Write(objId);
				writer.Write(permanentShield);
				writer.FinishMessage();
			}
		}

		private float _permanentShield;

		public float PermanentShield
		{
			get
			{
				return _permanentShield;
			}
			set
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				_permanentShield = value;
				if (NetworkServer.active)
				{
					NetMessageExtensions.Send((INetMessage)(object)new Sync(((Component)this).gameObject.GetComponent<NetworkIdentity>().netId, value), (NetworkDestination)1);
				}
			}
		}
	}

	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static Action<CharacterMaster> <>9__8_0;

		public static StatHookEventHandler <>9__8_1;

		public static hook_GetHealthBarValues <>9__8_2;

		public static Action<DamageReport> <>9__8_3;

		internal void <Hooks>b__8_0(CharacterMaster obj)
		{
			Inventory inventory = obj.inventory;
			if (inventory != null)
			{
				((Component)inventory).gameObject.AddComponent<Statistics>();
			}
		}

		internal void <Hooks>b__8_1(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
			{
				int itemCount = sender.inventory.GetItemCount(itemDef);
				if (itemCount > 0)
				{
					Statistics component = ((Component)sender.inventory).GetComponent<Statistics>();
					args.baseShieldAdd += component.PermanentShield;
					args.healthMultAdd -= Utils.GetExponentialStacking(maxHealthLostPercent, itemCount);
				}
			}
		}

		internal HealthBarValues <Hooks>b__8_2(orig_GetHealthBarValues orig, HealthComponent self)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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_00b8: 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)
			//IL_005e: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			HealthBarValues val = orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)self.body.inventory))
			{
				int itemCount = self.body.inventory.GetItemCount(itemDef);
				if (itemCount > 0)
				{
					val.curseFraction += (1f - val.curseFraction) * Utils.GetExponentialStacking(maxHealthLostPercent, itemCount);
					val.healthFraction = self.health * (1f - val.curseFraction) / self.fullCombinedHealth;
					val.shieldFraction = self.shield * (1f - val.curseFraction) / self.fullCombinedHealth;
				}
			}
			return val;
		}

		internal void <Hooks>b__8_3(DamageReport damageReport)
		{
			if (!NetworkServer.active)
			{
				return;
			}
			CharacterBody attackerBody = damageReport.attackerBody;
			if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)attackerBody.inventory))
			{
				int itemCount = attackerBody.inventory.GetItemCount(itemDef);
				if (itemCount > 0)
				{
					((Component)attackerBody.inventory).GetComponent<Statistics>().PermanentShield += (float)shieldPerKill * (float)itemCount;
					Utils.ForceRecalculate(attackerBody);
				}
			}
		}
	}

	public static ItemDef itemDef;

	public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Item: Spirit Stone", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string> { "ITEM_SPIRITSTONE_DESC" });

	public static ConfigurableValue<float> shieldPerKill = new ConfigurableValue<float>("Item: Spirit Stone", "Shield Amount", 1f, "Health given as shield for every kill.", new List<string> { "ITEM_SPIRITSTONE_DESC" });

	public static ConfigurableValue<float> maxHealthLost = new ConfigurableValue<float>("Item: Spirit Stone", "Max Health Reduction", 30f, "Max health lost as a penalty for holding this item.", new List<string> { "ITEM_SPIRITSTONE_DESC" });

	public static float maxHealthLostPercent = maxHealthLost.Value / 100f;

	internal static void Init()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Expected O, but got Unknown
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		GenerateItem();
		ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
		ItemAPI.Add(new CustomItem(itemDef, val));
		NetworkingAPI.RegisterMessageType<Statistics.Sync>();
		Hooks();
	}

	private static void GenerateItem()
	{
		itemDef = ScriptableObject.CreateInstance<ItemDef>();
		((Object)itemDef).name = "SPIRITSTONE";
		itemDef.AutoPopulateTokens();
		Utils.SetItemTier(itemDef, (ItemTier)3);
		itemDef.pickupIconSprite = AssetHandler.bundle.LoadAsset<Sprite>("SpiritStone.png");
		itemDef.pickupModelPrefab = AssetHandler.bundle.LoadAsset<GameObject>("SpiritStone.prefab");
		itemDef.canRemove = true;
		itemDef.hidden = false;
		itemDef.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)6 };
	}

	public static void Hooks()
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Expected O, but got Unknown
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Expected O, but got Unknown
		CharacterMaster.onStartGlobal += delegate(CharacterMaster obj)
		{
			Inventory inventory = obj.inventory;
			if (inventory != null)
			{
				((Component)inventory).gameObject.AddComponent<Statistics>();
			}
		};
		object obj2 = <>c.<>9__8_1;
		if (obj2 == null)
		{
			StatHookEventHandler val = delegate(CharacterBody sender, StatHookEventArgs args)
			{
				if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
				{
					int itemCount3 = sender.inventory.GetItemCount(itemDef);
					if (itemCount3 > 0)
					{
						Statistics component = ((Component)sender.inventory).GetComponent<Statistics>();
						args.baseShieldAdd += component.PermanentShield;
						args.healthMultAdd -= Utils.GetExponentialStacking(maxHealthLostPercent, itemCount3);
					}
				}
			};
			<>c.<>9__8_1 = val;
			obj2 = (object)val;
		}
		RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj2;
		object obj3 = <>c.<>9__8_2;
		if (obj3 == null)
		{
			hook_GetHealthBarValues val2 = delegate(orig_GetHealthBarValues orig, HealthComponent self)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: 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_00b8: 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)
				//IL_005e: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
				HealthBarValues val3 = orig.Invoke(self);
				if (Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)self.body.inventory))
				{
					int itemCount2 = self.body.inventory.GetItemCount(itemDef);
					if (itemCount2 > 0)
					{
						val3.curseFraction += (1f - val3.curseFraction) * Utils.GetExponentialStacking(maxHealthLostPercent, itemCount2);
						val3.healthFraction = self.health * (1f - val3.curseFraction) / self.fullCombinedHealth;
						val3.shieldFraction = self.shield * (1f - val3.curseFraction) / self.fullCombinedHealth;
					}
				}
				return val3;
			};
			<>c.<>9__8_2 = val2;
			obj3 = (object)val2;
		}
		HealthComponent.GetHealthBarValues += (hook_GetHealthBarValues)obj3;
		GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport damageReport)
		{
			if (NetworkServer.active)
			{
				CharacterBody attackerBody = damageReport.attackerBody;
				if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)attackerBody.inventory))
				{
					int itemCount = attackerBody.inventory.GetItemCount(itemDef);
					if (itemCount > 0)
					{
						((Component)attackerBody.inventory).GetComponent<Statistics>().PermanentShield += (float)shieldPerKill * (float)itemCount;
						Utils.ForceRecalculate(attackerBody);
					}
				}
			}
		};
	}
}
internal class BottleCap
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static StatHookEventHandler <>9__6_0;

		internal void <Hooks>b__6_0(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
			{
				int itemCount = sender.inventory.GetItemCount(itemDef);
				if (itemCount > 0)
				{
					float hyperbolicStacking = Utils.GetHyperbolicStacking(specialCDRPercent, itemCount);
					args.specialCooldownMultAdd -= hyperbolicStacking;
				}
			}
		}
	}

	public static ItemDef itemDef;

	public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Item: Bottle Cap", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string> { "ITEM_BOTTLECAP_DESC" });

	public static ConfigurableValue<float> specialCDR = new ConfigurableValue<float>("Item: Bottle Cap", "Cooldown Reduction", 10f, "Percent cooldown reduction on special skill.", new List<string> { "ITEM_BOTTLECAP_DESC" });

	public static float specialCDRPercent = specialCDR.Value / 100f;

	internal static void Init()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Expected O, but got Unknown
		//IL_0014: Unknown result type (might be due to inv