Decompiled source of WesleysMoonsHQModule v1.3.0

Tomatobird.WesleysMoonsHQModule.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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 BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JLL.Components;
using JLL.Components.Filters;
using LethalLevelLoader;
using LethalLevelLoader.Tools;
using Microsoft.CodeAnalysis;
using MrovLib;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using WeatherRegistry;
using WeatherRegistry.Definitions;
using WeatherRegistry.Enums;
using WeatherRegistry.Modules;
using WesleyMoonScripts;
using WesleyMoonScripts.Components;
using WesleysInteriorTools.Features;
using WesleysMoonsHQModule.Patches;
using WesleysWeatherStuff.Stuff;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("LethalLevelLoader")]
[assembly: IgnoresAccessChecksTo("WeatherRegistry")]
[assembly: IgnoresAccessChecksTo("WesleysInteriorTools")]
[assembly: IgnoresAccessChecksTo("WesleysWeatherStuff")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Tomatobird.WesleysMoonsHQModule")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0+9905e10f498ed8a8ed9497aa1a7ddab82cd49009")]
[assembly: AssemblyProduct("WesleysMoonsHQModule")]
[assembly: AssemblyTitle("Tomatobird.WesleysMoonsHQModule")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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 WesleysMoonsHQModule
{
	internal static class OtherPluginInfos
	{
		public const string HQFIXES_GUID = "chboo1.lethalcompany.hqfixes";

		public const string WEATHERREGISTRY_GUID = "mrov.WeatherRegistry";

		public const string LLL_GUID = "imabatby.lethallevelloader";

		public const string JLL_GUID = "JacobG5.JLL";

		public const string JLL_WMS_GUID = "JacobG5.WesleyMoonScripts";

		public const string MROVLIB_GUID = "MrovLib";

		public const string FREEMOONS_GUID = "SlushyRH.LethalCompany.FreeMoons";

		public const string CULLFACTORY_GUID = "com.fumiko.CullFactory";

		public const string LETHALLIB_GUID = "evaisa.lethallib";

		public const string PATHFINDINGLIB_GUID = "Zaggy1024.PathfindingLib";

		public const string PATHFINDINGLAGFIX_GUID = "Zaggy1024.PathfindingLagFix";

		public const string STARLANCERAIFIX_GUID = "AudioKnight.StarlancerAIFix";

		public const string STREAMOVERLAYS_GUID = "com.github.zehsteam.StreamOverlays";

		public const string LOADSTONE_GUID = "com.adibtw.loadstone";

		public const string VLOG_GUID = "OreoM.VLog";

		public const string WATERASSETRESTORER_GUID = "Sniper1_1.WaterAssetRestorer";

		public const string V73DCFIX_GUID = "hlb.V73dcfix";

		public const string INTERIORTOOLS_GUID = "MagicWesley.WesleysInteriorTools";
	}
	internal class PackDefinition(WesleysMoonsHQModule.Versions version, Dictionary<string, Version> requiredMods, Dictionary<string, Version> optionalMods, string[] disallowedMods, Type[] patches)
	{
		public WesleysMoonsHQModule.Versions Version = version;

		public Dictionary<string, Version> RequiredMods = requiredMods;

		public Dictionary<string, Version> OptionalMods = optionalMods;

		public string[] DisallowedMods = disallowedMods;

		public Type[] Patches = patches;

		internal static Dictionary<string, Version> commonRequiredMods = new Dictionary<string, Version>();
	}
	[BepInPlugin("Tomatobird.WesleysMoonsHQModule", "WesleysMoonsHQModule", "1.3.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class WesleysMoonsHQModule : BaseUnityPlugin
	{
		internal enum Versions
		{
			v69 = 69,
			v72 = 72,
			v73 = 73,
			v81 = 81
		}

		internal static List<PackDefinition> packDefinitions = new List<PackDefinition>(4)
		{
			new PackDefinition(Versions.v69, new Dictionary<string, Version>
			{
				{
					"imabatby.lethallevelloader",
					new Version("1.4.11")
				},
				{
					"Zaggy1024.PathfindingLagFix",
					new Version("2.2.4")
				},
				{
					"Zaggy1024.PathfindingLib",
					new Version("2.3.2")
				},
				{
					"AudioKnight.StarlancerAIFix",
					new Version("3.9.0")
				},
				{
					"evaisa.lethallib",
					new Version("1.0.1")
				},
				{
					"com.adibtw.loadstone",
					new Version("0.1.23")
				}
			}, new Dictionary<string, Version> { 
			{
				"com.fumiko.CullFactory",
				new Version("2.0.4")
			} }, Array.Empty<string>(), new Type[3]
			{
				typeof(BalancePatches_v1),
				typeof(SoundManagerPatcher),
				typeof(LLLConfigLoaderPatcher_v1)
			}),
			new PackDefinition(Versions.v72, new Dictionary<string, Version>
			{
				{
					"imabatby.lethallevelloader",
					new Version("1.4.11")
				},
				{
					"Zaggy1024.PathfindingLagFix",
					new Version("2.2.4")
				},
				{
					"Zaggy1024.PathfindingLib",
					new Version("2.3.2")
				},
				{
					"AudioKnight.StarlancerAIFix",
					new Version("3.11.1")
				},
				{
					"evaisa.lethallib",
					new Version("1.1.1")
				},
				{
					"com.adibtw.loadstone",
					new Version("0.1.23")
				}
			}, new Dictionary<string, Version> { 
			{
				"com.fumiko.CullFactory",
				new Version("2.0.4")
			} }, Array.Empty<string>(), new Type[3]
			{
				typeof(BalancePatches_v1),
				typeof(SoundManagerPatcher),
				typeof(LLLConfigLoaderPatcher_v1)
			}),
			new PackDefinition(Versions.v73, new Dictionary<string, Version>
			{
				{
					"imabatby.lethallevelloader",
					new Version("1.6.8")
				},
				{
					"mrov.WeatherRegistry",
					new Version("0.7.5")
				},
				{
					"MrovLib",
					new Version("0.4.2")
				},
				{
					"Zaggy1024.PathfindingLagFix",
					new Version("2.2.5")
				},
				{
					"Zaggy1024.PathfindingLib",
					new Version("2.4.1")
				},
				{
					"AudioKnight.StarlancerAIFix",
					new Version("3.11.1")
				},
				{
					"evaisa.lethallib",
					new Version("1.1.1")
				},
				{
					"com.adibtw.loadstone",
					new Version("0.1.23")
				}
			}, new Dictionary<string, Version> { 
			{
				"com.fumiko.CullFactory",
				new Version("2.0.4")
			} }, Array.Empty<string>(), new Type[6]
			{
				typeof(BalancePatches_v1),
				typeof(SoundManagerPatcher),
				typeof(LLLConfigLoaderPatcher_v2),
				typeof(WesleysWeatherStuffPatcher),
				typeof(ExpandedMineshaftExtraItemsPatcher),
				typeof(WeatherRegistryConfigPatcher_v1)
			}),
			new PackDefinition(Versions.v81, new Dictionary<string, Version>
			{
				{
					"imabatby.lethallevelloader",
					new Version("1.7.13")
				},
				{
					"mrov.WeatherRegistry",
					new Version("0.8.8")
				},
				{
					"MrovLib",
					new Version("0.4.15")
				},
				{
					"Zaggy1024.PathfindingLagFix",
					new Version("2.4.2")
				},
				{
					"Zaggy1024.PathfindingLib",
					new Version("2.4.1")
				},
				{
					"AudioKnight.StarlancerAIFix",
					new Version("3.13.2")
				},
				{
					"evaisa.lethallib",
					new Version("1.2.0")
				}
			}, new Dictionary<string, Version> { 
			{
				"com.fumiko.CullFactory",
				new Version("2.0.11")
			} }, new string[3] { "com.adibtw.loadstone", "Sniper1_1.WaterAssetRestorer", "hlb.V73dcfix" }, new Type[4]
			{
				typeof(BalancePatches_v2),
				typeof(LLLConfigLoaderPatcher_v2),
				typeof(WeatherRegistryConfigPatcher_v2),
				typeof(FabricationDoorOpener)
			})
		};

		internal static List<string> scenesToSkip = new List<string>(3) { "MainMenu", "InitScene", "InitSceneLaunchOptions" };

		internal static Dictionary<string, PluginInfo> pluginInfos = new Dictionary<string, PluginInfo>();

		public static WesleysMoonsHQModule Instance { get; private set; } = null;

		internal static ManualLogSource Logger { get; private set; } = null;

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			pluginInfos = Chainloader.PluginInfos;
			Patch();
			SceneManager.sceneLoaded += OnSceneLoad;
			Logger.LogInfo((object)("Pack launched in " + (WesleyScripts.LockMoons.Value ? "High Quota" : "Single Moon High Quota") + " mode!"));
			Logger.LogInfo((object)"Tomatobird.WesleysMoonsHQModule v1.3.0 has loaded!");
		}

		internal static void Patch()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("Tomatobird.WesleysMoonsHQModule");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll(typeof(MenuManagerPatcher));
			if (Chainloader.PluginInfos.TryGetValue("imabatby.lethallevelloader", out var value))
			{
				foreach (PackDefinition packDefinition in packDefinitions)
				{
					if (value.Metadata.Version == packDefinition.requiredMods["imabatby.lethallevelloader"])
					{
						PatchType(packDefinition.patches);
						break;
					}
				}
			}
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void PatchType(Type[] typeArray)
		{
			foreach (Type type in typeArray)
			{
				PatchType(type);
			}
		}

		internal static void PatchType(Type type)
		{
			Logger.LogDebug((object)("Patching " + type.Name));
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.PatchAll(type);
			}
		}

		internal static void OnSceneLoad(Scene scene, LoadSceneMode mode)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (scenesToSkip.Contains(((Scene)(ref scene)).name))
			{
				return;
			}
			RemoveAprilFools(scene);
			if (((Scene)(ref scene)).name == "MusemaScene")
			{
				EditGiftShop(scene);
				if (!WesleyScripts.LockMoons.Value)
				{
					GameNetworkManager instance = GameNetworkManager.Instance;
					if (instance != null && instance.gameVersionNum >= 81)
					{
						EditMusemaScene(scene);
					}
				}
			}
			if (((Scene)(ref scene)).name == "Asteroid14Scene" && WesleyScripts.LockMoons.Value)
			{
				EditHyveScene(scene);
			}
			if (((Scene)(ref scene)).name == "CalistScene")
			{
				EditCalistScene(scene);
			}
			if (((Scene)(ref scene)).name == "EndScene")
			{
				EditEndScene(scene);
			}
		}

		internal static GameObject GetRootGameObject(Scene scene, string name)
		{
			return ((IEnumerable<GameObject>)((Scene)(ref scene)).GetRootGameObjects()).FirstOrDefault((Func<GameObject, bool>)((GameObject g) => ((Object)g).name == name));
		}

		internal static void EditGiftShop(Scene scene)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkManager.Singleton.IsServer)
			{
				return;
			}
			Logger.LogInfo((object)"Editing Gift Shops in Musema/Galetry scene.");
			GameObject rootGameObject = GetRootGameObject(scene, "Environment");
			ItemShop[] componentsInChildren = ((Component)rootGameObject.transform.Find("Giftshop/Itemshop")).GetComponentsInChildren<ItemShop>();
			foreach (ItemShop val in componentsInChildren)
			{
				if ((Object)(object)val == (Object)null || !(val.Catalogue[0].ItemName == "Mortar hammer"))
				{
					continue;
				}
				val.setScrapValue = false;
				if (!WesleyScripts.LockMoons.Value)
				{
					GameNetworkManager instance = GameNetworkManager.Instance;
					if (instance != null && instance.gameVersionNum >= 81)
					{
						AddCraftingItemsToGiftShop(val);
					}
				}
				break;
			}
		}

		internal static void AddCraftingItemsToGiftShop(ItemShop shop)
		{
			//IL_0007: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0058: Expected O, but got Unknown
			//IL_0059: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_00ce: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Expected O, but got Unknown
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: 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_0148: Expected O, but got Unknown
			List<WeightedItemRefrence> collection = new List<WeightedItemRefrence>(8)
			{
				new WeightedItemRefrence
				{
					Weight = 200,
					ItemName = "Large plastic stock",
					ScrapValue = 70
				},
				new WeightedItemRefrence
				{
					Weight = 160,
					ItemName = "Large steel bars",
					ScrapValue = 70
				},
				new WeightedItemRefrence
				{
					Weight = 80,
					ItemName = "Circuit board container",
					ScrapValue = 70
				},
				new WeightedItemRefrence
				{
					Weight = 160,
					ItemName = "Large wire roll",
					ScrapValue = 70
				},
				new WeightedItemRefrence
				{
					Weight = 120,
					ItemName = "Large lithium container",
					ScrapValue = 70
				},
				new WeightedItemRefrence
				{
					Weight = 160,
					ItemName = "Rubber chunk",
					ScrapValue = 70
				},
				new WeightedItemRefrence
				{
					Weight = 160,
					ItemName = "Large cable rolls",
					ScrapValue = 70
				},
				new WeightedItemRefrence
				{
					Weight = 160,
					ItemName = "Large chemical container",
					ScrapValue = 70
				}
			};
			List<WeightedItemRefrence> list = shop.Catalogue.ToList();
			list.AddRange(collection);
			shop.Catalogue = list.ToArray();
		}

		internal static void EditMusemaScene(Scene scene)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			Logger.LogInfo((object)"Editing progression objects in Musema/Galetry scene.");
			Transform transform = GetRootGameObject(scene, "Environment").transform;
			Transform[] array = (Transform[])(object)new Transform[4]
			{
				transform.Find("SideBuilding/HangingLight (6)"),
				transform.Find("SideBuilding/fireexit"),
				transform.Find("SideBuilding/CraftingMachine"),
				transform.Find("SideBuilding/FireExitInteractTrigger")
			};
			Transform[] array2 = array;
			foreach (Transform val in array2)
			{
				((Behaviour)((Component)val).GetComponent<ProggressionObject>()).enabled = false;
			}
		}

		internal static void EditCalistScene(Scene scene)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			Logger.LogInfo((object)"Editing Calist Scene.");
			Transform transform = GetRootGameObject(scene, "Environment").transform;
			Transform val = transform.Find("Lighting/BrightDay/Sun");
			Transform[] array = (Transform[])(object)new Transform[3]
			{
				((Component)val).transform.Find("SunAnimContainer/GameObject"),
				((Component)val).transform.Find("SunAnimContainer/AsteroidsPAck"),
				((Component)val).transform.Find("SunAnimContainer/Sphere")
			};
			Transform[] array2 = array;
			foreach (Transform val2 in array2)
			{
				val2.SetParent(((Component)val).transform);
			}
		}

		internal static void EditHyveScene(Scene scene)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			Logger.LogInfo((object)"Editing Hyve Scene.");
			GameObject rootGameObject = GetRootGameObject(scene, "Environment");
			WeightedEnemyRefrence item = new WeightedEnemyRefrence
			{
				rarity = 99
			};
			EnemySpawner[] componentsInChildren = rootGameObject.GetComponentsInChildren<EnemySpawner>();
			foreach (EnemySpawner val in componentsInChildren)
			{
				if (!(((Object)val).name != "Spawner"))
				{
					val.randomPool = new List<WeightedEnemyRefrence>(1) { item };
				}
			}
		}

		internal static void EditEndScene(Scene scene)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			Logger.LogInfo((object)"Editing End Scene.");
			Transform transform = GetRootGameObject(scene, "GameObject (3)").transform;
			Transform val = transform.Find("Arena");
			List<DelayScript> list = new List<DelayScript>();
			list.Add(((Component)val.Find("WallButton (1)")).GetComponent<DelayScript>());
			list.Add(((Component)val.Find("WallButton (2)")).GetComponent<DelayScript>());
			list.Add(((Component)val.Find("WallButton (3)")).GetComponent<DelayScript>());
			list.Add(((Component)val.Find("WallButton (4)")).GetComponent<DelayScript>());
			list.Add(((Component)val.Find("WallButton (5)")).GetComponent<DelayScript>());
			foreach (DelayScript item in list)
			{
				((UnityEventBase)item.events).RemoveAllListeners();
				((UnityEventBase)item.events).m_PersistentCalls.Clear();
			}
		}

		internal static void RemoveAprilFools(Scene scene)
		{
			DateFilter[] array = Object.FindObjectsOfType<DateFilter>();
			DateFilter[] array2 = array;
			foreach (DateFilter val in array2)
			{
				if (((Object)((Component)val).gameObject).name != "randomAprilEffect")
				{
					break;
				}
				Logger.LogInfo((object)"Removing randomAprilEffect...");
				Object.Destroy((Object)(object)((Component)val).gameObject);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Tomatobird.WesleysMoonsHQModule";

		public const string PLUGIN_NAME = "WesleysMoonsHQModule";

		public const string PLUGIN_VERSION = "1.3.0";
	}
}
namespace WesleysMoonsHQModule.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class BalancePatches_v1
	{
		internal static bool Patched;

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		internal static void Start_Postfix(StartOfRound __instance)
		{
			if (Patched)
			{
				return;
			}
			if (WesleyScripts.LockMoons.Value)
			{
				LungProp[] array = Resources.FindObjectsOfTypeAll<LungProp>();
				LungProp[] array2 = array;
				foreach (LungProp val in array2)
				{
					if (((Object)val).name == "CosmicLungApparatus" || ((Object)val).name == "CosmicLungApparatusDisabled")
					{
						((GrabbableObject)val).scrapValue = 214;
					}
				}
			}
			SelectableLevel[] levels = __instance.levels;
			foreach (SelectableLevel val2 in levels)
			{
				val2.DaySpeedMultiplier = Mathf.Max(val2.DaySpeedMultiplier, 1f);
				if (((Object)val2).name == "CosmocosLevel")
				{
					val2.DaySpeedMultiplier = 0.959f;
					if (WesleyScripts.LockMoons.Value)
					{
						val2.maxScrap = 55;
					}
				}
				else if (((Object)val2).name == "EmpraLevel")
				{
					val2.DaySpeedMultiplier = 0.875f;
				}
			}
			Patched = true;
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class BalancePatches_v2
	{
		internal static bool Patched;

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		internal static void Start_Postfix(StartOfRound __instance)
		{
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0453: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Expected O, but got Unknown
			if (Patched)
			{
				return;
			}
			if (WesleyScripts.LockMoons.Value)
			{
				LungProp[] array = Resources.FindObjectsOfTypeAll<LungProp>();
				LungProp[] array2 = array;
				foreach (LungProp val in array2)
				{
					if (((Object)val).name == "CosmicLungApparatus" || ((Object)val).name == "CosmicLungApparatusDisabled")
					{
						((GrabbableObject)val).scrapValue = 214;
					}
				}
				List<Item> itemsList = StartOfRound.Instance.allItemsList.itemsList;
				for (int j = 0; j < itemsList.Count; j++)
				{
					Item val2 = itemsList[j];
					switch (val2.itemName)
					{
					case "Assimilated jester skull":
					case "Assimilated maneater":
					case "Assimilated bracken arm":
					case "Assimilated spore lizard leg":
					case "Assimilated hoarding bug head":
						val2.maxValue = 220;
						val2.minValue = 160;
						break;
					case "Assimilated concrete torso":
						val2.maxValue = 360;
						val2.minValue = 300;
						break;
					case "The seed of assimilation":
						val2.maxValue = 580;
						val2.minValue = 500;
						break;
					}
				}
				TerminalKeyword[] array3 = Resources.FindObjectsOfTypeAll<TerminalKeyword>();
				for (int k = 0; k < array3.Length; k++)
				{
					if (!(((Object)array3[k]).name == "Route"))
					{
						continue;
					}
					CompatibleNoun[] compatibleNouns = array3[k].compatibleNouns;
					for (int l = 0; l < compatibleNouns.Length; l++)
					{
						switch (((Object)compatibleNouns[l].result).name)
						{
						case "XenphirRoute":
							compatibleNouns[l].result.itemCost = 2500;
							break;
						case "HyxRoute":
							compatibleNouns[l].result.itemCost = 4000;
							break;
						case "CarnateRoute":
							compatibleNouns[l].result.itemCost = 2200;
							break;
						}
					}
					break;
				}
			}
			SelectableLevel[] levels = __instance.levels;
			foreach (SelectableLevel val3 in levels)
			{
				val3.DaySpeedMultiplier = Mathf.Max(val3.DaySpeedMultiplier, 1f);
				if (((Object)val3).name == "CosmocosLevel")
				{
					val3.DaySpeedMultiplier = 0.959f;
				}
				else if (((Object)val3).name == "EmpraLevel")
				{
					val3.DaySpeedMultiplier = 0.875f;
					if (WesleyScripts.LockMoons.Value)
					{
						val3.maxEnemyPowerCount = 11;
					}
				}
				else if (((Object)val3).name == "HyxLevel")
				{
					if (WesleyScripts.LockMoons.Value)
					{
						val3.maxScrap = 54;
						val3.minScrap = 42;
						val3.maxOutsideEnemyPowerCount = 14;
						val3.maxEnemyPowerCount = 20;
						val3.spawnProbabilityRange = 3.04f;
						val3.enemySpawnChanceThroughoutDay = new AnimationCurve((Keyframe[])(object)new Keyframe[6]
						{
							new Keyframe(0f, -3f, 2f, 2f),
							new Keyframe(0.2f, -1f, 15f, 15f),
							new Keyframe(0.4f, 6f, 0f, 0f),
							new Keyframe(0.6f, 4f, 4f, 4f),
							new Keyframe(0.8f, 9f, 15f, 15f),
							new Keyframe(1f, 50f, 120f, 120f)
						});
						val3.outsideEnemySpawnChanceThroughDay = AddToKeyFramesOverTime(val3.outsideEnemySpawnChanceThroughDay, 2f);
						val3.indoorMapHazards[0].numberToSpawn = AddToKeyFramesOverTime(val3.indoorMapHazards[0].numberToSpawn, 20f);
						val3.indoorMapHazards[1].numberToSpawn = AddToKeyFramesOverTime(val3.indoorMapHazards[1].numberToSpawn, 12f);
						val3.indoorMapHazards[2].numberToSpawn = AddToKeyFramesOverTime(val3.indoorMapHazards[2].numberToSpawn, 6f);
						val3.randomWeathers[1].weatherVariable = 4;
					}
				}
				else if (((Object)val3).name == "CarnateLevel")
				{
					if (WesleyScripts.LockMoons.Value)
					{
						val3.maxScrap = 50;
						val3.minScrap = 47;
						val3.factorySizeMultiplier = 1.7f;
					}
				}
				else if (((Object)val3).name == "XenphirLevel" && WesleyScripts.LockMoons.Value)
				{
					val3.maxScrap = 56;
					val3.minScrap = 48;
					val3.factorySizeMultiplier = 1.7f;
				}
			}
			Patched = true;
		}

		internal static AnimationCurve AddToKeyFramesOverTime(AnimationCurve curve, float value)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			Keyframe[] keys = curve.keys;
			for (int i = 0; i < keys.Length; i++)
			{
				if (((Keyframe)(ref keys[i])).value > 0f)
				{
					ref Keyframe reference = ref keys[i];
					((Keyframe)(ref reference)).value = ((Keyframe)(ref reference)).value + ((Keyframe)(ref keys[i])).time * value;
				}
			}
			return new AnimationCurve(keys);
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal class ExpandedMineshaftExtraItemsPatcher
	{
		public static int GetLevel3ButCoolID()
		{
			if ((Object)(object)RoundManager.Instance == (Object)null)
			{
				return -1;
			}
			IndoorMapType[] dungeonFlowTypes = RoundManager.Instance.dungeonFlowTypes;
			for (int i = 0; i < dungeonFlowTypes.Length; i++)
			{
				IndoorMapType val = dungeonFlowTypes[i];
				object value = AccessTools.Field(((object)val).GetType(), "dungeonFlow").GetValue(val);
				Object val2 = (Object)((value is Object) ? value : null);
				if (val2 != null && val2.name == "Level3ButCoolFlow")
				{
					return i;
				}
			}
			return -1;
		}

		public static bool IsMineshaftType(int dungeonType)
		{
			if (dungeonType != 4)
			{
				return dungeonType == GetLevel3ButCoolID();
			}
			return true;
		}

		[HarmonyPatch("SpawnScrapInLevel")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> SpawnScrapInLevel_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
			CodeMatch[] array = (CodeMatch[])(object)new CodeMatch[2]
			{
				new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(RoundManager), "currentDungeonType"), (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldc_I4_4, (object)null, (string)null)
			};
			val.MatchForward(false, array).ThrowIfNotMatch("Failed to find targetPattern for patching ExpandedMineshaft bonus", Array.Empty<CodeMatch>()).Advance(1)
				.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ExpandedMineshaftExtraItemsPatcher), "IsMineshaftType", (Type[])null, (Type[])null)))
				.SetOpcodeAndAdvance(OpCodes.Brfalse_S);
			return val.InstructionEnumeration();
		}
	}
	[HarmonyPatch]
	internal class FabricationDoorOpener
	{
		[HarmonyTargetMethod]
		private static MethodBase TargetMethod()
		{
			return AccessTools.Method(AccessTools.Inner(typeof(FabricationDoor), "<WaitForPlayersCoroutine>d__9"), "MoveNext", (Type[])null, (Type[])null);
		}

		[HarmonyPostfix]
		internal static void OpenDoor(object __instance, bool __result)
		{
			if (!__result)
			{
				FieldInfo fieldInfo = AccessTools.Field(__instance.GetType(), "<>4__this");
				object? value = fieldInfo.GetValue(__instance);
				FabricationDoor val = (FabricationDoor)((value is FabricationDoor) ? value : null);
				if ((Object)(object)val != (Object)null && !WesleyScripts.LockMoons.Value && NetworkManager.Singleton.IsServer && val.DoorState == 0)
				{
					WesleysMoonsHQModule.Logger.LogDebug((object)"Opening the door to the crafting machine...");
					val.OpenDoorClientRpc();
				}
			}
		}
	}
	[HarmonyPatch]
	internal class LLLConfigLoaderPatcher_v1
	{
		private static readonly List<string> vanillaLevels = new List<string>(12)
		{
			"Adamance", "Offense", "Assurance", "Experimentation", "Liquidation", "Embrion", "Vow", "March", "Artifice", "Dine",
			"Titan", "Rend"
		};

		[HarmonyPatch("LethalLevelLoader.Tools.ExtendedDungeonConfig, LethalLevelLoader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "BindConfigs")]
		[HarmonyPrefix]
		public static void PatchDungeon(object[] __args)
		{
			object obj = __args[0];
			Type type = obj.GetType();
			PropertyInfo property = type.GetProperty("GenerateAutomaticConfigurationOptions", BindingFlags.Instance | BindingFlags.Public);
			property.SetValue(obj, false);
		}

		[HarmonyPatch("LethalLevelLoader.Tools.ExtendedLevelConfig, LethalLevelLoader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "BindConfigs")]
		[HarmonyPrefix]
		public static void PatchMoon(object[] __args)
		{
			object obj = __args[0];
			Type type = obj.GetType();
			PropertyInfo property = type.GetProperty("GenerateAutomaticConfigurationOptions", BindingFlags.Instance | BindingFlags.Public);
			property.SetValue(obj, false);
			PropertyInfo property2 = type.GetProperty("NumberlessPlanetName", BindingFlags.Instance | BindingFlags.Public);
			if (vanillaLevels.Contains((string)property2.GetValue(obj)))
			{
				PropertyInfo property3 = type.GetProperty("IsRouteLocked", BindingFlags.Instance | BindingFlags.Public);
				PropertyInfo property4 = type.GetProperty("IsRouteHidden", BindingFlags.Instance | BindingFlags.Public);
				property3.SetValue(obj, true);
				property4.SetValue(obj, true);
			}
		}
	}
	[HarmonyPatch]
	internal class LLLConfigLoaderPatcher_v2
	{
		private static readonly List<string> vanillaLevels = new List<string>(12)
		{
			"Adamance", "Offense", "Assurance", "Experimentation", "Liquidation", "Embrion", "Vow", "March", "Artifice", "Dine",
			"Titan", "Rend"
		};

		[HarmonyPatch(typeof(ExtendedDungeonConfig), "BindConfigs")]
		[HarmonyPrefix]
		public static void PatchDungeon(ref ExtendedDungeonFlow extendedDungeonFlow)
		{
			extendedDungeonFlow.GenerateAutomaticConfigurationOptions = false;
		}

		[HarmonyPatch(typeof(ExtendedLevelConfig), "BindConfigs")]
		[HarmonyPrefix]
		public static void PatchMoon(ref ExtendedLevel extendedLevel)
		{
			extendedLevel.GenerateAutomaticConfigurationOptions = false;
			if (vanillaLevels.Contains(extendedLevel.NumberlessPlanetName))
			{
				extendedLevel.IsRouteLocked = true;
				extendedLevel.IsRouteHidden = true;
			}
		}
	}
	[HarmonyPatch(typeof(MenuManager))]
	internal class MenuManagerPatcher
	{
		private static Action<MenuManager, string, string, bool>? MenuNotif3;

		private static Action<MenuManager, string, string>? MenuNotif2;

		static MenuManagerPatcher()
		{
			MethodInfo methodInfo = AccessTools.Method(typeof(MenuManager), "DisplayMenuNotification", (Type[])null, (Type[])null);
			if (methodInfo != null)
			{
				if (methodInfo.GetParameters().Length == 3)
				{
					MenuNotif3 = AccessTools.MethodDelegate<Action<MenuManager, string, string, bool>>(methodInfo, (object)null, true);
				}
				else
				{
					MenuNotif2 = AccessTools.MethodDelegate<Action<MenuManager, string, string>>(methodInfo, (object)null, true);
				}
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		[HarmonyBefore(new string[] { "OreoM.VLog" })]
		internal static void Start_Postfix(MenuManager __instance)
		{
			if (__instance.isInitScene)
			{
				return;
			}
			string text = "";
			int gameVersionNum = GameNetworkManager.Instance.gameVersionNum;
			WesleysMoonsHQModule.Logger.LogInfo((object)("Game version: " + gameVersionNum));
			text += CheckModValidity(PackDefinition.commonRequiredMods, required: true);
			bool flag = false;
			foreach (PackDefinition packDefinition in WesleysMoonsHQModule.packDefinitions)
			{
				if (packDefinition.version == (WesleysMoonsHQModule.Versions)gameVersionNum)
				{
					text += CheckModValidity(packDefinition.requiredMods, required: true);
					text += CheckForBannedMods(packDefinition.disallowedMods);
					flag = true;
				}
			}
			if (!flag)
			{
				text += "Unsupported game version, ";
			}
			if (WesleysMoonsHQModule.pluginInfos.ContainsKey("SlushyRH.LethalCompany.FreeMoons") && WesleyScripts.LockMoons.Value)
			{
				text += "Freemoons installed in non-SMHQ mode, ";
			}
			else if (!WesleysMoonsHQModule.pluginInfos.ContainsKey("SlushyRH.LethalCompany.FreeMoons") && !WesleyScripts.LockMoons.Value)
			{
				text += "Freemoons missing in SMHQ mode, ";
			}
			if (!WesleysMoonsHQModule.pluginInfos.ContainsKey("OreoM.VLog"))
			{
				text += "VLog missing, ";
			}
			if (!Utility.IsNullOrWhiteSpace(text))
			{
				text = text.TrimEnd(',', ' ');
				WesleysMoonsHQModule.Logger.LogWarning((object)("WARNING! Modpack misconfiguration: " + text));
				if (MenuNotif3 != null)
				{
					MenuNotif3(__instance, "WARNING! Modpack misconfiguration: " + text, "[ OK ]", arg4: true);
				}
				else if (MenuNotif2 != null)
				{
					MenuNotif2(__instance, "WARNING! Modpack misconfiguration: " + text, "[ OK ]");
				}
				else
				{
					WesleysMoonsHQModule.Logger.LogError((object)"Displaying menu notification failed.");
				}
			}
		}

		internal static string CheckModValidity(Dictionary<string, Version> dict, bool required)
		{
			string text = "";
			foreach (KeyValuePair<string, Version> item in dict)
			{
				if (!WesleysMoonsHQModule.pluginInfos.ContainsKey(item.Key))
				{
					if (required)
					{
						text += $"{item.Key} v{item.Value} is misssing, ";
					}
				}
				else if (WesleysMoonsHQModule.pluginInfos[item.Key].Metadata.Version != item.Value && (required || !(WesleysMoonsHQModule.pluginInfos[item.Key].Metadata.Version <= item.Value)))
				{
					text += $"{WesleysMoonsHQModule.pluginInfos[item.Key].Metadata.GUID} v{WesleysMoonsHQModule.pluginInfos[item.Key].Metadata.Version} didnt match required version v{item.Value}, ";
				}
			}
			return text;
		}

		internal static string CheckForBannedMods(string[] names)
		{
			foreach (string key in names)
			{
				if (WesleysMoonsHQModule.pluginInfos.ContainsKey(key))
				{
					return "Invalid mods found - please reinstall the pack, ";
				}
			}
			return "";
		}
	}
	[HarmonyPatch(typeof(SoundManager))]
	internal class SoundManagerPatcher
	{
		[HarmonyPatch("ResetValues")]
		[HarmonyPostfix]
		internal static void ResetValues_Postfix(SoundManager __instance)
		{
			WesleysMoonsHQModule.Logger.LogInfo((object)"Attempting to fix chorus effect bug in SoundManager.ResetsValues.");
			((MonoBehaviour)__instance).StartCoroutine(FixChorusEffect(__instance));
		}

		private static IEnumerator FixChorusEffect(SoundManager soundManager)
		{
			yield return null;
			soundManager.SetDiageticMixerSnapshot(4, 1000f);
			yield return null;
			soundManager.SetDiageticMixerSnapshot(0, 1f);
		}
	}
	[HarmonyPatch]
	public class WeatherRegistryConfigPatcher_v1
	{
		private static TextMeshProUGUI? infoDisplay;

		private static bool VailidityCheckFailed;

		[HarmonyPatch(typeof(RoundManager), "Awake")]
		[HarmonyPostfix]
		public static void Awake_Postfix()
		{
			Type type = AccessTools.TypeByName("WeatherRegistry.WeatherCalculation");
			IDictionary dictionary = (IDictionary)AccessTools.Field(type, "WeatherAlgorithms").GetValue(null);
			object obj = null;
			foreach (DictionaryEntry item in dictionary)
			{
				if (Convert.ToInt32(item.Key) == 2)
				{
					obj = item.Value;
					break;
				}
			}
			if (obj == null)
			{
				WesleysMoonsHQModule.Logger.LogError((object)"Error patching v73 WeatherRegistry.");
				return;
			}
			Type type2 = AccessTools.TypeByName("WeatherRegistry.Settings");
			AccessTools.PropertySetter(type2, "WeatherSelectionAlgorithm").Invoke(null, new object[1] { obj });
			Type type3 = AccessTools.TypeByName("WeatherRegistry.ConfigManager");
			object value = AccessTools.Property(type3, "WeatherAlgorithm").GetValue(null);
			PropertyInfo propertyInfo = AccessTools.Property(value.GetType(), "Value");
			object value2 = Enum.Parse(propertyInfo.PropertyType, "Hybrid");
			propertyInfo.SetValue(value, value2);
			PropertyInfo propertyInfo2 = AccessTools.Property(value.GetType(), "ConfigFile");
			object value3 = propertyInfo2.GetValue(value);
			MethodInfo methodInfo = AccessTools.Method(value3.GetType(), "Save", (Type[])null, (Type[])null);
			methodInfo.Invoke(value3, null);
			ConfigManager.FirstDayClear.Value = true;
			((ConfigEntryBase)ConfigManager.FirstDayClear).ConfigFile.Save();
		}

		[HarmonyPatch(typeof(RoundManager), "Start")]
		[HarmonyPostfix]
		public static void Start_Postfix()
		{
			foreach (Weather registeredWeather in WeatherManager.RegisteredWeathers)
			{
				if (((ConfigHandler<float, float>)(object)registeredWeather.Config.ScrapValueMultiplier).ConfigEntry.Value != (float)((ConfigEntryBase)((ConfigHandler<float, float>)(object)registeredWeather.Config.ScrapValueMultiplier).ConfigEntry).DefaultValue || ((ConfigHandler<float, float>)(object)registeredWeather.Config.ScrapAmountMultiplier).ConfigEntry.Value != (float)((ConfigEntryBase)((ConfigHandler<float, float>)(object)registeredWeather.Config.ScrapAmountMultiplier).ConfigEntry).DefaultValue || ((ConfigHandler<int, int>)(object)registeredWeather.Config.DefaultWeight).ConfigEntry.Value != (int)((ConfigEntryBase)((ConfigHandler<int, int>)(object)registeredWeather.Config.DefaultWeight).ConfigEntry).DefaultValue)
				{
					WesleysMoonsHQModule.Logger.LogWarning((object)"Weather configurations did not match the intended pack configurations!");
					VailidityCheckFailed = true;
				}
			}
		}

		[HarmonyPatch(typeof(HUDManager), "Start")]
		[HarmonyPostfix]
		private static void HUDManager_Start_Postfix()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00dd: 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_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			if (!VailidityCheckFailed)
			{
				return;
			}
			if ((Object)(object)infoDisplay == (Object)null)
			{
				WesleysMoonsHQModule.Logger.LogInfo((object)"infoDisplay is null. Creating a new infodisplay.");
				GameObject val = new GameObject("WesleysMoonsHQModule_infoDisplay");
				val.transform.parent = ((TMP_Text)HUDManager.Instance.weightCounter).transform.parent;
				TextMeshProUGUI weightCounter = HUDManager.Instance.weightCounter;
				infoDisplay = val.AddComponent<TextMeshProUGUI>();
				((TMP_Text)infoDisplay).textStyle = ((TMP_Text)weightCounter).textStyle;
				((Component)infoDisplay).tag = ((Component)weightCounter).tag;
				((TMP_Text)infoDisplay).alignment = ((TMP_Text)weightCounter).alignment;
				((Graphic)infoDisplay).color = ((Graphic)weightCounter).color;
				((TMP_Text)infoDisplay).font = ((TMP_Text)weightCounter).font;
				((TMP_Text)infoDisplay).fontSize = ((TMP_Text)weightCounter).fontSize;
				((TMP_Text)infoDisplay).fontStyle = ((TMP_Text)weightCounter).fontStyle;
				((TMP_Text)infoDisplay).fontWeight = ((TMP_Text)weightCounter).fontWeight;
				((TMP_Text)infoDisplay).enableAutoSizing = ((TMP_Text)weightCounter).enableAutoSizing;
				((TMP_Text)infoDisplay).fontSizeMin = ((TMP_Text)weightCounter).fontSizeMin;
				((TMP_Text)infoDisplay).fontSizeMax = ((TMP_Text)weightCounter).fontSizeMax;
				((TMP_Text)infoDisplay).isOverlay = ((TMP_Text)weightCounter).isOverlay;
				((TMP_Text)infoDisplay).transform.position = ((TMP_Text)weightCounter).transform.position;
				((TMP_Text)infoDisplay).text = "text";
				RectTransform component = ((Component)infoDisplay).GetComponent<RectTransform>();
				if ((Object)(object)component == (Object)null)
				{
					WesleysMoonsHQModule.Logger.LogError((object)"Transform not found");
					return;
				}
				component.offsetMin = ((Component)weightCounter).GetComponent<RectTransform>().offsetMin;
				component.offsetMax = ((Component)weightCounter).GetComponent<RectTransform>().offsetMax;
				component.anchoredPosition = new Vector2(67f, -32f);
				((Transform)component).localScale = Vector3.one;
				((Transform)component).localRotation = Quaternion.identity;
			}
			if (!((Object)(object)infoDisplay == (Object)null))
			{
				((TMP_Text)infoDisplay).text = "Invalid Pack";
			}
		}
	}
	[HarmonyPatch]
	public class WeatherRegistryConfigPatcher_v2
	{
		private static TextMeshProUGUI? infoDisplay;

		private static bool VailidityCheckFailed;

		[HarmonyPatch(typeof(RoundManager), "Awake")]
		[HarmonyPostfix]
		public static void Awake_Postfix()
		{
			WeatherSelectionAlgorithm val = WeatherCalculation.WeatherAlgorithms[(WeatherAlgorithm)2];
			AccessTools.PropertySetter(typeof(WeatherCalculation), "WeatherSelectionAlgorithm").Invoke(null, new object[1] { val });
			ConfigManager.WeatherAlgorithm.Value = (WeatherAlgorithm)2;
			ConfigManager.FirstDayClear.Value = true;
			((ConfigEntryBase)ConfigManager.WeatherAlgorithm).ConfigFile.Save();
			((ConfigEntryBase)ConfigManager.FirstDayClear).ConfigFile.Save();
		}

		[HarmonyPatch(typeof(RoundManager), "Start")]
		[HarmonyPostfix]
		public static void Start_Postfix()
		{
			foreach (Weather registeredWeather in WeatherManager.RegisteredWeathers)
			{
				if (((ConfigHandler<float, float>)(object)registeredWeather.Config.ScrapValueMultiplier).ConfigEntry.Value != (float)((ConfigEntryBase)((ConfigHandler<float, float>)(object)registeredWeather.Config.ScrapValueMultiplier).ConfigEntry).DefaultValue || ((ConfigHandler<float, float>)(object)registeredWeather.Config.ScrapAmountMultiplier).ConfigEntry.Value != (float)((ConfigEntryBase)((ConfigHandler<float, float>)(object)registeredWeather.Config.ScrapAmountMultiplier).ConfigEntry).DefaultValue || ((ConfigHandler<int, int>)(object)registeredWeather.Config.DefaultWeight).ConfigEntry.Value != (int)((ConfigEntryBase)((ConfigHandler<int, int>)(object)registeredWeather.Config.DefaultWeight).ConfigEntry).DefaultValue)
				{
					WesleysMoonsHQModule.Logger.LogWarning((object)("Invalid configuration in WeatherRegistry Weather definition: " + registeredWeather.Name));
					VailidityCheckFailed = true;
				}
			}
		}

		[HarmonyPatch(typeof(HUDManager), "Start")]
		[HarmonyPostfix]
		private static void HUDManager_Start_Postfix()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00dd: 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_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			if (!VailidityCheckFailed)
			{
				return;
			}
			if ((Object)(object)infoDisplay == (Object)null)
			{
				WesleysMoonsHQModule.Logger.LogInfo((object)"infoDisplay is null. Creating a new infodisplay.");
				GameObject val = new GameObject("WesleysMoonsHQModule_infoDisplay");
				val.transform.parent = ((TMP_Text)HUDManager.Instance.weightCounter).transform.parent;
				TextMeshProUGUI weightCounter = HUDManager.Instance.weightCounter;
				infoDisplay = val.AddComponent<TextMeshProUGUI>();
				((TMP_Text)infoDisplay).textStyle = ((TMP_Text)weightCounter).textStyle;
				((Component)infoDisplay).tag = ((Component)weightCounter).tag;
				((TMP_Text)infoDisplay).alignment = ((TMP_Text)weightCounter).alignment;
				((Graphic)infoDisplay).color = ((Graphic)weightCounter).color;
				((TMP_Text)infoDisplay).font = ((TMP_Text)weightCounter).font;
				((TMP_Text)infoDisplay).fontSize = ((TMP_Text)weightCounter).fontSize;
				((TMP_Text)infoDisplay).fontStyle = ((TMP_Text)weightCounter).fontStyle;
				((TMP_Text)infoDisplay).fontWeight = ((TMP_Text)weightCounter).fontWeight;
				((TMP_Text)infoDisplay).enableAutoSizing = ((TMP_Text)weightCounter).enableAutoSizing;
				((TMP_Text)infoDisplay).fontSizeMin = ((TMP_Text)weightCounter).fontSizeMin;
				((TMP_Text)infoDisplay).fontSizeMax = ((TMP_Text)weightCounter).fontSizeMax;
				((TMP_Text)infoDisplay).isOverlay = ((TMP_Text)weightCounter).isOverlay;
				((TMP_Text)infoDisplay).transform.position = ((TMP_Text)weightCounter).transform.position;
				((TMP_Text)infoDisplay).text = "text";
				RectTransform component = ((Component)infoDisplay).GetComponent<RectTransform>();
				if ((Object)(object)component == (Object)null)
				{
					WesleysMoonsHQModule.Logger.LogError((object)"Transform not found");
					return;
				}
				component.offsetMin = ((Component)weightCounter).GetComponent<RectTransform>().offsetMin;
				component.offsetMax = ((Component)weightCounter).GetComponent<RectTransform>().offsetMax;
				component.anchoredPosition = new Vector2(67f, -32f);
				((Transform)component).localScale = Vector3.one;
				((Transform)component).localRotation = Quaternion.identity;
			}
			if (!((Object)(object)infoDisplay == (Object)null))
			{
				((TMP_Text)infoDisplay).text = "Invalid Pack";
			}
		}
	}
	[HarmonyPatch(typeof(WeatherObjectContainer))]
	internal class WesleysWeatherStuffPatcher
	{
		[HarmonyPatch("DestroyObjects")]
		[HarmonyPrefix]
		private static void DestroyObjectsPatch(WeatherObjectContainer __instance)
		{
			__instance.weatherObjects = Object.FindObjectsOfType<WeatherObject>().ToList();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}