Decompiled source of MagicalWeapons v1.2.1

MagicWeapons.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
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.Cryptography;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using ItemManager;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using ServerSync;
using TMPro;
using UnityEngine;

[assembly: AssemblyFileVersion("1.2.1")]
[assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")]
[assembly: ComVisible(false)]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyProduct("MagicWeapons")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("MagicWeapons")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("MythikWolf")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.0")]
[module: <f94991ff-3061-4c0f-a756-07d0ba068c77>RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<301763d6-d9c9-4db5-9b6c-fb57cca803af>Embedded]
	internal sealed class <301763d6-d9c9-4db5-9b6c-fb57cca803af>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)]
	[<301763d6-d9c9-4db5-9b6c-fb57cca803af>Embedded]
	[CompilerGenerated]
	internal sealed class <fa0099e5-e682-4467-b0e1-eb34a02f7b11>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <fa0099e5-e682-4467-b0e1-eb34a02f7b11>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <fa0099e5-e682-4467-b0e1-eb34a02f7b11>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[<301763d6-d9c9-4db5-9b6c-fb57cca803af>Embedded]
	[CompilerGenerated]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class <ded5a3ac-7538-435d-aa90-707aff494c11>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <ded5a3ac-7538-435d-aa90-707aff494c11>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	[<301763d6-d9c9-4db5-9b6c-fb57cca803af>Embedded]
	internal sealed class <f94991ff-3061-4c0f-a756-07d0ba068c77>RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public <f94991ff-3061-4c0f-a756-07d0ba068c77>RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MagicWeapons
{
	[BepInPlugin("MythikWolf.MagicWeapons", "MagicWeapons", "1.2.1")]
	[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(0)]
	[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(1)]
	public class MagicWeaponsPlugin : BaseUnityPlugin
	{
		[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)]
		public enum Toggle
		{
			On = 1,
			Off = 0
		}

		[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)]
		private class ConfigurationManagerAttributes
		{
			[UsedImplicitly]
			public int? Order;

			[UsedImplicitly]
			public bool? Browsable;

			[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
			[UsedImplicitly]
			public string Category;

			[UsedImplicitly]
			[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(new byte[] { 2, 1 })]
			public Action<ConfigEntryBase> CustomDrawer;
		}

		internal const string ModName = "MagicWeapons";

		internal const string ModVersion = "1.2.1";

		internal const string Author = "MythikWolf";

		private const string ModGUID = "MythikWolf.MagicWeapons";

		private static string ConfigFileName = "MythikWolf.MagicWeapons.cfg";

		private static string ConfigFileFullPath;

		internal static string ConnectionError;

		private readonly Harmony _harmony = new Harmony("MythikWolf.MagicWeapons");

		public static readonly ManualLogSource MagicWeaponsLogger;

		private static readonly ConfigSync ConfigSync;

		private static ConfigEntry<Toggle> _serverConfigLocked;

		private static ConfigEntry<Toggle> _recipeIsActiveConfig;

		public void Awake()
		{
			_serverConfigLocked = config("1 - General", "Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only.");
			ConfigSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked);
			Item item = new Item("magicweapons", "lightning_gem_mw");
			item.Name.English("Lightning Gem");
			item.Name.Portuguese_Brazilian("Gema de Relâmpago");
			item.Name.Spanish("Gema relámpago");
			item.Description.English("A skyblue gemstone that when you look closely, you can see a small lighting storm swirling inside.");
			item.Description.Portuguese_Brazilian("Uma gema azul celeste em que se pode ver uma pequena tempestade turbilhonando no interior.");
			item.Description.Spanish("Una gema azul cielo que cuando la miras de cerca puedes ver una pequeña tormenta de rayos arremolinándose en su interior.");
			Item item2 = new Item("magicweapons", "wind_gem_mw");
			item2.Name.English("Wind Gem");
			item2.Name.Portuguese_Brazilian("Gema de Vento");
			item2.Name.Spanish("Gema del viento");
			item2.Description.English("A turquiose gemstone that feels cool to the touch and seems to generate brief gusts of air that swirl about it for a moment before dissipating.");
			item2.Description.Portuguese_Brazilian("Uma gema turquesa que é fria ao toque e parece gerar breves rajadas de vento que rodopiam ao redor dela por instantes antes de dissiparem.");
			item2.Description.Spanish("Una gema turquesa que se siente fría al tacto y parece generar breves ráfagas de aire que giran a su alrededor por un momento antes de disiparse.");
			Item item3 = new Item("magicweapons", "moon_gem_mw");
			item3.Name.English("Moon Gem");
			item3.Name.Portuguese_Brazilian("Gema da Lua");
			item3.Name.Spanish("Gema lunar");
			item3.Description.English("A translucent gemstone that is oddly heavy in your hand and cool to the touch.");
			item3.Description.Portuguese_Brazilian("Uma gema translúcida que é estranhamente pesada na sua mão e fria ao toque.");
			item3.Description.Spanish("Una gema translúcida que es extrañamente pesada en la mano y fría al tacto.");
			Item item4 = new Item("magicweapons", "fenrir_blood_mw");
			item4.Name.English("Fenrir's Blood");
			item4.Name.Portuguese_Brazilian("Sangue de Fenrir");
			item4.Name.Spanish("Sangre de Fenrir");
			item4.Description.English("A bottle filled with the crimson blood collected from a Fenrir.");
			item4.Description.Portuguese_Brazilian("Um frasco enchido com o sangue carmesim coletado de um Fenrir.");
			item4.Description.Spanish("Una botella llena de la sangre carmesí recogida de un Fenrir.");
			Item item5 = new Item("magicweapons", "shard_of_darkness_mw");
			item5.Name.English("Shard of Darkness");
			item5.Name.Portuguese_Brazilian("Lasca das Trevas");
			item5.Name.Spanish("Fragmento de oscuridad");
			item5.Description.English("A shadowy gemstone with an otherworldly quality to it.");
			item5.Description.Portuguese_Brazilian("Uma gema sombria de qualidade sobrenatural.");
			item5.Description.Spanish("Una piedra preciosa sombría con una cualidad de otro mundo.");
			Item item6 = new Item("magicweapons", "bottle_of_poison_mw");
			item6.Name.English("Bottle of Poison");
			item6.Name.Portuguese_Brazilian("Frasco de Veneno");
			item6.Name.Spanish("Botella de veneno");
			item6.Description.English("A bottle of the poisonous secretions and bile of various creatures you have faced.");
			item6.Description.Portuguese_Brazilian("Um frasco com as secreções venenosas e bile de várias criaturas que você enfrentou.");
			item6.Description.Spanish("Botella de secreciones venenosas y bilis de varias criaturas a las que te has enfrentado.");
			Item item7 = new Item("magicweapons", "earth_gem_mw");
			item7.Name.English("Earth Gem");
			item7.Name.Portuguese_Brazilian("Gema da Terra");
			item7.Name.Spanish("Gema de la Tierra");
			item7.Description.English("A green-purple gemstone that is comfortably warm to the touch.");
			item7.Description.Portuguese_Brazilian("Uma gema verde-roxa que é confortavelmente quente ao toque.");
			Item item8 = new Item("magicweapons", "water_bottle_mw");
			item8.Name.English("Bottle of Chilly Water");
			item8.Name.Portuguese_Brazilian("Garrafa de água gelada");
			item8.Name.Spanish("Botella de agua helada");
			item8.Description.English("A bottle of water found from the golems in the mountains.");
			item8.Description.Portuguese_Brazilian("Uma garrafa de água encontrada dos golems nas montanhas.");
			item8.Description.Spanish("Botella de agua encontrada de los golems en las montañas");
			item4.DropsFrom.Add("Fenring", 0.6f, 1, 1);
			item4.DropsFrom.Add("Fenring_Cultist", 0.6f, 1, 1);
			item6.DropsFrom.Add("Blob", 0.4f, 1, 1);
			item5.DropsFrom.Add("Ghost", 1f, 1, 1);
			item3.DropsFrom.Add("gd_king", 1f, 1, 2);
			item.DropsFrom.Add("Eikthyr", 1f, 1, 2);
			item7.DropsFrom.Add("Greydwarf_Elite", 0.2f, 1, 1);
			item2.DropsFrom.Add("Hatchling", 0.3f, 1, 2);
			item8.DropsFrom.Add("StoneGolem", 0.3f, 1, 2);
			Item item9 = new Item("magicweapons", "magic_ice_sword");
			item9.Name.English("Frorin Dauoi");
			item9.Name.Portuguese_Brazilian("Frorin Dauoi");
			item9.Name.Spanish("Frorin Dauoi");
			item9.Description.English("A sharp blade made of frozen iron.  Premafrost adorns the blade.");
			item9.Description.Portuguese_Brazilian("Uma lâmina afiada feita de ferro congelado. Permafrost adorna a lâmina.");
			item9.Description.Spanish("Una hoja afilada hecha de hierro helado. Permafrost adorna la hoja.");
			item9.Crafting.Add(CraftingTable.Forge, 3);
			item9.RequiredItems.Add("Iron", 30);
			item9.RequiredItems.Add("FreezeGland", 10);
			item9.RequiredUpgradeItems.Add("Iron", 20);
			item9.RequiredUpgradeItems.Add("FreezeGland", 10);
			item9.CraftAmount = 1;
			item9.Snapshot();
			_recipeIsActiveConfig = config("2 - Recipes", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab");
			item9.RecipeIsActive = (ConfigEntryBase)(object)_recipeIsActiveConfig;
			Item item10 = new Item("magicweapons", "magic_wind_axe_1H");
			item10.Name.English("Njord's Fury");
			item10.Name.Portuguese_Brazilian("Fúria de Njord");
			item10.Name.Spanish("Furia de Njord");
			item10.Description.English("An axe with decorative symbols cut into the blade and a sturdy leather wrapped haft.");
			item10.Description.Portuguese_Brazilian("Um machado com símbolos decorativos talhados na lâmina e com um cabo resistente envolto em couro.");
			item10.Description.Spanish("Un hacha con símbolos decorativos tallados en la hoja y una robusta empuñadura envuelta en cuero.");
			item10.Crafting.Add(CraftingTable.Forge, 3);
			item10.RequiredItems.Add("RoundLog", 5);
			item10.RequiredItems.Add("Iron", 30);
			item10.RequiredItems.Add("wind_gem_mw", 10);
			item10.RequiredUpgradeItems.Add("Iron", 20);
			item10.RequiredUpgradeItems.Add("wind_gem_mw", 5);
			item10.CraftAmount = 1;
			item10.Snapshot();
			_recipeIsActiveConfig = config("2 - Recipes", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab");
			item10.RecipeIsActive = (ConfigEntryBase)(object)_recipeIsActiveConfig;
			Item item11 = new Item("magicweapons", "magic_fire_axe_1H_01");
			item11.Name.English("Freyr's Determination");
			item11.Name.Portuguese_Brazilian("Determinação de Freyr");
			item11.Name.Spanish("Determinación de Freyr");
			item11.Description.English("An almost primative looking axe made of rough dark metal with a haft of gnarled wood that emits cinder sparks into the air and radiates its own heat.");
			item11.Description.Portuguese_Brazilian("Um machado de aparência quase primitiva feito de metal escuro áspero com um cabo de madeira retorcida que emite faíscas de cinzas no ar e irradia seu próprio calor.");
			item11.Description.Spanish("Un hacha de aspecto casi primitivo hecha de áspero metal oscuro con un mango de madera nudosa que emite chispas de ceniza al aire e irradia su propio calor.");
			item11.Crafting.Add(CraftingTable.Forge, 4);
			item11.RequiredItems.Add("ElderBark", 5);
			item11.RequiredItems.Add("BlackMetal", 30);
			item11.RequiredItems.Add("SurtlingCore", 10);
			item11.RequiredUpgradeItems.Add("BlackMetal", 20);
			item11.RequiredUpgradeItems.Add("SurtlingCore", 5);
			item11.CraftAmount = 1;
			item11.Snapshot();
			_recipeIsActiveConfig = config("2 - Recipes", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab");
			item11.RecipeIsActive = (ConfigEntryBase)(object)_recipeIsActiveConfig;
			Item item12 = new Item("magicweapons", "magic_water_axe_1H_01");
			item12.Name.English("Freyja's Promise");
			item12.Name.Portuguese_Brazilian("A promessa de Freyja");
			item12.Name.Spanish("Promesa de Freyja");
			item12.Description.English("An almost primative looking axe made of rough dark metal with a haft of gnarled wood with am almost damp feel.");
			item12.Description.Portuguese_Brazilian("Um machado de aparência quase primitiva feito de metal escuro áspero com um cabo de madeira retorcida com uma sensação quase úmida.");
			item12.Description.Spanish("Un hacha de aspecto casi primitivo hecha de metal oscuro y áspero con un mango de madera nudosa con un tacto casi húmedo.");
			item12.Crafting.Add(CraftingTable.Forge, 4);
			item12.RequiredItems.Add("ElderBark", 5);
			item12.RequiredItems.Add("BlackMetal", 30);
			item12.RequiredItems.Add("water_bottle_mw", 10);
			item12.RequiredUpgradeItems.Add("BlackMetal", 20);
			item12.RequiredUpgradeItems.Add("SurtlingCore", 5);
			item12.CraftAmount = 1;
			item12.Snapshot();
			_recipeIsActiveConfig = config("2 - Recipes", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab");
			item12.RecipeIsActive = (ConfigEntryBase)(object)_recipeIsActiveConfig;
			Item item13 = new Item("magicweapons", "magic_darkness_scythe");
			item13.Name.English("Darkness' Tooth");
			item13.Name.Portuguese_Brazilian("Dente das Trevas");
			item13.Name.Spanish("Diente de oscuridad");
			item13.Description.English("A wicked looking scythe with an eerie feel.");
			item13.Description.Portuguese_Brazilian("Uma foice de aparência perversa com uma sensação horripilante.");
			item13.Description.Spanish("Guadaña de aspecto malvado y tacto espeluznante.");
			item13.Crafting.Add(CraftingTable.Forge, 3);
			item13.RequiredItems.Add("Silver", 30);
			item13.RequiredItems.Add("shard_of_darkness_mw", 5);
			item13.RequiredItems.Add("fenrir_blood_mw", 2);
			item13.RequiredUpgradeItems.Add("Silver", 15);
			item13.RequiredUpgradeItems.Add("shard_of_darkness_mw", 3);
			item13.RequiredUpgradeItems.Add("fenrir_blood_mw", 1);
			item13.CraftAmount = 1;
			item13.Snapshot();
			_recipeIsActiveConfig = config("2 - Recipes", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab");
			item13.RecipeIsActive = (ConfigEntryBase)(object)_recipeIsActiveConfig;
			Item item14 = new Item("magicweapons", "normal_scythe");
			item14.Name.English("Iron Scythe");
			item14.Name.Portuguese_Brazilian("Foice de Ferro");
			item14.Name.Spanish("Guadaña de hierro");
			item14.Description.English("A normal farming tool made of sturdy iron that has been adapted to be used as a weapon.");
			item14.Description.Portuguese_Brazilian("Uma ferramenta de cultivo normal feita com ferro robusto, adaptada para ser usada como uma arma.");
			item14.Description.Spanish("Una herramienta de labranza normal hecha de hierro resistente que ha sido adaptada para ser usada como arma.");
			item14.Crafting.Add(CraftingTable.Forge, 3);
			item14.RequiredItems.Add("Iron", 30);
			item14.RequiredItems.Add("RoundLog", 5);
			item14.RequiredUpgradeItems.Add("Iron", 15);
			item14.RequiredUpgradeItems.Add("RoundLog", 3);
			item14.CraftAmount = 1;
			item14.Snapshot();
			_recipeIsActiveConfig = config("2 - Recipes", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab");
			item14.RecipeIsActive = (ConfigEntryBase)(object)_recipeIsActiveConfig;
			Item item15 = new Item("magicweapons", "magic_earth_hammer_1H");
			item15.Name.English("Earthen Hammer");
			item15.Name.Portuguese_Brazilian("Martelo Terreno");
			item15.Name.Spanish("Martillo de tierra");
			item15.Description.English("A solid hammer made of sturdy iron.  Swirling around the head of the weapon are small stones and dust.");
			item15.Description.Portuguese_Brazilian("Um martelo consistente feito com ferro robusto. Cascalhos e pó turbilhonam ao redor da cabeça da arma.");
			item15.Description.Spanish("Un martillo sólido hecho de hierro resistente.  Alrededor de la cabeza del arma se arremolinan pequeñas piedras y polvo.");
			item15.Crafting.Add(CraftingTable.Forge, 3);
			item15.RequiredItems.Add("Iron", 30);
			item15.RequiredItems.Add("earth_gem_mw", 5);
			item15.RequiredUpgradeItems.Add("Iron", 15);
			item15.RequiredUpgradeItems.Add("earth_gem_mw", 2);
			item15.CraftAmount = 1;
			item15.Snapshot();
			_recipeIsActiveConfig = config("2 - Recipes", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab");
			item15.RecipeIsActive = (ConfigEntryBase)(object)_recipeIsActiveConfig;
			Item item16 = new Item("magicweapons", "magic_moon_sword");
			item16.Name.English("Mani's Touch");
			item16.Name.Portuguese_Brazilian("Toque de Mani");
			item16.Name.Spanish("Toque de Mani");
			item16.Description.English("A sharp blade made of an unidentifiable metal that is cool to the touch and radiates its own light.");
			item16.Description.Portuguese_Brazilian("Uma lâmina afiada feita de um metal desconhecido que é frio ao toque e irradia sua própria luz.");
			item16.Description.Spanish("Una hoja afilada hecha de un metal no identificable que es fría al tacto e irradia su propia luz.");
			item16.Crafting.Add(CraftingTable.Forge, 3);
			item16.RequiredItems.Add("Iron", 30);
			item16.RequiredItems.Add("moon_gem_mw", 10);
			item16.RequiredUpgradeItems.Add("Iron", 20);
			item16.RequiredUpgradeItems.Add("moon_gem_mw", 10);
			item16.CraftAmount = 1;
			item16.Snapshot();
			_recipeIsActiveConfig = config("2 - Recipes", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab");
			item16.RecipeIsActive = (ConfigEntryBase)(object)_recipeIsActiveConfig;
			Item item17 = new Item("magicweapons", "magic_dagger_01");
			item17.Name.English("Surtling Core Blade");
			item17.Name.Portuguese_Brazilian("Lâmina de Minério de Surtling");
			item17.Name.Spanish("Hoja de núcleo Surtling");
			item17.Description.English("A long dagger, made of iron and the cores of a surtling.");
			item17.Description.Portuguese_Brazilian("Uma adaga longa feita de ferro e dos minérios de um surtling.");
			item17.Description.Spanish("Una daga larga, hecha de hierro y los núcleos de un surtling.");
			item17.Crafting.Add(CraftingTable.Forge, 3);
			item17.RequiredItems.Add("Iron", 15);
			item17.RequiredItems.Add("SurtlingCore", 2);
			item17.RequiredUpgradeItems.Add("Iron", 20);
			item17.RequiredUpgradeItems.Add("SurtlingCore", 2);
			item17.CraftAmount = 1;
			item17.Snapshot();
			_recipeIsActiveConfig = config("2 - Recipes", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab");
			item17.RecipeIsActive = (ConfigEntryBase)(object)_recipeIsActiveConfig;
			Item item18 = new Item("magicweapons", "magic_spear_1H_01");
			item18.Name.English("Lightning Charged Spear");
			item18.Name.Portuguese_Brazilian("Lança Energizada com Relâmpago");
			item18.Name.Spanish("Lanza cargada de rayos");
			item18.Description.English("A sturdy spear of core wood and iron that has small arcs of blue lightning traveling over it.");
			item18.Description.Portuguese_Brazilian("Uma lança consistente de madeira-de-lei e ferro que gera pequenos arcos de relâmpago na ponta.");
			item18.Description.Spanish("Una robusta lanza de núcleo de madera y hierro que tiene pequeños destellos de relámpagos azules viajando sobre ella.");
			item18.Crafting.Add(CraftingTable.Forge, 3);
			item18.RequiredItems.Add("Iron", 15);
			item18.RequiredItems.Add("RoundLog", 15);
			item18.RequiredItems.Add("lightning_gem_mw", 5);
			item18.RequiredUpgradeItems.Add("Iron", 20);
			item18.RequiredUpgradeItems.Add("RoundLog", 10);
			item18.RequiredUpgradeItems.Add("lightning_gem_mw", 20);
			item18.CraftAmount = 1;
			item18.Snapshot();
			_recipeIsActiveConfig = config("2 - Recipes", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab");
			item18.RecipeIsActive = (ConfigEntryBase)(object)_recipeIsActiveConfig;
			Item item19 = new Item("magicweapons", "magic_green_staff");
			item19.Name.English("Nature's Lament");
			item19.Name.Portuguese_Brazilian("Lamento da Natureza");
			item19.Name.Spanish("Lamento de la naturaleza");
			item19.Description.English("A staff made of core wood with a green crystal mounted at its tip.  The crystal emits a noxious cloud that smells of rotting leaves and strangant water.");
			item19.Description.Portuguese_Brazilian("Um cajado feito de madeira-de-lei com um cristal verde encaixado em sua ponta. O cristal emite uma nuvem nociva que cheira a folhas podres e a água parada.");
			item19.Description.Spanish("Bastón de madera con un cristal verde en la punta.  El cristal emite una nube nociva que huele a hojas podridas y agua extraña.");
			item19.Crafting.Add(CraftingTable.MageTable, 1);
			item19.RequiredItems.Add("YggdrasilWood", 20);
			item19.RequiredItems.Add("Guck", 4);
			item19.RequiredItems.Add("Eitr", 15);
			item19.RequiredUpgradeItems.Add("YggdrasilWood", 15);
			item19.RequiredUpgradeItems.Add("Guck", 2);
			item19.RequiredUpgradeItems.Add("Eitr", 5);
			item19.CraftAmount = 1;
			item19.Snapshot();
			_recipeIsActiveConfig = config("2 - Recipes", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab");
			item19.RecipeIsActive = (ConfigEntryBase)(object)_recipeIsActiveConfig;
			Item item20 = new Item("magicweapons", "magic_lightning_wand");
			item20.Name.English("Ran's Fury");
			item20.Name.Portuguese_Brazilian("Fúria de Ran");
			item20.Name.Spanish("Furia de Ran");
			item20.Description.English("A wand made of Yggdrasil's lower branches.  Cluched by the knarl at the top is an orb that is seemingly a storm condensed into shape.  Small bursts of lightning can be seen within, giving credence to its namesake.");
			item20.Description.Portuguese_Brazilian("Um cajado feito dos ramos inferiores da Yggdrasil. Preso pelo nó da madeira no topo, há um orbe que aparenta ser uma tempestade condensada em forma. Pequenos relâmpagos podem ser vistos dentro dele, dando credibilidade ao seu homônimo.");
			item20.Description.Spanish("Varita hecha de las ramas inferiores de Yggdrasil.  Sujeta por el nudo de la parte superior hay un orbe que parece una tormenta condensada.  Pequeñas ráfagas de relámpagos se pueden ver dentro, dando credibilidad a su homónimo.");
			item20.Crafting.Add(CraftingTable.MageTable, 1);
			item20.RequiredItems.Add("YggdrasilWood", 20);
			item20.RequiredItems.Add("lightning_gem_mw", 10);
			item20.RequiredItems.Add("Eitr", 15);
			item20.RequiredUpgradeItems.Add("YggdrasilWood", 15);
			item20.RequiredUpgradeItems.Add("lightning_gem_mw", 5);
			item20.RequiredUpgradeItems.Add("Eitr", 5);
			item20.CraftAmount = 1;
			item20.Snapshot();
			_recipeIsActiveConfig = config("2 - Recipes", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab");
			item20.RecipeIsActive = (ConfigEntryBase)(object)_recipeIsActiveConfig;
			PrefabManager.RegisterPrefab("magicweapons", "magic_spear_1H_01_projectile");
			PrefabManager.RegisterPrefab("magicweapons", "wand_lightning_projectile");
			PrefabManager.RegisterPrefab("magicweapons", "fx_lighting_flash");
			PrefabManager.RegisterPrefab("magicweapons", "staff_poisonball_projectile");
			PrefabManager.RegisterPrefab("magicweapons", "fx_poison_staff_explosion1");
			PrefabManager.RegisterPrefab("magicweapons", "vfx_waterhit");
			PrefabManager.RegisterPrefab("magicweapons", "vfx_firehit");
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			_harmony.PatchAll(executingAssembly);
			SetupWatcher();
		}

		private void OnDestroy()
		{
			((BaseUnityPlugin)this).Config.Save();
		}

		private void SetupWatcher()
		{
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName);
			fileSystemWatcher.Changed += ReadConfigValues;
			fileSystemWatcher.Created += ReadConfigValues;
			fileSystemWatcher.Renamed += ReadConfigValues;
			fileSystemWatcher.IncludeSubdirectories = true;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			fileSystemWatcher.EnableRaisingEvents = true;
		}

		private void ReadConfigValues(object sender, FileSystemEventArgs e)
		{
			if (!File.Exists(ConfigFileFullPath))
			{
				return;
			}
			try
			{
				MagicWeaponsLogger.LogDebug((object)"ReadConfigValues called");
				((BaseUnityPlugin)this).Config.Reload();
			}
			catch
			{
				MagicWeaponsLogger.LogError((object)("There was an issue loading your " + ConfigFileName));
				MagicWeaponsLogger.LogError((object)"Please check your config entries for spelling and format!");
			}
		}

		private ConfigEntry<T> config<[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)] T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags);
			ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val);
			ConfigSync.AddConfigEntry<T>(val2).SynchronizedConfig = synchronizedSetting;
			return val2;
		}

		private ConfigEntry<T> config<[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)] T>(string group, string name, T value, string description, bool synchronizedSetting = true)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting);
		}

		static MagicWeaponsPlugin()
		{
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName;
			ConnectionError = "";
			MagicWeaponsLogger = Logger.CreateLogSource("MagicWeapons");
			ConfigSync = new ConfigSync("MythikWolf.MagicWeapons")
			{
				DisplayName = "MagicWeapons",
				CurrentVersion = "1.2.1",
				MinimumRequiredVersion = "1.2.1"
			};
			_serverConfigLocked = null;
			_recipeIsActiveConfig = null;
		}
	}
	[HarmonyPatch(typeof(ZNet), "OnNewConnection")]
	public static class RegisterAndCheckVersion
	{
		[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(1)]
		private static void Prefix(ZNetPeer peer, ref ZNet __instance)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			MagicWeaponsPlugin.MagicWeaponsLogger.LogDebug((object)"Registering version RPC handler");
			peer.m_rpc.Register<ZPackage>("MagicWeapons_VersionCheck", (Action<ZRpc, ZPackage>)RpcHandlers.RPC_AllManagersModTemplate_Version);
			MagicWeaponsPlugin.MagicWeaponsLogger.LogDebug((object)"Invoking version check");
			ZPackage val = new ZPackage();
			val.Write("1.2.1");
			val.Write(RpcHandlers.ComputeHashForMod().Replace("-", ""));
			peer.m_rpc.Invoke("MagicWeapons_VersionCheck", new object[1] { val });
		}
	}
	[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(1)]
	[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(0)]
	[HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")]
	public static class VerifyClient
	{
		private static bool Prefix(ZRpc rpc, ZPackage pkg, ref ZNet __instance)
		{
			if (!__instance.IsServer() || RpcHandlers.ValidatedPeers.Contains(rpc))
			{
				return true;
			}
			MagicWeaponsPlugin.MagicWeaponsLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") never sent version or couldn't due to previous disconnect, disconnecting"));
			rpc.Invoke("Error", new object[1] { 3 });
			return false;
		}

		private static void Postfix(ZNet __instance)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "MagicWeaponsRequestAdminSync", new object[1] { (object)new ZPackage() });
		}
	}
	[HarmonyPatch(typeof(FejdStartup), "ShowConnectError")]
	public class ShowConnectionError
	{
		[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(1)]
		private static void Postfix(FejdStartup __instance)
		{
			if (__instance.m_connectionFailedPanel.activeSelf)
			{
				__instance.m_connectionFailedError.fontSizeMax = 25f;
				__instance.m_connectionFailedError.fontSizeMin = 15f;
				TMP_Text connectionFailedError = __instance.m_connectionFailedError;
				connectionFailedError.text = connectionFailedError.text + "\n" + MagicWeaponsPlugin.ConnectionError;
			}
		}
	}
	[HarmonyPatch(typeof(ZNet), "Disconnect")]
	public static class RemoveDisconnectedPeerFromVerified
	{
		[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(1)]
		private static void Prefix(ZNetPeer peer, ref ZNet __instance)
		{
			if (__instance.IsServer())
			{
				MagicWeaponsPlugin.MagicWeaponsLogger.LogInfo((object)("Peer (" + peer.m_rpc.m_socket.GetHostName() + ") disconnected, removing from validated list"));
				RpcHandlers.ValidatedPeers.Remove(peer.m_rpc);
			}
		}
	}
	[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(1)]
	[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(0)]
	public static class RpcHandlers
	{
		public static readonly List<ZRpc> ValidatedPeers = new List<ZRpc>();

		public static void RPC_AllManagersModTemplate_Version(ZRpc rpc, ZPackage pkg)
		{
			string text = pkg.ReadString();
			string text2 = pkg.ReadString();
			string text3 = ComputeHashForMod().Replace("-", "");
			MagicWeaponsPlugin.MagicWeaponsLogger.LogInfo((object)("Version check, local: 1.2.1,  remote: " + text));
			if (text2 != text3 || text != "1.2.1")
			{
				MagicWeaponsPlugin.ConnectionError = "MagicWeapons Installed: 1.2.1 " + text3 + "\n Needed: " + text + " " + text2;
				if (ZNet.instance.IsServer())
				{
					MagicWeaponsPlugin.MagicWeaponsLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") has incompatible version, disconnecting..."));
					rpc.Invoke("Error", new object[1] { 3 });
				}
			}
			else if (!ZNet.instance.IsServer())
			{
				MagicWeaponsPlugin.MagicWeaponsLogger.LogInfo((object)"Received same version from server!");
			}
			else
			{
				MagicWeaponsPlugin.MagicWeaponsLogger.LogInfo((object)("Adding peer (" + rpc.m_socket.GetHostName() + ") to validated list"));
				ValidatedPeers.Add(rpc);
			}
		}

		public static string ComputeHashForMod()
		{
			using SHA256 sHA = SHA256.Create();
			byte[] array = sHA.ComputeHash(File.ReadAllBytes(Assembly.GetExecutingAssembly().Location));
			StringBuilder stringBuilder = new StringBuilder();
			byte[] array2 = array;
			foreach (byte b in array2)
			{
				stringBuilder.Append(b.ToString("X2"));
			}
			return stringBuilder.ToString();
		}
	}
}
namespace ItemManager
{
	[PublicAPI]
	public enum CraftingTable
	{
		Disabled,
		Inventory,
		[InternalName("piece_workbench")]
		Workbench,
		[InternalName("piece_cauldron")]
		Cauldron,
		[InternalName("piece_MeadCauldron")]
		MeadCauldron,
		[InternalName("forge")]
		Forge,
		[InternalName("piece_artisanstation")]
		ArtisanTable,
		[InternalName("piece_stonecutter")]
		StoneCutter,
		[InternalName("piece_magetable")]
		MageTable,
		[InternalName("piece_preptable")]
		PrepTable,
		[InternalName("blackforge")]
		BlackForge,
		Custom
	}
	[PublicAPI]
	public enum ConversionPiece
	{
		Disabled,
		[InternalName("smelter")]
		Smelter,
		[InternalName("charcoal_kiln")]
		CharcoalKiln,
		[InternalName("blastfurnace")]
		BlastFurnace,
		[InternalName("windmill")]
		Windmill,
		[InternalName("piece_spinningwheel")]
		SpinningWheel,
		[InternalName("eitrrefinery")]
		EitrRefinery,
		Custom
	}
	[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(1)]
	[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(0)]
	public class InternalName : Attribute
	{
		public readonly string internalName;

		public InternalName(string internalName)
		{
			this.internalName = internalName;
		}
	}
	[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(0)]
	[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(1)]
	[PublicAPI]
	public class RequiredResourceList
	{
		public readonly List<Requirement> Requirements = new List<Requirement>();

		public bool Free;

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

		public void Add(string itemName, ConfigEntry<int> amountConfig, int quality = 0)
		{
			Requirements.Add(new Requirement
			{
				itemName = itemName,
				amountConfig = amountConfig,
				quality = quality
			});
		}
	}
	[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(0)]
	[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(1)]
	[PublicAPI]
	public 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]
	[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(0)]
	[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(1)]
	public 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;

		public float QualityResultAmountMultiplier = 1f;

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
		public ConfigEntryBase RecipeIsActive;
	}
	[PublicAPI]
	public class Trade
	{
		public Trader Trader;

		public uint Price;

		public uint Stack = 1u;

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
		public string RequiredGlobalKey;
	}
	[Flags]
	[PublicAPI]
	public enum Trader
	{
		None = 0,
		Haldor = 1,
		Hildir = 2
	}
	public struct Requirement
	{
		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(1)]
		public string itemName;

		public int amount;

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
		public ConfigEntry<int> amountConfig;

		[Description("Set to a non-zero value to apply the requirement only for a specific quality")]
		public int quality;
	}
	public struct CraftingStationConfig
	{
		public CraftingTable Table;

		public int level;

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
		public string custom;
	}
	[Flags]
	public enum Configurability
	{
		Disabled = 0,
		Recipe = 1,
		Stats = 2,
		Drop = 4,
		Trader = 8,
		Full = 0xF
	}
	[PublicAPI]
	[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(0)]
	[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(1)]
	public 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.GetValueOrDefault(min),
				levelMultiplier = levelMultiplier
			});
		}
	}
	public struct DropTarget
	{
		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(1)]
		public string creature;

		public int min;

		public int max;

		public float chance;

		public bool levelMultiplier;
	}
	public enum Toggle
	{
		On = 1,
		Off = 0
	}
	[PublicAPI]
	[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(0)]
	[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(1)]
	public class Item
	{
		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(0)]
		private class ItemConfig
		{
			[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(new byte[] { 2, 1 })]
			public ConfigEntry<string> craft;

			[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(new byte[] { 2, 1 })]
			public ConfigEntry<string> upgrade;

			public ConfigEntry<CraftingTable> table;

			public ConfigEntry<int> tableLevel;

			public ConfigEntry<string> customTable;

			[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
			public ConfigEntry<int> maximumTableLevel;

			public ConfigEntry<Toggle> requireOneIngredient;

			public ConfigEntry<float> qualityResultAmountMultiplier;
		}

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(0)]
		private class TraderConfig
		{
			public ConfigEntry<Trader> trader;

			public ConfigEntry<uint> price;

			public ConfigEntry<uint> stack;

			public ConfigEntry<string> requiredGlobalKey;
		}

		[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)]
		private class RequirementQuality
		{
			public int quality;
		}

		[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(2)]
		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(0)]
		private class ConfigurationManagerAttributes
		{
			[UsedImplicitly]
			public int? Order;

			[UsedImplicitly]
			public bool? Browsable;

			[UsedImplicitly]
			public string Category;

			[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(new byte[] { 2, 1 })]
			[UsedImplicitly]
			public Action<ConfigEntryBase> CustomDrawer;

			public Func<bool> browsability;
		}

		[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)]
		[PublicAPI]
		public enum DamageModifier
		{
			Normal,
			Resistant,
			Weak,
			Immune,
			Ignore,
			VeryResistant,
			VeryWeak,
			None
		}

		[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)]
		private delegate void setDmgFunc(ref DamageTypes dmg, float value);

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(0)]
		private class SerializedRequirements
		{
			public readonly List<Requirement> Reqs;

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

			public SerializedRequirements(string reqs)
				: this(reqs.Split(new char[1] { ',' }).Select([<ded5a3ac-7538-435d-aa90-707aff494c11>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);
					result.quality = ((array.Length > 2 && int.TryParse(array[2], out var result3)) ? result3 : 0);
					return result;
				}).ToList())
			{
			}

			public override string ToString()
			{
				return string.Join(",", Reqs.Select([<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (Requirement r) => $"{r.itemName}:{r.amount}" + ((r.quality > 0) ? $":{r.quality}" : "")));
			}

			[return: <fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
			public static ItemDrop fetchByName(ObjectDB objectDB, string name)
			{
				GameObject itemPrefab = objectDB.GetItemPrefab(name);
				ItemDrop obj = ((itemPrefab != null) ? itemPrefab.GetComponent<ItemDrop>() : null);
				if ((Object)(object)obj == (Object)null)
				{
					Debug.LogWarning((object)("The required item '" + name + "' does not exist."));
				}
				return obj;
			}

			public static Requirement[] toPieceReqs(ObjectDB objectDB, SerializedRequirements craft, SerializedRequirements upgrade)
			{
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0178: Unknown result type (might be due to invalid IL or missing references)
				//IL_017d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0185: Unknown result type (might be due to invalid IL or missing references)
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				//IL_018f: Expected O, but got Unknown
				//IL_0194: Expected O, but got Unknown
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0125: Expected O, but got Unknown
				Dictionary<string, Requirement> dictionary = craft.Reqs.Where((Requirement r) => r.itemName != "").ToDictionary((Func<Requirement, string>)([<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (Requirement r) => r.itemName), (Func<Requirement, Requirement>)([<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (Requirement r) =>
				{
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0012: Unknown result type (might be due to invalid IL or missing references)
					//IL_002f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0036: Unknown result type (might be due to invalid IL or missing references)
					//IL_003e: Expected O, but got Unknown
					ItemDrop val6 = ResItem(r);
					return (val6 != null) ? new Requirement
					{
						m_amount = (r.amountConfig?.Value ?? r.amount),
						m_resItem = val6,
						m_amountPerLevel = 0
					} : ((Requirement)null);
				}));
				List<Requirement> list = dictionary.Values.Where([<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (Requirement v) => v != null).ToList();
				foreach (Requirement item in upgrade.Reqs.Where((Requirement r) => r.itemName != ""))
				{
					if (item.quality > 0)
					{
						ItemDrop val = ResItem(item);
						if (val != null)
						{
							Requirement val2 = new Requirement
							{
								m_resItem = val,
								m_amountPerLevel = (item.amountConfig?.Value ?? item.amount),
								m_amount = 0
							};
							list.Add(val2);
							requirementQuality.Add(val2, new RequirementQuality
							{
								quality = item.quality
							});
						}
						continue;
					}
					if (!dictionary.TryGetValue(item.itemName, out var value) || value == null)
					{
						ItemDrop val3 = ResItem(item);
						if (val3 != null)
						{
							string itemName = item.itemName;
							Requirement val4 = new Requirement
							{
								m_resItem = val3,
								m_amount = 0
							};
							Requirement val5 = val4;
							dictionary[itemName] = val4;
							value = val5;
							list.Add(value);
						}
					}
					if (value != null)
					{
						value.m_amountPerLevel = item.amountConfig?.Value ?? item.amount;
					}
				}
				return list.ToArray();
				[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(2)]
				ItemDrop ResItem(Requirement r)
				{
					return fetchByName(objectDB, r.itemName);
				}
			}
		}

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>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([<ded5a3ac-7538-435d-aa90-707aff494c11>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([<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (DropTarget r) => $"{r.creature}:{r.chance.ToString(CultureInfo.InvariantCulture)}:{r.min}:" + ((r.min == r.max) ? "" : $"{r.max}") + (r.levelMultiplier ? "" : ":0")));
			}

			[return: <fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
			private static Character fetchByName(ZNetScene netScene, string name)
			{
				GameObject prefab = netScene.GetPrefab(name);
				Character obj = ((prefab != null) ? prefab.GetComponent<Character>() : null);
				if ((Object)(object)obj == (Object)null)
				{
					Debug.LogWarning((object)("The drop target character '" + name + "' does not exist."));
				}
				return obj;
			}

			public Dictionary<Character, Drop> toCharacterDrops(ZNetScene netScene, GameObject item)
			{
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_006f: 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>>>();

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(new byte[] { 1, 1, 2 })]
		private static Dictionary<Recipe, ConfigEntryBase> hiddenCraftRecipes = new Dictionary<Recipe, ConfigEntryBase>();

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>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>();

		private static readonly ConditionalWeakTable<Requirement, RequirementQuality> requirementQuality = new ConditionalWeakTable<Requirement, RequirementQuality>();

		public static Configurability DefaultConfigurability = Configurability.Full;

		public Configurability? Configurable;

		private Configurability configurationVisible = Configurability.Full;

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
		private TraderConfig traderConfig;

		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();

		[Description("Configures whether the item can be bought at the trader.\nDon't forget to set cost to something above 0 or the item will be sold for free.")]
		public readonly Trade Trade = new Trade();

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

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

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

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
		private LocalizeKey _name;

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
		private LocalizeKey _description;

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
		private static object configManager;

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
		private static Localization _english;

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
		private static BaseUnityPlugin _plugin;

		private static bool hasConfigSync = true;

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>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;

		[Description("Specifies a config entry which toggles whether a recipe is active.")]
		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
		public ConfigEntryBase RecipeIsActive
		{
			[<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(2)]
			get
			{
				return this[""].RecipeIsActive;
			}
			[<ded5a3ac-7538-435d-aa90-707aff494c11>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_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: 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([<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t)));
				}
				return _plugin;
			}
		}

		[<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(2)]
		private static object configSync
		{
			[<ded5a3ac-7538-435d-aa90-707aff494c11>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;
			Prefab.GetComponent<ItemDrop>().m_itemData.m_dropPrefab = Prefab;
		}

		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;
				for (int j = 0; j < tags.Length; j++)
				{
					if (tags[j] is ConfigurationManagerAttributes configurationManagerAttributes)
					{
						configurationManagerAttributes.Browsable = (visible & check) != 0 && (configurationManagerAttributes.browsability == null || configurationManagerAttributes.browsability());
					}
				}
			}
			void ToggleObj(object obj, Configurability check)
			{
				FieldInfo[] fields = obj.GetType().GetFields();
				for (int i = 0; i < fields.Length; i++)
				{
					object? value3 = fields[i].GetValue(obj);
					ConfigEntryBase val = (ConfigEntryBase)((value3 is ConfigEntryBase) ? value3 : null);
					if (val != null)
					{
						Toggle(val, check);
					}
				}
			}
		}

		internal static void reloadConfigDisplay()
		{
			object obj = configManager?.GetType().GetProperty("DisplayingWindow").GetValue(configManager);
			if (obj is bool && (bool)obj)
			{
				configManager.GetType().GetMethod("BuildSettingList").Invoke(configManager, Array.Empty<object>());
			}
		}

		private void UpdateItemTableConfig(string recipeKey, CraftingTable table, string customTableValue)
		{
			if (activeRecipes.ContainsKey(this) && activeRecipes[this].TryGetValue(recipeKey, out var value))
			{
				value.First().m_enabled = table != CraftingTable.Disabled;
				if ((uint)table <= 1u)
				{
					value.First().m_craftingStation = null;
				}
				else if (table == CraftingTable.Custom)
				{
					Recipe obj = value.First();
					GameObject prefab = ZNetScene.instance.GetPrefab(customTableValue);
					obj.m_craftingStation = ((prefab != null) ? prefab.GetComponent<CraftingStation>() : null);
				}
				else
				{
					value.First().m_craftingStation = ZNetScene.instance.GetPrefab(getInternalName(table)).GetComponent<CraftingStation>();
				}
			}
		}

		private void UpdateCraftConfig(string recipeKey, SerializedRequirements craftRequirements, SerializedRequirements upgradeRequirements)
		{
			if (!Object.op_Implicit((Object)(object)ObjectDB.instance) || !activeRecipes.ContainsKey(this) || !activeRecipes[this].TryGetValue(recipeKey, out var value))
			{
				return;
			}
			foreach (Recipe item in value)
			{
				item.m_resources = SerializedRequirements.toPieceReqs(ObjectDB.instance, craftRequirements, upgradeRequirements);
			}
		}

		internal static void Patch_FejdStartup()
		{
			//IL_0e99: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e9e: Unknown result type (might be due to invalid IL or missing references)
			//IL_2164: Unknown result type (might be due to invalid IL or missing references)
			//IL_216e: Expected O, but got Unknown
			//IL_0f62: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f65: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fbb: Expected I4, but got Unknown
			//IL_0b88: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b92: Expected O, but got Unknown
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Expected O, but got Unknown
			//IL_10ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f4: Invalid comparison between Unknown and I4
			//IL_10f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_10fa: Invalid comparison between Unknown and I4
			//IL_0cab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb5: Expected O, but got Unknown
			//IL_0d56: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d60: Expected O, but got Unknown
			//IL_10fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_1100: Invalid comparison between Unknown and I4
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Expected O, but got Unknown
			//IL_0e0a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e14: Expected O, but got Unknown
			//IL_12fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_12fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_1300: Invalid comparison between Unknown and I4
			//IL_1302: Unknown result type (might be due to invalid IL or missing references)
			//IL_1306: Unknown result type (might be due to invalid IL or missing references)
			//IL_1308: Invalid comparison between Unknown and I4
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_0543: Expected O, but got Unknown
			//IL_130a: Unknown result type (might be due to invalid IL or missing references)
			//IL_130e: Invalid comparison between Unknown and I4
			//IL_13e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_13e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_13ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_13ed: Invalid comparison between Unknown and I4
			//IL_13ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_13f3: Invalid comparison between Unknown and I4
			//IL_06f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fa: Expected O, but got Unknown
			//IL_0651: Unknown result type (might be due to invalid IL or missing references)
			//IL_065b: Expected O, but got Unknown
			//IL_1462: Unknown result type (might be due to invalid IL or missing references)
			//IL_1465: Unknown result type (might be due to invalid IL or missing references)
			//IL_1467: Invalid comparison between Unknown and I4
			//IL_07fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0804: Expected O, but got Unknown
			//IL_1469: Unknown result type (might be due to invalid IL or missing references)
			//IL_146d: Unknown result type (might be due to invalid IL or missing references)
			//IL_146f: Invalid comparison between Unknown and I4
			//IL_1471: Unknown result type (might be due to invalid IL or missing references)
			//IL_1475: Invalid comparison between Unknown and I4
			//IL_15b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_15b5: Invalid comparison between Unknown and I4
			//IL_17b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_17b9: Invalid comparison between Unknown and I4
			//IL_1882: Unknown result type (might be due to invalid IL or missing references)
			//IL_1887: Unknown result type (might be due to invalid IL or missing references)
			//IL_1889: Unknown result type (might be due to invalid IL or missing references)
			//IL_188d: Unknown result type (might be due to invalid IL or missing references)
			//IL_188f: Invalid comparison between Unknown and I4
			//IL_18fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_1901: Unknown result type (might be due to invalid IL or missing references)
			//IL_1903: Invalid comparison between Unknown and I4
			//IL_1528: Unknown result type (might be due to invalid IL or missing references)
			//IL_152d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1905: Unknown result type (might be due to invalid IL or missing references)
			//IL_1909: Invalid comparison between Unknown and I4
			//IL_190b: Unknown result type (might be due to invalid IL or missing references)
			//IL_190f: Invalid comparison between Unknown and I4
			//IL_1d7c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d7f: Invalid comparison between Unknown and I4
			Type type = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault([<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (Assembly a) => a.GetName().Name == "ConfigurationManager")?.GetType("ConfigurationManager.ConfigurationManager");
			if (DefaultConfigurability != 0)
			{
				bool saveOnConfigSet = plugin.Config.SaveOnConfigSet;
				plugin.Config.SaveOnConfigSet = false;
				foreach (Item item4 in registeredItems.Where([<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (Item i) => i.configurability != Configurability.Disabled))
				{
					Item item3 = item4;
					string name2 = item3.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_name;
					string englishName = new Regex("[=\\n\\t\\\\\"\\'\\[\\]]*").Replace(english.Localize(name2), "").Trim();
					string localizedName = Localization.instance.Localize(name2).Trim();
					int order = 0;
					if ((item3.configurability & Configurability.Recipe) != 0)
					{
						itemCraftConfigs[item3] = new Dictionary<string, ItemConfig>();
						foreach (string item5 in item3.Recipes.Keys.DefaultIfEmpty(""))
						{
							string configKey = item5;
							string text = ((configKey == "") ? "" : (" (" + configKey + ")"));
							if (!item3.Recipes.ContainsKey(configKey) || item3.Recipes[configKey].Crafting.Stations.Count <= 0)
							{
								continue;
							}
							ItemConfig itemConfig2 = (itemCraftConfigs[item3][configKey] = new ItemConfig());
							ItemConfig cfg = itemConfig2;
							List<ConfigurationManagerAttributes> hideWhenNoneAttributes = new List<ConfigurationManagerAttributes>();
							cfg.table = config(englishName, "Crafting Station" + text, item3.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 = ((item3.configurationVisible & Configurability.Recipe) != 0),
									Category = localizedName
								}
							}));
							ConfigurationManagerAttributes customTableAttributes = new ConfigurationManagerAttributes
							{
								Order = (order -= 1),
								browsability = CustomTableBrowsability,
								Browsable = (CustomTableBrowsability() && (item3.configurationVisible & Configurability.Recipe) != 0),
								Category = localizedName
							};
							cfg.customTable = config(englishName, "Custom Crafting Station" + text, item3.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() && (item3.configurationVisible & Configurability.Recipe) != 0),
								Category = localizedName
							};
							hideWhenNoneAttributes.Add(configurationManagerAttributes);
							cfg.tableLevel = config(englishName, "Crafting Station Level" + text, item3.Recipes[configKey].Crafting.Stations.First().level, new ConfigDescription("Required crafting station level to craft " + englishName + ".", (AcceptableValueBase)null, new object[1] { configurationManagerAttributes }));
							cfg.tableLevel.SettingChanged += [<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (object _, EventArgs _) =>
							{
								if (activeRecipes.ContainsKey(item3) && activeRecipes[item3].TryGetValue(configKey, out var value6))
								{
									value6.First().m_minStationLevel = cfg.tableLevel.Value;
								}
							};
							if (item3.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_maxQuality > 1)
							{
								cfg.maximumTableLevel = config(englishName, "Maximum Crafting Station Level" + text, (item3.MaximumRequiredStationLevel == int.MaxValue) ? (item3.Recipes[configKey].Crafting.Stations.First().level + item3.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_maxQuality - 1) : item3.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, item3.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() && (item3.configurationVisible & Configurability.Recipe) != 0),
								Category = localizedName
							};
							cfg.requireOneIngredient.SettingChanged += [<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (object _, EventArgs _) =>
							{
								if (activeRecipes.ContainsKey(item3) && activeRecipes[item3].TryGetValue(configKey, out var value5))
								{
									foreach (Recipe item6 in value5)
									{
										item6.m_requireOnlyOneIngredient = cfg.requireOneIngredient.Value == Toggle.On;
									}
								}
								qualityResultAttributes.Browsable = QualityResultBrowsability();
								reloadConfigDisplay();
							};
							cfg.qualityResultAmountMultiplier = config(englishName, "Quality Multiplier" + text, item3.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 += [<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (object _, EventArgs _) =>
							{
								if (activeRecipes.ContainsKey(item3) && activeRecipes[item3].TryGetValue(configKey, out var value4))
								{
									foreach (Recipe item7 in value4)
									{
										item7.m_qualityResultAmountMultiplier = cfg.qualityResultAmountMultiplier.Value;
									}
								}
							};
							if ((!item3.Recipes[configKey].RequiredItems.Free || item3.Recipes[configKey].RequiredItems.Requirements.Count > 0) && item3.Recipes[configKey].RequiredItems.Requirements.All((Requirement r) => r.amountConfig == null))
							{
								cfg.craft = itemConfig("Crafting Costs" + text, new SerializedRequirements(item3.Recipes[configKey].RequiredItems.Requirements).ToString(), "Item costs to craft " + englishName, isUpgrade: false);
							}
							if (item3.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_maxQuality > 1 && (!item3.Recipes[configKey].RequiredUpgradeItems.Free || item3.Recipes[configKey].RequiredUpgradeItems.Requirements.Count > 0) && item3.Recipes[configKey].RequiredUpgradeItems.Requirements.All((Requirement r) => r.amountConfig == null))
							{
								cfg.upgrade = itemConfig("Upgrading Costs" + text, new SerializedRequirements(item3.Recipes[configKey].RequiredUpgradeItems.Requirements).ToString(), "Item costs per level to upgrade " + englishName, isUpgrade: true);
							}
							if (cfg.craft != null)
							{
								cfg.craft.SettingChanged += ConfigChanged;
							}
							if (cfg.upgrade != null)
							{
								cfg.upgrade.SettingChanged += ConfigChanged;
							}
							void ConfigChanged(object o, EventArgs e)
							{
								item3.UpdateCraftConfig(configKey, 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)
							{
								item3.UpdateItemTableConfig(configKey, cfg.table.Value, cfg.customTable.Value);
								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, bool isUpgrade)
							{
								//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
								//IL_00b1: Expected O, but got Unknown
								ConfigurationManagerAttributes configurationManagerAttributes3 = new ConfigurationManagerAttributes
								{
									CustomDrawer = drawRequirementsConfigTable(item3, isUpgrade),
									Order = (order -= 1),
									browsability = ItemBrowsability,
									Browsable = (ItemBrowsability() && (item3.configurationVisible & Configurability.Recipe) != 0),
									Category = localizedName
								};
								hideWhenNoneAttributes.Add(configurationManagerAttributes3);
								return config(englishName, name, value, new ConfigDescription(desc, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes3 }));
							}
						}
						if ((item3.configurability & Configurability.Drop) != 0)
						{
							ConfigEntry<string> val3 = (itemDropConfigs[item3] = config(englishName, "Drops from", new SerializedDrop(item3.DropsFrom.Drops).ToString(), new ConfigDescription(englishName + " drops from this creature.", (AcceptableValueBase)null, new object[1]
							{
								new ConfigurationManagerAttributes
								{
									CustomDrawer = drawDropsConfigTable,
									Category = localizedName,
									Browsable = ((item3.configurationVisible & Configurability.Drop) != 0)
								}
							})));
							val3.SettingChanged += [<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (object _, EventArgs _) =>
							{
								item3.UpdateCharacterDrop();
							};
						}
						for (int j = 0; j < item3.Conversions.Count; j++)
						{
							string text2 = ((item3.Conversions.Count > 1) ? $"{j + 1}. " : "");
							Conversion conversion = item3.Conversions[j];
							conversion.config = new Conversion.ConversionConfig();
							int index = j;
							conversion.config.input = config(englishName, text2 + "Conversion Input Item", conversion.Input, new ConfigDescription("Input item to create " + englishName, (AcceptableValueBase)null, new object[1]
							{
								new ConfigurationManagerAttributes
								{
									Category = localizedName,
									Browsable = ((item3.configurationVisible & Configurability.Recipe) != 0)
								}
							}));
							conversion.config.input.SettingChanged += [<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (object _, EventArgs _) =>
							{
								if (index < item3.conversions.Count)
								{
									ObjectDB instance = ObjectDB.instance;
									if (instance != null)
									{
										ItemDrop from = SerializedRequirements.fetchByName(instance, conversion.config.input.Value);
										item3.conversions[index].m_from = from;
										UpdatePiece();
									}
								}
							};
							conversion.config.piece = config(englishName, text2 + "Conversion Piece", conversion.Piece, new ConfigDescription("Conversion piece used to create " + englishName, (AcceptableValueBase)null, new object[1]
							{
								new ConfigurationManagerAttributes
								{
									Category = localizedName,
									Browsable = ((item3.configurationVisible & Configurability.Recipe) != 0)
								}
							}));
							conversion.config.piece.SettingChanged += [<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (object _, EventArgs _) =>
							{
								UpdatePiece();
							};
							conversion.config.customPiece = config(englishName, text2 + "Conversion Custom Piece", conversion.customPiece ?? "", new ConfigDescription("Custom conversion piece to create " + englishName, (AcceptableValueBase)null, new object[1]
							{
								new ConfigurationManagerAttributes
								{
									Category = localizedName,
									Browsable = ((item3.configurationVisible & Configurability.Recipe) != 0)
								}
							}));
							conversion.config.customPiece.SettingChanged += [<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (object _, EventArgs _) =>
							{
								UpdatePiece();
							};
							void UpdatePiece()
							{
								if (index < item3.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)
									{
										int num = ZNetScene.instance.GetPrefab(conversion.config.activePiece).GetComponent<Smelter>().m_conversion.IndexOf(item3.conversions[index]);
										if (num >= 0)
										{
											Smelter[] array3 = Resources.FindObjectsOfTypeAll<Smelter>();
											foreach (Smelter val4 in array3)
											{
												if (Utils.GetPrefabName(((Component)val4).gameObject) == activePiece)
												{
													val4.m_conversion.RemoveAt(num);
												}
											}
										}
										conversion.config.activePiece = null;
									}
									if (item3.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[] array3 = Resources.FindObjectsOfTypeAll<Smelter>();
											foreach (Smelter val5 in array3)
											{
												if (Utils.GetPrefabName(((Component)val5).gameObject) == text3)
												{
													val5.m_conversion.Add(item3.conversions[index]);
												}
											}
										}
									}
								}
							}
						}
					}
					if ((item3.configurability & Configurability.Stats) != 0)
					{
						item3.statsConfigs.Clear();
						SharedData shared2 = item3.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;
						});
						bool flag;
						switch (itemType - 3)
						{
						case 0:
						case 1:
						case 2:
						case 3:
						case 4:
						case 8:
						case 9:
						case 11:
						case 14:
						case 16:
						case 19:
							flag = true;
							break;
						default:
							flag = false;
							break;
						}
						if (flag)
						{
							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 ((itemType - 3 <= 2 || (int)itemType == 14 || (int)itemType == 22) ? true : false)
						{
							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 ((itemType - 6 <= 1 || itemType - 11 <= 1 || (int)itemType == 17) ? true : false)
						{
							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) ? true : false)
						{
							statcfg<int>("Tool tier", "Tool tier of " + englishName + ".", (SharedData shared) => shared.m_toolTier, delegate(SharedData shared, int value)
							{
								shared.m_toolTier = value;
							});
						}
						if ((itemType - 5 <= 2 || itemType - 11 <= 1 || (int)itemType == 17) ? true : false)
						{
							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 value3)) ? DamageModifier.None : value3, delegate(SharedData shared, DamageModifier value)
								{
									//IL_0002: Unknown result type (might be due to invalid IL or missing references)
									//IL_000b: Unknown result type (might be due to invalid IL or missing references)
									//IL_0010: Unknown result type (might be due to invalid IL or missing references)
									//IL_0018: Unknown result type (might be due to invalid IL or missing references)
									//IL_001d: Unknown result type (might be due to invalid IL or missing references)
									//IL_001e: Unknown result type (might be due to invalid IL or missing references)
									//IL_002a: Unknown result type (might be due to invalid IL or missing references)
									//IL_002f: Unknown result type (might be due to invalid IL or missing references)
									//IL_0035: Unknown result type (might be due to invalid IL or missing references)
									//IL_0077: Unknown result type (might be due to invalid IL or missing references)
									//IL_0054: Unknown result type (might be due to invalid IL or missing references)
									DamageModPair val6 = default(DamageModPair);
									val6.m_type = damageType;
									val6.m_modifier = (DamageModifier)value;
									DamageModPair val7 = val6;
									for (int n = 0; n < shared.m_damageModifiers.Count; n++)
									{
										if (shared.m_damageModifiers[n].m_type == damageType)
										{
											if (value == DamageModifier.None)
											{
												shared.m_damageModifiers.RemoveAt(n);
											}
											else
											{
												shared.m_damageModifiers[n] = val7;
											}
											return;
										}
									}
									if (value != DamageModifier.None)
									{
										shared.m_damageModifiers.Add(val7);
									}
								});
							}
						}
						if ((int)itemType == 2 && shared2.m_food > 0f)
						{
							statcfg<float>("Health", "Health value of " + englishName + ".", (SharedData shared) => shared.m_food, delegate(SharedData shared, float value)
							{
								shared.m_food = value;
							});
							statcfg<float>("Stamina", "Stamina value of " + englishName + ".", (SharedData shared) => shared.m_foodStamina, delegate(SharedData shared, float value)
							{
								shared.m_foodStamina = value;
							});
							statcfg<float>("Eitr", "Eitr value of " + englishName + ".", (SharedData shared) => shared.m_foodEitr, delegate(SharedData shared, float value)
							{
								shared.m_foodEitr = value;
							});
							statcfg<float>("Duration", "Duration of " + englishName + ".", (SharedData shared) => shared.m_foodBurnTime, delegate(SharedData shared, float value)
							{
								shared.m_foodBurnTime = value;
							});
							statcfg<float>("Health Regen", "Health regen value of " + englishName + ".", (SharedData shared) => shared.m_foodRegen, delegate(SharedData shared, float value)
							{
								shared.m_foodRegen = value;
							});
						}
						if ((int)shared2.m_skillType == 10)
						{
							statcfg<float>("Health Cost", "Health cost of " + englishName + ".", (SharedData shared) => shared.m_attack.m_attackHealth, delegate(SharedData shared, float value)
							{
								shared.m_attack.m_attackHealth = value;
							});
							statcfg<float>("Health Cost Percentage", "Health cost percentage of " + englishName + ".", (SharedData shared) => shared.m_attack.m_attackHealthPercentage, delegate(SharedData shared, float value)
							{
								shared.m_attack.m_attackHealthPercentage = value;
							});
						}
						skillType = shared2.m_skillType;
						if (skillType - 9 <= 1)
						{
							statcfg<float>("Eitr Cost", "Eitr cost of " + englishName + ".", (SharedData shared) => shared.m_attack.m_attackEitr, delegate(SharedData shared, float value)
							{
								shared.m_attack.m_attackEitr = value;
							});
						}
						if ((itemType - 3 <= 1 || (int)itemType == 14 || (int)itemType == 22) ? true : false)
						{
							statcfg<float>("Knockback", "Knockback of " + englishName + ".", (SharedData shared) => shared.m_attackForce, delegate(SharedData shared, float value)
							{
								shared.m_attackForce = value;
							});
							statcfg<float>("Backstab Bonus", "Backstab bonus of " + englishName + ".", (SharedData shared) => shared.m_backstabBonus, delegate(SharedData shared, float value)
							{
								shared.m_backstabBonus = value;
							});
							statcfg<float>("Attack Stamina", "Attack stamina of " + englishName + ".", (SharedData shared) => shared.m_attack.m_attackStamina, delegate(SharedData shared, float value)
							{
								shared.m_attack.m_attackStamina = value;
							});
							SetDmg("True", (DamageTypes dmg) => dmg.m_damage, delegate(ref DamageTypes dmg, float val)
							{
								dmg.m_damage = val;
							});
							SetDmg("Slash", (DamageTypes dmg) => dmg.m_slash, delegate(ref DamageTypes dmg, float val)
							{
								dmg.m_slash = val;
							});
							SetDmg("Pierce", (DamageTypes dmg) => dmg.m_pierce, delegate(ref DamageTypes dmg, float val)
							{
								dmg.m_pierce = val;
							});
							SetDmg("Blunt", (DamageTypes dmg) => dmg.m_blunt, delegate(ref DamageTypes dmg, float val)
							{
								dmg.m_blunt = val;
							});
							SetDmg("Chop", (DamageTypes dmg) => dmg.m_chop, delegate(ref DamageTypes dmg, float val)
							{
								dmg.m_chop = val;
							});
							SetDmg("Pickaxe", (DamageTypes dmg) => dmg.m_pickaxe, delegate(ref DamageTypes dmg, float val)
							{
								dmg.m_pickaxe = val;
							});
							SetDmg("Fire", (DamageTypes dmg) => dmg.m_fire, delegate(ref DamageTypes dmg, float val)
							{
								dmg.m_fire = val;
							});
							SetDmg("Poison", (DamageTypes dmg) => dmg.m_poison, delegate(ref DamageTypes dmg, float val)
							{
								dmg.m_poison = val;
							});
							SetDmg("Frost", (DamageTypes dmg) => dmg.m_frost, delegate(ref DamageTypes dmg, float val)
							{
								dmg.m_frost = val;
							});
							SetDmg("Lightning", (DamageTypes dmg) => dmg.m_lightning, delegate(ref DamageTypes dmg, float val)
							{
								dmg.m_lightning = val;
							});
							SetDmg("Spirit", (DamageTypes dmg) => dmg.m_spirit, delegate(ref DamageTypes dmg, float val)
							{
								dmg.m_spirit = val;
							});
							if ((int)itemType == 4)
							{
								statcfg<int>("Projectiles", "Number of projectiles that " + englishName + " shoots at once.", (SharedData shared) => shared.m_attack.m_projectileBursts, delegate(SharedData shared, int value)
								{
									shared.m_attack.m_projectileBursts = value;
								});
								statcfg<float>("Burst Interval", "Time between the projectiles " + englishName + " shoots at once.", (SharedData shared) => shared.m_attack.m_burstInterval, delegate(SharedData shared, float value)
								{
									shared.m_attack.m_burstInterval = value;
								});
								statcfg<float>("Minimum Accuracy", "Minimum accuracy for " + englishName + ".", (SharedData shared) => shared.m_attack.m_projectileAccuracyMin, delegate(SharedData shared, float value)
								{
									shared.m_attack.m_projectileAccuracyMin = value;
								});
								statcfg<float>("Accuracy", "Accuracy for " + englishName + ".", (SharedData shared) => shared.m_attack.m_projectileAccuracy, delegate(SharedData shared, float value)
								{
									shared.m_attack.m_projectileAccuracy = value;
								});
								statcfg<float>("Minimum Velocity", "Minimum velocity for " + englishName + ".", (SharedData shared) => shared.m_attack.m_projectileVelMin, delegate(SharedData shared, float value)
								{
									shared.m_attack.m_projectileVelMin = value;
								});
								statcfg<float>("Velocity", "Velocity for " + englishName + ".", (SharedData shared) => shared.m_attack.m_projectileVel, delegate(SharedData shared, float value)
								{
									shared.m_attack.m_projectileVel = value;
								});
								statcfg<float>("Maximum Draw Time", "Time until " + englishName + " is fully drawn at skill level 0.", (SharedData shared) => shared.m_attack.m_drawDurationMin, delegate(SharedData shared, float value)
								{
									shared.m_attack.m_drawDurationMin = value;
								});
								statcfg<float>("Stamina Drain", "Stamina drain per second while drawing " + englishName + ".", (SharedData shared) => shared.m_attack.m_drawStaminaDrain, delegate(SharedData shared, float value)
								{
									shared.m_attack.m_drawStaminaDrain = value;
								});
							}
						}
					}
					List<ConfigurationManagerAttributes> traderAttributes;
					if ((item3.configurability & Configurability.Trader) != 0)
					{
						traderAttributes = new List<ConfigurationManagerAttributes>();
						item3.traderConfig = new TraderConfig
						{
							trader = config(englishName, "Trader Selling", item3.Trade.Trader, new ConfigDescription("Which traders sell " + englishName + ".", (AcceptableValueBase)null, new object[1]
							{
								new ConfigurationManagerAttributes
								{
									Order = (order -= 1),
									Browsable = ((item3.configurationVisible & Configurability.Trader) != 0),
									Category = localizedName
								}
							}))
						};
						item3.traderConfig.trader.SettingChanged += [<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (object _, EventArgs _) =>
						{
							item3.ReloadTraderConfiguration();
							foreach (ConfigurationManagerAttributes item10 in traderAttributes)
							{
								item10.Browsable = TraderBrowsability();
							}
							reloadConfigDisplay();
						};
						item3.traderConfig.price = traderConfig<uint>("Trader Price", item3.Trade.Price, "Price of " + englishName + " at the trader.");
						item3.traderConfig.stack = traderConfig<uint>("Trader Stack", item3.Trade.Stack, "Stack size of " + englishName + " in the trader. Also known as the number of items sold by a trader in one transaction.");
						item3.traderConfig.requiredGlobalKey = traderConfig<string>("Trader Required Global Key", item3.Trade.RequiredGlobalKey ?? "", "Required global key to unlock " + englishName + " at the trader.");
						if (item3.traderConfig.trader.Value != 0)
						{
							PrefabManager.AddItemToTrader(item3.Prefab, item3.traderConfig.trader.Value, item3.traderConfig.price.Value, item3.traderConfig.stack.Value, item3.traderConfig.requiredGlobalKey.Value);
						}
					}
					else if (item3.Trade.Trader != 0)
					{
						PrefabManager.AddItemToTrader(item3.Prefab, item3.Trade.Trader, item3.Trade.Price, item3.Trade.Stack, item3.Trade.RequiredGlobalKey);
					}
					void SetDmg(string dmgType, Func<DamageTypes, float> readDmg, setDmgFunc setDmg)
					{
						statcfg<float>(dmgType + " Damage", dmgType + " damage dealt by " + englishName + ".", (SharedData shared) => readDmg(shared.m_damages), delegate(SharedData shared, float val)
						{
							setDmg(ref shared.m_damages, val);
						});
						statcfg<float>(dmgType + " Damage Per Level", dmgType + " damage dealt increase per level for " + englishName + ".", (SharedData shared) => readDmg(shared.m_damagesPerLevel), delegate(SharedData shared, float val)
						{
							setDmg(ref shared.m_damagesPerLevel, val);
						});
					}
					bool TraderBrowsability()
					{
						return item3.traderConfig.trader.Value != Trader.None;
					}
					void statcfg<T>(string configName, string description, [<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(new byte[] { 1, 1, 0 })] Func<SharedData, T> readDefault, [<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(new byte[] { 1, 1, 0 })] Action<SharedData, T> setValue)
					{
						//IL_0078: Unknown result type (might be due to invalid IL or missing references)
						//IL_0082: Expected O, but got Unknown
						SharedData shared3 = item3.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared;
						ConfigEntry<T> cfg2 = config(englishName, configName, readDefault(shared3), new ConfigDescription(description, (AcceptableValueBase)null, new object[1]
						{
							new ConfigurationManagerAttributes
							{
								Category = localizedName,
								Browsable = ((item3.configurationVisible & Configurability.Stats) != 0)
							}
						}));
						if ((item3.configurationVisible & Configurability.Stats) != 0)
						{
							setValue(shared3, cfg2.Value);
						}
						item3.statsConfigs.Add((ConfigEntryBase)(object)cfg2, ApplyConfig);
						cfg2.SettingChanged += [<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (object _, EventArgs _) =>
						{
							if ((item3.configurationVisible & Configurability.Stats) != 0)
							{
								ApplyConfig();
							}
						};
						void ApplyConfig()
						{
							item3.ApplyToAllInstances(delegate(ItemData item)
							{
								setValue(item.m_shared, cfg2.Value);
							});
						}
					}
					[return: <fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(new byte[] { 1, 0 })]
					ConfigEntry<T> traderConfig<T>(string name, [<fa0099e5-e682-4467-b0e1-eb34a02f7b11>Nullable(0)] T value, string desc)
					{
						//IL_0099: Unknown result type (might be due to invalid IL or missing references)
						//IL_00a3: Expected O, but got Unknown
						ConfigurationManagerAttributes configurationManagerAttributes2 = new ConfigurationManagerAttributes
						{
							Order = (order -= 1),
							browsability = TraderBrowsability,
							Browsable = (TraderBrowsability() && (item3.configurationVisible & Configurability.Trader) != 0),
							Category = localizedName
						};
						traderAttributes.Add(configurationManagerAttributes2);
						ConfigEntry<T> obj = config(englishName, name, value, new ConfigDescription(desc, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes2 }));
						obj.SettingChanged += [<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (object _, EventArgs _) =>
						{
							item3.ReloadTraderConfiguration();
						};
						return obj;
					}
				}
				if (saveOnConfigSet)
				{
					plugin.Config.SaveOnConfigSet = true;
					plugin.Config.Save();
				}
			}
			configManager = ((type == null) ? null : Chainloader.ManagerObject.GetComponent(type));
			foreach (Item registeredItem in registeredItems)
			{
				Item item2 = registeredItem;
				foreach (KeyValuePair<string, ItemRecipe> recipe in item2.Recipes)
				{
					KeyValuePair<string, ItemRecipe> kv = recipe;
					RequiredResourceList[] array2 = new RequiredResourceList[2]
					{
						kv.Value.RequiredItems,
						kv.Value.RequiredUpgradeItems
					};
					foreach (RequiredResourceList requiredResourceList in array2)
					{
						for (int l = 0; l < requiredResourceList.Requirements.Count; l++)
						{
							ConfigEntry<int> amountCfg;
							int resourceIndex;
							if ((item2.configurability & Configurability.Recipe) != 0)
							{
								amountCfg = requiredResourceList.Requirements[l].amountConfig;
								if (amountCfg != null)
								{
									resourceIndex = l;
									amountCfg.SettingChanged += ConfigChanged;
								}
							}
							void ConfigChanged(object o, EventArgs e)
							{
								if (Object.op_Implicit((Object)(object)ObjectDB.instance) && activeRecipes.ContainsKey(item2) && activeRecipes[item2].TryGetValue(kv.Key, out var value2))
								{
									foreach (Recipe item11 in value2)
									{
										item11.m_resources[resourceIndex].m_amount = amountCfg.Value;
									}
								}
							}
						}
					}
				}
				item2.InitializeNewRegisteredItem();
			}
		}

		private void InitializeNewRegisteredItem()
		{
			foreach (KeyValuePair<string, ItemRecipe> recipe in Recipes)
			{
				KeyValuePair<string, ItemRecipe> kv = recipe;
				ConfigEntryBase enabledCfg = kv.Value.RecipeIsActive;
				if (enabledCfg != null)
				{
					((object)enabledCfg).GetType().GetEvent("SettingChanged").AddEventHandler(enabledCfg, new EventHandler(ConfigChanged));
				}
				void ConfigChanged(object o, EventArgs e)
				{
					if (Object.op_Implicit((Object)(object)ObjectDB.instance) && activeRecipes.ContainsKey(this) && activeRecipes[this].TryGetValue(kv.Key, out var value))
					{
						foreach (Recipe item in value)
						{
							item.m_enabled = (int)enabledCfg.BoxedValue != 0;
						}
					}
				}
			}
		}

		public void ReloadCraftingConfiguration()
		{
			if (Object.op_Implicit((Object)(object)ObjectDB.instance) && ObjectDB.instance.GetItemPrefab(StringExtensionMethods.GetStableHashCode(((Object)Prefab).name)) == null)
			{
				registerRecipesInObjectDB(ObjectDB.instance);
				ObjectDB.instance.m_items.Add(Prefab);
				ObjectDB.instance.m_itemByHash.Add(StringExtensionMethods.GetStableHashCode(((Object)Prefab).name), Prefab);
				ZNetScene.instance.m_prefabs.Add(Prefab);
				ZNetScene.instance.m_namedPrefabs.Add(StringExtensionMethods.GetStableHashCode(((Object)Prefab).name), Prefab);
			}
			foreach (string item in Recipes.Keys.DefaultIfEmpty(""))
			{
				if (Recipes.TryGetValue(item, out var value) && value.Crafting.Stations.Count > 0)
				{
					UpdateItemTableConfig(item, value.Crafting.Stations.First().Table, value.Crafting.Stations.First().custom ?? "");
					UpdateCraftConfig(item, new SerializedRequirements(value.RequiredItems.Requirements), new SerializedRequirements(value.RequiredUpgradeItems.Requirements));
				}
			}
		}

		private void ReloadTraderConfiguration()
		{
			if (traderConfig.trader.Value == Trader.None)
			{
				PrefabManager.RemoveItemFromTrader(Prefab);
			}
			else
			{
				PrefabManager.AddItemToTrader(Prefab, traderConfig.trader.Value, traderConfig.price.Value, traderConfig.stack.Value, traderConfig.requiredGlobalKey.Value);
			}
		}

		public static void ApplyToAllInstances(GameObject prefab, Action<ItemData> callback)
		{
			callback(prefab.GetComponent<ItemDrop>().m_itemData);
			string name = prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_name;
			Inventory[] source = (from c in Player.s_players.Select([<ded5a3ac-7538-435d-aa90-707aff494c11>NullableContext(0)] (Player p) => ((Humanoid)p).GetInventory()).Concat(from c in Object.FindObjectsOfType<Container>()
					select c.GetInventory())
				where c != null
				select c).ToArray();
			foreach (ItemData item in (from i in (from p in ObjectDB.instance.m_items
					select p.GetComponent<ItemDrop>() into c
					where Object.op_Implicit((Objec