Decompiled source of ChaosArmor v13.0.6

BepInEx/plugins/ChaosArmor.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BlacksmithTools;
using HarmonyLib;
using ItemManager;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Audio;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Core.Tokens;
using YamlDotNet.Helpers;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.Converters;
using YamlDotNet.Serialization.EventEmitters;
using YamlDotNet.Serialization.NamingConventions;
using YamlDotNet.Serialization.NodeDeserializers;
using YamlDotNet.Serialization.NodeTypeResolvers;
using YamlDotNet.Serialization.ObjectFactories;
using YamlDotNet.Serialization.ObjectGraphTraversalStrategies;
using YamlDotNet.Serialization.ObjectGraphVisitors;
using YamlDotNet.Serialization.Schemas;
using YamlDotNet.Serialization.TypeInspectors;
using YamlDotNet.Serialization.TypeResolvers;
using YamlDotNet.Serialization.Utilities;
using YamlDotNet.Serialization.ValueDeserializers;

[assembly: AssemblyProduct("ChaosArmor")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCompany("ChaosArmor")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyTitle("ChaosArmor")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ChaosArmor
{
	public class ButchersNails : MonoBehaviour
	{
		private Humanoid wearer;

		public void Start()
		{
			Transform root = ((Component)this).transform.root;
			object obj;
			if (root == null)
			{
				obj = null;
			}
			else
			{
				GameObject gameObject = ((Component)root).gameObject;
				obj = ((gameObject != null) ? gameObject.GetComponent<Player>() : null);
			}
			wearer = (Humanoid)obj;
			if ((Object)(object)wearer != (Object)null)
			{
				Humanoid obj2 = wearer;
				((Character)obj2).m_onDamaged = (Action<float, Character>)Delegate.Combine(((Character)obj2).m_onDamaged, new Action<float, Character>(OnDamaged));
			}
		}

		public void OnDisable()
		{
			if ((Object)(object)wearer != (Object)null)
			{
				Humanoid obj = wearer;
				((Character)obj).m_onDamaged = (Action<float, Character>)Delegate.Remove(((Character)obj).m_onDamaged, new Action<float, Character>(OnDamaged));
			}
			wearer = null;
		}

		public void OnDamaged(float dmg, Character idfkLol)
		{
			float maxHealth = ((Character)wearer).GetMaxHealth();
			if (dmg > Math.Min(50f, maxHealth / 2f))
			{
				((Character)wearer).AddStamina(40f);
			}
			else if (dmg >= 5f)
			{
				((Character)wearer).AddStamina(15f);
			}
		}
	}
	[BepInPlugin("ReepusDeepusDelmeepus4902761.ChaosArmor", "ChaosArmor", "13.0.5")]
	public class ReepusDeepusDelmeepusChaosArmor : BaseUnityPlugin
	{
		[HarmonyPatch]
		public static class ObjectDBPatch
		{
			[HarmonyPatch(typeof(ObjectDB), "Awake")]
			[HarmonyPostfix]
			[HarmonyPriority(0)]
			public static void Patch_ObjectDBAwake(ObjectDB __instance)
			{
				StatusEffect statusEffect = __instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode(shieldVanilla));
				staffShield = (SE_Shield)(object)((statusEffect is SE_Shield) ? statusEffect : null);
			}
		}

		[HarmonyPatch]
		public static class ZNetScenePatch
		{
			[HarmonyPatch(typeof(ZNetScene), "Awake")]
			[HarmonyPostfix]
			public static void Patch_ZNetSceneAwake(ZNetScene __instance)
			{
				__instance.m_prefabs.Add(Clanka.prefabStep);
				__instance.m_prefabs.Add(Clanka.prefabRun);
				__instance.m_prefabs.Add(Clanka.prefabJump);
				__instance.m_prefabs.Add(Clanka.prefabDodge);
				__instance.m_prefabs.Add(Clanka.prefabLand);
				__instance.m_prefabs.Add(Clanka.prefabBootStep);
			}
		}

		[HarmonyPatch]
		public static class AudioManPatch
		{
			private static void SetAudioMixerGroup(GameObject prefab, AudioMixerGroup group)
			{
				AudioSource component = prefab.GetComponent<AudioSource>();
				component.outputAudioMixerGroup = group;
			}

			[HarmonyPatch(typeof(AudioMan), "Awake")]
			[HarmonyPostfix]
			public static void Patch_AudioManAwake(AudioMan __instance)
			{
				if (!((Object)(object)Clanka.prefabStep == (Object)null))
				{
					AudioMixerGroup group = __instance.m_ambientMixer.audioMixer.FindMatchingGroups("Effects/SFX").FirstOrDefault();
					SetAudioMixerGroup(Clanka.prefabStep, group);
					SetAudioMixerGroup(Clanka.prefabRun, group);
					SetAudioMixerGroup(Clanka.prefabDodge, group);
					SetAudioMixerGroup(Clanka.prefabLand, group);
					SetAudioMixerGroup(Clanka.prefabJump, group);
					SetAudioMixerGroup(Clanka.prefabBootRun, group);
					SetAudioMixerGroup(Clanka.prefabBootStep, group);
				}
			}
		}

		private const string ModName = "ChaosArmor";

		private const string ModVersion = "13.0.5";

		private const string ModGUID = "ReepusDeepusDelmeepus4902761.ChaosArmor";

		private const string T0Chest = "T0ChaosPlateArmor";

		private const string T1Chest = "T1ChaosPlateArmor";

		private const string T2Chest = "T2ChaosPlateArmor";

		private const string T3Chest = "ChaosPlateArmorBody";

		private const string T4Chest = "EliteChaosPlateArmor";

		private const string T5UChest = "EliteChaosPlateArmorT2";

		private const string T5Chest = "EliteChaosPlateArmorTzeentch";

		private const string T0ASSLegs = "T0ChaosPlateLegs";

		private const string T1ASSLegs = "T1ChaosPlateLegs";

		private const string T2ASSLegs = "T2ChaosPlateLegs";

		private const string T3ASSLegs = "ChaosPlateLegs";

		private const string T4ASSLegs = "EliteChaosPlateLegs";

		private const string T5UASSLegs = "EliteChaosPlateLegsT2";

		private const string T5ASSLegs = "EliteChaosPlateLegsTzeentch";

		private static string shieldVanilla = "Staff_shield";

		public static int T1Hash;

		public static int T2Hash;

		public static int T3Hash;

		public static int T4Hash;

		public static int T5Hash;

		public static int T5UHash;

		public static HashSet<int> clankyPrefabNames = new HashSet<int>();

		public static SE_Shield staffShield;

		private static ConfigEntry<bool> doTheRoar;

		private static SE_Stats T3SetStatus;

		private static SE_Stats T4SetStatus;

		private Assembly assembly;

		private Localization LocalizationClusterfuck;

		public static bool DoTheRoar => doTheRoar.Value;

		public void Awake()
		{
			//IL_16ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_1704: Unknown result type (might be due to invalid IL or missing references)
			//IL_170b: Unknown result type (might be due to invalid IL or missing references)
			//IL_171b: Expected O, but got Unknown
			//IL_171b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1720: Unknown result type (might be due to invalid IL or missing references)
			//IL_1727: Unknown result type (might be due to invalid IL or missing references)
			//IL_1737: Expected O, but got Unknown
			//IL_1755: Unknown result type (might be due to invalid IL or missing references)
			//IL_175c: Expected O, but got Unknown
			assembly = Assembly.GetExecutingAssembly();
			T1Hash = StringExtensionMethods.GetStableHashCode("T1ChaosPlateArmor");
			T2Hash = StringExtensionMethods.GetStableHashCode("T2ChaosPlateArmor");
			T3Hash = StringExtensionMethods.GetStableHashCode("ChaosPlateArmorBody");
			T4Hash = StringExtensionMethods.GetStableHashCode("EliteChaosPlateArmor");
			T5Hash = StringExtensionMethods.GetStableHashCode("EliteChaosPlateArmorTzeentch");
			T5UHash = StringExtensionMethods.GetStableHashCode("EliteChaosPlateArmorT2");
			clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("T0ChaosPlateArmor"));
			clankyPrefabNames.Add(T1Hash);
			clankyPrefabNames.Add(T2Hash);
			clankyPrefabNames.Add(T3Hash);
			clankyPrefabNames.Add(T4Hash);
			clankyPrefabNames.Add(T5Hash);
			clankyPrefabNames.Add(T5UHash);
			clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("T0ChaosPlateLegs"));
			clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("T1ChaosPlateLegs"));
			clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("T2ChaosPlateLegs"));
			clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("ChaosPlateLegs"));
			clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("EliteChaosPlateLegs"));
			clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("EliteChaosPlateLegsT2"));
			clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("EliteChaosPlateLegsTzeentch"));
			LoadTranslations();
			SetStatusEffects();
			Item item = new Item("chaosarmor", "T0ChaosPlateArmor");
			item.Name.English("Scrap Breastplate");
			item.Description.English("A plain breastplate cast from metal, warped and dented from what feels like a lifetime of use. It's barely holding together, yet something feels strangely familiar about the make, barren as it is now. A strange icon is clasped over it.");
			item.Crafting.Add(CraftingTable.Forge, 1);
			item.RequiredItems.Add("Bronze", 5);
			item.RequiredItems.Add("TrophyFrostTroll", 1);
			item.RequiredItems.Add("LeatherScraps", 9);
			item.RequiredUpgradeItems.Add("Bronze", 3);
			RegisterTranslations(item);
			Item item2 = new Item("chaosarmor", "T0ChaosPlateHelm");
			item2.Name.English("Scrap Helmet");
			item2.Description.English("A full helm cast from metal with a narrow visor. The wear of elements and war have taken a toll upon its integrity, but perhaps the familiarity of all-encasing metal is comfort enough for some.");
			item2.Crafting.Add(CraftingTable.Forge, 1);
			item2.RequiredItems.Add("Bronze", 6);
			item2.RequiredItems.Add("TrollHide", 3);
			item2.RequiredUpgradeItems.Add("Bronze", 4);
			RegisterTranslations(item2);
			Item item3 = new Item("chaosarmor", "T0ChaosPlateLegs");
			item3.Name.English("Scrap greaves");
			item3.Description.English("Unremarkable breeches and boots reinforced with well-worn metal. What little plating remains is battered almost beyond use, but its weight offers an anchor in unfamiliar lands.");
			item3.Crafting.Add(CraftingTable.Forge, 1);
			item3.RequiredItems.Add("Bronze", 4);
			item3.RequiredItems.Add("TrollHide", 2);
			item3.RequiredUpgradeItems.Add("Bronze", 2);
			RegisterTranslations(item3);
			Item item4 = new Item("chaosarmor", "T1ChaosPlateArmor");
			item4.Name.English("Half plate harness");
			item4.Description.English("A battered suit of heavy plate. The eight-spoked star clasped over the breastplate is dull and rusted. Reduces knockback from incoming attacks.");
			item4.Crafting.Add(CraftingTable.Forge, 1);
			item4.RequiredItems.Add("Iron", 25);
			item4.RequiredItems.Add("T0ChaosPlateArmor", 1);
			item4.RequiredItems.Add("LeatherScraps", 9);
			item4.RequiredUpgradeItems.Add("Iron", 5);
			item4.CraftAmount = 1;
			RegisterTranslations(item4);
			Item item5 = new Item("chaosarmor", "T1ChaosPlateHelm");
			item5.Name.English("Grave-iron plate helm");
			item5.Description.English("An iron plate helm, shrouded in funeral rags. Time will tell if the looming shadow of death comes for you or your foes.");
			item5.Crafting.Add(CraftingTable.Forge, 1);
			item5.RequiredItems.Add("Iron", 25);
			item5.RequiredItems.Add("T0ChaosPlateHelm", 1);
			item5.RequiredItems.Add("TrophyWraith", 1);
			item5.RequiredUpgradeItems.Add("Iron", 3);
			item5.CraftAmount = 1;
			RegisterTranslations(item5);
			Item item6 = new Item("chaosarmor", "T1ChaosPlateLegs");
			item6.Name.English("Battered plate leggings");
			item6.Description.English("Thick leather leggings reinforced with metal. The armor plates are heavy, anchoring the boots to the earth with stains and scars that cannot be erased.");
			item6.Crafting.Add(CraftingTable.Forge, 1);
			item6.RequiredItems.Add("Iron", 20);
			item6.RequiredItems.Add("LeatherScraps", 4);
			item6.RequiredItems.Add("T0ChaosPlateLegs", 1);
			item6.RequiredUpgradeItems.Add("Iron", 3);
			item6.RequiredUpgradeItems.Add("TrollHide", 5);
			item6.CraftAmount = 1;
			RegisterTranslations(item6);
			Item item7 = new Item("chaosarmor", "T2ChaosPlateArmor");
			item7.Name.English("Three quarters plate harness");
			item7.Description.English("A battered suit of heavy plate, cast from blackened silver. The eight-spoked star clasped over the breastplate catches the sun's rays with an uncanny, icy glint. Reduces knockback from incoming attacks.");
			item7.Crafting.Add(CraftingTable.Forge, 1);
			item7.RequiredItems.Add("Silver", 30);
			item7.RequiredItems.Add("Obsidian", 15);
			item7.RequiredItems.Add("FreezeGland", 5);
			item7.RequiredItems.Add("T1ChaosPlateArmor", 1);
			item7.RequiredUpgradeItems.Add("Silver", 10);
			item7.RequiredUpgradeItems.Add("FreezeGland", 5);
			item7.CraftAmount = 1;
			RegisterTranslations(item7);
			Item item8 = new Item("chaosarmor", "T2ChaosPlateHelm");
			item8.Name.English("Profaned plate helm");
			item8.Description.English("An icy plate helm, brazenly wreathed in tooth and cloth. Whether it is worn in ghastly tribute to the wolfmen or in bloody defiance is up to you.");
			item8.Crafting.Add(CraftingTable.Forge, 1);
			item8.RequiredItems.Add("Silver", 20);
			item8.RequiredItems.Add("TrophyCultist", 1);
			item8.RequiredItems.Add("FreezeGland", 5);
			item8.RequiredItems.Add("T1ChaosPlateHelm", 1);
			item8.RequiredUpgradeItems.Add("Silver", 5);
			item8.RequiredUpgradeItems.Add("FreezeGland", 5);
			item8.CraftAmount = 1;
			RegisterTranslations(item8);
			Item item9 = new Item("chaosarmor", "T2ChaosPlateLegs");
			item9.Name.English("Refurbished plate leggings");
			item9.Description.English("Thick leather leggings reinforced with blackened silver. The armor plates are heavy, anchoring the boots to the earth with stains and scars that cannot be erased.");
			item9.Crafting.Add(CraftingTable.Forge, 1);
			item9.RequiredItems.Add("Silver", 20);
			item9.RequiredItems.Add("FreezeGland", 5);
			item9.RequiredItems.Add("Obsidian", 15);
			item9.RequiredItems.Add("T1ChaosPlateLegs", 1);
			item9.RequiredUpgradeItems.Add("Silver", 5);
			item9.RequiredUpgradeItems.Add("FreezeGland", 5);
			item9.CraftAmount = 1;
			RegisterTranslations(item9);
			Item item10 = new Item("chaosarmor", "ChaosPlateArmorBody");
			item10.Name.English("Dormant plate harness");
			item10.Description.English("A full harness of heavy plate, too cumbersome to be carried by an ordinary body of mere flesh and bone. A sheath of rigid fibre is carefully woven beneath the plate- long-dead as it may be, twitches of vigor seem to pulse through at the tune of your own movements. Significantly reduces knockback from incoming attacks. Slightly reduces stagger taken.");
			item10.Crafting.Add(CraftingTable.Forge, 1);
			item10.RequiredItems.Add("BlackMetal", 30);
			item10.RequiredItems.Add("YmirRemains", 5);
			item10.RequiredItems.Add("TrophySGolem", 1);
			item10.RequiredItems.Add("T2ChaosPlateArmor", 1);
			item10.RequiredUpgradeItems.Add("BlackMetal", 10);
			item10.CraftAmount = 1;
			try
			{
				ItemDrop component = item10.Prefab.GetComponent<ItemDrop>();
				component.m_itemData.m_shared.m_setName = "ChaosT3Set";
				component.m_itemData.m_shared.m_setStatusEffect = (StatusEffect)(object)T3SetStatus;
				component.m_itemData.m_shared.m_setSize = 2;
			}
			catch (Exception ex)
			{
				Debug.LogError((object)ex);
			}
			RegisterTranslations(item10);
			Item item11 = new Item("chaosarmor", "ChaosPlateHelm");
			item11.Name.English("Dormant plate helm");
			item11.Description.English("A vicious-looking casque. The alloy plate that encloses it seems corroded and stained, even though the structure yet holds steady. An uncanny air of familiarity echoes within its confines.");
			item11.Crafting.Add(CraftingTable.Forge, 1);
			item11.RequiredItems.Add("BlackMetal", 15);
			item11.RequiredItems.Add("YmirRemains", 2);
			item11.RequiredItems.Add("TrophySerpent", 1);
			item11.RequiredItems.Add("T2ChaosPlateHelm", 1);
			item11.RequiredUpgradeItems.Add("BlackMetal", 5);
			item11.CraftAmount = 1;
			RegisterTranslations(item11);
			Item item12 = new Item("chaosarmor", "ChaosPlateLegs");
			item12.Name.English("Dormant plate greaves");
			item12.Description.English("Heavy greaves seemingly unfit for ordinary humans. Breeches of woven linen hide a grotesque array of rigid fibre underneath, perhaps the only reason you are able to move around in the metal boots that anchor you.");
			item12.Crafting.Add(CraftingTable.Forge, 1);
			item12.RequiredItems.Add("BlackMetal", 20);
			item12.RequiredItems.Add("LinenThread", 15);
			item12.RequiredItems.Add("YmirRemains", 5);
			item12.RequiredItems.Add("T2ChaosPlateLegs", 1);
			item12.RequiredUpgradeItems.Add("BlackMetal", 5);
			item12.CraftAmount = 1;
			RegisterTranslations(item12);
			try
			{
				ItemDrop component2 = item12.Prefab.GetComponent<ItemDrop>();
				component2.m_itemData.m_shared.m_setName = "ChaosT3Set";
				component2.m_itemData.m_shared.m_setStatusEffect = (StatusEffect)(object)T3SetStatus;
				component2.m_itemData.m_shared.m_setSize = 2;
			}
			catch (Exception ex2)
			{
				Debug.LogError((object)ex2);
			}
			Item item13 = new Item("chaosarmor", "EliteChaosPlateArmor");
			item13.Name.English("Animated plate harness");
			item13.Description.English("A full harness of deep-forged plate, far too cumbersome to be borne on human flesh and bone. A chained underlay of long-dead muscle courses with uncanny vigor, reanimated and bound to your own movements. All but negates knockback from incoming attacks. Slightly reduces stagger taken.");
			item13.Crafting.Add(CraftingTable.BlackForge, 1);
			item13.RequiredItems.Add("BlackMetal", 20);
			item13.RequiredItems.Add("BlackCore", 1);
			item13.RequiredItems.Add("Eitr", 9);
			item13.RequiredItems.Add("ChaosPlateArmorBody", 1);
			item13.RequiredUpgradeItems.Add("BlackMetal", 10);
			item13.CraftAmount = 1;
			RegisterTranslations(item13);
			try
			{
				ItemDrop component3 = item13.Prefab.GetComponent<ItemDrop>();
				component3.m_itemData.m_shared.m_setName = "ChaosT4Set";
				component3.m_itemData.m_shared.m_setStatusEffect = (StatusEffect)(object)T4SetStatus;
				component3.m_itemData.m_shared.m_setSize = 2;
			}
			catch (Exception ex3)
			{
				Debug.LogError((object)ex3);
			}
			Item item14 = new Item("chaosarmor", "EliteChaosPlateHelm");
			item14.Name.English("Abyssal plate helm");
			item14.Description.English("Shrouded in darkness as your plated skin may be, the horned proof of your bloody victories will ensure your place in the eyes of the gods.");
			item14.Crafting.Add(CraftingTable.BlackForge, 1);
			item14.RequiredItems.Add("BlackMetal", 15);
			item14.RequiredItems.Add("TrophySeekerBrute", 1);
			item14.RequiredItems.Add("Eitr", 3);
			item14.RequiredItems.Add("ChaosPlateHelm", 1);
			item14.RequiredUpgradeItems.Add("BlackMetal", 5);
			item14.RequiredUpgradeItems.Add("TrophySeekerBrute", 1);
			item14.CraftAmount = 1;
			RegisterTranslations(item14);
			Item item15 = new Item("chaosarmor", "ChaosPlateHelmAlt");
			item15.Name.English("Tenebrous plate helm");
			item15.Description.English("Dragged out from the murky shadows, visions of a distant and dark millennium glimmer like embers in the helm's eyeslits. What has been seen cannot be unseen.");
			item15.Crafting.Add(CraftingTable.BlackForge, 1);
			item15.RequiredItems.Add("Eitr", 9);
			item15.RequiredItems.Add("YagluthDrop", 1);
			item15.RequiredItems.Add("ChaosPlateHelm", 1);
			item15.RequiredUpgradeItems.Add("BlackMetal", 5);
			item15.CraftAmount = 1;
			RegisterTranslations(item15);
			Item item16 = new Item("chaosarmor", "EliteChaosPlateLegs");
			item16.Name.English("Animated plate greaves");
			item16.Description.English("Fully plated leggings. Chain hosen covers the gaps left by impassive metal, shrouding the twitching muscle beneath from prying eyes.");
			item16.Crafting.Add(CraftingTable.BlackForge, 1);
			item16.RequiredItems.Add("BlackMetal", 20);
			item16.RequiredItems.Add("Eitr", 9);
			item16.RequiredItems.Add("ChaosPlateLegs", 1);
			item16.RequiredUpgradeItems.Add("BlackMetal", 10);
			item16.CraftAmount = 1;
			RegisterTranslations(item16);
			try
			{
				ItemDrop component4 = item16.Prefab.GetComponent<ItemDrop>();
				component4.m_itemData.m_shared.m_setName = "ChaosT4Set";
				component4.m_itemData.m_shared.m_setStatusEffect = (StatusEffect)(object)T4SetStatus;
				component4.m_itemData.m_shared.m_setSize = 2;
			}
			catch (Exception ex4)
			{
				Debug.LogError((object)ex4);
			}
			Item item17 = new Item("chaosarmor", "EliteChaosPlateArmorTzeentch");
			item17.Name.English("Flickerscale plate harness");
			item17.Description.English("Reanimated plate harness, further enhanced by dynamos and armatures nearly beyond comprehension. All but negates knockback from incoming attacks. Slightly reduces stagger taken. Reactive shielding additionally scaling with current Eitr levels triggers upon receiving sufficient damage in a single strike or when health is critical.");
			item17.Crafting.Add(CraftingTable.BlackForge, 1);
			item17.RequiredItems.Add("FlametalNew", 30);
			item17.RequiredItems.Add("ShieldCore", 1);
			item17.RequiredItems.Add("GemstoneBlue", 1);
			item17.RequiredItems.Add("EliteChaosPlateArmor", 1);
			item17.RequiredUpgradeItems.Add("FlametalNew", 9);
			item17.RequiredUpgradeItems.Add("SerpentScale", 9);
			item17.CraftAmount = 1;
			RegisterTranslations(item17);
			try
			{
				ItemDrop component5 = item17.Prefab.GetComponent<ItemDrop>();
				component5.m_itemData.m_shared.m_setName = "ChaosT5Set";
				component5.m_itemData.m_shared.m_setStatusEffect = (StatusEffect)(object)T4SetStatus;
				component5.m_itemData.m_shared.m_setSize = 2;
			}
			catch (Exception ex5)
			{
				Debug.LogError((object)ex5);
			}
			Item item18 = new Item("chaosarmor", "ChaosPlateHelmAltTzeentch");
			item18.Name.English("Arcane breather helm");
			item18.Description.English("Dragged out from the murky shadows, visions of a distant and dark millennium glimmer like embers in the helm's eyeslits. What has been seen cannot be unseen.");
			item18.Crafting.Add(CraftingTable.BlackForge, 1);
			item18.RequiredItems.Add("MoltenCore", 1);
			item18.RequiredItems.Add("FlametalNew", 15);
			item18.RequiredItems.Add("ChaosPlateHelmAlt", 1);
			item18.RequiredUpgradeItems.Add("FlametalNew", 3);
			item18.CraftAmount = 1;
			RegisterTranslations(item18);
			Item item19 = new Item("chaosarmor", "EliteChaosPlateHelmTzeentch");
			item19.Name.English("Arcane plate helm");
			item19.Description.English("Shrouded in darkness as your plated skin may be, the horned proof of your bloody victories will ensure your place in the eyes of the gods.");
			item19.Crafting.Add(CraftingTable.BlackForge, 1);
			item19.RequiredItems.Add("MoltenCore", 1);
			item19.RequiredItems.Add("FlametalNew", 20);
			item19.RequiredItems.Add("EliteChaosPlateHelm", 1);
			item19.RequiredUpgradeItems.Add("FlametalNew", 3);
			item19.CraftAmount = 1;
			RegisterTranslations(item19);
			Item item20 = new Item("chaosarmor", "EliteChaosPlateHelmTzeentchBoss");
			item20.Name.English("Arcane channeler helm");
			item20.Description.English("Tingly.");
			item20.Crafting.Add(CraftingTable.BlackForge, 1);
			item20.RequiredItems.Add("TrophyCultist", 1);
			item20.RequiredItems.Add("EliteChaosPlateHelmTzeentch", 1);
			item20.RequiredUpgradeItems.Add("QueenDrop", 1);
			item20.CraftAmount = 1;
			RegisterTranslations(item20);
			Item item21 = new Item("chaosarmor", "EliteChaosPlateLegsTzeentch");
			item21.Name.English("Flickerscale plate greaves");
			item21.Description.English("Reanimated plate leggings, housing a complex array of arcane circuits. Recovers a flat amount of Eitr upon blocking or receiving sufficient damage.");
			item21.Crafting.Add(CraftingTable.BlackForge, 1);
			item21.RequiredItems.Add("Copper", 20);
			item21.RequiredItems.Add("GemstoneBlue", 1);
			item21.RequiredItems.Add("FlametalNew", 20);
			item21.RequiredItems.Add("EliteChaosPlateLegs", 1);
			item21.RequiredUpgradeItems.Add("FlametalNew", 4);
			item21.CraftAmount = 1;
			RegisterTranslations(item21);
			try
			{
				ItemDrop component6 = item21.Prefab.GetComponent<ItemDrop>();
				component6.m_itemData.m_shared.m_setName = "ChaosT5Set";
				component6.m_itemData.m_shared.m_setStatusEffect = (StatusEffect)(object)T4SetStatus;
				component6.m_itemData.m_shared.m_setSize = 2;
			}
			catch (Exception ex6)
			{
				Debug.LogError((object)ex6);
			}
			Item item22 = new Item("chaosarmor", "EliteChaosPlateArmorT2");
			item22.Name.English("Magmascale plate harness");
			item22.Description.English("A full harness of deep-forged plate, far too cumbersome to be borne on human flesh and bone. An inscrutable array of circuits snakes through the reanimated muscle beneath like veins, faintly pulsing with the latent power of a dead heartbeat. All but negates knockback from incoming attacks. Slightly reduces stagger taken. Weak emergency reactive shield triggers upon taking extreme damage or when health is critical.");
			item22.Crafting.Add(CraftingTable.BlackForge, 1);
			item22.RequiredItems.Add("FlametalNew", 30);
			item22.RequiredItems.Add("GemstoneRed", 1);
			item22.RequiredItems.Add("ShieldCore", 1);
			item22.RequiredItems.Add("EliteChaosPlateArmor", 1);
			item22.RequiredUpgradeItems.Add("FlametalNew", 10);
			item22.CraftAmount = 1;
			RegisterTranslations(item22);
			try
			{
				ItemDrop component7 = item22.Prefab.GetComponent<ItemDrop>();
				component7.m_itemData.m_shared.m_setName = "ChaosT4Set";
				component7.m_itemData.m_shared.m_setStatusEffect = (StatusEffect)(object)T4SetStatus;
				component7.m_itemData.m_shared.m_setSize = 2;
			}
			catch (Exception ex7)
			{
				Debug.LogError((object)ex7);
			}
			Item item23 = new Item("chaosarmor", "EliteChaosPlateHelmT2");
			item23.Name.English("Magmaskin plate helm");
			item23.Description.English("Shrouded in darkness as your plated skin may be, the horned proof of your bloody victories will ensure your place in the eyes of the gods.");
			item23.Crafting.Add(CraftingTable.BlackForge, 1);
			item23.RequiredItems.Add("FlametalNew", 15);
			item23.RequiredItems.Add("MoltenCore", 1);
			item23.RequiredItems.Add("EliteChaosPlateHelm", 1);
			item23.RequiredUpgradeItems.Add("FlametalNew", 5);
			item23.RequiredUpgradeItems.Add("TrophySeekerBrute", 1);
			item23.CraftAmount = 1;
			RegisterTranslations(item23);
			Item item24 = new Item("chaosarmor", "ChaosPlateHelmAltT2");
			item24.Name.English("Magmaskin breather helm");
			item24.Description.English("Dragged out from the murky shadows, visions of a distant and dark millennium glimmer like embers in the helm's eyeslits. What has been seen cannot be unseen.");
			item24.Crafting.Add(CraftingTable.BlackForge, 1);
			item24.RequiredItems.Add("FlametalNew", 9);
			item24.RequiredItems.Add("MoltenCore", 1);
			item24.RequiredItems.Add("ChaosPlateHelmAlt", 1);
			item24.RequiredUpgradeItems.Add("FlametalNew", 5);
			item24.CraftAmount = 1;
			RegisterTranslations(item24);
			Item item25 = new Item("chaosarmor", "EliteChaosPlateLegsT2");
			item25.Name.English("Magmaskin plate greaves");
			item25.Description.English("Fully plated leggings. Chain hosen covers the gaps left by impassive metal, shrouding the twitching muscle beneath from prying eyes. Recovers a small flat amount of stamina when moderate to heavy damage is taken.");
			item25.Crafting.Add(CraftingTable.BlackForge, 1);
			item25.RequiredItems.Add("FlametalNew", 20);
			item25.RequiredItems.Add("GemstoneRed", 1);
			item25.RequiredItems.Add("EliteChaosPlateLegs", 1);
			item25.RequiredUpgradeItems.Add("FlametalNew", 10);
			item25.CraftAmount = 1;
			RegisterTranslations(item25);
			try
			{
				ItemDrop component8 = item25.Prefab.GetComponent<ItemDrop>();
				component8.m_itemData.m_shared.m_setName = "ChaosT4Set";
				component8.m_itemData.m_shared.m_setStatusEffect = (StatusEffect)(object)T4SetStatus;
				component8.m_itemData.m_shared.m_setSize = 2;
			}
			catch (Exception ex8)
			{
				Debug.LogError((object)ex8);
			}
			AssetBundle value = null;
			PrefabManager.BundleId bundleId = default(PrefabManager.BundleId);
			bundleId.folderName = "assets";
			bundleId.assetBundleFileName = "chaosarmor";
			PrefabManager.BundleId key = bundleId;
			if (!PrefabManager.bundleCache.TryGetValue(key, out value))
			{
				AssetBundle[] source = Resources.FindObjectsOfTypeAll<AssetBundle>();
				Debug.LogWarning((object)$"unable to find assetbundle in ItemManager cache, attempting manual retrieval: {source.Count()} assetbundles found in resources");
				value = ((IEnumerable<AssetBundle>)source).FirstOrDefault((Func<AssetBundle, bool>)((AssetBundle a) => ((Object)a).name == "chaosarmor")) ?? AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(Assembly.GetExecutingAssembly().GetName().Name + ".assets.chaosarmor"));
			}
			if ((Object)(object)value != (Object)null)
			{
				Clanka.prefabStep = value.LoadAsset<GameObject>("sfx_reepus_footstepClankChaos");
				Clanka.prefabRun = value.LoadAsset<GameObject>("sfx_reepus_footstepClank2Chaos");
				Clanka.prefabDodge = value.LoadAsset<GameObject>("sfx_reepus_dodgeChaos");
				Clanka.prefabLand = value.LoadAsset<GameObject>("sfx_reepus_landChaos");
				Clanka.prefabJump = value.LoadAsset<GameObject>("sfx_reepus_jumpClankChaos");
				Clanka.prefabBootStep = value.LoadAsset<GameObject>("sfx_reepus_footstepBootWalkChaos");
				Clanka.prefabBootRun = value.LoadAsset<GameObject>("sfx_reepus_footstepBootRunChaos");
				Clanka.jumpData = new EffectData
				{
					m_enabled = true,
					m_prefab = Clanka.prefabJump
				};
				Clanka.dodgeData = new EffectData
				{
					m_enabled = true,
					m_prefab = Clanka.prefabDodge
				};
			}
			else
			{
				Debug.LogWarning((object)"Failed to load clanking");
			}
			ConfigFile val = new ConfigFile(Path.Combine(Paths.ConfigPath, "ReepusDelmeepus.ChaosArmorClank.cfg"), true);
			doTheRoar = val.Bind<bool>("General", "do the clank", true, "Make player go clank-clank if chaos armor is equipped. Not synced with server.");
			RegisterBlacksmithTools();
			Harmony.CreateAndPatchAll(assembly, (string)null);
		}

		public static void AttachShieldFx(SE_Shield shield)
		{
			if ((Object)(object)staffShield != (Object)null)
			{
				((StatusEffect)shield).m_startEffects.m_effectPrefabs = ((StatusEffect)staffShield).m_startEffects.m_effectPrefabs.Concat(staffShield.m_hitEffects.m_effectPrefabs).ToArray();
				shield.m_breakEffects = staffShield.m_breakEffects;
				shield.m_hitEffects = staffShield.m_hitEffects;
				((StatusEffect)shield).m_stopEffects = staffShield.m_breakEffects;
			}
		}

		private void SetStatusEffects()
		{
			try
			{
				T3SetStatus = ScriptableObject.CreateInstance<SE_Stats>();
				((Object)T3SetStatus).name = "ChaosT3SetEffect";
				T3SetStatus.m_staminaRegenMultiplier = 1.05f;
				T3SetStatus.m_addMaxCarryWeight = 16f;
				T4SetStatus = ScriptableObject.CreateInstance<SE_Stats>();
				((Object)T4SetStatus).name = "ChaosT4SetEffect";
				T4SetStatus.m_staminaRegenMultiplier = 1.15f;
				T4SetStatus.m_addMaxCarryWeight = 32f;
			}
			catch (Exception ex)
			{
				Debug.LogError((object)ex);
			}
		}

		private void LoadTranslations()
		{
			try
			{
				string directoryName = Path.GetDirectoryName(assembly.Location);
				string path = Path.Combine(directoryName, "Localization.yml");
				string text = "am I ever going to fix this, probably not";
				text = File.ReadAllText(path);
				StringReader input = new StringReader(text);
				Deserializer deserializer = new Deserializer();
				LocalizationClusterfuck = deserializer.Deserialize<Localization>(input);
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("Localization file was not loaded cuz mod author is a lazy ass who still won't change the hardcoded directory: " + ex.Message));
			}
		}

		private void RegisterTranslations(Item item)
		{
			if (LocalizationClusterfuck == null)
			{
				return;
			}
			foreach (string key in LocalizationClusterfuck.Localizations.Keys)
			{
				try
				{
					item.Name.addForLang(key, LocalizationClusterfuck.Localizations[key][((Object)item.Prefab).name]["Name"]);
					item.Description.addForLang(key, LocalizationClusterfuck.Localizations[key][((Object)item.Prefab).name]["Description"]);
				}
				catch (Exception ex)
				{
					Debug.LogWarning((object)("fucked something up registering translations for " + key + " on " + ((Object)item.Prefab).name + ": " + ex.Message));
				}
			}
		}

		private void RegisterBlacksmithTools()
		{
			try
			{
				BodypartSystem.bodypartSettings.Add("T0ChaosPlateArmor", new List<bodyPart>
				{
					(bodyPart)1,
					(bodyPart)2,
					(bodyPart)3,
					(bodyPart)4,
					(bodyPart)5,
					(bodyPart)6,
					(bodyPart)7
				});
				BodypartSystem.bodypartSettings.Add("T1ChaosPlateArmor", new List<bodyPart>
				{
					(bodyPart)1,
					(bodyPart)2,
					(bodyPart)3,
					(bodyPart)4,
					(bodyPart)5,
					(bodyPart)6,
					(bodyPart)7
				});
				BodypartSystem.bodypartSettings.Add("T2ChaosPlateArmor", new List<bodyPart>
				{
					(bodyPart)1,
					(bodyPart)2,
					(bodyPart)3,
					(bodyPart)4,
					(bodyPart)5,
					(bodyPart)6,
					(bodyPart)7
				});
				BodypartSystem.bodypartSettings.Add("ChaosPlateArmorBody", new List<bodyPart>
				{
					(bodyPart)1,
					(bodyPart)2,
					(bodyPart)3,
					(bodyPart)4,
					(bodyPart)5,
					(bodyPart)6,
					(bodyPart)7
				});
				BodypartSystem.bodypartSettings.Add("EliteChaosPlateArmor", new List<bodyPart>
				{
					(bodyPart)1,
					(bodyPart)2,
					(bodyPart)3,
					(bodyPart)4,
					(bodyPart)5,
					(bodyPart)6,
					(bodyPart)7
				});
				BodypartSystem.bodypartSettings.Add("EliteChaosPlateArmorTzeentch", new List<bodyPart>
				{
					(bodyPart)1,
					(bodyPart)2,
					(bodyPart)3,
					(bodyPart)4,
					(bodyPart)5,
					(bodyPart)6,
					(bodyPart)7
				});
				BodypartSystem.bodypartSettings.Add("EliteChaosPlateArmorT2", new List<bodyPart>
				{
					(bodyPart)1,
					(bodyPart)2,
					(bodyPart)3,
					(bodyPart)4,
					(bodyPart)5,
					(bodyPart)6,
					(bodyPart)7
				});
				BodypartSystem.bodypartSettings.Add("T0ChaosPlateLegs", new List<bodyPart>
				{
					(bodyPart)11,
					(bodyPart)8,
					(bodyPart)12,
					(bodyPart)13,
					(bodyPart)9,
					(bodyPart)10
				});
				BodypartSystem.bodypartSettings.Add("T1ChaosPlateLegs", new List<bodyPart>
				{
					(bodyPart)11,
					(bodyPart)8,
					(bodyPart)12,
					(bodyPart)13,
					(bodyPart)9,
					(bodyPart)10
				});
				BodypartSystem.bodypartSettings.Add("T2ChaosPlateLegs", new List<bodyPart>
				{
					(bodyPart)11,
					(bodyPart)8,
					(bodyPart)12,
					(bodyPart)13,
					(bodyPart)9,
					(bodyPart)10
				});
				BodypartSystem.bodypartSettings.Add("ChaosPlateLegs", new List<bodyPart>
				{
					(bodyPart)11,
					(bodyPart)8,
					(bodyPart)12,
					(bodyPart)13,
					(bodyPart)9,
					(bodyPart)10
				});
				BodypartSystem.bodypartSettings.Add("EliteChaosPlateLegs", new List<bodyPart>
				{
					(bodyPart)11,
					(bodyPart)8,
					(bodyPart)12,
					(bodyPart)13,
					(bodyPart)9,
					(bodyPart)10
				});
				BodypartSystem.bodypartSettings.Add("EliteChaosPlateLegsTzeentch", new List<bodyPart>
				{
					(bodyPart)11,
					(bodyPart)8,
					(bodyPart)12,
					(bodyPart)13,
					(bodyPart)9,
					(bodyPart)10
				});
				BodypartSystem.bodypartSettings.Add("EliteChaosPlateLegsT2", new List<bodyPart>
				{
					(bodyPart)11,
					(bodyPart)8,
					(bodyPart)12,
					(bodyPart)13,
					(bodyPart)9,
					(bodyPart)10
				});
			}
			catch (Exception)
			{
				Debug.LogWarning((object)"Blacksmith's Tools failed to register but Chaos Armor should still be functional; keep an eye out for updates to Blacksmith's Tools");
			}
		}
	}
	internal class Localization
	{
		public Dictionary<string, Dictionary<string, Dictionary<string, string>>> Localizations;
	}
	public class Clanka : MonoBehaviour
	{
		public static GameObject prefabStep;

		public static GameObject prefabRun;

		public static GameObject prefabJump;

		public static GameObject prefabDodge;

		public static GameObject prefabLand;

		public static GameObject prefabBootStep;

		public static GameObject prefabBootRun;

		public static EffectData jumpData;

		public static EffectData dodgeData;

		private Player wearer;

		public void Start()
		{
			if (ReepusDeepusDelmeepusChaosArmor.DoTheRoar && !((Object)(object)prefabStep == (Object)null))
			{
				Transform root = ((Component)this).transform.root;
				object obj;
				if (root == null)
				{
					obj = null;
				}
				else
				{
					GameObject gameObject = ((Component)root).gameObject;
					obj = ((gameObject != null) ? gameObject.GetComponent<Player>() : null);
				}
				wearer = (Player)obj;
				if ((Object)(object)wearer != (Object)null)
				{
					MakePlayerClanky(wearer);
				}
			}
		}

		public void OnDisable()
		{
			if (ReepusDeepusDelmeepusChaosArmor.DoTheRoar && !((Object)(object)prefabStep == (Object)null))
			{
				if ((Object)(object)wearer != (Object)null && !ReepusDeepusDelmeepusChaosArmor.clankyPrefabNames.Contains(((Humanoid)wearer).m_visEquipment?.m_currentChestItemHash ?? (-1)) && !ReepusDeepusDelmeepusChaosArmor.clankyPrefabNames.Contains(((Humanoid)wearer).m_visEquipment?.m_currentLegItemHash ?? (-1)))
				{
					UnclankPlayer(wearer);
				}
				wearer = null;
			}
		}

		private static void MakePlayerClanky(Player player)
		{
			//IL_0060: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Invalid comparison between Unknown and I4
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Invalid comparison between Unknown and I4
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Invalid comparison between Unknown and I4
			FootStep component = ((Component)player).GetComponent<FootStep>();
			if ((Object)(object)component == (Object)null || ((Character)player).m_jumpEffects == null || player.m_dodgeEffects == null)
			{
				return;
			}
			foreach (StepEffect effect in component.m_effects)
			{
				HashSet<GameObject> hashSet = new HashSet<GameObject>(effect.m_effectPrefabs);
				bool flag = false;
				MotionType motionType = effect.m_motionType;
				MotionType val = motionType;
				if (((int)val == 2 || (int)val == 8) ? (hashSet.Add(prefabRun) | hashSet.Add(prefabBootRun)) : (((int)val != 32) ? (hashSet.Add(prefabStep) | hashSet.Add(prefabBootStep)) : (hashSet.Add(prefabLand) | hashSet.Add(prefabBootRun))))
				{
					effect.m_effectPrefabs = hashSet.ToArray();
				}
			}
			HashSet<EffectData> hashSet2 = new HashSet<EffectData>(((Character)player).m_jumpEffects.m_effectPrefabs);
			bool flag2 = hashSet2.Add(jumpData);
			HashSet<EffectData> hashSet3 = new HashSet<EffectData>(player.m_dodgeEffects.m_effectPrefabs);
			bool flag3 = hashSet3.Add(dodgeData);
			if (flag2)
			{
				((Character)player).m_jumpEffects.m_effectPrefabs = hashSet2.ToArray();
			}
			if (flag3)
			{
				player.m_dodgeEffects.m_effectPrefabs = hashSet3.ToArray();
			}
		}

		private static void UnclankPlayer(Player player)
		{
			//IL_0060: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Invalid comparison between Unknown and I4
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Invalid comparison between Unknown and I4
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Invalid comparison between Unknown and I4
			FootStep component = ((Component)player).GetComponent<FootStep>();
			if ((Object)(object)component == (Object)null || ((Character)player).m_jumpEffects == null || player.m_dodgeEffects == null)
			{
				return;
			}
			foreach (StepEffect effect in component.m_effects)
			{
				HashSet<GameObject> hashSet = new HashSet<GameObject>(effect.m_effectPrefabs);
				bool flag = false;
				MotionType motionType = effect.m_motionType;
				MotionType val = motionType;
				if (((int)val == 2 || (int)val == 8) ? (hashSet.Remove(prefabRun) | hashSet.Remove(prefabBootRun)) : (((int)val != 32) ? (hashSet.Remove(prefabStep) | hashSet.Remove(prefabBootStep)) : (hashSet.Remove(prefabLand) | hashSet.Remove(prefabBootRun))))
				{
					effect.m_effectPrefabs = hashSet.ToArray();
				}
			}
			HashSet<EffectData> hashSet2 = new HashSet<EffectData>(((Character)player).m_jumpEffects.m_effectPrefabs);
			bool flag2 = hashSet2.Remove(jumpData);
			HashSet<EffectData> hashSet3 = new HashSet<EffectData>(player.m_dodgeEffects.m_effectPrefabs);
			bool flag3 = hashSet3.Remove(dodgeData);
			if (flag2)
			{
				((Character)player).m_jumpEffects.m_effectPrefabs = hashSet2.ToArray();
			}
			if (flag3)
			{
				player.m_dodgeEffects.m_effectPrefabs = hashSet3.ToArray();
			}
		}
	}
	public class EitrDynamo : MonoBehaviour
	{
		private Humanoid wearer;

		public void Start()
		{
			Transform root = ((Component)this).transform.root;
			object obj;
			if (root == null)
			{
				obj = null;
			}
			else
			{
				GameObject gameObject = ((Component)root).gameObject;
				obj = ((gameObject != null) ? gameObject.GetComponent<Player>() : null);
			}
			wearer = (Humanoid)obj;
			if ((Object)(object)wearer != (Object)null)
			{
				Humanoid obj2 = wearer;
				((Character)obj2).m_onDamaged = (Action<float, Character>)Delegate.Combine(((Character)obj2).m_onDamaged, new Action<float, Character>(OnDamaged));
			}
		}

		public void OnDisable()
		{
			if ((Object)(object)wearer != (Object)null)
			{
				Humanoid obj = wearer;
				((Character)obj).m_onDamaged = (Action<float, Character>)Delegate.Remove(((Character)obj).m_onDamaged, new Action<float, Character>(OnDamaged));
			}
			wearer = null;
		}

		public void OnDamaged(float dmg, Character idfkLol)
		{
			bool flag = ((Character)wearer).HaveEitr(0f);
			float maxEitr = ((Character)wearer).GetMaxEitr();
			float maxHealth = ((Character)wearer).GetMaxHealth();
			if (maxEitr > 0f)
			{
				if (dmg > Math.Min(50f, maxHealth / 3f))
				{
					((Character)wearer).AddEitr(70f);
				}
				else if (dmg > 30f)
				{
					((Character)wearer).AddEitr(40f);
				}
				else if (dmg < 20f && !((Character)wearer).m_blocking)
				{
					((Character)wearer).AddEitr(3f);
				}
				else
				{
					((Character)wearer).AddEitr(25f);
				}
			}
		}
	}
	public class EitrShield : MonoBehaviour
	{
		private Humanoid wearer;

		private const string shieldName = "TzeentchReactiveShield";

		private int shieldHash;

		public void Start()
		{
			Transform root = ((Component)this).transform.root;
			object obj;
			if (root == null)
			{
				obj = null;
			}
			else
			{
				GameObject gameObject = ((Component)root).gameObject;
				obj = ((gameObject != null) ? gameObject.GetComponent<Player>() : null);
			}
			wearer = (Humanoid)obj;
			if ((Object)(object)wearer != (Object)null)
			{
				shieldHash = StringExtensionMethods.GetStableHashCode("TzeentchReactiveShield");
				Humanoid obj2 = wearer;
				((Character)obj2).m_onDamaged = (Action<float, Character>)Delegate.Combine(((Character)obj2).m_onDamaged, new Action<float, Character>(OnDamaged));
			}
		}

		public void OnDisable()
		{
			if ((Object)(object)wearer != (Object)null)
			{
				Humanoid obj = wearer;
				((Character)obj).m_onDamaged = (Action<float, Character>)Delegate.Remove(((Character)obj).m_onDamaged, new Action<float, Character>(OnDamaged));
			}
			wearer = null;
		}

		public void OnDamaged(float dmg, Character idfkLol)
		{
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			bool flag = ((Character)wearer).HaveEitr(0f);
			float maxHealth = ((Character)wearer).GetMaxHealth();
			float num = Math.Max(25f, maxHealth / 4f);
			float num2 = (flag ? (((Character)wearer).GetEitrPercentage() * ((Character)wearer).GetMaxEitr()) : 0f);
			bool flag2 = ((Character)wearer).GetHealth() <= num;
			bool flag3 = dmg < 10f;
			SEMan sEMan = ((Character)wearer).GetSEMan();
			if (flag3 && (!flag2 || sEMan.HaveStatusEffect(shieldHash)))
			{
				return;
			}
			SE_Shield val = ScriptableObject.CreateInstance<SE_Shield>();
			((Object)val).name = "TzeentchReactiveShield";
			((StatusEffect)val).m_nameHash = shieldHash;
			((StatusEffect)val).m_ttl = ((flag3 && flag2) ? 5f : (20f + 0.35f * num2));
			val.m_levelUpSkillOnBreak = (SkillType)10;
			val.m_levelUpSkillFactor = 0.5f;
			val.m_absorbDamagePerSkillLevel = 1f;
			val.m_absorbDamage = ((flag3 && flag2) ? 5f : (5f + num2));
			ReepusDeepusDelmeepusChaosArmor.AttachShieldFx(val);
			float num3 = Math.Min(75f, maxHealth / 2f);
			float num4 = Math.Min(25f, maxHealth / 3f);
			if (dmg >= num3)
			{
				val.m_absorbDamage += 120f;
			}
			else
			{
				float num5 = dmg;
				if (num5 < num3 && num5 >= num4)
				{
					val.m_absorbDamage += 70f;
				}
				else
				{
					float num6 = dmg;
					if (num6 < num4 && num6 >= 10f)
					{
						val.m_absorbDamage += 30f;
					}
				}
			}
			val.m_absorbDamage = Math.Min(val.m_absorbDamage, 900f);
			((StatusEffect)val).m_ttl = Math.Min(((StatusEffect)val).m_ttl, 100f);
			sEMan.AddStatusEffect((StatusEffect)(object)val, false, 0, 0f);
		}
	}
	public class EmergencyShield : MonoBehaviour
	{
		private Humanoid wearer;

		private const string shieldName = "UndividedReactiveEmergencyShield";

		private int shieldHash;

		public void Start()
		{
			Transform root = ((Component)this).transform.root;
			object obj;
			if (root == null)
			{
				obj = null;
			}
			else
			{
				GameObject gameObject = ((Component)root).gameObject;
				obj = ((gameObject != null) ? gameObject.GetComponent<Player>() : null);
			}
			wearer = (Humanoid)obj;
			if ((Object)(object)wearer != (Object)null)
			{
				shieldHash = StringExtensionMethods.GetStableHashCode("UndividedReactiveEmergencyShield");
				Humanoid obj2 = wearer;
				((Character)obj2).m_onDamaged = (Action<float, Character>)Delegate.Combine(((Character)obj2).m_onDamaged, new Action<float, Character>(OnDamaged));
			}
		}

		public void OnDisable()
		{
			if ((Object)(object)wearer != (Object)null)
			{
				Humanoid obj = wearer;
				((Character)obj).m_onDamaged = (Action<float, Character>)Delegate.Remove(((Character)obj).m_onDamaged, new Action<float, Character>(OnDamaged));
			}
			wearer = null;
		}

		public void OnDamaged(float dmg, Character idfkLol)
		{
			float maxHealth = ((Character)wearer).GetMaxHealth();
			float num = Math.Max(25f, maxHealth / 4f);
			bool flag = ((Character)wearer).GetHealth() <= num;
			float num2 = Math.Min(50f, maxHealth / 2f);
			bool flag2 = dmg < num2;
			SEMan sEMan = ((Character)wearer).GetSEMan();
			if (!flag2 || (flag && !sEMan.HaveStatusEffect(shieldHash)))
			{
				SE_Shield val = ScriptableObject.CreateInstance<SE_Shield>();
				((Object)val).name = "UndividedReactiveEmergencyShield";
				((StatusEffect)val).m_nameHash = shieldHash;
				((StatusEffect)val).m_ttl = ((flag2 && flag) ? 10f : 25f);
				val.m_absorbDamage = 25f;
				ReepusDeepusDelmeepusChaosArmor.AttachShieldFx(val);
				sEMan.AddStatusEffect((StatusEffect)(object)val, false, 0, 0f);
			}
		}
	}
	public static class PoiseBois
	{
		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		public static class ReduceDamageTaken
		{
			[UsedImplicitly]
			private static void Prefix(Character __instance, HitData hit)
			{
				Player val = (Player)(object)((__instance is Player) ? __instance : null);
				if (val != null)
				{
					if (((Humanoid)val).m_visEquipment.m_currentChestItemHash == ReepusDeepusDelmeepusChaosArmor.T4Hash || ((Humanoid)val).m_visEquipment.m_currentChestItemHash == ReepusDeepusDelmeepusChaosArmor.T5Hash || ((Humanoid)val).m_visEquipment.m_currentChestItemHash == ReepusDeepusDelmeepusChaosArmor.T5UHash)
					{
						hit.m_pushForce *= 0.15f;
						hit.m_staggerMultiplier *= 0.75f;
					}
					else if (((Humanoid)val).m_visEquipment.m_currentChestItemHash == ReepusDeepusDelmeepusChaosArmor.T3Hash)
					{
						hit.m_pushForce *= 0.4f;
						hit.m_staggerMultiplier *= 0.85f;
					}
					else if (((Humanoid)val).m_visEquipment.m_currentChestItemHash == ReepusDeepusDelmeepusChaosArmor.T2Hash || ((Humanoid)val).m_visEquipment.m_currentChestItemHash == ReepusDeepusDelmeepusChaosArmor.T1Hash)
					{
						hit.m_pushForce *= 0.65f;
					}
				}
			}
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<bb059150-9ee0-432a-82b4-cbfa0b75fbb0>Embedded]
	internal sealed class <bb059150-9ee0-432a-82b4-cbfa0b75fbb0>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	[<bb059150-9ee0-432a-82b4-cbfa0b75fbb0>Embedded]
	[CompilerGenerated]
	internal sealed class <40bd5b47-655e-4b3a-9fce-16588b9601f8>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <40bd5b47-655e-4b3a-9fce-16588b9601f8>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <40bd5b47-655e-4b3a-9fce-16588b9601f8>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	[<bb059150-9ee0-432a-82b4-cbfa0b75fbb0>Embedded]
	[CompilerGenerated]
	internal sealed class <7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ItemManager
{
	[PublicAPI]
	internal enum CraftingTable
	{
		Disabled,
		Inventory,
		[InternalName("piece_workbench")]
		Workbench,
		[InternalName("piece_cauldron")]
		Cauldron,
		[InternalName("forge")]
		Forge,
		[InternalName("piece_artisanstation")]
		ArtisanTable,
		[InternalName("piece_stonecutter")]
		StoneCutter,
		[InternalName("piece_magetable")]
		MageTable,
		[InternalName("blackforge")]
		BlackForge,
		Custom
	}
	[PublicAPI]
	internal enum ConversionPiece
	{
		Disabled,
		[InternalName("smelter")]
		Smelter,
		[InternalName("charcoal_kiln")]
		CharcoalKiln,
		[InternalName("blastfurnace")]
		BlastFurnace,
		[InternalName("windmill")]
		Windmill,
		[InternalName("piece_spinningwheel")]
		SpinningWheel,
		[InternalName("eitrrefinery")]
		EitrRefinery,
		Custom
	}
	[<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(1)]
	[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(0)]
	internal class InternalName : Attribute
	{
		public readonly string internalName;

		public InternalName(string internalName)
		{
			this.internalName = internalName;
		}
	}
	[<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(1)]
	[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(0)]
	[PublicAPI]
	internal class RequiredResourceList
	{
		public readonly List<Requirement> Requirements = new List<Requirement>();

		public bool Free = false;

		public void Add(string itemName, int amount)
		{
			Requirements.Add(new Requirement
			{
				itemName = itemName,
				amount = amount
			});
		}

		public void Add(string itemName, ConfigEntry<int> amountConfig)
		{
			Requirements.Add(new Requirement
			{
				itemName = itemName,
				amountConfig = amountConfig
			});
		}
	}
	[PublicAPI]
	[<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(1)]
	[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(0)]
	internal class CraftingStationList
	{
		public readonly List<CraftingStationConfig> Stations = new List<CraftingStationConfig>();

		public void Add(CraftingTable table, int level)
		{
			Stations.Add(new CraftingStationConfig
			{
				Table = table,
				level = level
			});
		}

		public void Add(string customTable, int level)
		{
			Stations.Add(new CraftingStationConfig
			{
				Table = CraftingTable.Custom,
				level = level,
				custom = customTable
			});
		}
	}
	[PublicAPI]
	[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(0)]
	[<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(1)]
	internal class ItemRecipe
	{
		public readonly RequiredResourceList RequiredItems = new RequiredResourceList();

		public readonly RequiredResourceList RequiredUpgradeItems = new RequiredResourceList();

		public readonly CraftingStationList Crafting = new CraftingStationList();

		public int CraftAmount = 1;

		public bool RequireOnlyOneIngredient = false;

		public float QualityResultAmountMultiplier = 1f;

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(2)]
		public ConfigEntryBase RecipeIsActive = null;
	}
	internal struct Requirement
	{
		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(1)]
		public string itemName;

		public int amount;

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(2)]
		public ConfigEntry<int> amountConfig;
	}
	internal struct CraftingStationConfig
	{
		public CraftingTable Table;

		public int level;

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(2)]
		public string custom;
	}
	[Flags]
	internal enum Configurability
	{
		Disabled = 0,
		Recipe = 1,
		Stats = 2,
		Drop = 4,
		Full = 7
	}
	[PublicAPI]
	[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(0)]
	[<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(1)]
	internal class DropTargets
	{
		public readonly List<DropTarget> Drops = new List<DropTarget>();

		public void Add(string creatureName, float chance, int min = 1, int? max = null, bool levelMultiplier = true)
		{
			Drops.Add(new DropTarget
			{
				creature = creatureName,
				chance = chance,
				min = min,
				max = (max ?? min),
				levelMultiplier = levelMultiplier
			});
		}
	}
	internal struct DropTarget
	{
		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(1)]
		public string creature;

		public int min;

		public int max;

		public float chance;

		public bool levelMultiplier;
	}
	internal enum Toggle
	{
		On = 1,
		Off = 0
	}
	[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(0)]
	[PublicAPI]
	[<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(1)]
	internal class Item
	{
		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(0)]
		private class ItemConfig
		{
			[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(new byte[] { 2, 1 })]
			public ConfigEntry<string> craft;

			[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(new byte[] { 2, 1 })]
			public ConfigEntry<string> upgrade;

			public ConfigEntry<CraftingTable> table = null;

			public ConfigEntry<int> tableLevel = null;

			public ConfigEntry<string> customTable = null;

			[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(2)]
			public ConfigEntry<int> maximumTableLevel;

			public ConfigEntry<Toggle> requireOneIngredient = null;

			public ConfigEntry<float> qualityResultAmountMultiplier = null;
		}

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(0)]
		[<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(2)]
		private class ConfigurationManagerAttributes
		{
			[UsedImplicitly]
			public int? Order;

			[UsedImplicitly]
			public bool? Browsable;

			[UsedImplicitly]
			public string Category;

			[UsedImplicitly]
			[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(new byte[] { 2, 1 })]
			public Action<ConfigEntryBase> CustomDrawer;

			public Func<bool> browsability;
		}

		[PublicAPI]
		[<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)]
		public enum DamageModifier
		{
			Normal,
			Resistant,
			Weak,
			Immune,
			Ignore,
			VeryResistant,
			VeryWeak,
			None
		}

		[<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)]
		private delegate void setDmgFunc(ref DamageTypes dmg, float value);

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(0)]
		private class SerializedRequirements
		{
			public readonly List<Requirement> Reqs;

			public SerializedRequirements(List<Requirement> reqs)
			{
				Reqs = reqs;
			}

			public SerializedRequirements(string reqs)
			{
				Reqs = reqs.Split(new char[1] { ',' }).Select([<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (string r) =>
				{
					string[] array = r.Split(new char[1] { ':' });
					Requirement result = default(Requirement);
					result.itemName = array[0];
					result.amount = ((array.Length <= 1 || !int.TryParse(array[1], out var result2)) ? 1 : result2);
					return result;
				}).ToList();
			}

			public override string ToString()
			{
				return string.Join(",", Reqs.Select([<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (Requirement r) => $"{r.itemName}:{r.amount}"));
			}

			[return: <40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(2)]
			public static ItemDrop fetchByName(ObjectDB objectDB, string name)
			{
				GameObject itemPrefab = objectDB.GetItemPrefab(name);
				ItemDrop val = ((itemPrefab != null) ? itemPrefab.GetComponent<ItemDrop>() : null);
				if ((Object)(object)val == (Object)null)
				{
					Debug.LogWarning((object)("The required item '" + name + "' does not exist."));
				}
				return val;
			}

			public static Requirement[] toPieceReqs(ObjectDB objectDB, SerializedRequirements craft, SerializedRequirements upgrade)
			{
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e0: 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)
				//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f2: Expected O, but got Unknown
				//IL_00f7: Expected O, but got Unknown
				Dictionary<string, Requirement> dictionary = craft.Reqs.Where((Requirement r) => r.itemName != "").ToDictionary((Func<Requirement, string>)([<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (Requirement r) => r.itemName), (Func<Requirement, Requirement>)([<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (Requirement r) =>
				{
					//IL_000e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0013: Unknown result type (might be due to invalid IL or missing references)
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_0037: Unknown result type (might be due to invalid IL or missing references)
					ItemDrop val4 = ResItem(r);
					return (val4 == null) ? ((Requirement)null) : new Requirement
					{
						m_amount = (r.amountConfig?.Value ?? r.amount),
						m_resItem = val4,
						m_amountPerLevel = 0
					};
				}));
				foreach (Requirement item in upgrade.Reqs.Where((Requirement r) => r.itemName != ""))
				{
					if (!dictionary.TryGetValue(item.itemName, out var value) || value == null)
					{
						ItemDrop val = ResItem(item);
						if (val != null)
						{
							string itemName = item.itemName;
							Requirement val2 = new Requirement
							{
								m_resItem = val,
								m_amount = 0
							};
							Requirement val3 = val2;
							dictionary[itemName] = val2;
							value = val3;
						}
					}
					if (value != null)
					{
						value.m_amountPerLevel = item.amountConfig?.Value ?? item.amount;
					}
				}
				return dictionary.Values.Where([<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (Requirement v) => v != null).ToArray();
				[<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(2)]
				ItemDrop ResItem(Requirement r)
				{
					return fetchByName(objectDB, r.itemName);
				}
			}
		}

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(0)]
		private class SerializedDrop
		{
			public readonly List<DropTarget> Drops;

			public SerializedDrop(List<DropTarget> drops)
			{
				Drops = drops;
			}

			public SerializedDrop(string drops)
			{
				Drops = ((drops == "") ? ((IEnumerable<string>)Array.Empty<string>()) : ((IEnumerable<string>)drops.Split(new char[1] { ',' }))).Select([<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (string r) =>
				{
					string[] array = r.Split(new char[1] { ':' });
					if (array.Length <= 2 || !int.TryParse(array[2], out var result))
					{
						result = 1;
					}
					if (array.Length <= 3 || !int.TryParse(array[3], out var result2))
					{
						result2 = result;
					}
					bool levelMultiplier = array.Length <= 4 || array[4] != "0";
					DropTarget result3 = default(DropTarget);
					result3.creature = array[0];
					result3.chance = ((array.Length > 1 && float.TryParse(array[1], out var result4)) ? result4 : 1f);
					result3.min = result;
					result3.max = result2;
					result3.levelMultiplier = levelMultiplier;
					return result3;
				}).ToList();
			}

			public override string ToString()
			{
				return string.Join(",", Drops.Select([<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (DropTarget r) => $"{r.creature}:{r.chance.ToString(CultureInfo.InvariantCulture)}:{r.min}:" + ((r.min == r.max) ? "" : $"{r.max}") + (r.levelMultiplier ? "" : ":0")));
			}

			[return: <40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(2)]
			private static Character fetchByName(ZNetScene netScene, string name)
			{
				GameObject prefab = netScene.GetPrefab(name);
				Character val = ((prefab != null) ? prefab.GetComponent<Character>() : null);
				if ((Object)(object)val == (Object)null)
				{
					Debug.LogWarning((object)("The drop target character '" + name + "' does not exist."));
				}
				return val;
			}

			public Dictionary<Character, Drop> toCharacterDrops(ZNetScene netScene, GameObject item)
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: 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_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Expected O, but got Unknown
				Dictionary<Character, Drop> dictionary = new Dictionary<Character, Drop>();
				foreach (DropTarget drop in Drops)
				{
					Character val = fetchByName(netScene, drop.creature);
					if (val != null)
					{
						dictionary[val] = new Drop
						{
							m_prefab = item,
							m_amountMin = drop.min,
							m_amountMax = drop.max,
							m_chance = drop.chance,
							m_levelMultiplier = drop.levelMultiplier
						};
					}
				}
				return dictionary;
			}
		}

		private static readonly List<Item> registeredItems = new List<Item>();

		private static readonly Dictionary<ItemDrop, Item> itemDropMap = new Dictionary<ItemDrop, Item>();

		private static Dictionary<Item, Dictionary<string, List<Recipe>>> activeRecipes = new Dictionary<Item, Dictionary<string, List<Recipe>>>();

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(new byte[] { 1, 1, 2 })]
		private static Dictionary<Recipe, ConfigEntryBase> hiddenCraftRecipes = new Dictionary<Recipe, ConfigEntryBase>();

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(new byte[] { 1, 1, 2 })]
		private static Dictionary<Recipe, ConfigEntryBase> hiddenUpgradeRecipes = new Dictionary<Recipe, ConfigEntryBase>();

		private static Dictionary<Item, Dictionary<string, ItemConfig>> itemCraftConfigs = new Dictionary<Item, Dictionary<string, ItemConfig>>();

		private static Dictionary<Item, ConfigEntry<string>> itemDropConfigs = new Dictionary<Item, ConfigEntry<string>>();

		private Dictionary<CharacterDrop, Drop> characterDrops = new Dictionary<CharacterDrop, Drop>();

		private readonly Dictionary<ConfigEntryBase, Action> statsConfigs = new Dictionary<ConfigEntryBase, Action>();

		public static Configurability DefaultConfigurability = Configurability.Full;

		public Configurability? Configurable = null;

		private Configurability configurationVisible = Configurability.Full;

		public readonly GameObject Prefab;

		[Description("Specifies the maximum required crafting station level to upgrade and repair the item.\nDefault is calculated from crafting station level and maximum quality.")]
		public int MaximumRequiredStationLevel = int.MaxValue;

		[Description("Assigns the item as a drop item to a creature.\nUses a creature name, a drop chance and a minimum and maximum amount.")]
		public readonly DropTargets DropsFrom = new DropTargets();

		internal List<Conversion> Conversions = new List<Conversion>();

		internal List<ItemConversion> conversions = new List<ItemConversion>();

		public Dictionary<string, ItemRecipe> Recipes = new Dictionary<string, ItemRecipe>();

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(2)]
		private LocalizeKey _name;

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(2)]
		private LocalizeKey _description;

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(2)]
		private static object configManager;

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(2)]
		private static Localization _english;

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(2)]
		private static BaseUnityPlugin _plugin;

		private static bool hasConfigSync = true;

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(2)]
		private static object _configSync;

		private Configurability configurability => Configurable ?? DefaultConfigurability;

		[Description("Specifies the resources needed to craft the item.\nUse .Add to add resources with their internal ID and an amount.\nUse one .Add for each resource type the item should need.")]
		public RequiredResourceList RequiredItems => this[""].RequiredItems;

		[Description("Specifies the resources needed to upgrade the item.\nUse .Add to add resources with their internal ID and an amount. This amount will be multipled by the item quality level.\nUse one .Add for each resource type the upgrade should need.")]
		public RequiredResourceList RequiredUpgradeItems => this[""].RequiredUpgradeItems;

		[Description("Specifies the crafting station needed to craft the item.\nUse .Add to add a crafting station, using the CraftingTable enum and a minimum level for the crafting station.\nUse one .Add for each crafting station.")]
		public CraftingStationList Crafting => this[""].Crafting;

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(2)]
		[Description("Specifies a config entry which toggles whether a recipe is active.")]
		public ConfigEntryBase RecipeIsActive
		{
			[<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(2)]
			get
			{
				return this[""].RecipeIsActive;
			}
			[<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(2)]
			set
			{
				this[""].RecipeIsActive = value;
			}
		}

		[Description("Specifies the number of items that should be given to the player with a single craft of the item.\nDefaults to 1.")]
		public int CraftAmount
		{
			get
			{
				return this[""].CraftAmount;
			}
			set
			{
				this[""].CraftAmount = value;
			}
		}

		public bool RequireOnlyOneIngredient
		{
			get
			{
				return this[""].RequireOnlyOneIngredient;
			}
			set
			{
				this[""].RequireOnlyOneIngredient = value;
			}
		}

		public float QualityResultAmountMultiplier
		{
			get
			{
				return this[""].QualityResultAmountMultiplier;
			}
			set
			{
				this[""].QualityResultAmountMultiplier = value;
			}
		}

		public ItemRecipe this[string name]
		{
			get
			{
				if (Recipes.TryGetValue(name, out var value))
				{
					return value;
				}
				return Recipes[name] = new ItemRecipe();
			}
		}

		public LocalizeKey Name
		{
			get
			{
				LocalizeKey name = _name;
				if (name != null)
				{
					return name;
				}
				SharedData shared = Prefab.GetComponent<ItemDrop>().m_itemData.m_shared;
				if (shared.m_name.StartsWith("$"))
				{
					_name = new LocalizeKey(shared.m_name);
				}
				else
				{
					string text = "$item_" + ((Object)Prefab).name.Replace(" ", "_");
					_name = new LocalizeKey(text).English(shared.m_name);
					shared.m_name = text;
				}
				return _name;
			}
		}

		public LocalizeKey Description
		{
			get
			{
				LocalizeKey description = _description;
				if (description != null)
				{
					return description;
				}
				SharedData shared = Prefab.GetComponent<ItemDrop>().m_itemData.m_shared;
				if (shared.m_description.StartsWith("$"))
				{
					_description = new LocalizeKey(shared.m_description);
				}
				else
				{
					string text = "$itemdesc_" + ((Object)Prefab).name.Replace(" ", "_");
					_description = new LocalizeKey(text).English(shared.m_description);
					shared.m_description = text;
				}
				return _description;
			}
		}

		private static Localization english => _english ?? (_english = LocalizationCache.ForLanguage("English"));

		private static BaseUnityPlugin plugin
		{
			get
			{
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Expected O, but got Unknown
				if (_plugin == null)
				{
					IEnumerable<TypeInfo> source;
					try
					{
						source = Assembly.GetExecutingAssembly().DefinedTypes.ToList();
					}
					catch (ReflectionTypeLoadException ex)
					{
						source = from t in ex.Types
							where t != null
							select t.GetTypeInfo();
					}
					_plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First([<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t)));
				}
				return _plugin;
			}
		}

		[<40bd5b47-655e-4b3a-9fce-16588b9601f8>Nullable(2)]
		private static object configSync
		{
			[<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(2)]
			get
			{
				if (_configSync == null && hasConfigSync)
				{
					Type type = Assembly.GetExecutingAssembly().GetType("ServerSync.ConfigSync");
					if ((object)type != null)
					{
						_configSync = Activator.CreateInstance(type, plugin.Info.Metadata.GUID + " ItemManager");
						type.GetField("CurrentVersion").SetValue(_configSync, plugin.Info.Metadata.Version.ToString());
						type.GetProperty("IsLocked").SetValue(_configSync, true);
					}
					else
					{
						hasConfigSync = false;
					}
				}
				return _configSync;
			}
		}

		public Item(string assetBundleFileName, string prefabName, string folderName = "assets")
			: this(PrefabManager.RegisterAssetBundle(assetBundleFileName, folderName), prefabName)
		{
		}

		public Item(AssetBundle bundle, string prefabName)
			: this(PrefabManager.RegisterPrefab(bundle, prefabName, addToObjectDb: true), skipRegistering: true)
		{
		}

		public Item(GameObject prefab, bool skipRegistering = false)
		{
			if (!skipRegistering)
			{
				PrefabManager.RegisterPrefab(prefab, addToObjectDb: true);
			}
			Prefab = prefab;
			registeredItems.Add(this);
			itemDropMap[Prefab.GetComponent<ItemDrop>()] = this;
		}

		public void ToggleConfigurationVisibility(Configurability visible)
		{
			configurationVisible = visible;
			if (itemDropConfigs.TryGetValue(this, out var value))
			{
				Toggle((ConfigEntryBase)(object)value, Configurability.Drop);
			}
			if (itemCraftConfigs.TryGetValue(this, out var value2))
			{
				foreach (ItemConfig value4 in value2.Values)
				{
					ToggleObj(value4, Configurability.Recipe);
				}
			}
			foreach (Conversion conversion in Conversions)
			{
				if (conversion.config != null)
				{
					ToggleObj(conversion.config, Configurability.Recipe);
				}
			}
			foreach (KeyValuePair<ConfigEntryBase, Action> statsConfig in statsConfigs)
			{
				Toggle(statsConfig.Key, Configurability.Stats);
				if ((visible & Configurability.Stats) != 0)
				{
					statsConfig.Value();
				}
			}
			reloadConfigDisplay();
			void Toggle(ConfigEntryBase cfg, Configurability check)
			{
				object[] tags = cfg.Description.Tags;
				foreach (object obj2 in tags)
				{
					if (obj2 is ConfigurationManagerAttributes configurationManagerAttributes)
					{
						configurationManagerAttributes.Browsable = (visible & check) != 0 && (configurationManagerAttributes.browsability == null || configurationManagerAttributes.browsability());
					}
				}
			}
			void ToggleObj(object obj, Configurability check)
			{
				FieldInfo[] fields = obj.GetType().GetFields();
				foreach (FieldInfo fieldInfo in fields)
				{
					object? value3 = fieldInfo.GetValue(obj);
					ConfigEntryBase val = (ConfigEntryBase)((value3 is ConfigEntryBase) ? value3 : null);
					if (val != null)
					{
						Toggle(val, check);
					}
				}
			}
		}

		internal static void reloadConfigDisplay()
		{
			configManager?.GetType().GetMethod("BuildSettingList").Invoke(configManager, Array.Empty<object>());
		}

		internal static void Patch_FejdStartup()
		{
			//IL_1010: Unknown result type (might be due to invalid IL or missing references)
			//IL_1015: Unknown result type (might be due to invalid IL or missing references)
			//IL_10dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_10e0: Invalid comparison between Unknown and I4
			//IL_0cdb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce5: Expected O, but got Unknown
			//IL_10e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_10e5: Invalid comparison between Unknown and I4
			//IL_10e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_10eb: Invalid comparison between Unknown and I4
			//IL_1251: Unknown result type (might be due to invalid IL or missing references)
			//IL_1254: Invalid comparison between Unknown and I4
			//IL_10ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f0: Invalid comparison between Unknown and I4
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Expected O, but got Unknown
			//IL_1256: Unknown result type (might be due to invalid IL or missing references)
			//IL_1259: Invalid comparison between Unknown and I4
			//IL_10f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f6: Invalid comparison between Unknown and I4
			//IL_0e09: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e13: Expected O, but got Unknown
			//IL_0eb5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ebf: Expected O, but got Unknown
			//IL_125b: Unknown result type (might be due to invalid IL or missing references)
			//IL_125e: Invalid comparison between Unknown and I4
			//IL_10f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_10fb: Invalid comparison between Unknown and I4
			//IL_0f6a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f74: Expected O, but got Unknown
			//IL_146e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1471: Invalid comparison between Unknown and I4
			//IL_1260: Unknown result type (might be due to invalid IL or missing references)
			//IL_1264: Invalid comparison between Unknown and I4
			//IL_10fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_1101: Invalid comparison between Unknown and I4
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Expected O, but got Unknown
			//IL_1473: Unknown result type (might be due to invalid IL or missing references)
			//IL_1477: Invalid comparison between Unknown and I4
			//IL_1266: Unknown result type (might be due to invalid IL or missing references)
			//IL_126a: Invalid comparison between Unknown and I4
			//IL_1103: Unknown result type (might be due to invalid IL or missing references)
			//IL_1107: Invalid comparison between Unknown and I4
			//IL_1479: Unknown result type (might be due to invalid IL or missing references)
			//IL_147c: Invalid comparison between Unknown and I4
			//IL_1109: Unknown result type (might be due to invalid IL or missing references)
			//IL_110c: Invalid comparison between Unknown and I4
			//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d3: Expected O, but got Unknown
			//IL_1560: Unknown result type (might be due to invalid IL or missing references)
			//IL_1565: Unknown result type (might be due to invalid IL or missing references)
			//IL_1567: Unknown result type (might be due to invalid IL or missing references)
			//IL_156a: Invalid comparison between Unknown and I4
			//IL_147e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1482: Invalid comparison between Unknown and I4
			//IL_110e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1112: Invalid comparison between Unknown and I4
			//IL_156c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1570: Invalid comparison between Unknown and I4
			//IL_1484: Unknown result type (might be due to invalid IL or missing references)
			//IL_1488: Invalid comparison between Unknown and I4
			//IL_1114: Unknown result type (might be due to invalid IL or missing references)
			//IL_1118: Invalid comparison between Unknown and I4
			//IL_07b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bc: Expected O, but got Unknown
			//IL_0707: Unknown result type (might be due to invalid IL or missing references)
			//IL_0711: Expected O, but got Unknown
			//IL_15e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_15e9: Invalid comparison between Unknown and I4
			//IL_15eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_15ee: Invalid comparison between Unknown and I4
			//IL_08cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d6: Expected O, but got Unknown
			//IL_15f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_15f4: Invalid comparison between Unknown and I4
			//IL_1747: Unknown result type (might be due to invalid IL or missing references)
			//IL_174a: Invalid comparison between Unknown and I4
			//IL_15f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_15f9: Invalid comparison between Unknown and I4
			//IL_15fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_15ff: Invalid comparison between Unknown and I4
			//IL_1601: Unknown result type (might be due to invalid IL or missing references)
			//IL_1605: Invalid comparison between Unknown and I4
			//IL_1959: Unknown result type (might be due to invalid IL or missing references)
			//IL_1960: Invalid comparison between Unknown and I4
			//IL_1a35: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a3a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a3c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a40: Invalid comparison between Unknown and I4
			//IL_1a42: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a46: Invalid comparison between Unknown and I4
			//IL_16b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_16bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_1abc: Unknown result type (might be due to invalid IL or missing references)
			//IL_1abf: Invalid comparison between Unknown and I4
			//IL_1ac1: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ac5: Invalid comparison between Unknown and I4
			//IL_1ac7: Unknown result type (might be due to invalid IL or missing references)
			//IL_1acb: Invalid comparison between Unknown and I4
			//IL_1acd: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ad0: Invalid comparison between Unknown and I4
			//IL_1f58: Unknown result type (might be due to invalid IL or missing references)
			//IL_1f5b: Invalid comparison between Unknown and I4
			Type type = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault([<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (Assembly a) => a.GetName().Name == "ConfigurationManager")?.GetType("ConfigurationManager.ConfigurationManager");
			configManager = ((type == null) ? null : Chainloader.ManagerObject.GetComponent(type));
			if (DefaultConfigurability != 0)
			{
				bool saveOnConfigSet = plugin.Config.SaveOnConfigSet;
				plugin.Config.SaveOnConfigSet = false;
				foreach (Item item3 in registeredItems.Where([<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (Item i) => i.configurability != Configurability.Disabled))
				{
					Item item2 = item3;
					string name2 = item2.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_name;
					string englishName = new Regex("['[\"\\]]").Replace(english.Localize(name2), "").Trim();
					string localizedName = Localization.instance.Localize(name2).Trim();
					if ((item2.configurability & Configurability.Recipe) != 0)
					{
						itemCraftConfigs[item2] = new Dictionary<string, ItemConfig>();
						foreach (string item4 in item2.Recipes.Keys.DefaultIfEmpty(""))
						{
							string configKey = item4;
							int order = 0;
							string text = ((configKey == "") ? "" : (" (" + configKey + ")"));
							if (!item2.Recipes.ContainsKey(configKey) || item2.Recipes[configKey].Crafting.Stations.Count <= 0)
							{
								continue;
							}
							ItemConfig itemConfig2 = (itemCraftConfigs[item2][configKey] = new ItemConfig());
							ItemConfig cfg = itemConfig2;
							List<ConfigurationManagerAttributes> hideWhenNoneAttributes = new List<ConfigurationManagerAttributes>();
							cfg.table = config(englishName, "Crafting Station" + text, item2.Recipes[configKey].Crafting.Stations.First().Table, new ConfigDescription("Crafting station where " + englishName + " is available.", (AcceptableValueBase)null, new object[1]
							{
								new ConfigurationManagerAttributes
								{
									Order = (order -= 1),
									Browsable = ((item2.configurationVisible & Configurability.Recipe) != 0),
									Category = localizedName
								}
							}));
							ConfigurationManagerAttributes customTableAttributes = new ConfigurationManagerAttributes
							{
								Order = (order -= 1),
								browsability = CustomTableBrowsability,
								Browsable = (CustomTableBrowsability() && (item2.configurationVisible & Configurability.Recipe) != 0),
								Category = localizedName
							};
							cfg.customTable = config(englishName, "Custom Crafting Station" + text, item2.Recipes[configKey].Crafting.Stations.First().custom ?? "", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { customTableAttributes }));
							cfg.table.SettingChanged += TableConfigChanged;
							cfg.customTable.SettingChanged += TableConfigChanged;
							ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes
							{
								Order = (order -= 1),
								browsability = TableLevelBrowsability,
								Browsable = (TableLevelBrowsability() && (item2.configurationVisible & Configurability.Recipe) != 0),
								Category = localizedName
							};
							hideWhenNoneAttributes.Add(configurationManagerAttributes);
							cfg.tableLevel = config(englishName, "Crafting Station Level" + text, item2.Recipes[configKey].Crafting.Stations.First().level, new ConfigDescription("Required crafting station level to craft " + englishName + ".", (AcceptableValueBase)null, new object[1] { configurationManagerAttributes }));
							cfg.tableLevel.SettingChanged += [<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (object _, EventArgs _) =>
							{
								if (activeRecipes.ContainsKey(item2) && activeRecipes[item2].TryGetValue(configKey, out var value10))
								{
									value10.First().m_minStationLevel = cfg.tableLevel.Value;
								}
							};
							if (item2.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_maxQuality > 1)
							{
								cfg.maximumTableLevel = config(englishName, "Maximum Crafting Station Level" + text, (item2.MaximumRequiredStationLevel == int.MaxValue) ? (item2.Recipes[configKey].Crafting.Stations.First().level + item2.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_maxQuality - 1) : item2.MaximumRequiredStationLevel, new ConfigDescription("Maximum crafting station level to upgrade and repair " + englishName + ".", (AcceptableValueBase)null, new object[1] { configurationManagerAttributes }));
							}
							cfg.requireOneIngredient = config(englishName, "Require only one resource" + text, item2.Recipes[configKey].RequireOnlyOneIngredient ? Toggle.On : Toggle.Off, new ConfigDescription("Whether only one of the ingredients is needed to craft " + englishName, (AcceptableValueBase)null, new object[1]
							{
								new ConfigurationManagerAttributes
								{
									Order = (order -= 1),
									Category = localizedName
								}
							}));
							ConfigurationManagerAttributes qualityResultAttributes = new ConfigurationManagerAttributes
							{
								Order = (order -= 1),
								browsability = QualityResultBrowsability,
								Browsable = (QualityResultBrowsability() && (item2.configurationVisible & Configurability.Recipe) != 0),
								Category = localizedName
							};
							cfg.requireOneIngredient.SettingChanged += [<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (object _, EventArgs _) =>
							{
								if (activeRecipes.ContainsKey(item2) && activeRecipes[item2].TryGetValue(configKey, out var value9))
								{
									foreach (Recipe item5 in value9)
									{
										item5.m_requireOnlyOneIngredient = cfg.requireOneIngredient.Value == Toggle.On;
									}
								}
								qualityResultAttributes.Browsable = QualityResultBrowsability();
								reloadConfigDisplay();
							};
							cfg.qualityResultAmountMultiplier = config(englishName, "Quality Multiplier" + text, item2.Recipes[configKey].QualityResultAmountMultiplier, new ConfigDescription("Multiplies the crafted amount based on the quality of the resources when crafting " + englishName + ". Only works, if Require Only One Resource is true.", (AcceptableValueBase)null, new object[1] { qualityResultAttributes }));
							cfg.qualityResultAmountMultiplier.SettingChanged += [<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (object _, EventArgs _) =>
							{
								if (activeRecipes.ContainsKey(item2) && activeRecipes[item2].TryGetValue(configKey, out var value8))
								{
									foreach (Recipe item6 in value8)
									{
										item6.m_qualityResultAmountMultiplier = cfg.qualityResultAmountMultiplier.Value;
									}
								}
							};
							if ((!item2.Recipes[configKey].RequiredItems.Free || item2.Recipes[configKey].RequiredItems.Requirements.Count > 0) && item2.Recipes[configKey].RequiredItems.Requirements.All((Requirement r) => r.amountConfig == null))
							{
								cfg.craft = itemConfig("Crafting Costs" + text, new SerializedRequirements(item2.Recipes[configKey].RequiredItems.Requirements).ToString(), "Item costs to craft " + englishName);
							}
							if (item2.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_maxQuality > 1 && (!item2.Recipes[configKey].RequiredUpgradeItems.Free || item2.Recipes[configKey].RequiredUpgradeItems.Requirements.Count > 0) && item2.Recipes[configKey].RequiredUpgradeItems.Requirements.All((Requirement r) => r.amountConfig == null))
							{
								cfg.upgrade = itemConfig("Upgrading Costs" + text, new SerializedRequirements(item2.Recipes[configKey].RequiredUpgradeItems.Requirements).ToString(), "Item costs per level to upgrade " + englishName);
							}
							if (cfg.craft != null)
							{
								cfg.craft.SettingChanged += ConfigChanged;
							}
							if (cfg.upgrade != null)
							{
								cfg.upgrade.SettingChanged += ConfigChanged;
							}
							void ConfigChanged(object o, EventArgs e)
							{
								if (Object.op_Implicit((Object)(object)ObjectDB.instance) && activeRecipes.ContainsKey(item2) && activeRecipes[item2].TryGetValue(configKey, out var value4))
								{
									foreach (Recipe item7 in value4)
									{
										item7.m_resources = SerializedRequirements.toPieceReqs(ObjectDB.instance, new SerializedRequirements(cfg.craft?.Value ?? ""), new SerializedRequirements(cfg.upgrade?.Value ?? ""));
									}
								}
							}
							bool CustomTableBrowsability()
							{
								return cfg.table.Value == CraftingTable.Custom;
							}
							bool ItemBrowsability()
							{
								return cfg.table.Value != CraftingTable.Disabled;
							}
							bool QualityResultBrowsability()
							{
								return cfg.requireOneIngredient.Value == Toggle.On;
							}
							void TableConfigChanged(object o, EventArgs e)
							{
								if (activeRecipes.ContainsKey(item2) && activeRecipes[item2].TryGetValue(configKey, out var value5))
								{
									value5.First().m_enabled = cfg.table.Value != CraftingTable.Disabled;
									CraftingTable value6 = cfg.table.Value;
									if (value6 == CraftingTable.Inventory || value6 == CraftingTable.Disabled)
									{
										value5.First().m_craftingStation = null;
									}
									else if (cfg.table.Value == CraftingTable.Custom)
									{
										Recipe obj = value5.First();
										GameObject prefab2 = ZNetScene.instance.GetPrefab(cfg.customTable.Value);
										obj.m_craftingStation = ((prefab2 != null) ? prefab2.GetComponent<CraftingStation>() : null);
									}
									else
									{
										value5.First().m_craftingStation = ZNetScene.instance.GetPrefab(getInternalName(cfg.table.Value)).GetComponent<CraftingStation>();
									}
								}
								customTableAttributes.Browsable = cfg.table.Value == CraftingTable.Custom;
								foreach (ConfigurationManagerAttributes item8 in hideWhenNoneAttributes)
								{
									item8.Browsable = cfg.table.Value != CraftingTable.Disabled;
								}
								reloadConfigDisplay();
							}
							bool TableLevelBrowsability()
							{
								return cfg.table.Value != CraftingTable.Disabled;
							}
							ConfigEntry<string> itemConfig(string name, string value, string desc)
							{
								//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
								//IL_00b5: Expected O, but got Unknown
								ConfigurationManagerAttributes configurationManagerAttributes2 = new ConfigurationManagerAttributes
								{
									CustomDrawer = drawRequirementsConfigTable,
									Order = (order -= 1),
									browsability = ItemBrowsability,
									Browsable = (ItemBrowsability() && (item2.configurationVisible & Configurability.Recipe) != 0),
									Category = localizedName
								};
								hideWhenNoneAttributes.Add(configurationManagerAttributes2);
								return config(englishName, name, value, new ConfigDescription(desc, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes2 }));
							}
						}
						if ((item2.configurability & Configurability.Drop) != 0)
						{
							ConfigEntry<string> val3 = (itemDropConfigs[item2] = config(englishName, "Drops from", new SerializedDrop(item2.DropsFrom.Drops).ToString(), new ConfigDescription(englishName + " drops from this creature.", (AcceptableValueBase)null, new object[1]
							{
								new ConfigurationManagerAttributes
								{
									CustomDrawer = drawDropsConfigTable,
									Category = localizedName,
									Browsable = ((item2.configurationVisible & Configurability.Drop) != 0)
								}
							})));
							ConfigEntry<string> val4 = val3;
							val4.SettingChanged += [<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (object _, EventArgs _) =>
							{
								item2.UpdateCharacterDrop();
							};
						}
						for (int j = 0; j < item2.Conversions.Count; j++)
						{
							string text2 = ((item2.Conversions.Count > 1) ? $"{j + 1}. " : "");
							Conversion conversion = item2.Conversions[j];
							conversion.config = new Conversion.ConversionConfig();
							int index = j;
							conversion.config.input = config(englishName, text2 + "Conversion Input Item", conversion.Input, new ConfigDescription("Duration of conversion to create " + englishName, (AcceptableValueBase)null, new object[1]
							{
								new ConfigurationManagerAttributes
								{
									Category = localizedName,
									Browsable = ((item2.configurationVisible & Configurability.Recipe) != 0)
								}
							}));
							conversion.config.input.SettingChanged += [<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (object _, EventArgs _) =>
							{
								if (index < item2.conversions.Count)
								{
									ObjectDB instance = ObjectDB.instance;
									if (instance != null)
									{
										ItemDrop from = SerializedRequirements.fetchByName(instance, conversion.config.input.Value);
										item2.conversions[index].m_from = from;
										UpdatePiece();
									}
								}
							};
							conversion.config.piece = config(englishName, text2 + "Conversion Piece", conversion.Piece, new ConfigDescription("Duration of conversion to create " + englishName, (AcceptableValueBase)null, new object[1]
							{
								new ConfigurationManagerAttributes
								{
									Category = localizedName,
									Browsable = ((item2.configurationVisible & Configurability.Recipe) != 0)
								}
							}));
							conversion.config.piece.SettingChanged += [<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (object _, EventArgs _) =>
							{
								UpdatePiece();
							};
							conversion.config.customPiece = config(englishName, text2 + "Conversion Custom Piece", conversion.customPiece ?? "", new ConfigDescription("Duration of conversion to create " + englishName, (AcceptableValueBase)null, new object[1]
							{
								new ConfigurationManagerAttributes
								{
									Category = localizedName,
									Browsable = ((item2.configurationVisible & Configurability.Recipe) != 0)
								}
							}));
							conversion.config.customPiece.SettingChanged += [<7f4597bc-fe65-4eda-b79e-909f328347ff>NullableContext(0)] (object _, EventArgs _) =>
							{
								UpdatePiece();
							};
							void UpdatePiece()
							{
								if (index < item2.conversions.Count && Object.op_Implicit((Object)(object)ZNetScene.instance))
								{
									string text3 = ((conversion.config.piece.Value == ConversionPiece.Disabled) ? null : ((conversion.config.piece.Value == ConversionPiece.Custom) ? conversion.config.customPiece.Value : getInternalName(conversion.config.piece.Value)));
									string activePiece = conversion.config.activePiece;
									if (conversion.config.activePiece != null)
									{
										Smelter component = ZNetScene.instance.GetPrefab(conversion.config.activePiece).GetComponent<Smelter>();
										int num = component.m_conversion.IndexOf(item2.conversions[index]);
										if (num >= 0)
										{
											Smelter[] array3 = Resources.FindObjectsOfTypeAll<Smelter>();
											foreach (Smelter val5 in array3)
											{
												if (Utils.GetPrefabName(((Component)val5).gameObject) == activePiece)
												{
													val5.m_conversion.RemoveAt(num);
												}
											}
										}
										conversion.config.activePiece = null;
									}
									if (item2.conversions[index].m_from != null && conversion.config.piece.Value != 0)
									{
										GameObject prefab = ZNetScene.instance.GetPrefab(text3);
										if (((prefab != null) ? prefab.GetComponent<Smelter>() : null) != null)
										{
											conversion.config.activePiece = text3;
											Smelter[] array4 = Resources.FindObjectsOfTypeAll<Smelter>();
											foreach (Smelter val6 in array4)
											{
												if (Utils.GetPrefabName(((Component)val6).gameObject) == text3)
												{
													val6.m_conversion.Add(item2.conversions[index]);
												}
											}
										}
									}
								}
							}
						}
					}
					if ((item2.configurability & Configurability.Stats) == 0)
					{
						continue;
					}
					item2.statsConfigs.Clear();
					SharedData shared2 = item2.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared;
					ItemType itemType = shared2.m_itemType;
					statcfg<float>("Weight", "Weight of " + englishName + ".", (SharedData shared) => shared.m_weight, delegate(SharedData shared, float value)
					{
						shared.m_weight = value;
					});
					statcfg<int>("Trader Value", "Trader value of " + englishName + ".", (SharedData shared) => shared.m_value, delegate(SharedData shared, int value)
					{
						shared.m_value = value;
					});
					if ((int)itemType == 4 || (int)itemType == 7 || (int)itemType == 12 || (int)itemType == 6 || (int)itemType == 11 || (int)itemType == 5 || (int)itemType == 17 || (int)itemType == 19 || (int)itemType == 3 || (int)itemType == 14 || (int)itemType == 22)
					{
						statcfg<float>("Durability", "Durability of " + englishName + ".", (SharedData shared) => shared.m_maxDurability, delegate(SharedData shared, float value)
						{
							shared.m_maxDurability = value;
						});
						statcfg<float>("Durability per Level", "Durability gain per level of " + englishName + ".", (SharedData shared) => shared.m_durabilityPerLevel, delegate(SharedData shared, float value)
						{
							shared.m_durabilityPerLevel = value;
						});
						statcfg<float>("Movement Speed Modifier", "Movement speed modifier of " + englishName + ".", (SharedData shared) => shared.m_movementModifier, delegate(SharedData shared, float value)
						{
							shared.m_movementModifier = value;
						});
					}
					if ((int)itemType == 4 || (int)itemType == 5 || (int)itemType == 3 || (int)itemType == 14 || (int)itemType == 22)
					{
						statcfg<float>("Block Armor", "Block armor of " + englishName + ".", (SharedData shared) => shared.m_blockPower, delegate(SharedData shared, float value)
						{
							shared.m_blockPower = value;
						});
						statcfg<float>("Block Armor per Level", "Block armor per level for " + englishName + ".", (SharedData shared) => shared.m_blockPowerPerLevel, delegate(SharedData shared, float value)
						{
							shared.m_blockPowerPerLevel = value;
						});
						statcfg<float>("Block Force", "Block force of " + englishName + ".", (SharedData shared) => shared.m_deflectionForce, delegate(SharedData shared, float value)
						{
							shared.m_deflectionForce = value;
						});
						statcfg<float>("Block Force per Level", "Block force per level for " + englishName + ".", (SharedData shared) => shared.m_deflectionForcePerLevel, delegate(SharedData shared, float value)
						{
							shared.m_deflectionForcePerLevel = value;
						});
						statcfg<float>("Parry Bonus", "Parry bonus of " + englishName + ".", (SharedData shared) => shared.m_timedBlockBonus, delegate(SharedData shared, float value)
						{
							shared.m_timedBlockBonus = value;
						});
					}
					else if ((int)itemType == 7 || (int)itemType == 12 || (int)itemType == 6 || (int)itemType == 11 || (int)itemType == 17)
					{
						statcfg<float>("Armor", "Armor of " + englishName + ".", (SharedData shared) => shared.m_armor, delegate(SharedData shared, float value)
						{
							shared.m_armor = value;
						});
						statcfg<float>("Armor per Level", "Armor per level for " + englishName + ".", (SharedData shared) => shared.m_armorPerLevel, delegate(SharedData shared, float value)
						{
							shared.m_armorPerLevel = value;
						});
					}
					SkillType skillType = shared2.m_skillType;
					if ((int)skillType == 7 || (int)skillType == 12)
					{
						statcfg<int>("Tool tier", "Tool tier of " + englishName + ".", (SharedData shared) => shared.m_toolTier, delegate(SharedData shared, int value)
						{
							shared.m_toolTier = value;
						});
					}
					if ((int)itemType == 5 || (int)itemType == 7 || (int)itemType == 12 || (int)itemType == 6 || (int)itemType == 11 || (int)itemType == 17)
					{
						Dictionary<DamageType, DamageModifier> modifiers = shared2.m_damageModifiers.ToDictionary((DamageModPair d) => d.m_type, (DamageModPair d) => (DamageModifier)d.m_modifier);
						DamageType[] first = (DamageType[])Enum.GetValues(typeof(DamageType));
						DamageType[] array = new DamageType[5];
						RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
						foreach (DamageType item9 in first.Except((IEnumerable<DamageType>)(object)array))
						{
							DamageType damageType = item9;
							statcfg<DamageModifier>(((object)(DamageType)(ref damageType)).ToString() + " Resistance", ((object)(DamageType)(ref damageType)).ToString() + " resistance of " + englishName + ".", (SharedData _) => modifiers.TryGetValue(damageType, out var value7) ? value7 : DamageModifier.None, delegate(SharedData shared, DamageModifier value)
							{
								//IL_0003: Unknown result type (might be due to