Decompiled source of RUS DeadCellsCustomItems v1.0.3

plugins/DeadCellsCustomItems-v1.0.1_rus.dll

Decompiled 4 months ago
using System;
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.Gear;
using Characters.Gear.Items;
using Characters.Gear.Synergy.Inscriptions;
using Characters.Player;
using DeadCellsCustomItems.CustomAbilities;
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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[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("DeadCellsCustomItems")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Archlich has a fixed Death Trap skill. Infinite bone is happy again!")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+3a1355d4102e589326274b0336a681e4570f4db9")]
[assembly: AssemblyProduct("DeadCellsCustomItems")]
[assembly: AssemblyTitle("DeadCellsCustomItems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 ChangeItemWhenKilledBoss : MonoBehaviour
{
	[SerializeField]
	private Item _item = null;

	private void Awake()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		Character player = Singleton<Service>.Instance.levelManager.player;
		player.onKilled = (OnKilledDelegate)Delegate.Combine((Delegate?)(object)player.onKilled, (Delegate?)new OnKilledDelegate(CheckUpdateCondition));
	}

	private void OnDestroy()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		Character player = Singleton<Service>.Instance.levelManager.player;
		player.onKilled = (OnKilledDelegate)Delegate.Remove((Delegate?)(object)player.onKilled, (Delegate?)new OnKilledDelegate(CheckUpdateCondition));
	}

	private void CheckUpdateCondition(ITarget target, ref Damage damage)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Invalid comparison between Unknown and I4
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Invalid comparison between Unknown and I4
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		Character character = target.character;
		ItemReference val = default(ItemReference);
		if ((int)character.type == 3 && GearResource.instance.TryGetItemReferenceByName(((Object)_item).name.Substring(0, ((Object)_item).name.Length - 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);
			}
		}
	}
}
[Serializable]
public sealed class ChangeItemWhenLowHealth : MonoBehaviour
{
	[SerializeField]
	private Item _item = null;

	private void Awake()
	{
		((Health)Singleton<Service>.Instance.levelManager.player.health).onChanged += CheckUpdateCondition;
	}

	private void OnDestroy()
	{
		((Health)Singleton<Service>.Instance.levelManager.player.health).onChanged -= CheckUpdateCondition;
	}

	private void CheckUpdateCondition()
	{
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		CharacterHealth health = Singleton<Service>.Instance.levelManager.player.health;
		if (!(((Health)health).percent < 0.2))
		{
			return;
		}
		((Health)health).Heal(((Health)health).maximumHealth / 10.0 * 4.0, true);
		ItemReference val = default(ItemReference);
		if (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);
			}
		}
	}
}
[Serializable]
public sealed class MysteriousScrollKeyWordRandomizer : KeywordRandomizer
{
	private void Awake()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		((KeywordRandomizer)this).Awake();
		base._item.keyword1 = (Key)29;
		SecondInscriptionRandomizer();
	}

	private void SecondInscriptionRandomizer()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		Random random = new Random();
		int num = random.Next(0, 4);
		if (num >= 0 && num < 1)
		{
			base._item.keyword2 = (Key)5;
		}
		if (num >= 1 && num < 2)
		{
			base._item.keyword2 = (Key)18;
		}
		if (num >= 2 && num < 3)
		{
			base._item.keyword2 = (Key)25;
		}
		if (num == 3)
		{
			base._item.keyword2 = (Key)36;
		}
	}
}
[Serializable]
public sealed class UpgradeMysteriousScroll : MonoBehaviour
{
	[SerializeField]
	private Item _item = null;

	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_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Invalid comparison between Unknown and I4
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Invalid comparison between Unknown and I4
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Invalid comparison between Unknown and I4
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Invalid comparison between Unknown and I4
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Invalid comparison between Unknown and I4
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Invalid comparison between Unknown and I4
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Invalid comparison between Unknown and I4
		//IL_011f: 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_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: Invalid comparison between Unknown and I4
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_029b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a0: 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_02b2: Unknown result type (might be due to invalid IL or missing references)
		ItemReference val = default(ItemReference);
		if ((int)_item.keyword2 == 5 && GearResource.instance.TryGetItemReferenceByName(((Object)_item).name + "_1", 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;
				_item.ChangeOnInventory(val3);
			}
		}
		ItemReference val4 = default(ItemReference);
		if ((int)_item.keyword2 == 18 && GearResource.instance.TryGetItemReferenceByName(((Object)_item).name + "_2", ref val4))
		{
			ItemRequest val5 = val4.LoadAsync();
			((Request<Item>)(object)val5).WaitForCompletion();
			if ((int)((Gear)_item).state == 1)
			{
				Item val6 = Singleton<Service>.Instance.levelManager.DropItem(val5, Vector3.zero);
				val6.keyword1 = _item.keyword1;
				val6.keyword2 = _item.keyword2;
				_item.ChangeOnInventory(val6);
			}
		}
		ItemReference val7 = default(ItemReference);
		if ((int)_item.keyword2 == 25 && GearResource.instance.TryGetItemReferenceByName(((Object)_item).name + "_3", ref val7))
		{
			ItemRequest val8 = val7.LoadAsync();
			((Request<Item>)(object)val8).WaitForCompletion();
			if ((int)((Gear)_item).state == 1)
			{
				Item val9 = Singleton<Service>.Instance.levelManager.DropItem(val8, Vector3.zero);
				val9.keyword1 = _item.keyword1;
				val9.keyword2 = _item.keyword2;
				_item.ChangeOnInventory(val9);
			}
		}
		ItemReference val10 = default(ItemReference);
		if ((int)_item.keyword2 == 36 && GearResource.instance.TryGetItemReferenceByName(((Object)_item).name + "_4", ref val10))
		{
			ItemRequest val11 = val10.LoadAsync();
			((Request<Item>)(object)val11).WaitForCompletion();
			if ((int)((Gear)_item).state == 1)
			{
				Item val12 = Singleton<Service>.Instance.levelManager.DropItem(val11, Vector3.zero);
				val12.keyword1 = _item.keyword1;
				val12.keyword2 = _item.keyword2;
				_item.ChangeOnInventory(val12);
			}
		}
	}
}
namespace DeadCellsCustomItems
{
	[Serializable]
	public class CustomItemReference : ItemReference
	{
		private string _originalName;

		public string itemName_EN;

		public string itemName_KR;

		public string itemDescription_EN;

		public string itemDescription_KR;

		public string itemLore_EN;

		public string itemLore_KR;

		public Values stats;

		public Ability[] abilities;

		public Type[] extraComponents;

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

		public Sprite miniIcon;

		private Item item = null;

		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 string itemName => itemName_EN;

		public string itemDescription => itemDescription_EN;

		public string itemLore => itemLore_EN;

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

		public Item GetItem(Item baseItem)
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Expected O, but got Unknown
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Expected O, but got Unknown
			//IL_01a2: Expected O, but got Unknown
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Expected O, but got Unknown
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			Sprite result = null;
			try
			{
				Assembly assembly = typeof(CustomItemReference).Assembly;
				Stream manifestResourceStream = assembly.GetManifestResourceStream("DeadCellsCustomItems.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;
				int num = 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Expected O, but got Unknown
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Expected O, but got Unknown
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Expected O, but got Unknown
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Expected O, but got Unknown
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: 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_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Expected O, but got Unknown
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Expected O, but got Unknown
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Expected O, but got Unknown
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Expected O, but got Unknown
			//IL_0436: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Expected O, but got Unknown
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Expected O, but got Unknown
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Expected O, but got Unknown
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0520: Expected O, but got Unknown
			//IL_0520: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Expected O, but got Unknown
			//IL_0554: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e9: Expected O, but got Unknown
			//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: Expected O, but got Unknown
			//IL_0619: Unknown result type (might be due to invalid IL or missing references)
			//IL_061f: Expected O, but got Unknown
			//IL_0634: Unknown result type (might be due to invalid IL or missing references)
			//IL_063a: Expected O, but got Unknown
			//IL_063a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0644: Expected O, but got Unknown
			//IL_0666: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_074b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0754: Unknown result type (might be due to invalid IL or missing references)
			//IL_079d: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f6: Unknown result type (might be due to invalid IL or missing references)
			List<CustomItemReference> list = new List<CustomItemReference>();
			CustomItemReference customItemReference = new CustomItemReference();
			customItemReference.name = "CursedSword";
			((GearReference)customItemReference).rarity = (Rarity)3;
			customItemReference.itemName_EN = "Проклятый меч";
			customItemReference.itemName_KR = "저주받은 검";
			customItemReference.itemDescription_EN = "Увеличивает <color=#F25D1C>физическую атаку</color> на 1000% и усиливает <color=#F25D1C>физический урон</color> на 400%..\nМгновенная смерть при получении урона, ни ртутные сердца, ни броня не работают.";
			customItemReference.itemDescription_KR = "<color=#F25D1C>물리공격력</color>이 1000% 증가 및 300% 증폭됩니다.\n피격 시 무적과 패링을 제외한 모든 피해 무효화 수단을 무시하고 즉사합니다.";
			customItemReference.itemLore_EN = "Убей, пока тебя не убили. Просто, правда?";
			customItemReference.itemLore_KR = "자, 죽기 전에 죽이면 돼. 간단하지?";
			((ItemReference)customItemReference).prefabKeyword1 = (Key)10;
			((ItemReference)customItemReference).prefabKeyword2 = (Key)2;
			customItemReference.stats = new Values((Value[])(object)new Value[2]
			{
				new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 10.0),
				new Value(Category.Percent, Kind.PhysicalAttackDamage, 5.0)
			});
			customItemReference.abilities = (Ability[])(object)new Ability[1]
			{
				new InstaKillIgnoringNegation()
			};
			list.Add(customItemReference);
			CustomItemReference customItemReference2 = new CustomItemReference();
			customItemReference2.name = "MysteriousScroll";
			((GearReference)customItemReference2).rarity = (Rarity)2;
			customItemReference2.itemName_EN = "Таинственный свиток";
			customItemReference2.itemName_KR = "미지의 두루마리";
			customItemReference2.itemDescription_EN = "Увеличивает <color=#F25D1C>физическую атаку</color> на 25%.\nУвеличивает скорость перезарядки навыков на 25%.\nУменьшает входящий урон на 10%.\nУвеличивает максимальное количество ОЗ на 30.\nВторая надпись этого предмета выбирается случайным образом между Отвагой, Циклом маны, Местью и Загадкой.\nУлучшенная версия этого предмета меняется в зависимости от его второй надписи.";
			customItemReference2.itemDescription_KR = "<color=#F25D1C>물리공격력</color>이 25% 증가합니다.\n스킬 쿨다운 속도가 25% 증가합니다.\n받는 데미지가 10% 감소합니다.\n최대체력이 20 증가합니다\n이 아이템의 두번째 각인은 임의로 용기, 마나 순환, 복수, 그리고 신비중 하나로 지정됩니다.\n이 아이템의 강화된 버전은 두번째 각인에 따라 바뀝니다.";
			customItemReference2.itemLore_EN = "Незнание того, что внутри, делает его ценным.";
			customItemReference2.itemLore_KR = "안에 뭐가 들었는지 모르니까 가치가 있는 법이다.";
			((ItemReference)customItemReference2).prefabKeyword1 = (Key)29;
			((ItemReference)customItemReference2).prefabKeyword2 = (Key)0;
			customItemReference2.stats = new Values((Value[])(object)new Value[4]
			{
				new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 0.25),
				new Value(Category.PercentPoint, Kind.SkillCooldownSpeed, 0.25),
				new Value(Category.Percent, Kind.TakingDamage, 0.9),
				new Value(Category.Fixed, Kind.Health, 20.0)
			});
			customItemReference2.extraComponents = new Type[1] { typeof(MysteriousScrollKeyWordRandomizer) };
			list.Add(customItemReference2);
			CustomItemReference customItemReference3 = new CustomItemReference();
			customItemReference3.name = "MysteriousScroll_2";
			((GearReference)customItemReference3).obtainable = false;
			((GearReference)customItemReference3).rarity = (Rarity)2;
			customItemReference3.itemName_EN = "Свиток силы: Эволюция";
			customItemReference3.itemName_KR = "권능의 두루마리: 진화체";
			customItemReference3.itemDescription_EN = "Если этот предмет был найден непреднамеренно, пожалуйста, сообщите мне как можно скорее!";
			customItemReference3.itemDescription_KR = "만약 예기치 않게 이 아이템을 발견하셨다면, 저한테 바로 신고해주세요!";
			customItemReference3.itemLore_EN = "О-откуда ты это взял...?";
			customItemReference3.itemLore_KR = "뭐야... 이거 어디서 가져온거야..?";
			((ItemReference)customItemReference3).prefabKeyword1 = (Key)29;
			((ItemReference)customItemReference3).prefabKeyword2 = (Key)0;
			customItemReference3.forbiddenDrops = new string[1] { "MysteriousScroll" };
			customItemReference3.extraComponents = new Type[1] { typeof(UpgradeMysteriousScroll) };
			list.Add(customItemReference3);
			CustomItemReference customItemReference4 = new CustomItemReference();
			customItemReference4.name = "MysteriousScroll_2_1";
			((GearReference)customItemReference4).obtainable = false;
			((GearReference)customItemReference4).rarity = (Rarity)2;
			customItemReference4.itemName_EN = "Свиток силы: Жестокость";
			customItemReference4.itemName_KR = "권능의 두루마리: 잔혹성";
			customItemReference4.itemDescription_EN = "Увеличивает <color=#F25D1C>физическую атаку</color> на 75%.\nУвеличивает максимальное количество ОЗ на 55.";
			customItemReference4.itemDescription_KR = "<color=#F25D1C>물리공격력</color>이 75% 증가합니다.\n최대체력이 55 증가합니다.";
			customItemReference4.itemLore_EN = "Свиток силы, олицетворяющий жестокость.\nТолько истинные бойцы могут научиться использовать этот свиток.";
			customItemReference4.itemLore_KR = "잔혹성을 대표하는 권능의 두루마리.\n진정한 싸움꾼들만이 이 두루마리를 응용할 수 있다.";
			((ItemReference)customItemReference4).prefabKeyword1 = (Key)0;
			((ItemReference)customItemReference4).prefabKeyword2 = (Key)0;
			customItemReference4.forbiddenDrops = new string[1] { "MysteriousScroll" };
			customItemReference4.stats = new Values((Value[])(object)new Value[2]
			{
				new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 0.75),
				new Value(Category.Fixed, Kind.Health, 55.0)
			});
			list.Add(customItemReference4);
			CustomItemReference customItemReference5 = new CustomItemReference();
			customItemReference5.name = "MysteriousScroll_2_2";
			((GearReference)customItemReference5).obtainable = false;
			((GearReference)customItemReference5).rarity = (Rarity)2;
			customItemReference5.itemName_EN = "Свиток силы: Тактика";
			customItemReference5.itemName_KR = "권능의 두루마리: 전략가";
			customItemReference5.itemDescription_EN = "Увеличивает скорость перезарядки навыков на 75%.\nУвеличивает максимальное ОЗ на 40.";
			customItemReference5.itemDescription_KR = "스킬 쿨다운 속도가 75% 증가합니다.\n최대체력이 40 증가합니다.";
			customItemReference5.itemLore_EN = "Свиток силы, представляющий тактику.\nВсегда помните, что терпение - ключ к победе";
			customItemReference5.itemLore_KR = "전략가를 대표하는 권능의 두루마리.\n침착함이야말로 승리를 향한 길임을 명심하자.";
			((ItemReference)customItemReference5).prefabKeyword1 = (Key)0;
			((ItemReference)customItemReference5).prefabKeyword2 = (Key)0;
			customItemReference5.forbiddenDrops = new string[1] { "MysteriousScroll" };
			customItemReference5.stats = new Values((Value[])(object)new Value[2]
			{
				new Value(Category.PercentPoint, Kind.SkillCooldownSpeed, 0.75),
				new Value(Category.Fixed, Kind.Health, 40.0)
			});
			list.Add(customItemReference5);
			CustomItemReference customItemReference6 = new CustomItemReference();
			customItemReference6.name = "MysteriousScroll_2_3";
			((GearReference)customItemReference6).obtainable = false;
			((GearReference)customItemReference6).rarity = (Rarity)2;
			customItemReference6.itemName_EN = "Свиток силы: Выживание";
			customItemReference6.itemName_KR = "권능의 두루마리: 생존술";
			customItemReference6.itemDescription_EN = "Снижает входящий урон на 30%.\nУвеличивает максимальное количество ОЗ на 60";
			customItemReference6.itemDescription_KR = "받는 데미지가 30% 감소합니다.\n최대체력이 60 증가합니다.";
			customItemReference6.itemLore_EN = "Свиток силы, олицетворяющий выживание.\nНе сильнейший выживает, а выживший становится сильнейшим.";
			customItemReference6.itemLore_KR = "생존술을 대표하는 권능의 두루마리.\n강한 자가 살아남는 것이 아니라, 살아남는 자가 강한 것이다.";
			((ItemReference)customItemReference6).prefabKeyword1 = (Key)0;
			((ItemReference)customItemReference6).prefabKeyword2 = (Key)0;
			customItemReference6.forbiddenDrops = new string[1] { "MysteriousScroll" };
			customItemReference6.stats = new Values((Value[])(object)new Value[2]
			{
				new Value(Category.Percent, Kind.TakingDamage, 0.7),
				new Value(Category.Fixed, Kind.Health, 60.0)
			});
			list.Add(customItemReference6);
			CustomItemReference customItemReference7 = new CustomItemReference();
			customItemReference7.name = "MysteriousScroll_2_4";
			((GearReference)customItemReference7).obtainable = false;
			((GearReference)customItemReference7).rarity = (Rarity)2;
			customItemReference7.itemName_EN = "Эпический свиток силы";
			customItemReference7.itemName_KR = "전능의 두루마리";
			customItemReference7.itemDescription_EN = "Увеличивает <color=#F25D1C>физическую атаку</color> на 40%.\nУвеличивает скорость перезарядки навыков на 40%.\nУменьшает входящий урон на 20%.\nУвеличивает максимальное количество ОЗ на 45.";
			customItemReference7.itemDescription_KR = "<color=#F25D1C>물리공격력</color>이 40% 증가합니다.\n스킬 쿨다운 속도가 40% 증가합니다.\n받는 데미지가 20% 감소합니다.\n최대체력이 45 증가합니다.";
			customItemReference7.itemLore_EN = "Это сделает тренировки как минимум в 3 раза эффективнее!";
			customItemReference7.itemLore_KR = "이걸로 수련의 능률이 3배는 오르겠군!";
			((ItemReference)customItemReference7).prefabKeyword1 = (Key)0;
			((ItemReference)customItemReference7).prefabKeyword2 = (Key)0;
			customItemReference7.forbiddenDrops = new string[1] { "MysteriousScroll" };
			customItemReference7.stats = new Values((Value[])(object)new Value[4]
			{
				new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 0.4),
				new Value(Category.PercentPoint, Kind.SkillCooldownSpeed, 0.4),
				new Value(Category.Percent, Kind.TakingDamage, 0.8),
				new Value(Category.Fixed, Kind.Health, 45.0)
			});
			list.Add(customItemReference7);
			CustomItemReference customItemReference8 = new CustomItemReference();
			customItemReference8.name = "ShieldOfGreed";
			((GearReference)customItemReference8).rarity = (Rarity)0;
			customItemReference8.itemName_EN = "Щит жадности";
			customItemReference8.itemName_KR = "탐욕의 방패";
			customItemReference8.itemDescription_EN = "Получив удар, вы получаете 15 золотых (максимум 5 раз за комнату)";
			customItemReference8.itemDescription_KR = "피격 시 15 금화가 떨어집니다 (방마다 5회 제한).";
			customItemReference8.itemLore_EN = "Серьезно, кто вообще может заработать на том, что его бьют?\nДавайте сделаем это.";
			customItemReference8.itemLore_KR = "맞으면서 돈을 벌다니, 그것 참 한심한 생각이군.\n당장 하자.";
			((ItemReference)customItemReference8).prefabKeyword1 = (Key)8;
			((ItemReference)customItemReference8).prefabKeyword2 = (Key)32;
			customItemReference8.abilities = (Ability[])(object)new Ability[1]
			{
				new GainGoldUponHit()
			};
			list.Add(customItemReference8);
			CustomItemReference customItemReference9 = new CustomItemReference();
			customItemReference9.name = "EmergencyHealthFlask";
			((GearReference)customItemReference9).rarity = (Rarity)1;
			customItemReference9.itemName_EN = "Экстренная фляга";
			customItemReference9.itemName_KR = "비상용 회복약";
			customItemReference9.itemDescription_EN = "При ОЗ ниже 20%, опустошает флягу здоровья и восстанавливает 40% ОЗ";
			customItemReference9.itemDescription_KR = "현재 체력이 20% 미만일 시 회복약을 비우며 현재 체력의 40%를 회복합니다.";
			customItemReference9.itemLore_EN = "Она одноразовая, поэтому обращайтесь с ней осторожно";
			customItemReference9.itemLore_KR = "일회용이니 취급에 주의해주세요.";
			((ItemReference)customItemReference9).prefabKeyword1 = (Key)1;
			((ItemReference)customItemReference9).prefabKeyword2 = (Key)14;
			customItemReference9.extraComponents = new Type[1] { typeof(ChangeItemWhenLowHealth) };
			list.Add(customItemReference9);
			CustomItemReference customItemReference10 = new CustomItemReference();
			customItemReference10.name = "EmergencyHealthFlask_2";
			((GearReference)customItemReference10).obtainable = false;
			((GearReference)customItemReference10).rarity = (Rarity)1;
			customItemReference10.itemName_EN = "Пустая фляга";
			customItemReference10.itemName_KR = "빈 유리관";
			customItemReference10.itemDescription_EN = "После победы над боссом пополняет пустую флягу";
			customItemReference10.itemDescription_KR = "보스 처치 시 회복약이 다시 채워집니다.";
			customItemReference10.itemLore_EN = "Вы не должны... пить это...";
			customItemReference10.itemLore_KR = "아니... 그걸 한입에 쳐 마시면... 하...";
			((ItemReference)customItemReference10).prefabKeyword1 = (Key)1;
			((ItemReference)customItemReference10).prefabKeyword2 = (Key)14;
			customItemReference10.extraComponents = new Type[1] { typeof(ChangeItemWhenKilledBoss) };
			list.Add(customItemReference10);
			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();
		}
	}
	[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 event ManatechPartDelegate OnManatechPart;

		public static event InventoryUpdateDelegate OnInventoryUpdate;

		[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);
		}

		[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_0003: 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_0003: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			if (!requestDict.ContainsKey(request))
			{
				return true;
			}
			CustomItemReference customItemReference = requestDict[request];
			Item item = customItemReference.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 (!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);
		}
	}
	[BepInPlugin("DeadCellsCustomItems", "DeadCellsCustomItems", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			Harmony.CreateAndPatchAll(typeof(CustomItemsPatch), (string)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod DeadCellsCustomItems is loaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "DeadCellsCustomItems";

		public const string PLUGIN_NAME = "DeadCellsCustomItems";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}
namespace DeadCellsCustomItems.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 GainGoldUponHit : Ability, ICloneable
	{
		public class Instance : AbilityInstance<GainGoldUponHit>
		{
			private int _stacks;

			private LevelManager _levelManager;

			public override int iconStacks => _stacks;

			public override Sprite icon
			{
				get
				{
					if (_stacks == 0)
					{
						return null;
					}
					return ((Ability)base.ability)._defaultIcon;
				}
			}

			public Instance(Character owner, GainGoldUponHit ability)
				: base(owner, ability)
			{
				_levelManager = Singleton<Service>.Instance.levelManager;
			}

			public override void OnAttach()
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Expected O, but got Unknown
				((Health)((AbilityInstance)this).owner.health).onTakeDamage.Add(100000, new TakeDamageDelegate(HandleOnTakeDamage));
				_levelManager.onMapLoadedAndFadedIn += ResetStack;
				_stacks = 5;
			}

			public override void OnDetach()
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Expected O, but got Unknown
				((Health)((AbilityInstance)this).owner.health).onTakeDamage.Remove(new TakeDamageDelegate(HandleOnTakeDamage));
				_levelManager.onMapLoadedAndFadedIn -= ResetStack;
			}

			private bool HandleOnTakeDamage(ref Damage damage)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				if (((AbilityInstance)this).owner.invulnerable.value)
				{
					return false;
				}
				AttackType attackType = damage.attackType;
				if (((object)(AttackType)(ref attackType)).Equals((object)(AttackType)0))
				{
					return false;
				}
				if (damage.@null)
				{
					return false;
				}
				if (((Damage)(ref damage)).amount < 1.0)
				{
					return false;
				}
				if (_stacks <= 0)
				{
					return false;
				}
				_stacks--;
				Singleton<Service>.Instance.levelManager.DropGold(15, 5, ((Component)((AbilityInstance)this).owner).transform.position);
				return false;
			}

			private void ResetStack()
			{
				_stacks = 5;
			}
		}

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

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

			public override void OnAttach()
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Expected O, but got Unknown
				((Health)((AbilityInstance)this).owner.health).onTakeDamage.Add(2000, new TakeDamageDelegate(HandleOnTakeDamage));
			}

			public override void OnDetach()
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Expected O, but got Unknown
				((Health)((AbilityInstance)this).owner.health).onTakeDamage.Remove(new TakeDamageDelegate(HandleOnTakeDamage));
			}

			private bool HandleOnTakeDamage(ref Damage damage)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				if (((AbilityInstance)this).owner.invulnerable.value)
				{
					return false;
				}
				AttackType attackType = damage.attackType;
				if (((object)(AttackType)(ref attackType)).Equals((object)(AttackType)0))
				{
					return false;
				}
				if (damage.@null)
				{
					return false;
				}
				if (((Damage)(ref damage)).amount < 1.0)
				{
					return false;
				}
				((Health)((AbilityInstance)this).owner.health).TryKill();
				return false;
			}
		}

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

		public object Clone()
		{
			return new InstaKillIgnoringNegation
			{
				_defaultIcon = base._defaultIcon
			};
		}
	}
	public sealed class InstaKillIgnoringNegationComponent : AbilityComponentHack<InstaKillIgnoringNegation>
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}