Decompiled source of SeasonalTweaks v1.1.0

SeasonalTweaks.dll

Decompiled 3 days 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.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using SeasonalTweaks.Tweaks;
using ServerSync;
using TMPro;
using UnityEngine;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Core.Tokens;
using YamlDotNet.Helpers;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.BufferedDeserialization;
using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators;
using YamlDotNet.Serialization.Callbacks;
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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("SeasonalTweaks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("SeasonalTweaks")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("E0E2F92E-557C-4A05-9D89-AA92A0BD75C4")]
[assembly: AssemblyFileVersion("1.1.0")]
[assembly: AssemblyCompany("RustyMods")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<cf3672ae-5891-4eea-9703-c256ebbf9b2d>Embedded]
	internal sealed class <cf3672ae-5891-4eea-9703-c256ebbf9b2d>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[<cf3672ae-5891-4eea-9703-c256ebbf9b2d>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class <0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	[<cf3672ae-5891-4eea-9703-c256ebbf9b2d>Embedded]
	internal sealed class <f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace SeasonalTweaks
{
	[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
	[<0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>Nullable(0)]
	[BepInPlugin("RustyMods.SeasonalTweaks", "SeasonalTweaks", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class SeasonalTweaksPlugin : BaseUnityPlugin
	{
		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(0)]
		public enum Toggle
		{
			On = 1,
			Off = 0
		}

		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(0)]
		public enum WorkingAs
		{
			Client,
			Server,
			Both
		}

		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(0)]
		private class ConfigurationManagerAttributes
		{
			[UsedImplicitly]
			public int? Order = null;

			[UsedImplicitly]
			public bool? Browsable = null;

			[<0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>Nullable(2)]
			[UsedImplicitly]
			public string Category = null;

			[<0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>Nullable(new byte[] { 2, 1 })]
			[UsedImplicitly]
			public Action<ConfigEntryBase> CustomDrawer = null;
		}

		internal const string ModName = "SeasonalTweaks";

		internal const string ModVersion = "1.1.0";

		internal const string Author = "RustyMods";

		private const string ModGUID = "RustyMods.SeasonalTweaks";

		private static string ConfigFileName = "RustyMods.SeasonalTweaks.cfg";

		private static string ConfigFileFullPath;

		internal static string ConnectionError;

		private readonly Harmony _harmony = new Harmony("RustyMods.SeasonalTweaks");

		public static readonly ManualLogSource SeasonalTweaksLogger;

		public static readonly ConfigSync ConfigSync;

		public static WorkingAs workingAsType;

		public static bool ForagingLoaded;

		public static bool FarmingLoaded;

		private static ConfigEntry<Toggle> _serverConfigLocked;

		public static ConfigEntry<Toggle> _ModEnabled;

		public static ConfigEntry<int> _LevelByPass;

		public static ConfigEntry<Toggle> _SeasonalItems;

		public static ConfigEntry<Toggle> _UseYMLCustomValues;

		public static ConfigEntry<Toggle> _TweakFarming;

		public static ConfigEntry<string> _PlantDeniedText;

		public static ConfigEntry<Farming.PlantTypes> _FarmingSpring;

		public static ConfigEntry<Farming.PlantTypes> _FarmingSummer;

		public static ConfigEntry<Farming.PlantTypes> _FarmingFall;

		public static ConfigEntry<Farming.PlantTypes> _FarmingWinter;

		public static ConfigEntry<Pickables.PickableTypes> _PickSpring;

		public static ConfigEntry<Pickables.PickableTypes> _PickSummer;

		public static ConfigEntry<Pickables.PickableTypes> _PickFall;

		public static ConfigEntry<Pickables.PickableTypes> _PickWinter;

		public static ConfigEntry<Toggle> _FishPickableWinter;

		public static ConfigEntry<string> _FishNotPickableMessage;

		public static ConfigEntry<string> _PickSpringMessage;

		public static ConfigEntry<string> _PickSummerMessage;

		public static ConfigEntry<string> _PickFallMessage;

		public static ConfigEntry<string> _PickWinterMessage;

		public static ConfigEntry<Toggle> _TweakPickableValues;

		public static ConfigEntry<Vector4> _BarleyWildAmount;

		public static ConfigEntry<Vector4> _FlaxWildAmount;

		public static ConfigEntry<Vector4> _MushroomAmount;

		public static ConfigEntry<Vector4> _MushroomBlueAmount;

		public static ConfigEntry<Vector4> _MushroomYellowAmount;

		public static ConfigEntry<Vector4> _JotunPuffsAmount;

		public static ConfigEntry<Vector4> _MagecapAmount;

		public static ConfigEntry<Vector4> _RoyalJellyAmount;

		public static ConfigEntry<Vector4> _ThistleAmount;

		public static ConfigEntry<Vector4> _DandelionAmount;

		public static ConfigEntry<Vector4> _SeedCarrotAmount;

		public static ConfigEntry<Vector4> _CarrotAmount;

		public static ConfigEntry<Vector4> _SeedTurnipAmount;

		public static ConfigEntry<Vector4> _TurnipAmount;

		public static ConfigEntry<Vector4> _SeedOnionAmount;

		public static ConfigEntry<Vector4> _OnionAmount;

		public static ConfigEntry<Vector4> _BarleyAmount;

		public static ConfigEntry<Vector4> _FlaxAmount;

		public static ConfigEntry<Vector4> _RaspberryBushAmount;

		public static ConfigEntry<Vector4> _BlueberryBushAmount;

		public static ConfigEntry<Vector4> _CloudberryBushAmount;

		public static ConfigEntry<Toggle> _TweakDestructibleValues;

		public static ConfigEntry<Vector4> _GuckSackMinAmount;

		public static ConfigEntry<Vector4> _GuckSackMaxAmount;

		public static ConfigEntry<Vector4> _GuckSackSmallMinAmount;

		public static ConfigEntry<Vector4> _GuckSackSmallMaxAmount;

		public static ConfigEntry<Toggle> _TweakBeeHive;

		public static ConfigEntry<SeasonKeys.Seasons> _BeeHiveSeason;

		public static ConfigEntry<string> _BeeHiveMessage;

		public void Awake()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Invalid comparison between Unknown and I4
			_serverConfigLocked = config("1 - General", "Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only.");
			ConfigSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked);
			workingAsType = (((int)SystemInfo.graphicsDeviceType == 4) ? WorkingAs.Server : WorkingAs.Client);
			InitGeneralConfigs();
			InitPickableConfigs();
			InitDestructibleConfigs();
			InitBeeHiveConfig();
			YamlConfigurations.InitYamlConfigurations();
			YamlConfigurations.InitCustomFileSystemWatch();
			ForagingLoaded = Chainloader.PluginInfos.ContainsKey("org.bepinex.plugins.foraging");
			FarmingLoaded = Chainloader.PluginInfos.ContainsKey("org.bepinex.plugins.farming");
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			_harmony.PatchAll(executingAssembly);
			SetupWatcher();
		}

		public void Start()
		{
			((MonoBehaviour)this).StartCoroutine(UpdatePlugin());
		}

		private IEnumerator UpdatePlugin()
		{
			while (true)
			{
				SeasonKeys.UpdateSeasonalKeys();
				if (YamlConfigurations.UpdatedSyncedData)
				{
					yield return (object)new WaitForSeconds(10f);
				}
				YamlConfigurations.UpdateSyncedData();
				yield return (object)new WaitForSeconds(10f);
			}
		}

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

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

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

		private void InitBeeHiveConfig()
		{
			_TweakBeeHive = config("Bee Hive", "1 - Enable/Disable", Toggle.On, "If on, plugin modifies beehive behavior");
			_BeeHiveSeason = config("Bee Hive", "Allowed Season", (SeasonKeys.Seasons)(Enum.GetValues(typeof(SeasonKeys.Seasons)).Cast<int>().Sum() & -9), "Toggle seasons");
			_BeeHiveMessage = config("Bee Hive", "Not Allowed Message", "Bees do not enjoy this environment", "Message prompted when invalid season");
		}

		private void InitPickableConfigs()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			_TweakPickableValues = config("Pickable Values", "1 - Enabled/Disable", Toggle.On, "If on, plugin modifies pickable amount and respawn time, if any values are set to 0, it uses default vanilla values");
			_BarleyWildAmount = config<Vector4>("Pickable Values", "Wild Barley Amount", new Vector4(2f, 3f, 2f, 2f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_FlaxWildAmount = config<Vector4>("Pickable Values", "Wild Flax Amount", new Vector4(2f, 3f, 2f, 2f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_MushroomAmount = config<Vector4>("Pickable Values", "Mushroom Amount", new Vector4(1f, 1f, 2f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_MushroomBlueAmount = config<Vector4>("Pickable Values", "Blue Mushroom Amount", new Vector4(1f, 1f, 2f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_MushroomYellowAmount = config<Vector4>("Pickable Values", "Yellow Mushroom Amount", new Vector4(1f, 1f, 1f, 2f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_JotunPuffsAmount = config<Vector4>("Pickable Values", "Jotun Puffs Amount", new Vector4(1f, 1f, 1f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_MagecapAmount = config<Vector4>("Pickable Values", "Magecap Amount", new Vector4(1f, 1f, 1f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_RoyalJellyAmount = config<Vector4>("Pickable Values", "Royal Jelly Amount", new Vector4(5f, 5f, 5f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_ThistleAmount = config<Vector4>("Pickable Values", "Thistle Amount", new Vector4(1f, 1f, 2f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_DandelionAmount = config<Vector4>("Pickable Values", "Dandelion Amount", new Vector4(2f, 2f, 1f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_SeedCarrotAmount = config<Vector4>("Pickable Values", "Carrot Seed Amount", new Vector4(2f, 3f, 4f, 3f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_CarrotAmount = config<Vector4>("Pickable Values", "Carrot Amount", new Vector4(2f, 1f, 1f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_SeedTurnipAmount = config<Vector4>("Pickable Values", "Turnip Seed Amount", new Vector4(2f, 3f, 4f, 2f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_TurnipAmount = config<Vector4>("Pickable Values", "Turnip Amount", new Vector4(2f, 1f, 1f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_SeedOnionAmount = config<Vector4>("Pickable Values", "Onion Seed Amount", new Vector4(2f, 3f, 4f, 3f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_OnionAmount = config<Vector4>("Pickable Values", "Onion Amount", new Vector4(2f, 1f, 1f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_BarleyAmount = config<Vector4>("Pickable Values", "Barley Amount", new Vector4(2f, 2f, 3f, 2f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_FlaxAmount = config<Vector4>("Pickable Values", "Flax Amount", new Vector4(2f, 2f, 3f, 2f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_RaspberryBushAmount = config<Vector4>("Pickable Values", "Raspberry Bush Amount", new Vector4(2f, 1f, 1f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_BlueberryBushAmount = config<Vector4>("Pickable Values", "Blueberry Bush Amount", new Vector4(1f, 2f, 1f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_CloudberryBushAmount = config<Vector4>("Pickable Values", "Cloudberry Bush Amount", new Vector4(1f, 1f, 2f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_FishPickableWinter = config("Fish", "Winter Fish Pickable", Toggle.On, "If on, fish are pickable during winter");
			_FishNotPickableMessage = config("Fish", "Fish Frozen Message", "Fish too cold to pickup", "Message displayed when fish not pickable during winter");
		}

		private void InitDestructibleConfigs()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			_TweakDestructibleValues = config("Destructible", "1 - Enable/Disable", Toggle.On, "If on, plugin tweaks destructibles, if value is set to 0, it uses default vanilla values");
			_GuckSackMinAmount = config<Vector4>("Destructible", "Guck Sack Min", new Vector4(2f, 4f, 5f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_GuckSackMaxAmount = config<Vector4>("Destructible", "Guck Sack Max", new Vector4(3f, 5f, 9f, 2f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_GuckSackSmallMinAmount = config<Vector4>("Destructible", "Guck Sack Small Min", new Vector4(2f, 2f, 3f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
			_GuckSackSmallMaxAmount = config<Vector4>("Destructible", "Guck Sack Small Max", new Vector4(3f, 3f, 4f, 1f), "x: Spring, y: Summer, z: Autumn, w: Winter");
		}

		private void InitGeneralConfigs()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			_ModEnabled = config("1 - General", "Plugin Enabled", Toggle.On, "If on, plugin is enabled, if values set to 0, it uses default vanilla values");
			_LevelByPass = config("1 - General", "Season Ignore Level", 50, new ConfigDescription("Required farming or foraging skill to ignore seasons", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			_UseYMLCustomValues = config("1 - General", "Use YML Custom Values", Toggle.Off, "If on, plugin will use yml custom values file to manipulate pickable values");
			_SeasonalItems = config("1 - General", "Seasonal Items", Toggle.Off, "If on, plugin modifies behavior of seasonal items such as Midsummer Crown, Pointy hat and pieces such as JackOLantern and Xmas Tree");
			_TweakFarming = config("Farming", "1 - Enable/Disable", Toggle.On, "If on, plugin tweaks farming");
			_PlantDeniedText = config("Farming", "2 - Deny Message", "Not allowed during this season", "Message displayed when trying to plant during wrong season");
			_FarmingSpring = config("Farming", "Spring", (Farming.PlantTypes)Enum.GetValues(typeof(Farming.PlantTypes)).Cast<int>().Sum(), "Toggle allowed plants to grow");
			_FarmingSummer = config("Farming", "Summer", (Farming.PlantTypes)Enum.GetValues(typeof(Farming.PlantTypes)).Cast<int>().Sum(), "Toggle allowed plants to grow");
			_FarmingFall = config("Farming", "Autumn", (Farming.PlantTypes)Enum.GetValues(typeof(Farming.PlantTypes)).Cast<int>().Sum(), "Toggle allowed plants to grow");
			_FarmingWinter = config("Farming", "Winter", (Farming.PlantTypes)(Enum.GetValues(typeof(Farming.PlantTypes)).Cast<int>().Sum() & -1024), "Toggle allowed plants to grow");
			_PickSpring = config("Pickable", "Spring", (Pickables.PickableTypes)Enum.GetValues(typeof(Pickables.PickableTypes)).Cast<int>().Sum(), "Toggle allowed pickables to pick");
			_PickSummer = config("Pickable", "Summer", (Pickables.PickableTypes)Enum.GetValues(typeof(Pickables.PickableTypes)).Cast<int>().Sum(), "Toggle allowed pickables to pick");
			_PickFall = config("Pickable", "Autumn", (Pickables.PickableTypes)Enum.GetValues(typeof(Pickables.PickableTypes)).Cast<int>().Sum(), "Toggle allowed pickables to pick");
			_PickWinter = config("Pickable", "Winter", (Pickables.PickableTypes)Enum.GetValues(typeof(Pickables.PickableTypes)).Cast<int>().Sum(), "Toggle allowed pickables to pick");
			_PickSpringMessage = config("Pickable", "Spring Message", "Too pretty to pick", "Unable to pick message");
			_PickSummerMessage = config("Pickable", "Summer Message", "Too hot to pick", "Unable to pick message");
			_PickFallMessage = config("Pickable", "Autumn Message", "Too wet to pick", "Unable to pick message");
			_PickWinterMessage = config("Pickable", "Winter Message", "Too cold to pick", "Unable to pick message");
		}

		private ConfigEntry<T> config<[<0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>Nullable(2)] T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags);
			ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val);
			SyncedConfigEntry<T> syncedConfigEntry = ConfigSync.AddConfigEntry<T>(val2);
			syncedConfigEntry.SynchronizedConfig = synchronizedSetting;
			return val2;
		}

		private ConfigEntry<T> config<[<0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>Nullable(2)] T>(string group, string name, T value, string description, bool synchronizedSetting = true)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting);
		}

		static SeasonalTweaksPlugin()
		{
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName;
			ConnectionError = "";
			SeasonalTweaksLogger = Logger.CreateLogSource("SeasonalTweaks");
			ConfigSync = new ConfigSync("RustyMods.SeasonalTweaks")
			{
				DisplayName = "SeasonalTweaks",
				CurrentVersion = "1.1.0",
				MinimumRequiredVersion = "1.1.0"
			};
			_serverConfigLocked = null;
			_ModEnabled = null;
			_LevelByPass = null;
			_SeasonalItems = null;
			_UseYMLCustomValues = null;
			_TweakFarming = null;
			_PlantDeniedText = null;
			_FarmingSpring = null;
			_FarmingSummer = null;
			_FarmingFall = null;
			_FarmingWinter = null;
			_PickSpring = null;
			_PickSummer = null;
			_PickFall = null;
			_PickWinter = null;
			_FishPickableWinter = null;
			_FishNotPickableMessage = null;
			_PickSpringMessage = null;
			_PickSummerMessage = null;
			_PickFallMessage = null;
			_PickWinterMessage = null;
			_TweakPickableValues = null;
			_BarleyWildAmount = null;
			_FlaxWildAmount = null;
			_MushroomAmount = null;
			_MushroomBlueAmount = null;
			_MushroomYellowAmount = null;
			_JotunPuffsAmount = null;
			_MagecapAmount = null;
			_RoyalJellyAmount = null;
			_ThistleAmount = null;
			_DandelionAmount = null;
			_SeedCarrotAmount = null;
			_CarrotAmount = null;
			_SeedTurnipAmount = null;
			_TurnipAmount = null;
			_SeedOnionAmount = null;
			_OnionAmount = null;
			_BarleyAmount = null;
			_FlaxAmount = null;
			_RaspberryBushAmount = null;
			_BlueberryBushAmount = null;
			_CloudberryBushAmount = null;
			_TweakDestructibleValues = null;
			_GuckSackMinAmount = null;
			_GuckSackMaxAmount = null;
			_GuckSackSmallMinAmount = null;
			_GuckSackSmallMaxAmount = null;
			_TweakBeeHive = null;
			_BeeHiveSeason = null;
			_BeeHiveMessage = null;
		}
	}
	public static class SeasonalFlags
	{
		public static bool HasFlagFast(this SeasonKeys.Seasons value, SeasonKeys.Seasons flag)
		{
			return (value & flag) != 0;
		}
	}
	public static class FarmingFlags
	{
		public static bool HasFlagFast(this Farming.PlantTypes value, Farming.PlantTypes flag)
		{
			return (value & flag) != 0;
		}
	}
	public static class PickableFlags
	{
		public static bool HasFlagFast(this Pickables.PickableTypes value, Pickables.PickableTypes flag)
		{
			return (value & flag) != 0;
		}
	}
	[HarmonyPatch(typeof(ZNet), "OnNewConnection")]
	public static class RegisterAndCheckVersion
	{
		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
		private static void Prefix(ZNetPeer peer, ref ZNet __instance)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			SeasonalTweaksPlugin.SeasonalTweaksLogger.LogDebug((object)"Registering version RPC handler");
			peer.m_rpc.Register<ZPackage>("SeasonalTweaks_VersionCheck", (Action<ZRpc, ZPackage>)RpcHandlers.RPC_SeasonalTweaks_Version);
			SeasonalTweaksPlugin.SeasonalTweaksLogger.LogInfo((object)"Invoking version check");
			ZPackage val = new ZPackage();
			val.Write("1.1.0");
			val.Write(RpcHandlers.ComputeHashForMod().Replace("-", ""));
			peer.m_rpc.Invoke("SeasonalTweaks_VersionCheck", new object[1] { val });
		}
	}
	[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
	[<0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>Nullable(0)]
	[HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")]
	public static class VerifyClient
	{
		private static bool Prefix(ZRpc rpc, ZPackage pkg, ref ZNet __instance)
		{
			if (!__instance.IsServer() || RpcHandlers.ValidatedPeers.Contains(rpc))
			{
				return true;
			}
			SeasonalTweaksPlugin.SeasonalTweaksLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") never sent version or couldn't due to previous disconnect, disconnecting"));
			rpc.Invoke("Error", new object[1] { 3 });
			return false;
		}

		private static void Postfix(ZNet __instance)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "SeasonalTweaksRequestAdminSync", new object[1] { (object)new ZPackage() });
		}
	}
	[HarmonyPatch(typeof(FejdStartup), "ShowConnectError")]
	public class ShowConnectionError
	{
		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
		private static void Postfix(FejdStartup __instance)
		{
			if (__instance.m_connectionFailedPanel.activeSelf)
			{
				__instance.m_connectionFailedError.fontSizeMax = 25f;
				__instance.m_connectionFailedError.fontSizeMin = 15f;
				TMP_Text connectionFailedError = __instance.m_connectionFailedError;
				connectionFailedError.text = connectionFailedError.text + "\n" + SeasonalTweaksPlugin.ConnectionError;
			}
		}
	}
	[HarmonyPatch(typeof(ZNet), "Disconnect")]
	public static class RemoveDisconnectedPeerFromVerified
	{
		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
		private static void Prefix(ZNetPeer peer, ref ZNet __instance)
		{
			if (__instance.IsServer())
			{
				SeasonalTweaksPlugin.SeasonalTweaksLogger.LogInfo((object)("Peer (" + peer.m_rpc.m_socket.GetHostName() + ") disconnected, removing from validated list"));
				RpcHandlers.ValidatedPeers.Remove(peer.m_rpc);
			}
		}
	}
	[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
	[<0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>Nullable(0)]
	public static class RpcHandlers
	{
		public static readonly List<ZRpc> ValidatedPeers = new List<ZRpc>();

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

		public static string ComputeHashForMod()
		{
			using SHA256 sHA = SHA256.Create();
			byte[] array = sHA.ComputeHash(File.ReadAllBytes(Assembly.GetExecutingAssembly().Location));
			StringBuilder stringBuilder = new StringBuilder();
			byte[] array2 = array;
			foreach (byte b in array2)
			{
				stringBuilder.Append(b.ToString("X2"));
			}
			return stringBuilder.ToString();
		}
	}
}
namespace SeasonalTweaks.Tweaks
{
	public static class BeeHivePatch
	{
		[HarmonyPatch(typeof(Beehive), "Interact")]
		private static class SeasonBeeHive
		{
			[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
			private static bool Prefix(Beehive __instance, Humanoid character)
			{
				if (!Object.op_Implicit((Object)(object)__instance))
				{
					return false;
				}
				string text = Regex.Replace(((Object)__instance).name, "\\(.*?\\)", "");
				if (text != "piece_beehive")
				{
					return true;
				}
				if (SeasonalTweaksPlugin._TweakBeeHive.Value == SeasonalTweaksPlugin.Toggle.Off)
				{
					return true;
				}
				if (SeasonalTweaksPlugin._BeeHiveSeason.Value.HasFlagFast(SeasonKeys.season))
				{
					return true;
				}
				((Character)character).Message((MessageType)2, SeasonalTweaksPlugin._BeeHiveMessage.Value, 0, (Sprite)null);
				return false;
			}
		}

		[HarmonyPatch(typeof(Beehive), "UpdateBees")]
		private static class UpdateBeesPatch
		{
			[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
			private static bool Prefix(Beehive __instance)
			{
				if (!Object.op_Implicit((Object)(object)__instance))
				{
					return false;
				}
				string text = Regex.Replace(((Object)__instance).name, "\\(.*?\\)", "");
				if (text != "piece_beehive")
				{
					return true;
				}
				return SeasonalTweaksPlugin._TweakBeeHive.Value == SeasonalTweaksPlugin.Toggle.Off || SeasonalTweaksPlugin._BeeHiveSeason.Value.HasFlagFast(SeasonKeys.season);
			}
		}
	}
	public static class Destructible
	{
		private enum DestructibleTypes
		{
			None,
			GuckSackSmall,
			GuckSack
		}

		[HarmonyPatch(typeof(DropOnDestroyed), "Awake")]
		private static class SaveDefaultDropOnDestroyedValues
		{
			[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
			private static void Prefix(DropOnDestroyed __instance)
			{
				if (Object.op_Implicit((Object)(object)__instance) && SeasonalTweaksPlugin._ModEnabled.Value != 0)
				{
					DestructibleTypes destructibleType = GetDestructibleType(((Object)__instance).name);
					if (destructibleType != 0)
					{
						int dropMin = __instance.m_dropWhenDestroyed.m_dropMin;
						int dropMax = __instance.m_dropWhenDestroyed.m_dropMax;
						DestructibleDefaultValues[destructibleType] = new int[2] { dropMin, dropMax };
					}
				}
			}
		}

		[HarmonyPatch(typeof(DropOnDestroyed), "OnDestroyed")]
		private static class ModifyDropOnDestroyValues
		{
			[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
			private static void Prefix(DropOnDestroyed __instance)
			{
				if (Object.op_Implicit((Object)(object)__instance) && SeasonalTweaksPlugin._ModEnabled.Value != 0)
				{
					DestructibleTypes destructibleType = GetDestructibleType(((Object)__instance).name);
					if (destructibleType != 0)
					{
						SetDestructibleValues(destructibleType, __instance);
					}
				}
			}
		}

		[<0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>Nullable(1)]
		private static readonly Dictionary<DestructibleTypes, int[]> DestructibleDefaultValues = new Dictionary<DestructibleTypes, int[]>();

		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
		private static DestructibleTypes GetDestructibleType(string prefabName)
		{
			string text = Regex.Replace(prefabName, "\\(.*?\\)", "");
			if (1 == 0)
			{
			}
			DestructibleTypes result = ((text == "GuckSack_small") ? DestructibleTypes.GuckSackSmall : ((text == "GuckSack") ? DestructibleTypes.GuckSack : DestructibleTypes.None));
			if (1 == 0)
			{
			}
			return result;
		}

		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
		private static void SetDestructibleValues(DestructibleTypes type, DropOnDestroyed __instance)
		{
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: 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_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			int num = DestructibleDefaultValues[type][0];
			int num2 = DestructibleDefaultValues[type][1];
			bool flag = SeasonalTweaksPlugin._ModEnabled.Value == SeasonalTweaksPlugin.Toggle.On && SeasonalTweaksPlugin._TweakDestructibleValues.Value == SeasonalTweaksPlugin.Toggle.On;
			switch (type)
			{
			case DestructibleTypes.GuckSack:
				switch (SeasonKeys.season)
				{
				case SeasonKeys.Seasons.Spring:
					__instance.m_dropWhenDestroyed.m_dropMin = ((flag && (int)SeasonalTweaksPlugin._GuckSackMinAmount.Value.x != 0) ? ((int)SeasonalTweaksPlugin._GuckSackMinAmount.Value.x) : num);
					__instance.m_dropWhenDestroyed.m_dropMax = ((flag && (int)SeasonalTweaksPlugin._GuckSackMaxAmount.Value.x != 0) ? ((int)SeasonalTweaksPlugin._GuckSackMaxAmount.Value.x) : num2);
					break;
				case SeasonKeys.Seasons.Summer:
					__instance.m_dropWhenDestroyed.m_dropMin = ((flag && (int)SeasonalTweaksPlugin._GuckSackMinAmount.Value.y != 0) ? ((int)SeasonalTweaksPlugin._GuckSackMinAmount.Value.y) : num);
					__instance.m_dropWhenDestroyed.m_dropMax = ((flag && (int)SeasonalTweaksPlugin._GuckSackMaxAmount.Value.y != 0) ? ((int)SeasonalTweaksPlugin._GuckSackMaxAmount.Value.y) : num2);
					break;
				case SeasonKeys.Seasons.Fall:
					__instance.m_dropWhenDestroyed.m_dropMin = ((flag && (int)SeasonalTweaksPlugin._GuckSackMinAmount.Value.z != 0) ? ((int)SeasonalTweaksPlugin._GuckSackMinAmount.Value.z) : num);
					__instance.m_dropWhenDestroyed.m_dropMax = ((flag && (int)SeasonalTweaksPlugin._GuckSackMaxAmount.Value.z != 0) ? ((int)SeasonalTweaksPlugin._GuckSackMaxAmount.Value.z) : num2);
					break;
				case SeasonKeys.Seasons.Winter:
					__instance.m_dropWhenDestroyed.m_dropMin = ((flag && (int)SeasonalTweaksPlugin._GuckSackMinAmount.Value.w != 0) ? ((int)SeasonalTweaksPlugin._GuckSackMinAmount.Value.w) : num);
					__instance.m_dropWhenDestroyed.m_dropMax = ((flag && (int)SeasonalTweaksPlugin._GuckSackMaxAmount.Value.w != 0) ? ((int)SeasonalTweaksPlugin._GuckSackMaxAmount.Value.w) : num2);
					break;
				}
				break;
			case DestructibleTypes.GuckSackSmall:
				switch (SeasonKeys.season)
				{
				case SeasonKeys.Seasons.Spring:
					__instance.m_dropWhenDestroyed.m_dropMin = ((flag && (int)SeasonalTweaksPlugin._GuckSackSmallMinAmount.Value.x != 0) ? ((int)SeasonalTweaksPlugin._GuckSackSmallMinAmount.Value.x) : num);
					__instance.m_dropWhenDestroyed.m_dropMax = ((flag && (int)SeasonalTweaksPlugin._GuckSackSmallMaxAmount.Value.x != 0) ? ((int)SeasonalTweaksPlugin._GuckSackSmallMaxAmount.Value.x) : num2);
					break;
				case SeasonKeys.Seasons.Summer:
					__instance.m_dropWhenDestroyed.m_dropMin = ((flag && (int)SeasonalTweaksPlugin._GuckSackSmallMinAmount.Value.y != 0) ? ((int)SeasonalTweaksPlugin._GuckSackSmallMinAmount.Value.y) : num);
					__instance.m_dropWhenDestroyed.m_dropMax = ((flag && (int)SeasonalTweaksPlugin._GuckSackSmallMaxAmount.Value.y != 0) ? ((int)SeasonalTweaksPlugin._GuckSackSmallMaxAmount.Value.y) : num2);
					break;
				case SeasonKeys.Seasons.Fall:
					__instance.m_dropWhenDestroyed.m_dropMin = ((flag && (int)SeasonalTweaksPlugin._GuckSackSmallMinAmount.Value.z != 0) ? ((int)SeasonalTweaksPlugin._GuckSackSmallMinAmount.Value.z) : num);
					__instance.m_dropWhenDestroyed.m_dropMax = ((flag && (int)SeasonalTweaksPlugin._GuckSackSmallMaxAmount.Value.z != 0) ? ((int)SeasonalTweaksPlugin._GuckSackSmallMaxAmount.Value.z) : num2);
					break;
				case SeasonKeys.Seasons.Winter:
					__instance.m_dropWhenDestroyed.m_dropMin = ((flag && (int)SeasonalTweaksPlugin._GuckSackSmallMinAmount.Value.w != 0) ? ((int)SeasonalTweaksPlugin._GuckSackSmallMinAmount.Value.w) : num);
					__instance.m_dropWhenDestroyed.m_dropMax = ((flag && (int)SeasonalTweaksPlugin._GuckSackSmallMaxAmount.Value.w != 0) ? ((int)SeasonalTweaksPlugin._GuckSackSmallMaxAmount.Value.w) : num2);
					break;
				}
				break;
			}
		}
	}
	public static class Farming
	{
		[Flags]
		public enum PlantTypes
		{
			None = 0,
			Carrot = 1,
			CarrotSeed = 2,
			Turnip = 4,
			TurnipSeed = 8,
			Onion = 0x10,
			OnionSeed = 0x20,
			Barley = 0x40,
			Flax = 0x80,
			JotunPuff = 0x100,
			Magecap = 0x200
		}

		[HarmonyPatch(typeof(Plant), "UpdateHealth")]
		private static class SeasonPlantUpdateHealth
		{
			[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
			private static bool Prefix(Plant __instance)
			{
				//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
				//IL_014b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0186: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)__instance))
				{
					return false;
				}
				if (SeasonalTweaksPlugin._ModEnabled.Value == SeasonalTweaksPlugin.Toggle.Off || SeasonalTweaksPlugin._TweakFarming.Value == SeasonalTweaksPlugin.Toggle.Off)
				{
					return true;
				}
				PlantTypes plantType = GetPlantType(((Object)__instance).name);
				if (plantType == PlantTypes.None)
				{
					return CheckCustomPrefabs(__instance);
				}
				float farmingSkillLevel = GetSkillLevel.GetFarmingSkillLevel();
				switch (SeasonKeys.season)
				{
				case SeasonKeys.Seasons.Spring:
					if (SeasonalTweaksPlugin._FarmingSpring.Value.HasFlagFast(plantType) || farmingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
					{
						return true;
					}
					__instance.m_status = (Status)3;
					return false;
				case SeasonKeys.Seasons.Summer:
					if (SeasonalTweaksPlugin._FarmingSummer.Value.HasFlagFast(plantType) || farmingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
					{
						return true;
					}
					__instance.m_status = (Status)3;
					return false;
				case SeasonKeys.Seasons.Fall:
					if (SeasonalTweaksPlugin._FarmingFall.Value.HasFlagFast(plantType) || farmingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
					{
						return true;
					}
					__instance.m_status = (Status)3;
					return false;
				case SeasonKeys.Seasons.Winter:
					if (SeasonalTweaksPlugin._FarmingWinter.Value.HasFlagFast(plantType) || farmingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
					{
						return true;
					}
					__instance.m_status = (Status)3;
					return false;
				default:
					return true;
				}
			}
		}

		[HarmonyPatch(typeof(Player), "PlacePiece")]
		private static class PlayerPlacePiecePatch
		{
			[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
			private static bool Prefix(Player __instance, Piece piece)
			{
				if (!Object.op_Implicit((Object)(object)__instance) || !Object.op_Implicit((Object)(object)piece))
				{
					return false;
				}
				if (SeasonalTweaksPlugin._ModEnabled.Value == SeasonalTweaksPlugin.Toggle.Off || SeasonalTweaksPlugin._TweakFarming.Value == SeasonalTweaksPlugin.Toggle.Off)
				{
					return true;
				}
				PlantTypes plantType = GetPlantType(((Object)piece).name);
				if (plantType == PlantTypes.None)
				{
					if (CheckCustomPrefabs(piece))
					{
						return true;
					}
					((Character)__instance).Message((MessageType)2, SeasonalTweaksPlugin._PlantDeniedText.Value, 0, (Sprite)null);
					return false;
				}
				float farmingSkillLevel = GetSkillLevel.GetFarmingSkillLevel();
				switch (SeasonKeys.season)
				{
				case SeasonKeys.Seasons.Spring:
					if (SeasonalTweaksPlugin._FarmingSpring.Value.HasFlagFast(plantType) || farmingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
					{
						return true;
					}
					((Character)__instance).Message((MessageType)2, SeasonalTweaksPlugin._PlantDeniedText.Value, 0, (Sprite)null);
					return false;
				case SeasonKeys.Seasons.Summer:
					if (SeasonalTweaksPlugin._FarmingSummer.Value.HasFlagFast(plantType) || farmingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
					{
						return true;
					}
					((Character)__instance).Message((MessageType)2, SeasonalTweaksPlugin._PlantDeniedText.Value, 0, (Sprite)null);
					return false;
				case SeasonKeys.Seasons.Fall:
					if (SeasonalTweaksPlugin._FarmingFall.Value.HasFlagFast(plantType) || farmingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
					{
						return true;
					}
					((Character)__instance).Message((MessageType)2, SeasonalTweaksPlugin._PlantDeniedText.Value, 0, (Sprite)null);
					return false;
				case SeasonKeys.Seasons.Winter:
					if (SeasonalTweaksPlugin._FarmingWinter.Value.HasFlagFast(plantType) || farmingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
					{
						return true;
					}
					((Character)__instance).Message((MessageType)2, SeasonalTweaksPlugin._PlantDeniedText.Value, 0, (Sprite)null);
					return false;
				default:
					return true;
				}
			}
		}

		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
		private static PlantTypes GetPlantType(string prefabName)
		{
			string text = Regex.Replace(prefabName, "\\(.*?\\)", "");
			if (1 == 0)
			{
			}
			PlantTypes result = text switch
			{
				"sapling_seedonion" => PlantTypes.OnionSeed, 
				"sapling_onion" => PlantTypes.Onion, 
				"sapling_turnip" => PlantTypes.Turnip, 
				"sapling_seedturnip" => PlantTypes.TurnipSeed, 
				"sapling_carrot" => PlantTypes.Carrot, 
				"sapling_seedcarrot" => PlantTypes.CarrotSeed, 
				"sapling_barley" => PlantTypes.Barley, 
				"sapling_flax" => PlantTypes.Flax, 
				"sapling_jotunpuffs" => PlantTypes.JotunPuff, 
				"sapling_magecap" => PlantTypes.Magecap, 
				_ => PlantTypes.None, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
		private static bool CheckCustomPrefabs(Plant instance)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				string item = Regex.Replace(((Object)instance).name, "\\(.*?\\)", "");
				if (GetSkillLevel.GetFarmingSkillLevel() >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
				{
					return true;
				}
				if (!YamlConfigurations.CustomData.TryGetValue(SeasonKeys.currentSeason, out var value))
				{
					return true;
				}
				if (!value.Contains(item))
				{
					return true;
				}
				instance.m_status = (Status)3;
				return false;
			}
			catch (Exception)
			{
				return true;
			}
		}

		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
		private static bool CheckCustomPrefabs(Piece instance)
		{
			try
			{
				string item = Regex.Replace(((Object)instance).name, "\\(.*?\\)", "");
				if (GetSkillLevel.GetFarmingSkillLevel() >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
				{
					return true;
				}
				if (!YamlConfigurations.CustomData.TryGetValue(SeasonKeys.currentSeason, out var value))
				{
					return true;
				}
				if (!value.Contains(item))
				{
					return true;
				}
				return false;
			}
			catch (Exception)
			{
				return true;
			}
		}
	}
	public static class Fish
	{
		[HarmonyPatch(typeof(ItemDrop), "Pickup")]
		private static class ItemDropPickup
		{
			[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
			private static bool Prefix(ItemDrop __instance)
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Invalid comparison between Unknown and I4
				if (!Object.op_Implicit((Object)(object)__instance))
				{
					return false;
				}
				if ((int)__instance.m_itemData.m_shared.m_itemType != 21)
				{
					return true;
				}
				if (SeasonalTweaksPlugin._FishPickableWinter.Value == SeasonalTweaksPlugin.Toggle.On)
				{
					return true;
				}
				if (SeasonKeys.season == SeasonKeys.Seasons.Winter)
				{
					((Character)Player.m_localPlayer).Message((MessageType)2, SeasonalTweaksPlugin._FishNotPickableMessage.Value, 0, (Sprite)null);
					return false;
				}
				return true;
			}
		}
	}
	public static class GetSkillLevel
	{
		public static float GetFarmingSkillLevel()
		{
			//IL_003f: 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)
			if (!SeasonalTweaksPlugin.FarmingLoaded)
			{
				return 0f;
			}
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return 0f;
			}
			SkillType val = (SkillType)Math.Abs(StringExtensionMethods.GetStableHashCode("Farming"));
			return ((Character)Player.m_localPlayer).GetSkillLevel(val);
		}

		public static float GetForagingSkillLevel()
		{
			//IL_003f: 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)
			if (!SeasonalTweaksPlugin.ForagingLoaded)
			{
				return 0f;
			}
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return 0f;
			}
			SkillType val = (SkillType)Math.Abs(StringExtensionMethods.GetStableHashCode("Foraging"));
			return ((Character)Player.m_localPlayer).GetSkillLevel(val);
		}
	}
	[<0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>Nullable(0)]
	[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
	public static class Pickables
	{
		[Flags]
		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(0)]
		public enum PickableTypes
		{
			None = 0,
			BarleyWild = 1,
			FlaxWild = 2,
			Mushroom = 4,
			MushroomBlue = 8,
			MushroomYellow = 0x10,
			JotunPuffs = 0x20,
			Magecap = 0x40,
			RoyalJelly = 0x80,
			Thistle = 0x100,
			Dandelion = 0x200,
			SeedCarrot = 0x400,
			Carrot = 0x800,
			SeedTurnip = 0x1000,
			Turnip = 0x2000,
			SeedOnion = 0x4000,
			Onion = 0x8000,
			Barley = 0x10000,
			Flax = 0x20000,
			RaspberryBush = 0x40000,
			BlueberryBush = 0x80000,
			CloudberryBush = 0x100000
		}

		[HarmonyPatch(typeof(Pickable), "Awake")]
		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(0)]
		private static class GetDefaultPickableValues
		{
			[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
			private static void Postfix(Pickable __instance)
			{
				if (Object.op_Implicit((Object)(object)__instance))
				{
					PickableTypes pickableType = GetPickableType(((Object)__instance).name);
					if (pickableType != 0)
					{
						int amount = __instance.m_amount;
						float respawnTimeMinutes = __instance.m_respawnTimeMinutes;
						DefaultPickableValues[pickableType] = new float[2] { amount, respawnTimeMinutes };
					}
				}
			}
		}

		[<0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>Nullable(0)]
		[HarmonyPatch(typeof(Pickable), "Interact")]
		private static class SeasonPickableInteract
		{
			private static bool Prefix(Pickable __instance, Humanoid character)
			{
				if (!__instance.m_nview.IsValid())
				{
					return false;
				}
				if (SeasonalTweaksPlugin._ModEnabled.Value == SeasonalTweaksPlugin.Toggle.Off)
				{
					return true;
				}
				PickableTypes pickableType = GetPickableType(((Object)__instance).name);
				float farmingSkillLevel = GetSkillLevel.GetFarmingSkillLevel();
				float foragingSkillLevel = GetSkillLevel.GetForagingSkillLevel();
				if (pickableType == PickableTypes.None)
				{
					bool flag = CheckCustomData(__instance, character);
					if (SeasonalTweaksPlugin._UseYMLCustomValues.Value == SeasonalTweaksPlugin.Toggle.On && flag)
					{
						ModifyPickableValues(__instance);
					}
					return flag;
				}
				switch (SeasonKeys.season)
				{
				case SeasonKeys.Seasons.Spring:
					if (SeasonalTweaksPlugin._PickSpring.Value.HasFlagFast(pickableType) || farmingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value || foragingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
					{
						return SetValueByType(pickableType, __instance, SeasonKeys.season);
					}
					((Character)character).Message((MessageType)2, SeasonalTweaksPlugin._PickSpringMessage.Value, 0, (Sprite)null);
					return false;
				case SeasonKeys.Seasons.Summer:
					if (SeasonalTweaksPlugin._PickSummer.Value.HasFlagFast(pickableType) || farmingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value || foragingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
					{
						return SetValueByType(pickableType, __instance, SeasonKeys.season);
					}
					((Character)character).Message((MessageType)2, SeasonalTweaksPlugin._PickSummerMessage.Value, 0, (Sprite)null);
					return false;
				case SeasonKeys.Seasons.Fall:
					if (SeasonalTweaksPlugin._PickFall.Value.HasFlagFast(pickableType) || farmingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value || foragingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
					{
						return SetValueByType(pickableType, __instance, SeasonKeys.season);
					}
					((Character)character).Message((MessageType)2, SeasonalTweaksPlugin._PickFallMessage.Value, 0, (Sprite)null);
					return false;
				case SeasonKeys.Seasons.Winter:
					if (SeasonalTweaksPlugin._PickWinter.Value.HasFlagFast(pickableType) || farmingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value || foragingSkillLevel >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
					{
						return SetValueByType(pickableType, __instance, SeasonKeys.season);
					}
					((Character)character).Message((MessageType)2, SeasonalTweaksPlugin._PickWinterMessage.Value, 0, (Sprite)null);
					return false;
				default:
					return true;
				}
			}

			private static bool CheckCustomData(Pickable instance, Humanoid character)
			{
				try
				{
					string item = Regex.Replace(((Object)instance).name, "\\(.*?\\)", "");
					if (GetSkillLevel.GetFarmingSkillLevel() >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
					{
						return true;
					}
					if (GetSkillLevel.GetForagingSkillLevel() >= (float)SeasonalTweaksPlugin._LevelByPass.Value)
					{
						return true;
					}
					if (!YamlConfigurations.CustomData.TryGetValue(SeasonKeys.currentSeason, out var value))
					{
						return true;
					}
					if (!value.Contains(item))
					{
						return true;
					}
					switch (SeasonKeys.season)
					{
					case SeasonKeys.Seasons.Spring:
						((Character)character).Message((MessageType)2, SeasonalTweaksPlugin._PickSpringMessage.Value, 0, (Sprite)null);
						break;
					case SeasonKeys.Seasons.Summer:
						((Character)character).Message((MessageType)2, SeasonalTweaksPlugin._PickSummerMessage.Value, 0, (Sprite)null);
						break;
					case SeasonKeys.Seasons.Fall:
						((Character)character).Message((MessageType)2, SeasonalTweaksPlugin._PickFallMessage.Value, 0, (Sprite)null);
						break;
					case SeasonKeys.Seasons.Winter:
						((Character)character).Message((MessageType)2, SeasonalTweaksPlugin._PickWinterMessage.Value, 0, (Sprite)null);
						break;
					}
					return false;
				}
				catch (Exception)
				{
					return true;
				}
			}

			private static bool SetValueByType(PickableTypes type, Pickable __instance, SeasonKeys.Seasons season)
			{
				//IL_0c23: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c3d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c57: Unknown result type (might be due to invalid IL or missing references)
				//IL_022d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0247: Unknown result type (might be due to invalid IL or missing references)
				//IL_0261: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a61: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a7b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a95: Unknown result type (might be due to invalid IL or missing references)
				//IL_0935: Unknown result type (might be due to invalid IL or missing references)
				//IL_094f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0969: Unknown result type (might be due to invalid IL or missing references)
				//IL_0773: Unknown result type (might be due to invalid IL or missing references)
				//IL_078d: Unknown result type (might be due to invalid IL or missing references)
				//IL_07a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0647: Unknown result type (might be due to invalid IL or missing references)
				//IL_0661: Unknown result type (might be due to invalid IL or missing references)
				//IL_067b: Unknown result type (might be due to invalid IL or missing references)
				//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0197: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0359: Unknown result type (might be due to invalid IL or missing references)
				//IL_0373: Unknown result type (might be due to invalid IL or missing references)
				//IL_038d: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_0409: Unknown result type (might be due to invalid IL or missing references)
				//IL_0423: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c71: Unknown result type (might be due to invalid IL or missing references)
				//IL_0cb9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0cd3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ced: Unknown result type (might be due to invalid IL or missing references)
				//IL_027b: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0aaf: Unknown result type (might be due to invalid IL or missing references)
				//IL_0af7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b11: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b2b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0983: Unknown result type (might be due to invalid IL or missing references)
				//IL_09cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_09e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_09ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_07c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0809: Unknown result type (might be due to invalid IL or missing references)
				//IL_0823: Unknown result type (might be due to invalid IL or missing references)
				//IL_083d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0695: Unknown result type (might be due to invalid IL or missing references)
				//IL_06dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_06f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0711: Unknown result type (might be due to invalid IL or missing references)
				//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_051b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0535: Unknown result type (might be due to invalid IL or missing references)
				//IL_054f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_043d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0485: Unknown result type (might be due to invalid IL or missing references)
				//IL_049f: Unknown result type (might be due to invalid IL or missing references)
				//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d07: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d4f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d69: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d83: Unknown result type (might be due to invalid IL or missing references)
				//IL_0311: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b45: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b8d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ba7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0bc1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a19: Unknown result type (might be due to invalid IL or missing references)
				//IL_0857: Unknown result type (might be due to invalid IL or missing references)
				//IL_089f: Unknown result type (might be due to invalid IL or missing references)
				//IL_08b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_08d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_072b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0569: Unknown result type (might be due to invalid IL or missing references)
				//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d9d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0bdb: Unknown result type (might be due to invalid IL or missing references)
				//IL_08ed: Unknown result type (might be due to invalid IL or missing references)
				if (SeasonalTweaksPlugin._UseYMLCustomValues.Value == SeasonalTweaksPlugin.Toggle.On)
				{
					ModifyPickableValues(__instance);
					return true;
				}
				switch (type)
				{
				case PickableTypes.BarleyWild:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._BarleyWildAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._BarleyWildAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._BarleyWildAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._BarleyWildAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.Barley:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._BarleyAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._BarleyAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._BarleyAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._BarleyAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.Flax:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._FlaxAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._FlaxAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._FlaxAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._FlaxAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.FlaxWild:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._FlaxWildAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._FlaxWildAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._FlaxWildAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._FlaxWildAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.Mushroom:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MushroomAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MushroomAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MushroomAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MushroomAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.MushroomBlue:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MushroomBlueAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MushroomBlueAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MushroomBlueAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MushroomBlueAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.JotunPuffs:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._JotunPuffsAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._JotunPuffsAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._JotunPuffsAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._JotunPuffsAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.MushroomYellow:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MushroomYellowAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MushroomYellowAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MushroomYellowAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MushroomYellowAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.Magecap:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MagecapAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MagecapAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MagecapAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._MagecapAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.RoyalJelly:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._RoyalJellyAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._RoyalJellyAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._RoyalJellyAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._RoyalJellyAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.Thistle:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._ThistleAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._ThistleAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._ThistleAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._ThistleAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.Dandelion:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._DandelionAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._DandelionAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._DandelionAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._DandelionAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.SeedCarrot:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._SeedCarrotAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._SeedCarrotAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._SeedCarrotAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._SeedCarrotAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.Carrot:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._CarrotAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._CarrotAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._CarrotAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._CarrotAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.SeedTurnip:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._SeedTurnipAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._SeedTurnipAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._SeedTurnipAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._SeedTurnipAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.Turnip:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._TurnipAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._TurnipAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._TurnipAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._TurnipAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.SeedOnion:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._SeedOnionAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._SeedOnionAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._SeedOnionAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._SeedOnionAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.Onion:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._OnionAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._OnionAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._OnionAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._OnionAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.RaspberryBush:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._RaspberryBushAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._RaspberryBushAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._RaspberryBushAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._RaspberryBushAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.BlueberryBush:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._BlueberryBushAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._BlueberryBushAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._BlueberryBushAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._BlueberryBushAmount.Value.w, type);
						break;
					}
					break;
				case PickableTypes.CloudberryBush:
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._CloudberryBushAmount.Value.x, type);
						break;
					case SeasonKeys.Seasons.Summer:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._CloudberryBushAmount.Value.y, type);
						break;
					case SeasonKeys.Seasons.Fall:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._CloudberryBushAmount.Value.z, type);
						break;
					case SeasonKeys.Seasons.Winter:
						SetPickableValues(__instance, (int)SeasonalTweaksPlugin._CloudberryBushAmount.Value.w, type);
						break;
					}
					break;
				}
				return true;
			}

			private static void ModifyPickableValues(Pickable instance)
			{
				if (!Object.op_Implicit((Object)(object)instance.m_itemPrefab))
				{
					return;
				}
				string name = ((Object)instance.m_itemPrefab).name;
				YamlConfigurations.PickableValueConfigurations pickableValueConfigurations = YamlConfigurations.customPickableData.Find((YamlConfigurations.PickableValueConfigurations x) => x.prefab_name == name);
				if (pickableValueConfigurations != null)
				{
					SeasonKeys.Seasons season = SeasonKeys.season;
					int amount = instance.m_amount;
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						amount = pickableValueConfigurations.spring_amount;
						break;
					case SeasonKeys.Seasons.Summer:
						amount = pickableValueConfigurations.summer_amount;
						break;
					case SeasonKeys.Seasons.Fall:
						amount = pickableValueConfigurations.fall_amount;
						break;
					case SeasonKeys.Seasons.Winter:
						amount = pickableValueConfigurations.winter_amount;
						break;
					}
					instance.m_amount = amount;
					float respawnTimeMinutes = instance.m_respawnTimeMinutes;
					switch (season)
					{
					case SeasonKeys.Seasons.Spring:
						respawnTimeMinutes = pickableValueConfigurations.spring_respawn_time;
						break;
					case SeasonKeys.Seasons.Summer:
						respawnTimeMinutes = pickableValueConfigurations.summer_respawn_time;
						break;
					case SeasonKeys.Seasons.Fall:
						respawnTimeMinutes = pickableValueConfigurations.fall_respawn_time;
						break;
					case SeasonKeys.Seasons.Winter:
						respawnTimeMinutes = pickableValueConfigurations.winter_respawn_time;
						break;
					}
					instance.m_respawnTimeMinutes = respawnTimeMinutes;
				}
			}
		}

		private static readonly Dictionary<PickableTypes, float[]> DefaultPickableValues = new Dictionary<PickableTypes, float[]>();

		private static PickableTypes GetPickableType(string prefabName)
		{
			string text = Regex.Replace(prefabName, "\\(.*?\\)", "");
			if (1 == 0)
			{
			}
			PickableTypes result = text switch
			{
				"Pickable_Barley_Wild" => PickableTypes.BarleyWild, 
				"Pickable_Flax_Wild" => PickableTypes.FlaxWild, 
				"Pickable_Mushroom" => PickableTypes.Mushroom, 
				"Pickable_Mushroom_blue" => PickableTypes.MushroomBlue, 
				"Pickable_Mushroom_yellow" => PickableTypes.MushroomYellow, 
				"Pickable_Mushroom_JotunPuffs" => PickableTypes.JotunPuffs, 
				"Pickable_Mushroom_Magecap" => PickableTypes.Magecap, 
				"Pickable_RoyalJelly" => PickableTypes.RoyalJelly, 
				"Pickable_Thistle" => PickableTypes.Thistle, 
				"Pickable_Dandelion" => PickableTypes.Dandelion, 
				"Pickable_Carrot" => PickableTypes.Carrot, 
				"Pickable_SeedCarrot" => PickableTypes.SeedCarrot, 
				"Pickable_Turnip" => PickableTypes.Turnip, 
				"Pickable_SeedTurnip" => PickableTypes.SeedTurnip, 
				"Pickable_Onion" => PickableTypes.Onion, 
				"Pickable_SeedOnion" => PickableTypes.SeedOnion, 
				"Pickable_Barley" => PickableTypes.Barley, 
				"Pickable_Flax" => PickableTypes.Flax, 
				"RaspberryBush" => PickableTypes.RaspberryBush, 
				"BlueberryBush" => PickableTypes.BlueberryBush, 
				"CloudberryBush" => PickableTypes.CloudberryBush, 
				_ => PickableTypes.None, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		private static void SetPickableValues(Pickable __instance, int amount, PickableTypes type)
		{
			__instance.m_amount = ((SeasonalTweaksPlugin._TweakPickableValues.Value == SeasonalTweaksPlugin.Toggle.On && amount != 0) ? amount : ((int)DefaultPickableValues[type][0]));
		}
	}
	[<0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>Nullable(0)]
	[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
	public static class SeasonalItems
	{
		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(0)]
		private static class CacheGameObject
		{
			[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
			private static void Postfix(ZNetScene __instance)
			{
				if (Object.op_Implicit((Object)(object)__instance))
				{
					Hammer = __instance.GetPrefab("Hammer");
					JackOTurnip = __instance.GetPrefab("piece_jackoturnip");
					MayPole = __instance.GetPrefab("piece_maypole");
					XmasCrown = __instance.GetPrefab("piece_xmascrown");
					XmasGarland = __instance.GetPrefab("piece_xmasgarland");
					XmasTree = __instance.GetPrefab("piece_xmastree");
					Gift1 = __instance.GetPrefab("piece_gift1");
					Gift2 = __instance.GetPrefab("piece_gift2");
					Gift3 = __instance.GetPrefab("piece_gift3");
					Mistletoe = __instance.GetPrefab("piece_mistletoe");
					HelmetYule = __instance.GetPrefab("HelmetYule");
					HelmetPointy = __instance.GetPrefab("HelmetPointyHat");
					HelmetMidsummer = __instance.GetPrefab("HelmetMidsummerCrown");
					Haldor = __instance.GetPrefab("Haldor");
					HelmetOdin = __instance.GetPrefab("HelmetOdin");
					CapeOdin = __instance.GetPrefab("CapeOdin");
					TankardOdin = __instance.GetPrefab("TankardOdin");
					ItemDrop val = default(ItemDrop);
					HelmetOdin.TryGetComponent<ItemDrop>(ref val);
					ItemDrop val2 = default(ItemDrop);
					CapeOdin.TryGetComponent<ItemDrop>(ref val2);
					ItemDrop val3 = default(ItemDrop);
					TankardOdin.TryGetComponent<ItemDrop>(ref val3);
					val.m_itemData.m_shared.m_dlc = "";
					val2.m_itemData.m_shared.m_dlc = "";
					val3.m_itemData.m_shared.m_dlc = "";
				}
			}
		}

		[HarmonyPatch(typeof(Trader), "Start")]
		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(0)]
		private static class TraderStartPatch
		{
			[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
			private static void Postfix(Trader __instance)
			{
				//IL_006f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: 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: 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_009b: Expected O, but got Unknown
				if (Object.op_Implicit((Object)(object)__instance) && SeasonalTweaksPlugin._SeasonalItems.Value != 0)
				{
					ItemDrop HelmetYule_ItemDrop = default(ItemDrop);
					HelmetYule.TryGetComponent<ItemDrop>(ref HelmetYule_ItemDrop);
					TradeItem val = __instance.m_items.Find((TradeItem x) => (Object)(object)x.m_prefab == (Object)(object)HelmetYule_ItemDrop);
					if (val != null)
					{
						val.m_requiredGlobalKey = "season_winter";
						return;
					}
					val = new TradeItem
					{
						m_prefab = HelmetYule_ItemDrop,
						m_price = 100,
						m_stack = 1,
						m_requiredGlobalKey = "season_winter"
					};
					__instance.m_items.Add(val);
				}
			}
		}

		private static GameObject Hammer;

		private static GameObject JackOTurnip;

		private static GameObject MayPole;

		private static GameObject XmasCrown;

		private static GameObject XmasGarland;

		private static GameObject XmasTree;

		private static GameObject Gift1;

		private static GameObject Gift2;

		private static GameObject Gift3;

		private static GameObject Mistletoe;

		private static GameObject HelmetYule;

		private static GameObject HelmetPointy;

		private static GameObject HelmetMidsummer;

		private static GameObject Haldor;

		private static GameObject HelmetOdin;

		private static GameObject CapeOdin;

		private static GameObject TankardOdin;

		public static void UpdateSeasonalPieces()
		{
			if (!Object.op_Implicit((Object)(object)ZNetScene.instance) || !Object.op_Implicit((Object)(object)Player.m_localPlayer) || SeasonalTweaksPlugin._SeasonalItems.Value == SeasonalTweaksPlugin.Toggle.Off)
			{
				return;
			}
			Piece item = default(Piece);
			JackOTurnip.TryGetComponent<Piece>(ref item);
			Piece item2 = default(Piece);
			MayPole.TryGetComponent<Piece>(ref item2);
			Piece item3 = default(Piece);
			XmasCrown.TryGetComponent<Piece>(ref item3);
			Piece item4 = default(Piece);
			XmasGarland.TryGetComponent<Piece>(ref item4);
			Piece item5 = default(Piece);
			XmasTree.TryGetComponent<Piece>(ref item5);
			Piece item6 = default(Piece);
			Gift1.TryGetComponent<Piece>(ref item6);
			Piece item7 = default(Piece);
			Gift2.TryGetComponent<Piece>(ref item7);
			Piece item8 = default(Piece);
			Gift3.TryGetComponent<Piece>(ref item8);
			Piece item9 = default(Piece);
			Mistletoe.TryGetComponent<Piece>(ref item9);
			List<Piece> list = new List<Piece> { item, item2 };
			List<GameObject> list2 = new List<GameObject> { XmasCrown, XmasGarland, XmasTree, Gift1, Gift2, Gift3, Mistletoe };
			List<Piece> collection = new List<Piece> { item3, item4, item5, item6, item7, item8, item9 };
			list.AddRange(collection);
			foreach (Piece item10 in list)
			{
				item10.m_enabled = true;
			}
			ItemDrop val = default(ItemDrop);
			if (!Hammer.TryGetComponent<ItemDrop>(ref val))
			{
				return;
			}
			if (SeasonKeys.season == SeasonKeys.Seasons.Fall)
			{
				if (!val.m_itemData.m_shared.m_buildPieces.m_pieces.Contains(JackOTurnip))
				{
					val.m_itemData.m_shared.m_buildPieces.m_pieces.Add(JackOTurnip);
				}
				if (val.m_itemData.m_shared.m_buildPieces.m_pieces.Contains(MayPole))
				{
					val.m_itemData.m_shared.m_buildPieces.m_pieces.Remove(MayPole);
				}
				foreach (GameObject item11 in list2)
				{
					if (val.m_itemData.m_shared.m_buildPieces.m_pieces.Contains(item11))
					{
						val.m_itemData.m_shared.m_buildPieces.m_pieces.Remove(item11);
					}
				}
			}
			if (SeasonKeys.season == SeasonKeys.Seasons.Winter)
			{
				foreach (GameObject item12 in list2)
				{
					if (!val.m_itemData.m_shared.m_buildPieces.m_pieces.Contains(item12))
					{
						val.m_itemData.m_shared.m_buildPieces.m_pieces.Add(item12);
					}
				}
				if (val.m_itemData.m_shared.m_buildPieces.m_pieces.Contains(JackOTurnip))
				{
					val.m_itemData.m_shared.m_buildPieces.m_pieces.Remove(JackOTurnip);
				}
				if (val.m_itemData.m_shared.m_buildPieces.m_pieces.Contains(MayPole))
				{
					val.m_itemData.m_shared.m_buildPieces.m_pieces.Remove(MayPole);
				}
			}
			if (SeasonKeys.season == SeasonKeys.Seasons.Summer)
			{
				if (!val.m_itemData.m_shared.m_buildPieces.m_pieces.Contains(MayPole))
				{
					val.m_itemData.m_shared.m_buildPieces.m_pieces.Add(MayPole);
				}
				if (val.m_itemData.m_shared.m_buildPieces.m_pieces.Contains(JackOTurnip))
				{
					val.m_itemData.m_shared.m_buildPieces.m_pieces.Remove(JackOTurnip);
				}
				foreach (GameObject item13 in list2)
				{
					if (val.m_itemData.m_shared.m_buildPieces.m_pieces.Contains(item13))
					{
						val.m_itemData.m_shared.m_buildPieces.m_pieces.Remove(item13);
					}
				}
			}
			if (SeasonKeys.season == SeasonKeys.Seasons.Spring)
			{
				if (val.m_itemData.m_shared.m_buildPieces.m_pieces.Contains(JackOTurnip))
				{
					val.m_itemData.m_shared.m_buildPieces.m_pieces.Remove(JackOTurnip);
				}
				if (val.m_itemData.m_shared.m_buildPieces.m_pieces.Contains(MayPole))
				{
					val.m_itemData.m_shared.m_buildPieces.m_pieces.Remove(MayPole);
				}
				foreach (GameObject item14 in list2)
				{
					if (val.m_itemData.m_shared.m_buildPieces.m_pieces.Contains(item14))
					{
						val.m_itemData.m_shared.m_buildPieces.m_pieces.Remove(item14);
					}
				}
			}
			Player.m_localPlayer.UpdateAvailablePiecesList();
		}

		[HarmonyWrapSafe]
		public static void UpdateSeasonalItems()
		{
			if (!Object.op_Implicit((Object)(object)ZNetScene.instance) || !Object.op_Implicit((Object)(object)Player.m_localPlayer) || !Object.op_Implicit((Object)(object)ObjectDB.instance) || SeasonalTweaksPlugin._SeasonalItems.Value == SeasonalTweaksPlugin.Toggle.Off)
			{
				return;
			}
			ItemDrop val = default(ItemDrop);
			HelmetPointy.TryGetComponent<ItemDrop>(ref val);
			ItemDrop val2 = default(ItemDrop);
			HelmetMidsummer.TryGetComponent<ItemDrop>(ref val2);
			ItemDrop val3 = default(ItemDrop);
			HelmetYule.TryGetComponent<ItemDrop>(ref val3);
			Recipe recipe = ObjectDB.instance.GetRecipe(val.m_itemData);
			Recipe recipe2 = ObjectDB.instance.GetRecipe(val2.m_itemData);
			Recipe recipe3 = ObjectDB.instance.GetRecipe(val3.m_itemData);
			switch (SeasonKeys.season)
			{
			case SeasonKeys.Seasons.Fall:
				if (Object.op_Implicit((Object)(object)recipe))
				{
					recipe.m_enabled = true;
				}
				if (Object.op_Implicit((Object)(object)recipe2))
				{
					recipe2.m_enabled = false;
				}
				if (Object.op_Implicit((Object)(object)recipe3))
				{
					recipe3.m_enabled = false;
				}
				break;
			case SeasonKeys.Seasons.Winter:
				if (Object.op_Implicit((Object)(object)recipe))
				{
					recipe.m_enabled = false;
				}
				if (Object.op_Implicit((Object)(object)recipe2))
				{
					recipe2.m_enabled = false;
				}
				if (Object.op_Implicit((Object)(object)recipe3))
				{
					recipe3.m_enabled = true;
				}
				break;
			case SeasonKeys.Seasons.Spring:
				if (Object.op_Implicit((Object)(object)recipe))
				{
					recipe.m_enabled = false;
				}
				if (Object.op_Implicit((Object)(object)recipe2))
				{
					recipe2.m_enabled = false;
				}
				if (Object.op_Implicit((Object)(object)recipe3))
				{
					recipe3.m_enabled = false;
				}
				break;
			case SeasonKeys.Seasons.Summer:
				if (Object.op_Implicit((Object)(object)recipe))
				{
					recipe.m_enabled = false;
				}
				if (Object.op_Implicit((Object)(object)recipe2))
				{
					recipe2.m_enabled = true;
				}
				if (Object.op_Implicit((Object)(object)recipe3))
				{
					recipe3.m_enabled = false;
				}
				break;
			}
		}

		public static void ModifyHaldorTrader()
		{
			//IL_00bc: 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_00cd: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)ZNetScene.instance) || !Object.op_Implicit((Object)(object)Player.m_localPlayer) || !Object.op_Implicit((Object)(object)ObjectDB.instance) || SeasonalTweaksPlugin._SeasonalItems.Value == SeasonalTweaksPlugin.Toggle.Off)
			{
				return;
			}
			ItemDrop HelmetYule_ItemDrop = default(ItemDrop);
			HelmetYule.TryGetComponent<ItemDrop>(ref HelmetYule_ItemDrop);
			Trader val = default(Trader);
			if (Haldor.TryGetComponent<Trader>(ref val))
			{
				TradeItem val2 = val.m_items.Find([<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(0)] (TradeItem x) => (Object)(object)x.m_prefab == (Object)(object)HelmetYule_ItemDrop);
				if (val2 != null)
				{
					val2.m_requiredGlobalKey = "season_winter";
					return;
				}
				val2 = new TradeItem
				{
					m_prefab = HelmetYule_ItemDrop,
					m_price = 100,
					m_stack = 1,
					m_requiredGlobalKey = "season_winter"
				};
				val.m_items.Add(val2);
			}
		}
	}
	public static class SeasonKeys
	{
		[Flags]
		public enum Seasons
		{
			None = 0,
			Spring = 1,
			Summer = 2,
			Fall = 4,
			Winter = 8
		}

		public static Seasons season = Seasons.Winter;

		[<0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>Nullable(1)]
		public static string currentSeason = "season_winter";

		public static void UpdateSeasonalKeys()
		{
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer) || !Object.op_Implicit((Object)(object)ZoneSystem.instance))
			{
				return;
			}
			List<string> globalKeys = ZoneSystem.instance.GetGlobalKeys();
			string text = globalKeys.Find([<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)] (string x) => x.StartsWith("season"));
			if (currentSeason != text)
			{
				switch (text)
				{
				case "season_winter":
					season = Seasons.Winter;
					break;
				case "season_summer":
					season = Seasons.Summer;
					break;
				case "season_spring":
					season = Seasons.Spring;
					break;
				case "season_fall":
					season = Seasons.Fall;
					break;
				}
				SeasonalItems.UpdateSeasonalPieces();
				SeasonalItems.UpdateSeasonalItems();
				SeasonalItems.ModifyHaldorTrader();
				currentSeason = text;
			}
		}
	}
	[<0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>Nullable(0)]
	[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
	public static class YamlConfigurations
	{
		[HarmonyPatch(typeof(ZoneSystem), "Start")]
		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(0)]
		private static class ZoneSystemStartPatch
		{
			[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(1)]
			private static void Postfix(ZoneSystem __instance)
			{
				if (Object.op_Implicit((Object)(object)__instance))
				{
					GetCustomPlantValues(__instance);
				}
			}
		}

		[Serializable]
		[<f2973a47-bea9-4c40-92fd-6606ddb9e6e0>NullableContext(0)]
		public class PickableValueConfigurations
		{
			[<0e5c3fdb-2e79-43ed-a4f2-ac9152f0d30f>Nullable(1)]
			public string prefab_name = null;

			public int spring_amount;

			public int summer_amount;

			public int fall_amount;

			public int winter_amount;

			public float spring_respawn_time;

			public float summer_respawn_time;

			public float fall_respawn_time;

			public float winter_respawn_time;
		}

		private static readonly CustomSyncedValue<string> SyncedData = new CustomSyncedValue<string>(SeasonalTweaksPlugin.ConfigSync, "SyncedData", "");

		private static readonly CustomSyncedValue<string> SyncedValues = new CustomSyncedValue<string>(SeasonalTweaksPlugin.ConfigSync, "SyncedValues", "");

		private static readonly string folderPath;

		private static readonly string CustomFilePath;

		private static readonly string CustomValuePath;

		public static Dictionary<string, List<string>> CustomData;

		public static bool UpdatedSyncedData;

		public static List<PickableValueConfigurations> customPickableData;

		public static void InitCustomFileSystemWatch()
		{
			if (SeasonalTweaksPlugin.workingAsType != SeasonalTweaksPlugin.WorkingAs.Server)
			{
				SyncedData.ValueChanged += OnValueChanged;
				SyncedValues.ValueChanged += OnValueChanged;
				return;
			}
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(folderPath)
			{
				Filter = "*.yml",
				EnableRaisingEvents = true,
				IncludeSubdirectories = true,
				SynchronizingObject = ThreadingHelper.SynchronizingObject,
				NotifyFilter = NotifyFilters.LastWrite
			};
			fileSystemWatcher.Created += OnChanged;
			fileSystemWatcher.Changed += OnChanged;
			fileSystemWatcher.Deleted += OnDeleted;
		}

		private static void OnValueChanged()
		{
			UpdatedSyncedData = false;
		}

		private static void OnChanged(object sender, FileSystemEventArgs e)
		{
			UpdatedSyncedData = false;
		}

		private static void OnDeleted(object sender, FileSystemEventArgs e)
		{
			if (!(e.FullPath != CustomValuePath) && Object.op_Implicit((Object)(object)ZoneSystem.instance))
			{
				GetCustomPlantValues(ZoneSystem.instance);
			}
		}

		public static void InitYamlConfigurations()
		{
			if (!Directory.Exists(folderPath))
			{
				Directory.CreateDirectory(folderPath);
			}
			WriteTutorial();
			if (!File.Exists(CustomFilePath))
			{
				ISerializer serializer = new SerializerBuilder().Build();
				string contents = serializer.Serialize(CustomData);
				File.WriteAllText(CustomFilePath, contents);
			}
			ReadYamlConfigs();
		}

		private static void GetCustomPlantValues(ZoneSystem instance)
		{
			if (Object.op_Implicit((Object)(object)instance) && !File.Exists(CustomValuePath))
			{
				ISerializer serializer = new SerializerBuilder().Build();
				GetCustomPlants();
				string contents = serializer.Serialize(customPickableData);
				File.WriteAllText(CustomValuePath, contents);
			}
		}

		public static void UpdateSyncedData()
		{
			if (UpdatedSyncedData)
			{
				return;
			}
			SeasonalTweaksPlugin.WorkingAs workingAsType = SeasonalTweaksPlugin.workingAsType;
			if ((uint)(workingAsType - 1) <= 1u)
			{
				string value = File.ReadAllText(CustomFilePath);
				string text = File.ReadAllText(CustomValuePath);
				if (Utility.IsNullOrWhiteSpace(text))
				{
					return;
				}
				SyncedData.Value = value;
				SyncedValues.Value = text;
			}
			else
			{
				if (Utility.IsNullOrWhiteSpace(SyncedValues.Value))
				{
					return;
				}
				IDeserializer deserializer = new DeserializerBuilder().Build();
				CustomData = deserializer.Deserialize<Dictionary<string, List<string>>>(SyncedData.Value);
				customPickableData = deserializer.Deserialize<List<PickableValueConfigurations>>(SyncedValues.Value);
			}
			UpdatedSyncedData = true;
		}

		private static void ReadYamlConfigs()
		{
			string input = File.ReadAllText(CustomFilePath);
			IDeserializer deserializer = new DeserializerBuilder().Build();
			Dictionary<string, List<string>> customData = deserializer.Deserialize<Dictionary<string, List<string>>>(input);
			CustomData = customData;
			if (File.Exists(CustomValuePath))
			{
				string input2 = File.ReadAllText(CustomValuePath);
				customPickableData = deserializer.Deserialize<List<PickableValueConfigurations>>(input2);
			}
		}

		private static void WriteTutorial()
		{
			string text = folderPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			string path = text + directorySeparatorChar + "README.md";
			if (!File.Exists(path))
			{
				List<string> contents = new List<string>
				{
					"# Yaml Configurations", "Use these files to add custom prefabs to control seasonally.", "Add the prefab names as strings into the brackets of the season you wish to NOT allow.", "#### ", "Example: ", "```yml", "season_spring: ['CottonWoodSapling_RtD','OakSapling_RtD']", "season_summer: []", "season_fall: []", "season_winter:",
					"- BlossomSapling_RtD", "- ThinPineSapling_RtD", "```", "#### ", "You will notice that the YML accepts two formats for adding to the list.", "Direct string inputs into the brackets or line inputs.", "#### ", "CustomValues.yml will automatically generate if file is missing once game is loaded.", "Once generated, you can open file and tweak the values.", "If you ever add new custom pickables, simply delete the file, and let regenerate, then tweak again.",
					"#### Notes", "Have fun - Rusty"
				};
				File.WriteAllLines(path, contents);
			}
		}

		private static void GetCustomPlants()
		{
			customPickableData.Clear();
			HashSet<string> hashSet = new HashSet<string>();
			GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
			GameObject[] array2 = array;
			Pickable val2 = default(Pickable);
			foreach (GameObject val in array2)
			{
				if (val.TryGetComponent<Pickable>(ref val2) && Object.op_Implicit((Object)(object)val2.m_itemPrefab) && !hashSet.Contains(((Object)val2.m_itemPrefab).name))
				{
					PickableValueConfigurations item = new PickableValueConfigurations
					{
						prefab_name = ((Object)val2.m_itemPrefab).name,
						spring_amount = val2.m_amount,
						summer_amount = val2.m_amount,
						fall_amount = val2.m_amount,
						winter_amount = val2.m_amount,
						spring_respawn_time = val2.m_respawnTimeMinutes,
						summer_respawn_time = val2.m_respawnTimeMinutes,
						fall_respawn_time = val2.m_respawnTimeMinutes,
						winter_respawn_time = val2.m_respawnTimeMinutes
					};
					hashSet.Add(((Object)val2.m_itemPrefab).name);
					if (!customPickableData.Contains(item))
					{
						customPickableData.Add(item);
					}
				}
			}
		}

		static YamlConfigurations()
		{
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			folderPath = configPath + directorySeparatorChar + "SeasonalTweaks";
			string text = folderPath;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			CustomFilePath = text + directorySeparatorChar + "CustomPrefabs.yml";
			string text2 = folderPath;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			CustomValuePath = text2 + directorySeparatorChar + "CustomValues.yml";
			CustomData = new Dictionary<string, List<string>>
			{
				{
					"season_spring",
					new List<string>()
				},
				{
					"season_summer",
					new List<string>()
				},
				{
					"season_fall",
					new List<string>()
				},
				{
					"season_winter",
					new List<string>()
				}
			};
			UpdatedSyncedData = false;
			customPickableData = new List<PickableValueConfigurations>();
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[<4f0e08e1-1b51-4fff-9137-a573f955b3f7>Embedded]
	[CompilerGenerated]
	internal sealed class <4f0e08e1-1b51-4fff-9137-a573f955b3f7>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	[<4f0e08e1-1b51-4fff-9137-a573f955b3f7>Embedded]
	[CompilerGenerated]
	internal sealed class <9e191b27-5fc3-4b01-8f70-459cf2713ef8>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <9e191b27-5fc3-4b01-8f70-459cf2713ef8>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <9e191b27-5fc3-4b01-8f70-459cf2713ef8>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	[<4f0e08e1-1b51-4fff-9137-a573f955b3f7>Embedded]
	internal sealed class <b184b5e6-e65a-4da6-83bd-358b19dec9a1>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <b184b5e6-e65a-4da6-83bd-358b19dec9a1>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenera