Decompiled source of WeatherTweaks v0.5.11

WeatherTweaks.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using ConsoleTables;
using HarmonyLib;
using LethalLevelLoader;
using LethalNetworkAPI;
using Microsoft.CodeAnalysis;
using MrovLib;
using MrovLib.API;
using MrovLib.Compatibility;
using Newtonsoft.Json;
using Steamworks.Data;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using WeatherRegistry;
using WeatherRegistry.Patches;
using WeatherTweaks.Modules;
using WeatherTweaks.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("MrovLib")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("WeatherRegistry")]
[assembly: AssemblyCompany("WeatherTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1+cb7ca12fac8ea933952955eb40f3584f27396b26")]
[assembly: AssemblyProduct("WeatherTweaks")]
[assembly: AssemblyTitle("WeatherTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ConsoleTables
{
	public class ConsoleTable
	{
		public static readonly HashSet<Type> NumericTypes = new HashSet<Type>
		{
			typeof(int),
			typeof(double),
			typeof(decimal),
			typeof(long),
			typeof(short),
			typeof(sbyte),
			typeof(byte),
			typeof(ulong),
			typeof(ushort),
			typeof(uint),
			typeof(float)
		};

		public IList<object> Columns { get; }

		public IList<object[]> Rows { get; }

		public ConsoleTableOptions Options { get; }

		public Type[] ColumnTypes { get; private set; }

		public IList<string> Formats { get; private set; }

		public ConsoleTable(params string[] columns)
			: this(new ConsoleTableOptions
			{
				Columns = new List<string>(columns)
			})
		{
		}

		public ConsoleTable(ConsoleTableOptions options)
		{
			Options = options ?? throw new ArgumentNullException("options");
			Rows = new List<object[]>();
			Columns = new List<object>(options.Columns);
		}

		public ConsoleTable AddColumn(IEnumerable<string> names)
		{
			foreach (string name in names)
			{
				Columns.Add(name);
			}
			return this;
		}

		public ConsoleTable AddRow(params object[] values)
		{
			if (values == null)
			{
				throw new ArgumentNullException("values");
			}
			if (!Columns.Any())
			{
				throw new Exception("Please set the columns first");
			}
			if (Columns.Count != values.Length)
			{
				throw new Exception($"The number columns in the row ({Columns.Count}) does not match the values ({values.Length})");
			}
			Rows.Add(values);
			return this;
		}

		public ConsoleTable Configure(Action<ConsoleTableOptions> action)
		{
			action(Options);
			return this;
		}

		public static ConsoleTable FromDictionary(Dictionary<string, Dictionary<string, object>> values)
		{
			ConsoleTable consoleTable = new ConsoleTable();
			List<string> list = values.SelectMany((KeyValuePair<string, Dictionary<string, object>> x) => x.Value.Keys).Distinct().ToList();
			list.Insert(0, "");
			consoleTable.AddColumn(list);
			foreach (KeyValuePair<string, Dictionary<string, object>> value2 in values)
			{
				List<object> list2 = new List<object> { value2.Key };
				foreach (string item in list.Skip(1))
				{
					list2.Add(value2.Value.TryGetValue(item, out var value) ? value : "");
				}
				consoleTable.AddRow(list2.Cast<object>().ToArray());
			}
			return consoleTable;
		}

		public static ConsoleTable From<T>(IEnumerable<T> values)
		{
			ConsoleTable consoleTable = new ConsoleTable
			{
				ColumnTypes = GetColumnsType<T>().ToArray()
			};
			List<string> columns = GetColumns<T>().ToList();
			consoleTable.AddColumn(columns);
			foreach (IEnumerable<object> item in values.Select((T value) => columns.Select((string column) => GetColumnValue<T>(value, column))))
			{
				consoleTable.AddRow(item.ToArray());
			}
			return consoleTable;
		}

		public static ConsoleTable From(DataTable dataTable)
		{
			ConsoleTable consoleTable = new ConsoleTable();
			List<string> names = (from DataColumn x in dataTable.Columns
				select x.ColumnName).ToList();
			consoleTable.AddColumn(names);
			foreach (DataRow row in dataTable.Rows)
			{
				string[] array = row.ItemArray.Select((object x) => (x is byte[] inArray) ? Convert.ToBase64String(inArray) : x.ToString()).ToArray();
				object[] values = array;
				consoleTable.AddRow(values);
			}
			return consoleTable;
		}

		public override string ToString()
		{
			StringBuilder stringBuilder = new StringBuilder();
			List<int> columnLengths = ColumnLengths();
			List<string> columnAlignment = Enumerable.Range(0, Columns.Count).Select(GetNumberAlignment).ToList();
			string format = (from i in Enumerable.Range(0, Columns.Count)
				select " | {" + i + "," + columnAlignment[i] + columnLengths[i] + "}").Aggregate((string s, string a) => s + a) + " |";
			SetFormats(ColumnLengths(), columnAlignment);
			int val = Math.Max(0, Rows.Any() ? Rows.Max((object[] row) => string.Format(format, row).Length) : 0);
			string text = string.Format(Formats[0], Columns.ToArray());
			int num = Math.Max(val, text.Length);
			List<string> list = Rows.Select((object[] row, int i) => string.Format(Formats[i + 1], row)).ToList();
			string value = " " + string.Join("", Enumerable.Repeat("-", num - 1)) + " ";
			stringBuilder.AppendLine(value);
			stringBuilder.AppendLine(text);
			foreach (string item in list)
			{
				stringBuilder.AppendLine(value);
				stringBuilder.AppendLine(item);
			}
			stringBuilder.AppendLine(value);
			if (Options.EnableCount)
			{
				stringBuilder.AppendLine("");
				stringBuilder.AppendFormat(" Count: {0}", Rows.Count);
			}
			return stringBuilder.ToString();
		}

		private void SetFormats(List<int> columnLengths, List<string> columnAlignment)
		{
			List<object[]> list = new List<object[]>();
			list.Add(Columns.ToArray());
			list.AddRange(Rows);
			Formats = list.Select((object[] d) => Enumerable.Range(0, Columns.Count).Select(delegate(int i)
			{
				string text = d[i]?.ToString() ?? "";
				int num = columnLengths[i] - (GetTextWidth(text) - text.Length);
				return " | {" + i + "," + columnAlignment[i] + num + "}";
			}).Aggregate((string s, string a) => s + a) + " |").ToList();
		}

		public static int GetTextWidth(string value)
		{
			return value?.ToCharArray().Sum((char c) => (c <= '\u007f') ? 1 : 2) ?? 0;
		}

		public string ToMarkDownString()
		{
			return ToMarkDownString('|');
		}

		private string ToMarkDownString(char delimiter)
		{
			StringBuilder builder = new StringBuilder();
			List<int> columnLengths = ColumnLengths();
			Format(columnLengths, delimiter);
			string text = string.Format(Formats[0].TrimStart(), Columns.ToArray());
			List<string> list = Rows.Select((object[] row, int i) => string.Format(Formats[i + 1].TrimStart(), row)).ToList();
			string value = Regex.Replace(text, "[^|]", "-");
			builder.AppendLine(text);
			builder.AppendLine(value);
			list.ForEach(delegate(string row)
			{
				builder.AppendLine(row);
			});
			return builder.ToString();
		}

		public string ToMinimalString()
		{
			return ToMarkDownString('\0');
		}

		public string ToStringAlternative()
		{
			StringBuilder stringBuilder = new StringBuilder();
			string text = string.Format(Formats[0].TrimStart(), Columns.ToArray());
			List<string> list = Rows.Select((object[] row, int i) => string.Format(Formats[i + 1].TrimStart(), row)).ToList();
			string text2 = Regex.Replace(text, "[^| ]", "-");
			string value = text2.Replace("|", "+");
			stringBuilder.AppendLine(value);
			stringBuilder.AppendLine(text);
			foreach (string item in list)
			{
				stringBuilder.AppendLine(value);
				stringBuilder.AppendLine(item);
			}
			stringBuilder.AppendLine(value);
			return stringBuilder.ToString();
		}

		private string Format(List<int> columnLengths, char delimiter = '|')
		{
			List<string> columnAlignment = Enumerable.Range(0, Columns.Count).Select(GetNumberAlignment).ToList();
			SetFormats(columnLengths, columnAlignment);
			string delimiterStr = ((delimiter == '\0') ? string.Empty : delimiter.ToString());
			return ((from i in Enumerable.Range(0, Columns.Count)
				select " " + delimiterStr + " {" + i + "," + columnAlignment[i] + columnLengths[i] + "}").Aggregate((string s, string a) => s + a) + " " + delimiterStr).Trim();
		}

		private string GetNumberAlignment(int i)
		{
			return (Options.NumberAlignment == Alignment.Right && ColumnTypes != null && NumericTypes.Contains(ColumnTypes[i])) ? "" : "-";
		}

		private List<int> ColumnLengths()
		{
			return Columns.Select((object t, int i) => (from x in Rows.Select((object[] x) => x[i]).Union(new object[1] { Columns[i] })
				where x != null
				select x.ToString().ToCharArray().Sum((char c) => (c <= '\u007f') ? 1 : 2)).Max()).ToList();
		}

		public void Write(Format format = ConsoleTables.Format.Default)
		{
			SetFormats(ColumnLengths(), Enumerable.Range(0, Columns.Count).Select(GetNumberAlignment).ToList());
			switch (format)
			{
			case ConsoleTables.Format.Default:
				Options.OutputTo.WriteLine(ToString());
				break;
			case ConsoleTables.Format.MarkDown:
				Options.OutputTo.WriteLine(ToMarkDownString());
				break;
			case ConsoleTables.Format.Alternative:
				Options.OutputTo.WriteLine(ToStringAlternative());
				break;
			case ConsoleTables.Format.Minimal:
				Options.OutputTo.WriteLine(ToMinimalString());
				break;
			default:
				throw new ArgumentOutOfRangeException("format", format, null);
			}
		}

		private static IEnumerable<string> GetColumns<T>()
		{
			return (from x in typeof(T).GetProperties()
				select x.Name).ToArray();
		}

		private static object GetColumnValue<T>(object target, string column)
		{
			return typeof(T).GetProperty(column)?.GetValue(target, null);
		}

		private static IEnumerable<Type> GetColumnsType<T>()
		{
			return (from x in typeof(T).GetProperties()
				select x.PropertyType).ToArray();
		}
	}
	public class ConsoleTableOptions
	{
		public IEnumerable<string> Columns { get; set; } = new List<string>();


		public bool EnableCount { get; set; } = true;


		public Alignment NumberAlignment { get; set; } = Alignment.Left;


		public TextWriter OutputTo { get; set; } = Console.Out;

	}
	public enum Format
	{
		Default,
		MarkDown,
		Alternative,
		Minimal
	}
	public enum Alignment
	{
		Left,
		Right
	}
}
namespace WeatherTweaks
{
	public class ConfigManager
	{
		internal readonly ConfigFile configFile;

		public static ConfigManager Instance { get; private set; }

		public static ConfigEntry<bool> MapScreenPatch { get; private set; }

		public static ConfigEntry<bool> TerminalForcePatch { get; private set; }

		public static ConfigEntry<int> FirstDaySeed { get; private set; }

		public static ConfigEntry<bool> UncertainWeatherEnabled { get; private set; }

		public static ConfigEntry<bool> AlwaysUncertain { get; private set; }

		public static ConfigEntry<bool> AlwaysUnknown { get; private set; }

		public static ConfigEntry<bool> AlwaysClear { get; private set; }

		public static ConfigEntry<float> GameLengthMultiplier { get; private set; }

		public static ConfigEntry<float> GamePlayersMultiplier { get; private set; }

		public static ConfigEntry<float> MaxMultiplier { get; private set; }

		public static ConfigEntry<bool> ScaleDownClearWeather { get; private set; }

		public static ConfigEntry<int> NoneToNoneWeight { get; private set; }

		public static ConfigEntry<int> NoneToRainyWeight { get; private set; }

		public static ConfigEntry<int> NoneToStormyWeight { get; private set; }

		public static ConfigEntry<int> NoneToFloodedWeight { get; private set; }

		public static ConfigEntry<int> NoneToFoggyWeight { get; private set; }

		public static ConfigEntry<int> NoneToEclipsedWeight { get; private set; }

		public static ConfigEntry<int> RainyToNoneWeight { get; private set; }

		public static ConfigEntry<int> RainyToRainyWeight { get; private set; }

		public static ConfigEntry<int> RainyToStormyWeight { get; private set; }

		public static ConfigEntry<int> RainyToFloodedWeight { get; private set; }

		public static ConfigEntry<int> RainyToFoggyWeight { get; private set; }

		public static ConfigEntry<int> RainyToEclipsedWeight { get; private set; }

		public static ConfigEntry<int> StormyToNoneWeight { get; private set; }

		public static ConfigEntry<int> StormyToRainyWeight { get; private set; }

		public static ConfigEntry<int> StormyToStormyWeight { get; private set; }

		public static ConfigEntry<int> StormyToFloodedWeight { get; private set; }

		public static ConfigEntry<int> StormyToFoggyWeight { get; private set; }

		public static ConfigEntry<int> StormyToEclipsedWeight { get; private set; }

		public static ConfigEntry<int> FloodedToNoneWeight { get; private set; }

		public static ConfigEntry<int> FloodedToRainyWeight { get; private set; }

		public static ConfigEntry<int> FloodedToStormyWeight { get; private set; }

		public static ConfigEntry<int> FloodedToFloodedWeight { get; private set; }

		public static ConfigEntry<int> FloodedToFoggyWeight { get; private set; }

		public static ConfigEntry<int> FloodedToEclipsedWeight { get; private set; }

		public static ConfigEntry<int> FoggyToNoneWeight { get; private set; }

		public static ConfigEntry<int> FoggyToRainyWeight { get; private set; }

		public static ConfigEntry<int> FoggyToStormyWeight { get; private set; }

		public static ConfigEntry<int> FoggyToFloodedWeight { get; private set; }

		public static ConfigEntry<int> FoggyToFoggyWeight { get; private set; }

		public static ConfigEntry<int> FoggyToEclipsedWeight { get; private set; }

		public static ConfigEntry<int> EclipsedToNoneWeight { get; private set; }

		public static ConfigEntry<int> EclipsedToRainyWeight { get; private set; }

		public static ConfigEntry<int> EclipsedToStormyWeight { get; private set; }

		public static ConfigEntry<int> EclipsedToFloodedWeight { get; private set; }

		public static ConfigEntry<int> EclipsedToFoggyWeight { get; private set; }

		public static ConfigEntry<int> EclipsedToEclipsedWeight { get; private set; }

		public static int NoneWeightSum { get; private set; }

		public static int RainyWeightSum { get; private set; }

		public static int StormyWeightSum { get; private set; }

		public static int FloodedWeightSum { get; private set; }

		public static int FoggyWeightSum { get; private set; }

		public static int EclipsedWeightSum { get; private set; }

		public static Dictionary<LevelWeatherType, int> NoneWeights { get; private set; }

		public static Dictionary<LevelWeatherType, int> RainyWeights { get; private set; }

		public static Dictionary<LevelWeatherType, int> StormyWeights { get; private set; }

		public static Dictionary<LevelWeatherType, int> FloodedWeights { get; private set; }

		public static Dictionary<LevelWeatherType, int> FoggyWeights { get; private set; }

		public static Dictionary<LevelWeatherType, int> EclipsedWeights { get; private set; }

		public static Dictionary<LevelWeatherType, Dictionary<LevelWeatherType, int>> Weights { get; private set; }

		public static void Init(ConfigFile config)
		{
			Instance = new ConfigManager(config);
		}

		private ConfigManager(ConfigFile config)
		{
			configFile = config;
			MapScreenPatch = configFile.Bind<bool>("0> General", "MapScreenPatch", true, "Enable map screen patch (weather in top row)");
			TerminalForcePatch = configFile.Bind<bool>("0> General", "TerminalForcePatch", true, "Disable patching terminal weather formatting (for compatibility with vanilla game)");
			UncertainWeatherEnabled = configFile.Bind<bool>("1> Uncertain weather", "UncertainWeatherEnabled", true, "Enable uncertain weather mechanic");
			MaxMultiplier = configFile.Bind<float>("2> Multipliers", "MaxMultiplier", 0.8f, "Maximum difficulty multiplier (between 0 and 1)");
			ScaleDownClearWeather = configFile.Bind<bool>("2> Multipliers", "ScaleDownClearWeather", true, "Scale down clear weather's weight based on planet's available random weathers to match % chance ");
			GameLengthMultiplier = configFile.Bind<float>("2a> Difficulty multipliers", "GameLengthMultiplier", 0.05f, "Difficulty multiplier - game length (quotas done)");
			GamePlayersMultiplier = configFile.Bind<float>("2a> Difficulty multipliers", "GamePlayersMultiplier", 0.01f, "Difficulty multiplier - players amount");
			FirstDaySeed = configFile.Bind<int>("3> First day", "FirstDaySeed", 0, "Seed for the first day's weather");
			AlwaysUncertain = configFile.Bind<bool>("4> Special modes", "AlwaysUncertain", false, "Always make weather uncertain");
			AlwaysUnknown = configFile.Bind<bool>("4> Special modes", "AlwaysUnknown", false, "Always make weather unknown");
			AlwaysClear = configFile.Bind<bool>("4> Special modes", "AlwaysClear", false, "Always make weather clear - good for testing");
			NoneToNoneWeight = configFile.Bind<int>("Weights > Clear", "NoneToNoneWeight", 80, "Weight for changing from none to none");
			NoneToRainyWeight = configFile.Bind<int>("Weights > Clear", "NoneToRainyWeight", 50, "Weight for changing from none to rainy");
			NoneToStormyWeight = configFile.Bind<int>("Weights > Clear", "NoneToStormyWeight", 35, "Weight for changing from none to stormy");
			NoneToFloodedWeight = configFile.Bind<int>("Weights > Clear", "NoneToFloodedWeight", 10, "Weight for changing from none to flooded");
			NoneToFoggyWeight = configFile.Bind<int>("Weights > Clear", "NoneToFoggyWeight", 20, "Weight for changing from none to foggy");
			NoneToEclipsedWeight = configFile.Bind<int>("Weights > Clear", "NoneToEclipsedWeight", 5, "Weight for changing from none to eclipsed");
			RainyToNoneWeight = configFile.Bind<int>("Weights > Rainy", "RainyToNoneWeight", 50, "Weight for changing from rainy to none");
			RainyToRainyWeight = configFile.Bind<int>("Weights > Rainy", "RainyToRainyWeight", 30, "Weight for changing from rainy to rainy");
			RainyToStormyWeight = configFile.Bind<int>("Weights > Rainy", "RainyToStormyWeight", 20, "Weight for changing from rainy to stormy");
			RainyToFloodedWeight = configFile.Bind<int>("Weights > Rainy", "RainyToFloodedWeight", 15, "Weight for changing from rainy to flooded");
			RainyToFoggyWeight = configFile.Bind<int>("Weights > Rainy", "RainyToFoggyWeight", 25, "Weight for changing from rainy to foggy");
			RainyToEclipsedWeight = configFile.Bind<int>("Weights > Rainy", "RainyToEclipsedWeight", 10, "Weight for changing from rainy to eclipsed");
			StormyToNoneWeight = configFile.Bind<int>("Weights > Stormy", "StormyToNoneWeight", 80, "Weight for changing from stormy to none");
			StormyToRainyWeight = configFile.Bind<int>("Weights > Stormy", "StormyToRainyWeight", 55, "Weight for changing from stormy to rainy");
			StormyToStormyWeight = configFile.Bind<int>("Weights > Stormy", "StormyToStormyWeight", 5, "Weight for changing from stormy to stormy");
			StormyToFloodedWeight = configFile.Bind<int>("Weights > Stormy", "StormyToFloodedWeight", 60, "Weight for changing from stormy to flooded");
			StormyToFoggyWeight = configFile.Bind<int>("Weights > Stormy", "StormyToFoggyWeight", 10, "Weight for changing from stormy to foggy");
			StormyToEclipsedWeight = configFile.Bind<int>("Weights > Stormy", "StormyToEclipsedWeight", 40, "Weight for changing from stormy to eclipsed");
			FloodedToNoneWeight = configFile.Bind<int>("Weights > Flooded", "FloodedToNoneWeight", 80, "Weight for changing from flooded to none");
			FloodedToRainyWeight = configFile.Bind<int>("Weights > Flooded", "FloodedToRainyWeight", 30, "Weight for changing from flooded to rainy");
			FloodedToStormyWeight = configFile.Bind<int>("Weights > Flooded", "FloodedToStormyWeight", 25, "Weight for changing from flooded to stormy");
			FloodedToFloodedWeight = configFile.Bind<int>("Weights > Flooded", "FloodedToFloodedWeight", 5, "Weight for changing from flooded to flooded");
			FloodedToFoggyWeight = configFile.Bind<int>("Weights > Flooded", "FloodedToFoggyWeight", 30, "Weight for changing from flooded to foggy");
			FloodedToEclipsedWeight = configFile.Bind<int>("Weights > Flooded", "FloodedToEclipsedWeight", 20, "Weight for changing from flooded to eclipsed");
			FoggyToNoneWeight = configFile.Bind<int>("Weights > Foggy", "FoggyToNoneWeight", 100, "Weight for changing from foggy to none");
			FoggyToRainyWeight = configFile.Bind<int>("Weights > Foggy", "FoggyToRainyWeight", 30, "Weight for changing from foggy to rainy");
			FoggyToStormyWeight = configFile.Bind<int>("Weights > Foggy", "FoggyToStormyWeight", 25, "Weight for changing from foggy to stormy");
			FoggyToFloodedWeight = configFile.Bind<int>("Weights > Foggy", "FoggyToFloodedWeight", 5, "Weight for changing from foggy to flooded");
			FoggyToFoggyWeight = configFile.Bind<int>("Weights > Foggy", "FoggyToFoggyWeight", 15, "Weight for changing from foggy to foggy");
			FoggyToEclipsedWeight = configFile.Bind<int>("Weights > Foggy", "FoggyToEclipsedWeight", 10, "Weight for changing from foggy to eclipsed");
			EclipsedToNoneWeight = configFile.Bind<int>("Weights > Eclipsed", "EclipsedToNoneWeight", 150, "Weight for changing from eclipsed to none");
			EclipsedToRainyWeight = configFile.Bind<int>("Weights > Eclipsed", "EclipsedToRainyWeight", 20, "Weight for changing from eclipsed to rainy");
			EclipsedToStormyWeight = configFile.Bind<int>("Weights > Eclipsed", "EclipsedToStormyWeight", 8, "Weight for changing from eclipsed to stormy");
			EclipsedToFloodedWeight = configFile.Bind<int>("Weights > Eclipsed", "EclipsedToFloodedWeight", 10, "Weight for changing from eclipsed to flooded");
			EclipsedToFoggyWeight = configFile.Bind<int>("Weights > Eclipsed", "EclipsedToFoggyWeight", 30, "Weight for changing from eclipsed to foggy");
			EclipsedToEclipsedWeight = configFile.Bind<int>("Weights > Eclipsed", "EclipsedToEclipsedWeight", 5, "Weight for changing from eclipsed to eclipsed");
			NoneWeightSum = NoneToNoneWeight.Value + NoneToRainyWeight.Value + NoneToStormyWeight.Value + NoneToFloodedWeight.Value + NoneToFoggyWeight.Value + NoneToEclipsedWeight.Value;
			RainyWeightSum = RainyToNoneWeight.Value + RainyToRainyWeight.Value + RainyToStormyWeight.Value + RainyToFloodedWeight.Value + RainyToFoggyWeight.Value + RainyToEclipsedWeight.Value;
			StormyWeightSum = StormyToNoneWeight.Value + StormyToRainyWeight.Value + StormyToStormyWeight.Value + StormyToFloodedWeight.Value + StormyToFoggyWeight.Value + StormyToEclipsedWeight.Value;
			FloodedWeightSum = FloodedToNoneWeight.Value + FloodedToRainyWeight.Value + FloodedToStormyWeight.Value + FloodedToFloodedWeight.Value + FloodedToFoggyWeight.Value + FloodedToEclipsedWeight.Value;
			FoggyWeightSum = FoggyToNoneWeight.Value + FoggyToRainyWeight.Value + FoggyToStormyWeight.Value + FoggyToFloodedWeight.Value + FoggyToFoggyWeight.Value + FoggyToEclipsedWeight.Value;
			EclipsedWeightSum = EclipsedToNoneWeight.Value + EclipsedToRainyWeight.Value + EclipsedToStormyWeight.Value + EclipsedToFloodedWeight.Value + EclipsedToFoggyWeight.Value + EclipsedToEclipsedWeight.Value;
			NoneWeights = new Dictionary<LevelWeatherType, int>
			{
				{
					(LevelWeatherType)(-1),
					NoneToNoneWeight.Value
				},
				{
					(LevelWeatherType)1,
					NoneToRainyWeight.Value
				},
				{
					(LevelWeatherType)2,
					NoneToStormyWeight.Value
				},
				{
					(LevelWeatherType)4,
					NoneToFloodedWeight.Value
				},
				{
					(LevelWeatherType)3,
					NoneToFoggyWeight.Value
				},
				{
					(LevelWeatherType)5,
					NoneToEclipsedWeight.Value
				}
			};
			RainyWeights = new Dictionary<LevelWeatherType, int>
			{
				{
					(LevelWeatherType)(-1),
					RainyToNoneWeight.Value
				},
				{
					(LevelWeatherType)1,
					RainyToRainyWeight.Value
				},
				{
					(LevelWeatherType)2,
					RainyToStormyWeight.Value
				},
				{
					(LevelWeatherType)4,
					RainyToFloodedWeight.Value
				},
				{
					(LevelWeatherType)3,
					RainyToFoggyWeight.Value
				},
				{
					(LevelWeatherType)5,
					RainyToEclipsedWeight.Value
				}
			};
			StormyWeights = new Dictionary<LevelWeatherType, int>
			{
				{
					(LevelWeatherType)(-1),
					StormyToNoneWeight.Value
				},
				{
					(LevelWeatherType)1,
					StormyToRainyWeight.Value
				},
				{
					(LevelWeatherType)2,
					StormyToStormyWeight.Value
				},
				{
					(LevelWeatherType)4,
					StormyToFloodedWeight.Value
				},
				{
					(LevelWeatherType)3,
					StormyToFoggyWeight.Value
				},
				{
					(LevelWeatherType)5,
					StormyToEclipsedWeight.Value
				}
			};
			FloodedWeights = new Dictionary<LevelWeatherType, int>
			{
				{
					(LevelWeatherType)(-1),
					FloodedToNoneWeight.Value
				},
				{
					(LevelWeatherType)1,
					FloodedToRainyWeight.Value
				},
				{
					(LevelWeatherType)2,
					FloodedToStormyWeight.Value
				},
				{
					(LevelWeatherType)4,
					FloodedToFloodedWeight.Value
				},
				{
					(LevelWeatherType)3,
					FloodedToFoggyWeight.Value
				},
				{
					(LevelWeatherType)5,
					FloodedToEclipsedWeight.Value
				}
			};
			FoggyWeights = new Dictionary<LevelWeatherType, int>
			{
				{
					(LevelWeatherType)(-1),
					FoggyToNoneWeight.Value
				},
				{
					(LevelWeatherType)1,
					FoggyToRainyWeight.Value
				},
				{
					(LevelWeatherType)2,
					FoggyToStormyWeight.Value
				},
				{
					(LevelWeatherType)4,
					FoggyToFloodedWeight.Value
				},
				{
					(LevelWeatherType)3,
					FoggyToFoggyWeight.Value
				},
				{
					(LevelWeatherType)5,
					FoggyToEclipsedWeight.Value
				}
			};
			EclipsedWeights = new Dictionary<LevelWeatherType, int>
			{
				{
					(LevelWeatherType)(-1),
					EclipsedToNoneWeight.Value
				},
				{
					(LevelWeatherType)1,
					EclipsedToRainyWeight.Value
				},
				{
					(LevelWeatherType)2,
					EclipsedToStormyWeight.Value
				},
				{
					(LevelWeatherType)4,
					EclipsedToFloodedWeight.Value
				},
				{
					(LevelWeatherType)3,
					EclipsedToFoggyWeight.Value
				},
				{
					(LevelWeatherType)5,
					EclipsedToEclipsedWeight.Value
				}
			};
			Weights = new Dictionary<LevelWeatherType, Dictionary<LevelWeatherType, int>>
			{
				{
					(LevelWeatherType)(-1),
					NoneWeights
				},
				{
					(LevelWeatherType)1,
					RainyWeights
				},
				{
					(LevelWeatherType)2,
					StormyWeights
				},
				{
					(LevelWeatherType)4,
					FloodedWeights
				},
				{
					(LevelWeatherType)3,
					FoggyWeights
				},
				{
					(LevelWeatherType)5,
					EclipsedWeights
				}
			};
		}
	}
	public static class DisplayTable
	{
		public static void DisplayWeathersTable()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			ConsoleTable consoleTable = new ConsoleTable("Planet", "Weather");
			List<SelectableLevel> gameLevels = Variables.GetGameLevels();
			foreach (SelectableLevel item in gameLevels)
			{
				consoleTable.AddRow(item.PlanetName, item.currentWeather);
			}
			Plugin.logger.LogInfo((object)("Currently set weathers: \n" + consoleTable.ToMinimalString()));
		}
	}
	internal class GameInteraction
	{
		internal static void SetWeather(Dictionary<string, LevelWeatherType> weatherData)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			List<SelectableLevel> gameLevels = Variables.GetGameLevels();
			foreach (SelectableLevel item in gameLevels)
			{
				string planetName = item.PlanetName;
				if (weatherData.ContainsKey(planetName))
				{
					item.currentWeather = weatherData[planetName];
				}
				else
				{
					Plugin.logger.LogWarning((object)("Weather data for " + planetName + " somehow not found, skipping"));
				}
			}
			StartOfRound.Instance.SetMapScreenInfoToCurrentLevel();
		}
	}
	internal class NetworkedConfig
	{
		public static LethalNetworkVariable<string> currentWeatherSynced = new LethalNetworkVariable<string>("previousWeather");

		public static LethalNetworkVariable<string> currentWeatherStringsSynced = new LethalNetworkVariable<string>("previousWeatherStrings");

		public static void Init()
		{
			currentWeatherSynced.OnValueChanged += WeatherDataReceived;
			currentWeatherStringsSynced.OnValueChanged += WeatherDisplayDataReceived;
		}

		public static void WeatherDataReceived(string weatherData)
		{
			Dictionary<string, LevelWeatherType> dictionary = JsonConvert.DeserializeObject<Dictionary<string, LevelWeatherType>>(weatherData);
			if (dictionary != null && !((NetworkBehaviour)StartOfRound.Instance).IsHost)
			{
				Plugin.logger.LogInfo((object)"Received weather data from server, applying");
				Plugin.logger.LogDebug((object)("Received data: " + weatherData));
				GameInteraction.SetWeather(dictionary);
				DisplayTable.DisplayWeathersTable();
				StartOfRound.Instance.SetMapScreenInfoToCurrentLevel();
			}
		}

		public static void WeatherDisplayDataReceived(string weatherData)
		{
			Dictionary<string, string> dictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(weatherData);
			if (dictionary != null && !((NetworkBehaviour)StartOfRound.Instance).IsHost)
			{
				Plugin.logger.LogInfo((object)"Received weather display data from server, applying");
				Plugin.logger.LogDebug((object)("Received data: " + weatherData));
				UncertainWeather.uncertainWeathers = dictionary;
				StartOfRound.Instance.SetMapScreenInfoToCurrentLevel();
			}
		}

		public static void SetWeather(Dictionary<string, LevelWeatherType> previousWeather)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			string text = JsonConvert.SerializeObject((object)previousWeather, (Formatting)0, new JsonSerializerSettings
			{
				ReferenceLoopHandling = (ReferenceLoopHandling)1
			});
			currentWeatherSynced.Value = text;
			Plugin.logger.LogInfo((object)("Set weather data on server: " + text));
		}

		public static void SetDisplayWeather(Dictionary<string, string> uncertainWeathers)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			string text = JsonConvert.SerializeObject((object)uncertainWeathers, (Formatting)0, new JsonSerializerSettings
			{
				ReferenceLoopHandling = (ReferenceLoopHandling)1
			});
			currentWeatherStringsSynced.Value = text;
			Plugin.logger.LogInfo((object)("Set weather display data on server: " + text));
		}
	}
	public class GeneralImprovementsWeather
	{
		private static Type type;

		private static FieldInfo weatherMonitorsField;

		private static FieldInfo fancyMonitorsField;

		private static int frame = 0;

		internal static ManualLogSource logger = Logger.CreateLogSource("WeatherTweaks GI");

		public static void Init()
		{
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Expected O, but got Unknown
			string key = "ShaosilGaming.GeneralImprovements";
			Dictionary<string, PluginInfo> pluginInfos = Chainloader.PluginInfos;
			if (pluginInfos.ContainsKey(key))
			{
				string text = "GeneralImprovements.Utilities";
				string text2 = "MonitorsHelper";
				Assembly assembly = ((object)Chainloader.PluginInfos[key].Instance).GetType().Assembly;
				type = assembly.GetType(text + "." + text2);
				if (type != null)
				{
					Plugin.logger.LogWarning((object)"GeneralImprovements found, patching weather displays");
					MethodInfo method = type.GetMethod("UpdateGenericTextList", BindingFlags.Static | BindingFlags.NonPublic);
					weatherMonitorsField = type.GetField("_weatherMonitorTexts", BindingFlags.Static | BindingFlags.NonPublic);
					fancyMonitorsField = type.GetField("_fancyWeatherMonitorTexts", BindingFlags.Static | BindingFlags.NonPublic);
					Harmony val = new Harmony("Weathertweaks.GIPatch");
					HarmonyMethod val2 = new HarmonyMethod(typeof(GeneralImprovementsWeather).GetMethod("TextPatch", BindingFlags.Static | BindingFlags.Public));
					val.Patch((MethodBase)method, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
		}

		public static void TextPatch(List<TextMeshProUGUI> textList, ref string text)
		{
			bool isWeatherMonitor = false;
			List<TextMeshProUGUI> weathermonitors = weatherMonitorsField.GetValue(null) as List<TextMeshProUGUI>;
			List<TextMeshProUGUI> fancymonitors = fancyMonitorsField.GetValue(null) as List<TextMeshProUGUI>;
			CollectionExtensions.Do<TextMeshProUGUI>((IEnumerable<TextMeshProUGUI>)textList, (Action<TextMeshProUGUI>)delegate(TextMeshProUGUI monitor)
			{
				if (!((Object)(object)monitor == (Object)null) && (weathermonitors.Contains(monitor) || fancymonitors.Contains(monitor)))
				{
					isWeatherMonitor = true;
				}
			});
			if (!isWeatherMonitor)
			{
				return;
			}
			string planetCurrentWeather = Variables.GetPlanetCurrentWeather(StartOfRound.Instance.currentLevel);
			bool flag = ((object)(LevelWeatherType)(ref StartOfRound.Instance.currentLevel.currentWeather)).ToString() != planetCurrentWeather;
			if (text.Contains("WEATHER:\n"))
			{
				string text2 = "WEATHER:\n" + planetCurrentWeather;
				logger.LogDebug((object)("Changing " + text.Replace("\n", " ") + " to " + text2.Replace("\n", " ")));
				text = text2;
			}
			else if (flag)
			{
				text = "???????????????????????????????????";
				text = Regex.Replace(text, "[?]", (Match m) => (frame++ % 20 == 0) ? " " : m.Value);
				text = Regex.Replace(text, ".{8}", "$0\n");
				text = Regex.Replace(text, "(?<=\\n.*\\n.*\\n.*\\n).+", "");
				frame++;
				if (frame == 20)
				{
					frame = 0;
				}
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public static class SetPlanetsWeatherPatch
	{
		[HarmonyPatch("SetPlanetsWeather")]
		[HarmonyPrefix]
		private static bool GameMethodPatch(int connectedPlayersOnServer, StartOfRound __instance)
		{
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			Plugin.logger.LogMessage((object)"SetPlanetsWeather called.");
			if ((Object)(object)__instance == (Object)null)
			{
				Plugin.logger.LogWarning((object)"Instance is null");
				return true;
			}
			List<SelectableLevel> gameLevels = Variables.GetGameLevels();
			if (gameLevels == null)
			{
				Plugin.logger.LogWarning((object)"Levels are null");
				return true;
			}
			bool hasValue = GameNetworkManager.Instance.currentLobby.HasValue;
			Lobby valueOrDefault;
			if (((NetworkBehaviour)__instance).IsHost)
			{
				Dictionary<string, LevelWeatherType> weather = WeatherCalculation.NewWeathers(__instance);
				GameInteraction.SetWeather(weather);
				NetworkedConfig.SetWeather(weather);
				Dictionary<string, string> displayWeather = UncertainWeather.GenerateUncertainty();
				NetworkedConfig.SetDisplayWeather(displayWeather);
				__instance.SetMapScreenInfoToCurrentLevel();
				if (hasValue)
				{
					Lobby? currentLobby = GameNetworkManager.Instance.currentLobby;
					if (currentLobby.HasValue)
					{
						valueOrDefault = currentLobby.GetValueOrDefault();
						((Lobby)(ref valueOrDefault)).SetData("WeatherTweaks", "true");
					}
				}
			}
			else
			{
				Plugin.logger.LogMessage((object)"Not a host");
				if (hasValue)
				{
					Lobby? currentLobby = GameNetworkManager.Instance.currentLobby;
					object obj;
					if (!currentLobby.HasValue)
					{
						obj = null;
					}
					else
					{
						valueOrDefault = currentLobby.GetValueOrDefault();
						obj = ((Lobby)(ref valueOrDefault)).GetData("WeatherTweaks");
					}
					if (obj == null)
					{
						Plugin.logger.LogMessage((object)"Mod not detected on host, falling back to vanilla");
						return true;
					}
					Plugin.logger.LogMessage((object)"Detected mod on host, waiting for weather data");
				}
				Plugin.logger.LogDebug((object)("Current data: " + NetworkedConfig.currentWeatherSynced.Value));
			}
			return false;
		}

		[HarmonyPatch("SetPlanetsWeather")]
		[HarmonyPostfix]
		private static void DisplayCurrentWeathers()
		{
			DisplayTable.DisplayWeathersTable();
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	public static class TextPostProcessPatch
	{
		internal static ManualLogSource logger = Logger.CreateLogSource("WeatherTweaks Terminal");

		[HarmonyPatch("TextPostProcess")]
		[HarmonyPrefix]
		[HarmonyPriority(700)]
		private static bool PatchGameMethod(ref string modifiedDisplayText, TerminalNode node)
		{
			if (ConfigManager.TerminalForcePatch.Value)
			{
				logger.LogInfo((object)"Removing terminal weather formatting");
				if (node.buyRerouteToMoon == -2)
				{
					logger.LogDebug((object)"buyRerouteToMoon == -2");
					Regex regex = new Regex("\\ It is (\\n)*currently.+\\[currentPlanetTime].+");
					if (regex.IsMatch(modifiedDisplayText))
					{
						modifiedDisplayText = regex.Replace(modifiedDisplayText, "");
					}
				}
				if (((Object)node).name == "MoonsCatalogue")
				{
					Regex regex2 = new Regex("\\[planetTime\\]");
					modifiedDisplayText = regex2.Replace(modifiedDisplayText, "");
				}
			}
			return true;
		}
	}
	[BepInPlugin("WeatherTweaks", "WeatherTweaks", "0.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource logger;

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			logger = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("WeatherTweaks");
			val.PatchAll();
			NetworkedConfig.Init();
			ConfigManager.Init(((BaseUnityPlugin)this).Config);
			UncertainWeather.Init();
			GeneralImprovementsWeather.Init();
			if (Chainloader.PluginInfos.ContainsKey("imabatby.lethallevelloader"))
			{
				LLL.Init();
			}
			if (Chainloader.PluginInfos.ContainsKey("com.zealsprince.malfunctions"))
			{
				Malfunctions.Init();
			}
			if (Chainloader.PluginInfos.ContainsKey("xxxstoner420bongmasterxxx.open_monitors"))
			{
				OpenMonitorsPatch.Init();
			}
			logger.LogInfo((object)"\r\n                  .::.                  \r\n                  :==:                  \r\n         :-.      :==:      .-:         \r\n        .-==-.    .::.    .-===.        \r\n          .-=-  .:----:.  -==.          \r\n              -==========-              \r\n             ==============             \r\n               .-==========- :-----     \r\n         :-==-:. .=========- :-----     \r\n       .========:   .-=====             \r\n       ============-. :==-              \r\n       -=============. .  -==.          \r\n        :-==========:     .-==-.        \r\n            ......          .-:         ");
			Settings.SelectWeathers = false;
			Settings.ScreenMapColors.Add("+", Color.white);
			Settings.ScreenMapColors.Add("/", Color.white);
			Settings.ScreenMapColors.Add("?", Color.white);
			Settings.ScreenMapColors.Add("[UNKNOWN]", new Color(0.29f, 0.29f, 0.29f));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin WeatherTweaks is loaded!");
		}
	}
	internal class UncertainTypes
	{
		public class Uncertain : Types.UncertainWeatherType
		{
			public Uncertain()
				: base("Uncertain")
			{
			}

			public override string CreateUncertaintyString(SelectableLevel level, Random random)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				LevelWeatherType weather = level.currentWeather;
				List<RandomWeatherWithVariables> list = level.randomWeathers.Where((RandomWeatherWithVariables w) => w.weatherType != weather).ToList();
				if (list.Count == 0)
				{
					return ((object)(LevelWeatherType)(ref weather)).ToString();
				}
				RandomWeatherWithVariables val = list[random.Next(list.Count)];
				if (random.Next(0, 3) == 0)
				{
					return $"{val.weatherType}?";
				}
				return $"{weather}?";
			}
		}

		public class Uncertain5050 : Types.UncertainWeatherType
		{
			public Uncertain5050()
				: base("Uncertain5050")
			{
			}

			public override string CreateUncertaintyString(SelectableLevel level, Random random)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				LevelWeatherType weather = level.currentWeather;
				List<RandomWeatherWithVariables> list = level.randomWeathers.Where((RandomWeatherWithVariables w) => w.weatherType != weather).ToList();
				if (list.Count == 0)
				{
					return ((object)(LevelWeatherType)(ref weather)).ToString();
				}
				RandomWeatherWithVariables val = list[random.Next(list.Count)];
				if (random.Next(0, 2) == 0)
				{
					return $"{weather}/{val.weatherType}";
				}
				return $"{val.weatherType}/{weather}";
			}
		}

		public class Unknown : Types.UncertainWeatherType
		{
			public Unknown()
				: base("Unknown")
			{
			}

			public override string CreateUncertaintyString(SelectableLevel level, Random random)
			{
				return "[UNKNOWN]";
			}
		}
	}
	internal class UncertainWeather
	{
		public static Dictionary<string, string> uncertainWeathers = new Dictionary<string, string>();

		public static List<Types.UncertainWeatherType> uncertainWeatherTypes = new List<Types.UncertainWeatherType>();

		public static void Init()
		{
			Plugin.logger.LogInfo((object)"UncertainWeather initialized.");
			uncertainWeatherTypes = new List<Types.UncertainWeatherType>(3)
			{
				new UncertainTypes.Uncertain(),
				new UncertainTypes.Uncertain5050(),
				new UncertainTypes.Unknown()
			};
		}

		public static Dictionary<string, string> GenerateUncertainty()
		{
			uncertainWeathers.Clear();
			if (!ConfigManager.UncertainWeatherEnabled.Value || !ConfigManager.MapScreenPatch.Value || !ConfigManager.TerminalForcePatch.Value)
			{
				Plugin.logger.LogInfo((object)"Uncertain weathers are disabled.");
				return uncertainWeathers;
			}
			if (StartOfRound.Instance.gameStats.daysSpent == 0 && !ConfigManager.AlwaysUncertain.Value && !ConfigManager.AlwaysUnknown.Value)
			{
				Plugin.logger.LogInfo((object)"It's the first day, no uncertainty will be generated.");
				return uncertainWeathers;
			}
			Plugin.logger.LogInfo((object)"GenerateUncertainty called.");
			StartOfRound instance = StartOfRound.Instance;
			Random random = new Random(instance.randomMapSeed + 31);
			int num = Mathf.Clamp((int)((double)Mathf.Clamp(instance.planetsWeatherRandomCurve.Evaluate((float)random.NextDouble()) * 0.4f, 0f, 1f) * (double)Variables.GameLevels.Count), 1, Variables.GameLevels.Count - 2);
			if (ConfigManager.AlwaysUncertain.Value || ConfigManager.AlwaysUnknown.Value)
			{
				num = Variables.GameLevels.Count;
			}
			Plugin.logger.LogDebug((object)$"howManyPlanetsUncertain: {num}");
			List<SelectableLevel> list = new List<SelectableLevel>();
			for (int i = 0; i < num; i++)
			{
				SelectableLevel item = Variables.GameLevels[random.Next(Variables.GameLevels.Count)];
				if (!list.Contains(item))
				{
					list.Add(item);
				}
				else
				{
					i--;
				}
			}
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			List<Types.UncertainWeatherType> list2 = new List<Types.UncertainWeatherType>();
			foreach (Types.UncertainWeatherType uncertainWeatherType in uncertainWeatherTypes)
			{
				if (uncertainWeatherType.Enabled.Value)
				{
					list2.Add(uncertainWeatherType);
				}
			}
			if (ConfigManager.AlwaysUnknown.Value)
			{
				Plugin.logger.LogDebug((object)"Setting possible types to only unknown.");
				list2 = new List<Types.UncertainWeatherType>(1)
				{
					new UncertainTypes.Unknown()
				};
			}
			Plugin.logger.LogDebug((object)$"uncertainTypes: {list2.Count}");
			if (list2.Count == 0)
			{
				Plugin.logger.LogInfo((object)"No uncertain types are enabled, skipping uncertainty generation.");
				return uncertainWeathers;
			}
			foreach (SelectableLevel item2 in list)
			{
				int index = random.Next(list2.Count);
				string text = list2[index].CreateUncertaintyString(item2, random);
				Plugin.logger.LogDebug((object)("Rolled type: " + list2[index].Name + ", setting its uncertainty to " + text + "."));
				dictionary.Add(item2.PlanetName, text);
			}
			uncertainWeathers = dictionary;
			return dictionary;
		}
	}
	internal class Variables
	{
		public static List<SelectableLevel> GameLevels = new List<SelectableLevel>();

		public static Dictionary<string, SelectableLevel> PlanetNames = new Dictionary<string, SelectableLevel>();

		public static Dictionary<SelectableLevel, string> CurrentWeathers = new Dictionary<SelectableLevel, string>();

		internal static Dictionary<int, LevelWeatherType> GetWeatherData(string weatherData)
		{
			return JsonConvert.DeserializeObject<Dictionary<int, LevelWeatherType>>(weatherData);
		}

		internal static List<SelectableLevel> GetGameLevels()
		{
			GameLevels = SharedMethods.GetGameLevels();
			return GameLevels;
		}

		internal static List<LevelWeatherType> GetPlanetPossibleWeathers(SelectableLevel level)
		{
			return (from x in level.randomWeathers.Where((RandomWeatherWithVariables randomWeather) => (int)randomWeather.weatherType != -1 && (int)randomWeather.weatherType > 0).ToList()
				select x.weatherType).Append((LevelWeatherType)(-1)).ToList();
		}

		internal static string GetPlanetCurrentWeather(SelectableLevel level, bool uncertain = true)
		{
			if (UncertainWeather.uncertainWeathers.ContainsKey(level.PlanetName))
			{
				return UncertainWeather.uncertainWeathers[level.PlanetName];
			}
			return ((object)(LevelWeatherType)(ref level.currentWeather)).ToString();
		}

		internal static List<LevelWeatherType> GetPlanetWeightedList(SelectableLevel level, Dictionary<LevelWeatherType, int> weights, float difficulty = 0f)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Invalid comparison between Unknown and I4
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Invalid comparison between Unknown and I4
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			List<LevelWeatherType> list = new List<LevelWeatherType>();
			difficulty = Math.Clamp(difficulty, 0f, ConfigManager.MaxMultiplier.Value);
			foreach (LevelWeatherType planetPossibleWeather in WeatherManager.GetPlanetPossibleWeathers(level))
			{
				LevelWeatherType val = planetPossibleWeather;
				int value;
				int num = (weights.TryGetValue(val, out value) ? value : 25);
				if (ConfigManager.ScaleDownClearWeather.Value && (int)val == -1)
				{
					int num2 = weights[(LevelWeatherType)(-1)];
					int num3 = weights.Sum((KeyValuePair<LevelWeatherType, int> x) => x.Value);
					int possibleWeathersWeightSum = 0;
					(from randomWeather in level.randomWeathers.ToList()
						where (int)randomWeather.weatherType > 0
						select randomWeather).ToList().ForEach(delegate(RandomWeatherWithVariables randomWeather)
					{
						//IL_0014: Unknown result type (might be due to invalid IL or missing references)
						possibleWeathersWeightSum += (weights.TryGetValue(randomWeather.weatherType, out var value3) ? value3 : 25);
					});
					double value2 = num2 * Math.Max(possibleWeathersWeightSum, 1) / num3;
					num = Convert.ToInt32(value2);
					Plugin.logger.LogDebug((object)$"Scaling down clear weather weight from {num2} to {num} : ({num2} * {Math.Max(possibleWeathersWeightSum, 1)} / {num3}) == {num}");
				}
				if (difficulty != 0f && (int)val == -1)
				{
					num = (int)((float)num * (1f - difficulty));
				}
				Plugin.logger.LogDebug((object)$"{val} has weight {num}");
				for (int i = 0; i < num; i++)
				{
					list.Add(val);
				}
			}
			return list;
		}
	}
	internal class WeatherCalculation
	{
		internal static Dictionary<string, LevelWeatherType> previousDayWeather = new Dictionary<string, LevelWeatherType>();

		internal static Dictionary<string, LevelWeatherType> NewWeathers(StartOfRound startOfRound)
		{
			//IL_066a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Invalid comparison between Unknown and I4
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0540: Unknown result type (might be due to invalid IL or missing references)
			//IL_0509: Unknown result type (might be due to invalid IL or missing references)
			//IL_056c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_0578: Unknown result type (might be due to invalid IL or missing references)
			//IL_057e: Invalid comparison between Unknown and I4
			//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			Plugin.logger.LogMessage((object)"SetWeathers called.");
			if (!((NetworkBehaviour)StartOfRound.Instance).IsHost)
			{
				Plugin.logger.LogMessage((object)"Not a host, cannot generate weather!");
				return null;
			}
			previousDayWeather.Clear();
			int seed = startOfRound.randomMapSeed + 31;
			Random random = new Random(seed);
			Dictionary<string, LevelWeatherType> dictionary = VanillaWeathers(0, startOfRound);
			Dictionary<string, LevelWeatherType> dictionary2 = new Dictionary<string, LevelWeatherType>();
			List<LevelWeatherType> list = new List<LevelWeatherType>(7)
			{
				(LevelWeatherType)(-1),
				(LevelWeatherType)0,
				(LevelWeatherType)1,
				(LevelWeatherType)2,
				(LevelWeatherType)3,
				(LevelWeatherType)4,
				(LevelWeatherType)5
			};
			List<SelectableLevel> gameLevels = Variables.GetGameLevels();
			int daysSpent = startOfRound.gameStats.daysSpent;
			int timesFulfilledQuota = TimeOfDay.Instance.timesFulfilledQuota;
			int num = daysSpent % 3;
			if (daysSpent == 0)
			{
				seed = ConfigManager.FirstDaySeed.Value;
				random = new Random(seed);
				List<string> noWeatherOnStartPlanets = new List<string>(2) { "41 Experimentation", "56 Vow" };
				List<SelectableLevel> list2 = gameLevels.Where((SelectableLevel level) => !noWeatherOnStartPlanets.Contains(level.PlanetName)).ToList();
				if (gameLevels.Count > 9)
				{
					int num2 = (int)((double)gameLevels.Count * 0.5);
					Plugin.logger.LogDebug((object)$"Planets without weather: {num2 + 2}");
					for (int i = 0; i < num2; i++)
					{
						string planetName = list2[random.Next(0, list2.Count)].PlanetName;
						noWeatherOnStartPlanets.Add(planetName);
						list2.RemoveAll((SelectableLevel level) => level.PlanetName == planetName);
					}
				}
				return FirstDayWeathers(gameLevels, noWeatherOnStartPlanets, random);
			}
			float num3 = (float)timesFulfilledQuota * ConfigManager.GameLengthMultiplier.Value;
			float num4 = (float)StartOfRound.Instance.livingPlayers * ConfigManager.GamePlayersMultiplier.Value;
			float num5 = num3 + num4;
			Plugin.logger.LogDebug((object)$"Difficulty multiplier: {num5}");
			foreach (SelectableLevel item in gameLevels)
			{
				previousDayWeather[item.PlanetName] = item.currentWeather;
				LevelWeatherType val = (LevelWeatherType)((!dictionary.ContainsKey(item.PlanetName)) ? (-1) : ((int)dictionary[item.PlanetName]));
				if (ConfigManager.AlwaysClear.Value)
				{
					Plugin.logger.LogDebug((object)"AlwaysClear is true, setting weather to None");
					dictionary2[item.PlanetName] = (LevelWeatherType)(-1);
					continue;
				}
				Plugin.logger.LogDebug((object)"-------------");
				Plugin.logger.LogDebug((object)(item.PlanetName ?? ""));
				Plugin.logger.LogDebug((object)$"previousDayWeather: {previousDayWeather[item.PlanetName]}");
				if ((int)previousDayWeather[item.PlanetName] == 0)
				{
					previousDayWeather[item.PlanetName] = (LevelWeatherType)(-1);
				}
				dictionary2[item.PlanetName] = (LevelWeatherType)(-1);
				List<RandomWeatherWithVariables> list3 = item.randomWeathers.Where((RandomWeatherWithVariables randomWeather) => (int)randomWeather.weatherType != -1 && (int)randomWeather.weatherType > 0).ToList();
				bool flag = item.randomWeathers.Any((RandomWeatherWithVariables randomWeather) => (int)randomWeather.weatherType == 0);
				string text = JsonConvert.SerializeObject((object)list3.Select((RandomWeatherWithVariables x) => ((object)(LevelWeatherType)(ref x.weatherType)).ToString()).ToList());
				Plugin.logger.LogDebug((object)("possibleWeathers: " + text));
				if (list3.Count == 0)
				{
					Plugin.logger.LogDebug((object)"No possible weathers, setting to None");
					dictionary2[item.PlanetName] = (LevelWeatherType)(-1);
					continue;
				}
				if (item.overrideWeather)
				{
					Plugin.logger.LogDebug((object)$"Override weather present, changing weather to {item.overrideWeatherType}");
					dictionary2[item.PlanetName] = item.overrideWeatherType;
					continue;
				}
				List<LevelWeatherType> list4 = (from x in list3.ToList()
					select x.weatherType).Append((LevelWeatherType)(-1)).ToList();
				Dictionary<LevelWeatherType, int> dictionary3 = new Dictionary<LevelWeatherType, int>();
				if (!list.Contains(previousDayWeather[item.PlanetName]))
				{
					Plugin.logger.LogDebug((object)$"Previous weather was {previousDayWeather[item.PlanetName]}, which is not vanilla - using predefined weights");
					dictionary3 = ConfigManager.Weights[(LevelWeatherType)1];
				}
				else
				{
					dictionary3 = ConfigManager.Weights[previousDayWeather[item.PlanetName]];
				}
				List<LevelWeatherType> planetWeightedList = Variables.GetPlanetWeightedList(item, dictionary3, num5);
				LevelWeatherType weather = planetWeightedList[random.Next(0, planetWeightedList.Count)];
				if ((int)weather == -1 && flag && random.Next(0, 100) < 25)
				{
					weather = (LevelWeatherType)0;
				}
				dictionary2[item.PlanetName] = weather;
				Plugin.logger.LogDebug((object)$"Selected weather: {dictionary2[item.PlanetName]}");
				try
				{
					Plugin.logger.LogDebug((object)$"Chance for that was {planetWeightedList.Where((LevelWeatherType x) => x == weather).Count()} / {planetWeightedList.Count} ({(float)planetWeightedList.Where((LevelWeatherType x) => x == weather).Count() / (float)planetWeightedList.Count * 100f}%)");
				}
				catch
				{
				}
				dictionary2[item.PlanetName] = dictionary2[item.PlanetName];
			}
			Plugin.logger.LogDebug((object)"-------------");
			return dictionary2;
		}

		private static Dictionary<string, LevelWeatherType> FirstDayWeathers(List<SelectableLevel> levels, List<string> planetsWithoutWeather, Random random)
		{
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			Plugin.logger.LogInfo((object)"First day, setting predefined weather conditions");
			ConsoleTable consoleTable = new ConsoleTable("planet", "randomWeathers");
			Dictionary<string, LevelWeatherType> dictionary = new Dictionary<string, LevelWeatherType>();
			foreach (SelectableLevel level in levels)
			{
				string planetName = level.PlanetName;
				Plugin.logger.LogDebug((object)("planet: " + planetName));
				if (ConfigManager.AlwaysClear.Value)
				{
					Plugin.logger.LogDebug((object)"AlwaysClear is true, setting weather to None");
					dictionary[level.PlanetName] = (LevelWeatherType)(-1);
					continue;
				}
				List<RandomWeatherWithVariables> list = level.randomWeathers.Where((RandomWeatherWithVariables randomWeather) => (int)randomWeather.weatherType != -1 && (int)randomWeather.weatherType > 0).ToList();
				Plugin.logger.LogDebug((object)$"randomWeathers count: {list.Count}");
				CollectionExtensions.Do<RandomWeatherWithVariables>((IEnumerable<RandomWeatherWithVariables>)list, (Action<RandomWeatherWithVariables>)delegate(RandomWeatherWithVariables x)
				{
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					Plugin.logger.LogDebug((object)$"randomWeathers: {x.weatherType}");
				});
				string text = JsonConvert.SerializeObject((object)list.Select((RandomWeatherWithVariables x) => ((object)(LevelWeatherType)(ref x.weatherType)).ToString()).ToList());
				list.RemoveAll((RandomWeatherWithVariables x) => (int)x.weatherType == 5);
				if (list.Count == 0 || list == null)
				{
					Plugin.logger.LogDebug((object)("No random weathers for " + planetName + ", skipping"));
					continue;
				}
				if (planetsWithoutWeather.Contains(planetName))
				{
					dictionary[planetName] = (LevelWeatherType)(-1);
					Plugin.logger.LogDebug((object)("Skipping " + planetName + " (predefined)"));
					continue;
				}
				bool flag = random.Next(0, 100) < 5;
				RandomWeatherWithVariables val = list[random.Next(0, list.Count)];
				if (flag)
				{
					Plugin.logger.LogDebug((object)("Setting eclipsed for " + planetName));
					if (!list.Any((RandomWeatherWithVariables x) => (int)x.weatherType == 5))
					{
						Plugin.logger.LogDebug((object)("Eclipsed not possible for " + planetName + ", setting random weather"));
					}
					else
					{
						val = level.randomWeathers.First((RandomWeatherWithVariables x) => (int)x.weatherType == 5);
					}
				}
				Plugin.logger.LogDebug((object)$"Set weather for {planetName}: {val.weatherType}");
				dictionary[planetName] = list[random.Next(0, list.Count)].weatherType;
			}
			return dictionary;
		}

		private static Dictionary<string, LevelWeatherType> VanillaWeathers(int connectedPlayersOnServer, StartOfRound startOfRound)
		{
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<string, LevelWeatherType> dictionary = new Dictionary<string, LevelWeatherType>();
			Random random = new Random(startOfRound.randomMapSeed + 31);
			List<SelectableLevel> list = startOfRound.levels.ToList();
			float num = 1f;
			if (connectedPlayersOnServer + 1 > 1 && startOfRound.daysPlayersSurvivedInARow > 2 && startOfRound.daysPlayersSurvivedInARow % 3 == 0)
			{
				num = (float)random.Next(15, 25) / 10f;
			}
			int num2 = Mathf.Clamp((int)((double)Mathf.Clamp(startOfRound.planetsWeatherRandomCurve.Evaluate((float)random.NextDouble()) * num, 0f, 1f) * (double)startOfRound.levels.Length), 0, startOfRound.levels.Length);
			for (int i = 0; i < num2; i++)
			{
				SelectableLevel val = list[random.Next(0, list.Count)];
				if (val.randomWeathers != null && val.randomWeathers.Length != 0)
				{
					dictionary[val.PlanetName] = val.randomWeathers[random.Next(0, val.randomWeathers.Length)].weatherType;
				}
				list.Remove(val);
			}
			return dictionary;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "WeatherTweaks";

		public const string PLUGIN_NAME = "WeatherTweaks";

		public const string PLUGIN_VERSION = "0.0.1";
	}
}
namespace WeatherTweaks.Patches
{
	public static class LLL
	{
		internal static ManualLogSource logger = Logger.CreateLogSource("WeatherTweaks LLL");

		internal static void Init()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			Harmony val = new Harmony("WeatherTweaks.LLL");
			if (((CompatibilityBase)Plugin.LLL).IsModPresent)
			{
				logger.LogWarning((object)"Patching LethalLevelLoader");
				val.Patch((MethodBase)AccessTools.Method(typeof(TerminalManager), "GetWeatherConditions", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(LLL), "PatchNewLLL", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			else
			{
				logger.LogWarning((object)"Patching Old LethalLevelLoader");
				val.Patch((MethodBase)AccessTools.Method(typeof(TerminalManager), "GetWeatherConditions", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(LLL), "PatchOldLLL", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}

		private static void PatchNewLLL(ExtendedLevel extendedLevel, ref string __result)
		{
			__result = PatchLLL(extendedLevel.SelectableLevel);
		}

		private static void PatchOldLLL(SelectableLevel selectableLevel, ref string __result)
		{
			__result = PatchLLL(selectableLevel);
		}

		private static string PatchLLL(SelectableLevel selectableLevel)
		{
			string text = Variables.GetPlanetCurrentWeather(selectableLevel);
			logger.LogDebug((object)("GetMoonConditions " + selectableLevel.PlanetName + "::" + text));
			if (text == "None")
			{
				text = "";
			}
			else if (!text.Contains("[") && !text.Contains("]"))
			{
				text = "(" + text + ")";
			}
			return text;
		}
	}
	internal class Malfunctions
	{
		private static Type StartOfRoundPatches;

		private static Assembly assembly;

		private static Harmony harmony;

		internal static void Init()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			assembly = ((object)Chainloader.PluginInfos["com.zealsprince.malfunctions"].Instance).GetType().Assembly;
			StartOfRoundPatches = AccessTools.TypeByName("Malfunctions.Patches.StartOfRoundPatches");
			if (StartOfRoundPatches == null)
			{
				Plugin.logger.LogError((object)"Could not find StartOfRoundPatches class in Malfunctions assembly");
			}
			else
			{
				Plugin.logger.LogDebug((object)"Found StartOfRoundPatches class in Malfunctions assembly");
			}
			harmony = new Harmony("WeatherTweaks.Malfunctions");
			HarmonyMethod val = new HarmonyMethod(typeof(Malfunctions).GetMethod("EclipseOnEnablePatch"));
			harmony.Patch((MethodBase)AccessTools.Method(StartOfRoundPatches, "OverwriteMapScreenInfo", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		public static IEnumerable<CodeInstruction> EclipseOnEnablePatch(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			ManualLogSource logger = Plugin.logger;
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
			{
				new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Brtrue, (object)null, (string)null)
			});
			val.Repeat((Action<CodeMatcher>)delegate(CodeMatcher match)
			{
				match.RemoveInstructions(3);
			}, (Action<string>)null);
			return val.InstructionEnumeration();
		}
	}
	public class OpenMonitorsPatch
	{
		private static string guid = "xxxstoner420bongmasterxxx.open_monitors";

		public static void Init()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			Plugin.logger.LogDebug((object)"OpenMonitorsPatch Init");
			Harmony val = new Harmony("WeatherTweaks.OpenMonitors");
			val.Unpatch((MethodBase)typeof(StartOfRound).GetMethod("SetMapScreenInfoToCurrentLevel", BindingFlags.Instance | BindingFlags.Public), (HarmonyPatchType)0, guid);
			Plugin.logger.LogWarning((object)"Unpatched StartOfRound.SetMapScreenInfoToCurrentLevel");
			val.Unpatch((MethodBase)typeof(Terminal).GetMethod("TextPostProcess", BindingFlags.Instance | BindingFlags.NonPublic), (HarmonyPatchType)0, guid);
			Plugin.logger.LogWarning((object)"Unpatched Terminal.TextPostProcess");
		}
	}
	[HarmonyPatch(typeof(WeatherManager))]
	internal class WeatherRegistryPatches
	{
		[HarmonyPatch(typeof(SetMapScreenInfoToCurrentLevelPatch))]
		[HarmonyPatch("GetDisplayWeatherString")]
		[HarmonyPostfix]
		internal static void GetDisplayWeatherStringPatch(ref string __result, SelectableLevel level, Weather weather)
		{
			__result = Variables.GetPlanetCurrentWeather(level);
		}

		[HarmonyPatch(typeof(WeatherManager))]
		[HarmonyPatch("GetCurrentWeatherName")]
		[HarmonyPostfix]
		internal static void GetCurrentWeatherNamePatch(ref string __result, SelectableLevel level)
		{
			__result = Variables.GetPlanetCurrentWeather(level, uncertain: false);
		}
	}
}
namespace WeatherTweaks.Modules
{
	internal class Types
	{
		public abstract class UncertainWeatherType
		{
			public string Name;

			public ConfigEntry<bool> Enabled;

			public abstract string CreateUncertaintyString(SelectableLevel level, Random random);

			public UncertainWeatherType(string name)
			{
				Name = name;
				Plugin.logger.LogDebug((object)("Creating UncertainWeatherType: " + Name));
				Enabled = ConfigManager.Instance.configFile.Bind<bool>("1a> Uncertain mechanics", Name + " Enabled", true, "Enable " + Name + " uncertainty");
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}