Decompiled source of CustomItems v1.1.0

CustomItems.dll

Decompiled 7 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Characters;
using Characters.Abilities;
using Characters.Abilities.CharacterStat;
using Characters.Actions;
using Characters.Actions.Constraints;
using Characters.Cooldowns.Streaks;
using Characters.Gear;
using Characters.Gear.Items;
using Characters.Gear.Synergy.Inscriptions;
using Characters.Gear.Upgrades;
using Characters.Gear.Weapons;
using Characters.Movements;
using Characters.Operations.Movement;
using Characters.Player;
using CustomItems;
using CustomItems.CustomAbilities;
using Data;
using GameResources;
using HarmonyLib;
using Level;
using Microsoft.CodeAnalysis;
using Services;
using Singletons;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Plugins.Common")]
[assembly: IgnoresAccessChecksTo("Plugins.Singletons")]
[assembly: IgnoresAccessChecksTo("Unity.Addressables")]
[assembly: AssemblyCompany("CustomItems")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Archlich has a fixed Death Trap skill. Infinite bone is happy again!")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("CustomItems")]
[assembly: AssemblyTitle("CustomItems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[Serializable]
public sealed class CloneCloneClone : MonoBehaviour
{
	[SerializeField]
	private Item _item;

	private static Key[] keywords = Enum.GetValues(typeof(Key)).Cast<Key>().ToArray();

	private static Dictionary<Key, int> keywordIndexes = keywords.Select((Key value, int index) => new { value, index }).ToDictionary(keyword => keyword.value, keyword => keyword.index);

	private HashSet<Key> forbiddenKeywords = new HashSet<Key>
	{
		(Key)0,
		(Key)23,
		(Key)34,
		(Key)35
	};

	private void Awake()
	{
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Expected O, but got Unknown
		CustomItemsPatch.OnInventoryUpdate -= InventoryUpdate;
		CustomItemsPatch.OnInventoryUpdate += InventoryUpdate;
		if (!((Object)(object)_item == (Object)null))
		{
			_item.bonusKeyword = (BonusKeyword[])(object)new BonusKeyword[keywords.Length];
			for (int i = 0; i < keywords.Length; i++)
			{
				_item.bonusKeyword[i] = new BonusKeyword
				{
					keyword = keywords[i],
					type = (Type)3,
					count = 0
				};
			}
		}
	}

	private void OnDestroy()
	{
		CustomItemsPatch.OnInventoryUpdate -= InventoryUpdate;
	}

	private void InventoryUpdate(Inventory inventory)
	{
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: 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_0151: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_item == (Object)null || _item.bonusKeyword == null || _item.bonusKeyword.Length == 0)
		{
			return;
		}
		BonusKeyword[] bonusKeyword = _item.bonusKeyword;
		for (int i = 0; i < bonusKeyword.Length; i++)
		{
			bonusKeyword[i].count = 0;
		}
		foreach (Item item in inventory.item.items)
		{
			if (!((Object)(object)item == (Object)null))
			{
				_item.bonusKeyword[keywordIndexes[item.keyword1]].count = 1;
				_item.bonusKeyword[keywordIndexes[item.keyword2]].count = 1;
			}
		}
		foreach (Key key in Inscription.keys)
		{
			if (inventory.synergy.inscriptions[key].bonusCount > 0)
			{
				_item.bonusKeyword[keywordIndexes[key]].count = 1;
			}
		}
		bonusKeyword = _item.bonusKeyword;
		foreach (BonusKeyword val in bonusKeyword)
		{
			if (forbiddenKeywords.Contains(val.keyword))
			{
				val.count = 0;
			}
			else
			{
				val.count = val.count;
			}
		}
	}
}
[Serializable]
public sealed class DelayedOmenAssigner : MonoBehaviour
{
	[SerializeField]
	private Item _item;

	private void Awake()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		((Gear)_item)._gearTag = (Tag)8;
		_item.keyword1 = (Key)34;
	}
}
[Serializable]
public sealed class OmenKeywordRandomizer : KeywordRandomizer
{
	private void Awake()
	{
		//IL_000d: 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)
		((KeywordRandomizer)this).Awake();
		((Gear)base._item)._gearTag = (Tag)8;
		base._item.keyword1 = (Key)34;
	}
}
[Serializable]
public sealed class UpgradeOnInscriptionCount : MonoBehaviour
{
	[SerializeField]
	private Item _item;

	private void Awake()
	{
		Singleton<Service>.Instance.levelManager.player.playerComponents.inventory.onUpdatedKeywordCounts += CheckUpdateCondition;
	}

	private void OnDestroy()
	{
		Singleton<Service>.Instance.levelManager.player.playerComponents.inventory.onUpdatedKeywordCounts -= CheckUpdateCondition;
	}

	private void CheckUpdateCondition()
	{
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Invalid comparison between Unknown and I4
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: 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_0102: 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_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		ItemReference val = default(ItemReference);
		if (((IEnumerable<Inscription>)Singleton<Service>.Instance.levelManager.player.playerComponents.inventory.synergy.inscriptions).Count((Inscription inscription) => inscription.count > 0) >= 14 && GearResource.instance.TryGetItemReferenceByName(((Object)_item).name + "_2", ref val))
		{
			ItemRequest val2 = val.LoadAsync();
			((Request<Item>)(object)val2).WaitForCompletion();
			if ((int)((Gear)_item).state == 1)
			{
				Item val3 = Singleton<Service>.Instance.levelManager.DropItem(val2, Vector3.zero);
				val3.keyword1 = _item.keyword1;
				val3.keyword2 = _item.keyword2;
				((Gear)val3)._gearTag = ((Gear)_item)._gearTag;
				_item.ChangeOnInventory(val3);
				Bounds bounds = ((Collider2D)((Gear)_item).owner.collider).bounds;
				float x = ((Bounds)(ref bounds)).center.x;
				bounds = ((Collider2D)((Gear)_item).owner.collider).bounds;
				Vector3 val4 = default(Vector3);
				((Vector3)(ref val4))..ctor(x, ((Bounds)(ref bounds)).max.y + 1f, 0f);
				Singleton<Service>.Instance.floatingTextSpawner.SpawnBuff("IT'S INSANITY TIME!", val4, "#F2F2F2");
			}
		}
	}
}
namespace CustomItems
{
	[Serializable]
	public class CustomItemReference : ItemReference
	{
		private string _originalName;

		public string itemName;

		public string itemDescription;

		public string itemLore;

		public Values stats;

		public Ability[] abilities;

		public Type[] extraComponents;

		public string[] forbiddenDrops = new string[0];

		public Sprite miniIcon;

		private Item item;

		private static GameObject rootObj;

		public string name
		{
			get
			{
				return ((GearReference)this).name;
			}
			set
			{
				_originalName = value;
				((GearReference)this).name = "Custom-" + _originalName;
				((GearReference)this).guid = "custom_item://" + value;
				((GearReference)this).displayNameKey = "item/" + ((GearReference)this).name + "/name";
			}
		}

		public CustomItemReference()
		{
			((GearReference)this).obtainable = true;
			((GearReference)this).needUnlock = false;
			((GearReference)this).path = "Assets/Gear/Items/BasicCarleonSword.prefab";
		}

		public Item GetItem(Item baseItem)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Expected O, but got Unknown
			//IL_0186: Expected O, but got Unknown
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Expected O, but got Unknown
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Expected O, but got Unknown
			if ((Object)(object)item == (Object)null)
			{
				if ((Object)(object)rootObj == (Object)null)
				{
					rootObj = new GameObject("CustomItems");
					rootObj.SetActive(false);
					Object.DontDestroyOnLoad((Object)(object)rootObj);
				}
				item = Object.Instantiate<Item>(baseItem, rootObj.transform);
				Object.DontDestroyOnLoad((Object)(object)item);
				((Object)((Component)item).gameObject).name = name;
				item.keyword1 = base.prefabKeyword1;
				item.keyword2 = base.prefabKeyword2;
				((Gear)item)._stat = stats;
				((Gear)item)._rarity = ((GearReference)this).rarity;
				((Gear)item)._gearTag = ((GearReference)this).gearTag;
				((Gear)item)._groupItemKeys = forbiddenDrops.Select((string name) => "Custom-" + name).ToArray();
				LoadSprites();
				if ((Object)(object)((GearReference)this).icon != (Object)null)
				{
					((Gear)item).dropped.spriteRenderer.sprite = ((GearReference)this).icon;
				}
				if (abilities != null && abilities.Length != 0)
				{
					GameObject val = new GameObject("Ability Attacher");
					val.transform.parent = ((Component)item).gameObject.transform;
					Item obj = item;
					Subcomponents val2 = new Subcomponents();
					Subcomponents val3 = val2;
					obj._abilityAttacher = val2;
					Subcomponents val4 = val3;
					((SubcomponentArray<AbilityAttacher>)(object)val4)._container = val;
					((SubcomponentArray<AbilityAttacher>)(object)val4)._components = (AbilityAttacher[])(object)new AbilityAttacher[abilities.Length];
					abilities[0]._defaultIcon = miniIcon;
					for (int i = 0; i < abilities.Length; i++)
					{
						GameObject val5 = new GameObject("[" + i + "]", new Type[1] { typeof(AlwaysAbilityAttacher) });
						val5.transform.parent = val.transform;
						AlwaysAbilityAttacher component = val5.GetComponent<AlwaysAbilityAttacher>();
						component._abilityComponent = CreateAbilityObject(val5, abilities[i]);
						((SubcomponentArray<AbilityAttacher>)(object)val4)._components[i] = (AbilityAttacher)(object)component;
					}
				}
				if (extraComponents != null && extraComponents.Length != 0)
				{
					GameObject val6 = new GameObject("Extra Behaviors");
					val6.transform.parent = ((Component)item).gameObject.transform;
					Type[] array = extraComponents;
					foreach (Type type in array)
					{
						Component obj2 = val6.AddComponent(type);
						FieldInfo fieldInfo = AccessTools.Field(type, "_item");
						if (fieldInfo != null)
						{
							fieldInfo.SetValue(obj2, item);
						}
					}
				}
			}
			return item;
		}

		private static AbilityComponent CreateAbilityObject(GameObject parent, Ability ability)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			Type abilityType = ((object)ability).GetType();
			Assembly assembly = abilityType.Assembly;
			string componentName = abilityType.Name + "Component";
			Type[] array = (from type in assembly.GetTypes()
				where string.Equals(type.Namespace, abilityType.Namespace, StringComparison.Ordinal) && string.Equals(type.Name, componentName, StringComparison.Ordinal)
				select type).ToArray();
			if (array.Length == 1)
			{
				Type type2 = array[0];
				GameObject val = new GameObject("Ability", new Type[1] { type2 });
				val.transform.parent = parent.transform;
				FieldInfo fieldInfo = AccessTools.Field(type2, "_ability");
				Component component = val.GetComponent(type2);
				fieldInfo.SetValue(component, ability);
				return (AbilityComponent)component;
			}
			throw new NotImplementedException("Ability Component Type " + componentName + " not found.");
		}

		public void LoadSprites()
		{
			GetIcon();
			GetThumbnail();
			GetMiniIcon();
		}

		public Sprite GetIcon()
		{
			if ((Object)(object)((GearReference)this).icon == (Object)null)
			{
				((GearReference)this).icon = LoadSprite("Icon", 32f);
			}
			return ((GearReference)this).icon;
		}

		public Sprite GetThumbnail()
		{
			if ((Object)(object)((GearReference)this).thumbnail == (Object)null)
			{
				((GearReference)this).thumbnail = LoadSprite("Thumbnail", 32f);
				if ((Object)(object)((GearReference)this).thumbnail != (Object)null)
				{
					((Object)((GearReference)this).thumbnail).name = name;
				}
			}
			return ((GearReference)this).thumbnail;
		}

		public Sprite GetMiniIcon()
		{
			if ((Object)(object)miniIcon == (Object)null)
			{
				miniIcon = LoadSprite("AbilityIcon", 36f);
				if ((Object)(object)miniIcon != (Object)null)
				{
					((Object)miniIcon).name = name;
				}
			}
			return miniIcon;
		}

		private Sprite LoadSprite(string type, float pixelsPerUnit)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			Sprite result = null;
			try
			{
				Stream manifestResourceStream = typeof(CustomItemReference).Assembly.GetManifestResourceStream("CustomItems.Sprites." + _originalName + "." + type + ".png");
				byte[] array = new byte[manifestResourceStream.Length];
				manifestResourceStream.Read(array, 0, (int)manifestResourceStream.Length);
				Texture2D val = new Texture2D(2, 2);
				ImageConversion.LoadImage(val, array);
				((Texture)val).filterMode = (FilterMode)0;
				Math.Max(((Texture)val).width, ((Texture)val).height);
				result = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), pixelsPerUnit);
			}
			catch (Exception)
			{
			}
			return result;
		}
	}
	public class CustomItems
	{
		public static readonly List<CustomItemReference> Items = InitializeItems();

		private static List<CustomItemReference> InitializeItems()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00d5: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Expected O, but got Unknown
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Expected O, but got Unknown
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Expected O, but got Unknown
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Expected O, but got Unknown
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Expected O, but got Unknown
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Expected O, but got Unknown
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Expected O, but got Unknown
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Expected O, but got Unknown
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Invalid comparison between Unknown and I4
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Expected O, but got Unknown
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Expected O, but got Unknown
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Expected O, but got Unknown
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Expected O, but got Unknown
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Expected O, but got Unknown
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Expected O, but got Unknown
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Expected O, but got Unknown
			//IL_0448: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Expected O, but got Unknown
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Invalid comparison between Unknown and I4
			//IL_0512: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_056a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0570: Expected O, but got Unknown
			//IL_0570: Unknown result type (might be due to invalid IL or missing references)
			//IL_057a: Expected O, but got Unknown
			//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ce: Expected O, but got Unknown
			//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d8: Expected O, but got Unknown
			//IL_05db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Expected O, but got Unknown
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Expected O, but got Unknown
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Expected O, but got Unknown
			//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f2: Expected O, but got Unknown
			//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0610: Unknown result type (might be due to invalid IL or missing references)
			//IL_061a: Expected O, but got Unknown
			//IL_062a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0634: Expected O, but got Unknown
			//IL_0660: Unknown result type (might be due to invalid IL or missing references)
			//IL_0662: Unknown result type (might be due to invalid IL or missing references)
			//IL_066c: Expected O, but got Unknown
			//IL_06a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06df: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fe: Expected O, but got Unknown
			//IL_06fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0705: Expected O, but got Unknown
			//IL_0708: Unknown result type (might be due to invalid IL or missing references)
			//IL_072a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0730: Expected O, but got Unknown
			//IL_0745: Unknown result type (might be due to invalid IL or missing references)
			//IL_074b: Expected O, but got Unknown
			//IL_074b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0755: Expected O, but got Unknown
			//IL_0785: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d1: Expected O, but got Unknown
			//IL_07d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d8: Expected O, but got Unknown
			//IL_07d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07df: Expected O, but got Unknown
			//IL_0814: Unknown result type (might be due to invalid IL or missing references)
			//IL_081a: Expected O, but got Unknown
			//IL_082f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0835: Expected O, but got Unknown
			//IL_0835: Unknown result type (might be due to invalid IL or missing references)
			//IL_083f: Expected O, but got Unknown
			//IL_088b: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08df: Expected O, but got Unknown
			//IL_08df: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ed: Expected O, but got Unknown
			//IL_08ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f4: Expected O, but got Unknown
			//IL_0929: Unknown result type (might be due to invalid IL or missing references)
			//IL_092f: Expected O, but got Unknown
			//IL_0944: Unknown result type (might be due to invalid IL or missing references)
			//IL_094a: Expected O, but got Unknown
			//IL_094a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0954: Expected O, but got Unknown
			//IL_09b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a13: Expected O, but got Unknown
			//IL_0a13: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1d: Expected O, but got Unknown
			//IL_0a50: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a58: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a96: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aad: Expected O, but got Unknown
			//IL_0adb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae1: Expected O, but got Unknown
			//IL_0af6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afc: Expected O, but got Unknown
			//IL_0afc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b06: Expected O, but got Unknown
			//IL_0b17: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1e: Expected O, but got Unknown
			//IL_0b33: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b55: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b5b: Expected O, but got Unknown
			//IL_0b70: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b76: Expected O, but got Unknown
			//IL_0b76: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b80: Expected O, but got Unknown
			//IL_0ba6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bdc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf3: Expected O, but got Unknown
			//IL_0c26: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c53: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c7e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c84: Expected O, but got Unknown
			//IL_0c84: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c8e: Expected O, but got Unknown
			//IL_0c9f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cc8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cfe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d20: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d26: Expected O, but got Unknown
			//IL_0d3b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d41: Expected O, but got Unknown
			//IL_0d41: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d4b: Expected O, but got Unknown
			//IL_0d69: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d96: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d9f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc7: Expected O, but got Unknown
			//IL_0dc7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd1: Expected O, but got Unknown
			//IL_0df7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e24: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e2d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e64: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e6a: Expected O, but got Unknown
			//IL_0e6a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e74: Expected O, but got Unknown
			//IL_0e92: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e9a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ecf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ed8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ee5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eef: Expected O, but got Unknown
			//IL_0f28: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f2e: Expected O, but got Unknown
			//IL_0f2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f38: Expected O, but got Unknown
			//IL_0f68: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f94: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f9d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0faa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fb4: Expected O, but got Unknown
			//IL_0ff4: Unknown result type (might be due to invalid IL or missing references)
			//IL_1020: Unknown result type (might be due to invalid IL or missing references)
			//IL_1028: Unknown result type (might be due to invalid IL or missing references)
			//IL_104a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1050: Expected O, but got Unknown
			//IL_1050: Unknown result type (might be due to invalid IL or missing references)
			//IL_105a: Expected O, but got Unknown
			//IL_107e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1084: Expected O, but got Unknown
			//IL_1099: Unknown result type (might be due to invalid IL or missing references)
			//IL_109f: Expected O, but got Unknown
			//IL_109f: Unknown result type (might be due to invalid IL or missing references)
			//IL_10a9: Expected O, but got Unknown
			//IL_10d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_10e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_1116: Unknown result type (might be due to invalid IL or missing references)
			//IL_111e: Unknown result type (might be due to invalid IL or missing references)
			//IL_112b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1135: Expected O, but got Unknown
			//IL_1197: Unknown result type (might be due to invalid IL or missing references)
			//IL_11c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_11cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_11d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_11e2: Expected O, but got Unknown
			//IL_1260: Unknown result type (might be due to invalid IL or missing references)
			//IL_128c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1294: Unknown result type (might be due to invalid IL or missing references)
			//IL_12a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_12ab: Expected O, but got Unknown
			List<CustomItemReference> list = new List<CustomItemReference>();
			CustomItemReference customItemReference = new CustomItemReference();
			customItemReference.name = "DecidedlyPhysical";
			((GearReference)customItemReference).rarity = (Rarity)3;
			customItemReference.itemName = "Orc King's Bonker";
			customItemReference.itemDescription = "Increases <color=#F25D1C>Physical Attack</color> by 100%.\nYou cannot deal <color=#1787D8>Magic damage</color>.";
			customItemReference.itemLore = "The weapon of the strongest Orc. Once plated in gold, but he could never maintain it; his brute strength would shatter it.";
			((ItemReference)customItemReference).prefabKeyword1 = (Key)5;
			((ItemReference)customItemReference).prefabKeyword2 = (Key)5;
			customItemReference.stats = new Values((Value[])(object)new Value[0]);
			StatBonus val = new StatBonus();
			val._stat = new Values((Value[])(object)new Value[2]
			{
				new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 1.0),
				new Value(Category.Percent, Kind.MagicAttackDamage, 0.0)
			});
			customItemReference.abilities = (Ability[])(object)new Ability[1] { (Ability)val };
			list.Add(customItemReference);
			CustomItemReference customItemReference2 = new CustomItemReference();
			customItemReference2.name = "PurelyMagical";
			((GearReference)customItemReference2).rarity = (Rarity)3;
			customItemReference2.itemName = "Raven Lord's Medallion";
			customItemReference2.itemDescription = "Increases <color=#1787D8>Magic Attack</color> by 100%.\nYou cannot deal <color=#F25D1C>Physical damage</color>.";
			customItemReference2.itemLore = "Able to control his army of raven souls, the Raven Lord has never faced a physical confrontation for the rest of his life.";
			((ItemReference)customItemReference2).prefabKeyword1 = (Key)28;
			((ItemReference)customItemReference2).prefabKeyword2 = (Key)28;
			customItemReference2.stats = new Values((Value[])(object)new Value[0]);
			StatBonus val2 = new StatBonus();
			val2._stat = new Values((Value[])(object)new Value[2]
			{
				new Value(Category.PercentPoint, Kind.MagicAttackDamage, 1.0),
				new Value(Category.Percent, Kind.PhysicalAttackDamage, 0.0)
			});
			customItemReference2.abilities = (Ability[])(object)new Ability[1] { (Ability)val2 };
			list.Add(customItemReference2);
			CustomItemReference customItemReference3 = new CustomItemReference();
			customItemReference3.name = "WisdomAndCourage";
			((GearReference)customItemReference3).rarity = (Rarity)1;
			customItemReference3.itemName = "Amulet of Duality";
			customItemReference3.itemDescription = "Increases <color=#F25D1C>Physical Attack</color> and <color=#1787D8>Magic Attack</color> by 40%.";
			customItemReference3.itemLore = "With a taste for knowledge, undecided warrior Haxa could never succumb to pure brutality.";
			((ItemReference)customItemReference3).prefabKeyword1 = (Key)5;
			((ItemReference)customItemReference3).prefabKeyword2 = (Key)28;
			customItemReference3.stats = new Values((Value[])(object)new Value[2]
			{
				new Value(Category.PercentPoint, Kind.MagicAttackDamage, 0.4),
				new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 0.4)
			});
			list.Add(customItemReference3);
			CustomItemReference customItemReference4 = new CustomItemReference();
			customItemReference4.name = "ElementalMess";
			((GearReference)customItemReference4).rarity = (Rarity)3;
			customItemReference4.itemName = "Quindent of Sadism";
			customItemReference4.itemDescription = "Attacks and skills have +10% chance to inflict any status effect: Poison, Wound, Stun, Freeze or Burn.\n(Freeze and Stun bonuses have an internal cooldown of 4 seconds.)";
			customItemReference4.itemLore = "The Demonlord Beelz becomes stronger by inflicting pain and suffering on everyone around him.";
			((ItemReference)customItemReference4).prefabKeyword1 = (Key)10;
			((ItemReference)customItemReference4).prefabKeyword2 = (Key)19;
			customItemReference4.stats = new Values((Value[])(object)new Value[0]);
			customItemReference4.abilities = (Ability[])(object)new Ability[5];
			for (int i = 0; i < 5; i++)
			{
				ApplyStatusOnGaveDamage val3 = new ApplyStatusOnGaveDamage();
				Kind val4 = (Kind)i;
				val3._cooldownTime = (((int)val4 == 1 || (int)val4 == 0) ? 4f : 0.1f);
				val3._chance = 10;
				val3._attackTypes = new AttackTypeBoolArray();
				((EnumArray<MotionType, bool>)(object)val3._attackTypes)[(MotionType)0] = true;
				((EnumArray<MotionType, bool>)(object)val3._attackTypes)[(MotionType)1] = true;
				val3._types = new DamageTypeBoolArray();
				((EnumArray<AttackType, bool>)(object)val3._types)[(AttackType)1] = true;
				((EnumArray<AttackType, bool>)(object)val3._types)[(AttackType)2] = true;
				((EnumArray<AttackType, bool>)(object)val3._types)[(AttackType)3] = true;
				val3._status = new ApplyInfo(val4);
				customItemReference4.abilities[i] = (Ability)(object)val3;
			}
			list.Add(customItemReference4);
			CustomItemReference customItemReference5 = new CustomItemReference();
			customItemReference5.name = "FireAndIce";
			((GearReference)customItemReference5).rarity = (Rarity)1;
			customItemReference5.itemName = "Elementalist's Staff";
			customItemReference5.itemDescription = "Increases <color=#1787D8>Magic Attack</color> by 25%.\nSkills have +5% chance to inflict Freeze or Burn.\n(Freeze bonus has a cooldown of 2 seconds.)\nIf <u>all</u> enemies are burning, amplifies <color=#1787D8>Magic Attack</color> by 20%.";
			customItemReference5.itemLore = "Only a true master of the elements could learn how to set ice on fire.";
			((ItemReference)customItemReference5).prefabKeyword1 = (Key)9;
			((ItemReference)customItemReference5).prefabKeyword2 = (Key)20;
			customItemReference5.stats = new Values((Value[])(object)new Value[1]
			{
				new Value(Category.PercentPoint, Kind.MagicAttackDamage, 0.25)
			});
			Kind[] array = (Kind[])(object)new Kind[2]
			{
				(Kind)1,
				(Kind)2
			};
			customItemReference5.abilities = (Ability[])(object)new Ability[array.Length + 1];
			customItemReference5.abilities[0] = (Ability)(object)new StatBonusIfAllEnemiesAreAffectedByStatus
			{
				_stats = new Values((Value[])(object)new Value[1]
				{
					new Value(Category.Percent, Kind.MagicAttackDamage, 1.2)
				}),
				_status = (Kind)2
			};
			for (int j = 0; j < array.Length; j++)
			{
				ApplyStatusOnGaveDamage val5 = new ApplyStatusOnGaveDamage();
				Kind val6 = array[j];
				val5._cooldownTime = (((int)val6 == 1) ? 2f : 0.1f);
				val5._chance = 10;
				val5._attackTypes = new AttackTypeBoolArray();
				((EnumArray<MotionType, bool>)(object)val5._attackTypes)[(MotionType)1] = true;
				val5._types = new DamageTypeBoolArray();
				((EnumArray<AttackType, bool>)(object)val5._types)[(AttackType)1] = true;
				((EnumArray<AttackType, bool>)(object)val5._types)[(AttackType)2] = true;
				((EnumArray<AttackType, bool>)(object)val5._types)[(AttackType)3] = true;
				val5._status = new ApplyInfo(val6);
				customItemReference5.abilities[j + 1] = (Ability)(object)val5;
			}
			list.Add(customItemReference5);
			CustomItemReference customItemReference6 = new CustomItemReference();
			customItemReference6.name = "PoisonAndBleed";
			((GearReference)customItemReference6).rarity = (Rarity)1;
			customItemReference6.itemName = "Poisoned Rope Dart";
			customItemReference6.itemDescription = "Increases <color=#F25D1C>Physical Attack</color> by 25%.\nSkills have +5% chance to inflict Poison or Wound.\nIf <u>all</u> enemies are poisoned, amplifies <color=#F25D1C>Physical Attack</color> by 20%.";
			customItemReference6.itemLore = "In skilled hands, this kunai brings death as swiftly as a Scorpion's sting.";
			((ItemReference)customItemReference6).prefabKeyword1 = (Key)26;
			((ItemReference)customItemReference6).prefabKeyword2 = (Key)27;
			customItemReference6.stats = new Values((Value[])(object)new Value[1]
			{
				new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 0.25)
			});
			Kind[] array2 = (Kind[])(object)new Kind[2]
			{
				(Kind)3,
				(Kind)4
			};
			customItemReference6.abilities = (Ability[])(object)new Ability[array2.Length + 1];
			customItemReference6.abilities[0] = (Ability)(object)new StatBonusIfAllEnemiesAreAffectedByStatus
			{
				_stats = new Values((Value[])(object)new Value[1]
				{
					new Value(Category.Percent, Kind.PhysicalAttackDamage, 1.2)
				}),
				_status = (Kind)4
			};
			for (int k = 0; k < array2.Length; k++)
			{
				ApplyStatusOnGaveDamage val7 = new ApplyStatusOnGaveDamage();
				Kind val8 = array2[k];
				val7._cooldownTime = 0.1f;
				val7._chance = 10;
				val7._attackTypes = new AttackTypeBoolArray();
				((EnumArray<MotionType, bool>)(object)val7._attackTypes)[(MotionType)1] = true;
				val7._types = new DamageTypeBoolArray();
				((EnumArray<AttackType, bool>)(object)val7._types)[(AttackType)1] = true;
				((EnumArray<AttackType, bool>)(object)val7._types)[(AttackType)2] = true;
				((EnumArray<AttackType, bool>)(object)val7._types)[(AttackType)3] = true;
				val7._status = new ApplyInfo(val8);
				customItemReference6.abilities[k + 1] = (Ability)(object)val7;
			}
			list.Add(customItemReference6);
			CustomItemReference customItemReference7 = new CustomItemReference();
			customItemReference7.name = "CarleonHeritage";
			((GearReference)customItemReference7).rarity = (Rarity)0;
			customItemReference7.itemName = "Carleon's Flag";
			customItemReference7.itemDescription = "Increases <color=#F25D1C>Physical Attack</color> and <color=#1787D8>Magic Attack</color> by 15% for each Carleon item you own.";
			customItemReference7.itemLore = "The symbol of Carleon's people brought strength during times of need.";
			((ItemReference)customItemReference7).prefabKeyword1 = (Key)21;
			((ItemReference)customItemReference7).prefabKeyword2 = (Key)31;
			((GearReference)customItemReference7).gearTag = (Tag)1;
			customItemReference7.stats = new Values((Value[])(object)new Value[0]);
			StatBonusPerGearTag val9 = new StatBonusPerGearTag();
			val9._tag = (Tag)1;
			val9._statPerGearTag = new Values((Value[])(object)new Value[2]
			{
				new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 0.15),
				new Value(Category.PercentPoint, Kind.MagicAttackDamage, 0.15)
			});
			customItemReference7.abilities = (Ability[])(object)new Ability[1] { (Ability)val9 };
			list.Add(customItemReference7);
			CustomItemReference customItemReference8 = new CustomItemReference();
			customItemReference8.name = "BoneOfJumps";
			((GearReference)customItemReference8).rarity = (Rarity)0;
			customItemReference8.itemName = "Bone Wing";
			customItemReference8.itemDescription = "Grants 1 extra jump and decreases gravity by 50%.\n(Gargoyle: reduces falling speed while attacking or using skills instead)\nIncreases <color=#F25D1C>Physical Attack</color> and <color=#1787D8>Magic Attack</color> by 25% while in midair.";
			customItemReference8.itemLore = "Float like a butterfly, sting like a bee!";
			((ItemReference)customItemReference8).prefabKeyword1 = (Key)4;
			((ItemReference)customItemReference8).prefabKeyword2 = (Key)13;
			customItemReference8.stats = new Values((Value[])(object)new Value[0]);
			AddAirJumpCount val10 = new AddAirJumpCount();
			StatBonusByAirTime val11 = new StatBonusByAirTime();
			val11._timeToMaxStat = 0.01f;
			val11._remainTimeOnGround = 0f;
			val11._maxStat = new Values((Value[])(object)new Value[2]
			{
				new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 0.25),
				new Value(Category.PercentPoint, Kind.MagicAttackDamage, 0.25)
			});
			GravityScale gravityScale = new GravityScale
			{
				amount = 0.5f
			};
			customItemReference8.abilities = (Ability[])(object)new Ability[3]
			{
				(Ability)val11,
				(Ability)val10,
				gravityScale
			};
			list.Add(customItemReference8);
			CustomItemReference customItemReference9 = new CustomItemReference();
			customItemReference9.name = "BoneOfJumps_BoneUpgrade";
			((GearReference)customItemReference9).rarity = (Rarity)0;
			((GearReference)customItemReference9).obtainable = false;
			customItemReference9.itemName = "Bone of Eternity: Wing";
			customItemReference9.itemDescription = "Grants 2 extra jumps and decreases gravity by 60%.\n(Gargoyle: reduces falling speed while attacking or using skills instead)\nIncreases <color=#F25D1C>Physical Attack</color> and <color=#1787D8>Magic Attack</color> by 50% while in midair.";
			customItemReference9.itemLore = "Float like a cloud, sting like a swarm of bees!";
			((ItemReference)customItemReference9).prefabKeyword1 = (Key)4;
			((ItemReference)customItemReference9).prefabKeyword2 = (Key)13;
			customItemReference9.stats = new Values((Value[])(object)new Value[0]);
			AddAirJumpCount val12 = new AddAirJumpCount
			{
				_count = 2
			};
			StatBonusByAirTime val13 = new StatBonusByAirTime();
			val13._timeToMaxStat = 0.01f;
			val13._remainTimeOnGround = 0f;
			val13._maxStat = new Values((Value[])(object)new Value[2]
			{
				new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 0.5),
				new Value(Category.PercentPoint, Kind.MagicAttackDamage, 0.5)
			});
			GravityScale gravityScale2 = new GravityScale
			{
				amount = 0.4f
			};
			customItemReference9.abilities = (Ability[])(object)new Ability[3]
			{
				(Ability)val13,
				(Ability)val12,
				gravityScale2
			};
			customItemReference9.forbiddenDrops = new string[1] { "BoneOfJumps" };
			list.Add(customItemReference9);
			CustomItemReference customItemReference10 = new CustomItemReference();
			customItemReference10.name = "TalariaOfMercury";
			((GearReference)customItemReference10).rarity = (Rarity)2;
			customItemReference10.itemName = "Talaria of Mercury";
			customItemReference10.itemDescription = "Grants 1 extra dash.\nIncreases movement speed by 50%.";
			customItemReference10.itemLore = "Mortals could never achieve Hermes's speed. The key to his swiftness was his winged sandals.";
			((ItemReference)customItemReference10).prefabKeyword1 = (Key)17;
			((ItemReference)customItemReference10).prefabKeyword2 = (Key)24;
			customItemReference10.stats = new Values((Value[])(object)new Value[1]
			{
				new Value(Category.PercentPoint, Kind.MovementSpeed, 0.5)
			});
			customItemReference10.abilities = (Ability[])(object)new Ability[1]
			{
				new ExtraDash()
			};
			list.Add(customItemReference10);
			CustomItemReference customItemReference11 = new CustomItemReference();
			customItemReference11.name = "TheTreasureOmen";
			((GearReference)customItemReference11).rarity = (Rarity)2;
			((GearReference)customItemReference11).gearTag = (Tag)8;
			((GearReference)customItemReference11).obtainable = false;
			customItemReference11.itemName = "Omen: Root of All Evil";
			customItemReference11.itemDescription = "Increases <color=#F25D1C>Physical Attack</color> and <color=#1787D8>Magic Attack</color> by 1% for each 100 gold you have.\nIncreases <color=#F25D1C>Physical Attack</color> and <color=#1787D8>Magic Attack</color> by 20% for each Treasure inscription you have.";
			customItemReference11.itemLore = "Wealth is the true root of all power, for greed knows no bounds.";
			((ItemReference)customItemReference11).prefabKeyword1 = (Key)34;
			((ItemReference)customItemReference11).prefabKeyword2 = (Key)32;
			customItemReference11.stats = new Values((Value[])(object)new Value[0]);
			Ability[] obj = new Ability[2]
			{
				new StatBonusByGoldAmount
				{
					_statsPerStack = new Values((Value[])(object)new Value[2]
					{
						new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 0.01),
						new Value(Category.PercentPoint, Kind.MagicAttackDamage, 0.01)
					}),
					_goldPerStack = 100f
				},
				default(Ability)
			};
			StatBonusByInscriptionCount val14 = new StatBonusByInscriptionCount();
			val14._keys = (Key[])(object)new Key[1] { (Key)32 };
			val14._type = (Type)4;
			val14._statPerStack = new Values((Value[])(object)new Value[2]
			{
				new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 0.2),
				new Value(Category.PercentPoint, Kind.MagicAttackDamage, 0.2)
			});
			obj[1] = (Ability)val14;
			customItemReference11.abilities = (Ability[])(object)obj;
			list.Add(customItemReference11);
			CustomItemReference customItemReference12 = new CustomItemReference();
			customItemReference12.name = "PandorasBox";
			((GearReference)customItemReference12).rarity = (Rarity)3;
			customItemReference12.itemName = "Pandora's Box";
			customItemReference12.itemDescription = "Upon pickup, replace each item with a random item of higher rarity.\nYou gain 500 gold per item transformed this way.";
			customItemReference12.itemLore = "\"This is my own special gift to you. Don't ever open it.\"";
			((ItemReference)customItemReference12).prefabKeyword1 = (Key)15;
			((ItemReference)customItemReference12).prefabKeyword2 = (Key)32;
			customItemReference12.stats = new Values((Value[])(object)new Value[0]);
			customItemReference12.abilities = (Ability[])(object)new Ability[1]
			{
				new PandorasBoxAbility()
			};
			list.Add(customItemReference12);
			CustomItemReference customItemReference13 = new CustomItemReference();
			customItemReference13.name = "QuintDamageBuff";
			((GearReference)customItemReference13).rarity = (Rarity)2;
			customItemReference13.itemName = "Claws of Raptor";
			customItemReference13.itemDescription = "Increases crit damage by 15%.\nQuintessences can crit.";
			customItemReference13.itemLore = "No one has ever seen the monster that possessed such powerful claws and survived to tell the story.";
			((ItemReference)customItemReference13).prefabKeyword1 = (Key)31;
			((ItemReference)customItemReference13).prefabKeyword2 = (Key)19;
			customItemReference13.stats = new Values((Value[])(object)new Value[1]
			{
				new Value(Category.PercentPoint, Kind.CriticalDamage, 0.15)
			});
			customItemReference13.abilities = (Ability[])(object)new Ability[1]
			{
				new AdditionalCritReroll
				{
					motionType = (MotionType)3
				}
			};
			list.Add(customItemReference13);
			CustomItemReference customItemReference14 = new CustomItemReference();
			customItemReference14.name = "MisfortuneBrawl";
			((GearReference)customItemReference14).rarity = (Rarity)0;
			customItemReference14.itemName = "Spiked Brass Knuckles";
			customItemReference14.itemDescription = "Increases crit damage by 10%.\nIncreases crit rate by 5%.";
			customItemReference14.itemLore = "There is no such thing as a fair fight. Only a fight you win.";
			((ItemReference)customItemReference14).prefabKeyword1 = (Key)19;
			((ItemReference)customItemReference14).prefabKeyword2 = (Key)22;
			customItemReference14.stats = new Values((Value[])(object)new Value[2]
			{
				new Value(Category.PercentPoint, Kind.CriticalDamage, 0.1),
				new Value(Category.PercentPoint, Kind.CriticalChance, 0.05)
			});
			list.Add(customItemReference14);
			CustomItemReference customItemReference15 = new CustomItemReference();
			customItemReference15.name = "CommonMasterpiece";
			((GearReference)customItemReference15).rarity = (Rarity)0;
			customItemReference15.itemName = "Ornamental Axe";
			customItemReference15.itemDescription = "Increases <color=#F25D1C>Physical Attack</color> by 20%.";
			customItemReference15.itemLore = "During times of distress, anything can be used as a weapon.";
			((ItemReference)customItemReference15).prefabKeyword1 = (Key)29;
			((ItemReference)customItemReference15).prefabKeyword2 = (Key)10;
			customItemReference15.stats = new Values((Value[])(object)new Value[1]
			{
				new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 0.2)
			});
			list.Add(customItemReference15);
			CustomItemReference customItemReference16 = new CustomItemReference();
			customItemReference16.name = "CommonMasterpiece_2";
			((GearReference)customItemReference16).obtainable = false;
			((GearReference)customItemReference16).rarity = (Rarity)0;
			customItemReference16.itemName = "Honorary Battle-Axe";
			customItemReference16.itemDescription = "Amplifies <color=#F25D1C>Physical Attack</color> by 20%.";
			customItemReference16.itemLore = "A weapon reforged by the fire of its warrior's soul.";
			((ItemReference)customItemReference16).prefabKeyword1 = (Key)29;
			((ItemReference)customItemReference16).prefabKeyword2 = (Key)10;
			customItemReference16.forbiddenDrops = new string[1] { "CommonMasterpiece" };
			customItemReference16.stats = new Values((Value[])(object)new Value[1]
			{
				new Value(Category.Percent, Kind.PhysicalAttackDamage, 1.2)
			});
			list.Add(customItemReference16);
			CustomItemReference customItemReference17 = new CustomItemReference();
			customItemReference17.name = "TheManatechOmen";
			((GearReference)customItemReference17).rarity = (Rarity)2;
			((GearReference)customItemReference17).gearTag = (Tag)8;
			((GearReference)customItemReference17).obtainable = false;
			customItemReference17.itemName = "Omen: Dark Tech Marvel";
			customItemReference17.itemDescription = "Picking up a Manatech part amplifies Skill Damage by 5% for 5 seconds (Up to 50%)";
			customItemReference17.itemLore = "A paradoxical machine that never seems to stop running.";
			((ItemReference)customItemReference17).prefabKeyword1 = (Key)34;
			((ItemReference)customItemReference17).prefabKeyword2 = (Key)12;
			customItemReference17.stats = new Values((Value[])(object)new Value[0]);
			StatBonusPerManatechPart statBonusPerManatechPart = new StatBonusPerManatechPart();
			statBonusPerManatechPart._timeout = 5f;
			statBonusPerManatechPart._maxStack = 10;
			statBonusPerManatechPart._statPerStack = new Values((Value[])(object)new Value[1]
			{
				new Value(Category.Percent, Kind.SkillAttackDamage, 0.05)
			});
			customItemReference17.abilities = (Ability[])(object)new Ability[1] { statBonusPerManatechPart };
			list.Add(customItemReference17);
			CustomItemReference customItemReference18 = new CustomItemReference();
			customItemReference18.name = "AdventurerKiller";
			((GearReference)customItemReference18).rarity = (Rarity)2;
			customItemReference18.itemName = "Soul Ripper";
			customItemReference18.itemDescription = "Upon killing an adventurer, this item disappears and that adventurer's Legendary item is dropped.";
			customItemReference18.itemLore = "One's soul is the source of their most desirable posessions.";
			((ItemReference)customItemReference18).prefabKeyword1 = (Key)7;
			((ItemReference)customItemReference18).prefabKeyword2 = (Key)10;
			customItemReference18.stats = new Values((Value[])(object)new Value[0]);
			customItemReference18.abilities = (Ability[])(object)new Ability[1]
			{
				new AdventurerWeaponSteal
				{
					baseItem = customItemReference18.name
				}
			};
			list.Add(customItemReference18);
			CustomItemReference customItemReference19 = new CustomItemReference();
			customItemReference19.name = "SymbolOfConfidence";
			((GearReference)customItemReference19).rarity = (Rarity)2;
			customItemReference19.itemName = "Symbol of Confidence";
			customItemReference19.itemDescription = "Decreases incoming damage by 25%.\nIncreases <color=#F25D1C>Physical Attack</color> and <color=#1787D8>Magic Attack</color> by up to 100%, equal to your current HP %.";
			customItemReference19.itemLore = "The blistering confidence brought by a strong defense makes the most powerful warriors.";
			((ItemReference)customItemReference19).prefabKeyword1 = (Key)1;
			((ItemReference)customItemReference19).prefabKeyword2 = (Key)8;
			customItemReference19.stats = new Values((Value[])(object)new Value[1]
			{
				new Value(Category.Percent, Kind.TakingDamage, 0.75)
			});
			StatBonusPerHPPercent statBonusPerHPPercent = new StatBonusPerHPPercent();
			statBonusPerHPPercent._maxStat = new Values((Value[])(object)new Value[2]
			{
				new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 1.0),
				new Value(Category.PercentPoint, Kind.MagicAttackDamage, 1.0)
			});
			customItemReference19.abilities = (Ability[])(object)new Ability[1] { statBonusPerHPPercent };
			list.Add(customItemReference19);
			CustomItemReference customItemReference20 = new CustomItemReference();
			customItemReference20.name = "OmenClone";
			((GearReference)customItemReference20).rarity = (Rarity)2;
			((GearReference)customItemReference20).gearTag = (Tag)8;
			((GearReference)customItemReference20).obtainable = false;
			customItemReference20.itemName = "Omen: Cryptic Collectible";
			customItemReference20.itemDescription = "This item gains one random inscription.\nWhen you have 14 or more different inscriptions, transform this item.";
			customItemReference20.itemLore = "The heart of a true collector desires what it desires. Even when it doesn't know what lies inside.";
			((ItemReference)customItemReference20).prefabKeyword1 = (Key)34;
			((ItemReference)customItemReference20).prefabKeyword2 = (Key)0;
			customItemReference20.stats = new Values((Value[])(object)new Value[0]);
			customItemReference20.abilities = (Ability[])(object)new Ability[1]
			{
				new InscriptionCountAbility()
			};
			customItemReference20.extraComponents = new Type[2]
			{
				typeof(OmenKeywordRandomizer),
				typeof(UpgradeOnInscriptionCount)
			};
			list.Add(customItemReference20);
			CustomItemReference customItemReference21 = new CustomItemReference();
			customItemReference21.name = "OmenClone_2";
			((GearReference)customItemReference21).obtainable = false;
			((GearReference)customItemReference21).rarity = (Rarity)2;
			customItemReference21.itemName = "Omen: Idol of Insanity";
			customItemReference21.itemDescription = "This item gains one random inscription.\nIncreases the number of each inscription you have by 1.\nIncreases Collection Desire's inscription requirement by 1.";
			customItemReference21.itemLore = "I DON'T DESIRE ANYTHING ANYMORE! I HAVE EVERYTHING I'VE EVER WANTED!";
			((ItemReference)customItemReference21).prefabKeyword1 = (Key)0;
			((ItemReference)customItemReference21).prefabKeyword2 = (Key)0;
			customItemReference21.stats = new Values((Value[])(object)new Value[0]);
			customItemReference21.abilities = (Ability[])(object)new Ability[1]
			{
				new NerfCollectionDesire
				{
					_count = 1
				}
			};
			customItemReference21.extraComponents = new Type[2]
			{
				typeof(OmenKeywordRandomizer),
				typeof(CloneCloneClone)
			};
			customItemReference21.forbiddenDrops = new string[1] { "OmenClone" };
			list.Add(customItemReference21);
			CustomItemReference customItemReference22 = new CustomItemReference();
			customItemReference22.name = "OmenClone_2_BoneUpgrade";
			((GearReference)customItemReference22).obtainable = false;
			((GearReference)customItemReference22).rarity = (Rarity)2;
			customItemReference22.itemName = "Omen: Bony Idol of Eternal Insanity";
			customItemReference22.itemDescription = "Increases the number of each inscription you have by 1.\nIncreases Collection Desire's inscription requirement by 1.\nDecreases the Bone inscription activation requirement by 1 swap.";
			customItemReference22.itemLore = "Yo dawg, I heard you like Bone! So I put a Bone inside this Bone item so you can use more Bone against Evil Little Bone!";
			((ItemReference)customItemReference22).prefabKeyword1 = (Key)0;
			((ItemReference)customItemReference22).prefabKeyword2 = (Key)4;
			customItemReference22.stats = new Values((Value[])(object)new Value[0]);
			customItemReference22.abilities = (Ability[])(object)new Ability[2]
			{
				new NerfCollectionDesire
				{
					_count = 1
				},
				new ReduceBoneInscriptionRequirement
				{
					_count = 1
				}
			};
			customItemReference22.extraComponents = new Type[2]
			{
				typeof(DelayedOmenAssigner),
				typeof(CloneCloneClone)
			};
			customItemReference22.forbiddenDrops = new string[2] { "OmenClone", "OmenClone_2" };
			list.Add(customItemReference22);
			return list;
		}

		internal static void LoadSprites()
		{
			Items.ForEach(delegate(CustomItemReference item)
			{
				item.LoadSprites();
			});
		}

		internal static Dictionary<string, string> MakeStringDictionary()
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>(Items.Count * 8);
			foreach (CustomItemReference item in Items)
			{
				dictionary.Add("item/" + item.name + "/name", item.itemName);
				dictionary.Add("item/" + item.name + "/desc", item.itemDescription);
				dictionary.Add("item/" + item.name + "/flavor", item.itemLore);
			}
			return dictionary;
		}

		internal static List<EnhancementMap> ListMasterpieces()
		{
			Dictionary<string, CustomItemReference> masterpieces = Items.Where((CustomItemReference i) => (int)((ItemReference)i).prefabKeyword1 == 29 || (int)((ItemReference)i).prefabKeyword2 == 29).ToDictionary((CustomItemReference i) => i.name);
			return masterpieces.Where((KeyValuePair<string, CustomItemReference> item) => masterpieces.ContainsKey(item.Key + "_2")).Select((Func<KeyValuePair<string, CustomItemReference>, EnhancementMap>)((KeyValuePair<string, CustomItemReference> item) => new EnhancementMap
			{
				_from = new AssetReference(((GearReference)item.Value).guid),
				_to = new AssetReference(((GearReference)masterpieces[item.Key + "_2"]).guid)
			})).ToList();
		}

		internal static List<EnhancementMap> ListUpgradableBones()
		{
			Dictionary<string, CustomItemReference> items = Items.ToDictionary((CustomItemReference i) => i.name);
			return items.Where((KeyValuePair<string, CustomItemReference> item) => items.ContainsKey(item.Key + "_BoneUpgrade")).Select((Func<KeyValuePair<string, CustomItemReference>, EnhancementMap>)((KeyValuePair<string, CustomItemReference> item) => new EnhancementMap
			{
				_from = new AssetReference(((GearReference)item.Value).guid),
				_to = new AssetReference(((GearReference)items[item.Key + "_BoneUpgrade"]).guid)
			})).ToList();
		}
	}
	[HarmonyPatch]
	public class CustomItemsPatch
	{
		public delegate void ManatechPartDelegate();

		public delegate void InventoryUpdateDelegate(Inventory inventory);

		private static Dictionary<ItemRequest, CustomItemReference> currentRequests = new Dictionary<ItemRequest, CustomItemReference>();

		private static Dictionary<GearRequest, CustomItemReference> currentGearRequests = new Dictionary<GearRequest, CustomItemReference>();

		private static Dictionary<string, string> ItemStrings = new Dictionary<string, string>();

		public static readonly Dictionary<string, string> ItemStringsOverride = new Dictionary<string, string>();

		private static bool _initializedBone = false;

		public static event ManatechPartDelegate OnManatechPart;

		public static event InventoryUpdateDelegate OnInventoryUpdate;

		public static event InventoryUpdateDelegate AfterInventoryUpdate;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(GearResource), "Initialize")]
		private static void InjectCustomItems(ref GearResource __instance)
		{
			ItemReference[] array = (ItemReference[])(object)CustomItems.Items.ToArray();
			ItemReference[] array2 = array;
			CustomItems.LoadSprites();
			ItemStrings = CustomItems.MakeStringDictionary();
			int num = __instance._items.Length;
			Array.Resize(ref __instance._items, num + array2.Length);
			array2.CopyTo(__instance._items, num);
			Sprite[] array3 = (from item in array2
				where (Object)(object)((GearReference)item).thumbnail != (Object)null
				select ((GearReference)item).thumbnail).ToArray();
			int num2 = __instance._gearThumbnails.Length;
			Array.Resize(ref __instance._gearThumbnails, num2 + array3.Length);
			array3.CopyTo(__instance._gearThumbnails, num2);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Masterpiece), "Initialize")]
		private static void InjectMasterpieces(ref Masterpiece __instance)
		{
			EnhancementMap[] array = CustomItems.ListMasterpieces().ToArray();
			int num = __instance._enhancementMaps.Length;
			Array.Resize(ref __instance._enhancementMaps, num + array.Length);
			array.CopyTo(__instance._enhancementMaps, num);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SuperAbility), "CreateInstance")]
		private static void InjectUpgradedBones(ref SuperAbility __instance)
		{
			if (!_initializedBone)
			{
				EnhancementMap[] array = CustomItems.ListUpgradableBones().ToArray();
				int num = __instance._enhancementMaps.Length;
				Array.Resize(ref __instance._enhancementMaps, num + array.Length);
				array.CopyTo(__instance._enhancementMaps, num);
				_initializedBone = true;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ItemReference), "LoadAsync")]
		private static void RegisterGearRequest(ref ItemReference __instance, ref ItemRequest __result)
		{
			if (__instance is CustomItemReference value)
			{
				currentRequests.Add(__result, value);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GearReference), "LoadAsync")]
		private static void RegisterGearRequest(ref GearReference __instance, ref GearRequest __result)
		{
			if (__instance is CustomItemReference value)
			{
				currentGearRequests.Add(__result, value);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(LevelManager), "DropItem", new Type[]
		{
			typeof(ItemRequest),
			typeof(Vector3)
		})]
		private static bool DropCustomItem(ref LevelManager __instance, ItemRequest gearRequest, Vector3 position, ref Item __result)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return ProcessDrop<ItemRequest, Item>(ref __instance, gearRequest, position, ref __result, currentRequests);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(LevelManager), "DropGear", new Type[]
		{
			typeof(GearRequest),
			typeof(Vector3)
		})]
		private static bool DropCustomGear(ref LevelManager __instance, GearRequest gearRequest, Vector3 position, ref Gear __result)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return ProcessDrop<GearRequest, Gear>(ref __instance, gearRequest, position, ref __result, currentGearRequests);
		}

		private static bool ProcessDrop<TRequest, TResult>(ref LevelManager __instance, TRequest request, Vector3 position, ref TResult __result, Dictionary<TRequest, CustomItemReference> requestDict) where TRequest : Request<TResult> where TResult : Gear
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if (!requestDict.ContainsKey(request))
			{
				return true;
			}
			Item item = requestDict[request].GetItem(((Component)(object)((Request<TResult>)request).asset).gameObject.GetComponent<Item>());
			__result = (TResult)(object)__instance.DropItem(item, position);
			requestDict.Remove(request);
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Localization), "GetLocalizedString", new Type[] { typeof(string) })]
		private static bool InjectCustomStrings(string key, ref string __result)
		{
			if (ItemStringsOverride.ContainsKey(key))
			{
				__result = ItemStringsOverride[key];
				return false;
			}
			if (!ItemStrings.ContainsKey(key))
			{
				return true;
			}
			__result = ItemStrings[key];
			return false;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(DroppedManatechPart), "PickedUpBy")]
		private static void ManatechPickedupHook(Character character)
		{
			CustomItemsPatch.OnManatechPart?.Invoke();
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Inventory), "UpdateSynergy")]
		private static void InventoryUpdateHook(ref Inventory __instance)
		{
			CustomItemsPatch.OnInventoryUpdate?.Invoke(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Inventory), "UpdateSynergy")]
		private static void PostInventoryUpdateHook(ref Inventory __instance)
		{
			CustomItemsPatch.AfterInventoryUpdate?.Invoke(__instance);
		}
	}
	[BepInPlugin("CustomItems", "CustomItems", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			Harmony.CreateAndPatchAll(typeof(CustomItemsPatch), (string)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod CustomItems is loaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CustomItems";

		public const string PLUGIN_NAME = "CustomItems";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace CustomItems.CustomAbilities
{
	public abstract class AbilityComponentHack<T> : AbilityComponent<T>, ISerializationCallbackReceiver where T : Ability, ICloneable
	{
		[SerializeReference]
		private T _abilityReference;

		public void OnAfterDeserialize()
		{
			if (base._ability == null && _abilityReference != null)
			{
				base._ability = (T)_abilityReference.Clone();
			}
		}

		public void OnBeforeSerialize()
		{
			_abilityReference = base._ability;
		}
	}
	[Serializable]
	public class AdditionalCritReroll : Ability, ICloneable
	{
		public class Instance : AbilityInstance<AdditionalCritReroll>
		{
			public Instance(Character owner, AdditionalCritReroll ability)
				: base(owner, ability)
			{
			}

			private bool OnGiveDamage(ITarget target, ref Damage damage)
			{
				//IL_0001: 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)
				if (damage.motionType == base.ability.motionType)
				{
					damage.critical |= MMMaths.Chance(damage.criticalChance);
				}
				return false;
			}

			public override void OnAttach()
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Expected O, but got Unknown
				((PriorityList<GiveDamageDelegate>)(object)((AbilityInstance)this).owner.onGiveDamage).Add(int.MaxValue, new GiveDamageDelegate(OnGiveDamage));
			}

			public override void OnDetach()
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Expected O, but got Unknown
				((PriorityList<GiveDamageDelegate>)(object)((AbilityInstance)this).owner.onGiveDamage).Remove(new GiveDamageDelegate(OnGiveDamage));
			}
		}

		[SerializeField]
		internal MotionType motionType;

		public override IAbilityInstance CreateInstance(Character owner)
		{
			return (IAbilityInstance)(object)new Instance(owner, this);
		}

		public object Clone()
		{
			//IL_0007: 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)
			return new AdditionalCritReroll
			{
				motionType = motionType
			};
		}
	}
	public sealed class AdditionalCritRerollComponent : AbilityComponentHack<AdditionalCritReroll>
	{
	}
	[Serializable]
	public class AdventurerWeaponSteal : Ability, ICloneable
	{
		public class Instance : AbilityInstance<AdventurerWeaponSteal>
		{
			private static Dictionary<string, string> AdventurerItems = new Dictionary<string, string>
			{
				{ "AdventurerArcher", "TheChosenHuntersArrow" },
				{ "AdventurerCleric", "TheChosenClericsBible" },
				{ "AdventurerHero", "TheChosenHerosCirclet" },
				{ "AdventurerMagician", "TheChosenMagesBadge" },
				{ "AdventurerThief", "TheChosenThiefsTwinSwords" },
				{ "AdventurerWarrior", "TheChosenWarriorsArmor" },
				{ "SupportingArcher", "TheChosenHuntersArrow" },
				{ "SupportingCleric", "TheChosenClericsBible" },
				{ "SupportingHero", "TheChosenHerosCirclet" },
				{ "SupportingMagician", "TheChosenMagesBadge" },
				{ "SupportingThief", "TheChosenThiefsTwinSwords" },
				{ "SupportingWarrior", "TheChosenWarriorsArmor" },
				{ "Veteran Archer", "TheChosenHuntersArrow" },
				{ "Veteran Cleric", "TheChosenClericsBible" },
				{ "Veteran Hero", "TheChosenHerosCirclet" },
				{ "Veteran Magician", "TheChosenMagesBadge" },
				{ "Veteran Thief", "TheChosenThiefsTwinSwords" },
				{ "Veteran Warrior", "TheChosenWarriorsArmor" }
			};

			private bool dropped;

			public Instance(Character owner, AdventurerWeaponSteal ability)
				: base(owner, ability)
			{
			}

			private void OnKill(ITarget target, ref Damage damage)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Invalid comparison between Unknown and I4
				//IL_012a: Unknown result type (might be due to invalid IL or missing references)
				//IL_012f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0133: Unknown result type (might be due to invalid IL or missing references)
				//IL_0146: Unknown result type (might be due to invalid IL or missing references)
				//IL_014b: Unknown result type (might be due to invalid IL or missing references)
				//IL_014f: Unknown result type (might be due to invalid IL or missing references)
				//IL_015f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0164: Unknown result type (might be due to invalid IL or missing references)
				//IL_0168: Unknown result type (might be due to invalid IL or missing references)
				//IL_0191: Unknown result type (might be due to invalid IL or missing references)
				Character character = target.character;
				if (dropped || (int)character.type != 2)
				{
					return;
				}
				string name = ((Object)character).name;
				string text = null;
				foreach (string key in AdventurerItems.Keys)
				{
					if (name.StartsWith(key))
					{
						text = AdventurerItems[key];
						break;
					}
				}
				if (text == null)
				{
					Debug.LogWarning((object)("[CustomItems - Essence Extractor] Adventurer '" + name + "' not found."));
					return;
				}
				ItemInventory item = ((AbilityInstance)this).owner.playerComponents.inventory.item;
				ItemReference val2 = default(ItemReference);
				Vector3 val4 = default(Vector3);
				for (int i = 0; i < item.items.Count; i++)
				{
					try
					{
						Item val = item.items[i];
						if ((Object)(object)val == (Object)null || !(((Object)val).name == base.ability.baseItem))
						{
							continue;
						}
						if (!GearResource.instance.TryGetItemReferenceByName(text, ref val2))
						{
							Debug.LogWarning((object)("[CustomItems - Essence Extractor] Could not find item " + text));
						}
						ItemRequest val3 = val2.LoadAsync();
						((Request<Item>)(object)val3).WaitForCompletion();
						val.RemoveOnInventory();
						LevelManager levelManager = Singleton<Service>.Instance.levelManager;
						Bounds bounds = ((Collider2D)character.collider).bounds;
						levelManager.DropItem(val3, ((Bounds)(ref bounds)).center);
						bounds = ((Collider2D)character.collider).bounds;
						float x = ((Bounds)(ref bounds)).center.x;
						bounds = ((Collider2D)character.collider).bounds;
						((Vector3)(ref val4))..ctor(x, ((Bounds)(ref bounds)).max.y + 1f, 0f);
						Singleton<Service>.Instance.floatingTextSpawner.SpawnBuff("YOUR SOUL IS MINE", val4, "#F2F2F2");
						dropped = true;
						break;
					}
					catch (Exception ex)
					{
						Debug.LogWarning((object)("[CustomItems - Essence Extractor] Error at item index " + i));
						Debug.LogWarning((object)ex.Message);
					}
				}
			}

			public override void OnAttach()
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Expected O, but got Unknown
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Expected O, but got Unknown
				Character owner = ((AbilityInstance)this).owner;
				owner.onKilled = (OnKilledDelegate)Delegate.Combine((Delegate?)(object)owner.onKilled, (Delegate?)new OnKilledDelegate(OnKill));
			}

			public override void OnDetach()
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Expected O, but got Unknown
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Expected O, but got Unknown
				Character owner = ((AbilityInstance)this).owner;
				owner.onKilled = (OnKilledDelegate)Delegate.Remove((Delegate?)(object)owner.onKilled, (Delegate?)new OnKilledDelegate(OnKill));
			}
		}

		[SerializeField]
		internal string baseItem;

		public override IAbilityInstance CreateInstance(Character owner)
		{
			return (IAbilityInstance)(object)new Instance(owner, this);
		}

		public object Clone()
		{
			return new AdventurerWeaponSteal
			{
				baseItem = baseItem
			};
		}
	}
	public sealed class AdventurerWeaponStealComponent : AbilityComponentHack<AdventurerWeaponSteal>
	{
	}
	[Serializable]
	public class ExtraDash : Ability, ICloneable
	{
		public class Instance : AbilityInstance<ExtraDash>
		{
			public Instance(Character owner, ExtraDash ability)
				: base(owner, ability)
			{
			}

			private void PlusDash(Component obj)
			{
				SimpleAction[] array = (from action in obj.GetComponentsInChildren<SimpleAction>(true)
					where (int)((Action)action)._type == 0
					select action).ToArray();
				for (int i = 0; i < array.Length; i++)
				{
					IStreak streak = ((Action)array[i])._cooldown.streak;
					if (streak.timeout == 0f)
					{
						streak.timeout = 0.4f;
					}
					streak.timeout = streak.timeout / (float)(streak.count + 1) * (float)(streak.count + 1 + base.ability._count);
					streak.count += base.ability._count;
				}
				Transform obj2 = obj.transform.Find("Equipped/Dash_Air");
				LimitedTimesOnAirConstraint val = ((obj2 != null) ? ((Component)obj2).GetComponentInChildren<LimitedTimesOnAirConstraint>(true) : null);
				if ((Object)(object)val != (Object)null)
				{
					val._maxTimes += base.ability._count;
				}
			}

			private void MinusDash(Component obj)
			{
				SimpleAction[] array = (from action in obj.GetComponentsInChildren<SimpleAction>(true)
					where (int)((Action)action)._type == 0
					select action).ToArray();
				for (int i = 0; i < array.Length; i++)
				{
					IStreak streak = ((Action)array[i])._cooldown.streak;
					streak.timeout = streak.timeout / (float)(streak.count + 1) * (float)(streak.count + 1 - base.ability._count);
					streak.count -= base.ability._count;
					if (streak.count < 0)
					{
						streak.count = 0;
					}
				}
				Transform obj2 = obj.transform.Find("Equipped/Dash_Air");
				LimitedTimesOnAirConstraint val = ((obj2 != null) ? ((Component)obj2).GetComponentInChildren<LimitedTimesOnAirConstraint>(true) : null);
				if ((Object)(object)val != (Object)null)
				{
					val._maxTimes -= base.ability._count;
				}
			}

			private void WeaponChange(Weapon w1, Weapon w2)
			{
				if (Object.op_Implicit((Object)(object)w1))
				{
					MinusDash((Component)(object)w1);
				}
				if (Object.op_Implicit((Object)(object)w2))
				{
					PlusDash((Component)(object)w2);
				}
			}

			public override void OnAttach()
			{
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Expected O, but got Unknown
				Weapon[] weapons = ((AbilityInstance)this).owner.playerComponents.inventory.weapon.weapons;
				foreach (Weapon val in weapons)
				{
					if (Object.op_Implicit((Object)(object)val))
					{
						PlusDash((Component)(object)val);
					}
				}
				((AbilityInstance)this).owner.playerComponents.inventory.weapon.onChanged += new OnChangeDelegate(WeaponChange);
			}

			public override void OnDetach()
			{
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Expected O, but got Unknown
				Weapon[] weapons = ((AbilityInstance)this).owner.playerComponents.inventory.weapon.weapons;
				foreach (Weapon val in weapons)
				{
					if (Object.op_Implicit((Object)(object)val))
					{
						MinusDash((Component)(object)val);
					}
				}
				((AbilityInstance)this).owner.playerComponents.inventory.weapon.onChanged -= new OnChangeDelegate(WeaponChange);
			}
		}

		[SerializeField]
		internal int _count = 1;

		public override IAbilityInstance CreateInstance(Character owner)
		{
			return (IAbilityInstance)(object)new Instance(owner, this);
		}

		public object Clone()
		{
			return new ExtraDash
			{
				_count = _count
			};
		}
	}
	public sealed class ExtraDashComponent : AbilityComponentHack<ExtraDash>
	{
	}
	[Serializable]
	public class GravityScale : Ability, ICloneable
	{
		public class Instance : AbilityInstance<GravityScale>
		{
			public Instance(Character owner, GravityScale ability)
				: base(owner, ability)
			{
			}

			private void WeaponChange(Weapon w1, Weapon w2)
			{
				OverrideMovementConfigComponent val = ((w1 != null) ? ((Component)w1).GetComponentInChildren<OverrideMovementConfigComponent>(true) : null);
				if ((Object)(object)val != (Object)null)
				{
					if (((Object)w1).name.StartsWith("Gargoyle"))
					{
						ModifyVerticalVelocity[] componentsInChildren = ((Component)w1).GetComponentsInChildren<ModifyVerticalVelocity>(true);
						foreach (ModifyVerticalVelocity val2 in componentsInChildren)
						{
							if (val2._amount < 0f)
							{
								val2._amount /= base.ability.amount;
							}
						}
					}
					else
					{
						Config config = ((AbilityComponent<OverrideMovementConfig>)(object)val)._ability._config;
						config.gravity /= base.ability.amount;
					}
				}
				OverrideMovementConfigComponent val3 = ((w2 != null) ? ((Component)w2).GetComponentInChildren<OverrideMovementConfigComponent>(true) : null);
				if (!((Object)(object)val3 != (Object)null))
				{
					return;
				}
				if (((Object)w2).name.StartsWith("Gargoyle"))
				{
					ModifyVerticalVelocity[] componentsInChildren = ((Component)w2).GetComponentsInChildren<ModifyVerticalVelocity>(true);
					foreach (ModifyVerticalVelocity val4 in componentsInChildren)
					{
						if (val4._amount < 0f)
						{
							val4._amount *= base.ability.amount;
						}
					}
				}
				else
				{
					Config config2 = ((AbilityComponent<OverrideMovementConfig>)(object)val3)._ability._config;
					config2.gravity *= base.ability.amount;
				}
			}

			private void AttachWeapon(Weapon w)
			{
				WeaponChange(null, w);
			}

			private void DetachWeapon(Weapon w)
			{
				WeaponChange(w, null);
			}

			public override void OnAttach()
			{
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Expected O, but got Unknown
				PriorityList<Config> configs = ((AbilityInstance)this).owner.movement.configs;
				Config obj = configs[configs.Count - 1];
				obj.gravity *= base.ability.amount;
				Weapon[] weapons = ((AbilityInstance)this).owner.playerComponents.inventory.weapon.weapons;
				foreach (Weapon w in weapons)
				{
					AttachWeapon(w);
				}
				((AbilityInstance)this).owner.playerComponents.inventory.weapon.onChanged += new OnChangeDelegate(WeaponChange);
			}

			public override void OnDetach()
			{
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Expected O, but got Unknown
				PriorityList<Config> configs = ((AbilityInstance)this).owner.movement.configs;
				Config obj = configs[configs.Count - 1];
				obj.gravity /= base.ability.amount;
				((AbilityInstance)this).owner.playerComponents.inventory.weapon.onChanged -= new OnChangeDelegate(WeaponChange);
				Weapon[] weapons = ((AbilityInstance)this).owner.playerComponents.inventory.weapon.weapons;
				foreach (Weapon w in weapons)
				{
					DetachWeapon(w);
				}
			}
		}

		[SerializeField]
		internal float amount = 1f;

		public override IAbilityInstance CreateInstance(Character owner)
		{
			return (IAbilityInstance)(object)new Instance(owner, this);
		}

		public object Clone()
		{
			return new GravityScale
			{
				amount = amount
			};
		}
	}
	public sealed class GravityScaleComponent : AbilityComponentHack<GravityScale>
	{
	}
	[Serializable]
	public class InscriptionCountAbility : Ability, ICloneable
	{
		public class Instance : AbilityInstance<InscriptionCountAbility>
		{
			private EnumArray<Key, Inscription> inscriptions;

			public override int iconStacks => ((IEnumerable<Inscription>)inscriptions).Count((Inscription inscription) => inscription.count > 0);

			public Instance(Character owner, InscriptionCountAbility ability)
				: base(owner, ability)
			{
				inscriptions = owner.playerComponents.inventory.synergy.inscriptions;
			}

			public override void OnAttach()
			{
			}

			public override void OnDetach()
			{
			}
		}

		public override IAbilityInstance CreateInstance(Character owner)
		{
			return (IAbilityInstance)(object)new Instance(owner, this);
		}

		public object Clone()
		{
			return new InscriptionCountAbility
			{
				_defaultIcon = base._defaultIcon
			};
		}
	}
	public sealed class InscriptionCountAbilityComponent : AbilityComponentHack<InscriptionCountAbility>
	{
	}
	[Serializable]
	public class NerfCollectionDesire : Ability, ICloneable
	{
		public class Instance : AbilityInstance<NerfCollectionDesire>
		{
			private Inventory _inventory;

			private bool _collectionPresent;

			public Instance(Character owner, NerfCollectionDesire ability)
				: base(owner, ability)
			{
				_inventory = owner.playerComponents.inventory;
			}

			public override void OnAttach()
			{
				RefreshCollectionDesire();
				_inventory.onUpdatedKeywordCounts += RefreshCollectionDesire;
				_inventory.upgrade.onChanged += RefreshCollectionDesire;
			}

			public override void OnDetach()
			{
				_inventory.upgrade.onChanged -= RefreshCollectionDesire;
				if (_collectionPresent)
				{
					_collectionPresent = false;
					AddToCollectionDesireRequirement(-base.ability._count);
				}
			}

			private void RefreshCollectionDesire()
			{
				AddToCollectionDesireRequirement(base.ability._count);
			}

			private void AddToCollectionDesireRequirement(int count)
			{
				foreach (UpgradeObject upgrade in _inventory.upgrade.upgrades)
				{
					if ((Object)(object)upgrade == (Object)null || !(((Object)upgrade).name == "CollectionDesire"))
					{
						continue;
					}
					if (!_collectionPresent)
					{
						_collectionPresent = true;
						StatBonusPerInscriptionStackComponent componentInChildren = ((Component)upgrade).GetComponentInChildren<StatBonusPerInscriptionStackComponent>();
						if ((Object)(object)componentInChildren == (Object)null)
						{
							Debug.LogWarning((object)"[Custom Items] Could not find a Collection Desire to nerf.");
							return;
						}
						StatBonusPerInscriptionStack ability = ((AbilityComponent<StatBonusPerInscriptionStack>)(object)componentInChildren)._ability;
						ability._inscriptionLevelForStackCounting += count;
						_inventory.UpdateSynergy();
					}
					return;
				}
				_collectionPresent = false;
			}
		}

		[SerializeField]
		internal int _count = 1;

		public override IAbilityInstance CreateInstance(Character owner)
		{
			return (IAbilityInstance)(object)new Instance(owner, this);
		}

		public object Clone()
		{
			return new NerfCollectionDesire
			{
				_count = _count,
				_defaultIcon = base._defaultIcon
			};
		}
	}
	public sealed class NerfCollectionDesireComponent : AbilityComponentHack<NerfCollectionDesire>
	{
	}
	[Serializable]
	public class PandorasBoxAbility : Ability, ICloneable
	{
		public class Instance : AbilityInstance<PandorasBoxAbility>
		{
			public Instance(Character owner, PandorasBoxAbility ability)
				: base(owner, ability)
			{
			}

			private static Rarity HigherRarity(Rarity rarity)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Invalid comparison between Unknown and I4
				if ((int)rarity != 0)
				{
					if ((int)rarity == 1)
					{
						return (Rarity)2;
					}
					return (Rarity)3;
				}
				return (Rarity)1;
			}

			private static IEnumerator Animation(Character owner, List<string> oldItems, List<string> newItems)
			{
				FloatingTextSpawner spawner = Singleton<Service>.Instance.floatingTextSpawner;
				Bounds bounds = ((Collider2D)owner.collider).bounds;
				float x = ((Bounds)(ref bounds)).center.x;
				bounds = ((Collider2D)owner.collider).bounds;
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(x, ((Bounds)(ref bounds)).max.y + 1f, 0f);
				bounds = ((Collider2D)owner.collider).bounds;
				float x2 = ((Bounds)(ref bounds)).center.x;
				bounds = ((Collider2D)owner.collider).bounds;
				Vector3 position = new Vector3(x2, ((Bounds)(ref bounds)).max.y + 0.25f, 0f);
				FloatingText title = spawner.Spawn("THE BOX HAS BEEN OPENED!", val);
				for (int i = 0; i < oldItems.Count; i++)
				{
					Singleton<Service>.Instance.levelManager.DropGold(500, 20);
					spawner.SpawnBuff("-" + oldItems[i], position, "#880088");
					yield return (object)new WaitForSeconds(0.2f);
					spawner.SpawnBuff("+" + newItems[i], position, "#AAAA33");
					yield return (object)new WaitForSeconds(0.5f);
				}
				title.FadeOut(0.5f);
			}

			public override void OnAttach()
			{
				//IL_0083: 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_008b: Invalid comparison between Unknown and I4
				//IL_009c: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
				ItemInventory item = ((AbilityInstance)this).owner.playerComponents.inventory.item;
				GearManager gearManager = Singleton<Service>.Instance.gearManager;
				Random random = new Random(Save.instance.randomSeed);
				List<string> list = new List<string>();
				List<string> list2 = new List<string>();
				LevelManager levelManager = Singleton<Service>.Instance.levelManager;
				for (int i = 0; i < item.items.Count; i++)
				{
					try
					{
						Item val = item.items[i];
						if (!((Object)(object)val == (Object)null))
						{
							list.Add(((Gear)val).displayName);
							ItemReference val2 = null;
							val2 = (((((Gear)val).gearTag & 8) != 8) ? gearManager.GetItemToTake(random, HigherRarity(((Gear)val).rarity)) : gearManager.GetOmenItems(random));
							ItemRequest val3 = val2.LoadAsync();
							((Request<Item>)(object)val3).WaitForCompletion();
							Item val4 = levelManager.DropItem(val3, Vector3.zero);
							val.ChangeOnInventory(val4);
							list2.Add(((Gear)val4).displayName);
						}
					}
					catch (Exception ex)
					{
						Debug.LogWarning((object)("[CustomItems - Pandora's Box] Error at item index " + i));
						Debug.LogWarning((object)ex.Message);
					}
				}
				((MonoBehaviour)((AbilityInstance)this).owner).StartCoroutine(Animation(((AbilityInstance)this).owner, list, list2));
			}

			public override void OnDetach()
			{
			}
		}

		public override IAbilityInstance CreateInstance(Character owner)
		{
			return (IAbilityInstance)(object)new Instance(owner, this);
		}

		public object Clone()
		{
			return new PandorasBoxAbility();
		}
	}
	public sealed class PandorasBoxAbilityComponent : AbilityComponentHack<PandorasBoxAbility>
	{
	}
	[Serializable]
	public class ReduceBoneInscriptionRequirement : Ability, ICloneable
	{
		public class Instance : AbilityInstance<ReduceBoneInscriptionRequirement>
		{
			private bool _bonePresent;

			public Instance(Character owner, ReduceBoneInscriptionRequirement ability)
				: base(owner, ability)
			{
			}

			public override void OnAttach()
			{
				InventoryUpdate(((AbilityInstance)this).owner.playerComponents.inventory);
				CustomItemsPatch.AfterInventoryUpdate -= InventoryUpdate;
				CustomItemsPatch.AfterInventoryUpdate += InventoryUpdate;
			}

			public override void OnDetach()
			{
				CustomItemsPatch.AfterInventoryUpdate -= InventoryUpdate;
				ModifyCount(base.ability._count);
			}

			private void ModifyCount(int amount)
			{
				Bone componentInChildren = ((Component)((AbilityInstance)this).owner).GetComponentInChildren<Bone>();
				if (!((Object)(object)componentInChildren == (Object)null))
				{
					_bonePresent = true;
					ModifyCount(componentInChildren, amount);
				}
			}

			private void ModifyCount(Bone bone, int amount)
			{
				Buff buff = bone._buff;
				buff.cycle += amount;
			}

			private void InventoryUpdate(Inventory inventory)
			{
				if (!_bonePresent)
				{
					Bone componentInChildren = ((Component)((AbilityInstance)this).owner).GetComponentInChildren<Bone>();
					if ((Object)(object)componentInChildren == (Object)null)
					{
						_bonePresent = false;
						return;
					}
					_bonePresent = true;
					ModifyCount(componentInChildren, -base.ability._count);
				}
			}
		}

		[SerializeField]
		internal int _count = 1;

		public override IAbilityInstance CreateInstance(Character owner)
		{
			return (IAbilityInstance)(object)new Instance(owner, this);
		}

		public object Clone()
		{
			return new ReduceBoneInscriptionRequirement
			{
				_count = _count,
				_defaultIcon = base._defaultIcon
			};
		}
	}
	public sealed class ReduceBoneInscriptionRequirementComponent : AbilityComponentHack<ReduceBoneInscriptionRequirement>
	{
	}
	[Serializable]
	public class StatBonusByGoldAmount : Ability, ICloneable
	{
		public class Instance : AbilityInstance<StatBonusByGoldAmount>
		{
			private const float _updateInterval = 0.25f;

			private float _remainUpdateTime;

			private Values _stat;

			private int _stack = -1;

			public override int iconStacks => _stack;

			public override float iconFillAmount => 0f;

			public Instance(Character owner, StatBonusByGoldAmount ability)
				: base(owner, ability)
			{
				_stat = ability._statsPerStack.Clone();
			}

			public override void OnAttach()
			{
				((AbilityInstance)this).owner.stat.AttachValues(_stat);
				UpdateStat();
			}

			public override void OnDetach()
			{
				((AbilityInstance)this).owner.stat.DetachValues(_stat);
			}

			public override void UpdateTime(float deltaTime)
			{
				((AbilityInstance)this).UpdateTime(deltaTime);
				_remainUpdateTime -= deltaTime;
				if (_remainUpdateTime < 0f)
				{
					_remainUpdateTime = 0.25f;
					UpdateStat();
				}
			}

			private void UpdateStat()
			{
				int num = (int)((float)Currency.gold.balance / base.ability._goldPerStack);
				if (num != _stack)
				{
					_stack = num;
					SetStat(_stack);
				}
			}

			private void SetStat(int stack)
			{
				Value[] values = ((ReorderableArray<Value>)(object)_stat).values;
				for (int i = 0; i < values.Length; i++)
				{
					values[i].value = ((ReorderableArray<Value>)(object)base.ability._statsPerStack).values[i].value * (double)stack;
				}
				((AbilityInstance)this).owner.stat.SetNeedUpdate();
			}
		}

		[SerializeField]
		public Values _statsPerStack;

		[SerializeField]
		public float _goldPerStack;

		public override IAbilityInstance CreateInstance(Character owner)
		{
			return (IAbilityInstance)(object)new Instance(owner, this);
		}

		public object Clone()
		{
			return new StatBonusByGoldAmount
			{
				_statsPerStack = _statsPerStack.Clone(),
				_defaultIcon = base._defaultIcon,
				_goldPerStack = _goldPerStack
			};
		}
	}
	public sealed class StatBonusByGoldAmountComponent : AbilityComponentHack<StatBonusByGoldAmount>
	{
	}
	[Serializable]
	public class StatBonusIfAllEnemiesAreAffectedByStatus : Ability, ICloneable
	{
		public class Instance : AbilityInstance<StatBonusIfAllEnemiesAreAffectedByStatus>
		{
			private const float _updateInterval = 0.1f;

			private float _remainUpdateTime;

			private Values _stat;

			private Kind _status;

			private bool _active;

			public override Sprite icon
			{
				get
				{
					if (!_active)
					{
						return null;
					}
					return ((AbilityInstance)this).icon;
				}
			}

			public Instance(Character owner, StatBonusIfAllEnemiesAreAffectedByStatus ability)
				: base(owner, ability)
			{
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				_status = ability._status;
				_stat = ability._stats.Clone();
			}

			public override void OnAttach()
			{
				UpdateStat();
			}

			public override void OnDetach()
			{
				if (_active)
				{
					_active = false;
					((AbilityInstance)this).owner.stat.DetachValues(_stat);
				}
			}

			public override void UpdateTime(float deltaTime)
			{
				((AbilityInstance)this).UpdateTime(deltaTime);
				_remainUpdateTime -= deltaTime;
				if (_remainUpdateTime < 0f)
				{
					_remainUpdateTime = 0.1f;
					UpdateStat();
				}
			}

			private void UpdateStat()
			{
				bool flag = AllEnemiesAreAffected();
				if (!_active && flag)
				{
					_active = true;
					((AbilityInstance)this).owner.stat.AttachValues(_stat);
				}
				else if (_active && !flag)
				{
					_active = false;
					((AbilityInstance)this).owner.stat.DetachValues(_stat);
				}
			}

			private bool AllEnemiesAreAffected()
			{
				Character[] array = (from character in Object.FindObjectsOfType<Character>()
					where (Object)(object)character.health != (Object)null && !((Health)character.health).dead && (int)character.type != 6 && (int)character.type != 8 && (int)character.type != 5
					select character).ToArray();
				int num = array.Count((Character enemy) => (Object)(object)enemy.status != (Object)null && enemy.status.IsApplying(_status));
				if (num > 0)
				{
					return num == array.Length;
				}
				return false;
			}
		}

		[SerializeField]
		public Values _stats;

		[SerializeField]
		public Kind _status;

		public override IAbilityInstance CreateInstance(Character owner)
		{
			return (IAbilityInstance)(object)new Instance(owner, this);
		}

		public object Clone()
		{
			//IL_0024: 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)
			return new StatBonusIfAllEnemiesAreAffectedByStatus
			{
				_stats = _stats.Clone(),
				_defaultIcon = base._defaultIcon,
				_status = _status
			};
		}
	}
	public sealed class StatBonusIfAllEnemiesAreAffectedByStatusComponent : AbilityComponentHack<StatBonusIfAllEnemiesAreAffectedByStatus>
	{
	}
	[Serializable]
	public class StatBonusPerHPPercent : Ability, ICloneable
	{
		public class Instance : AbilityInstance<StatBonusPerHPPercent>
		{
			private Values _stats;

			public override int iconStacks => (int)(((Health)((AbilityInstance)this).owner.health).percent * 100.0);

			public Instance(Character owner, StatBonusPerHPPercent ability)
				: base(owner, ability)
			{
			}

			private void RefreshStacks()
			{
				for (int i = 0; i < ((ReorderableArray<Value>)(object)_stats).values.Length; i++)
				{
					((ReorderableArray<Value>)(object)_stats).values[i].value = ((ReorderableArray<Value>)(object)base.ability._maxStat).values[i].GetMultipliedValue((float)((Health)((AbilityInstance)this).owner.health).percent);
				}
				((AbilityInstance)this).owner.stat.SetNeedUpdate();
			}

			public override void OnAttach()
			{
				_stats = base.ability._maxStat.Clone();
				((AbilityInstance)this).owner.stat.AttachValues(_stats);
				RefreshStacks();
				((Health)((AbilityInstance)this).owner.health)