Decompiled source of Seasonality v3.7.9

Seasonality.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using ServerSync;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using YamlDotNet.Serialization;

[assembly: AssemblyFileVersion("3.7.9")]
[assembly: Guid("E0E2F92E-557C-4A05-9D89-AA92A0BD75C4")]
[assembly: ComVisible(false)]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyProduct("Seasonality")]
[assembly: AssemblyCompany("RustyMods")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("Seasonality")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.7.9.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<d8f5a938-bca0-41de-9756-f0e6695cec53>Embedded]
	internal sealed class <d8f5a938-bca0-41de-9756-f0e6695cec53>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	[<d8f5a938-bca0-41de-9756-f0e6695cec53>Embedded]
	internal sealed class <940de675-ac5e-4a4f-a395-f7d1b5208a00>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <940de675-ac5e-4a4f-a395-f7d1b5208a00>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <940de675-ac5e-4a4f-a395-f7d1b5208a00>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	[<d8f5a938-bca0-41de-9756-f0e6695cec53>Embedded]
	internal sealed class <5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace Seasonality
{
	[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
	[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
	public class SeasonalIce : MonoBehaviour
	{
		private static GameObject Ice = null;

		private static readonly ZoneVegetation ZoneVeg = new ZoneVegetation();

		private static readonly List<SeasonalIce> m_instances = new List<SeasonalIce>();

		private Destructible m_destructible = null;

		public void Awake()
		{
			m_destructible = ((Component)this).GetComponent<Destructible>();
			m_instances.Add(this);
			((MonoBehaviour)this).InvokeRepeating("CheckSeason", 0f, 10f);
		}

		public void OnDestroy()
		{
			m_instances.Remove(this);
		}

		public void CheckSeason()
		{
			if (Configs.m_season.Value != Season.Winter)
			{
				m_destructible.DestroyNow();
			}
		}

		public static void UpdateAll()
		{
			foreach (SeasonalIce instance in m_instances)
			{
				instance.CheckSeason();
			}
		}

		public static void UpdateZoneVeg()
		{
			if (!Object.op_Implicit((Object)(object)ZoneSystem.instance))
			{
				return;
			}
			if (Configs.m_season.Value == Season.Winter && Configs.m_addIceShelves.Value == Toggle.On)
			{
				if (!ZoneSystem.instance.m_vegetation.Contains(ZoneVeg))
				{
					ZoneSystem.instance.m_vegetation.Add(ZoneVeg);
				}
			}
			else
			{
				ZoneSystem.instance.m_vegetation.Remove(ZoneVeg);
			}
		}

		public static void Setup()
		{
			Clone clone = new Clone("ice1", "SeasonalIce");
			clone.OnCreated += delegate(GameObject p)
			{
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				p.AddComponent<SeasonalIce>();
				ZoneVeg.m_name = "SeasonalIce";
				ZoneVeg.m_prefab = p;
				ZoneVeg.m_min = 10f;
				ZoneVeg.m_max = 20f;
				ZoneVeg.m_biome = (Biome)539;
				ZoneVeg.m_biomeArea = (BiomeArea)3;
				ZoneVeg.m_blockCheck = true;
				ZoneVeg.m_minAltitude = -1000f;
				ZoneVeg.m_maxAltitude = -1f;
				UpdateZoneVeg();
				Ice = p;
			};
		}
	}
	public class RandomColors : MonoBehaviour
	{
		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		private static class ZNetScene_Awake_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(ZNetScene __instance)
			{
				foreach (string name in new StringListConfig(Configs.m_fallObjects.Value).m_names)
				{
					GameObject prefab = __instance.GetPrefab(name);
					if (prefab != null)
					{
						prefab.AddComponent<RandomColors>();
						m_modifiedPrefabs.Add(prefab);
					}
				}
				Configs.m_fallObjects.SettingChanged += delegate
				{
					RandomColors randomColors = default(RandomColors);
					foreach (GameObject modifiedPrefab in m_modifiedPrefabs)
					{
						if (modifiedPrefab.TryGetComponent<RandomColors>(ref randomColors))
						{
							Object.Destroy((Object)(object)randomColors);
						}
					}
					m_modifiedPrefabs.Clear();
					foreach (string name2 in new StringListConfig(Configs.m_fallObjects.Value).m_names)
					{
						GameObject prefab2 = __instance.GetPrefab(name2);
						if (prefab2 != null)
						{
							prefab2.AddComponent<RandomColors>();
							m_modifiedPrefabs.Add(prefab2);
						}
					}
				};
			}
		}

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(new byte[] { 2, 1 })]
		public Renderer[] m_renderers;

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(2)]
		public ParticleSystem m_particleSystem;

		public MinMaxGradient m_originalGradient;

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(1)]
		public static readonly List<RandomColors> m_instances = new List<RandomColors>();

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(1)]
		private static readonly List<GameObject> m_modifiedPrefabs = new List<GameObject>();

		public void Awake()
		{
			if (Configs.m_randomColors.Value != 0 && new StringListConfig(Configs.m_fallObjects.Value).m_names.Contains(((Object)this).name.Replace("(Clone)", string.Empty)))
			{
				m_renderers = ((Component)this).GetComponentsInChildren<Renderer>(true);
				m_particleSystem = ((Component)this).GetComponentInChildren<ParticleSystem>();
				m_instances.Add(this);
			}
		}

		public void Start()
		{
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			if (m_renderers != null)
			{
				Renderer[] renderers = m_renderers;
				foreach (Renderer val in renderers)
				{
					if (val.sharedMaterials == null)
					{
						continue;
					}
					Material[] sharedMaterials = val.sharedMaterials;
					for (int j = 0; j < sharedMaterials.Length; j++)
					{
						if (!((Object)(object)sharedMaterials[j] == (Object)null))
						{
							string key = ((Object)sharedMaterials[j]).name.Replace("(Instance)", string.Empty).Trim();
							if (TextureReplacer.m_fallMaterials.TryGetValue(key, out var value))
							{
								sharedMaterials[j] = value[Random.Range(0, value.Count)].m_material;
							}
						}
					}
					val.sharedMaterials = sharedMaterials;
				}
			}
			if ((Object)(object)m_particleSystem != (Object)null)
			{
				MainModule main = m_particleSystem.main;
				m_originalGradient = ((MainModule)(ref main)).startColor;
			}
			UpdateParticleColors();
		}

		public void OnDestroy()
		{
			m_instances.Remove(this);
		}

		public static void UpdateAll()
		{
			foreach (RandomColors instance in m_instances)
			{
				instance.UpdateParticleColors();
			}
		}

		public void UpdateParticleColors()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			if (Configs.m_particlesController.Value != 0 && !((Object)(object)m_particleSystem == (Object)null))
			{
				MainModule main = m_particleSystem.main;
				m_originalGradient = ((MainModule)(ref main)).startColor;
				MinMaxGradient startColor;
				switch (Configs.m_season.Value)
				{
				case Season.Fall:
					startColor = default(MinMaxGradient);
					((MinMaxGradient)(ref startColor)).color = Color32.op_Implicit(new Color32((byte)205, (byte)92, (byte)92, byte.MaxValue));
					((MinMaxGradient)(ref startColor)).colorMax = Color32.op_Implicit(new Color32((byte)218, (byte)165, (byte)32, byte.MaxValue));
					((MinMaxGradient)(ref startColor)).colorMin = Color32.op_Implicit(new Color32((byte)233, (byte)116, (byte)81, byte.MaxValue));
					((MinMaxGradient)(ref startColor)).mode = (ParticleSystemGradientMode)4;
					((MainModule)(ref main)).startColor = startColor;
					break;
				case Season.Winter:
					startColor = default(MinMaxGradient);
					((MinMaxGradient)(ref startColor)).color = Color.white;
					((MinMaxGradient)(ref startColor)).mode = (ParticleSystemGradientMode)0;
					((MainModule)(ref main)).startColor = startColor;
					break;
				default:
					((MainModule)(ref main)).startColor = m_originalGradient;
					break;
				}
			}
		}
	}
	[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
	[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
	public class FrozenWaterLOD : MonoBehaviour
	{
		[HarmonyPatch(typeof(Game), "Start")]
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		private static class Game_Start_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(Game __instance)
			{
				if (!Object.op_Implicit((Object)(object)__instance))
				{
					return;
				}
				try
				{
					((Component)Utils.FindChild(((Component)__instance).gameObject.transform, "WaterPlane", (IterativeSearchType)0).GetChild(0)).gameObject.AddComponent<FrozenWaterLOD>();
				}
				catch
				{
					SeasonalityPlugin.Record.LogDebug("Failed to find water LOD");
				}
			}
		}

		public Vector3 m_originalPos;

		public MeshRenderer m_renderer = null;

		public Material m_originalMat = null;

		public bool m_frozen;

		private static readonly List<FrozenWaterLOD> Instances = new List<FrozenWaterLOD>();

		public static void UpdateAll()
		{
			foreach (FrozenWaterLOD instance in Instances)
			{
				if (Configs.m_season.Value == Season.Winter && Configs.m_waterFreezes.Value == Toggle.On)
				{
					instance.Freeze();
				}
				else
				{
					instance.Thaw();
				}
			}
		}

		public void Awake()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			m_originalPos = ((Component)this).transform.position;
			m_renderer = ((Component)this).GetComponent<MeshRenderer>();
			m_originalMat = ((Renderer)m_renderer).material;
			SetInitialValues();
			Instances.Add(this);
		}

		private void SetInitialValues()
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)m_renderer))
			{
				if (Configs.m_waterFreezes.Value == Toggle.On && Configs.m_season.Value == Season.Winter)
				{
					((Renderer)m_renderer).material = SeasonalityPlugin.FrozenWaterMat1;
					((Component)this).transform.position = m_originalPos + new Vector3(0f, -0.2f, 0f);
					m_frozen = true;
				}
				else
				{
					((Renderer)m_renderer).material = m_originalMat;
					((Component)this).transform.position = m_originalPos;
					m_frozen = false;
				}
			}
		}

		public void OnDestroy()
		{
			Instances.Remove(this);
		}

		public void Thaw()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (m_frozen)
			{
				((Renderer)m_renderer).material = m_originalMat;
				((Component)this).transform.position = m_originalPos;
				m_frozen = false;
			}
		}

		public void Freeze()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			if (!m_frozen)
			{
				((Renderer)m_renderer).material = SeasonalityPlugin.FrozenWaterMat1;
				((Component)this).transform.position = m_originalPos + new Vector3(0f, -0.2f, 0f);
				m_frozen = true;
			}
		}
	}
	[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
	[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
	public class FrozenZones : MonoBehaviour
	{
		[HarmonyPatch(typeof(ZoneSystem), "Start")]
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		private static class ZoneSystem_Start_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(ZoneSystem __instance)
			{
				if (Object.op_Implicit((Object)(object)__instance))
				{
					__instance.m_zonePrefab.AddComponent<FrozenZones>();
				}
			}
		}

		public MeshCollider m_surfaceCollider = null;

		public MeshRenderer m_surfaceRenderer = null;

		public WaterVolume m_waterVolume = null;

		public Material m_originalMaterial = null;

		private static readonly List<FrozenZones> Instances = new List<FrozenZones>();

		public bool m_frozen;

		public static void UpdateAll()
		{
			foreach (FrozenZones instance in Instances)
			{
				if (Configs.m_waterFreezes.Value == Toggle.Off)
				{
					instance.ThawWater();
				}
				else if (Configs.m_season.Value == Season.Winter)
				{
					instance.FreezeWater();
				}
				else
				{
					instance.ThawWater();
				}
			}
		}

		public void Awake()
		{
			Transform val = ((Component)this).transform.Find("Water");
			Transform val2 = val.Find("WaterSurface");
			Transform val3 = val.Find("WaterVolume");
			MeshFilter component = ((Component)val2).GetComponent<MeshFilter>();
			m_surfaceRenderer = ((Component)val2).GetComponent<MeshRenderer>();
			m_waterVolume = ((Component)val3).GetComponent<WaterVolume>();
			m_surfaceCollider = ((Component)val2).gameObject.AddComponent<MeshCollider>();
			m_originalMaterial = ((Renderer)m_surfaceRenderer).material;
			m_surfaceCollider.sharedMesh = component.sharedMesh;
			SetInitialValues();
			if (!Instances.Contains(this))
			{
				Instances.Add(this);
			}
		}

		public void OnDestroy()
		{
			Instances.Remove(this);
		}

		private void SetInitialValues()
		{
			if (Configs.m_season.Value == Season.Winter && Configs.m_waterFreezes.Value == Toggle.On)
			{
				((Renderer)m_surfaceRenderer).material = SeasonalityPlugin.FrozenWaterMat1;
				((Collider)m_surfaceCollider).enabled = true;
				m_waterVolume.m_useGlobalWind = false;
				m_frozen = true;
			}
			else
			{
				((Renderer)m_surfaceRenderer).material = m_originalMaterial;
				((Collider)m_surfaceCollider).enabled = false;
				m_waterVolume.m_useGlobalWind = true;
				m_frozen = false;
			}
		}

		public void FreezeWater()
		{
			if (Object.op_Implicit((Object)(object)m_surfaceCollider) && Object.op_Implicit((Object)(object)m_surfaceCollider) && Object.op_Implicit((Object)(object)m_waterVolume) && !m_frozen)
			{
				((Renderer)m_surfaceRenderer).material = SeasonalityPlugin.FrozenWaterMat1;
				((Collider)m_surfaceCollider).enabled = true;
				m_waterVolume.m_useGlobalWind = false;
				m_frozen = true;
			}
		}

		public void ThawWater()
		{
			if (Object.op_Implicit((Object)(object)m_surfaceCollider) && Object.op_Implicit((Object)(object)m_surfaceCollider) && Object.op_Implicit((Object)(object)m_waterVolume) && m_frozen)
			{
				((Renderer)m_surfaceRenderer).material = m_originalMaterial;
				((Collider)m_surfaceCollider).enabled = false;
				m_waterVolume.m_useGlobalWind = true;
				m_waterVolume.Start();
				m_frozen = false;
			}
		}
	}
	public static class GlobalKeyManager
	{
		public static void UpdateSeasonalKey()
		{
			if (Object.op_Implicit((Object)(object)ZoneSystem.instance))
			{
				ClearSeasonalKeys();
				SetKey();
			}
		}

		private static void ClearSeasonalKeys()
		{
			if (!Object.op_Implicit((Object)(object)ZoneSystem.instance))
			{
				return;
			}
			foreach (string item in ZoneSystem.instance.GetGlobalKeys().ToList())
			{
				if (item.StartsWith("season_"))
				{
					ZoneSystem.instance.RemoveGlobalKey(item);
				}
			}
		}

		private static void SetKey()
		{
			if (Object.op_Implicit((Object)(object)ZoneSystem.instance))
			{
				ZoneSystem.instance.SetGlobalKey("season_" + Configs.m_season.Value.ToString().ToLower());
			}
		}
	}
	public class MossController : MonoBehaviour
	{
		[HarmonyPatch(typeof(BossStone), "Start")]
		private static class BossStone_Start_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(BossStone __instance)
			{
				if (Object.op_Implicit((Object)(object)__instance) && !Object.op_Implicit((Object)(object)((Component)__instance).GetComponentInParent<LocationFix>()))
				{
					MossController mossController = ((Component)__instance).gameObject.AddComponent<MossController>();
					mossController.Cache();
					mossController.SetMoss();
				}
			}
		}

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(1)]
		private readonly Dictionary<Material, Texture> m_textureMap = new Dictionary<Material, Texture>();

		private static readonly int MossTex = Shader.PropertyToID("_MossTex");

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(1)]
		private static readonly List<MossController> m_instances = new List<MossController>();

		public static void UpdateAll()
		{
			foreach (MossController instance in m_instances)
			{
				instance.SetMoss();
			}
		}

		public void Awake()
		{
			m_instances.Add(this);
		}

		public void OnDestroy()
		{
			m_instances.Remove(this);
		}

		private void Cache()
		{
			Renderer[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren<Renderer>();
			if (componentsInChildren.Length == 0)
			{
				return;
			}
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				Material[] sharedMaterials = val.sharedMaterials;
				foreach (Material val2 in sharedMaterials)
				{
					if (!((Object)(object)val2 == (Object)null) && val2.HasProperty(MossTex))
					{
						Texture tex = TextureManager.stonemoss.m_tex;
						if (tex != null)
						{
							m_textureMap[val2] = tex;
						}
						else
						{
							m_textureMap[val2] = val2.GetTexture(MossTex);
						}
					}
				}
			}
		}

		public void SetMoss()
		{
			switch (Configs.m_season.Value)
			{
			case Season.Fall:
			{
				foreach (KeyValuePair<Material, Texture> item in m_textureMap)
				{
					item.Key.SetTexture(MossTex, TextureManager.Stonemoss_heath.m_tex);
				}
				return;
			}
			case Season.Winter:
			{
				foreach (KeyValuePair<Material, Texture> item2 in m_textureMap)
				{
					item2.Key.SetTexture(MossTex, TextureManager.AshOnRocks_d.m_tex);
				}
				return;
			}
			}
			foreach (KeyValuePair<Material, Texture> item3 in m_textureMap)
			{
				item3.Key.SetTexture(MossTex, item3.Value);
			}
		}
	}
	[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
	[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
	public class LocationFix : MonoBehaviour
	{
		[HarmonyPatch(typeof(ZoneSystem), "SpawnLocation")]
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		private static class ZoneSystem_SpawnLocation_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(ref GameObject __result)
			{
				if (Object.op_Implicit((Object)(object)__result))
				{
					__result.AddComponent<LocationFix>();
				}
			}
		}

		public static readonly List<LocationFix> m_instances = new List<LocationFix>();

		public Renderer[] m_renderers = null;

		public readonly Dictionary<Material, Texture> m_textures = new Dictionary<Material, Texture>();

		private static readonly int MossTex = Shader.PropertyToID("_MossTex");

		private Texture TryGetOriginalMoss(Texture current)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Invalid comparison between Unknown and I4
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Invalid comparison between Unknown and I4
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Invalid comparison between Unknown and I4
			Biome biome = WorldGenerator.instance.GetBiome(((Component)this).transform.position);
			Biome val = biome;
			Texture val2;
			if ((int)val <= 2)
			{
				if ((int)val == 1)
				{
					goto IL_0040;
				}
				if ((int)val != 2)
				{
					goto IL_009c;
				}
				val2 = TextureManager.stonemoss_swamp.m_tex;
			}
			else
			{
				if ((int)val == 8)
				{
					goto IL_0040;
				}
				if ((int)val != 16)
				{
					if ((int)val != 512)
					{
						goto IL_009c;
					}
					val2 = (((Object)((Component)this).transform).name.ToLower().Contains("dvergr") ? TextureManager.groundcreep_d.m_tex : TextureManager.stonemoss_bw.m_tex);
				}
				else
				{
					val2 = TextureManager.Stonemoss_heath.m_tex;
				}
			}
			goto IL_00a9;
			IL_00a9:
			return ((Object)(object)val2 != (Object)null) ? val2 : current;
			IL_0040:
			val2 = TextureManager.stonemoss.m_tex;
			goto IL_00a9;
			IL_009c:
			val2 = TextureManager.stonemoss.m_tex;
			goto IL_00a9;
		}

		public void Awake()
		{
			m_renderers = ((Component)this).GetComponentsInChildren<Renderer>();
			m_instances.Add(this);
			if (m_renderers.Length == 0)
			{
				return;
			}
			Renderer[] renderers = m_renderers;
			foreach (Renderer val in renderers)
			{
				Material[] sharedMaterials = val.sharedMaterials;
				for (int j = 0; j < val.sharedMaterials.Length; j++)
				{
					Material val2 = val.sharedMaterials[j];
					if (val2.HasProperty(MossTex))
					{
						m_textures[val2] = TryGetOriginalMoss(val2.GetTexture(MossTex));
					}
					if (((Object)val2).name.Contains("HildirsLox") && TextureReplacer.m_materials.TryGetValue("lox", out var value))
					{
						sharedMaterials[j] = value.m_material;
					}
				}
				val.sharedMaterials = sharedMaterials;
			}
			UpdateMoss();
		}

		public void OnDestroy()
		{
			m_instances.Remove(this);
		}

		public void UpdateMoss()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			if ((int)WorldGenerator.instance.GetBiome(((Component)this).transform.position) == 4)
			{
				return;
			}
			switch (Configs.m_season.Value)
			{
			case Season.Winter:
			{
				foreach (Material key in m_textures.Keys)
				{
					key.SetTexture(MossTex, TextureManager.AshOnRocks_d.m_tex);
				}
				return;
			}
			case Season.Fall:
			{
				foreach (Material key2 in m_textures.Keys)
				{
					key2.SetTexture(MossTex, TextureManager.Stonemoss_heath.m_tex);
				}
				return;
			}
			}
			foreach (KeyValuePair<Material, Texture> texture in m_textures)
			{
				texture.Key.SetTexture(MossTex, texture.Value);
			}
		}

		public static void UpdateAll()
		{
			foreach (LocationFix instance in m_instances)
			{
				instance.UpdateMoss();
			}
		}
	}
	[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
	[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
	public static class SeasonSE
	{
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		[HarmonyPatch(typeof(ObjectDB), "Awake")]
		private static class ObjectDB_Awake_Patch
		{
			private static void Postfix()
			{
				if (Object.op_Implicit((Object)(object)ObjectDB.instance) && Object.op_Implicit((Object)(object)ZNetScene.instance))
				{
					SE_Season sE_Season = ScriptableObject.CreateInstance<SE_Season>();
					((Object)sE_Season).name = "SE_Seasons";
					((StatusEffect)sE_Season).m_name = "Seasonality";
					((StatusEffect)sE_Season).m_icon = GetIcon();
					if (!ObjectDB.instance.m_StatusEffects.Contains((StatusEffect)(object)sE_Season))
					{
						ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)sE_Season);
					}
				}
			}
		}

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
		public class SE_Season : StatusEffect
		{
			public override void Setup(Character character)
			{
				Update();
				((StatusEffect)this).Setup(character);
			}

			public void Update()
			{
				base.m_name = ((Configs.m_displayType.Value == DisplayType.Above) ? GetSeasonName() : "");
				base.m_icon = ((Configs.m_displaySeason.Value == Toggle.On) ? GetIcon() : null);
			}

			public override string GetTooltipString()
			{
				StringBuilder stringBuilder = new StringBuilder();
				string text = Localization.instance.Localize("$season_" + Configs.m_season.Value.ToString().ToLower() + "_tooltip");
				if (!text.Contains("["))
				{
					stringBuilder.Append("$season_" + Configs.m_season.Value.ToString().ToLower() + "_tooltip\n");
				}
				stringBuilder.Append("Modifiers Enabled: " + Configs.m_enableModifiers.Value.ToString() + "\n");
				stringBuilder.Append(GetToolTip("Carry Weight", "$se_max_carryweight"));
				stringBuilder.Append(GetToolTip("Health Regeneration", "$se_healthregen"));
				stringBuilder.Append(GetToolTip("Damage", "$se_damage"));
				stringBuilder.Append(GetToolTip("Speed", "$item_movement_modifier"));
				stringBuilder.Append(GetToolTip("Eitr Regeneration", "$se_eitrregen"));
				stringBuilder.Append(GetToolTip("Raise Skill", "$se_skill_modifier"));
				stringBuilder.Append(GetToolTip("Stamina Regeneration", "$se_staminaregen"));
				return Localization.instance.Localize(stringBuilder.ToString());
			}

			private string GetToolTip(string key, string token)
			{
				if (!Configs.m_effectConfigs.TryGetValue(Configs.m_season.Value, out var value))
				{
					return "";
				}
				ConfigEntry<float> value2;
				return value.TryGetValue(key, out value2) ? FormatTooltip(token, value2, key == "Carry Weight") : "";
			}

			private string FormatTooltip(string token, [<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(2)] ConfigEntry<float> config, bool integer)
			{
				float num = ((!integer) ? (config?.Value ?? 1f) : (config?.Value ?? 0f));
				string text = ((integer ? (num > 0f) : (num > 1f)) ? "+" : "");
				string text2 = (integer ? "" : "%");
				float num2 = (integer ? num : (num * 100f - 100f));
				return (num2 != 0f) ? $"{token}: <color=orange>{text}{Math.Round(num2, 1)}{text2}</color>\n" : "";
			}

			public override string GetIconText()
			{
				if (!Object.op_Implicit((Object)(object)EnvMan.instance))
				{
					return "";
				}
				return (Configs.m_displayTimer.Value != 0) ? ((Configs.m_displayType.Value == DisplayType.Above) ? GetSeasonTime() : (GetSeasonName() + "\n" + GetSeasonTime())) : ((Configs.m_displayType.Value == DisplayType.Above) ? "" : GetSeasonName());
			}

			private static string GetSeasonName()
			{
				return Localization.instance.Localize("$season_" + Configs.m_season.Value.ToString().ToLower());
			}

			public override void ModifyStaminaRegen(ref float staminaRegen)
			{
				if (Configs.m_enableModifiers.Value != 0)
				{
					staminaRegen *= Configs.m_effectConfigs.GetOrDefault(Configs.m_season.Value, "Stamina Regeneration", 1f);
				}
			}

			public override void ModifyMaxCarryWeight(float baseLimit, ref float limit)
			{
				if (Configs.m_enableModifiers.Value != 0)
				{
					limit += Configs.m_effectConfigs.GetOrDefault("Carry Weight", 0f);
				}
			}

			public override void ModifyRaiseSkill(SkillType skill, ref float value)
			{
				if (Configs.m_enableModifiers.Value != 0)
				{
					value *= Configs.m_effectConfigs.GetOrDefault("Raise Skill", 1f);
				}
			}

			public override void ModifyEitrRegen(ref float eitrRegen)
			{
				if (Configs.m_enableModifiers.Value != 0)
				{
					eitrRegen *= Configs.m_effectConfigs.GetOrDefault("Eitr Regeneration", 1f);
				}
			}

			public override void ModifyHealthRegen(ref float regenMultiplier)
			{
				if (Configs.m_enableModifiers.Value != 0)
				{
					regenMultiplier *= Configs.m_effectConfigs.GetOrDefault("Health Regeneration", 1f);
				}
			}

			public override void ModifyAttack(SkillType skill, ref HitData hitData)
			{
				if (Configs.m_enableModifiers.Value != 0)
				{
					hitData.ApplyModifier(Configs.m_effectConfigs.GetOrDefault("Damage", 1f));
				}
			}

			public override void ModifySpeed(float baseSpeed, ref float speed, Character character, Vector3 dir)
			{
				if (Configs.m_enableModifiers.Value != 0)
				{
					speed *= Configs.m_effectConfigs.GetOrDefault("Speed", 1f);
				}
			}

			public override void OnDamaged(HitData hit, Character attacker)
			{
				if (FadeToBlack.m_fading && Configs.m_fadeToBlackImmune.Value == Toggle.On)
				{
					hit.ApplyModifier(0f);
				}
			}
		}

		private const string SE_Seasons = "SE_Seasons";

		private static readonly int SE_Season_StableHashCode = StringExtensionMethods.GetStableHashCode("SE_Seasons");

		private static float m_timer;

		public static void CheckOrSet(float dt)
		{
			m_timer += dt;
			if (!(m_timer <= 10f))
			{
				m_timer = 0f;
				if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && !((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(SE_Season_StableHashCode))
				{
					((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(SE_Season_StableHashCode, false, 0, 0f);
				}
			}
		}

		public static void UpdateStatus()
		{
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && ((Character)Player.m_localPlayer).GetSEMan().GetStatusEffect(SE_Season_StableHashCode) is SE_Season sE_Season)
			{
				sE_Season.Update();
			}
		}

		private static bool ShouldCount()
		{
			return GetTotalSeconds() > 0.0;
		}

		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(2)]
		private static Sprite GetIcon()
		{
			Season value = Configs.m_season.Value;
			if (1 == 0)
			{
			}
			Sprite result = (Sprite)(value switch
			{
				Season.Spring => SpriteManager.SpringIcon, 
				Season.Summer => SpriteManager.SummerIcon, 
				Season.Fall => SpriteManager.FallIcon, 
				Season.Winter => SpriteManager.WinterIcon, 
				_ => SpriteManager.ValknutIcon, 
			});
			if (1 == 0)
			{
			}
			return result;
		}

		private static double GetTotalSeconds()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			ConfigEntry<Vector3> value;
			Vector3 val = (Configs.m_durations.TryGetValue(Configs.m_season.Value, out value) ? value.Value : Vector3.zero);
			double num = val.x * 86400f;
			double num2 = val.y * 3600f;
			double num3 = val.z * 60f;
			return num + num2 + num3;
		}

		public static void OnSeasonDisplayConfigChange(object sender, EventArgs e)
		{
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Object.op_Implicit((Object)(object)Hud.instance))
			{
				if (((Character)Player.m_localPlayer).GetSEMan().GetStatusEffect(SE_Season_StableHashCode) is SE_Season sE_Season)
				{
					sE_Season.Update();
				}
				if (Hud.instance.m_tempStatusEffects.Find([<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)] (StatusEffect x) => x.m_nameHash == SE_Season_StableHashCode) is SE_Season sE_Season2)
				{
					sE_Season2.Update();
				}
			}
		}

		private static string GetSeasonTime()
		{
			if (!ShouldCount())
			{
				return "";
			}
			TimeSpan timeSpan = TimeSpan.FromSeconds(SeasonalTimer.GetTimeDifference());
			int days = timeSpan.Days;
			int hours = timeSpan.Hours;
			int minutes = timeSpan.Minutes;
			int seconds = timeSpan.Seconds;
			if (SeasonalTimer.m_sleepOverride)
			{
				return Localization.instance.Localize("$msg_ready");
			}
			return (days > 0) ? string.Format("{0} {1}", days, Localization.instance.Localize((days > 1) ? "$label_days" : "$label_day")) : ((hours > 0) ? $"{hours}:{minutes:D2}:{seconds:D2}" : ((minutes > 0) ? $"{minutes}:{seconds:D2}" : $"{seconds}"));
		}
	}
	public class TerrainController : MonoBehaviour
	{
		[HarmonyPatch(typeof(Heightmap), "Awake")]
		private static class Heightmap_Awake_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(Heightmap __instance)
			{
				((Component)__instance).gameObject.AddComponent<TerrainController>();
			}
		}

		[HarmonyPatch(typeof(Heightmap), "OnEnable")]
		private static class Heightmap_OnEnable_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(Heightmap __instance)
			{
				TerrainController terrainController = default(TerrainController);
				if (((Component)__instance).TryGetComponent<TerrainController>(ref terrainController))
				{
					terrainController.Load();
				}
			}
		}

		[HarmonyPatch(typeof(Heightmap), "OnDisable")]
		private static class Heightmap_OnDisable_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(Heightmap __instance)
			{
				TerrainController item = default(TerrainController);
				if (((Component)__instance).TryGetComponent<TerrainController>(ref item))
				{
					m_instances.Remove(item);
				}
			}
		}

		[HarmonyPatch(typeof(Heightmap), "GetBiomeColor", new Type[] { typeof(Biome) })]
		private static class Heightmap_GetBiomeColor_Patch
		{
			private static void Postfix(Biome biome, ref Color32 __result)
			{
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Invalid comparison between Unknown and I4
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Invalid comparison between Unknown and I4
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Invalid comparison between Unknown and I4
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Invalid comparison between Unknown and I4
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Invalid comparison between Unknown and I4
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Invalid comparison between Unknown and I4
				switch (Configs.m_season.Value)
				{
				case Season.Winter:
					if ((int)biome <= 8)
					{
						if (biome - 1 > 1 && (int)biome != 8)
						{
							break;
						}
					}
					else if ((int)biome != 16 && (int)biome != 512)
					{
						break;
					}
					__result = defaultMap[(Biome)4];
					break;
				case Season.Fall:
					if ((int)biome == 1)
					{
						__result = defaultMap[(Biome)16];
					}
					break;
				}
			}
		}

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(1)]
		private static readonly List<TerrainController> m_instances = new List<TerrainController>();

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(2)]
		private Heightmap m_heightmap;

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(1)]
		private static readonly Dictionary<Biome, Color32> defaultMap = new Dictionary<Biome, Color32>
		{
			{
				(Biome)1,
				new Color32((byte)0, (byte)0, (byte)0, (byte)0)
			},
			{
				(Biome)8,
				new Color32((byte)0, (byte)0, byte.MaxValue, (byte)0)
			},
			{
				(Biome)2,
				new Color32(byte.MaxValue, (byte)0, (byte)0, (byte)0)
			},
			{
				(Biome)4,
				new Color32((byte)0, byte.MaxValue, (byte)0, (byte)0)
			},
			{
				(Biome)16,
				new Color32((byte)0, (byte)0, (byte)0, byte.MaxValue)
			},
			{
				(Biome)512,
				new Color32((byte)0, (byte)0, byte.MaxValue, byte.MaxValue)
			},
			{
				(Biome)64,
				new Color32((byte)0, byte.MaxValue, (byte)0, (byte)0)
			},
			{
				(Biome)32,
				new Color32(byte.MaxValue, (byte)0, (byte)0, byte.MaxValue)
			},
			{
				(Biome)256,
				new Color32((byte)0, (byte)0, (byte)0, (byte)0)
			}
		};

		public static void UpdateTerrain()
		{
			foreach (TerrainController instance in m_instances)
			{
				if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance.m_heightmap == (Object)null))
				{
					instance.ChangeTerrainColor();
				}
			}
		}

		public void OnDestroy()
		{
			m_instances.Remove(this);
		}

		public void Load()
		{
			m_heightmap = ((Component)this).GetComponent<Heightmap>();
			m_instances.Add(this);
		}

		public void ChangeTerrainColor()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			if (WorldGenerator.instance == null || (Object)(object)m_heightmap == (Object)null || (Object)(object)m_heightmap.m_renderMesh == (Object)null)
			{
				return;
			}
			Heightmap.s_tempColors.Clear();
			Vector3 val = ((Component)this).transform.position + new Vector3((float)((double)m_heightmap.m_width * (double)m_heightmap.m_scale * -0.5), 0f, (float)((double)m_heightmap.m_width * (double)m_heightmap.m_scale * -0.5));
			int num = m_heightmap.m_width + 1;
			for (int i = 0; i < num; i++)
			{
				float num2 = DUtils.SmoothStep(0f, 1f, (float)i / (float)m_heightmap.m_width);
				for (int j = 0; j < num; j++)
				{
					float num3 = DUtils.SmoothStep(0f, 1f, (float)j / (float)m_heightmap.m_width);
					Heightmap.s_tempUVs.Add(new Vector2((float)j / (float)m_heightmap.m_width, (float)i / (float)m_heightmap.m_width));
					if (m_heightmap.m_isDistantLod)
					{
						float num4 = val.x + (float)j * m_heightmap.m_scale;
						float num5 = val.z + (float)i * m_heightmap.m_scale;
						Biome biome = WorldGenerator.instance.GetBiome(num4, num5, 0.02f, false);
						Heightmap.s_tempColors.Add(Heightmap.GetBiomeColor(biome));
					}
					else
					{
						Heightmap.s_tempColors.Add(Color32.op_Implicit(m_heightmap.GetBiomeColor(num3, num2)));
					}
				}
			}
			m_heightmap.m_renderMesh.SetColors(Heightmap.s_tempColors);
		}
	}
	[RequireComponent(typeof(VisEquipment))]
	[RequireComponent(typeof(Player))]
	public class VisEquipController : MonoBehaviour
	{
		[HarmonyPatch(typeof(Player), "Awake")]
		private static class Player_Awake_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(Player __instance)
			{
				((Component)__instance).gameObject.AddComponent<VisEquipController>();
			}
		}

		[HarmonyPatch(typeof(VisEquipment), "SetChestEquipped")]
		private static class VisEquipment_SetChestEquipped_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(VisEquipment __instance, bool __result)
			{
				VisEquipController visEquipController = default(VisEquipController);
				if (__result && ((Component)__instance).TryGetComponent<VisEquipController>(ref visEquipController))
				{
					visEquipController.UpdateChestTexture();
				}
			}
		}

		[HarmonyPatch(typeof(VisEquipment), "SetLegEquipped")]
		private static class VisEquipment_SetLegsEquipped_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(VisEquipment __instance, bool __result)
			{
				VisEquipController visEquipController = default(VisEquipController);
				if (__result && ((Component)__instance).TryGetComponent<VisEquipController>(ref visEquipController))
				{
					visEquipController.UpdateLegTexture();
				}
			}
		}

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(1)]
		public static readonly List<VisEquipController> m_instances = new List<VisEquipController>();

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(1)]
		public static VisEquipment m_visEquipment = null;

		private static readonly int ChestTex = Shader.PropertyToID("_ChestTex");

		private static readonly int LegsTex = Shader.PropertyToID("_LegsTex");

		public void Awake()
		{
			m_visEquipment = ((Component)this).GetComponent<VisEquipment>();
			m_instances.Add(this);
		}

		public void OnDestroy()
		{
			m_instances.Remove(this);
		}

		public void UpdatePlayerMaterial()
		{
			UpdateChestTexture();
			UpdateLegTexture();
		}

		public void UpdateChestTexture()
		{
			if ((Object)(object)m_visEquipment == (Object)null || (Object)(object)m_visEquipment.m_bodyModel == (Object)null)
			{
				return;
			}
			GameObject itemPrefab = ObjectDB.m_instance.GetItemPrefab(m_visEquipment.m_currentChestItemHash);
			ItemDrop val = default(ItemDrop);
			if (itemPrefab == null || !itemPrefab.TryGetComponent<ItemDrop>(ref val))
			{
				return;
			}
			Material armorMaterial = val.m_itemData.m_shared.m_armorMaterial;
			if (armorMaterial == null)
			{
				return;
			}
			string key = ((Object)armorMaterial).name.Replace("(Instance)", string.Empty).Trim();
			if (TextureReplacer.m_materials.TryGetValue(key, out var value) && value.m_specialTextures.TryGetValue("_ChestTex", out var value2))
			{
				Texture value4;
				if (value2.TryGetValue(Configs.m_season.Value, out var value3))
				{
					((Renderer)m_visEquipment.m_bodyModel).material.SetTexture(ChestTex, value3);
				}
				else if (value.m_originalTextures.TryGetValue("_ChestTex", out value4))
				{
					((Renderer)m_visEquipment.m_bodyModel).material.SetTexture(ChestTex, value4);
				}
			}
		}

		public void UpdateLegTexture()
		{
			if ((Object)(object)m_visEquipment == (Object)null || (Object)(object)m_visEquipment.m_bodyModel == (Object)null)
			{
				return;
			}
			GameObject itemPrefab = ObjectDB.m_instance.GetItemPrefab(m_visEquipment.m_currentLegItemHash);
			ItemDrop val = default(ItemDrop);
			if (itemPrefab == null || !itemPrefab.TryGetComponent<ItemDrop>(ref val))
			{
				return;
			}
			Material armorMaterial = val.m_itemData.m_shared.m_armorMaterial;
			if (armorMaterial == null)
			{
				return;
			}
			string key = ((Object)armorMaterial).name.Replace("(Instance)", string.Empty).Trim();
			if (TextureReplacer.m_materials.TryGetValue(key, out var value) && value.m_specialTextures.TryGetValue("_LegsTex", out var value2))
			{
				Texture value4;
				if (value2.TryGetValue(Configs.m_season.Value, out var value3))
				{
					((Renderer)m_visEquipment.m_bodyModel).material.SetTexture(LegsTex, value3);
				}
				else if (value.m_originalTextures.TryGetValue("_LegsTex", out value4))
				{
					((Renderer)m_visEquipment.m_bodyModel).material.SetTexture(LegsTex, value4);
				}
			}
		}

		public static void UpdateAll()
		{
			foreach (VisEquipController instance in m_instances)
			{
				instance.UpdatePlayerMaterial();
			}
		}
	}
	[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
	[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
	public static class WeatherManager
	{
		[HarmonyPatch(typeof(EnvMan), "GetAvailableEnvironments")]
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		private static class GetAvailableEnvironments_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(Biome biome, ref List<EnvEntry> __result)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Invalid comparison between Unknown and I4
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				if (Configs.m_weatherEnabled.Value != 0 && (((int)biome != 0 && (int)biome != 32) || 1 == 0))
				{
					__result = GetEnvironments(biome, __result);
				}
			}
		}

		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		[HarmonyPatch(typeof(EnvMan), "Awake")]
		private static class EnvMan_Awake_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(EnvMan __instance)
			{
				if (Object.op_Implicit((Object)(object)__instance))
				{
					RegisterEnvironments(__instance);
					if (Configs.m_weatherEnabled.Value != 0)
					{
						__instance.m_environmentDuration = Configs.m_weatherDuration.Value * 60;
					}
				}
			}
		}

		[HarmonyPatch(typeof(EnvMan), "IsCold")]
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		private static class EnvMan_IsCold_Patch
		{
			private static void Postfix(ref bool __result)
			{
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Invalid comparison between Unknown and I4
				if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Configs.m_winterAlwaysCold.Value != 0 && Configs.m_season.Value == Season.Winter && (int)Player.m_localPlayer.GetCurrentBiome() != 32)
				{
					__result = true;
				}
			}
		}

		[HarmonyPatch(typeof(ObjectDB), "Awake")]
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		private static class ObjectDB_Awake_Patch
		{
			private static void Postfix()
			{
				if (Object.op_Implicit((Object)(object)ObjectDB.instance) && Object.op_Implicit((Object)(object)ZNetScene.instance))
				{
					SE_WeatherMan sE_WeatherMan = ScriptableObject.CreateInstance<SE_WeatherMan>();
					((Object)sE_WeatherMan).name = "SE_Weatherman";
					((StatusEffect)sE_WeatherMan).m_name = "Weatherman";
					((StatusEffect)sE_WeatherMan).m_icon = SpriteManager.ValknutIcon;
					if (!ObjectDB.instance.m_StatusEffects.Contains((StatusEffect)(object)sE_WeatherMan))
					{
						ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)sE_WeatherMan);
					}
				}
			}
		}

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
		public class SE_WeatherMan : StatusEffect
		{
			public override void Setup(Character character)
			{
				((StatusEffect)this).Setup(character);
				Update();
			}

			public void Update()
			{
				base.m_icon = ((Configs.m_displayWeather.Value == Toggle.On) ? SpriteManager.ValknutIcon : null);
			}

			public override string GetTooltipString()
			{
				string text = Localization.instance.Localize("$weather_" + EnvMan.instance.m_currentEnv.m_name.ToLower().Replace(" ", "_") + "_tooltip");
				if (text.Contains("["))
				{
					text = "";
				}
				return base.m_tooltip + text;
			}

			public override string GetIconText()
			{
				if ((Object)(object)EnvMan.instance == (Object)null)
				{
					return "";
				}
				string name = EnvMan.instance.m_currentEnv.m_name;
				string text = Localization.instance.Localize("$weather_" + EnvMan.instance.m_currentEnv.m_name.ToLower().Replace(" ", "_"));
				base.m_name = (text.Contains("[") ? name : text);
				if (Configs.m_displayWeatherTimer.Value == Toggle.Off)
				{
					return "";
				}
				double num = EnvMan.instance.m_totalSeconds / (double)EnvMan.instance.m_environmentDuration;
				double num2 = 1.0 - (num - Math.Truncate(num));
				double num3 = num2 * (double)EnvMan.instance.m_environmentDuration;
				int hours = TimeSpan.FromSeconds(num3).Hours;
				int minutes = TimeSpan.FromSeconds(num3).Minutes;
				int seconds = TimeSpan.FromSeconds(num3).Seconds;
				if (num3 < 0.0)
				{
					return "";
				}
				return (hours > 0) ? $"{hours}:{minutes:D2}:{seconds:D2}" : ((minutes > 0) ? $"{minutes}:{seconds:D2}" : $"{seconds}");
			}
		}

		private const string SE_Weather = "SE_Weatherman";

		private static readonly int SE_Weather_StableHashCode = StringExtensionMethods.GetStableHashCode("SE_Weatherman");

		private static float m_timer;

		private static void RegisterEnvironments(EnvMan __instance)
		{
			EnvSetup env = __instance.GetEnv("Snow");
			EnvSetup env2 = __instance.GetEnv("SnowStorm");
			if (env != null && env2 != null)
			{
				EnvSetup val = env.Clone();
				val.m_isFreezing = false;
				val.m_isFreezingAtNight = false;
				val.m_name = "WarmSnow";
				EnvSetup val2 = env2.Clone();
				val2.m_isFreezing = false;
				val2.m_isFreezingAtNight = false;
				val2.m_name = "WarmSnowStorm";
				EnvSetup val3 = env.Clone();
				val3.m_isFreezing = false;
				val3.m_name = "NightFrost";
				val3.m_isFreezingAtNight = true;
				RegisterEnv(val);
				RegisterEnv(val2);
				RegisterEnv(val3);
			}
		}

		private static void RegisterEnv(EnvSetup setup)
		{
			if (Object.op_Implicit((Object)(object)EnvMan.instance) && !EnvMan.instance.m_environments.Contains(setup))
			{
				EnvMan.instance.m_environments.Add(setup);
			}
		}

		public static void OnWeatherDurationChange(object sender, EventArgs e)
		{
			if (Object.op_Implicit((Object)(object)EnvMan.instance) && Configs.m_weatherEnabled.Value != 0)
			{
				EnvMan.instance.m_environmentDuration = Configs.m_weatherDuration.Value * 60;
			}
		}

		private static List<EnvEntry> GetEnvironments(Biome biome, List<EnvEntry> entries)
		{
			//IL_0048: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)EnvMan.instance))
			{
				return entries;
			}
			List<EnvEntry> list = new List<EnvEntry>();
			if (!Configs.m_weatherOptions.TryGetValue(Configs.m_season.Value, out var value))
			{
				return entries;
			}
			if (!value.TryGetValue(biome, out var value2))
			{
				return entries;
			}
			if (Utility.IsNullOrWhiteSpace(value2.Value))
			{
				return entries;
			}
			foreach (WeatherConfig.WeatherData environment in new WeatherConfig(value2.Value).environments)
			{
				EnvSetup env = EnvMan.instance.GetEnv(environment.name);
				if (env != null)
				{
					EnvEntry item = new EnvEntry
					{
						m_environment = environment.name,
						m_weight = environment.weight,
						m_env = env
					};
					list.Add(item);
				}
			}
			return (list.Count > 0) ? list : entries;
		}

		public static void OnDisplayConfigChange(object sender, EventArgs e)
		{
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && ((Character)Player.m_localPlayer).GetSEMan().GetStatusEffect(SE_Weather_StableHashCode) is SE_WeatherMan sE_WeatherMan)
			{
				sE_WeatherMan.Update();
			}
		}

		public static void CheckOrSet(float dt)
		{
			if (Configs.m_displayWeather.Value == Toggle.Off)
			{
				return;
			}
			m_timer += dt;
			if (!(m_timer < 10f))
			{
				m_timer = 0f;
				if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && !((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(SE_Weather_StableHashCode))
				{
					((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(SE_Weather_StableHashCode, false, 0, 0f);
				}
			}
		}
	}
	[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
	[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
	public static class BeeHiveTweaks
	{
		[HarmonyPatch(typeof(Beehive), "Interact")]
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		private static class Beehive_Interact_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static bool Prefix(Beehive __instance, Humanoid character)
			{
				switch (Configs.m_season.Value)
				{
				case Season.Summer:
					if (SummerEnabled.Value == Toggle.Off)
					{
						((Character)character).Message((MessageType)2, __instance.m_areaText, 0, (Sprite)null);
						return false;
					}
					return true;
				case Season.Fall:
					if (FallEnabled.Value == Toggle.Off)
					{
						((Character)character).Message((MessageType)2, __instance.m_areaText, 0, (Sprite)null);
						return false;
					}
					return true;
				case Season.Spring:
					if (SpringEnabled.Value == Toggle.Off)
					{
						((Character)character).Message((MessageType)2, __instance.m_areaText, 0, (Sprite)null);
						return false;
					}
					return true;
				case Season.Winter:
					if (WinterEnabled.Value == Toggle.Off)
					{
						((Character)character).Message((MessageType)2, __instance.m_areaText, 0, (Sprite)null);
						return false;
					}
					return true;
				default:
					return true;
				}
			}
		}

		private static ConfigEntry<Toggle> SummerEnabled;

		private static ConfigEntry<Toggle> FallEnabled;

		private static ConfigEntry<Toggle> SpringEnabled;

		private static ConfigEntry<Toggle> WinterEnabled;

		public static void Setup()
		{
			SummerEnabled = ConfigManager.config("Tweaks", "Beehive Summer", Toggle.On, "If on, beehive interactable during summer");
			FallEnabled = ConfigManager.config("Tweaks", "Beehive Fall", Toggle.On, "If on, beehive interactable during fall");
			SpringEnabled = ConfigManager.config("Tweaks", "Beehive Spring", Toggle.On, "If on, beehive interactable during spring");
			WinterEnabled = ConfigManager.config("Tweaks", "Beehive Winter", Toggle.On, "If on, beehive interactable during winter");
		}
	}
	[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
	[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
	public static class BuildTweaks
	{
		[HarmonyPatch(typeof(PieceTable), "UpdateAvailable")]
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		private static class PieceTable_UpdateAvailable
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(PieceTable __instance, Player player)
			{
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: Invalid comparison between Unknown and I4
				//IL_011d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0127: Expected I4, but got Unknown
				if (m_enabled.Value == Toggle.Off)
				{
					return;
				}
				Piece component = default(Piece);
				foreach (string name in new StringListConfig(GetConfig().Value).m_names)
				{
					GameObject prefab = ZNetScene.instance.GetPrefab(name);
					if (prefab == null || !prefab.TryGetComponent<Piece>(ref component) || !player.HaveRequirements(component, (RequirementMode)2))
					{
						continue;
					}
					if ((int)component.m_category == 100)
					{
						foreach (List<Piece> item in __instance.m_availablePieces.Where((List<Piece> list) => !list.Contains(component)))
						{
							item.Add(component);
						}
					}
					else
					{
						List<Piece> list2 = __instance.m_availablePieces[(int)component.m_category];
						if (!list2.Contains(component))
						{
							list2.Add(component);
						}
					}
				}
			}
		}

		private static ConfigEntry<Toggle> m_enabled = null;

		private static ConfigEntry<string> m_winterPieces = null;

		private static ConfigEntry<string> m_springPieces = null;

		private static ConfigEntry<string> m_fallPieces = null;

		private static ConfigEntry<string> m_summerPieces = null;

		private static readonly List<string> m_defaultWinterPieces = new List<string> { "piece_xmascrown", "piece_xmastree", "piece_xmasgarland", "piece_mistletoe", "piece_gift1", "piece_gift2", "piece_gift3" };

		private static readonly List<string> m_defaultSpringPieces = new List<string>();

		private static readonly List<string> m_defaultFallPieces = new List<string> { "piece_jackoturnip" };

		private static readonly List<string> m_defaultSummerPieces = new List<string> { "piece_maypole" };

		public static void Setup()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Expected O, but got Unknown
			m_enabled = ConfigManager.config("Tweaks", "Build Pieces Enabled", Toggle.Off, "If on, seasonal build pieces enabled");
			m_winterPieces = ConfigManager.config("Tweaks", "Winter Pieces", new StringListConfig(m_defaultWinterPieces).ToString(), new ConfigDescription("Set added winter pieces", (AcceptableValueBase)null, new object[1] { StringListConfig.attributes }));
			m_springPieces = ConfigManager.config("Tweaks", "Spring Pieces", new StringListConfig(m_defaultSpringPieces).ToString(), new ConfigDescription("Set added spring pieces", (AcceptableValueBase)null, new object[1] { StringListConfig.attributes }));
			m_fallPieces = ConfigManager.config("Tweaks", "Fall Pieces", new StringListConfig(m_defaultFallPieces).ToString(), new ConfigDescription("Set added fall pieces", (AcceptableValueBase)null, new object[1] { StringListConfig.attributes }));
			m_summerPieces = ConfigManager.config("Tweaks", "Summer Pieces", new StringListConfig(m_defaultSummerPieces).ToString(), new ConfigDescription("Set added summer pieces", (AcceptableValueBase)null, new object[1] { StringListConfig.attributes }));
		}

		private static ConfigEntry<string> GetConfig()
		{
			Season value = Configs.m_season.Value;
			if (1 == 0)
			{
			}
			ConfigEntry<string> result = (ConfigEntry<string>)(value switch
			{
				Season.Summer => m_summerPieces, 
				Season.Spring => m_springPieces, 
				Season.Fall => m_fallPieces, 
				Season.Winter => m_winterPieces, 
				_ => m_summerPieces, 
			});
			if (1 == 0)
			{
			}
			return result;
		}
	}
	public static class FishTweaks
	{
		[HarmonyPatch(typeof(Fish), "Interact")]
		private static class Fish_Interact_Patch
		{
			private static bool Prefix()
			{
				if (m_enabled.Value == Toggle.Off)
				{
					return true;
				}
				return Configs.m_season.Value != Season.Winter;
			}
		}

		[HarmonyPatch(typeof(Fish), "GetHoverText")]
		private static class Fish_GetHoverText_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(ref string __result)
			{
				if (m_enabled.Value != 0 && Configs.m_season.Value == Season.Winter)
				{
					__result += Localization.instance.Localize("\n $cannot_pick");
				}
			}
		}

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(1)]
		private static ConfigEntry<Toggle> m_enabled;

		public static void Setup()
		{
			m_enabled = ConfigManager.config("Tweaks", "Frozen Fish", Toggle.Off, "If on, fish cannot be picked up during winter");
		}
	}
	[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
	[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
	public static class PickableTweaks
	{
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		[HarmonyPatch(typeof(Pickable), "Awake")]
		private static class Pickable_Awake_Patch
		{
			[UsedImplicitly]
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(Pickable __instance)
			{
				if (m_enabled.Value != 0 && GetHarvestData(((Object)__instance).name.Replace("(Clone)", string.Empty), out var result))
				{
					__instance.m_amount = result.Amount;
				}
			}
		}

		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		[HarmonyPatch(typeof(Pickable), "Interact")]
		private static class Pickable_Interact_Patch
		{
			[UsedImplicitly]
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static bool Prefix(Pickable __instance)
			{
				if (m_enabled.Value == Toggle.Off)
				{
					return true;
				}
				if (!GetHarvestData(((Object)__instance).name.Replace("(Clone)", string.Empty), out var result))
				{
					return true;
				}
				return result.CanHarvest;
			}
		}

		[HarmonyPatch(typeof(Pickable), "GetHoverText")]
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		private static class Pickable_GetHoverText_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			[UsedImplicitly]
			private static void Postfix(Pickable __instance, ref string __result)
			{
				if (m_enabled.Value != 0 && GetHarvestData(((Object)__instance).name.Replace("(Clone)", string.Empty), out var result) && !result.CanHarvest)
				{
					__result += Localization.instance.Localize("\n <color=red>$cannot_pick</color>");
				}
			}
		}

		[Serializable]
		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
		public class Harvest
		{
			[Serializable]
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
			public class HarvestData
			{
				public int Amount;

				public bool CanHarvest;
			}

			public HarvestData Summer = new HarvestData();

			public HarvestData Fall = new HarvestData();

			public HarvestData Winter = new HarvestData();

			public HarvestData Spring = new HarvestData();
		}

		private const string FileName = "Pickables.yml";

		private static readonly string FilePath;

		private static readonly CustomSyncedValue<string> ServerPickableConfigs;

		private static ConfigEntry<Toggle> m_enabled;

		public static readonly Dictionary<string, Harvest> m_data;

		private static readonly ISerializer serializer;

		private static readonly IDeserializer deserializer;

		public static void Setup()
		{
			m_enabled = ConfigManager.config("Tweaks", "Pickable Enabled", Toggle.Off, "If on, pickable tweaks are enabled");
			Read();
			ServerPickableConfigs.ValueChanged += OnServerValueChanged;
			if (m_data.Count == 0)
			{
				TweaksManager.OnZNetScenePrefab += delegate(GameObject prefab)
				{
					Pickable val = default(Pickable);
					if (!m_data.ContainsKey(((Object)prefab).name) && prefab.TryGetComponent<Pickable>(ref val))
					{
						m_data[((Object)prefab).name] = new Harvest
						{
							Summer = CreateData(val.m_amount),
							Fall = CreateData(val.m_amount),
							Winter = CreateData(val.m_amount, canHarvest: false),
							Spring = CreateData(val.m_amount)
						};
					}
				};
				TweaksManager.OnFinishSetup += Write;
			}
			TweaksManager.OnZNetAwake += delegate
			{
				UpdateServerConfigs();
				SetupFileWatch();
			};
		}

		private static void OnServerValueChanged()
		{
			if (!Object.op_Implicit((Object)(object)ZNet.m_instance) || ZNet.m_instance.IsServer() || string.IsNullOrEmpty(ServerPickableConfigs.Value))
			{
				return;
			}
			try
			{
				m_data.Clear();
				m_data.AddRange(deserializer.Deserialize<Dictionary<string, Harvest>>(ServerPickableConfigs.Value));
			}
			catch
			{
				SeasonalityPlugin.Record.LogWarning("Failed to deserialize server pickable configs");
			}
		}

		public static void SetupFileWatch()
		{
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(TweaksManager.FolderPath, "Pickables.yml");
			fileSystemWatcher.Changed += ReadConfigValues;
			fileSystemWatcher.Created += ReadConfigValues;
			fileSystemWatcher.Renamed += ReadConfigValues;
			fileSystemWatcher.IncludeSubdirectories = false;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			fileSystemWatcher.EnableRaisingEvents = true;
			static void ReadConfigValues(object sender, FileSystemEventArgs args)
			{
				if (Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.instance.IsServer())
				{
					Read();
					UpdateServerConfigs();
				}
			}
		}

		public static void UpdateServerConfigs()
		{
			if (Object.op_Implicit((Object)(object)ZNet.m_instance) && ZNet.m_instance.IsServer())
			{
				ServerPickableConfigs.Value = serializer.Serialize((object)m_data);
			}
		}

		private static bool GetHarvestData(string prefabName, out Harvest.HarvestData result)
		{
			result = new Harvest.HarvestData();
			if (!m_data.TryGetValue(prefabName, out var value))
			{
				return false;
			}
			switch (Configs.m_season.Value)
			{
			case Season.Fall:
				result = value.Fall;
				break;
			case Season.Winter:
				result = value.Winter;
				break;
			case Season.Spring:
				result = value.Spring;
				break;
			case Season.Summer:
				result = value.Summer;
				break;
			default:
				return false;
			}
			return true;
		}

		public static void Read()
		{
			if (!Directory.Exists(TweaksManager.FolderPath))
			{
				Directory.CreateDirectory(TweaksManager.FolderPath);
			}
			if (!File.Exists(FilePath))
			{
				return;
			}
			try
			{
				m_data.Clear();
				m_data.AddRange(deserializer.Deserialize<Dictionary<string, Harvest>>(File.ReadAllText(FilePath)));
			}
			catch
			{
				SeasonalityPlugin.Record.LogWarning("Failed to deserialize: " + Path.GetFileName(FilePath));
			}
		}

		public static void Write()
		{
			if (!Directory.Exists(TweaksManager.FolderPath))
			{
				Directory.CreateDirectory(TweaksManager.FolderPath);
			}
			string contents = serializer.Serialize((object)m_data);
			File.WriteAllText(FilePath, contents);
		}

		public static Harvest.HarvestData CreateData(int amount, bool canHarvest = true)
		{
			return new Harvest.HarvestData
			{
				Amount = amount,
				CanHarvest = canHarvest
			};
		}

		static PickableTweaks()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			string folderPath = TweaksManager.FolderPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			FilePath = folderPath + directorySeparatorChar + "Pickables.yml";
			ServerPickableConfigs = new CustomSyncedValue<string>(ConfigManager.ConfigSync, "ServerPickableConfigs", "");
			m_enabled = null;
			m_data = new Dictionary<string, Harvest>();
			serializer = new SerializerBuilder().Build();
			deserializer = new DeserializerBuilder().Build();
		}
	}
	[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
	[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
	public static class PlantTweaks
	{
		[HarmonyPatch(typeof(Plant), "Grow")]
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		private static class Plant_Grow_Patch
		{
			[UsedImplicitly]
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static bool Prefix(Plant __instance)
			{
				if (m_enabled.Value == Toggle.Off)
				{
					return true;
				}
				if (!m_data.TryGetValue(((Object)__instance).name.Replace("(Clone)", string.Empty), out var value))
				{
					return true;
				}
				Season value2 = Configs.m_season.Value;
				if (1 == 0)
				{
				}
				bool result = value2 switch
				{
					Season.Spring => value.Spring.CanHarvest, 
					Season.Summer => value.Summer.CanHarvest, 
					Season.Fall => value.Fall.CanHarvest, 
					Season.Winter => value.Winter.CanHarvest, 
					_ => true, 
				};
				if (1 == 0)
				{
				}
				return result;
			}
		}

		[HarmonyPatch(typeof(Plant), "GetStatus")]
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		private static class Plant_GetStatus_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			[UsedImplicitly]
			private static void Postfix(Plant __instance, ref Status __result)
			{
				if (m_enabled.Value == Toggle.Off || !m_data.TryGetValue(((Object)__instance).name.Replace("(Clone)", string.Empty), out var value))
				{
					return;
				}
				switch (Configs.m_season.Value)
				{
				case Season.Spring:
					if (!value.Spring.CanHarvest)
					{
						__result = (Status)2;
					}
					break;
				case Season.Summer:
					if (!value.Summer.CanHarvest)
					{
						__result = (Status)2;
					}
					break;
				case Season.Fall:
					if (!value.Fall.CanHarvest)
					{
						__result = (Status)2;
					}
					break;
				case Season.Winter:
					if (!value.Winter.CanHarvest)
					{
						__result = (Status)2;
					}
					break;
				}
			}
		}

		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		[HarmonyPatch(typeof(Plant), "GetHoverText")]
		private static class Plant_GetHoverText_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			[UsedImplicitly]
			private static void Postfix(Plant __instance, ref string __result)
			{
				if (m_enabled.Value == Toggle.Off || !m_data.TryGetValue(((Object)__instance).name.Replace("(Clone)", string.Empty), out var value))
				{
					return;
				}
				switch (Configs.m_season.Value)
				{
				case Season.Spring:
					if (value.Spring.CanHarvest)
					{
						return;
					}
					break;
				case Season.Summer:
					if (value.Summer.CanHarvest)
					{
						return;
					}
					break;
				case Season.Fall:
					if (value.Fall.CanHarvest)
					{
						return;
					}
					break;
				case Season.Winter:
					if (value.Winter.CanHarvest)
					{
						return;
					}
					break;
				}
				__result += Localization.instance.Localize("\n <color=red>$" + Configs.m_season.Value.ToString().ToLower() + "_cannot_grow</color>");
			}
		}

		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		[HarmonyPatch(typeof(Plant), "Awake")]
		private static class Plant_Awake_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			[UsedImplicitly]
			private static void Postfix(Plant __instance)
			{
				if (m_enabled.Value != 0 && m_data.TryGetValue(((Object)__instance).name.Replace("(Clone)", string.Empty), out var value))
				{
					Plants.Data data;
					switch (Configs.m_season.Value)
					{
					default:
						return;
					case Season.Spring:
						data = value.Spring;
						break;
					case Season.Summer:
						data = value.Summer;
						break;
					case Season.Fall:
						data = value.Fall;
						break;
					case Season.Winter:
						data = value.Winter;
						break;
					}
					__instance.m_maxScale = data.MaxScale;
					__instance.m_minScale = data.MinScale;
					__instance.m_growTimeMax = data.GrowTimeMax;
					__instance.m_growTime = data.GrowTime;
				}
			}
		}

		[Serializable]
		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
		public class Plants
		{
			[Serializable]
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
			public class Data
			{
				public float MaxScale;

				public float MinScale;

				public float GrowTimeMax;

				public float GrowTime;

				public bool CanHarvest;
			}

			public Data Summer = new Data();

			public Data Fall = new Data();

			public Data Winter = new Data();

			public Data Spring = new Data();
		}

		private const string FileName = "Plants.yml";

		private static readonly string FilePath;

		private static readonly CustomSyncedValue<string> ServerConfigs;

		private static ConfigEntry<Toggle> m_enabled;

		public static readonly Dictionary<string, Plants> m_data;

		private static readonly ISerializer serializer;

		private static readonly IDeserializer deserializer;

		public static void Setup()
		{
			m_enabled = ConfigManager.config("Tweaks", "Plants Tweaks", Toggle.Off, "If on, plant tweaks are enabled");
			Read();
			ServerConfigs.ValueChanged += OnServerValueChanged;
			if (m_data.Count == 0)
			{
				TweaksManager.OnZNetScenePrefab += delegate(GameObject prefab)
				{
					Plant val = default(Plant);
					if (!m_data.ContainsKey(((Object)prefab).name) && prefab.TryGetComponent<Plant>(ref val))
					{
						m_data[((Object)prefab).name] = new Plants
						{
							Summer = Create(val.m_minScale, val.m_maxScale, val.m_growTimeMax, val.m_growTime),
							Fall = Create(val.m_minScale, val.m_maxScale, val.m_growTimeMax, val.m_growTime),
							Winter = Create(val.m_minScale, val.m_maxScale, val.m_growTimeMax, val.m_growTime, canHarvest: false),
							Spring = Create(val.m_minScale, val.m_maxScale, val.m_growTimeMax, val.m_growTime)
						};
					}
				};
				TweaksManager.OnFinishSetup += Write;
			}
			TweaksManager.OnZNetAwake += delegate
			{
				UpdateServerConfigs();
				SetupFileWatch();
			};
		}

		private static void OnServerValueChanged()
		{
			if (!Object.op_Implicit((Object)(object)ZNet.m_instance) || ZNet.m_instance.IsServer() || string.IsNullOrEmpty(ServerConfigs.Value))
			{
				return;
			}
			try
			{
				m_data.Clear();
				m_data.AddRange(deserializer.Deserialize<Dictionary<string, Plants>>(ServerConfigs.Value));
			}
			catch
			{
				SeasonalityPlugin.Record.LogWarning("Failed to deserialize server plant configs");
			}
		}

		public static void UpdateServerConfigs()
		{
			if (Object.op_Implicit((Object)(object)ZNet.m_instance) && ZNet.m_instance.IsServer())
			{
				ServerConfigs.Value = serializer.Serialize((object)m_data);
			}
		}

		public static void SetupFileWatch()
		{
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(TweaksManager.FolderPath, "Plants.yml");
			fileSystemWatcher.Changed += ReadConfigValues;
			fileSystemWatcher.Created += ReadConfigValues;
			fileSystemWatcher.Renamed += ReadConfigValues;
			fileSystemWatcher.IncludeSubdirectories = false;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			fileSystemWatcher.EnableRaisingEvents = true;
			static void ReadConfigValues(object sender, FileSystemEventArgs args)
			{
				if (Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.instance.IsServer())
				{
					Read();
					UpdateServerConfigs();
				}
			}
		}

		public static void Write()
		{
			string contents = serializer.Serialize((object)m_data);
			File.WriteAllText(FilePath, contents);
		}

		public static void Read()
		{
			if (!File.Exists(FilePath))
			{
				return;
			}
			try
			{
				m_data.Clear();
				m_data.AddRange(deserializer.Deserialize<Dictionary<string, Plants>>(File.ReadAllText(FilePath)));
			}
			catch
			{
				SeasonalityPlugin.Record.LogWarning("Failed to deserialize plant tweaks: " + Path.GetFileName(FilePath));
			}
		}

		public static Plants.Data Create(float min, float max, float growTimeMax, float growTime, bool canHarvest = true)
		{
			return new Plants.Data
			{
				MaxScale = max,
				MinScale = min,
				GrowTime = growTime,
				GrowTimeMax = growTimeMax,
				CanHarvest = canHarvest
			};
		}

		static PlantTweaks()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			string folderPath = TweaksManager.FolderPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			FilePath = folderPath + directorySeparatorChar + "Plants.yml";
			ServerConfigs = new CustomSyncedValue<string>(ConfigManager.ConfigSync, "ServerPlantConfigs", "");
			m_enabled = null;
			m_data = new Dictionary<string, Plants>();
			serializer = new SerializerBuilder().Build();
			deserializer = new DeserializerBuilder().Build();
		}
	}
	[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
	[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
	public static class SpawnTweaks
	{
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		[HarmonyPatch(typeof(SpawnSystem), "Spawn")]
		private static class SpawnSystem_Spawn_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static bool Prefix(SpawnData critter)
			{
				if (m_enabled.Value == Toggle.Off)
				{
					return true;
				}
				if (!m_data.TryGetValue(((Object)critter.m_prefab).name, out var value))
				{
					return true;
				}
				bool value2;
				return !value.TryGetValue(Configs.m_season.Value, out value2) || value2;
			}
		}

		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		[HarmonyPatch(typeof(SpawnArea), "SpawnOne")]
		private static class SpawnArea_SpawnOne_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static bool Prefix(SpawnArea __instance)
			{
				if (m_enabled.Value == Toggle.Off)
				{
					return true;
				}
				foreach (SpawnData prefab in __instance.m_prefabs)
				{
					if (prefab == null || (Object)(object)prefab.m_prefab == (Object)null || !m_data.TryGetValue(((Object)prefab.m_prefab).name, out var value) || !value.TryGetValue(Configs.m_season.Value, out var value2) || value2)
					{
						continue;
					}
					return false;
				}
				return true;
			}
		}

		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		[HarmonyPatch(typeof(BaseAI), "UpdateAI")]
		private static class BaseAI_UpdateAI_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static bool Prefix(BaseAI __instance, float dt, ref bool __result)
			{
				if (m_enabled.Value == Toggle.Off)
				{
					return true;
				}
				if (!__instance.m_nview.IsValid() || !__instance.m_nview.IsOwner())
				{
					return true;
				}
				string prefabName = Utils.GetPrefabName(((Object)__instance).name);
				if (!m_data.TryGetValue(prefabName, out var value))
				{
					return true;
				}
				if (!value.TryGetValue(Configs.m_season.Value, out var value2))
				{
					return true;
				}
				if (value2)
				{
					return true;
				}
				__instance.MoveAwayAndDespawn(dt, true);
				__result = false;
				return false;
			}
		}

		private static readonly string FileName = "SpawnTweaks.yml";

		private static readonly string FilePath = Path.Combine(TweaksManager.FolderPath, FileName);

		public static readonly Dictionary<string, Dictionary<Season, bool>> m_data = new Dictionary<string, Dictionary<Season, bool>>();

		private static ConfigEntry<Toggle> m_enabled = null;

		private static readonly ISerializer serializer = new SerializerBuilder().Build();

		private static readonly IDeserializer deserializer = new DeserializerBuilder().Build();

		private static readonly CustomSyncedValue<string> ServerSpawnData = new CustomSyncedValue<string>(ConfigManager.ConfigSync, "Seasonality.Server.SpawnData", "");

		public static void OnServerValueChanged()
		{
			if (!Object.op_Implicit((Object)(object)ZNet.instance) || ZNet.instance.IsServer() || string.IsNullOrEmpty(ServerSpawnData.Value))
			{
				return;
			}
			try
			{
				m_data.Clear();
				m_data.AddRange(deserializer.Deserialize<Dictionary<string, Dictionary<Season, bool>>>(ServerSpawnData.Value));
			}
			catch
			{
				SeasonalityPlugin.Record.LogWarning("Failed to parse server spawn data.");
			}
		}

		public static void UpdateServerConfigs()
		{
			if (Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.instance.IsServer())
			{
				ServerSpawnData.Value = serializer.Serialize((object)m_data);
			}
		}

		public static void SetupFileWatch()
		{
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(TweaksManager.FolderPath, FileName);
			fileSystemWatcher.Changed += ReadConfigValues;
			fileSystemWatcher.Created += ReadConfigValues;
			fileSystemWatcher.Renamed += ReadConfigValues;
			fileSystemWatcher.IncludeSubdirectories = false;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			fileSystemWatcher.EnableRaisingEvents = true;
			static void ReadConfigValues(object sender, FileSystemEventArgs args)
			{
				if (Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.instance.IsServer())
				{
					Read();
					UpdateServerConfigs();
				}
			}
		}

		public static void Setup()
		{
			m_enabled = ConfigManager.config("Tweaks", "Spawns Enabled", Toggle.Off, "If on, spawns are modified per season");
			Read();
			ServerSpawnData.ValueChanged += OnServerValueChanged;
			if (m_data.Count == 0)
			{
				TweaksManager.OnZNetScenePrefab += delegate(GameObject prefab)
				{
					Character val = default(Character);
					if (!m_data.ContainsKey(((Object)prefab).name) && prefab.TryGetComponent<Character>(ref val) && !(val is Player))
					{
						m_data[((Object)prefab).name] = new Dictionary<Season, bool>
						{
							[Season.Spring] = true,
							[Season.Summer] = true,
							[Season.Fall] = true,
							[Season.Winter] = true
						};
					}
				};
				TweaksManager.OnFinishSetup += Write;
			}
			TweaksManager.OnZNetAwake += delegate
			{
				UpdateServerConfigs();
				SetupFileWatch();
			};
		}

		public static void Write()
		{
			string contents = serializer.Serialize((object)m_data);
			File.WriteAllText(FilePath, contents);
		}

		public static void Read()
		{
			if (!File.Exists(FilePath))
			{
				return;
			}
			try
			{
				m_data.Clear();
				m_data.AddRange(deserializer.Deserialize<Dictionary<string, Dictionary<Season, bool>>>(File.ReadAllText(FilePath)));
			}
			catch
			{
				SeasonalityPlugin.Record.LogWarning("Failed to deserialize spawn tweaks file: " + Path.GetFileName(FilePath));
			}
		}
	}
	[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
	[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
	public static class TraderTweaks
	{
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		[HarmonyPatch(typeof(Trader), "GetAvailableItems")]
		private static class Trader_GetAvailableItems_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(ref List<TradeItem> __result)
			{
				if (m_enabled.Value == Toggle.Off)
				{
					return;
				}
				foreach (SerializedItems.SeasonalItem item in new SerializedItems(GetConfig().Value).m_items)
				{
					TradeItem tradeItem = item.GetTradeItem();
					if (tradeItem != null)
					{
						__result.Add(tradeItem);
					}
				}
			}
		}

		private static ConfigEntry<Toggle> m_enabled = null;

		private static ConfigEntry<string> m_summerItems = null;

		private static ConfigEntry<string> m_fallItems = null;

		private static ConfigEntry<string> m_winterItems = null;

		private static ConfigEntry<string> m_springItems = null;

		private static readonly List<SerializedItems.SeasonalItem> m_defaultSummerItems = new List<SerializedItems.SeasonalItem>
		{
			new SerializedItems.SeasonalItem("HelmetMidsummerCrown", 1, 300)
		};

		private static readonly List<SerializedItems.SeasonalItem> m_defaultFallItems = new List<SerializedItems.SeasonalItem>
		{
			new SerializedItems.SeasonalItem("HelmetPointyHat", 1, 300)
		};

		private static readonly List<SerializedItems.SeasonalItem> m_defaultWinterItems = new List<SerializedItems.SeasonalItem>();

		private static readonly List<SerializedItems.SeasonalItem> m_defaultSpringItems = new List<SerializedItems.SeasonalItem>();

		public static void Setup()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Expected O, but got Unknown
			m_enabled = ConfigManager.config("Tweaks", "Trader Enabled", Toggle.Off, "If on, trader has extra items for sale depending on season");
			m_summerItems = ConfigManager.config("Tweaks", "Summer Items", new SerializedItems(m_defaultSummerItems).ToString(), new ConfigDescription("Set summer items added to trader", (AcceptableValueBase)null, new object[1] { SerializedItems.attributes }));
			m_fallItems = ConfigManager.config("Tweaks", "Fall Items", new SerializedItems(m_defaultFallItems).ToString(), new ConfigDescription("Set fall items added to trader", (AcceptableValueBase)null, new object[1] { SerializedItems.attributes }));
			m_winterItems = ConfigManager.config("Tweaks", "Winter Items", new SerializedItems(m_defaultWinterItems).ToString(), new ConfigDescription("Set fall items added to trader", (AcceptableValueBase)null, new object[1] { SerializedItems.attributes }));
			m_springItems = ConfigManager.config("Tweaks", "Spring Items", new SerializedItems(m_defaultSpringItems).ToString(), new ConfigDescription("Set fall items added to trader", (AcceptableValueBase)null, new object[1] { SerializedItems.attributes }));
		}

		private static ConfigEntry<string> GetConfig()
		{
			Season value = Configs.m_season.Value;
			if (1 == 0)
			{
			}
			ConfigEntry<string> result = (ConfigEntry<string>)(value switch
			{
				Season.Summer => m_summerItems, 
				Season.Fall => m_fallItems, 
				Season.Winter => m_winterItems, 
				Season.Spring => m_springItems, 
				_ => m_summerItems, 
			});
			if (1 == 0)
			{
			}
			return result;
		}
	}
	[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
	[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(2)]
	public static class TweaksManager
	{
		[HarmonyPatch(typeof(ZNet), "Awake")]
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		private static class ZNet_Awake_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			[UsedImplicitly]
			private static void Postfix(ZNet __instance)
			{
				if (__instance.IsServer())
				{
					TweaksManager.OnZNetAwake?.Invoke();
				}
			}
		}

		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(0)]
		private static class ZNetScene_Awake_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			[UsedImplicitly]
			private static void Postfix(ZNetScene __instance)
			{
				foreach (GameObject prefab in __instance.m_prefabs)
				{
					if (!((Object)(object)prefab == (Object)null))
					{
						TweaksManager.OnZNetScenePrefab?.Invoke(prefab);
					}
				}
				TweaksManager.OnFinishSetup?.Invoke();
			}
		}

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(1)]
		private static readonly string ConfigFolder;

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(1)]
		public static readonly string FolderPath;

		public static event Action OnZNetAwake;

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(new byte[] { 2, 1 })]
		[method: <940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(new byte[] { 2, 1 })]
		[field: <940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(new byte[] { 2, 1 })]
		public static event Action<GameObject> OnZNetScenePrefab;

		public static event Action OnFinishSetup;

		public static void Setup()
		{
			if (!Directory.Exists(ConfigFolder))
			{
				Directory.CreateDirectory(ConfigFolder);
			}
			if (!Directory.Exists(FolderPath))
			{
				Directory.CreateDirectory(FolderPath);
			}
			PickableTweaks.Setup();
			PlantTweaks.Setup();
			FishTweaks.Setup();
			SpawnTweaks.Setup();
			TraderTweaks.Setup();
			BuildTweaks.Setup();
			BeeHiveTweaks.Setup();
			WetTweaks.Setup();
		}

		static TweaksManager()
		{
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			ConfigFolder = configPath + directorySeparatorChar + "Seasonality";
			string configFolder = ConfigFolder;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			FolderPath = configFolder + directorySeparatorChar + "Tweaks";
		}
	}
	public static class WetTweaks
	{
		[HarmonyPatch(typeof(Player), "UpdateEnvStatusEffects")]
		public static class Player_UpdateEnvStatusEffects
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			public static void Postfix(Player __instance)
			{
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Invalid comparison between Unknown and I4
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Invalid comparison between Unknown and I4
				if (enabled.Value == Toggle.Off || Configs.m_season.Value != Season.Winter || ((Character)__instance).GetSEMan().HaveStatusEffect(SEMan.s_statusEffectFreezing))
				{
					return;
				}
				DamageModifiers damageModifiers = ((Character)__instance).GetDamageModifiers((WeakSpot)null);
				DamageModifier modifier = ((DamageModifiers)(ref damageModifiers)).GetModifier((DamageType)64);
				if (((int)modifier == 1 || modifier - 3 <= 1) ? true : false)
				{
					return;
				}
				StatusEffect statusEffect = ((Character)__instance).GetSEMan().GetStatusEffect(SEMan.s_statusEffectWet);
				if (!((Object)(object)statusEffect == (Object)null))
				{
					StatusEffect val = ((Character)__instance).GetSEMan().AddStatusEffect(SEMan.s_statusEffectFreezing, false, 0, 0f);
					if (!((Object)(object)val == (Object)null))
					{
						val.m_ttl = statusEffect.m_ttl;
						val.m_category = "Seasonality";
						((Character)__instance).GetSEMan().RemoveStatusEffect(SEMan.s_statusEffectWet, true);
						((Character)__instance).GetSEMan().RemoveStatusEffect(SEMan.s_statusEffectCold, true);
					}
				}
			}
		}

		[HarmonyPatch(typeof(SEMan), "AddStatusEffect", new Type[]
		{
			typeof(int),
			typeof(bool),
			typeof(int),
			typeof(float)
		})]
		private static class SEMan_AddStatusEffect_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static bool Prefix(SEMan __instance, int nameHash)
			{
				if (enabled.Value == Toggle.Off)
				{
					return true;
				}
				if (!(__instance.m_character is Player))
				{
					return true;
				}
				if (nameHash != SEMan.s_statusEffectWet)
				{
					return true;
				}
				StatusEffect statusEffect = __instance.GetStatusEffect(SEMan.s_statusEffectFreezing);
				if ((Object)(object)statusEffect == (Object)null)
				{
					return true;
				}
				if (statusEffect.m_category != "Seasonality")
				{
					return true;
				}
				return false;
			}
		}

		[HarmonyPatch(typeof(SEMan), "RemoveStatusEffect", new Type[]
		{
			typeof(int),
			typeof(bool)
		})]
		private static class SEMan_RemoveStatusEffect_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static bool Prefix(SEMan __instance, int nameHash)
			{
				if (enabled.Value == Toggle.Off)
				{
					return true;
				}
				if (nameHash != SEMan.s_statusEffectFreezing)
				{
					return true;
				}
				if (!(__instance.m_character is Player))
				{
					return true;
				}
				StatusEffect statusEffect = __instance.GetStatusEffect(nameHash);
				if ((Object)(object)statusEffect == (Object)null)
				{
					return true;
				}
				if (statusEffect.m_category != "Seasonality")
				{
					return true;
				}
				if (__instance.HaveStatusEffect(SEMan.s_statusEffectCampFire))
				{
					statusEffect.m_ttl -= 0.25f;
				}
				return false;
			}
		}

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(1)]
		private static ConfigEntry<Toggle> enabled;

		public static void Setup()
		{
			enabled = ConfigManager.config("Winter", "Wet Freezes", Toggle.Off, "If on, player will freeze if wet during winter");
		}
	}
	[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(0)]
	[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
	public class Records
	{
		private static string ConfigFolder;

		private static string FileName;

		private static string FilePath;

		private readonly ManualLogSource m_manualLogSource;

		private readonly List<string> m_records = new List<string>();

		public Records(ManualLogSource logger, string folderName, string fileName)
		{
			m_manualLogSource = logger;
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			ConfigFolder = configPath + directorySeparatorChar + folderName;
			FileName = fileName;
			string configFolder = ConfigFolder;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			FilePath = configFolder + directorySeparatorChar + fileName;
		}

		public void LogSuccess(string log)
		{
			m_records.Add("[Success]: " + log);
		}

		public void LogDebug(string log)
		{
			m_records.Add("[Debug]: " + log);
			m_manualLogSource.LogDebug((object)log);
		}

		public void LogInfo(string log)
		{
			m_records.Add("[Info]: " + log);
			m_manualLogSource.LogInfo((object)log);
		}

		public void LogWarning(string log)
		{
			m_records.Add("[Warning]: " + log);
			m_manualLogSource.LogWarning((object)log);
		}

		public void LogError(string log)
		{
			m_records.Add("[Error]: " + log);
			m_manualLogSource.LogError((object)log);
		}

		public void Write()
		{
			if (!Directory.Exists(ConfigFolder))
			{
				Directory.CreateDirectory(ConfigFolder);
			}
			File.WriteAllLines(FilePath, m_records);
			LogInfo(FileName + " wrote to file: " + FilePath);
		}

		static Records()
		{
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			ConfigFolder = configPath + directorySeparatorChar + "Seasonality";
			FileName = "Seasonality-LogOutput.log";
			string configFolder = ConfigFolder;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			FilePath = configFolder + directorySeparatorChar + FileName;
		}
	}
	public class SeasonalTimer : MonoBehaviour
	{
		[HarmonyPatch(typeof(Game), "SleepStop")]
		private static class Game_SleepStop_Patch
		{
			[UsedImplicitly]
			private static void Postfix()
			{
				instance?.OnSleepStop();
			}
		}

		[HarmonyPatch(typeof(ZNet), "Start")]
		private static class ZNet_Start_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			[UsedImplicitly]
			private static void Postfix(ZNet __instance)
			{
				SeasonalityPlugin.Record.LogDebug("ZNet.Start");
				lastSeasonChangeFileName = __instance.GetWorldName() + ".Seasonality.bin";
				Read();
				if (__instance.IsServer())
				{
					instance?.ScheduleNextSeason();
				}
			}
		}

		[HarmonyPatch(typeof(ZNet), "SetNetTime")]
		private static class ZNet_SetNetTime_Patch
		{
			[UsedImplicitly]
			private static void Postfix()
			{
				if (!Game.instance.m_sleeping)
				{
					instance?.ResetSchedule();
				}
			}
		}

		[HarmonyPatch(typeof(ZNet), "OnNewConnection")]
		private static class RegisterSetLastSeasonChangeAndSet
		{
			[UsedImplicitly]
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Prefix(ZNetPeer peer)
			{
				peer.m_rpc.Register<double>("RPC_SetLastSeasonChange", (Action<ZRpc, double>)RPC_SetLastSeasonChange);
			}
		}

		[HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")]
		private static class ZNet_RPC_PeerInfo_Patch
		{
			[UsedImplicitly]
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(ZNet __instance, ZRpc rpc)
			{
				if (__instance.IsServer())
				{
					rpc.Invoke("RPC_SetLastSeasonChange", new object[1] { lastSeasonChange });
				}
			}
		}

		[HarmonyPatch(typeof(ZNet), "SendPlayerList")]
		private static class ZNet_SendPlayer_Patch
		{
			[<5772221b-d27e-4907-bdd5-f786b072bf0c>NullableContext(1)]
			private static void Postfix(ZNet __instance)
			{
				if (__instance.IsServer() && !((Object)(object)instance == (Object)null))
				{
					if (__instance.GetNrOfPlayers() <= 0)
					{
						instance.Pause();
					}
					else
					{
						instance.Continue();
					}
				}
			}
		}

		public static bool hasValidServer;

		public static bool m_sleepOverride;

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(1)]
		private static readonly string ConfigFolder;

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(1)]
		private static readonly string BinFolder;

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(2)]
		public static SeasonalTimer instance;

		public float m_fadeTimer;

		[<940de675-ac5e-4a4f-a395-f7d1b5208a00>Nullable(2)]
		public static string lastSeasonChangeFileName;

		public static double lastSeasonChange;

		public void Awake()
		{
			SeasonalityPlugin.Record.LogDebug("Seasonal Timer Awake");
			instance = this;
			if (!Directory.Exists(ConfigFolder))
			{
				Directory.CreateDirectory(ConfigFolder);
			}
			if (!Directory.Exists(BinFolder))
			{
				Directory.CreateDirectory(BinFolder);
			}
		}

		public void Pause()
		{
			if (((MonoBehaviour)this).IsInvoking("ChangeSeason"))
			{
				((MonoBehaviour)this).CancelInvoke("ChangeSeason");
				SeasonalityPlugin.Record.LogDebug("Seasonal Timer Pause");
			}
		}

		public void Continue()
		{
			if (!((MonoBehaviour)this).IsInvoking("ChangeSeason"))
			{
				ScheduleNextSeason();
				SeasonalityPlugin.Record.LogDebug("Seasonal Timer Continue");
			}
		}

		public static void Read()
		{
			if (lastSeasonChangeFileName == null)
			{
				return;
			}
			string path = Path.Combine(BinFolder, lastSeasonChangeFileName);
			if (!File.Exists(path))
			{
				return;
			}
			try
			{
				using BinaryReader binaryReader = new BinaryReader(File.OpenRead(path));
				lastSeasonChange = binaryReader.ReadDouble();
				SeasonalityPlugin.Record.LogDebug($"Reading last season change from, {Path.GetFileNameWithoutExtension(path)}: {lastSeasonChange}");
				if (lastSeasonChange > ZNet.instance.GetTimeSeconds())
				{
					SeasonalityPlugin.Record.LogDebug($"Last season change time {lastSeasonChange} is larger than world time: {ZNet.instance.GetTimeSeconds()}, setting last season change to world time");
					lastSeasonChange = ZNet.instance.GetTimeSeconds();
				}
			}
			catch (Exception ex)
			{
				SeasonalityPlugin.Record.LogError(ex.Message);
			}
		}

		public static void Save()
		{
			if (lastSeasonChangeFileName == null)
			{
				return;
			}
			string path = Path.Combine(BinFolder, lastSeasonChangeFileName);
			try
			{
				using BinaryWriter binaryWriter = new BinaryWriter(File.Create(path));
				binaryWriter.Write(lastSeasonChange);
				SeasonalityPlugin.Record.LogDebug($"Saving last season change to, {Path.GetFileNameWithoutExtension(path)}, {lastSeasonChange}");
			}
			catch (Exception ex)