Decompiled source of RebalancedMoonsBeta v1.5.10

RebalancedMoons.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using RebalancedMoons.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
using WeatherRegistry;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Chameleon")]
[assembly: IgnoresAccessChecksTo("LethalLevelLoader")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: AssemblyCompany("RebalancedMoons")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Rebalances/reworks some of the vanilla moons.")]
[assembly: AssemblyFileVersion("1.5.10.0")]
[assembly: AssemblyInformationalVersion("1.5.10+7ce707515ffe53b5abbd60be49c499d6ec2f1edd")]
[assembly: AssemblyProduct("RebalancedMoons")]
[assembly: AssemblyTitle("RebalancedMoons")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.10.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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 RebalancedMoons
{
	public class ModConfig
	{
		internal static ConfigEntry<bool> configSnowySkies;

		internal static ConfigEntry<bool> configEmbrionSky;

		internal static ConfigEntry<bool> configAmbientVariety;

		internal static ConfigEntry<bool> configOffenseScene;

		internal static ConfigEntry<bool> configAdamanceScene;

		internal static ConfigEntry<bool> configMarchScene;

		internal static ConfigEntry<bool> configDineScene;

		internal static ConfigEntry<bool> configTitanScene;

		internal static ConfigEntry<bool> configEmbrionScene;

		internal static ConfigEntry<bool> configMarchBridge;

		internal static ConfigEntry<bool> configTitanThirdFireExit;

		internal static ConfigEntry<bool> configMarchDungeons;

		internal static ConfigEntry<bool> configDineDungeons;

		internal static ConfigEntry<bool> configTitanDungeons;

		internal static ConfigEntry<bool> configWeatherOverrides;

		internal static ConfigEntry<string> configMoonEntries;

		internal static void Init(ConfigFile cfg)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Expected O, but got Unknown
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Expected O, but got Unknown
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Expected O, but got Unknown
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Expected O, but got Unknown
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Expected O, but got Unknown
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Expected O, but got Unknown
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Expected O, but got Unknown
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Expected O, but got Unknown
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Expected O, but got Unknown
			configSnowySkies = cfg.Bind<bool>("Client", "New Snowy Skies", true, new ConfigDescription("Adds new HDRI sky volumes to snowy moons.", (AcceptableValueBase)null, Array.Empty<object>()));
			configEmbrionSky = cfg.Bind<bool>("Client", "New Embrion Skies", true, new ConfigDescription("Adds new sunset HDRI sky volume to Embrion.", (AcceptableValueBase)null, Array.Empty<object>()));
			configAmbientVariety = cfg.Bind<bool>("Client", "Ambient Color Variety", true, new ConfigDescription("Adds slightly purple tinted fog to Embrion, and colder interior lighting on Titan.", (AcceptableValueBase)null, Array.Empty<object>()));
			configMarchBridge = cfg.Bind<bool>("Server", "March Rickety Bridge", true, new ConfigDescription("Adds a rickety bridge to March. Stats are inbetween Adamance and Vow.", (AcceptableValueBase)null, Array.Empty<object>()));
			configTitanThirdFireExit = cfg.Bind<bool>("Server", "Titan Third Fire Exit", false, new ConfigDescription("Adds a 3rd fire exit to Titan under the first one. Off by default as it's a bit overpowered.", (AcceptableValueBase)null, Array.Empty<object>()));
			configOffenseScene = cfg.Bind<bool>("Server", "Offense Scene Overrides", true, new ConfigDescription("Replaces Offense's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
			configAdamanceScene = cfg.Bind<bool>("Server", "Adamance Scene Overrides", true, new ConfigDescription("Replaces Adamance's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
			configMarchScene = cfg.Bind<bool>("Server", "March Scene Overrides", true, new ConfigDescription("Replaces March's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
			configDineScene = cfg.Bind<bool>("Server", "Dine Scene Overrides", true, new ConfigDescription("Replaces Dine's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
			configTitanScene = cfg.Bind<bool>("Server", "Titan Scene Overrides", true, new ConfigDescription("Replaces Titan's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
			configEmbrionScene = cfg.Bind<bool>("Server", "Embrion Scene Overrides", true, new ConfigDescription("Replaces Embrion's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
			configMarchDungeons = cfg.Bind<bool>("Server", "March Interior Overrides", true, new ConfigDescription("REQUIRES RESTART WHEN DISABLING INGAME - Overrides the interior selections on March to include all vanilla interiors.", (AcceptableValueBase)null, Array.Empty<object>()));
			configDineDungeons = cfg.Bind<bool>("Server", "Dine Interior Overrides", true, new ConfigDescription("REQUIRES RESTART WHEN DISABLING INGAME - Overrides the interior selections on Dine to make Mineshaft less common.", (AcceptableValueBase)null, Array.Empty<object>()));
			configTitanDungeons = cfg.Bind<bool>("Server", "Titan Interior Overrides", true, new ConfigDescription("REQUIRES RESTART WHEN DISABLING INGAME - Overrides the interior selections on Titan to make Mineshaft significantly more common.", (AcceptableValueBase)null, Array.Empty<object>()));
			configWeatherOverrides = cfg.Bind<bool>("Server", "Weather Overrides", true, new ConfigDescription("Enables weather overrides on rebalanced moons (Replaces Rainy w/ Foggy on Dine)", (AcceptableValueBase)null, Array.Empty<object>()));
			configMoonEntries = cfg.Bind<string>("Misc", "Rebalanced Moon Names", "Assurаncе, Offеnsе, Mаrch, Adаmance, Embrіon, Rеnd, Dіne, Tіtan", new ConfigDescription("THIS SETTING DOES NOTHING AND SERVES AS A LIST FOR REFERENCE! You can copy the rebalanced moon names from here for all your config needs. They look the same, but they use cyrillic letters.", (AcceptableValueBase)null, Array.Empty<object>()));
		}
	}
	public class ModNetworkHandler : NetworkBehaviour
	{
		public static ModNetworkHandler Instance { get; private set; }

		public static event Action<int, string, string> SendLevelEvent;

		public override void OnNetworkSpawn()
		{
			ModNetworkHandler.SendLevelEvent = null;
			if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && (Object)(object)Instance != (Object)null)
			{
				ModNetworkHandler instance = Instance;
				if (instance != null)
				{
					((Component)instance).gameObject.GetComponent<NetworkObject>().Despawn(true);
				}
			}
			Instance = this;
			((NetworkBehaviour)this).OnNetworkSpawn();
		}

		[ServerRpc(RequireOwnership = false)]
		public void InteriorServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3535556583u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3535556583u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				if (ModConfig.configMarchDungeons.Value)
				{
					InteriorClientRpc("March");
				}
				if (ModConfig.configDineDungeons.Value)
				{
					InteriorClientRpc("Dine");
				}
				if (ModConfig.configTitanDungeons.Value)
				{
					InteriorClientRpc("Titan");
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void WeatherServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(275949116u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 275949116u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ModConfig.configWeatherOverrides.Value)
				{
					WeatherClientRpc();
				}
			}
		}

		[ClientRpc]
		public void WeatherClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2505610390u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2505610390u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			foreach (ExtendedLevel vanillaExtendedLevel in PatchedContent.VanillaExtendedLevels)
			{
				if (vanillaExtendedLevel.NumberlessPlanetName == "Dine")
				{
					vanillaExtendedLevel.SelectableLevel.randomWeathers = Plugin.reDineExtended.SelectableLevel.randomWeathers;
				}
			}
		}

		[ClientRpc]
		public void InteriorClientRpc(string name)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1063301947u, val, (RpcDelivery)0);
				bool flag = name != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(name, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1063301947u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			string name2 = name;
			if ((Object)(object)Plugin.rebalancedMoonsMod == (Object)null)
			{
				return;
			}
			foreach (ExtendedDungeonFlow extendedDungeonFlow in PatchedContent.ExtendedDungeonFlows)
			{
				List<StringWithRarity> planetNames2 = extendedDungeonFlow.LevelMatchingProperties.planetNames;
				switch (((Object)extendedDungeonFlow.DungeonFlow).name)
				{
				case "Level1Flow3Exits":
					planetNames2.RemoveAll((StringWithRarity p) => p.Name.Equals("March") && name2.Equals("March"));
					break;
				case "Level1Flow":
					UpdateMoonInList(planetNames2, "Titan", 140, name2);
					AddMoonIfNotInList(planetNames2, "March", 300, name2);
					break;
				case "Level2Flow":
					UpdateMoonInList(planetNames2, "Titan", 40, name2);
					AddMoonIfNotInList(planetNames2, "March", 5, name2);
					break;
				case "Level3Flow":
					UpdateMoonInList(planetNames2, "Dine", 50, name2);
					UpdateMoonInList(planetNames2, "Titan", 300, name2);
					AddMoonIfNotInList(planetNames2, "March", 190, name2);
					break;
				}
			}
			static void AddMoonIfNotInList(List<StringWithRarity> planetNames, string planetName, int rarity, string configEvent)
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Expected O, but got Unknown
				if (!planetNames.Any((StringWithRarity p) => p.Name.Equals(planetName) && p.Name.Equals(configEvent)))
				{
					planetNames.Add(new StringWithRarity(planetName, rarity));
				}
			}
			static void UpdateMoonInList(List<StringWithRarity> planetNames, string planetName, int newRarity, string configEvent)
			{
				foreach (StringWithRarity planetName in planetNames)
				{
					if (planetName.Name.Equals(planetName) && planetName.Name.Equals(configEvent))
					{
						planetName.Rarity = newRarity;
					}
				}
			}
		}

		[ClientRpc]
		public void DeactivateObjectClientRpc(string name)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1937315323u, val, (RpcDelivery)0);
				bool flag = name != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(name, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1937315323u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				GameObject val3 = GameObject.Find(name);
				if ((Object)(object)val3 != (Object)null && val3.activeSelf)
				{
					val3.SetActive(false);
				}
			}
		}

		[ClientRpc]
		public void LevelClientRpc(int extendedLevel, string eventName, string sceneName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1937144637u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, extendedLevel);
				bool flag = eventName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(eventName, false);
				}
				bool flag2 = sceneName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(sceneName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1937144637u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				ModNetworkHandler.SendLevelEvent?.Invoke(extendedLevel, eventName, sceneName);
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ModNetworkHandler()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3535556583u, new RpcReceiveHandler(__rpc_handler_3535556583));
			NetworkManager.__rpc_func_table.Add(275949116u, new RpcReceiveHandler(__rpc_handler_275949116));
			NetworkManager.__rpc_func_table.Add(2505610390u, new RpcReceiveHandler(__rpc_handler_2505610390));
			NetworkManager.__rpc_func_table.Add(1063301947u, new RpcReceiveHandler(__rpc_handler_1063301947));
			NetworkManager.__rpc_func_table.Add(1937315323u, new RpcReceiveHandler(__rpc_handler_1937315323));
			NetworkManager.__rpc_func_table.Add(1937144637u, new RpcReceiveHandler(__rpc_handler_1937144637));
		}

		private static void __rpc_handler_3535556583(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ModNetworkHandler)(object)target).InteriorServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_275949116(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ModNetworkHandler)(object)target).WeatherServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2505610390(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ModNetworkHandler)(object)target).WeatherClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1063301947(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string name = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ModNetworkHandler)(object)target).InteriorClientRpc(name);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1937315323(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string name = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ModNetworkHandler)(object)target).DeactivateObjectClientRpc(name);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1937144637(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int extendedLevel = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref extendedLevel);
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string eventName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref eventName, false);
				}
				bool flag2 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
				string sceneName = null;
				if (flag2)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref sceneName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ModNetworkHandler)(object)target).LevelClientRpc(extendedLevel, eventName, sceneName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "ModNetworkHandler";
		}
	}
	internal class ModUtil
	{
		public static List<T> SearchInLatestScene<T>() where T : Object
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			List<T> list = new List<T>();
			Scene sceneAt = SceneManager.GetSceneAt(SceneManager.sceneCount - 1);
			GameObject[] rootGameObjects = ((Scene)(ref sceneAt)).GetRootGameObjects();
			for (int i = 0; i < rootGameObjects.Length; i++)
			{
				T[] componentsInChildren = rootGameObjects[i].GetComponentsInChildren<T>();
				foreach (T item in componentsInChildren)
				{
					list.Add(item);
				}
			}
			return list;
		}

		public static void initSceneOverrides()
		{
			Plugin.ApplySky();
		}
	}
	internal class NetworkObjectManager
	{
		private static GameObject networkPrefab;

		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		[HarmonyPostfix]
		public static void Init()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			if (!((Object)(object)networkPrefab != (Object)null))
			{
				networkPrefab = (GameObject)Plugin.Instance.NetworkBundle.LoadAsset("RBMNetworkHandler");
				networkPrefab.AddComponent<ModNetworkHandler>();
				NetworkManager.Singleton.AddNetworkPrefab(networkPrefab);
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		[HarmonyPostfix]
		private static void SpawnNetworkHandler()
		{
			//IL_001d: 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)
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity);
				Plugin.Logger.LogDebug((object)("Network handler instantiated at " + (object)val));
				val.GetComponent<NetworkObject>().Spawn(false);
			}
		}
	}
	[BepInPlugin("dopadream.lethalcompany.rebalancedmoons", "RebalancedMoons", "1.5.10")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal class RebalancedMoonsPatches
		{
			private static void InitMoons()
			{
				if (!Plugin.IsSetupComplete)
				{
					return;
				}
				foreach (ExtendedLevel vanillaExtendedLevel in PatchedContent.VanillaExtendedLevels)
				{
					RebalanceMoon(vanillaExtendedLevel);
				}
			}

			private static void RebalanceMoon(ExtendedLevel extendedLevel)
			{
				if (new Dictionary<string, Action<ExtendedLevel>>
				{
					{
						"Assurance",
						delegate(ExtendedLevel level)
						{
							ApplyRebalance(level, reAssuranceExtended);
						}
					},
					{
						"Offense",
						delegate(ExtendedLevel level)
						{
							ApplyRebalance(level, reOffenseExtended);
							SetScene(level, "ReOffenseScene");
						}
					},
					{
						"March",
						delegate(ExtendedLevel level)
						{
							ApplyRebalance(level, reMarchExtended);
							SetScene(level, "ReMarchScene");
						}
					},
					{
						"Adamance",
						delegate(ExtendedLevel level)
						{
							ApplyRebalance(level, reAdamanceExtended);
							SetScene(level, "ReAdamanceScene");
						}
					},
					{
						"Rend",
						delegate(ExtendedLevel level)
						{
							ApplyRebalance(level, reRendExtended);
						}
					},
					{
						"Dine",
						delegate(ExtendedLevel level)
						{
							ApplyRebalance(level, reDineExtended);
							SetScene(level, "ReDineScene");
						}
					},
					{
						"Titan",
						delegate(ExtendedLevel level)
						{
							ApplyRebalance(level, reTitanExtended);
							SetScene(level, "ReTitanScene");
						}
					},
					{
						"Artifice",
						delegate(ExtendedLevel level)
						{
							level.SelectableLevel.riskLevel = "S+";
						}
					},
					{
						"Embrion",
						delegate(ExtendedLevel level)
						{
							ApplyRebalance(level, reEmbrionExtended);
							SetScene(level, "ReEmbrionScene");
						}
					}
				}.TryGetValue(extendedLevel.NumberlessPlanetName, out var value))
				{
					value(extendedLevel);
				}
			}

			private static void SetScene(ExtendedLevel extendedLevel, string sceneName)
			{
				if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && new Dictionary<string, bool>
				{
					{
						"Offense",
						ModConfig.configOffenseScene.Value
					},
					{
						"March",
						ModConfig.configMarchScene.Value
					},
					{
						"Adamance",
						ModConfig.configAdamanceScene.Value
					},
					{
						"Dine",
						ModConfig.configDineScene.Value
					},
					{
						"Titan",
						ModConfig.configTitanScene.Value
					},
					{
						"Embrion",
						ModConfig.configEmbrionScene.Value
					}
				}.TryGetValue(extendedLevel.NumberlessPlanetName, out var value) && value)
				{
					SendLevelToClients(extendedLevel.SelectableLevel.levelID, "RBMSceneEvent", sceneName);
				}
			}

			[HarmonyPatch(typeof(QuickMenuManager), "Start")]
			[HarmonyPostfix]
			private static void SubscribeToHandler()
			{
				ModNetworkHandler.SendLevelEvent += ReceivedLevelFromServer;
				SetupLobby(StartOfRound.Instance);
				ModNetworkHandler.Instance.InteriorServerRpc();
			}

			[HarmonyPatch(typeof(QuickMenuManager), "LeaveGameConfirm")]
			[HarmonyPostfix]
			private static void UnsubscribeFromHandler()
			{
				ModNetworkHandler.SendLevelEvent -= ReceivedLevelFromServer;
			}

			[HarmonyPatch(typeof(StartOfRound), "OnClientConnect")]
			[HarmonyPostfix]
			private static void ClientConnectPostFix(StartOfRound __instance)
			{
				SetupLobby(__instance);
			}

			private static void SetupLobby(StartOfRound __instance)
			{
				SelectableLevel[] levels = __instance.levels;
				foreach (SelectableLevel val in levels)
				{
					string planetName = val.PlanetName;
					if (planetName != null)
					{
						if (planetName.Contains("Titan"))
						{
							val.canSpawnMold = false;
						}
						else if (planetName.Contains("Embrion"))
						{
							val.canSpawnMold = false;
						}
					}
				}
				InitMoons();
				__instance.screenLevelVideoReel.Play();
			}

			public static void SendLevelToClients(int extendedLevel, string eventName, string sceneName)
			{
				if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
				{
					ModNetworkHandler.Instance.LevelClientRpc(extendedLevel, eventName, sceneName);
				}
			}

			public static void ReceivedLevelFromServer(int extendedLevel, string eventName, string sceneName)
			{
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Expected O, but got Unknown
				//IL_0105: Unknown result type (might be due to invalid IL or missing references)
				//IL_010f: Expected O, but got Unknown
				foreach (ExtendedLevel vanillaExtendedLevel in PatchedContent.VanillaExtendedLevels)
				{
					if (!vanillaExtendedLevel.SelectableLevel.levelID.Equals(extendedLevel))
					{
						continue;
					}
					if (!(eventName == "RBMSceneEvent"))
					{
						if (eventName == "VanillaSceneEvent" && new Dictionary<string, string>
						{
							{ "ReOffenseScene", "Level7Offense" },
							{ "ReMarchScene", "Level4March" },
							{ "ReAdamanceScene", "Level10Adamance" },
							{ "ReDineScene", "Level6Dine" },
							{ "ReTitanScene", "Level8Titan" }
						}.TryGetValue(vanillaExtendedLevel.SelectableLevel.sceneName, out var value))
						{
							vanillaExtendedLevel.SelectableLevel.sceneName = sceneName;
							vanillaExtendedLevel.SceneSelections.Clear();
							vanillaExtendedLevel.SceneSelections.Add(new StringWithRarity(value, 100));
						}
					}
					else
					{
						vanillaExtendedLevel.SelectableLevel.sceneName = sceneName;
						vanillaExtendedLevel.SceneSelections.Clear();
						vanillaExtendedLevel.SceneSelections.Add(new StringWithRarity(sceneName, 100));
					}
				}
			}

			[HarmonyPatch(typeof(RoundManager), "SetChallengeFileRandomModifiers")]
			[HarmonyPriority(800)]
			[HarmonyPrefix]
			private static void OnGenerateNewFloorPrefix(RoundManager __instance)
			{
				ModUtil.initSceneOverrides();
				if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
				{
					if (!ModConfig.configTitanThirdFireExit.Value && (Object)(object)StartOfRound.Instance.currentLevel != (Object)null && ((Object)StartOfRound.Instance.currentLevel).name.Equals("TitanLevel") && ModConfig.configTitanScene.Value)
					{
						Logger.LogDebug((object)"Rebalanced Titan loaded, destroying 3rd fire exit...");
						ModNetworkHandler.Instance.DeactivateObjectClientRpc("Environment/Teleports/FireExitDoorContainerD");
					}
					if (!ModConfig.configMarchBridge.Value && (Object)(object)StartOfRound.Instance.currentLevel != (Object)null && ((Object)StartOfRound.Instance.currentLevel).name.Equals("MarchLevel") && ModConfig.configMarchScene.Value)
					{
						Logger.LogDebug((object)"Rebalanced March loaded, destroying rickety bridge...");
						ModNetworkHandler.Instance.DeactivateObjectClientRpc("Environment/DangerousBridge");
					}
				}
			}

			[HarmonyPatch(typeof(RoundManager), "RefreshLightsList")]
			[HarmonyPostfix]
			private static void RefreshLightsPostFix(ref List<Light> ___allPoweredLights)
			{
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				if (!ModConfig.configAmbientVariety.Value || !((Object)StartOfRound.Instance.currentLevel).name.Equals("TitanLevel"))
				{
					return;
				}
				foreach (Light ___allPoweredLight in ___allPoweredLights)
				{
					if ((Object)(object)___allPoweredLight != (Object)null)
					{
						___allPoweredLight.useColorTemperature = true;
						___allPoweredLight.color = new Color(0.7f, 0.735f, 0.76f, 1f);
						___allPoweredLight.colorTemperature = 6500f;
					}
				}
			}

			[HarmonyPatch(typeof(PlayerControllerB), "KillPlayerClientRpc")]
			[HarmonyPostfix]
			private static void OnKillPlayerClientRpcPostfix(PlayerControllerB __instance)
			{
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				if (!ModConfig.configAmbientVariety.Value || !((Object)StartOfRound.Instance.currentLevel).name.Equals("TitanLevel") || RoundManager.Instance.LevelRandom.Next(0, 2) == 0 || __instance.playersManager.connectedPlayersAmount < 1 || __instance.playersManager.livingPlayers != 1)
				{
					return;
				}
				RoundManager.Instance.FlickerLights(false, false);
				foreach (Light allPoweredLight in RoundManager.Instance.allPoweredLights)
				{
					if ((Object)(object)allPoweredLight != (Object)null)
					{
						allPoweredLight.color = new Color(0.4f, 0.425f, 0.45f, 1f);
					}
				}
			}

			[HarmonyPatch(typeof(TerminalManager), "GetExtendedLevelGroups")]
			[HarmonyPostfix]
			private static void OnGetExtendedLevelGroupsPostfix(ref List<ExtendedLevelGroup> __result)
			{
				List<ExtendedLevelGroup> list = new List<ExtendedLevelGroup>();
				if (!((Object)(object)rebalancedMoonsMod != (Object)null))
				{
					return;
				}
				foreach (ExtendedLevelGroup item in __result)
				{
					if (!item.extendedLevelsList.Any((ExtendedLevel x) => rebalancedMoonsMod.ExtendedLevels.Any((ExtendedLevel y) => (Object)(object)y == (Object)(object)x)))
					{
						list.Add(item);
					}
				}
				__result = list;
			}
		}

		public const string PLUGIN_GUID = "dopadream.lethalcompany.rebalancedmoons";

		public const string PLUGIN_NAME = "RebalancedMoons";

		public const string PLUGIN_VERSION = "1.5.10";

		public const string WEATHER_REGISTRY = "mrov.WeatherRegistry";

		internal static ManualLogSource Logger;

		internal static ExtendedLevel reRendExtended;

		internal static ExtendedLevel reDineExtended;

		internal static ExtendedLevel reMarchExtended;

		internal static ExtendedLevel reOffenseExtended;

		internal static ExtendedLevel reAssuranceExtended;

		internal static ExtendedLevel reEmbrionExtended;

		internal static ExtendedLevel reTitanExtended;

		internal static ExtendedLevel reAdamanceExtended;

		internal static ExtendedMod rebalancedMoonsMod;

		internal static VolumeProfile snowyProfile;

		internal static VolumeProfile embyProfile;

		public AssetBundle NetworkBundle;

		public static Plugin Instance { get; set; }

		public Plugin()
		{
			Instance = this;
		}

		private void Awake()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			ModConfig.Init(((BaseUnityPlugin)this).Config);
			string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "networkprefab");
			NetworkBundle = AssetBundle.LoadFromFile(text);
			NetcodePatcher();
			AssetBundleLoader.AddOnExtendedModLoadedListener((Action<ExtendedMod>)OnExtendedModRegistered, "dopadream", "RebalancedMoons");
			Harmony val = new Harmony("dopadream.lethalcompany.rebalancedmoons");
			val.PatchAll(typeof(NetworkObjectManager));
			val.PatchAll(typeof(RebalancedMoonsPatches));
			if (Chainloader.PluginInfos.ContainsKey("mrov.WeatherRegistry"))
			{
				val.PatchAll(typeof(WeatherRegistryCompat));
			}
			Logger.LogInfo((object)"RebalancedMoons v1.5.10 loaded");
		}

		private static void NetcodePatcher()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			for (int i = 0; i < types.Length; i++)
			{
				MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}

		internal static void OnExtendedModRegistered(ExtendedMod extendedMod)
		{
			if (!((Object)(object)extendedMod == (Object)null))
			{
				rebalancedMoonsMod = extendedMod;
				reAdamanceExtended = rebalancedMoonsMod.ExtendedLevels[0];
				reAssuranceExtended = rebalancedMoonsMod.ExtendedLevels[1];
				reDineExtended = rebalancedMoonsMod.ExtendedLevels[2];
				reEmbrionExtended = rebalancedMoonsMod.ExtendedLevels[3];
				reMarchExtended = rebalancedMoonsMod.ExtendedLevels[4];
				reOffenseExtended = rebalancedMoonsMod.ExtendedLevels[5];
				reRendExtended = rebalancedMoonsMod.ExtendedLevels[6];
				reTitanExtended = rebalancedMoonsMod.ExtendedLevels[7];
			}
		}

		internal static void ApplyRebalance(ExtendedLevel input, ExtendedLevel output)
		{
			input.RoutePrice = output.RoutePrice;
			input.SelectableLevel.Enemies = output.SelectableLevel.Enemies;
			input.SelectableLevel.OutsideEnemies = output.SelectableLevel.OutsideEnemies;
			input.SelectableLevel.DaytimeEnemies = output.SelectableLevel.DaytimeEnemies;
			input.SelectableLevel.maxEnemyPowerCount = output.SelectableLevel.maxEnemyPowerCount;
			input.SelectableLevel.maxOutsideEnemyPowerCount = output.SelectableLevel.maxOutsideEnemyPowerCount;
			input.SelectableLevel.maxDaytimeEnemyPowerCount = output.SelectableLevel.maxDaytimeEnemyPowerCount;
			input.SelectableLevel.spawnProbabilityRange = output.SelectableLevel.spawnProbabilityRange;
			input.SelectableLevel.enemySpawnChanceThroughoutDay = output.SelectableLevel.enemySpawnChanceThroughoutDay;
			input.SelectableLevel.daytimeEnemiesProbabilityRange = output.SelectableLevel.daytimeEnemiesProbabilityRange;
			input.SelectableLevel.daytimeEnemySpawnChanceThroughDay = output.SelectableLevel.daytimeEnemySpawnChanceThroughDay;
			input.SelectableLevel.outsideEnemySpawnChanceThroughDay = output.SelectableLevel.outsideEnemySpawnChanceThroughDay;
			input.SelectableLevel.minScrap = output.SelectableLevel.minScrap;
			input.SelectableLevel.maxScrap = output.SelectableLevel.maxScrap;
			input.SelectableLevel.minTotalScrapValue = output.SelectableLevel.minTotalScrapValue;
			input.SelectableLevel.maxTotalScrapValue = output.SelectableLevel.maxTotalScrapValue;
			input.SelectableLevel.spawnableScrap.Clear();
			input.SelectableLevel.spawnableScrap.AddRange(output.SelectableLevel.spawnableScrap);
			ModNetworkHandler.Instance.WeatherServerRpc();
			input.SelectableLevel.spawnableMapObjects = output.SelectableLevel.spawnableMapObjects;
			input.SelectableLevel.spawnableOutsideObjects = output.SelectableLevel.spawnableOutsideObjects;
			input.SelectableLevel.riskLevel = output.SelectableLevel.riskLevel;
			input.SelectableLevel.videoReel = output.SelectableLevel.videoReel;
			Logger.LogDebug((object)("Rebalances applied for " + ((object)input)?.ToString() + "!"));
		}

		internal static void ApplySky()
		{
			if (!ModConfig.configSnowySkies.Value && !ModConfig.configEmbrionSky.Value)
			{
				return;
			}
			Volume[] array = Object.FindObjectsByType<Volume>((FindObjectsSortMode)0);
			Fog val2 = default(Fog);
			foreach (Volume val in array)
			{
				if ((Object)(object)snowyProfile == (Object)null || (Object)(object)embyProfile == (Object)null)
				{
					try
					{
						AssetBundle obj = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "hdri_skies"));
						snowyProfile = obj.LoadAsset<VolumeProfile>("ReSnowyFog");
						embyProfile = obj.LoadAsset<VolumeProfile>("EmbrionSky");
					}
					catch
					{
						Logger.LogError((object)"Encountered some error loading assets from bundle \"hdri_skies\". Did you install the plugin correctly?");
						break;
					}
				}
				if ((Object)(object)val == (Object)null || (Object)(object)val.sharedProfile == (Object)null)
				{
					continue;
				}
				string text = null;
				if ((Object)(object)snowyProfile != (Object)null && ((Object)val.sharedProfile).name.Contains("SnowyFog"))
				{
					StartOfRound instance = StartOfRound.Instance;
					if (instance != null && instance.currentLevel?.PlanetName?.Contains("Artifice") == false)
					{
						text = "SnowyProfile";
					}
				}
				if ((Object)(object)embyProfile != (Object)null)
				{
					StartOfRound instance2 = StartOfRound.Instance;
					if (instance2 != null && instance2.currentLevel?.PlanetName?.Contains("Embrion") == true && ((Object)val.sharedProfile).name.Contains("Sky and Fog Settings Profile"))
					{
						text = "EmbyProfile";
					}
				}
				if (string.IsNullOrEmpty(text))
				{
					continue;
				}
				Logger.LogInfo((object)("Applying profile '" + text + "' to Volume " + ((Object)val).name + "."));
				if (!((Object)val).name.Equals("Sky and Fog Global Volume"))
				{
					continue;
				}
				if (text.Equals("SnowyProfile") && ModConfig.configSnowySkies.Value)
				{
					val.sharedProfile = snowyProfile;
				}
				else
				{
					if (!text.Equals("EmbyProfile") || !ModConfig.configEmbrionSky.Value)
					{
						continue;
					}
					val.sharedProfile = embyProfile;
					if (!ModConfig.configAmbientVariety.Value)
					{
						val.sharedProfile.TryGet<Fog>(ref val2);
						if ((Object)(object)val2 != (Object)null)
						{
							((VolumeParameter)val2.albedo).overrideState = false;
						}
					}
				}
			}
		}
	}
	internal class WeatherRegistryCompat
	{
		[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
		[HarmonyPostfix]
		private static void startGamePostfix(RoundManager __instance)
		{
			initWeatherTweaksCompat(__instance);
		}

		private static void initWeatherTweaksCompat(RoundManager instance)
		{
			if (!((Object)instance.currentLevel).name.Equals("TitanLevel") || !WeatherManager.GetCurrentLevelWeather().Name.Equals("Blackout"))
			{
				return;
			}
			Plugin.Logger.LogDebug((object)"Titan Blackout detected, turning the evil fire exit off...");
			foreach (AudioSource item in from aud in ModUtil.SearchInLatestScene<AudioSource>()
				where ((Object)((Component)aud).gameObject).name == "BrokenLight"
				select aud)
			{
				item.mute = true;
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "RebalancedMoons";

		public const string PLUGIN_NAME = "RebalancedMoons";

		public const string PLUGIN_VERSION = "1.5.10";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace RebalancedMoons.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}

RebalancedMoons.ChameleonCompat.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Chameleon;
using Chameleon.Info;
using Chameleon.Overrides;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Chameleon")]
[assembly: IgnoresAccessChecksTo("LethalLevelLoader")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: AssemblyCompany("RebalancedMoons.ChameleonCompat")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Rebalances/reworks some of the vanilla moons.")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1+cc08a632a5e584fc35f40960c26c60c5a9ff7779")]
[assembly: AssemblyProduct("RebalancedMoons.ChameleonCompat")]
[assembly: AssemblyTitle("RebalancedMoons.ChameleonCompat")]
[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 RebalancedMoons.ChameleonCompat
{
	[BepInPlugin("dopadream.lethalcompany.rebalancedmoons.chameleoncompat", "RebalancedMoonsChameleonCompat", "0.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private const string PLUGIN_GUID = "dopadream.lethalcompany.rebalancedmoons.chameleoncompat";

		private const string PLUGIN_NAME = "RebalancedMoonsChameleonCompat";

		private const string PLUGIN_VERSION = "0.0.1";

		private const string CHAMELEON = "butterystancakes.lethalcompany.chameleon";

		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			new Harmony("dopadream.lethalcompany.rebalancedmoons.chameleoncompat").PatchAll();
			Logger.LogInfo((object)"RebalancedMoonsChameleonCompat v0.0.1 loaded");
		}
	}
	[HarmonyPatch]
	internal class ChameleonCompatPatches
	{
		[HarmonyPatch(typeof(EntranceDoorFancifier), "Apply")]
		[HarmonyPrefix]
		private static void OnApplyCosmeticInfoPostfix()
		{
			//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_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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			if (((Object)StartOfRound.Instance.currentLevel).name == "DineLevel")
			{
				Common.currentLevelCosmeticInfo = new LevelCosmeticInfo
				{
					fancyDoorPos = new Vector3(-156.5477f, -15.0669f, 16.7538f),
					fancyDoorRot = Quaternion.Euler(270f, -5.7088f, 0f),
					doorLightColor = DoorLightPalette.BLIZZARD_BACKGROUND,
					windowMatName = "FakeWindowView3"
				};
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "RebalancedMoons.ChameleonCompat";

		public const string PLUGIN_NAME = "RebalancedMoons.ChameleonCompat";

		public const string PLUGIN_VERSION = "0.0.1";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}