Decompiled source of Seasonality v3.4.6

Seasonality.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using Seasonality.Behaviors;
using Seasonality.DataTypes;
using Seasonality.Managers;
using Seasonality.SeasonUtility;
using Seasonality.SeasonalityPaths;
using Seasonality.Seasons;
using Seasonality.Textures;
using ServerSync;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Core.Tokens;
using YamlDotNet.Helpers;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.BufferedDeserialization;
using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators;
using YamlDotNet.Serialization.Callbacks;
using YamlDotNet.Serialization.Converters;
using YamlDotNet.Serialization.EventEmitters;
using YamlDotNet.Serialization.NamingConventions;
using YamlDotNet.Serialization.NodeDeserializers;
using YamlDotNet.Serialization.NodeTypeResolvers;
using YamlDotNet.Serialization.ObjectFactories;
using YamlDotNet.Serialization.ObjectGraphTraversalStrategies;
using YamlDotNet.Serialization.ObjectGraphVisitors;
using YamlDotNet.Serialization.Schemas;
using YamlDotNet.Serialization.TypeInspectors;
using YamlDotNet.Serialization.TypeResolvers;
using YamlDotNet.Serialization.Utilities;
using YamlDotNet.Serialization.ValueDeserializers;

[assembly: AssemblyFileVersion("3.4.6")]
[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.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.4.6.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<988ceb52-4bdc-4974-9d5e-5bd480cf21c7>Embedded]
	internal sealed class <988ceb52-4bdc-4974-9d5e-5bd480cf21c7>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)]
	[<988ceb52-4bdc-4974-9d5e-5bd480cf21c7>Embedded]
	internal sealed class <6a8baf6c-d6a5-464d-a2b8-007977aefe74>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <6a8baf6c-d6a5-464d-a2b8-007977aefe74>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <6a8baf6c-d6a5-464d-a2b8-007977aefe74>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	[<988ceb52-4bdc-4974-9d5e-5bd480cf21c7>Embedded]
	[CompilerGenerated]
	internal sealed class <1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace Seasonality
{
	[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(0)]
	[BepInPlugin("RustyMods.Seasonality", "Seasonality", "3.4.6")]
	[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(1)]
	public class SeasonalityPlugin : BaseUnityPlugin
	{
		[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(0)]
		public enum Toggle
		{
			On = 1,
			Off = 0
		}

		[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(0)]
		public enum Season
		{
			Spring,
			Summer,
			Fall,
			Winter
		}

		[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(0)]
		public enum DurationType
		{
			Day,
			Hours,
			Minutes
		}

		[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(0)]
		public enum DisplayType
		{
			Above,
			Below
		}

		[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(0)]
		private class ConfigurationManagerAttributes
		{
			[UsedImplicitly]
			public int? Order = null;

			[UsedImplicitly]
			public bool? Browsable = null;

			[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(2)]
			[UsedImplicitly]
			public string Category = null;

			[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 2, 1 })]
			[UsedImplicitly]
			public Action<ConfigEntryBase> CustomDrawer = null;
		}

		internal const string ModName = "Seasonality";

		internal const string ModVersion = "3.4.6";

		internal const string Author = "RustyMods";

		private const string ModGUID = "RustyMods.Seasonality";

		private static readonly string ConfigFileName = "RustyMods.Seasonality.cfg";

		private static readonly string ConfigFileFullPath;

		internal static string ConnectionError;

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

		public static readonly ManualLogSource SeasonalityLogger;

		public static readonly ConfigSync ConfigSync;

		public static SeasonalityPlugin _plugin;

		public static ConfigEntry<Season> _Season;

		public static ConfigEntry<Toggle> _ReplaceArmorTextures;

		public static ConfigEntry<Toggle> _ReplaceCreatureTextures;

		public static ConfigEntry<Toggle> _SeasonFades;

		public static ConfigEntry<Toggle> _SleepOverride;

		public static ConfigEntry<float> _FadeLength;

		public static ConfigEntry<Toggle> _WinterFreezes;

		public static ConfigEntry<Toggle> _WinterAlwaysCold;

		public static ConfigEntry<Toggle> _DisplaySeason;

		public static ConfigEntry<Toggle> _DisplaySeasonTimer;

		public static ConfigEntry<DisplayType> _DisplayType;

		public static ConfigEntry<int> _WeatherDuration;

		public static ConfigEntry<Toggle> _DisplayWeather;

		public static ConfigEntry<Toggle> _EnableWeather;

		public static ConfigEntry<Toggle> _DisplayWeatherTimer;

		public static ConfigEntry<Toggle> _EnableModifiers;

		public static readonly Dictionary<Season, Dictionary<DurationType, ConfigEntry<int>>> _Durations;

		public static readonly Dictionary<Season, Dictionary<Biome, ConfigEntry<string>>> _WeatherConfigs;

		public static readonly Dictionary<Season, Dictionary<string, ConfigEntry<float>>> effectConfigs;

		public static ConfigEntry<Toggle> _fadeToBlackImmune;

		public static ConfigEntry<double> m_lastSeasonChange;

		private static readonly Dictionary<List<string>, float> intConfigs;

		private static readonly Dictionary<List<string>, float> floatConfigs;

		private static ConfigEntry<Toggle> _serverConfigLocked;

		public void Awake()
		{
			_plugin = this;
			TextureManager.ReadCustomTextures();
			ZoneManager.InitSnowBundle();
			InitConfigs();
			Localizer.Load();
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			_harmony.PatchAll(executingAssembly);
			SetupWatcher();
		}

		public void Update()
		{
			float deltaTime = Time.deltaTime;
			SeasonTimer.CheckSeasonTransition(deltaTime);
			SeasonManager.UpdateSeasonEffects(deltaTime);
			MaterialReplacer.UpdateInAshlands(deltaTime);
		}

		private void InitConfigs()
		{
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Expected O, but got Unknown
			_serverConfigLocked = config("1 - General", "1 - Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only.");
			ConfigSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked);
			m_lastSeasonChange = config("9 - Data", "Last Season Change", 0.0, "Reset to set last season change");
			_Season = config("1 - General", "Current Season", Season.Fall, "Set duration to 0, and select your season, else season is determined by plugin");
			_ReplaceArmorTextures = config("2 - Settings", "Replace Armor Textures", Toggle.On, "If on, plugin modifies armor textures");
			_ReplaceCreatureTextures = config("2 - Settings", "Replace Creature Textures", Toggle.On, "If on, creature skins change with the seasons");
			_SeasonFades = config("2 - Settings", "Fade to Black", Toggle.On, "If on, plugin fades to black before season change");
			_fadeToBlackImmune = config("2 - Settings", "Fade Immunity", Toggle.Off, "If on, while fading to black, player is immune to damage");
			_SleepOverride = config("2 - Settings", "Sleep Season Change", Toggle.Off, "If on, seasons can only change if everyone is asleep");
			_SleepOverride.SettingChanged += [<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(0)] (object sender, EventArgs args) =>
			{
				if (_SleepOverride.Value == Toggle.Off)
				{
					SeasonTimer.m_sleepOverride = false;
				}
			};
			_FadeLength = config("2 - Settings", "Fade Length (seconds)", 3f, new ConfigDescription("Set the length of fade to black", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 101f), Array.Empty<object>()));
			_DisplaySeason = config("2 - Settings", "Display Season", Toggle.On, "If on, season will be displayed alongside HUD Status Effects");
			_DisplaySeason.SettingChanged += SeasonManager.OnSeasonDisplayConfigChange;
			_DisplaySeasonTimer = config("2 - Settings", "Display Season Timer", Toggle.On, "If on, season timer will be displayed");
			_EnableModifiers = config("2 - Settings", "Modifiers", Toggle.Off, "If on, modifiers, as in health regeneration, carry weight etc... are enabled");
			_DisplayType = config("2 - Settings", "Name Display", DisplayType.Above, "Set if name of season should be displayed above or below icon");
			_WinterFreezes = config("4 - Winter Settings", "Frozen Water", Toggle.On, "If on, winter freezes water");
			_WinterFreezes.SettingChanged += [<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(0)] (object sender, EventArgs args) =>
			{
				FrozenWaterLOD.UpdateInstances();
				FrozenZones.UpdateInstances();
			};
			_WinterAlwaysCold = config("4 - Winter Settings", "Always Cold", Toggle.On, "If on, winter will always make player cold");
			_Season.SettingChanged += SeasonManager.OnSeasonConfigChange;
			_WeatherDuration = config("3 - Weather Settings", "Weather Duration (Minutes)", 20, new ConfigDescription("Set duration of custom weather", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 1000), Array.Empty<object>()));
			_WeatherDuration.SettingChanged += WeatherManager.OnWeatherDurationChange;
			_EnableWeather = config("3 - Weather Settings", "Enabled", Toggle.On, "If on, plugin can control weather and display information");
			_EnableWeather.SettingChanged += WeatherManager.OnDisplayConfigChange;
			_DisplayWeather = config("3 - Weather Settings", "Weather Display", Toggle.Off, "If on, plugin can control weather and displays current weather as status effect");
			_DisplayWeather.SettingChanged += WeatherManager.OnDisplayConfigChange;
			_DisplayWeatherTimer = config("3 - Weather Settings", "Weather Timer", Toggle.On, "If on, weather status effect displays countdown till next environment");
			InitDurationConfigs();
			InitWeatherConfigs();
			InitSeasonEffectConfigs();
		}

		private static void InitSeasonEffectConfigs()
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Expected O, but got Unknown
			foreach (Season value5 in Enum.GetValues(typeof(Season)))
			{
				Dictionary<string, ConfigEntry<float>> dictionary = new Dictionary<string, ConfigEntry<float>>();
				foreach (KeyValuePair<List<string>, float> floatConfig in floatConfigs)
				{
					string text = floatConfig.Key[0];
					string text2 = floatConfig.Key[1];
					float value = floatConfig.Value;
					ConfigEntry<float> value2 = _plugin.config($"{value5} Modifiers", text, value, new ConfigDescription(text2 ?? "", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
					dictionary[text] = value2;
				}
				foreach (KeyValuePair<List<string>, float> intConfig in intConfigs)
				{
					string text3 = intConfig.Key[0];
					string text4 = intConfig.Key[1];
					float value3 = intConfig.Value;
					ConfigEntry<float> value4 = _plugin.config($"{value5} Modifiers", text3, value3, new ConfigDescription(text4 ?? "", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-300f, 300f), Array.Empty<object>()));
					dictionary[text3] = value4;
				}
				effectConfigs[value5] = dictionary;
			}
		}

		private void InitWeatherConfigs()
		{
			//IL_0050: 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)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Invalid comparison between Unknown and I4
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Invalid comparison between Unknown and I4
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Invalid comparison between Unknown and I4
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			foreach (Season value in Enum.GetValues(typeof(Season)))
			{
				Dictionary<Biome, ConfigEntry<string>> dictionary = new Dictionary<Biome, ConfigEntry<string>>();
				foreach (Biome value2 in Enum.GetValues(typeof(Biome)))
				{
					if (((int)value2 != 0 && (int)value2 != 32 && (int)value2 != 895) || 1 == 0)
					{
						int num = BiomeIndex(value2);
						if (value == Season.Winter && (int)value2 != 4)
						{
							dictionary[value2] = _plugin.config($"{value} Weather Options", $"{num} - {(object)value2}", "WarmSnow:1,Twilight_Snow:0.5,WarmSnowStorm:0.1", "Set weather options, [name]:[weight]");
						}
						else
						{
							dictionary[value2] = _plugin.config($"{value} Weather Options", $"{num} - {(object)value2}", "", "Set weather options, [name]:[weight]");
						}
					}
				}
				_WeatherConfigs[value] = dictionary;
			}
		}

		private void InitDurationConfigs()
		{
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			foreach (Season value in Enum.GetValues(typeof(Season)))
			{
				Dictionary<DurationType, ConfigEntry<int>> dictionary = new Dictionary<DurationType, ConfigEntry<int>>();
				foreach (DurationType value2 in Enum.GetValues(typeof(DurationType)))
				{
					if (value2 == DurationType.Hours)
					{
						dictionary[value2] = _plugin.config($"Duration - {value}", $"Real-Time {value2}", 1, new ConfigDescription($"Set the length of {value}", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>()));
					}
					else
					{
						dictionary[value2] = _plugin.config($"Duration - {value}", $"Real-Time {value2}", 0, new ConfigDescription($"Set the length of {value}", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>()));
					}
				}
				_Durations[value] = dictionary;
			}
		}

		private int BiomeIndex(Biome biome)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Invalid comparison between Unknown and I4
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected I4, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Invalid comparison between Unknown and I4
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Invalid comparison between Unknown and I4
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Invalid comparison between Unknown and I4
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Invalid comparison between Unknown and I4
			if (1 == 0)
			{
			}
			int result;
			if ((int)biome <= 16)
			{
				switch (biome - 1)
				{
				case 0:
					goto IL_004c;
				case 1:
					goto IL_0054;
				case 3:
					goto IL_0058;
				case 2:
					goto IL_006c;
				}
				if ((int)biome != 8)
				{
					if ((int)biome != 16)
					{
						goto IL_006c;
					}
					result = 5;
				}
				else
				{
					result = 2;
				}
			}
			else if ((int)biome != 64)
			{
				if ((int)biome != 256)
				{
					if ((int)biome != 512)
					{
						goto IL_006c;
					}
					result = 6;
				}
				else
				{
					result = 7;
				}
			}
			else
			{
				result = 8;
			}
			goto IL_0070;
			IL_006c:
			result = 0;
			goto IL_0070;
			IL_0058:
			result = 4;
			goto IL_0070;
			IL_004c:
			result = 1;
			goto IL_0070;
			IL_0054:
			result = 3;
			goto IL_0070;
			IL_0070:
			if (1 == 0)
			{
			}
			return result;
		}

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

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

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

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

		private ConfigEntry<T> config<[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(2)] T>(string group, string name, T value, string description, bool synchronizedSetting = true)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting);
		}

		static SeasonalityPlugin()
		{
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName;
			ConnectionError = "";
			SeasonalityLogger = Logger.CreateLogSource("Seasonality");
			ConfigSync = new ConfigSync("RustyMods.Seasonality")
			{
				DisplayName = "Seasonality",
				CurrentVersion = "3.4.6",
				MinimumRequiredVersion = "3.4.6"
			};
			_plugin = null;
			_Season = null;
			_ReplaceArmorTextures = null;
			_ReplaceCreatureTextures = null;
			_SeasonFades = null;
			_SleepOverride = null;
			_FadeLength = null;
			_WinterFreezes = null;
			_WinterAlwaysCold = null;
			_DisplaySeason = null;
			_DisplaySeasonTimer = null;
			_DisplayType = null;
			_WeatherDuration = null;
			_DisplayWeather = null;
			_EnableWeather = null;
			_DisplayWeatherTimer = null;
			_EnableModifiers = null;
			_Durations = new Dictionary<Season, Dictionary<DurationType, ConfigEntry<int>>>();
			_WeatherConfigs = new Dictionary<Season, Dictionary<Biome, ConfigEntry<string>>>();
			effectConfigs = new Dictionary<Season, Dictionary<string, ConfigEntry<float>>>();
			_fadeToBlackImmune = null;
			m_lastSeasonChange = null;
			intConfigs = new Dictionary<List<string>, float> { 
			{
				new List<string> { "Carry Weight", "Increase or decrease max carry weight" },
				0f
			} };
			floatConfigs = new Dictionary<List<string>, float>
			{
				{
					new List<string> { "Health Regeneration", "Multiply the amount of health regeneration from food" },
					1f
				},
				{
					new List<string> { "Damage", "Multiply the amount of damage inflicted on enemies" },
					1f
				},
				{
					new List<string> { "Speed", "Multiply the speed" },
					1f
				},
				{
					new List<string> { "Eitr Regeneration", "Multiply the amount of eitr regeneration from food" },
					1f
				},
				{
					new List<string> { "Raise Skill", "Multiply the amount experience gained for skills" },
					1f
				},
				{
					new List<string> { "Stamina Regeneration", "Define the rate of stamina regeneration" },
					1f
				}
			};
			_serverConfigLocked = null;
		}
	}
}
namespace Seasonality.Textures
{
	public static class Directories
	{
		public enum PickableDirectories
		{
			None,
			Mushroom,
			MushroomYellow,
			MushroomBlue,
			JotunPuff,
			Magecap,
			Raspberry,
			Blueberry,
			Dandelion,
			Barley,
			Flax,
			Carrot,
			Turnip,
			Onion,
			CarrotSeed,
			TurnipSeed,
			OnionSeed,
			Branches,
			Flint,
			Rock,
			BoneRemains,
			SurtlingCore,
			BlackCore,
			Thistle
		}

		public enum VegDirectories
		{
			Beech,
			BeechSmall,
			Birch,
			Bushes,
			Oak,
			Pine,
			PineParticles,
			FirSmall,
			FirDead,
			FirDeadParticles,
			Fir,
			FirParticles,
			YggaShoot,
			SwampTrees,
			PlainsBush,
			Shrub,
			ShrubParticles,
			Rock,
			MeadowGrass,
			MeadowGrassShort,
			PlainsGrass,
			BlackForestGrass,
			BlackForestGrassAlt,
			SwampGrass,
			MistlandsGrass,
			PlainsFlowers,
			Ormbunke,
			Vass,
			Vines,
			WaterLilies,
			RockPlant,
			Clutter,
			CloudberryBush,
			YggdrasilSkyTree,
			None
		}

		public enum PieceDirectories
		{
			None,
			Straw,
			DarkWood,
			GoblinVillage
		}

		public enum CreatureDirectories
		{
			None,
			Gull,
			Serpent,
			Deer,
			Boar,
			Piggy,
			Neck,
			Greydwarf,
			GreydwarfShaman,
			Troll,
			Skeleton,
			Leech,
			Wraith,
			Blob,
			Oozer,
			Wolf,
			WolfCub,
			Lox,
			LoxCalf,
			Deathsquito,
			Goblin,
			GoblinBrute,
			GoblinShaman,
			Hare,
			Seeker,
			SeekerSoldier,
			SeekerBrood,
			Gjall,
			Tick
		}

		public enum ArmorDirectories
		{
			None,
			Rags,
			Leather,
			Troll,
			Bronze,
			Iron,
			Wolf,
			Padded,
			Carapace,
			Mage
		}
	}
	[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(0)]
	[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(1)]
	public static class HDConfigurations
	{
		[Serializable]
		[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(0)]
		public class HDConfiguration
		{
			public TextureSettings defaultSettings = new TextureSettings
			{
				TextureFormat = (TextureFormat)12,
				TextureFilter = (FilterMode)2
			};

			public TextureSettings GrassSettings = new TextureSettings
			{
				TextureFormat = (TextureFormat)10,
				TextureFilter = (FilterMode)0
			};

			public TextureSettings CreatureSettings = new TextureSettings
			{
				TextureFormat = (TextureFormat)25,
				TextureFilter = (FilterMode)0
			};

			public TextureSettings PieceSettings = new TextureSettings
			{
				TextureFormat = (TextureFormat)25,
				TextureFilter = (FilterMode)0
			};

			public TextureSettings PickableSettings = new TextureSettings
			{
				TextureFormat = (TextureFormat)25,
				TextureFilter = (FilterMode)0
			};

			public TextureSettings ArmorSettings = new TextureSettings
			{
				TextureFormat = (TextureFormat)25,
				TextureFilter = (FilterMode)0
			};
		}

		[Serializable]
		[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(0)]
		public class TextureSettings
		{
			public TextureFormat TextureFormat;

			public FilterMode TextureFilter;
		}

		private static readonly string SeasonalityFolderPath;

		private static readonly string HDConfigFilePath;

		public static HDConfiguration HdConfigurations;

		public static void InitHDConfigurations()
		{
			if (!File.Exists(HDConfigFilePath))
			{
				ISerializer serializer = new SerializerBuilder().Build();
				string contents = serializer.Serialize(new HDConfiguration());
				File.WriteAllText(HDConfigFilePath, contents);
			}
			ReadHDConfigs();
		}

		private static void ReadHDConfigs()
		{
			IDeserializer deserializer = new DeserializerBuilder().Build();
			HDConfiguration hdConfigurations = deserializer.Deserialize<HDConfiguration>(File.ReadAllText(HDConfigFilePath));
			HdConfigurations = hdConfigurations;
		}

		static HDConfigurations()
		{
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			SeasonalityFolderPath = configPath + directorySeparatorChar + "Seasonality";
			string seasonalityFolderPath = SeasonalityFolderPath;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			HDConfigFilePath = seasonalityFolderPath + directorySeparatorChar + "HDConfiguration.yml";
			HdConfigurations = new HDConfiguration();
		}
	}
	[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(0)]
	[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(2)]
	public static class SpriteManager
	{
		public static readonly Sprite ValknutIcon = RegisterSprite("valknutIcon.png");

		public static readonly Sprite SpringIcon = RegisterSprite("spring_icon.png");

		public static readonly Sprite SummerIcon = RegisterSprite("summer_icon.png");

		public static readonly Sprite FallIcon = RegisterSprite("fall_icon.png");

		public static readonly Sprite WinterIcon = RegisterSprite("winter_icon.png");

		[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(1)]
		[return: <6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(2)]
		private static Sprite RegisterSprite(string fileName, string folderName = "icons")
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string name = "Seasonality." + folderName + "." + fileName;
			using Stream stream = executingAssembly.GetManifestResourceStream(name);
			if (stream == null)
			{
				return null;
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			Texture2D val = new Texture2D(2, 2);
			Sprite val2 = (ImageConversion.LoadImage(val, array) ? Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero) : null);
			if ((Object)(object)val2 != (Object)null)
			{
				((Object)val2).name = fileName;
			}
			return val2;
		}
	}
	[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(1)]
	[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(0)]
	public static class TextureManager
	{
		public static bool HDPackLoaded;

		[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(2)]
		public static readonly Texture Pillar_Snow = RegisterTexture("pillar_snow_d2.png");

		[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 1, 2 })]
		public static readonly Dictionary<Directories.VegDirectories, Dictionary<string, Texture>> CustomRegisteredTextures = new Dictionary<Directories.VegDirectories, Dictionary<string, Texture>>();

		[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 1, 2 })]
		public static readonly Dictionary<Directories.CreatureDirectories, Dictionary<string, Texture>> CustomRegisteredCreatureTex = new Dictionary<Directories.CreatureDirectories, Dictionary<string, Texture>>();

		[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 1, 2 })]
		public static readonly Dictionary<Directories.PieceDirectories, Dictionary<string, Texture>> CustomRegisteredPieceTextures = new Dictionary<Directories.PieceDirectories, Dictionary<string, Texture>>();

		[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 1, 2 })]
		public static readonly Dictionary<Directories.PickableDirectories, Dictionary<string, Texture>> CustomRegisteredPickableTex = new Dictionary<Directories.PickableDirectories, Dictionary<string, Texture>>();

		[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 1, 2 })]
		public static readonly Dictionary<Directories.ArmorDirectories, Dictionary<string, Texture>> CustomRegisteredArmorTex = new Dictionary<Directories.ArmorDirectories, Dictionary<string, Texture>>();

		[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 1, 1, 1, 1, 2 })]
		public static readonly Dictionary<string, Dictionary<string, Dictionary<string, Texture>>> RegisteredCustomTextures = new Dictionary<string, Dictionary<string, Dictionary<string, Texture>>>();

		[return: <6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(2)]
		private static Texture RegisterTexture(string fileName, string folderName = "assets")
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string name = "Seasonality." + folderName + "." + fileName;
			using Stream stream = executingAssembly.GetManifestResourceStream(name);
			if (stream == null)
			{
				return null;
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			Texture2D val = new Texture2D(2, 2);
			((Object)val).name = fileName.Replace(".png", string.Empty);
			return (Texture)(object)(ImageConversion.LoadImage(val, array) ? val : null);
		}

		[return: <6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(2)]
		private static Texture RegisterCustomTexture(string filePath, TextureFormat format, FilterMode filter, int aniso = 1, int mipMapBias = 0, TextureWrapMode wrap = 0, bool isBark = false)
		{
			//IL_001b: 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_0023: 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_002c: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (!File.Exists(filePath))
			{
				return null;
			}
			byte[] array = File.ReadAllBytes(filePath);
			Texture2D val = new Texture2D(4, 4, format, true, false)
			{
				filterMode = filter
			};
			if (isBark)
			{
				((Texture)val).anisoLevel = aniso;
				((Texture)val).mipMapBias = mipMapBias;
				((Texture)val).wrapMode = wrap;
			}
			if (ImageConversion.LoadImage(val, array))
			{
				((Object)val).name = filePath;
				return (Texture)(object)val;
			}
			return null;
		}

		private static void ReadVegDirectories()
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: 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_00dd: Expected O, but got I4
			//IL_00bf->IL00bf: Incompatible stack types: O vs I4
			//IL_00b0->IL00bf: Incompatible stack types: I4 vs O
			//IL_00b0->IL00bf: Incompatible stack types: O vs I4
			foreach (Directories.VegDirectories value in Enum.GetValues(typeof(Directories.VegDirectories)))
			{
				if (value == Directories.VegDirectories.None)
				{
					continue;
				}
				string text = value.ToString();
				string vegTexturePath = SeasonPaths.VegTexturePath;
				char directorySeparatorChar = Path.DirectorySeparatorChar;
				if (!Directory.Exists(vegTexturePath + directorySeparatorChar + text))
				{
					string vegTexturePath2 = SeasonPaths.VegTexturePath;
					directorySeparatorChar = Path.DirectorySeparatorChar;
					Directory.CreateDirectory(vegTexturePath2 + directorySeparatorChar + text);
				}
				Directories.VegDirectories vegDirectories2 = value;
				Directories.VegDirectories vegDirectories3 = vegDirectories2;
				if ((uint)(vegDirectories3 - 20) <= 3u)
				{
					object obj = text;
					obj = SeasonPaths.VegTexturePath;
					int num;
					if (HDPackLoaded)
					{
						obj = HDConfigurations.HdConfigurations.GrassSettings.TextureFormat;
						num = (int)obj;
					}
					else
					{
						num = 10;
						obj = num;
						num = (int)obj;
					}
					num = (HDPackLoaded ? ((int)HDConfigurations.HdConfigurations.GrassSettings.TextureFilter) : 0);
					Dictionary<string, Texture> customTextures = GetCustomTextures((string)num, (string)obj, (TextureFormat)obj, (FilterMode)num);
					if (customTextures.Count != 0)
					{
						CustomRegisteredTextures.Add(value, customTextures);
					}
				}
				else
				{
					Dictionary<string, Texture> dictionary = (HDPackLoaded ? GetCustomTextures(text, SeasonPaths.VegTexturePath, HDConfigurations.HdConfigurations.defaultSettings.TextureFormat, HDConfigurations.HdConfigurations.defaultSettings.TextureFilter) : GetCustomTextures(text, SeasonPaths.VegTexturePath, (TextureFormat)12, (FilterMode)2));
					if (dictionary.Count != 0)
					{
						CustomRegisteredTextures.Add(value, dictionary);
					}
				}
			}
		}

		private static void ReadCreatureDirectories()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			foreach (Directories.CreatureDirectories value in Enum.GetValues(typeof(Directories.CreatureDirectories)))
			{
				if (value != 0)
				{
					string text = value.ToString();
					string creatureTexPath = SeasonPaths.creatureTexPath;
					char directorySeparatorChar = Path.DirectorySeparatorChar;
					if (!Directory.Exists(creatureTexPath + directorySeparatorChar + text))
					{
						string creatureTexPath2 = SeasonPaths.creatureTexPath;
						directorySeparatorChar = Path.DirectorySeparatorChar;
						Directory.CreateDirectory(creatureTexPath2 + directorySeparatorChar + text);
					}
					Dictionary<string, Texture> dictionary = (HDPackLoaded ? GetCustomTextures(text, SeasonPaths.creatureTexPath, HDConfigurations.HdConfigurations.CreatureSettings.TextureFormat, HDConfigurations.HdConfigurations.CreatureSettings.TextureFilter) : GetCustomTextures(text, SeasonPaths.creatureTexPath, (TextureFormat)25, (FilterMode)0));
					if (dictionary.Count != 0)
					{
						CustomRegisteredCreatureTex.Add(value, dictionary);
					}
				}
			}
		}

		private static void ReadPieceDirectories()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			foreach (Directories.PieceDirectories value in Enum.GetValues(typeof(Directories.PieceDirectories)))
			{
				if (value != 0)
				{
					string text = value.ToString();
					string pieceTexPath = SeasonPaths.PieceTexPath;
					char directorySeparatorChar = Path.DirectorySeparatorChar;
					if (!Directory.Exists(pieceTexPath + directorySeparatorChar + text))
					{
						string pieceTexPath2 = SeasonPaths.PieceTexPath;
						directorySeparatorChar = Path.DirectorySeparatorChar;
						Directory.CreateDirectory(pieceTexPath2 + directorySeparatorChar + text);
					}
					Dictionary<string, Texture> dictionary = (HDPackLoaded ? GetCustomTextures(text, SeasonPaths.PieceTexPath, HDConfigurations.HdConfigurations.PieceSettings.TextureFormat, HDConfigurations.HdConfigurations.PieceSettings.TextureFilter) : GetCustomTextures(text, SeasonPaths.PieceTexPath, (TextureFormat)25, (FilterMode)0));
					if (dictionary.Count != 0)
					{
						CustomRegisteredPieceTextures.Add(value, dictionary);
					}
				}
			}
		}

		private static void ReadPickableDirectories()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			foreach (Directories.PickableDirectories value in Enum.GetValues(typeof(Directories.PickableDirectories)))
			{
				if (value != 0)
				{
					string text = value.ToString();
					string pickableTexturePath = SeasonPaths.PickableTexturePath;
					char directorySeparatorChar = Path.DirectorySeparatorChar;
					if (!Directory.Exists(pickableTexturePath + directorySeparatorChar + text))
					{
						string pickableTexturePath2 = SeasonPaths.PickableTexturePath;
						directorySeparatorChar = Path.DirectorySeparatorChar;
						Directory.CreateDirectory(pickableTexturePath2 + directorySeparatorChar + text);
					}
					Dictionary<string, Texture> dictionary = (HDPackLoaded ? GetCustomTextures(text, SeasonPaths.PickableTexturePath, HDConfigurations.HdConfigurations.PickableSettings.TextureFormat, HDConfigurations.HdConfigurations.PickableSettings.TextureFilter) : GetCustomTextures(text, SeasonPaths.PickableTexturePath, (TextureFormat)25, (FilterMode)0));
					if (dictionary.Count != 0)
					{
						CustomRegisteredPickableTex.Add(value, dictionary);
					}
				}
			}
		}

		private static void ReadArmorDirectories()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			foreach (Directories.ArmorDirectories value in Enum.GetValues(typeof(Directories.ArmorDirectories)))
			{
				if (value != 0)
				{
					string text = value.ToString();
					string armorTexPath = SeasonPaths.ArmorTexPath;
					char directorySeparatorChar = Path.DirectorySeparatorChar;
					if (!Directory.Exists(armorTexPath + directorySeparatorChar + text))
					{
						string armorTexPath2 = SeasonPaths.ArmorTexPath;
						directorySeparatorChar = Path.DirectorySeparatorChar;
						Directory.CreateDirectory(armorTexPath2 + directorySeparatorChar + text);
					}
					Dictionary<string, Texture> dictionary = (HDPackLoaded ? GetCustomTextures(text, SeasonPaths.ArmorTexPath, HDConfigurations.HdConfigurations.ArmorSettings.TextureFormat, HDConfigurations.HdConfigurations.ArmorSettings.TextureFilter) : GetCustomTextures(text, SeasonPaths.ArmorTexPath, (TextureFormat)25, (FilterMode)0));
					if (dictionary.Count != 0)
					{
						CustomRegisteredArmorTex.Add(value, dictionary);
					}
				}
			}
		}

		public static void ReadCustomTextures()
		{
			if (!Directory.Exists(SeasonPaths.folderPath))
			{
				Directory.CreateDirectory(SeasonPaths.folderPath);
			}
			if (!Directory.Exists(SeasonPaths.VegTexturePath))
			{
				Directory.CreateDirectory(SeasonPaths.VegTexturePath);
			}
			string folderPath = SeasonPaths.folderPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			if (File.Exists(folderPath + directorySeparatorChar + "WillyBachHD.md"))
			{
				SeasonalityPlugin.SeasonalityLogger.LogInfo((object)"Willybach HD loaded");
				HDPackLoaded = true;
				HDConfigurations.InitHDConfigurations();
			}
			ReadVegDirectories();
			ReadCreatureDirectories();
			ReadPieceDirectories();
			ReadPickableDirectories();
			ReadArmorDirectories();
			ReadCustoms();
		}

		private static void ReadCustoms()
		{
			if (!Directory.Exists(SeasonPaths.CustomTexPath))
			{
				Directory.CreateDirectory(SeasonPaths.CustomTexPath);
			}
			string[] directories = Directory.GetDirectories(SeasonPaths.CustomTexPath);
			string[] array = directories;
			foreach (string path in array)
			{
				string fileName = Path.GetFileName(path);
				string[] files = Directory.GetFiles(path, "*.png");
				if (files.Length == 0)
				{
					continue;
				}
				Dictionary<string, Dictionary<string, Texture>> dictionary = new Dictionary<string, Dictionary<string, Texture>>();
				string[] array2 = files;
				foreach (string text in array2)
				{
					string text2 = Path.GetFileName(text).Replace(".png", string.Empty);
					string[] array3 = text2.Split(new char[1] { '@' });
					if (array3.Length != 2)
					{
						continue;
					}
					string key = array3[0];
					string text3 = array3[1];
					Texture val = RegisterCustomTexture(text, (TextureFormat)10, (FilterMode)0, 1, 0, (TextureWrapMode)0);
					if (!((Object)(object)val == (Object)null))
					{
						((Object)val).name = text2;
						if (dictionary.ContainsKey(key))
						{
							dictionary[key][text3] = val;
						}
						else
						{
							dictionary[key] = new Dictionary<string, Texture> { [text3] = val };
						}
						SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Registered: " + fileName + "/" + text2 + ".png"));
					}
				}
				RegisteredCustomTextures[fileName] = dictionary;
			}
		}

		private static void GetTexture([<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 2 })] Dictionary<string, Texture> textureMap, SeasonalityPlugin.Season season, string path, string type, TextureFormat textureFormat, FilterMode filterMode)
		{
			//IL_00c1: 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)
			string[] obj = new string[6] { path, null, null, null, null, null };
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[1] = directorySeparatorChar.ToString();
			obj[2] = type;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[3] = directorySeparatorChar.ToString();
			obj[4] = season.ToString().ToLower();
			obj[5] = ".png";
			string text = string.Concat(obj);
			string text2 = type + "/" + season.ToString().ToLower() + ".png compressed as " + ((object)(TextureFormat)(ref textureFormat)).ToString() + ", filter " + ((object)(FilterMode)(ref filterMode)).ToString();
			if (File.Exists(text))
			{
				Texture val = RegisterCustomTexture(text, textureFormat, filterMode, 1, 0, (TextureWrapMode)0);
				if (!Object.op_Implicit((Object)(object)val))
				{
					SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Failed: " + text2));
					return;
				}
				textureMap.Add(season.ToString(), val);
				SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Registered: " + text2));
			}
		}

		private static void GetBark([<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 2 })] Dictionary<string, Texture> textureMap, SeasonalityPlugin.Season season, string path, string type, TextureFormat textureFormat, FilterMode filterMode)
		{
			//IL_00c1: 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)
			string[] obj = new string[6] { path, null, null, null, null, null };
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[1] = directorySeparatorChar.ToString();
			obj[2] = type;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[3] = directorySeparatorChar.ToString();
			obj[4] = season.ToString().ToLower();
			obj[5] = "_bark.png";
			string text = string.Concat(obj);
			string text2 = type + "/" + season.ToString().ToLower() + "_bark.png compressed as " + ((object)(TextureFormat)(ref textureFormat)).ToString() + ", filter " + ((object)(FilterMode)(ref filterMode)).ToString();
			if (File.Exists(text))
			{
				Texture val = RegisterCustomTexture(text, textureFormat, filterMode, 1, 0, (TextureWrapMode)0, isBark: true);
				if (!Object.op_Implicit((Object)(object)val))
				{
					SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Failed: " + text2));
					return;
				}
				textureMap.Add(season.ToString() + "_bark", val);
				SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Registered: " + text2));
			}
		}

		private static void GetNormal([<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 2 })] Dictionary<string, Texture> textureMap, SeasonalityPlugin.Season season, string path, string type, TextureFormat textureFormat, FilterMode filterMode)
		{
			//IL_00c1: 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)
			string[] obj = new string[6] { path, null, null, null, null, null };
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[1] = directorySeparatorChar.ToString();
			obj[2] = type;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[3] = directorySeparatorChar.ToString();
			obj[4] = season.ToString().ToLower();
			obj[5] = "_normal.png";
			string text = string.Concat(obj);
			string text2 = type + "/" + season.ToString().ToLower() + "_normal.png compressed as " + ((object)(TextureFormat)(ref textureFormat)).ToString() + ", filter " + ((object)(FilterMode)(ref filterMode)).ToString();
			if (File.Exists(text))
			{
				Texture val = RegisterCustomTexture(text, textureFormat, filterMode, 1, 0, (TextureWrapMode)0, isBark: true);
				if (!Object.op_Implicit((Object)(object)val))
				{
					SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Failed: " + text2));
					return;
				}
				textureMap.Add(season.ToString() + "_normal", val);
				SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Registered: " + text2));
			}
		}

		private static void GetWorn([<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 2 })] Dictionary<string, Texture> textureMap, SeasonalityPlugin.Season season, string path, string type, TextureFormat textureFormat, FilterMode filterMode)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			string[] obj = new string[6] { path, null, null, null, null, null };
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[1] = directorySeparatorChar.ToString();
			obj[2] = type;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[3] = directorySeparatorChar.ToString();
			obj[4] = season.ToString().ToLower();
			obj[5] = "_worn.png";
			string text = string.Concat(obj);
			string text2 = type + "/" + season.ToString().ToLower() + "_worn.png compressed as " + ((object)(TextureFormat)(ref textureFormat)).ToString() + ", filter " + ((object)(FilterMode)(ref filterMode)).ToString();
			if (File.Exists(text))
			{
				Texture val = RegisterCustomTexture(text, textureFormat, filterMode, 1, 0, (TextureWrapMode)0, isBark: true);
				if (!Object.op_Implicit((Object)(object)val))
				{
					SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Failed: " + text2));
					return;
				}
				textureMap.Add(season.ToString() + "_worn", val);
				SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Registered: " + text2));
			}
		}

		private static void GetCorner([<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 2 })] Dictionary<string, Texture> textureMap, SeasonalityPlugin.Season season, string path, string type, TextureFormat textureFormat, FilterMode filterMode)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			string[] obj = new string[6] { path, null, null, null, null, null };
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[1] = directorySeparatorChar.ToString();
			obj[2] = type;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[3] = directorySeparatorChar.ToString();
			obj[4] = season.ToString().ToLower();
			obj[5] = "_corner.png";
			string text = string.Concat(obj);
			string text2 = type + "/" + season.ToString().ToLower() + "_corner.png compressed as " + ((object)(TextureFormat)(ref textureFormat)).ToString() + ", filter " + ((object)(FilterMode)(ref filterMode)).ToString();
			if (File.Exists(text))
			{
				Texture val = RegisterCustomTexture(text, textureFormat, filterMode, 1, 0, (TextureWrapMode)0, isBark: true);
				if (!Object.op_Implicit((Object)(object)val))
				{
					SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Failed: " + text2));
					return;
				}
				textureMap.Add(season.ToString() + "_corner", val);
				SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Registered: " + text2));
			}
		}

		private static void GetCornerWorn([<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 2 })] Dictionary<string, Texture> textureMap, SeasonalityPlugin.Season season, string path, string type, TextureFormat textureFormat, FilterMode filterMode)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			string[] obj = new string[6] { path, null, null, null, null, null };
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[1] = directorySeparatorChar.ToString();
			obj[2] = type;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[3] = directorySeparatorChar.ToString();
			obj[4] = season.ToString().ToLower();
			obj[5] = "_corner_worn.png";
			string text = string.Concat(obj);
			string text2 = type + "/" + season.ToString().ToLower() + "_corner_worn.png compressed as " + ((object)(TextureFormat)(ref textureFormat)).ToString() + ", filter " + ((object)(FilterMode)(ref filterMode)).ToString();
			if (File.Exists(text))
			{
				Texture val = RegisterCustomTexture(text, textureFormat, filterMode, 1, 0, (TextureWrapMode)0, isBark: true);
				if (!Object.op_Implicit((Object)(object)val))
				{
					SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Failed: " + text2));
					return;
				}
				textureMap.Add(season.ToString() + "_corner_worn", val);
				SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Registered: " + text2));
			}
		}

		private static void GetLegs([<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 2 })] Dictionary<string, Texture> textureMap, SeasonalityPlugin.Season season, string path, string type, TextureFormat textureFormat, FilterMode filterMode)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			string[] obj = new string[6] { path, null, null, null, null, null };
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[1] = directorySeparatorChar.ToString();
			obj[2] = type;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[3] = directorySeparatorChar.ToString();
			obj[4] = season.ToString().ToLower();
			obj[5] = "_legs.png";
			string text = string.Concat(obj);
			string text2 = type + "/" + season.ToString().ToLower() + "_legs.png compressed as " + ((object)(TextureFormat)(ref textureFormat)).ToString() + ", filter " + ((object)(FilterMode)(ref filterMode)).ToString();
			if (File.Exists(text))
			{
				Texture val = RegisterCustomTexture(text, textureFormat, filterMode, 1, 0, (TextureWrapMode)0);
				if (!Object.op_Implicit((Object)(object)val))
				{
					SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Failed: " + text2));
					return;
				}
				textureMap.Add(season.ToString() + "_legs", val);
				SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Registered: " + text2));
			}
		}

		private static void getChest([<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 2 })] Dictionary<string, Texture> textureMap, SeasonalityPlugin.Season season, string path, string type, TextureFormat textureFormat, FilterMode filterMode)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			string[] obj = new string[6] { path, null, null, null, null, null };
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[1] = directorySeparatorChar.ToString();
			obj[2] = type;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[3] = directorySeparatorChar.ToString();
			obj[4] = season.ToString().ToLower();
			obj[5] = "_chest.png";
			string text = string.Concat(obj);
			string text2 = type + "/" + season.ToString().ToLower() + "_chest.png compressed as " + ((object)(TextureFormat)(ref textureFormat)).ToString() + ", filter " + ((object)(FilterMode)(ref filterMode)).ToString();
			if (File.Exists(text))
			{
				Texture val = RegisterCustomTexture(text, textureFormat, filterMode, 1, 0, (TextureWrapMode)0);
				if (!Object.op_Implicit((Object)(object)val))
				{
					SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Failed: " + text2));
					return;
				}
				textureMap.Add(season.ToString() + "_chest", val);
				SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Registered: " + text2));
			}
		}

		private static void GetCape([<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 2 })] Dictionary<string, Texture> textureMap, SeasonalityPlugin.Season season, string path, string type, TextureFormat textureFormat, FilterMode filterMode)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			string[] obj = new string[6] { path, null, null, null, null, null };
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[1] = directorySeparatorChar.ToString();
			obj[2] = type;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[3] = directorySeparatorChar.ToString();
			obj[4] = season.ToString().ToLower();
			obj[5] = "_cape.png";
			string text = string.Concat(obj);
			string text2 = type + "/" + season.ToString().ToLower() + "_cape.png compressed as " + ((object)(TextureFormat)(ref textureFormat)).ToString() + ", filter " + ((object)(FilterMode)(ref filterMode)).ToString();
			if (File.Exists(text))
			{
				Texture val = RegisterCustomTexture(text, textureFormat, filterMode, 1, 0, (TextureWrapMode)0);
				if (!Object.op_Implicit((Object)(object)val))
				{
					SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Failed: " + text2));
					return;
				}
				textureMap.Add(season.ToString() + "_cape", val);
				SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Registered: " + text2));
			}
		}

		private static void GetHelmet([<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 2 })] Dictionary<string, Texture> textureMap, SeasonalityPlugin.Season season, string path, string type, TextureFormat textureFormat, FilterMode filterMode)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			string[] obj = new string[6] { path, null, null, null, null, null };
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[1] = directorySeparatorChar.ToString();
			obj[2] = type;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[3] = directorySeparatorChar.ToString();
			obj[4] = season.ToString().ToLower();
			obj[5] = "_helmet.png";
			string text = string.Concat(obj);
			string text2 = type + "/" + season.ToString().ToLower() + "_helmet.png compressed as " + ((object)(TextureFormat)(ref textureFormat)).ToString() + ", filter " + ((object)(FilterMode)(ref filterMode)).ToString();
			if (File.Exists(text))
			{
				Texture val = RegisterCustomTexture(text, textureFormat, filterMode, 1, 0, (TextureWrapMode)0);
				if (!Object.op_Implicit((Object)(object)val))
				{
					SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Failed: " + text2));
					return;
				}
				textureMap.Add(season.ToString() + "_helmet", val);
				SeasonalityPlugin.SeasonalityLogger.LogDebug((object)("Registered: " + text2));
			}
		}

		[return: <6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(new byte[] { 1, 1, 2 })]
		private static Dictionary<string, Texture> GetCustomTextures(string type, string path, TextureFormat textureFormat = 12, FilterMode filterMode = 2)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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)
			Dictionary<string, Texture> dictionary = new Dictionary<string, Texture>();
			foreach (SeasonalityPlugin.Season value in Enum.GetValues(typeof(SeasonalityPlugin.Season)))
			{
				GetTexture(dictionary, value, path, type, textureFormat, filterMode);
				GetBark(dictionary, value, path, type, textureFormat, filterMode);
				GetNormal(dictionary, value, path, type, textureFormat, filterMode);
				GetWorn(dictionary, value, path, type, textureFormat, filterMode);
				GetCorner(dictionary, value, path, type, textureFormat, filterMode);
				GetCornerWorn(dictionary, value, path, type, textureFormat, filterMode);
				getChest(dictionary, value, path, type, textureFormat, filterMode);
				GetLegs(dictionary, value, path, type, textureFormat, filterMode);
				GetCape(dictionary, value, path, type, textureFormat, filterMode);
				GetHelmet(dictionary, value, path, type, textureFormat, filterMode);
			}
			return dictionary;
		}
	}
}
namespace Seasonality.SeasonUtility
{
	public static class ConsoleCommands
	{
		[HarmonyPatch(typeof(Terminal), "InitTerminal")]
		private static class TerminalInitPatch
		{
			[Serializable]
			[CompilerGenerated]
			private sealed class <>c
			{
				public static readonly <>c <>9 = new <>c();

				public static ConsoleEventFailable <>9__0_0;

				public static ConsoleOptionsFetcher <>9__0_1;

				public static ConsoleEventFailable <>9__1_0;

				public static ConsoleEventFailable <>9__2_0;

				public static ConsoleOptionsFetcher <>9__2_1;

				internal object <Postfix>b__0_0(ConsoleEventArgs args)
				{
					if (args.Length < 2)
					{
						return false;
					}
					switch (args[1])
					{
					case "help":
					{
						List<string> list = new List<string>();
						foreach (KeyValuePair<string, ConsoleCommand> seasonCommand in SeasonCommands)
						{
							list.Add(seasonCommand.Value.Command + " - " + seasonCommand.Value.Description);
						}
						list.Sort();
						foreach (string item in list)
						{
							SeasonalityPlugin.SeasonalityLogger.LogInfo((object)item);
						}
						SeasonalityPlugin.SeasonalityLogger.LogInfo((object)"reload - force reload materials");
						SeasonalityPlugin.SeasonalityLogger.LogInfo((object)"list_weather - list available weather names");
						break;
					}
					case "reload":
						MaterialReplacer.ModifyCachedMaterials(SeasonalityPlugin._Season.Value);
						break;
					case "list_weather":
						if (!Object.op_Implicit((Object)(object)EnvMan.instance))
						{
							return false;
						}
						foreach (EnvSetup environment in EnvMan.instance.m_environments)
						{
							SeasonalityPlugin.SeasonalityLogger.LogInfo((object)environment.m_name);
						}
						break;
					}
					return true;
				}

				internal List<string> <Postfix>b__0_1()
				{
					return new List<string> { "help", "reload" };
				}

				internal object <SaveCommands>b__1_0(ConsoleEventArgs args)
				{
					if (args.Length < 2)
					{
						return false;
					}
					if (!Object.op_Implicit((Object)(object)ZNetScene.instance))
					{
						return false;
					}
					GameObject prefab = ZNetScene.instance.GetPrefab(args[1]);
					if (!Object.op_Implicit((Object)(object)prefab))
					{
						return false;
					}
					Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true);
					foreach (Renderer val in componentsInChildren)
					{
						Material[] materials = val.materials;
						foreach (Material val2 in materials)
						{
							if (!val2.HasProperty("_MainTex"))
							{
								continue;
							}
							Texture texture = val2.GetTexture(MainTex);
							if ((Object)(object)texture == (Object)null)
							{
								continue;
							}
							Texture2D val3 = (Texture2D)(object)((texture is Texture2D) ? texture : null);
							if (val3 == null)
							{
								continue;
							}
							try
							{
								byte[] bytes = ImageConversion.EncodeToPNG(val3);
								if (!Directory.Exists(SeasonPaths.CustomSavePath))
								{
									Directory.CreateDirectory(SeasonPaths.CustomSavePath);
								}
								string[] obj = new string[6]
								{
									SeasonPaths.CustomSavePath,
									null,
									null,
									null,
									null,
									null
								};
								char directorySeparatorChar = Path.DirectorySeparatorChar;
								obj[1] = directorySeparatorChar.ToString();
								obj[2] = ((Object)val2).name.Replace("(Instance)", string.Empty);
								obj[3] = ".";
								obj[4] = ((Object)texture).name;
								obj[5] = ".png";
								string text = string.Concat(obj);
								File.WriteAllBytes(text, bytes);
								SeasonalityPlugin.SeasonalityLogger.LogInfo((object)("Saved texture to disk: " + text));
							}
							catch
							{
								SeasonalityPlugin.SeasonalityLogger.LogInfo((object)("Failed to save texture: " + ((Object)texture).name));
							}
						}
					}
					return true;
				}

				internal object <ConfigCommands>b__2_0(ConsoleEventArgs args)
				{
					if (args.Length < 2)
					{
						return false;
					}
					switch (args[1])
					{
					case "summer":
						SeasonalityPlugin._Season.Value = SeasonalityPlugin.Season.Summer;
						break;
					case "fall":
						SeasonalityPlugin._Season.Value = SeasonalityPlugin.Season.Fall;
						break;
					case "winter":
						SeasonalityPlugin._Season.Value = SeasonalityPlugin.Season.Winter;
						break;
					case "spring":
						SeasonalityPlugin._Season.Value = SeasonalityPlugin.Season.Spring;
						break;
					}
					return true;
				}

				internal List<string> <ConfigCommands>b__2_1()
				{
					return new List<string> { "summer", "fall", "winter", "spring" };
				}
			}

			private static void Postfix()
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Expected O, but got Unknown
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Expected O, but got Unknown
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Expected O, but got Unknown
				object obj = <>c.<>9__0_0;
				if (obj == null)
				{
					ConsoleEventFailable val = delegate(ConsoleEventArgs args)
					{
						if (args.Length < 2)
						{
							return false;
						}
						switch (args[1])
						{
						case "help":
						{
							List<string> list = new List<string>();
							foreach (KeyValuePair<string, ConsoleCommand> seasonCommand in SeasonCommands)
							{
								list.Add(seasonCommand.Value.Command + " - " + seasonCommand.Value.Description);
							}
							list.Sort();
							foreach (string item in list)
							{
								SeasonalityPlugin.SeasonalityLogger.LogInfo((object)item);
							}
							SeasonalityPlugin.SeasonalityLogger.LogInfo((object)"reload - force reload materials");
							SeasonalityPlugin.SeasonalityLogger.LogInfo((object)"list_weather - list available weather names");
							break;
						}
						case "reload":
							MaterialReplacer.ModifyCachedMaterials(SeasonalityPlugin._Season.Value);
							break;
						case "list_weather":
							if (!Object.op_Implicit((Object)(object)EnvMan.instance))
							{
								return false;
							}
							foreach (EnvSetup environment in EnvMan.instance.m_environments)
							{
								SeasonalityPlugin.SeasonalityLogger.LogInfo((object)environment.m_name);
							}
							break;
						}
						return true;
					};
					<>c.<>9__0_0 = val;
					obj = (object)val;
				}
				object obj2 = <>c.<>9__0_1;
				if (obj2 == null)
				{
					ConsoleOptionsFetcher val2 = () => new List<string> { "help", "reload" };
					<>c.<>9__0_1 = val2;
					obj2 = (object)val2;
				}
				ConsoleCommand val3 = new ConsoleCommand("seasonality", "Shows a list of console commands for seasonality", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)obj2, false, false, false);
				SeasonCommands.Clear();
				ConfigCommands();
			}

			private static void SaveCommands()
			{
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Expected O, but got Unknown
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Expected O, but got Unknown
				object obj = <>c.<>9__1_0;
				if (obj == null)
				{
					ConsoleEventFailable val = delegate(ConsoleEventArgs args)
					{
						if (args.Length < 2)
						{
							return false;
						}
						if (!Object.op_Implicit((Object)(object)ZNetScene.instance))
						{
							return false;
						}
						GameObject prefab = ZNetScene.instance.GetPrefab(args[1]);
						if (!Object.op_Implicit((Object)(object)prefab))
						{
							return false;
						}
						Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true);
						foreach (Renderer val2 in componentsInChildren)
						{
							Material[] materials = val2.materials;
							foreach (Material val3 in materials)
							{
								if (val3.HasProperty("_MainTex"))
								{
									Texture texture = val3.GetTexture(MainTex);
									if (!((Object)(object)texture == (Object)null))
									{
										Texture2D val4 = (Texture2D)(object)((texture is Texture2D) ? texture : null);
										if (val4 != null)
										{
											try
											{
												byte[] bytes = ImageConversion.EncodeToPNG(val4);
												if (!Directory.Exists(SeasonPaths.CustomSavePath))
												{
													Directory.CreateDirectory(SeasonPaths.CustomSavePath);
												}
												string[] obj2 = new string[6]
												{
													SeasonPaths.CustomSavePath,
													null,
													null,
													null,
													null,
													null
												};
												char directorySeparatorChar = Path.DirectorySeparatorChar;
												obj2[1] = directorySeparatorChar.ToString();
												obj2[2] = ((Object)val3).name.Replace("(Instance)", string.Empty);
												obj2[3] = ".";
												obj2[4] = ((Object)texture).name;
												obj2[5] = ".png";
												string text = string.Concat(obj2);
												File.WriteAllBytes(text, bytes);
												SeasonalityPlugin.SeasonalityLogger.LogInfo((object)("Saved texture to disk: " + text));
											}
											catch
											{
												SeasonalityPlugin.SeasonalityLogger.LogInfo((object)("Failed to save texture: " + ((Object)texture).name));
											}
										}
									}
								}
							}
						}
						return true;
					};
					<>c.<>9__1_0 = val;
					obj = (object)val;
				}
				ConsoleCommand value = new ConsoleCommand("seasonality_save", "[prefabName] - Attempts to save texture to file", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false);
				if (!SeasonCommands.ContainsKey("seasonality_save"))
				{
					SeasonCommands.Add("seasonality_save", value);
				}
			}

			private static void ConfigCommands()
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Expected O, but got Unknown
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Expected O, but got Unknown
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Expected O, but got Unknown
				object obj = <>c.<>9__2_0;
				if (obj == null)
				{
					ConsoleEventFailable val = delegate(ConsoleEventArgs args)
					{
						if (args.Length < 2)
						{
							return false;
						}
						switch (args[1])
						{
						case "summer":
							SeasonalityPlugin._Season.Value = SeasonalityPlugin.Season.Summer;
							break;
						case "fall":
							SeasonalityPlugin._Season.Value = SeasonalityPlugin.Season.Fall;
							break;
						case "winter":
							SeasonalityPlugin._Season.Value = SeasonalityPlugin.Season.Winter;
							break;
						case "spring":
							SeasonalityPlugin._Season.Value = SeasonalityPlugin.Season.Spring;
							break;
						}
						return true;
					};
					<>c.<>9__2_0 = val;
					obj = (object)val;
				}
				object obj2 = <>c.<>9__2_1;
				if (obj2 == null)
				{
					ConsoleOptionsFetcher val2 = () => new List<string> { "summer", "fall", "winter", "spring" };
					<>c.<>9__2_1 = val2;
					obj2 = (object)val2;
				}
				ConsoleCommand val3 = new ConsoleCommand("season", "[season name] changes season (ex: summer, fall, winter, spring)", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)obj2, false, false, true);
				SeasonCommands[val3.Command] = val3;
			}

			private static void SearchCommands()
			{
			}
		}

		[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(1)]
		private static readonly Dictionary<string, ConsoleCommand> SeasonCommands = new Dictionary<string, ConsoleCommand>();

		private static readonly int MainTex = Shader.PropertyToID("_MainTex");
	}
	[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(1)]
	[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(0)]
	public static class Utils
	{
		public static VegetationType GetVegetationType(string prefabName)
		{
			string input = prefabName.Replace("(Clone)", "");
			input = Regex.Replace(input, "\\(.*?\\)", "");
			input = input.Replace(" ", "");
			if (input.ToLower().Contains("runestone"))
			{
				return VegetationType.Rock;
			}
			if (1 == 0)
			{
			}
			VegetationType result = input switch
			{
				"Beech" => VegetationType.Beech, 
				"Beech1" => VegetationType.Beech, 
				"Beech_small1" => VegetationType.BeechSmall, 
				"Beech_small2" => VegetationType.BeechSmall, 
				"Birch" => VegetationType.Birch, 
				"Birch1" => VegetationType.Birch, 
				"Birch2" => VegetationType.Birch, 
				"Birch1_aut" => VegetationType.Birch, 
				"Birch2_aut" => VegetationType.Birch, 
				"Oak" => VegetationType.Oak, 
				"Oak1" => VegetationType.Oak, 
				"FirTree_small_dead" => VegetationType.FirDead, 
				"FirTree" => VegetationType.Fir, 
				"FirTree_small" => VegetationType.FirSmall, 
				"Pinetree_01" => VegetationType.Pine, 
				"SwampTree1" => VegetationType.Swamp, 
				"SwampTree2" => VegetationType.Swamp, 
				"SwampTree2_darkland" => VegetationType.Swamp, 
				"YggaShoot1" => VegetationType.Yggashoot, 
				"YggaShoot2" => VegetationType.Yggashoot, 
				"YggaShoot3" => VegetationType.Yggashoot, 
				"YggaShoot_small1" => VegetationType.YggashootSmall, 
				"YggdrasilTree2_RtD" => VegetationType.Yggashoot, 
				"Bush01_heath" => VegetationType.Bush, 
				"Bush02_en" => VegetationType.PlainsBush, 
				"Bush01" => VegetationType.Bush, 
				"shrub_2" => VegetationType.Shrub, 
				"shrub_2_heath" => VegetationType.Shrub, 
				"stubbe" => VegetationType.Stubbe, 
				"FirTree_oldLog" => VegetationType.Log, 
				"SwampTree2_log" => VegetationType.Log, 
				"RockDolmen_1" => VegetationType.Rock, 
				"RockDolmen_2" => VegetationType.Rock, 
				"RockDolmen_3" => VegetationType.Rock, 
				"Rock_3" => VegetationType.Rock, 
				"Rock_4" => VegetationType.Rock, 
				"Rock_7" => VegetationType.Rock, 
				"rock4_forest" => VegetationType.Rock, 
				"rock4_copper" => VegetationType.Rock, 
				"rock4_coast" => VegetationType.Rock, 
				"StatueEvil" => VegetationType.Rock, 
				"rock1_mountain" => VegetationType.Rock, 
				"rock2_heath" => VegetationType.RockPlains, 
				"rock4_heath" => VegetationType.RockPlains, 
				"Rock_4_plains" => VegetationType.RockPlains, 
				"HeathRockPillar" => VegetationType.RockPlains, 
				"Rock_destructible" => VegetationType.Rock, 
				"Rock_3_static" => VegetationType.Rock, 
				"RockFinger" => VegetationType.RockPlains, 
				"RockFingerBroken" => VegetationType.RockPlains, 
				"rockformation1" => VegetationType.Rock, 
				"RockThumb" => VegetationType.RockPlains, 
				"Rocks2" => VegetationType.Rock, 
				"highstone" => VegetationType.RockPlains, 
				"widestone" => VegetationType.RockPlains, 
				"StatueSeed" => VegetationType.Rock, 
				"RaspberryBush" => VegetationType.RaspberryBush, 
				"BlueberryBush" => VegetationType.BlueberryBush, 
				"CloudberryBush" => VegetationType.CloudberryBush, 
				"vines" => VegetationType.Vines, 
				_ => VegetationType.None, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		public static GrassTypes GetGrassType(string clutterName)
		{
			if (1 == 0)
			{
			}
			GrassTypes result = clutterName switch
			{
				"instanced_meadows_grass" => GrassTypes.GreenGrass, 
				"instanced_meadows_grass_short" => GrassTypes.GreenGrassShort, 
				"instanced_shrub" => GrassTypes.ClutterShrubs, 
				"clutter_shrub_large" => GrassTypes.ClutterShrubs, 
				"instanced_forest_groundcover_brown" => GrassTypes.GroundCoverBrown, 
				"instanced_forest_groundcover" => GrassTypes.GroundCover, 
				"instanced_swamp_grass" => GrassTypes.SwampGrass, 
				"instanced_heathgrass" => GrassTypes.HeathGrass, 
				"grasscross_heath_green" => GrassTypes.GrassHeathGreen, 
				"instanced_heathflowers" => GrassTypes.HeathFlowers, 
				"instanced_swamp_ormbunke" => GrassTypes.OrmBunkeSwamp, 
				"instanced_ormbunke" => GrassTypes.Ormbunke, 
				"instanced_vass" => GrassTypes.Vass, 
				"instanced_waterlilies" => GrassTypes.WaterLilies, 
				"instanced_mistlands_rockplant" => GrassTypes.RockPlant, 
				"instanced_small_rock1" => GrassTypes.Rocks, 
				"instanced_mistlands_grass_short" => GrassTypes.MistlandGrassShort, 
				_ => GrassTypes.None, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		public static void ApplyRandomly(List<Action> methods)
		{
			if (methods.Count != 0)
			{
				Random random = new Random();
				int index = random.Next(methods.Count);
				methods[index]();
			}
		}

		[return: <6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(2)]
		public static Texture GetCustomTexture(Directories.VegDirectories type, string key)
		{
			Dictionary<string, Texture> value;
			Texture value2;
			return (!TextureManager.CustomRegisteredTextures.TryGetValue(type, out value)) ? null : (value.TryGetValue(key, out value2) ? value2 : null);
		}

		[return: <6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(2)]
		public static Texture GetCustomTexture(Directories.ArmorDirectories type, string key)
		{
			Dictionary<string, Texture> value;
			Texture value2;
			return (!TextureManager.CustomRegisteredArmorTex.TryGetValue(type, out value)) ? null : (value.TryGetValue(key, out value2) ? value2 : null);
		}

		[return: <6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(2)]
		public static Texture GetCustomTexture(Directories.PickableDirectories type, string key)
		{
			Dictionary<string, Texture> value;
			Texture value2;
			return (!TextureManager.CustomRegisteredPickableTex.TryGetValue(type, out value)) ? null : (value.TryGetValue(key, out value2) ? value2 : null);
		}

		[return: <6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(2)]
		public static Texture GetCustomTexture(Directories.PieceDirectories type, string key)
		{
			Dictionary<string, Texture> value;
			Texture value2;
			return (!TextureManager.CustomRegisteredPieceTextures.TryGetValue(type, out value)) ? null : (value.TryGetValue(key, out value2) ? value2 : null);
		}

		[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(2)]
		public static Texture GetCustomTexture(Directories.CreatureDirectories type, SeasonalityPlugin.Season key)
		{
			Dictionary<string, Texture> value;
			Texture value2;
			return (!TextureManager.CustomRegisteredCreatureTex.TryGetValue(type, out value)) ? null : (value.TryGetValue(key.ToString(), out value2) ? value2 : null);
		}

		private static bool CustomTextureExist(Directories.VegDirectories type, string key)
		{
			Dictionary<string, Texture> value;
			return TextureManager.CustomRegisteredTextures.TryGetValue(type, out value) && value.ContainsKey(key);
		}

		public static Directories.VegDirectories VegToDirectory(GrassTypes type)
		{
			if (1 == 0)
			{
			}
			Directories.VegDirectories result = type switch
			{
				GrassTypes.GreenGrass => Directories.VegDirectories.MeadowGrass, 
				GrassTypes.GreenGrassShort => Directories.VegDirectories.MeadowGrassShort, 
				GrassTypes.GroundCover => Directories.VegDirectories.BlackForestGrass, 
				GrassTypes.GroundCoverBrown => Directories.VegDirectories.BlackForestGrassAlt, 
				GrassTypes.SwampGrass => Directories.VegDirectories.SwampGrass, 
				GrassTypes.HeathGrass => Directories.VegDirectories.PlainsGrass, 
				GrassTypes.HeathFlowers => Directories.VegDirectories.PlainsFlowers, 
				GrassTypes.Ormbunke => Directories.VegDirectories.Ormbunke, 
				GrassTypes.OrmBunkeSwamp => Directories.VegDirectories.Ormbunke, 
				GrassTypes.Vass => Directories.VegDirectories.Vass, 
				GrassTypes.WaterLilies => Directories.VegDirectories.WaterLilies, 
				GrassTypes.RockPlant => Directories.VegDirectories.RockPlant, 
				GrassTypes.ClutterShrubs => Directories.VegDirectories.Clutter, 
				GrassTypes.MistlandGrassShort => Directories.VegDirectories.MistlandsGrass, 
				GrassTypes.GrassHeathGreen => Directories.VegDirectories.PlainsGrass, 
				_ => Directories.VegDirectories.None, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		public static Directories.VegDirectories VegToDirectory(VegetationType type)
		{
			if (1 == 0)
			{
			}
			Directories.VegDirectories result = type switch
			{
				VegetationType.Beech => Directories.VegDirectories.Beech, 
				VegetationType.BeechSmall => Directories.VegDirectories.BeechSmall, 
				VegetationType.Birch => Directories.VegDirectories.Birch, 
				VegetationType.Bush => Directories.VegDirectories.Bushes, 
				VegetationType.Oak => Directories.VegDirectories.Oak, 
				VegetationType.Pine => Directories.VegDirectories.Pine, 
				VegetationType.Fir => Directories.VegDirectories.Fir, 
				VegetationType.Yggashoot => Directories.VegDirectories.YggaShoot, 
				VegetationType.PlainsBush => Directories.VegDirectories.PlainsBush, 
				VegetationType.Shrub => Directories.VegDirectories.Shrub, 
				VegetationType.Rock => Directories.VegDirectories.Rock, 
				VegetationType.Swamp => Directories.VegDirectories.SwampTrees, 
				VegetationType.CloudberryBush => Directories.VegDirectories.CloudberryBush, 
				VegetationType.Vines => Directories.VegDirectories.Vines, 
				_ => Directories.VegDirectories.None, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		public static bool ApplyBasedOnAvailable(Directories.VegDirectories directory, SeasonalityPlugin.Season season, Material material, string prop)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			if (directory == Directories.VegDirectories.None)
			{
				return false;
			}
			if (!CustomTextureExist(directory, season.ToString()))
			{
				return false;
			}
			Texture customTexture = GetCustomTexture(directory, season.ToString());
			if (!Object.op_Implicit((Object)(object)customTexture))
			{
				return false;
			}
			material.SetTexture(prop, customTexture);
			material.color = Color.white;
			return true;
		}

		public static bool FindTexturePropName(string[] props, string query, out string result)
		{
			result = "";
			foreach (string text in props)
			{
				if (text.ToLower().Contains(query))
				{
					result = text;
					return true;
				}
			}
			return false;
		}
	}
}
namespace Seasonality.Seasons
{
	[<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(0)]
	[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(1)]
	public static class MaterialReplacer
	{
		[HarmonyPatch(typeof(ZoneSystem), "Start")]
		[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(0)]
		private static class ZoneSystemPatch
		{
			[<1f98b2f7-78a9-43e0-910f-1965ccd1913c>NullableContext(1)]
			private static void Postfix(ZoneSystem __instance)
			{
				if (Object.op_Implicit((Object)(object)__instance))
				{
					GetAllMaterials();
					GetAllTextures();
				}
			}
		}

		public static readonly Dictionary<string, Texture> CachedTextures = new Dictionary<string, Texture>();

		public static readonly Dictionary<string, Material> CachedMaterials = new Dictionary<string, Material>();

		public static readonly Dictionary<string, Material> CustomMaterials = new Dictionary<string, Material>();

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

		public static readonly Dictionary<Material, Color> m_mossColors = new Dictionary<Material, Color>();

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

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

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

		private static readonly int MainTex = Shader.PropertyToID("_MainTex");

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

		private static readonly int MossColorProp = Shader.PropertyToID("_MossColor");

		private static readonly int ColorProp = Shader.PropertyToID("_Color");

		private static readonly int BumpMap = Shader.PropertyToID("_BumpMap");

		private static bool m_inAshlands;

		private static bool m_firstCheck = true;

		private static float m_ashlandTimer;

		private static void GetAllMaterials()
		{
			Material[] array = Resources.FindObjectsOfTypeAll<Material>();
			Material[] array2 = array;
			foreach (Material val in array2)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					string key = ((Object)val).name.Replace("(Instance)", "").Replace(" ", "");
					CachedMaterials[key] = val;
				}
			}
		}

		private static void SetArmorColors(SeasonalityPlugin.Season season)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			if (CachedMaterials.TryGetValue("CapeDeerHide", out var value))
			{
				value.SetColor(ColorProp, Color32.op_Implicit(Object.op_Implicit((Object)(object)GetCustomTexture(season, Directories.ArmorDirectories.Leather, "CapeDeerHide", isLegs: false, isCape: true)) ? new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue) : new Color32((byte)182, (byte)125, (byte)102, byte.MaxValue)));
			}
			if (CachedMaterials.TryGetValue("CapeTrollHide", out var value2))
			{
				value2.SetColor(ColorProp, Color32.op_Implicit(Object.op_Implicit((Object)(object)GetCustomTexture(season, Directories.ArmorDirectories.Troll, "CapeTrollHide", isLegs: false, isCape: true)) ? new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue) : new Color32((byte)102, (byte)149, (byte)182, byte.MaxValue)));
			}
			if (CachedMaterials.TryGetValue("helmet_trollleather", out var value3))
			{
				value3.SetColor(ColorProp, Color32.op_Implicit(Object.op_Implicit((Object)(object)GetCustomTexture(season, Directories.ArmorDirectories.Troll, "helmet_trollleather", isLegs: false, isCape: false, isHelmet: true)) ? new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue) : new Color32((byte)88, (byte)123, (byte)151, byte.MaxValue)));
			}
		}

		private static void GetAllTextures()
		{
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			foreach (Material value in CachedMaterials.Values)
			{
				if (Object.op_Implicit((Object)(object)value))
				{
					string text = ((Object)value).name.Replace("(Instance)", "").Replace(" ", "");
					if (value.HasProperty(MainTex))
					{
						CachedTextures[text] = value.GetTexture(MainTex);
					}
					if (value.HasProperty(MossTex))
					{
						CachedTextures[text + "_moss"] = value.GetTexture(MossTex);
						m_mossMaterials[value] = value.GetTexture(MossTex);
					}
					if (value.HasProperty("_MossColor"))
					{
						m_mossColors[value] = value.GetColor(MossColorProp);
					}
					if (value.HasProperty(BumpMap))
					{
						CachedTextures[text + "_normal"] = value.GetTexture(BumpMap);
					}
					if (value.HasProperty(ChestTex))
					{
						CachedTextures[text + "_chest"] = value.GetTexture(ChestTex);
					}
					if (value.HasProperty(LegsTex))
					{
						CachedTextures[text + "_legs"] = value.GetTexture(LegsTex);
					}
				}
			}
		}

		private static void SetMainTexture(string materialName, [<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(2)] Texture tex)
		{
			if (CachedMaterials.TryGetValue(materialName, out var value))
			{
				value.SetTexture(MainTex, tex);
			}
		}

		private static void SetMossColor(string materialName, Color32 color)
		{
			//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)
			if (CachedMaterials.TryGetValue(materialName, out var value))
			{
				value.SetColor(MossColorProp, Color32.op_Implicit(color));
			}
		}

		private static void SetChestTexture(string materialName, [<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(2)] Texture tex)
		{
			if (CachedMaterials.TryGetValue(materialName, out var value))
			{
				value.SetTexture(ChestTex, tex);
			}
		}

		private static void SetLegsTexture(string materialName, [<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(2)] Texture tex)
		{
			if (CachedMaterials.TryGetValue(materialName, out var value))
			{
				value.SetTexture(LegsTex, tex);
			}
		}

		private static void SetNormalTexture(string materialName, [<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(2)] Texture normal)
		{
			if (CachedMaterials.TryGetValue(materialName, out var value) && Object.op_Implicit((Object)(object)normal))
			{
				value.SetTexture(BumpMap, normal);
			}
		}

		private static void SetCustomMainTexture(string materialName, [<6a8baf6c-d6a5-464d-a2b8-007977aefe74>Nullable(2)] Texture tex, int index = 0)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if (CustomMaterials.TryGetValue(materialName, out var value))
			{
				value.SetTexture(MainTex, tex);
				SeasonalityPlugin.Season value2 = SeasonalityPlugin._Season.Value;
				SeasonalityPlugin.Season season = value2;
				if (season == SeasonalityPlugin.Season.Fall)
				{
					value.color = SeasonColors.FallColors[index];
				}
				else
				{
					value.color = Color.white;
				}
			}
		}

		public static void ModifyCachedMaterials(SeasonalityPlugin.Season season)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)SystemInfo.graphicsDeviceType != 4)
			{
				ModifyMossMaterials(season);
				if (SeasonalityPlugin._ReplaceCreatureTextures.Value == SeasonalityPlugin.Toggle.On)
				{
					ModifyCreatures(season);
				}
				ModifyVegetation(season);
				ModifyCustomMaterials(season);
				ModifyPieceMaterials(season);
				ModifyBarkMaterials(season);
				ModifyPickableMaterials(season);
				if (SeasonalityPlugin._ReplaceArmorTextures.Value == SeasonalityPlugin.Toggle.On)
				{
					SetArmorColors(season);
					ModifyArmorMaterials(season);
				}
			}
		}

		private static void ModifyArmorMaterials(SeasonalityPlugin.Season season)
		{
			Dictionary<string, Directories.ArmorDirectories> dictionary = new Dictionary<string, Directories.ArmorDirectories>
			{
				{
					"RagsChest",
					Directories.ArmorDirectories.Rags
				},
				{
					"LeatherChest",
					Directories.ArmorDirectories.Leather
				},
				{
					"TrollLeatherChest",
					Directories.ArmorDirectories.Troll
				}
			};
			Dictionary<string, Directories.ArmorDirectories> dictionary2 = new Dictionary<string, Directories.ArmorDirectories>
			{
				{
					"RagsLegs",
					Directories.ArmorDirectories.Rags
				},
				{
					"LeatherPants",
					Directories.ArmorDirectories.Leather
				},
				{
					"TrollLeatherPants",
					Directories.ArmorDirectories.Troll
				}
			};
			Dictionary<string, Directories.ArmorDirectories> dictionary3 = new Dictionary<string, Directories.ArmorDirectories>
			{
				{
					"CapeDeerHide",
					Directories.ArmorDirectories.Leather
				},
				{
					"CapeTrollHide",
					Directories.ArmorDirectories.Troll
				},
				{
					"WolfCape",
					Directories.ArmorDirectories.Wolf
				},
				{
					"LoxCape_Mat",
					Directories.ArmorDirectories.Padded
				},
				{
					"feathercape_mat",
					Directories.ArmorDirectories.Mage
				}
			};
			Dictionary<string, Directories.ArmorDirectories> dictionary4 = new Dictionary<string, Directories.ArmorDirectories>
			{
				{
					"helmet_leather_mat",
					Directories.ArmorDirectories.Leather
				},
				{
					"helmet_trollleather",
					Directories.ArmorDirectories.Troll
				},
				{
					"helmet_bronze_mat",
					Directories.ArmorDirectories.Bronze
				},
				{
					"helmet_iron_mat",
					Directories.ArmorDirectories.Iron
				}
			};
			Dictionary<string, Directories.ArmorDirectories> dictionary5 = new Dictionary<string, Directories.ArmorDirectories>
			{
				{
					"BronzeArmorMesh_Mat",
					Directories.ArmorDirectories.Bronze
				},
				{
					"IronArmorChest_mat",
					Directories.ArmorDirectories.Iron
				},
				{
					"SilverArmourChest_mat",
					Directories.ArmorDirectories.Wolf
				},
				{
					"DragonVisor_Mat",
					Directories.ArmorDirectories.Wolf
				},
				{
					"Padded_mat",
					Directories.ArmorDirectories.Padded
				},
				{
					"carapacearmor_mat",
					Directories.ArmorDirectories.Carapace
				},
				{
					"MageArmor_mat",
					Directories.ArmorDirectories.Mage
				}
			};
			Dictionary<string, Directories.ArmorDirectories> dictionary6 = new Dictionary<string, Directories.ArmorDirectories> { 
			{
				"IronArmorLegs_mat",
				Directories.ArmorDirectories.Iron
			} };
			foreach (KeyValuePair<string, Directories.ArmorDirectories> item in dictionary)
			{
				Texture customTexture = GetCustomTexture(season, item.Value, item.Key);
				if (!Object.op_Implicit((Object)(object)customTexture))
				{
					if (CachedTextures.TryGetValue(item.Key + "_chest", out var value))
					{
						SetChestTexture(item.Key, value);
					}
				}
				else
				{
					SetChestTexture(item.Key, customTexture);
				}
			}
			foreach (KeyValuePair<string, Directories.ArmorDirectories> item2 in dictionary2)
			{
				Texture customTexture2 = GetCustomTexture(season, item2.Value, item2.Key, isLegs: true);
				if (!Object.op_Implicit((Object)(object)customTexture2))
				{
					if (CachedTextures.TryGetValue(item2.Key + "_legs", out var value2))
					{
						SetLegsTexture(item2.Key, value2);
					}
				}
				else
				{
					SetLegsTexture(item2.Key, customTexture2);
				}
			}
			foreach (KeyValuePair<string, Directories.ArmorDirectories> item3 in dictionary3)
			{
				Texture customTexture3 = GetCustomTexture(season, item3.Value, item3.Key, isLegs: false, isCape: true);
				if (!Object.op_Implicit((Object)(object)customTexture3))
				{
					if (CachedTextures.TryGetValue(item3.Key + "_cape", out var value3))
					{
						SetMainTexture(item3.Key, value3);
					}
				}
				else
				{
					SetMainTexture(item3.Key, customTexture3);
				}
			}
			foreach (KeyValuePair<string, Directories.ArmorDirectories> item4 in dictionary4)
			{
				Texture customTexture4 = GetCustomTexture(season, item4.Value, item4.Key, isLegs: false, isCape: false, isHelmet: true);
				if (!Object.op_Implicit((Object)(object)customTexture4))
				{
					if (CachedTextures.TryGetValue(item4.Key, out var value4))
					{
						SetMainTexture(item4.Key, value4);
					}
				}
				else
				{
					SetMainTexture(item4.Key, customTexture4);
				}
			}
			foreach (KeyValuePair<string, Directories.ArmorDirectories> item5 in dictionary5)
			{
				Texture customTexture5 = GetCustomTexture(season, item5.Value, item5.Key);
				if (!Object.op_Implicit((Object)(object)customTexture5))
				{
					if (CachedTextures.TryGetValue(item5.Key, out var value5))
					{
						SetMainTexture(item5.Key, value5);
					}
				}
				else
				{
					SetMainTexture(item5.Key, customTexture5);
				}
			}
			foreach (KeyValuePair<string, Directories.ArmorDirectories> item6 in dictionary6)
			{
				Texture customTexture6 = GetCustomTexture(season, item6.Value, item6.Key, isLegs: true);
				if (!Object.op_Implicit((Object)(object)customTexture6))
				{
					if (CachedTextures.TryGetValue(item6.Key, out var value6))
					{
						SetMainTexture(item6.Key, value6);
					}
				}
				else
				{
					SetMainTexture(item6.Key, customTexture6);
				}
			}
		}

		private static void ModifyPieceMaterials(SeasonalityPlugin.Season season)
		{
			Dictionary<string, Directories.PieceDirectories> dictionary = new Dictionary<string, Directories.PieceDirectories>
			{
				{
					"straw_roof",
					Directories.PieceDirectories.Straw
				},
				{
					"straw_roof_alpha",
					Directories.PieceDirectories.Straw
				},
				{
					"RoofShingles",
					Directories.PieceDirectories.DarkWood
				},
				{
					"GoblinVillage_Cloth",
					Directories.PieceDirectories.GoblinVillage
				},
				{
					"GoblinVillage",
					Directories.PieceDirectories.GoblinVillage
				}
			};
			Dictionary<string, Directories.PieceDirectories> dictionary2 = new Dictionary<string, Directories.PieceDirectories>
			{
				{
					"straw_roof_worn",
					Directories.PieceDirectories.Straw
				},
				{
					"straw_roof_worn_alpha",
					Directories.PieceDirectories.Straw
				},
				{
					"RoofShingles_worn",
					Directories.PieceDirectories.DarkWood
				},
				{
					"GoblinVillage",
					Directories.PieceDirectories.GoblinVillage
				}
			};
			Dictionary<string, Directories.PieceDirectories> dictionary3 = new Dictionary<string, Directories.PieceDirectories> { 
			{
				"straw_roof_corner_alpha",
				Directories.PieceDirectories.Straw
			} };
			Dictionary<string, Directories.PieceDirectories> dictionary4 = new Dictionary<string, Directories.PieceDirectories> { 
			{
				"straw_roof_corner_worn_alpha",
				Directories.PieceDirectories.Straw
			} };
			foreach (KeyValuePair<string, Directories.PieceDirectories> item in dictionary)
			{
				Texture customTexture = GetCustomTexture(season, item.Value, item.Key);
				if (Object.op_Implicit((Object)(object)customTexture))
				{
					SetMainTexture(item.Key, customTexture);
				}
			}
			foreach (KeyValuePair<string, Directories.PieceDirectories> item2 in dictionary2)
			{
				Texture customTexture2 = GetCustomTexture(season, item2.Value, item2.Key, isWorn: true);
				if (Object.op_Implicit((Object)(object)customTexture2))
				{
					SetMainTexture(item2.Key, customTexture2);
				}
			}
			foreach (KeyValuePair<string, Directories.PieceDirectories> item3 in dictionary3)
			{
				Texture customTexture3 = GetCustomTexture(season, item3.Value, item3.Key, isWorn: false, isCorner: true);
				if (Object.op_Implicit((Object)(object)customTexture3))
				{
					SetMainTexture(item3.Key, customTexture3);
				}
			}
			foreach (KeyValuePair<string, Directories.PieceDirectories> item4 in dictionary4)
			{
				Texture customTexture4 = GetCustomTexture(season, item4.Value, item4.Key, isWorn: true, isCorner: true);
				if (Object.op_Implicit((Object)(object)customTexture4))
				{
					SetMainTexture(item4.Key, customTexture4);
				}
			}
		}

		private static void ModifyPickableMaterials(SeasonalityPlugin.Season season)
		{
			Dictionary<string, Directories.PickableDirectories> dictionary = new Dictionary<string, Directories.PickableDirectories>
			{
				{
					"Boletus_edulis",
					Directories.PickableDirectories.Mushroom
				},
				{
					"Boletus_Yellow",
					Directories.PickableDirectories.MushroomYellow
				},
				{
					"Boletus_blue",
					Directories.PickableDirectories.MushroomBlue
				},
				{
					"MistlandsMushrooms_balls",
					Directories.PickableDirectories.JotunPuff
				},
				{
					"MistlandsMushrooms_magecap",
					Directories.PickableDirectories.Magecap
				},
				{
					"raspberry",
					Directories.PickableDirectories.Raspberry
				},
				{
					"blueberry",
					Directories.PickableDirectories.Blueberry
				},
				{
					"Dandelion",
					Directories.PickableDirectories.Dandelion
				},
				{
					"barley_ripe",
					Directories.PickableDirectories.Barley
				},
				{
					"flax_ripe",
					Directories.PickableDirectories.Flax
				},
				{
					"flax_item",
					Directories.PickableDirectories.Flax
				},
				{
					"carrot",
					Directories.PickableDirectories.Carrot
				},
				{
					"turnip_0",
					Directories.PickableDirectories.Turnip
				},
				{
					"onion_ripe",
					Directories.PickableDirectories.Onion
				},
				{
					"carrot_flower",
					Directories.PickableDirectories.CarrotSeed
				},
				{
					"turnip_flower",
					Directories.PickableDirectories.TurnipSeed
				},
				{
					"onion_seedling_ripe",
					Directories.PickableDirectories.OnionSeed
				},
				{
					"branch",
					Directories.PickableDirectories.Branches
				},
				{
					"flint",
					Directories.PickableDirectories.Flint
				},
				{
					"stone",
					Directories.PickableDirectories.Rock
				},
				{
					"fi_village_catacombs",
					Directories.PickableDirectories.BoneRemains
				},
				{
					"surtlingcore",
					Directories.PickableDirectories.SurtlingCore
				},
				{
					"BlackCore_mat",
					Directories.PickableDirectories.BlackCore
				},
				{
					"swampplant2",
					Directories.PickableDirectories.Thistle
				}
			};
			foreach (KeyValuePair<string, Directories.PickableDirectories> item in dictionary)
			{
				Texture customTexture = GetCustomTexture(season, item.Value, item.Key);
				if (Object.op_Implicit((Object)(object)customTexture))
				{
					SetMainTexture(item.Key, customTexture);
				}
			}
		}

		private static void ModifyBarkMateria