Decompiled source of CookingAdditions v1.2.9

CookingAdditions.dll

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

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("blacks7ar")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.9")]
[assembly: AssemblyInformationalVersion("1.2.9")]
[assembly: AssemblyProduct("CookingAdditions")]
[assembly: AssemblyTitle("CookingAdditions")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.9.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CookingAdditions
{
	[BepInPlugin("blacks7ar.CookingAdditions", "CookingAdditions", "1.2.9")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "blacks7ar.CookingAdditions";

		public const string modName = "CookingAdditions";

		public const string modAuthor = "blacks7ar";

		public const string modVersion = "1.2.9";

		public const string modLink = "https://valheim.thunderstore.io/package/blacks7ar/CookingAdditions/";

		private static readonly Harmony _harmony = new Harmony("blacks7ar.CookingAdditions");

		private static readonly ConfigSync _configSync = new ConfigSync("blacks7ar.CookingAdditions")
		{
			DisplayName = "CookingAdditions",
			CurrentVersion = "1.2.9",
			MinimumRequiredVersion = "1.2.9",
			ModRequired = true
		};

		private static ConfigEntry<CookingAdditions.Functions.Toggle> _serverConfigLocked;

		public static ConfigEntry<CookingAdditions.Functions.Toggle> _enableSmoke;

		public static Plugin _instance;

		public static Localization english;

		public ConfigEntry<T> config<T>(string group, string name, T value, ConfigDescription description, bool synchronizedConfig = 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 + (synchronizedConfig ? " [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 = synchronizedConfig;
			return val2;
		}

		public void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			_instance = this;
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
			Localizer.Load();
			english = new Localization();
			english.SetupLanguage("English");
			_serverConfigLocked = config("1- ServerSync", "Lock Configuration", CookingAdditions.Functions.Toggle.On, new ConfigDescription("If On, the configuration is locked and can be changed by server admins only.", (AcceptableValueBase)null, Array.Empty<object>()));
			_configSync.AddLockingConfigEntry<CookingAdditions.Functions.Toggle>(_serverConfigLocked);
			_enableSmoke = config("2- General", "Smoke", CookingAdditions.Functions.Toggle.On, new ConfigDescription("Enable/Disables smokes from grillers.\nNeeds Logout to take effect.", (AcceptableValueBase)null, Array.Empty<object>()));
			ConfigSetup.Init();
			CookingAdditions.Functions.PrefabManager.Init();
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			_harmony.PatchAll(executingAssembly);
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
			((BaseUnityPlugin)this).Config.Save();
		}

		private void OnDestroy()
		{
			((BaseUnityPlugin)this).Config.Save();
		}
	}
}
namespace CookingAdditions.Patches
{
	[HarmonyPatch]
	public static class ObjectDBPatch
	{
		[HarmonyPriority(700)]
		[HarmonyPostfix]
		[HarmonyPatch(typeof(ObjectDB), "Awake")]
		public static void Awake_Postfix(ObjectDB __instance)
		{
			RegisterToFeaster(__instance);
		}

		private static void AddToFeaster(this ObjectDB __instance, GameObject gameObject, bool overWrite = true)
		{
			PieceTable buildPieces = __instance.GetItemPrefab("Feaster").GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces;
			if (buildPieces.m_pieces.Contains(gameObject))
			{
				if (!overWrite)
				{
					return;
				}
				buildPieces.m_pieces.Remove(gameObject);
			}
			buildPieces.m_pieces.Add(gameObject);
		}

		private static bool ObjectDBAwake()
		{
			if ((Object)(object)ObjectDB.instance != (Object)null && ObjectDB.instance.m_items.Count != 0)
			{
				return (Object)(object)ObjectDB.instance.GetItemPrefab("Wood") != (Object)null;
			}
			return false;
		}

		private static void RegisterToFeaster(ObjectDB __instance)
		{
			if (ObjectDBAwake())
			{
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_BoiledEgg"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_ChickenSoup"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_ChiliPepper"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_FishSoup"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_MeatSoup"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_Salted_AsksvinEgg"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_Salted_AsksvinMeat"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_Salted_BoarMeat"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_Salted_BugMeat"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_Salted_ChickenEgg"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_Salted_ChickenMeat"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_Salted_DeerMeat"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_Salted_Fish"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_Salted_HareMeat"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_Salted_VoltureEgg"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_Salted_WolfMeat"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_SpicyMeatPlatter"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_SpicyMeatSupreme"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_SpicySerpentMeat"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_SweetNSpicyFish"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_Tomato"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_TomatoSoup"));
				__instance.AddToFeaster(CookingAdditions.Functions.PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_VeggieSoup"));
			}
		}
	}
	[HarmonyPatch(typeof(Pickable), "Awake")]
	public class PickablePatch
	{
		private static void Postfix(Pickable __instance)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			if (!((Object)(object)__instance == (Object)null) && __instance.m_nview.IsValid() && __instance.m_nview.IsOwner())
			{
				if (((Object)((Component)__instance).gameObject).name.ToLower().Contains("chilipepperplant"))
				{
					__instance.m_respawnTimeMinutes = ConfigSetup._chiliRegrowTime.Value;
					__instance.m_bonusEffect.m_effectPrefabs = (EffectData[])(object)new EffectData[1]
					{
						new EffectData
						{
							m_prefab = ZNetScene.instance.GetPrefab("fx_BonusYield"),
							m_enabled = true,
							m_variant = -1
						}
					};
				}
				if (((Object)((Component)__instance).gameObject).name.ToLower().Contains("tomatoplant"))
				{
					__instance.m_respawnTimeMinutes = ConfigSetup._tomatoRegrowTime.Value;
					__instance.m_bonusEffect.m_effectPrefabs = (EffectData[])(object)new EffectData[1]
					{
						new EffectData
						{
							m_prefab = ZNetScene.instance.GetPrefab("fx_BonusYield"),
							m_enabled = true,
							m_variant = -1
						}
					};
				}
			}
		}
	}
	[HarmonyPatch(typeof(Plant), "Awake")]
	public class PlantPatches
	{
		private static void Postfix(Plant __instance)
		{
			if (!((Object)(object)__instance == (Object)null) && __instance.m_nview.IsValid() && __instance.m_nview.IsOwner())
			{
				if (__instance.m_name.Contains("chilipepper_sapling"))
				{
					__instance.m_growTime = ConfigSetup._chiliSaplingGrowTime.Value;
					__instance.m_growTimeMax = ConfigSetup._chiliSaplingGrowTimeMax.Value;
				}
				if (__instance.m_name.Contains("tomato_sapling"))
				{
					__instance.m_growTime = ConfigSetup._tomatoSaplingGrowTime.Value;
					__instance.m_growTimeMax = ConfigSetup._tomatoSaplingGrowTimeMax.Value;
				}
			}
		}
	}
	[HarmonyPatch(typeof(ZNetScene), "Awake")]
	public class ZNetScenePatch
	{
		public static void Postfix(ZNetScene __instance)
		{
			PieceSetup.Init();
		}
	}
	[HarmonyPatch(typeof(ZoneSystem), "ValidateVegetation")]
	public class ZoneSystemPatch
	{
		public static void Postfix(ZoneSystem __instance)
		{
			VegetationSetup.Init(__instance);
		}
	}
}
namespace CookingAdditions.Functions
{
	public static class ConfigSetup
	{
		public static ConfigEntry<int> _boiledEggCraftAmount;

		public static ConfigEntry<Toggle> _enableWildTomato;

		public static ConfigEntry<Biome> _wildTomatoBiome;

		public static ConfigEntry<BiomeArea> _wildTomatoBiomeArea;

		public static ConfigEntry<float> _wildTomatoGroupRadius;

		public static ConfigEntry<int> _wildTomatoGroupSizeMin;

		public static ConfigEntry<int> _wildTomatoGroupSizeMax;

		public static ConfigEntry<int> _wildTomatoMax;

		public static ConfigEntry<Toggle> _enableWildChili;

		public static ConfigEntry<Biome> _wildChiliBiome;

		public static ConfigEntry<BiomeArea> _wildChiliBiomeArea;

		public static ConfigEntry<float> _wildChiliGroupRadius;

		public static ConfigEntry<int> _wildChiliGroupSizeMin;

		public static ConfigEntry<int> _wildChiliGroupSizeMax;

		public static ConfigEntry<int> _wildChiliMax;

		public static ConfigEntry<float> _tomatoSaplingGrowTime;

		public static ConfigEntry<float> _tomatoSaplingGrowTimeMax;

		public static ConfigEntry<int> _tomatoRegrowTime;

		public static ConfigEntry<float> _chiliSaplingGrowTime;

		public static ConfigEntry<float> _chiliSaplingGrowTimeMax;

		public static ConfigEntry<int> _chiliRegrowTime;

		public static ConfigEntry<Biome> _saltDepositBiome;

		public static ConfigEntry<BiomeArea> _saltDepositBiomeArea;

		public static ConfigEntry<int> _saltDepositMin;

		public static ConfigEntry<int> _saltDepositMax;

		public static ConfigEntry<Toggle> _saltDepositEnable;

		public static void Init()
		{
			BoiledEgg();
			WildTomato();
			WildChili();
			TomatoSapling();
			ChiliSapling();
			SaltDeposit();
		}

		private static void SaltDeposit()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			_saltDepositEnable = Plugin._instance.config("3- Salt Deposit", "Enable", Toggle.On, new ConfigDescription("Enable/Disables spawning of salt deposits.", (AcceptableValueBase)null, Array.Empty<object>()));
			_saltDepositBiome = Plugin._instance.config<Biome>("3- Salt Deposit", "Biome", (Biome)895, new ConfigDescription("Biome to spawn salt deposits.", (AcceptableValueBase)null, Array.Empty<object>()));
			_saltDepositBiomeArea = Plugin._instance.config<BiomeArea>("3- Salt Deposit", "Biome Area", (BiomeArea)1, new ConfigDescription("Area to spawn salt deposits.", (AcceptableValueBase)null, Array.Empty<object>()));
			_saltDepositMin = Plugin._instance.config("3- Salt Deposit", "Min", 8, new ConfigDescription("Minimum amount of salt deposit to spawn in a zone.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>()));
			_saltDepositMax = Plugin._instance.config("3- Salt Deposit", "Max", 10, new ConfigDescription("Maximum amount of salt deposit to spawn in a zone.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>()));
		}

		private static void WildTomato()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			string group = Plugin.english.Localize("$bca_wild_tomato");
			_enableWildTomato = Plugin._instance.config(group, "Enable", Toggle.On, new ConfigDescription("Enable/Disables spawning of wild tomato's.", (AcceptableValueBase)null, Array.Empty<object>()));
			_wildTomatoBiome = Plugin._instance.config<Biome>(group, "Biome", (Biome)25, new ConfigDescription("Biome to spawn wild tomato's.", (AcceptableValueBase)null, Array.Empty<object>()));
			_wildTomatoBiomeArea = Plugin._instance.config<BiomeArea>(group, "Biome Area", (BiomeArea)1, new ConfigDescription("Area to spawn wild tomato's.", (AcceptableValueBase)null, Array.Empty<object>()));
			_wildTomatoGroupRadius = Plugin._instance.config(group, "Group Radius", 32f, new ConfigDescription("How far does wild tomato spawn to each other.", (AcceptableValueBase)null, Array.Empty<object>()));
			_wildTomatoGroupSizeMin = Plugin._instance.config(group, "Group Size Min", 1, new ConfigDescription("Minimum group size to spawn.", (AcceptableValueBase)null, Array.Empty<object>()));
			_wildTomatoGroupSizeMax = Plugin._instance.config(group, "Group Size Max", 3, new ConfigDescription("Maximum group size to spawn.", (AcceptableValueBase)null, Array.Empty<object>()));
			_wildTomatoMax = Plugin._instance.config(group, "Max", 2, new ConfigDescription("Maximum amount of wild tomato's to spawn in a zone.", (AcceptableValueBase)null, Array.Empty<object>()));
		}

		private static void WildChili()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			string group = Plugin.english.Localize("$bca_wild_chilipepper");
			_enableWildChili = Plugin._instance.config(group, "Enable", Toggle.On, new ConfigDescription("Enable/Disables spawning of wild tomato's.", (AcceptableValueBase)null, Array.Empty<object>()));
			_wildChiliBiome = Plugin._instance.config<Biome>(group, "Biome", (Biome)25, new ConfigDescription("Biome to spawn wild tomato's.", (AcceptableValueBase)null, Array.Empty<object>()));
			_wildChiliBiomeArea = Plugin._instance.config<BiomeArea>(group, "Biome Area", (BiomeArea)2, new ConfigDescription("Area to spawn wild tomato's.", (AcceptableValueBase)null, Array.Empty<object>()));
			_wildChiliGroupRadius = Plugin._instance.config(group, "Group Radius", 32f, new ConfigDescription("How far does wild tomato spawn to each other.", (AcceptableValueBase)null, Array.Empty<object>()));
			_wildChiliGroupSizeMin = Plugin._instance.config(group, "Group Size Min", 1, new ConfigDescription("Minimum group size to spawn.", (AcceptableValueBase)null, Array.Empty<object>()));
			_wildChiliGroupSizeMax = Plugin._instance.config(group, "Group Size Max", 3, new ConfigDescription("Maximum group size to spawn.", (AcceptableValueBase)null, Array.Empty<object>()));
			_wildChiliMax = Plugin._instance.config(group, "Max", 2, new ConfigDescription("Maximum amount of wild tomato's to spawn in a zone.", (AcceptableValueBase)null, Array.Empty<object>()));
		}

		private static void TomatoSapling()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			string group = Plugin.english.Localize("$bca_tomato_sapling");
			_tomatoSaplingGrowTime = Plugin._instance.config(group, "Grow Time", 5000f, new ConfigDescription("How long does it take to grow in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 6000f), Array.Empty<object>()));
			_tomatoSaplingGrowTimeMax = Plugin._instance.config(group, "Grow Time Max", 6000f, new ConfigDescription("Maximum grow time in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 6000f), Array.Empty<object>()));
			_tomatoRegrowTime = Plugin._instance.config(group, "Regrow Time", 120, new ConfigDescription("Regrow time in minutes.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 600), Array.Empty<object>()));
		}

		private static void ChiliSapling()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			string group = Plugin.english.Localize("$bca_chilipepper_sapling");
			_chiliSaplingGrowTime = Plugin._instance.config(group, "Grow Time", 5000f, new ConfigDescription("How long does it take to grow in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 6000f), Array.Empty<object>()));
			_chiliSaplingGrowTimeMax = Plugin._instance.config(group, "Grow Time Max", 6000f, new ConfigDescription("Maximum grow time in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 6000f), Array.Empty<object>()));
			_chiliRegrowTime = Plugin._instance.config(group, "Regrow Time", 120, new ConfigDescription("Regrow time in minutes.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 600), Array.Empty<object>()));
		}

		private static void BoiledEgg()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			string group = Plugin.english.Localize("$bca_boiledegg");
			_boiledEggCraftAmount = Plugin._instance.config(group, "Craft Amount", 5, new ConfigDescription("Craft amount (Needs Logout to take effect.)", (AcceptableValueBase)null, Array.Empty<object>()));
		}
	}
	public class DryingStation : MonoBehaviour, Interactable, Hoverable, IHasHoverMenuExtended
	{
		[Serializable]
		public class ItemConversion
		{
			public ItemDrop m_from;

			public ItemDrop m_to;

			public float m_dryingTime = 1800f;
		}

		private enum Status
		{
			NotDone,
			Done
		}

		public Switch m_addFoodSwitch;

		public EffectList m_addEffect = new EffectList();

		public EffectList m_doneEffect = new EffectList();

		public EffectList m_pickEffector = new EffectList();

		public string m_addItemTooltip = "$bca_additem_tooltip";

		public float m_spawnForce = 5f;

		public List<ItemConversion> m_conversions = new List<ItemConversion>();

		public Transform[] m_slots;

		public string m_name = "";

		public Transform m_roofCheckPoint;

		private ZNetView m_nview;

		private ParticleSystem[] m_ps;

		private void Awake()
		{
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			m_nview = ((Component)this).gameObject.GetComponent<ZNetView>();
			SetItUp();
			if (m_nview.GetZDO() != null)
			{
				m_ps = (ParticleSystem[])(object)new ParticleSystem[m_slots.Length];
				for (int i = 0; i < m_slots.Length; i++)
				{
					m_ps[i] = ((Component)m_slots[i]).GetComponent<ParticleSystem>();
				}
				m_nview.Register<Vector3, int>("RPC_RemoveDoneItem", (Action<long, Vector3, int>)RPC_RemoveDoneItem);
				m_nview.Register<string>("RPC_AddItem", (Action<long, string>)RPC_AddItem);
				m_nview.Register<int, string>("RPC_SetSlotVisual", (Action<long, int, string>)RPC_SetSlotVisual);
				if (Object.op_Implicit((Object)(object)m_addFoodSwitch))
				{
					m_addFoodSwitch.m_onUse = new Callback(OnAddFoodSwitch);
					m_addFoodSwitch.m_hoverText = HoverText();
				}
				WearNTear component = ((Component)this).GetComponent<WearNTear>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.m_onDestroyed = (Action)Delegate.Combine(component.m_onDestroyed, new Action(OnDestroyed));
				}
				((MonoBehaviour)this).InvokeRepeating("UpdateCooking", 0f, 1f);
			}
		}

		private void SetConversion()
		{
			m_conversions.AddRange(new List<ItemConversion>
			{
				new ItemConversion
				{
					m_from = ObjectDB.instance.GetItemPrefab("BCA_Undryed_AsksvinMeat").GetComponent<ItemDrop>(),
					m_to = ObjectDB.instance.GetItemPrefab("BCA_Salted_AsksvinMeat").GetComponent<ItemDrop>(),
					m_dryingTime = 1800f
				},
				new ItemConversion
				{
					m_from = ObjectDB.instance.GetItemPrefab("BCA_Undryed_BugMeat").GetComponent<ItemDrop>(),
					m_to = ObjectDB.instance.GetItemPrefab("BCA_Salted_BugMeat").GetComponent<ItemDrop>(),
					m_dryingTime = 1800f
				},
				new ItemConversion
				{
					m_from = ObjectDB.instance.GetItemPrefab("BCA_Undryed_ChickenMeat").GetComponent<ItemDrop>(),
					m_to = ObjectDB.instance.GetItemPrefab("BCA_Salted_ChickenMeat").GetComponent<ItemDrop>(),
					m_dryingTime = 1800f
				},
				new ItemConversion
				{
					m_from = ObjectDB.instance.GetItemPrefab("BCA_Undryed_DeerMeat").GetComponent<ItemDrop>(),
					m_to = ObjectDB.instance.GetItemPrefab("BCA_Salted_DeerMeat").GetComponent<ItemDrop>(),
					m_dryingTime = 1800f
				},
				new ItemConversion
				{
					m_from = ObjectDB.instance.GetItemPrefab("BCA_Undryed_Fish").GetComponent<ItemDrop>(),
					m_to = ObjectDB.instance.GetItemPrefab("BCA_Salted_Fish").GetComponent<ItemDrop>(),
					m_dryingTime = 1800f
				},
				new ItemConversion
				{
					m_from = ObjectDB.instance.GetItemPrefab("BCA_Undryed_HareMeat").GetComponent<ItemDrop>(),
					m_to = ObjectDB.instance.GetItemPrefab("BCA_Salted_HareMeat").GetComponent<ItemDrop>(),
					m_dryingTime = 1800f
				},
				new ItemConversion
				{
					m_from = ObjectDB.instance.GetItemPrefab("BCA_Undryed_RawMeat").GetComponent<ItemDrop>(),
					m_to = ObjectDB.instance.GetItemPrefab("BCA_Salted_BoarMeat").GetComponent<ItemDrop>(),
					m_dryingTime = 1800f
				},
				new ItemConversion
				{
					m_from = ObjectDB.instance.GetItemPrefab("BCA_Undryed_WolfMeat").GetComponent<ItemDrop>(),
					m_to = ObjectDB.instance.GetItemPrefab("BCA_Salted_WolfMeat").GetComponent<ItemDrop>(),
					m_dryingTime = 1800f
				}
			});
		}

		private void SetItUp()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_0037: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Expected O, but got Unknown
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected O, but got Unknown
			m_addEffect.m_effectPrefabs = (EffectData[])(object)new EffectData[2]
			{
				new EffectData
				{
					m_prefab = PrefabManager._cookingBundle.LoadAsset<GameObject>("bca_sfx_cooking_station_done"),
					m_enabled = true,
					m_variant = -1
				},
				new EffectData
				{
					m_prefab = PrefabManager._cookingBundle.LoadAsset<GameObject>("bca_vfx_cooking_station_transform"),
					m_enabled = true,
					m_variant = -1
				}
			};
			m_doneEffect.m_effectPrefabs = (EffectData[])(object)new EffectData[2]
			{
				new EffectData
				{
					m_prefab = PrefabManager._cookingBundle.LoadAsset<GameObject>("bca_sfx_cooking_station_done"),
					m_enabled = true,
					m_variant = -1
				},
				new EffectData
				{
					m_prefab = PrefabManager._cookingBundle.LoadAsset<GameObject>("bca_vfx_cooking_station_transform"),
					m_enabled = true,
					m_variant = -1
				}
			};
			m_pickEffector.m_effectPrefabs = (EffectData[])(object)new EffectData[2]
			{
				new EffectData
				{
					m_prefab = PrefabManager._cookingBundle.LoadAsset<GameObject>("bca_sfx_cooking_station_take"),
					m_enabled = true,
					m_variant = -1
				},
				new EffectData
				{
					m_prefab = PrefabManager._cookingBundle.LoadAsset<GameObject>("bca_vfx_cooking_station_transform"),
					m_enabled = true,
					m_variant = -1
				}
			};
			SetConversion();
			m_slots = (Transform[])(object)new Transform[6]
			{
				((Component)this).transform.Find("slot1"),
				((Component)this).transform.Find("slot2"),
				((Component)this).transform.Find("slot3"),
				((Component)this).transform.Find("slot4"),
				((Component)this).transform.Find("slot5"),
				((Component)this).transform.Find("slot6")
			};
			m_roofCheckPoint = ((Component)this).transform.Find("roof_check_point");
		}

		private void DropAllItems()
		{
			for (int i = 0; i < m_slots.Length; i++)
			{
				GetSlot(i, out var itemName, out var _, out var status);
				if (itemName == "")
				{
					continue;
				}
				switch (status)
				{
				case Status.Done:
					drop(GetItemConversion(itemName).m_to);
					break;
				case Status.NotDone:
				{
					GameObject prefab = ZNetScene.instance.GetPrefab(itemName);
					if ((Object)(object)prefab != (Object)null)
					{
						ItemDrop component = prefab.GetComponent<ItemDrop>();
						if (Object.op_Implicit((Object)(object)component))
						{
							drop(component);
						}
					}
					break;
				}
				}
				SetSlot(i, "", 0f, Status.NotDone);
			}
			void drop(ItemDrop item)
			{
				//IL_0006: 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_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = ((Component)this).transform.position + Vector3.up + Random.insideUnitSphere * 0.3f;
				Quaternion val2 = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f);
				ItemDrop.OnCreateNew(Object.Instantiate<GameObject>(((Component)item).gameObject, val, val2));
			}
		}

		private void OnDestroyed()
		{
			if (m_nview.IsOwner())
			{
				DropAllItems();
			}
		}

		private void UpdateCooking()
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			if (!m_nview.IsValid())
			{
				return;
			}
			bool flag = IsRaining() || EnvMan.IsNight() || IsCovered();
			if (m_nview.IsOwner())
			{
				float deltaTime = GetDeltaTime();
				if (!flag)
				{
					for (int i = 0; i < m_slots.Length; i++)
					{
						GetSlot(i, out var itemName, out var dryTime, out var status);
						if (itemName == "")
						{
							continue;
						}
						ItemConversion itemConversion = GetItemConversion(itemName);
						if (itemConversion == null)
						{
							SetSlot(i, "", 0f, Status.NotDone);
							continue;
						}
						dryTime += deltaTime;
						if (dryTime > itemConversion.m_dryingTime && itemName == ((Object)itemConversion.m_from).name)
						{
							m_doneEffect.Create(m_slots[i].position, Quaternion.identity, (Transform)null, 1f, -1);
							SetSlot(i, ((Object)itemConversion.m_to).name, dryTime, Status.Done);
						}
						else
						{
							SetSlot(i, itemName, dryTime, status);
						}
					}
				}
			}
			UpdateVisual(!flag);
		}

		private float GetDeltaTime()
		{
			DateTime time = ZNet.instance.GetTime();
			DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong(ZDOVars.s_startTime, time.Ticks));
			double totalSeconds = (time - dateTime).TotalSeconds;
			m_nview.GetZDO().Set(ZDOVars.s_startTime, time.Ticks);
			return (float)totalSeconds;
		}

		private void UpdateVisual(bool isDay)
		{
			for (int i = 0; i < m_slots.Length; i++)
			{
				GetSlot(i, out var itemName, out var _, out var status);
				SetSlotVisual(i, itemName, isDay, status);
			}
		}

		private void RPC_SetSlotVisual(long sender, int slot, string item)
		{
			SetSlotVisual(slot, item, isDay: false, Status.NotDone);
		}

		private void SetSlotVisual(int i, string item, bool isDay, Status status)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			if (item == "")
			{
				EmissionModule emission = m_ps[i].emission;
				((EmissionModule)(ref emission)).enabled = false;
				if (m_slots[i].childCount > 0)
				{
					Object.Destroy((Object)(object)((Component)m_slots[i].GetChild(0)).gameObject);
				}
				return;
			}
			EmissionModule emission2 = m_ps[i].emission;
			((EmissionModule)(ref emission2)).enabled = isDay && status != Status.Done;
			if (m_slots[i].childCount == 0 || !(((Object)m_slots[i].GetChild(0)).name == item))
			{
				if (m_slots[i].childCount > 0)
				{
					Object.Destroy((Object)(object)((Component)m_slots[i].GetChild(0)).gameObject);
				}
				Transform obj = ObjectDB.instance.GetItemPrefab(item).transform.Find("attach");
				Transform val = m_slots[i];
				GameObject obj2 = Object.Instantiate<GameObject>(((Component)obj).gameObject, val.position, val.rotation, val);
				((Object)obj2).name = item;
				Renderer[] componentsInChildren = obj2.GetComponentsInChildren<Renderer>();
				for (int j = 0; j < componentsInChildren.Length; j++)
				{
					componentsInChildren[j].shadowCastingMode = (ShadowCastingMode)0;
				}
			}
		}

		private void RPC_RemoveDoneItem(long sender, Vector3 userPoint, int amount)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < m_slots.Length; i++)
			{
				GetSlot(i, out var itemName, out var _, out var _);
				if (!(itemName == "") && IsItemDone(itemName))
				{
					for (int j = 0; j < amount; j++)
					{
						SpawnItem(itemName, i, userPoint);
					}
					SetSlot(i, "", 0f, Status.NotDone);
					m_nview.InvokeRPC(ZNetView.Everybody, "RPC_SetSlotVisual", new object[2] { i, "" });
					break;
				}
			}
		}

		private bool HaveDoneItem()
		{
			for (int i = 0; i < m_slots.Length; i++)
			{
				GetSlot(i, out var itemName, out var _, out var _);
				if (itemName != "" && IsItemDone(itemName))
				{
					return true;
				}
			}
			return false;
		}

		private bool IsItemDone(string itemName)
		{
			ItemConversion itemConversion = GetItemConversion(itemName);
			if (itemConversion == null)
			{
				return false;
			}
			return itemName == ((Object)itemConversion.m_to).name;
		}

		private void SpawnItem(string name, int slot, Vector3 userPoint)
		{
			//IL_0013: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(name);
			Vector3 position = m_slots[slot].position;
			Vector3 val = userPoint - position;
			val.y = 0f;
			((Vector3)(ref val)).Normalize();
			Vector3 val2 = position + val * 0.5f;
			Vector3 val3 = val;
			Quaternion val4 = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f);
			GameObject obj = Object.Instantiate<GameObject>(itemPrefab, val2, val4);
			ItemDrop.OnCreateNew(obj);
			obj.GetComponent<Rigidbody>().velocity = val3 * m_spawnForce;
			m_pickEffector.Create(val2, Quaternion.identity, (Transform)null, 1f, -1);
		}

		public string GetHoverText()
		{
			if (!((Object)(object)m_addFoodSwitch != (Object)null))
			{
				return Localization.instance.Localize(HoverText());
			}
			return "";
		}

		private string HoverText()
		{
			return m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] " + m_addItemTooltip + (ZInput.GamepadActive ? "" : ("\n[<color=yellow><b>1-8</b></color>] " + m_addItemTooltip));
		}

		public string GetHoverName()
		{
			return m_name;
		}

		private bool OnAddFoodSwitch(Switch caller, Humanoid user, ItemData item)
		{
			if (item == null)
			{
				return OnInteract(user);
			}
			return OnUseItem(user, item);
		}

		public bool Interact(Humanoid user, bool hold, bool alt)
		{
			if (hold)
			{
				return false;
			}
			if ((Object)(object)m_addFoodSwitch == (Object)null)
			{
				return OnInteract(user);
			}
			return false;
		}

		private bool OnInteract(Humanoid user)
		{
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			if (HaveDoneItem())
			{
				((Character)Player.m_localPlayer).RaiseSkill((SkillType)105, 0.6f);
				int num = 1;
				float skillFactor = ((Character)Player.m_localPlayer).GetSkillFactor((SkillType)105);
				if (Random.value < skillFactor * InventoryGui.instance.m_craftBonusChance)
				{
					num += InventoryGui.instance.m_craftBonusAmount;
					DamageText.instance.ShowText((TextType)7, ((Component)this).transform.position + Vector3.up, "+" + InventoryGui.instance.m_craftBonusAmount, true);
					InventoryGui.instance.m_craftBonusEffect.Create(((Component)this).transform.position, Quaternion.identity, (Transform)null, 1f, -1);
				}
				m_nview.InvokeRPC("RPC_RemoveDoneItem", new object[2]
				{
					((Component)user).transform.position,
					num
				});
				return true;
			}
			ItemData val = FindCookableItem(user.GetInventory());
			if (val == null)
			{
				((Character)user).Message((MessageType)2, "$bca_nodryableitems", 0, (Sprite)null);
				return false;
			}
			if (!OnUseItem(user, val))
			{
				return false;
			}
			((Character)Player.m_localPlayer).RaiseSkill((SkillType)105, 0.4f);
			return true;
		}

		public bool UseItem(Humanoid user, ItemData item)
		{
			if ((Object)(object)m_addFoodSwitch == (Object)null)
			{
				return OnUseItem(user, item);
			}
			return false;
		}

		private bool OnUseItem(Humanoid user, ItemData item)
		{
			if (IsRaining() || EnvMan.IsNight())
			{
				((Character)user).Message((MessageType)2, "$bca_needssunlight", 0, (Sprite)null);
				user.UseIemBlockkMessage();
				return false;
			}
			if (GetFreeSlot() != -1)
			{
				return DryItem(user, item);
			}
			((Character)user).Message((MessageType)2, "$bca_nofreeslot", 0, (Sprite)null);
			user.UseIemBlockkMessage();
			return false;
		}

		private static bool IsRaining()
		{
			List<string> list = new List<string>
			{
				"Rain", "LightRain", "ThunderStorm", "SwampRain", "Darklands_dark", "Snow", "SnowStorm", "Misty", "DeepForest Mist", "Twilight_Snow",
				"Twilight_SnowStorm"
			};
			return EnvMan.instance.IsEnvironment(list);
		}

		private bool IsCovered()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			float num = default(float);
			bool flag = default(bool);
			Cover.GetCoverForPoint(m_roofCheckPoint.position, ref num, ref flag, 0.5f);
			return num > 0.7f || flag;
		}

		private ItemData FindCookableItem(Inventory inventory)
		{
			return Enumerable.FirstOrDefault(Enumerable.Select(m_conversions, (ItemConversion item2) => inventory.GetItem(item2.m_from.m_itemData.m_shared.m_name, -1, false)), (Func<ItemData, bool>)((ItemData item) => item != null));
		}

		private bool DryItem(Humanoid user, ItemData item)
		{
			string name = ((Object)item.m_dropPrefab).name;
			if (!m_nview.HasOwner())
			{
				m_nview.ClaimOwnership();
			}
			if (!IsItemAllowed(item))
			{
				return false;
			}
			if (GetFreeSlot() == -1)
			{
				return false;
			}
			user.GetInventory().RemoveOneItem(item);
			m_nview.InvokeRPC("RPC_AddItem", new object[1] { name });
			return true;
		}

		private void RPC_AddItem(long sender, string itemName)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			if (IsItemAllowed(itemName))
			{
				int freeSlot = GetFreeSlot();
				if (freeSlot != -1)
				{
					SetSlot(freeSlot, itemName, 0f, Status.NotDone);
					m_nview.InvokeRPC(ZNetView.Everybody, "RPC_SetSlotVisual", new object[2] { freeSlot, itemName });
					m_addEffect.Create(m_slots[freeSlot].position, Quaternion.identity, (Transform)null, 1f, -1);
				}
			}
		}

		private void SetSlot(int slot, string itemName, float dryTime, Status status)
		{
			if (m_nview.IsValid())
			{
				m_nview.GetZDO().Set("slot" + slot, itemName);
				m_nview.GetZDO().Set("slot" + slot, dryTime);
				m_nview.GetZDO().Set("slotstatus" + slot, (int)status);
			}
		}

		private void GetSlot(int slot, out string itemName, out float dryTime, out Status status)
		{
			if (!m_nview.IsValid())
			{
				itemName = "";
				status = Status.NotDone;
				dryTime = 0f;
			}
			else
			{
				itemName = m_nview.GetZDO().GetString("slot" + slot, "");
				dryTime = m_nview.GetZDO().GetFloat("slot" + slot, 0f);
				status = (Status)m_nview.GetZDO().GetInt("slotstatus" + slot, 0);
			}
		}

		private bool IsEmpty()
		{
			for (int i = 0; i < m_slots.Length; i++)
			{
				if (m_nview.GetZDO().GetString("slot" + i, "") != "")
				{
					return false;
				}
			}
			return true;
		}

		private int GetFreeSlot()
		{
			for (int i = 0; i < m_slots.Length; i++)
			{
				if (m_nview.GetZDO().GetString("slot" + i, "") == "")
				{
					return i;
				}
			}
			return -1;
		}

		private bool IsItemAllowed(ItemData item)
		{
			return IsItemAllowed(((Object)item.m_dropPrefab).name);
		}

		private bool IsItemAllowed(string itemName)
		{
			return Enumerable.Any(m_conversions, (ItemConversion item) => ((Object)((Component)item.m_from).gameObject).name == itemName);
		}

		private ItemConversion GetItemConversion(string itemName)
		{
			return Enumerable.FirstOrDefault(m_conversions, (ItemConversion item) => ((Object)((Component)item.m_from).gameObject).name == itemName || ((Object)((Component)item.m_to).gameObject).name == itemName);
		}

		public bool TryGetItems(Player player, Switch switchRef, out List<string> items)
		{
			items = new List<string>();
			if (!Object.op_Implicit((Object)(object)switchRef) && Object.op_Implicit((Object)(object)m_addFoodSwitch))
			{
				return false;
			}
			if (!CanUseItems(player, switchRef))
			{
				return true;
			}
			if ((Object)(object)switchRef == (Object)null || (Object)(object)switchRef == (Object)(object)m_addFoodSwitch)
			{
				items.AddRange(Enumerable.Select(m_conversions, (ItemConversion conversion) => conversion.m_from.m_itemData.m_shared.m_name));
			}
			return true;
		}

		public bool CanUseItems(Player player, Switch switchRef, bool sendErrorMessage = true)
		{
			if ((Object)(object)switchRef != (Object)null && (Object)(object)switchRef != (Object)(object)m_addFoodSwitch)
			{
				return false;
			}
			if (IsRaining() || EnvMan.IsNight() || IsCovered())
			{
				if (sendErrorMessage)
				{
					((Character)player).Message((MessageType)2, "$bca_needssunlight", 0, (Sprite)null);
				}
				return false;
			}
			if (GetFreeSlot() == -1)
			{
				if (sendErrorMessage)
				{
					((Character)player).Message((MessageType)2, "$bca_nofreeslot", 0, (Sprite)null);
				}
				return false;
			}
			if (FindCookableItem(((Humanoid)player).GetInventory()) != null)
			{
				return true;
			}
			if (sendErrorMessage)
			{
				((Character)player).Message((MessageType)2, "$bca_nodryableitems", 0, (Sprite)null);
			}
			return false;
		}
	}
	public static class PieceSetup
	{
		public static void Init()
		{
			if (ZNetSceneAwake())
			{
				ChiliPepperBush(PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_ChiliPepperPlant").GetComponent<DropOnDestroyed>());
				Griller(PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_Griller").GetComponent<CookingStation>());
				LargeGriller(PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_LargeMeat_Griller").GetComponent<CookingStation>());
				TomatoBush(PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_TomatoPlant").GetComponent<DropOnDestroyed>());
				TomatoBush(PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_Wild_Tomato").GetComponent<DropOnDestroyed>());
				ChiliPepperBush(PrefabManager._cookingBundle.LoadAsset<GameObject>("BCA_Wild_ChiliPepper").GetComponent<DropOnDestroyed>());
			}
		}

		private static void Griller(CookingStation cookingStation)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected O, but got Unknown
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Expected O, but got Unknown
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Expected O, but got Unknown
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Expected O, but got Unknown
			cookingStation.m_overCookedItem = ZNetScene.instance.GetPrefab("Coal").GetComponent<ItemDrop>();
			cookingStation.m_conversion = new List<ItemConversion>(7)
			{
				new ItemConversion
				{
					m_from = ZNetScene.instance.GetPrefab("RawMeat").GetComponent<ItemDrop>(),
					m_to = ZNetScene.instance.GetPrefab("CookedMeat").GetComponent<ItemDrop>(),
					m_cookTime = 25f
				},
				new ItemConversion
				{
					m_from = ZNetScene.instance.GetPrefab("NeckTail").GetComponent<ItemDrop>(),
					m_to = ZNetScene.instance.GetPrefab("NeckTailGrilled").GetComponent<ItemDrop>(),
					m_cookTime = 25f
				},
				new ItemConversion
				{
					m_from = ZNetScene.instance.GetPrefab("FishRaw").GetComponent<ItemDrop>(),
					m_to = ZNetScene.instance.GetPrefab("FishCooked").GetComponent<ItemDrop>(),
					m_cookTime = 25f
				},
				new ItemConversion
				{
					m_from = ZNetScene.instance.GetPrefab("DeerMeat").GetComponent<ItemDrop>(),
					m_to = ZNetScene.instance.GetPrefab("CookedDeerMeat").GetComponent<ItemDrop>(),
					m_cookTime = 25f
				},
				new ItemConversion
				{
					m_from = ZNetScene.instance.GetPrefab("WolfMeat").GetComponent<ItemDrop>(),
					m_to = ZNetScene.instance.GetPrefab("CookedWolfMeat").GetComponent<ItemDrop>(),
					m_cookTime = 25f
				},
				new ItemConversion
				{
					m_from = ZNetScene.instance.GetPrefab("ChickenMeat").GetComponent<ItemDrop>(),
					m_to = ZNetScene.instance.GetPrefab("CookedChickenMeat").GetComponent<ItemDrop>(),
					m_cookTime = 25f
				},
				new ItemConversion
				{
					m_from = ZNetScene.instance.GetPrefab("HareMeat").GetComponent<ItemDrop>(),
					m_to = ZNetScene.instance.GetPrefab("CookedHareMeat").GetComponent<ItemDrop>(),
					m_cookTime = 25f
				}
			};
			cookingStation.m_fuelItem = ZNetScene.instance.GetPrefab("Coal").GetComponent<ItemDrop>();
			((Behaviour)cookingStation.m_haveFireObject.GetComponentInChildren<SmokeSpawner>(true)).enabled = Plugin._enableSmoke.Value == Toggle.On;
			SmokeSpawner componentInChildren = ZNetScene.instance.GetPrefab("fire_pit").GetComponentInChildren<SmokeSpawner>(true);
			cookingStation.m_haveFireObject.GetComponentInChildren<SmokeSpawner>(true).m_smokePrefab = componentInChildren.m_smokePrefab;
		}

		private static void LargeGriller(CookingStation cookingStation)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			cookingStation.m_overCookedItem = ZNetScene.instance.GetPrefab("Coal").GetComponent<ItemDrop>();
			cookingStation.m_conversion = new List<ItemConversion>(2)
			{
				new ItemConversion
				{
					m_from = ZNetScene.instance.GetPrefab("LoxMeat").GetComponent<ItemDrop>(),
					m_to = ZNetScene.instance.GetPrefab("CookedLoxMeat").GetComponent<ItemDrop>(),
					m_cookTime = 25f
				},
				new ItemConversion
				{
					m_from = ZNetScene.instance.GetPrefab("SerpentMeat").GetComponent<ItemDrop>(),
					m_to = ZNetScene.instance.GetPrefab("SerpentMeatCooked").GetComponent<ItemDrop>(),
					m_cookTime = 25f
				}
			};
			cookingStation.m_fuelItem = ZNetScene.instance.GetPrefab("Coal").GetComponent<ItemDrop>();
			((Behaviour)cookingStation.m_haveFireObject.GetComponentInChildren<SmokeSpawner>(true)).enabled = Plugin._enableSmoke.Value == Toggle.On;
			SmokeSpawner componentInChildren = ZNetScene.instance.GetPrefab("fire_pit").GetComponentInChildren<SmokeSpawner>(true);
			cookingStation.m_haveFireObject.GetComponentInChildren<SmokeSpawner>(true).m_smokePrefab = componentInChildren.m_smokePrefab;
		}

		private static void ChiliPepperBush(DropOnDestroyed dod)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			dod.m_dropWhenDestroyed.m_drops = new List<DropData>(1)
			{
				new DropData
				{
					m_item = ObjectDB.instance.GetItemPrefab("Wood"),
					m_stackMin = 1,
					m_stackMax = 1,
					m_weight = 0f,
					m_dontScale = false
				}
			};
		}

		private static void TomatoBush(DropOnDestroyed dod)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			dod.m_dropWhenDestroyed.m_drops = new List<DropData>(1)
			{
				new DropData
				{
					m_item = ObjectDB.instance.GetItemPrefab("Wood"),
					m_stackMin = 1,
					m_stackMax = 1,
					m_weight = 0f,
					m_dontScale = false
				}
			};
		}

		private static bool ZNetSceneAwake()
		{
			if ((Object)(object)ZNetScene.instance != (Object)null && ZNetScene.instance.m_prefabs.Count != 0)
			{
				return (Object)(object)ZNetScene.instance.GetPrefab("piece_workbench") != (Object)null;
			}
			return false;
		}
	}
	public static class PrefabManager
	{
		public static AssetBundle _cookingBundle;

		public static void Init()
		{
			_cookingBundle = ItemManager.PrefabManager.RegisterAssetBundle("cookingbundle");
			FoodItems();
			Pieces();
			Others();
		}

		private static void FoodItems()
		{
			Item item = new Item(_cookingBundle, "BCA_BoiledEgg");
			item.Crafting.Add("BCA_CookingPot", 1);
			item.RequiredItems.Add("ChickenEgg", 5);
			ConfigSetup._boiledEggCraftAmount.SettingChanged += delegate
			{
				item.CraftAmount = ConfigSetup._boiledEggCraftAmount.Value;
			};
			item.CraftAmount = ConfigSetup._boiledEggCraftAmount.Value;
			item.Configurable = Configurability.Full;
			ShaderReplacer.Replace(item.Prefab);
			Item item2 = new Item(_cookingBundle, "BCA_ChickenSoup");
			item2.Crafting.Add("BCA_CookingPot", 1);
			item2.RequiredItems.Add("CookedChickenMeat", 2);
			item2.RequiredItems.Add("Dandelion", 8);
			item2.RequiredItems.Add("Onion", 4);
			item2.RequiredItems.Add("Mushroom", 6);
			item2.Configurable = Configurability.Full;
			ShaderReplacer.Replace(item2.Prefab);
			ShaderReplacer.Replace(new Item(_cookingBundle, "BCA_ChiliPepper")
			{
				Configurable = Configurability.Stats
			}.Prefab);
			Item item3 = new Item(_cookingBundle, "BCA_ChiliPepperSeeds");
			item3.Crafting.Add(ItemManager.CraftingTable.Workbench, 1);
			item3.CraftAmount = 10;
			item3.RequiredItems.Add("BCA_ChiliPepper", 5);
			item3.Configurable = Configurability.Recipe;
			Item item4 = new Item(_cookingBundle, "BCA_FishSoup");
			item4.Crafting.Add("BCA_CookingPot", 1);
			item4.RequiredItems.Add("FishCooked", 3);
			item4.RequiredItems.Add("BCA_Tomato", 4);
			item4.RequiredItems.Add("Onion", 2);
			item4.RequiredItems.Add("Mushroom", 6);
			item4.Configurable = Configurability.Full;
			ShaderReplacer.Replace(item4.Prefab);
			Item item5 = new Item(_cookingBundle, "BCA_MeatSoup");
			item5.Crafting.Add("BCA_CookingPot", 1);
			item5.RequiredItems.Add("CookedMeat", 2);
			item5.RequiredItems.Add("CookedDeerMeat", 2);
			item5.RequiredItems.Add("Onion", 4);
			item5.RequiredItems.Add("Mushroom", 6);
			item5.Configurable = Configurability.Full;
			ShaderReplacer.Replace(item5.Prefab);
			Item item6 = new Item(_cookingBundle, "BCA_SpicyMeatPlatter");
			item6.Crafting.Add("BCA_CookingPot", 1);
			item6.RequiredItems.Add("CookedWolfMeat", 2);
			item6.RequiredItems.Add("CookedMeat", 2);
			item6.RequiredItems.Add("CookedDeerMeat", 2);
			item6.RequiredItems.Add("BCA_ChiliPepper", 12);
			item6.Configurable = Configurability.Full;
			ShaderReplacer.Replace(item6.Prefab);
			Item item7 = new Item(_cookingBundle, "BCA_SpicyMeatSupreme");
			item7.Crafting.Add("BCA_CookingPot", 1);
			item7.RequiredItems.Add("CookedMeat", 6);
			item7.RequiredItems.Add("Onion", 4);
			item7.RequiredItems.Add("BCA_Tomato", 4);
			item7.RequiredItems.Add("BCA_ChiliPepper", 8);
			item7.Configurable = Configurability.Full;
			ShaderReplacer.Replace(item7.Prefab);
			Item item8 = new Item(_cookingBundle, "BCA_SpicySerpentMeat");
			item8.Crafting.Add("BCA_CookingPot", 1);
			item8.RequiredItems.Add("SerpentMeatCooked", 1);
			item8.RequiredItems.Add("BCA_Tomato", 4);
			item8.RequiredItems.Add("Mushroom", 6);
			item8.RequiredItems.Add("BCA_ChiliPepper", 8);
			item8.Configurable = Configurability.Full;
			ShaderReplacer.Replace(item8.Prefab);
			Item item9 = new Item(_cookingBundle, "BCA_SweetNSpicyFish");
			item9.Crafting.Add("BCA_CookingPot", 1);
			item9.RequiredItems.Add("FishCooked", 2);
			item9.RequiredItems.Add("Raspberry", 12);
			item9.RequiredItems.Add("BCA_Tomato", 4);
			item9.RequiredItems.Add("BCA_ChiliPepper", 8);
			item9.Configurable = Configurability.Full;
			ShaderReplacer.Replace(item9.Prefab);
			ShaderReplacer.Replace(new Item(_cookingBundle, "BCA_Tomato")
			{
				Configurable = Configurability.Stats
			}.Prefab);
			Item item10 = new Item(_cookingBundle, "BCA_TomatoSeeds");
			item10.Crafting.Add(ItemManager.CraftingTable.Workbench, 1);
			item10.CraftAmount = 10;
			item10.RequiredItems.Add("BCA_Tomato", 5);
			item10.Configurable = Configurability.Recipe;
			Item item11 = new Item(_cookingBundle, "BCA_TomatoSoup");
			item11.Crafting.Add("BCA_CookingPot", 1);
			item11.RequiredItems.Add("DeerMeat", 1);
			item11.RequiredItems.Add("BCA_Tomato", 8);
			item11.RequiredItems.Add("Raspberry", 12);
			item11.RequiredItems.Add("Mushroom", 6);
			item11.Configurable = Configurability.Full;
			ShaderReplacer.Replace(item11.Prefab);
			Item item12 = new Item(_cookingBundle, "BCA_VeggieSoup");
			item12.Crafting.Add("BCA_CookingPot", 1);
			item12.RequiredItems.Add("Carrot", 2);
			item12.RequiredItems.Add("Turnip", 2);
			item12.RequiredItems.Add("Onion", 4);
			item12.RequiredItems.Add("Mushroom", 8);
			item12.Configurable = Configurability.Full;
			ShaderReplacer.Replace(item12.Prefab);
			Item item13 = new Item(_cookingBundle, "BCA_Salt");
			item13.Crafting.Add("BCA_Crusher", 1);
			item13.RequiredItems.Add("BCA_SaltRock", 1);
			item13.CraftAmount = 5;
			item13.Configurable = Configurability.Disabled;
			ShaderReplacer.Replace(new Item(_cookingBundle, "BCA_Salted_AsksvinEgg")
			{
				Configurable = Configurability.Stats
			}.Prefab);
			Item item14 = new Item(_cookingBundle, "BCA_Coated_AsksvinEgg");
			item14.Crafting.Add(ItemManager.CraftingTable.FoodPreparationTable, 1);
			item14.RequiredItems.Add("AsksvinEgg", 1);
			item14.RequiredItems.Add("BCA_Salt", 26);
			item14.RequiredItems.Add("BeechSeeds", 8);
			item14.Configurable = Configurability.Recipe;
			ShaderReplacer.Replace(new Item(_cookingBundle, "BCA_Salted_AsksvinMeat")
			{
				Configurable = Configurability.Stats
			}.Prefab);
			Item item15 = new Item(_cookingBundle, "BCA_Undryed_AsksvinMeat");
			item15.Crafting.Add(ItemManager.CraftingTable.FoodPreparationTable, 1);
			item15.RequiredItems.Add("AsksvinMeat", 1);
			item15.RequiredItems.Add("BCA_Salt", 5);
			item15.Configurable = Configurability.Recipe;
			new Item(_cookingBundle, "BCA_SaltRock").Configurable = Configurability.Disabled;
			Item item16 = new Item(_cookingBundle, "BCA_Coated_ChickenEgg");
			item16.Crafting.Add(ItemManager.CraftingTable.FoodPreparationTable, 1);
			item16.RequiredItems.Add("ChickenEgg", 1);
			item16.RequiredItems.Add("BCA_Salt", 15);
			item16.RequiredItems.Add("BeechSeeds", 4);
			item16.Configurable = Configurability.Recipe;
			Item item17 = new Item(_cookingBundle, "BCA_Coated_VoltureEgg");
			item17.Crafting.Add(ItemManager.CraftingTable.FoodPreparationTable, 1);
			item17.RequiredItems.Add("VoltureEgg", 1);
			item17.RequiredItems.Add("BCA_Salt", 35);
			item17.RequiredItems.Add("BeechSeeds", 10);
			item17.Configurable = Configurability.Recipe;
			ShaderReplacer.Replace(new Item(_cookingBundle, "BCA_Salted_BoarMeat")
			{
				Configurable = Configurability.Stats
			}.Prefab);
			ShaderReplacer.Replace(new Item(_cookingBundle, "BCA_Salted_BugMeat")
			{
				Configurable = Configurability.Stats
			}.Prefab);
			new Item(_cookingBundle, "BCA_Salted_ChickenEgg").Configurable = Configurability.Stats;
			ShaderReplacer.Replace(new Item(_cookingBundle, "BCA_Salted_ChickenMeat")
			{
				Configurable = Configurability.Stats
			}.Prefab);
			ShaderReplacer.Replace(new Item(_cookingBundle, "BCA_Salted_DeerMeat")
			{
				Configurable = Configurability.Stats
			}.Prefab);
			ShaderReplacer.Replace(new Item(_cookingBundle, "BCA_Salted_Fish")
			{
				Configurable = Configurability.Stats
			}.Prefab);
			ShaderReplacer.Replace(new Item(_cookingBundle, "BCA_Salted_HareMeat")
			{
				Configurable = Configurability.Stats
			}.Prefab);
			new Item(_cookingBundle, "BCA_Salted_VoltureEgg").Configurable = Configurability.Stats;
			ShaderReplacer.Replace(new Item(_cookingBundle, "BCA_Salted_WolfMeat")
			{
				Configurable = Configurability.Stats
			}.Prefab);
			Item item18 = new Item(_cookingBundle, "BCA_Undryed_BugMeat");
			item18.Crafting.Add(ItemManager.CraftingTable.FoodPreparationTable, 1);
			item18.RequiredItems.Add("BugMeat", 1);
			item18.RequiredItems.Add("BCA_Salt", 5);
			item18.Configurable = Configurability.Recipe;
			Item item19 = new Item(_cookingBundle, "BCA_Undryed_ChickenMeat");
			item19.Crafting.Add(ItemManager.CraftingTable.FoodPreparationTable, 1);
			item19.RequiredItems.Add("ChickenMeat", 1);
			item19.RequiredItems.Add("BCA_Salt", 5);
			item19.Configurable = Configurability.Recipe;
			Item item20 = new Item(_cookingBundle, "BCA_Undryed_DeerMeat");
			item20.Crafting.Add(ItemManager.CraftingTable.FoodPreparationTable, 1);
			item20.RequiredItems.Add("DeerMeat", 1);
			item20.RequiredItems.Add("BCA_Salt", 5);
			item20.Configurable = Configurability.Recipe;
			Item item21 = new Item(_cookingBundle, "BCA_Undryed_Fish");
			item21.Crafting.Add(ItemManager.CraftingTable.FoodPreparationTable, 1);
			item21.RequiredItems.Add("FishRaw", 1);
			item21.RequiredItems.Add("BCA_Salt", 5);
			item21.Configurable = Configurability.Recipe;
			Item item22 = new Item(_cookingBundle, "BCA_Undryed_HareMeat");
			item22.Crafting.Add(ItemManager.CraftingTable.FoodPreparationTable, 1);
			item22.RequiredItems.Add("HareMeat", 1);
			item22.RequiredItems.Add("BCA_Salt", 5);
			item22.Configurable = Configurability.Recipe;
			Item item23 = new Item(_cookingBundle, "BCA_Undryed_RawMeat");
			item23.Crafting.Add(ItemManager.CraftingTable.FoodPreparationTable, 1);
			item23.RequiredItems.Add("RawMeat", 1);
			item23.RequiredItems.Add("BCA_Salt", 5);
			item23.Configurable = Configurability.Recipe;
			Item item24 = new Item(_cookingBundle, "BCA_Undryed_WolfMeat");
			item24.Crafting.Add(ItemManager.CraftingTable.FoodPreparationTable, 1);
			item24.RequiredItems.Add("WolfMeat", 1);
			item24.RequiredItems.Add("BCA_Salt", 5);
			item24.Configurable = Configurability.Recipe;
		}

		private static void Pieces()
		{
			BuildPiece buildPiece = new BuildPiece(_cookingBundle, "BCA_CookingPot");
			buildPiece.Crafting.Set(PieceManager.CraftingTable.Workbench);
			buildPiece.Category.Set(BuildPieceCategory.Crafting);
			buildPiece.RequiredItems.Add("Copper", 3, recover: true);
			buildPiece.RequiredItems.Add("Tin", 12, recover: true);
			buildPiece.SpecialProperties = new SpecialProperties
			{
				AdminOnly = false,
				NoConfig = false
			};
			ShaderReplacer.Replace(buildPiece.Prefab);
			BuildPiece buildPiece2 = new BuildPiece(_cookingBundle, "BCA_Griller");
			buildPiece2.Crafting.Set(PieceManager.CraftingTable.Workbench);
			buildPiece2.Category.Set(BuildPieceCategory.Crafting);
			buildPiece2.RequiredItems.Add("Copper", 12, recover: true);
			buildPiece2.RequiredItems.Add("Tin", 8, recover: true);
			buildPiece2.RequiredItems.Add("Coal", 10, recover: true);
			buildPiece2.SpecialProperties = new SpecialProperties
			{
				AdminOnly = false,
				NoConfig = false
			};
			ShaderReplacer.Replace(buildPiece2.Prefab);
			BuildPiece buildPiece3 = new BuildPiece(_cookingBundle, "BCA_LargeMeat_Griller");
			buildPiece3.Crafting.Set(PieceManager.CraftingTable.Workbench);
			buildPiece3.Category.Set(BuildPieceCategory.Crafting);
			buildPiece3.RequiredItems.Add("Copper", 18, recover: true);
			buildPiece3.RequiredItems.Add("Tin", 12, recover: true);
			buildPiece3.RequiredItems.Add("Coal", 16, recover: true);
			buildPiece3.SpecialProperties = new SpecialProperties
			{
				AdminOnly = false,
				NoConfig = false
			};
			ShaderReplacer.Replace(buildPiece3.Prefab);
			BuildPiece buildPiece4 = new BuildPiece(_cookingBundle, "BCA_ChiliPepperSapling");
			buildPiece4.Crafting.Set(PieceManager.CraftingTable.None);
			buildPiece4.Tool.Add("Cultivator");
			buildPiece4.RequiredItems.Add("BCA_ChiliPepperSeeds", 1, recover: true);
			buildPiece4.SpecialProperties = new SpecialProperties
			{
				AdminOnly = false,
				NoConfig = false
			};
			ShaderReplacer.Replace(buildPiece4.Prefab);
			BuildPiece buildPiece5 = new BuildPiece(_cookingBundle, "BCA_TomatoSapling");
			buildPiece5.Crafting.Set(PieceManager.CraftingTable.None);
			buildPiece5.Tool.Add("Cultivator");
			buildPiece5.RequiredItems.Add("BCA_TomatoSeeds", 1, recover: true);
			buildPiece5.SpecialProperties = new SpecialProperties
			{
				AdminOnly = false,
				NoConfig = false
			};
			ShaderReplacer.Replace(buildPiece5.Prefab);
			BuildPiece buildPiece6 = new BuildPiece(_cookingBundle, "BCA_Crusher");
			buildPiece6.Crafting.Set(PieceManager.CraftingTable.Workbench);
			buildPiece6.Category.Set(BuildPieceCategory.Crafting);
			buildPiece6.RequiredItems.Add("Stone", 16, recover: true);
			buildPiece6.RequiredItems.Add("RoundLog", 1, recover: true);
			buildPiece6.SpecialProperties = new SpecialProperties
			{
				AdminOnly = false,
				NoConfig = false
			};
			ShaderReplacer.Replace(buildPiece6.Prefab);
			BuildPiece buildPiece7 = new BuildPiece(_cookingBundle, "BCA_DryingRack");
			buildPiece7.Crafting.Set(PieceManager.CraftingTable.Workbench);
			buildPiece7.Category.Set(BuildPieceCategory.Crafting);
			buildPiece7.RequiredItems.Add("Wood", 20, recover: true);
			buildPiece7.SpecialProperties = new SpecialProperties
			{
				AdminOnly = false,
				NoConfig = false
			};
			ShaderReplacer.Replace(buildPiece7.Prefab);
			if (!Object.op_Implicit((Object)(object)buildPiece7.Prefab.GetComponent<DryingStation>()))
			{
				buildPiece7.Prefab.AddComponent<DryingStation>();
			}
		}

		private static void Others()
		{
			ShaderReplacer.Replace(ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "BCA_ChiliPepperPlant"));
			ShaderReplacer.Replace(ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "BCA_TomatoPlant"));
			ShaderReplacer.Replace(ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "BCA_Wild_Tomato"));
			ShaderReplacer.Replace(ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "BCA_Wild_ChiliPepper"));
			ShaderReplacer.Replace(ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "BCA_MineRock_Salt"));
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_fx_Eat");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_fx_FeastSmall");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_fx_oven_add_wood");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_build_cultivator");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_build_hammer_default");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_build_hammer_metal");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_build_hammer_wood");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_bush_hit");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_cooking_station_done");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_cooking_station_take");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_eat");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_gui_craftitem_cauldron");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_gui_craftitem_cauldron_end");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_gui_craftitem_workbench");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_gui_craftitem_workbench_end");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_gui_repairitem_workbench");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_pickable_pick");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_rock_destroyed");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_rock_hit");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_unarmed_hit");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_sfx_wood_destroyed");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_vfx_bush_destroyed");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_vfx_bush_leaf_puff");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_vfx_cooking_station_transform");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_vfx_pickable_pick");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_vfx_Place_cauldron");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_vfx_Place_wood_pole");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_vfx_RockDestroyed_Obsidian");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_vfx_RockHit_Obsidian");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_vfx_SawDust");
			ItemManager.PrefabManager.RegisterPrefab(_cookingBundle, "bca_vfx_turnip_grow");
		}
	}
	public static class ShaderReplacer
	{
		private static readonly List<GameObject> GOToSwap;

		static ShaderReplacer()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			GOToSwap = new List<GameObject>();
			new Harmony("blacks7ar.utilities.ShaderReplacer").Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(ShaderReplacer), "ReplaceShaderPatch", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		public static void Replace(GameObject gameObject)
		{
			GOToSwap.Add(gameObject);
		}

		[HarmonyPriority(700)]
		private static void ReplaceShaderPatch()
		{
			foreach (Material item in Enumerable.Select(Enumerable.Where(Enumerable.SelectMany(Enumerable.Where(Enumerable.SelectMany(Enumerable.Select(GOToSwap, (GameObject gameObject) => gameObject.GetComponentsInChildren<Renderer>(true)), (Renderer[] renderers) => renderers, (Renderer[] renderers, Renderer renderer) => new { renderers, renderer }), <>h__TransparentIdentifier0 => (Object)(object)<>h__TransparentIdentifier0.renderer != (Object)null), <>h__TransparentIdentifier0 => <>h__TransparentIdentifier0.renderer.sharedMaterials, (<>h__TransparentIdentifier0, Material material) => new { <>h__TransparentIdentifier0, material }), <>h__TransparentIdentifier1 => (Object)(object)<>h__TransparentIdentifier1.material != (Object)null), <>h__TransparentIdentifier1 => <>h__TransparentIdentifier1.material))
			{
				Shader[] array = Resources.FindObjectsOfTypeAll<Shader>();
				foreach (Shader val in array)
				{
					if (((Object)item.shader).name == ((Object)val).name)
					{
						item.shader = val;
					}
				}
			}
		}
	}
	public enum Toggle
	{
		On = 1,
		Off = 0
	}
	public static class VegetationSetup
	{
		private static readonly List<ZoneVegetation> _vegetationList = new List<ZoneVegetation>();

		public static void Init(ZoneSystem zoneSystem)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Expected O, but got Unknown
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Expected O, but got Unknown
			foreach (ZoneVegetation vegetation in _vegetationList)
			{
				zoneSystem.m_vegetation.Remove(vegetation);
			}
			_vegetationList.Clear();
			ZoneVegetation item = new ZoneVegetation
			{
				m_enable = (ConfigSetup._enableWildTomato.Value == Toggle.On),
				m_biome = ConfigSetup._wildTomatoBiome.Value,
				m_biomeArea = ConfigSetup._wildTomatoBiomeArea.Value,
				m_groupRadius = ConfigSetup._wildTomatoGroupRadius.Value,
				m_groupSizeMin = ConfigSetup._wildTomatoGroupSizeMin.Value,
				m_groupSizeMax = ConfigSetup._wildTomatoGroupSizeMax.Value,
				m_minAltitude = 0f,
				m_max = ConfigSetup._wildTomatoMax.Value,
				m_prefab = ZNetScene.instance.GetPrefab("BCA_Wild_Tomato")
			};
			ZoneVegetation item2 = new ZoneVegetation
			{
				m_enable = (ConfigSetup._enableWildChili.Value == Toggle.On),
				m_biome = ConfigSetup._wildChiliBiome.Value,
				m_biomeArea = ConfigSetup._wildChiliBiomeArea.Value,
				m_groupRadius = ConfigSetup._wildChiliGroupRadius.Value,
				m_groupSizeMin = ConfigSetup._wildChiliGroupSizeMin.Value,
				m_groupSizeMax = ConfigSetup._wildChiliGroupSizeMax.Value,
				m_minAltitude = 0f,
				m_max = ConfigSetup._wildChiliMax.Value,
				m_prefab = ZNetScene.instance.GetPrefab("BCA_Wild_ChiliPepper")
			};
			ZoneVegetation item3 = new ZoneVegetation
			{
				m_enable = (ConfigSetup._saltDepositEnable.Value == Toggle.On),
				m_biome = ConfigSetup._saltDepositBiome.Value,
				m_biomeArea = ConfigSetup._saltDepositBiomeArea.Value,
				m_min = ConfigSetup._saltDepositMin.Value,
				m_max = ConfigSetup._saltDepositMax.Value,
				m_chanceToUseGroundTilt = 1f,
				m_scaleMin = 0.8f,
				m_scaleMax = 1f,
				m_minAltitude = -0.2f,
				m_maxAltitude = 1.5f,
				m_maxTerrainDelta = 2f,
				m_groundOffset = -0.5f,
				m_prefab = ZNetScene.instance.GetPrefab("BCA_MineRock_Salt")
			};
			_vegetationList.Add(item);
			_vegetationList.Add(item2);
			_vegetationList.Add(item3);
			foreach (ZoneVegetation vegetation2 in _vegetationList)
			{
				zoneSystem.m_vegetation.Add(vegetation2);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ItemManager
{
	[PublicAPI]
	internal enum CraftingTable
	{
		Disabled,
		Inventory,
		[InternalName("piece_workbench")]
		Workbench,
		[InternalName("piece_cauldron")]
		Cauldron,
		[InternalName("forge")]
		Forge,
		[InternalName("piece_artisanstation")]
		ArtisanTable,
		[InternalName("piece_stonecutter")]
		StoneCutter,
		[InternalName("piece_magetable")]
		MageTable,
		[InternalName("blackforge")]
		BlackForge,
		[InternalName("piece_preptable")]
		FoodPreparationTable,
		[InternalName("piece_MeadCauldron")]
		MeadKetill,
		Custom
	}
	[PublicAPI]
	internal enum ConversionPiece
	{
		Disabled,
		[InternalName("smelter")]
		Smelter,
		[InternalName("charcoal_kiln")]
		CharcoalKiln,
		[InternalName("blastfurnace")]
		BlastFurnace,
		[InternalName("windmill")]
		Windmill,
		[InternalName("piece_spinningwheel")]
		SpinningWheel,
		[InternalName("eitrrefinery")]
		EitrRefinery,
		Custom
	}
	internal class InternalName : Attribute
	{
		public readonly string internalName;

		public InternalName(string internalName)
		{
			this.internalName = internalName;
		}
	}
	[PublicAPI]
	internal 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
			});
		}
	}
	[PublicAPI]
	internal class CraftingStationList
	{
		public readonly List<CraftingStationConfig> Stations = new List<CraftingStationConfig>();

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

		public void Add(string customTable, int level)
		{
			Stations.Add(new CraftingStationConfig
			{
				Table = CraftingTable.Custom,
				level = level,
				custom = customTable
			});
		}
	}
	[PublicAPI]
	internal class ItemRecipe
	{
		public readonly RequiredResourceList RequiredItems = new RequiredResourceList();

		public readonly RequiredResourceList RequiredUpgradeItems = new RequiredResourceList();

		public readonly CraftingStationList Crafting = new CraftingStationList();

		public int CraftAmount = 1;

		public bool RequireOnlyOneIngredient;

		public float QualityResultAmountMultiplier = 1f;

		public ConfigEntryBase? RecipeIsActive;
	}
	[PublicAPI]
	internal class Trade
	{
		public Trader Trader;

		public uint Price;

		public uint Stack = 1u;

		public string? RequiredGlobalKey;
	}
	[PublicAPI]
	[Flags]
	internal enum Trader
	{
		None = 0,
		Haldor = 1,
		Hildir = 2
	}
	internal struct Requirement
	{
		public string itemName;

		public int amount;

		public ConfigEntry<int>? amountConfig;

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

		public int level;

		public string? custom;
	}
	[Flags]
	internal enum Configurability
	{
		Disabled = 0,
		Recipe = 1,
		Stats = 2,
		Drop = 4,
		Trader = 8,
		Full = 0xF
	}
	[PublicAPI]
	internal class DropTargets
	{
		public readonly List<DropTarget> Drops = new List<DropTarget>();

		public void Add(string creatureName, float chance, int min = 1, int? max = null, bool levelMultiplier = true)
		{
			Drops.Add(new DropTarget
			{
				creature = creatureName,
				chance = chance,
				min = min,
				max = max.GetValueOrDefault(min),
				levelMultiplier = levelMultiplier
			});
		}
	}
	internal struct DropTarget
	{
		public string creature;

		public int min;

		public int max;

		public float chance;

		public bool levelMultiplier;
	}
	internal enum Toggle
	{
		On = 1,
		Off = 0
	}
	[PublicAPI]
	internal class Item
	{
		private class ItemConfig
		{
			public ConfigEntry<string>? craft;

			public ConfigEntry<string>? upgrade;

			public ConfigEntry<CraftingTable> table;

			public ConfigEntry<int> tableLevel;

			public ConfigEntry<string> customTable;

			public ConfigEntry<int>? maximumTableLevel;

			public ConfigEntry<Toggle> requireOneIngredient;

			public ConfigEntry<float> qualityResultAmountMultiplier;
		}

		private class TraderConfig
		{
			public ConfigEntry<Trader> trader;

			public ConfigEntry<uint> price;

			public ConfigEntry<uint> stack;

			public ConfigEntry<string> requiredGlobalKey;
		}

		private class RequirementQuality
		{
			public int quality;
		}

		private class ConfigurationManagerAttributes
		{
			[UsedImplicitly]
			public int? Order;

			[UsedImplicitly]
			public bool? Browsable;

			[UsedImplicitly]
			public string? Category;

			[UsedImplicitly]
			public Action<ConfigEntryBase>? CustomDrawer;

			public Func<bool>? browsability;
		}

		[PublicAPI]
		public enum DamageModifier
		{
			Normal,
			Resistant,
			Weak,
			Immune,
			Ignore,
			VeryResistant,
			VeryWeak,
			None
		}

		private delegate void setDmgFunc(ref DamageTypes dmg, float value);

		private class SerializedRequirements
		{
			public readonly List<Requirement> Reqs;

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

			public SerializedRequirements(string reqs)
				: this(Enumerable.ToList(Enumerable.Select(reqs.Split(new char[1] { ',' }), delegate(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;
				})))
			{
			}

			public override string ToString()
			{
				return string.Join(",", Enumerable.Select(Reqs, (Requirement r) => $"{r.itemName}:{r.amount}" + ((r.quality > 0) ? $":{r.quality}" : "")));
			}

			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
				ObjectDB objectDB2 = objectDB;
				Dictionary<string, Requirement> dictionary = Enumerable.ToDictionary(Enumerable.Where(craft.Reqs, (Requirement r) => r.itemName != ""), (Func<Requirement, string>)((Requirement r) => r.itemName), (Func<Requirement, Requirement>)delegate(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 = Enumerable.ToList(Enumerable.Where(dictionary.Values, (Requirement v) => v != null));
				foreach (Requirement item in Enumerable.Where(upgrade.Reqs, (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();
				ItemDrop? ResItem(Requirement r)
				{
					return fetchByName(objectDB2, r.itemName);
				}
			}
		}

		private class SerializedDrop
		{
			public readonly List<DropTarget> Drops;

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

			public SerializedDrop(string drops)
			{
				Drops = Enumerable.ToList(Enumerable.Select((drops == "") ? ((IEnumerable<string>)Array.Empty<string>()) : ((IEnumerable<string>)drops.Split(new char[1] { ',' })), delegate(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;
				}));
			}

			public override string ToString()
			{
				return string.Join(",", Enumerable.Select(Drops, (DropTarget r) => $"{r.creature}:{r.chance.ToString(CultureInfo.InvariantCulture)}:{r.min}:" + ((r.min == r.max) ? "" : $"{r.max}") + (r.levelMultiplier ? "" : ":0")));
			}

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

		private static Dictionary<Recipe, ConfigEntryBase?> hiddenCraftRecipes = new Dictionary<Recipe, ConfigEntryBase>();

		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;

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

		private static object? configManager;

		private static Localization? _english;

		private static BaseUnityPlugin? _plugin;

		private static bool hasConfigSync = true;

		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.")]
		public ConfigEntryBase? RecipeIsActive
		{
			get
			{
				return this[""].RecipeIsActive;
			}
			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 ItemRecipe value))
				{
					return value;
				}
				return Recipes[name] = new ItemRecipe();
			}
		}

		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 = Enumerable.ToList(Assembly.GetExecutingAssembly().DefinedTypes);
					}
					catch (ReflectionTypeLoadException ex)
					{
						source = Enumerable.Select(Enumerable.Where(ex.Types, (Type t) =