Decompiled source of RemoveTheAnnoying v1.4.1

RemoveTheAnnoying.dll

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using RemoveTheAnnoying.Patches;
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RemoveTheAnnoying")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RemoveTheAnnoying")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5445ad29-c98f-47fc-82e3-f3aeb564b4a7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RemoveTheAnnoying
{
	[BepInPlugin("Kyoshi.RemoveAnnoyingStuff", "Remove Annoying Mechanics", "1.4.1")]
	public class RemoveAnnoyingBase : BaseUnityPlugin
	{
		private const string modGUID = "Kyoshi.RemoveAnnoyingStuff";

		private const string modName = "Remove Annoying Mechanics";

		private const string modVersion = "1.4.1";

		private readonly Harmony harmony = new Harmony("Kyoshi.RemoveAnnoyingStuff");

		public static RemoveAnnoyingBase Instance;

		public static ManualLogSource mls;

		public ConfigEntry<bool> MineshaftDisabled { get; private set; }

		public ConfigEntry<bool> BarberDisabled { get; private set; }

		public ConfigEntry<bool> ManeaterDisabled { get; private set; }

		public ConfigEntry<bool> AllowFactoryArtifice { get; private set; }

		public ConfigEntry<bool> CruiserFix { get; private set; }

		public ConfigEntry<bool> IncreasedArtificeScrap { get; private set; }

		public ConfigEntry<bool> AttemptForceManor { get; private set; }

		public ConfigEntry<bool> RemoveInteriorFog { get; private set; }

		public ConfigEntry<string> ForceWeather { get; private set; }

		public ConfigEntry<float> EclipsedMultiplier { get; private set; }

		public ConfigEntry<bool> IncreasedStartingCredits { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Kyoshi.RemoveAnnoyingStuff");
			mls.LogInfo((object)"Patching some QoL files!");
			BindConfig();
			ParseWeather(ForceWeather);
			PatchAll();
			mls.LogInfo((object)"The game is now more playable!");
			ConfigStatus();
		}

		private void PatchAll()
		{
			harmony.PatchAll(typeof(RemoveAnnoyingBase));
			harmony.PatchAll(typeof(CruiserSeatTeleportPatch));
			harmony.PatchAll(typeof(CruiserFailsafe));
			harmony.PatchAll(typeof(ChooseNewRandomMapSeedPatch));
			harmony.PatchAll(typeof(DisableBadEnemySpawningPatch));
			harmony.PatchAll(typeof(RemoveFogPatch));
			harmony.PatchAll(typeof(ArtificeScrapPatch));
			harmony.PatchAll(typeof(ForceWeatherPatch));
			harmony.PatchAll(typeof(StartingCreditsPatch));
			harmony.PatchAll(typeof(EclipsedScrapValuePatch));
		}

		private void BindConfig()
		{
			CruiserFix = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "CruiserTeleportFix", true, "Allows players in a cruiser connected to the ship's magnet to be counted as in the ship when the ship takes off.");
			MineshaftDisabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior Generation", "DisableMineshaft", true, "Disables mineshaft interior when enabled.");
			AllowFactoryArtifice = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior Generation", "AllowArtificeFactory", true, "Allows factory interior on Artifice when enabled.");
			AttemptForceManor = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior Generation", "AttemptForceManor", false, "Attempts to force manor generation on all moons, when possible. Overrides all other interior config settings");
			RemoveInteriorFog = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior Generation", "RemoveInteriorFog", true, "Prevents the generation of interior fog introduced in v67.");
			BarberDisabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "DisableBarber", true, "Disables all barber spawning when enabled.");
			ManeaterDisabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "DisableManeater", true, "Disables all maneater spawning when enabled.");
			IncreasedArtificeScrap = ((BaseUnityPlugin)this).Config.Bind<bool>("High Quota", "IncreasedArtificeScrap", false, "Sets the minimum scrap of Artifice to 31 and the maximum to 37. These are the values from v56.");
			ForceWeather = ((BaseUnityPlugin)this).Config.Bind<string>("Training", "ForceWeather", "disabled", "Forces all moon's weathers to be the specified type, defaulting to 'disabled' if input is invalid. Case-insensitive choices are: None, Rainy, Stormy, Foggy, Flooded, Eclipsed, and disabled");
			IncreasedStartingCredits = ((BaseUnityPlugin)this).Config.Bind<bool>("Relaxed", "IncreasedStartingCredits", false, "Increases the starting credits enough to buy cruiser, 5 pro flashlights, 5 walkies, 2 shovels, 2 weed killer, and to go to Artifice (assuming no sales).");
			EclipsedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Relaxed", "EclipsedMultiplier", 1f, "Alters the global scrap value multiplier for eclipsed moons. The valid input range is (0-2]. A little goes a long way...");
		}

		private void ConfigStatus()
		{
			mls.LogDebug((object)$"Config CruiserTeleportFix = {CruiserFix.Value}");
			mls.LogDebug((object)$"Config DisableMineshaft = {MineshaftDisabled.Value}");
			mls.LogDebug((object)$"Config AllowArtificeFactory = {AllowFactoryArtifice.Value}");
			mls.LogDebug((object)$"Config AttemptForceManor = {AttemptForceManor.Value}");
			mls.LogDebug((object)$"Config RemoveInteriorFog = {RemoveInteriorFog.Value}");
			mls.LogDebug((object)$"Config DisableBarber = {BarberDisabled.Value}");
			mls.LogDebug((object)$"Config DisableManeater = {ManeaterDisabled.Value}");
			mls.LogDebug((object)$"Config IncreasedArtificeScrap = {IncreasedArtificeScrap.Value}");
			mls.LogDebug((object)("Config ForceWeather = " + ForceWeather.Value));
			mls.LogDebug((object)$"Config IncreasedStartingCredits = {IncreasedStartingCredits.Value}");
			mls.LogDebug((object)$"Config EclipsedMultiplier = {EclipsedMultiplier.Value}");
		}

		private void ParseWeather(ConfigEntry<string> entry)
		{
			string text = entry.Value.ToLower();
			switch (text)
			{
			case "disabled":
			case "none":
			case "rainy":
			case "stormy":
			case "foggy":
			case "flooded":
			case "eclipsed":
				entry.Value = text;
				break;
			default:
				mls.LogDebug((object)"Could not parse forced weather.");
				entry.Value = "disabled";
				break;
			}
		}
	}
}
namespace RemoveTheAnnoying.Patches
{
	[HarmonyPatch(typeof(StartOfRound), "ChooseNewRandomMapSeed")]
	public class ChooseNewRandomMapSeedPatch
	{
		[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
		public class GenerateNewFloorPatch
		{
			private static readonly ManualLogSource Logger = RemoveAnnoyingBase.mls;

			private static readonly bool MineshaftDisabled = RemoveAnnoyingBase.Instance.MineshaftDisabled.Value;

			private static readonly bool AllowFactoryArtifice = RemoveAnnoyingBase.Instance.AllowFactoryArtifice.Value;

			private static bool Prefix(RoundManager __instance)
			{
				string text = ((Object)__instance.currentLevel).name.Replace("Level", "");
				try
				{
					if (MineshaftDisabled)
					{
						__instance.currentLevel.dungeonFlowTypes = __instance.currentLevel.dungeonFlowTypes.Where(IsNotMineshaft).ToArray();
						Logger.LogDebug((object)("Removed mineshaft generation of " + text + "."));
					}
					if (text.Equals("Artifice") && !AllowFactoryArtifice)
					{
						__instance.currentLevel.dungeonFlowTypes = __instance.currentLevel.dungeonFlowTypes.Where(IsNotFactory).ToArray();
						Logger.LogDebug((object)("Removed factory generation of " + text + "."));
					}
					return true;
				}
				catch (Exception ex)
				{
					Logger.LogWarning((object)("Error removing interior type: " + ex.Message));
					return false;
				}
			}

			private static bool IsNotMineshaft(IntWithRarity flow)
			{
				return flow.id != 4;
			}

			private static bool IsNotFactory(IntWithRarity flow)
			{
				return flow.id != 0;
			}
		}

		public enum InteriorType
		{
			Factory = 0,
			Manor = 1,
			Mineshaft = 4
		}

		private static readonly ManualLogSource Logger = RemoveAnnoyingBase.mls;

		private static readonly bool MineshaftDisabled = RemoveAnnoyingBase.Instance.MineshaftDisabled.Value;

		private static readonly bool AllowFactoryArtifice = RemoveAnnoyingBase.Instance.AllowFactoryArtifice.Value;

		private static readonly bool ManorForced = RemoveAnnoyingBase.Instance.AttemptForceManor.Value;

		private const int MaxSeedAttempts = 1000;

		private const int MaxSeedValue = 100000000;

		private static readonly Dictionary<int?, string> interiorMap = new Dictionary<int?, string>();

		private static void Postfix(StartOfRound __instance)
		{
			if (!MineshaftDisabled && AllowFactoryArtifice)
			{
				Logger.LogInfo((object)"All interiors are enabled, so I won't regenerate the seed.");
				return;
			}
			Logger.LogDebug((object)$"Initialize Dictionary: {InitializeInteriorDict()}");
			int randomMapSeed = __instance.randomMapSeed;
			RoundManager instance = RoundManager.Instance;
			InteriorType? interiorType = DetermineType(randomMapSeed, instance);
			string text = ((Object)__instance.currentLevel).name.Replace("Level", "");
			if (!interiorType.HasValue)
			{
				return;
			}
			interiorType = interiorType.Value;
			Logger.LogInfo((object)$"Seed: {randomMapSeed} is a {interiorType}.");
			InteriorType?[][] removeables = GetRemoveables();
			bool flag = text.Equals("Artifice");
			if (ManorForced)
			{
				if (!RemoveInteriorGeneration(interiorType, removeables[5], instance, __instance))
				{
					Logger.LogDebug((object)"Forcing Manor was unsuccessful, defaulting to other interior config rules...");
					if (MineshaftDisabled)
					{
						RemoveInteriorGeneration(interiorType, removeables[0], instance, __instance);
					}
					else if (!AllowFactoryArtifice && flag)
					{
						RemoveInteriorGeneration(interiorType, removeables[2], instance, __instance);
					}
				}
			}
			else if (MineshaftDisabled)
			{
				if (AllowFactoryArtifice)
				{
					RemoveInteriorGeneration(interiorType, removeables[0], instance, __instance);
				}
				else if (!AllowFactoryArtifice && flag)
				{
					RemoveInteriorGeneration(interiorType, removeables[5], instance, __instance);
				}
				else
				{
					RemoveInteriorGeneration(interiorType, removeables[0], instance, __instance);
				}
			}
			else if (!MineshaftDisabled && !AllowFactoryArtifice && flag)
			{
				RemoveInteriorGeneration(interiorType, removeables[2], instance, __instance);
			}
		}

		private static bool RemoveInteriorGeneration(InteriorType? currentType, InteriorType?[] disallowedTypes, RoundManager manager, StartOfRound __instance)
		{
			if (disallowedTypes.Length == 0 || disallowedTypes.Length == 3)
			{
				return false;
			}
			if (disallowedTypes == null || disallowedTypes.Contains(null))
			{
				return false;
			}
			if (!disallowedTypes.Contains(currentType))
			{
				Logger.LogInfo((object)"No need to regenerate seed.");
				return false;
			}
			int?[] second = ((IEnumerable<InteriorType?>)disallowedTypes).Select((Func<InteriorType?, int?>)((InteriorType? dt) => (int)dt.Value)).ToArray();
			string[] array = disallowedTypes.Select((InteriorType? dt) => interiorMap[(int)dt.Value]).ToArray();
			IEnumerable<string> values = array.Zip(second, (string name, int? typeVal) => $"{name}: {typeVal}");
			Logger.LogDebug((object)string.Format("Current: {0}; Disallowed: {1}", currentType, string.Join(", ", values)));
			Logger.LogInfo((object)(string.Join(" or ", array) + " seed identified, trying to regenerate..."));
			manager.hasInitializedLevelRandomSeed = false;
			manager.InitializeRandomNumberGenerators();
			for (int i = 0; i < 1000; i++)
			{
				int num = NewSeed();
				InteriorType? interiorType = DetermineType(num, manager);
				Logger.LogDebug((object)$"Attempt {i + 1} - Seed: {num} Interior: {interiorType}");
				if (!interiorType.HasValue)
				{
					Logger.LogWarning((object)"Detected unknown interior.");
					return false;
				}
				if (!disallowedTypes.Contains(new InteriorType?(interiorType.Value).GetValueOrDefault()))
				{
					__instance.randomMapSeed = num;
					Logger.LogInfo((object)$"Generated new map seed: {num} after {i + 1} attempts.");
					return true;
				}
			}
			Logger.LogWarning((object)"Regeneration failed after 1000 attempts");
			return false;
		}

		private static InteriorType? DetermineType(int seed, RoundManager manager)
		{
			try
			{
				if (ManagerIsCompany(manager))
				{
					Logger.LogDebug((object)"The Company Building Detected.");
					return null;
				}
				if (manager.currentLevel.dungeonFlowTypes == null || manager.currentLevel.dungeonFlowTypes.Length == 0)
				{
					Logger.LogDebug((object)$"Seed {seed}: Moon is not recognized as having an interior.");
					return null;
				}
				Random random = new Random(seed);
				List<int> list = manager.currentLevel.dungeonFlowTypes.Select((IntWithRarity flow) => flow.rarity).ToList();
				Logger.LogDebug((object)("List: " + string.Join(", ", list)));
				int randomWeightedIndex = manager.GetRandomWeightedIndex(list.ToArray(), random);
				Logger.LogDebug((object)$"Weight: {randomWeightedIndex}");
				int id = manager.currentLevel.dungeonFlowTypes[randomWeightedIndex].id;
				if (Enum.IsDefined(typeof(InteriorType), id))
				{
					return (InteriorType)id;
				}
				return null;
			}
			catch (Exception ex)
			{
				Logger.LogWarning((object)$"Error determining interior type for seed {seed}: {ex.Message}");
				return null;
			}
		}

		private static int NewSeed()
		{
			return new Random().Next(1, 100000000);
		}

		private static bool ManagerIsCompany(RoundManager manager)
		{
			string text = ((Object)manager.currentLevel).name.Replace("Level", "");
			return text.Equals("CompanyBuilding");
		}

		private static bool InitializeInteriorDict()
		{
			if (interiorMap.ContainsKey(0))
			{
				return false;
			}
			interiorMap.Add(0, "Factory");
			interiorMap.Add(1, "Manor");
			interiorMap.Add(4, "Mineshaft");
			return true;
		}

		private static InteriorType?[][] GetRemoveables()
		{
			return new InteriorType?[6][]
			{
				new InteriorType?[1] { InteriorType.Mineshaft },
				new InteriorType?[1] { InteriorType.Manor },
				new InteriorType?[1] { InteriorType.Factory },
				new InteriorType?[2]
				{
					InteriorType.Mineshaft,
					InteriorType.Manor
				},
				new InteriorType?[2]
				{
					InteriorType.Factory,
					InteriorType.Manor
				},
				new InteriorType?[2]
				{
					InteriorType.Mineshaft,
					InteriorType.Factory
				}
			};
		}
	}
	[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
	public class DisableBadEnemySpawningPatch
	{
		private static readonly ManualLogSource Logger = RemoveAnnoyingBase.mls;

		private static readonly HashSet<string> DisabledEnemies = new HashSet<string> { "ClaySurgeon", "CaveDweller" };

		private static readonly bool BarberDisabled = RemoveAnnoyingBase.Instance.BarberDisabled.Value;

		private static readonly bool ManeaterDisabled = RemoveAnnoyingBase.Instance.ManeaterDisabled.Value;

		private static void Prefix(SelectableLevel newLevel)
		{
			try
			{
				LevelOperation(newLevel, log: false);
			}
			catch (Exception arg)
			{
				Logger.LogWarning((object)$"Prefix disabling ran incorrectly: {arg}");
			}
		}

		private static void Postfix(SelectableLevel newLevel)
		{
			try
			{
				LevelOperation(newLevel, log: true);
			}
			catch (Exception arg)
			{
				Logger.LogWarning((object)$"Postfix disabling ran incorrectly: {arg}");
			}
		}

		private static void LevelOperation(SelectableLevel newLevel, bool log)
		{
			if (SelectableLevelIsCompany(newLevel))
			{
				return;
			}
			if (!BarberDisabled && !ManeaterDisabled)
			{
				if (log)
				{
					Logger.LogInfo((object)"All unfun enemies allowed by user config.");
				}
				return;
			}
			if (!newLevel.Enemies.Any((SpawnableEnemyWithRarity e) => DisabledEnemies.Contains(((Object)e.enemyType).name)))
			{
				if (log)
				{
					Logger.LogInfo((object)"No unfun enemies detected in spawning pool.");
				}
				return;
			}
			int num = 0;
			foreach (SpawnableEnemyWithRarity enemy in newLevel.Enemies)
			{
				if (DisableEnemyIfStinky(enemy, log))
				{
					num++;
				}
			}
			if (log)
			{
				Logger.LogInfo((object)$"Disabled {num} unfun enemies in current level.");
			}
			if (log && num > 0)
			{
				Logger.LogDebug((object)"Level will not spawn any unfun enemies.");
			}
		}

		private static bool DisableEnemyIfStinky(SpawnableEnemyWithRarity enemy, bool log)
		{
			string name = ((Object)enemy.enemyType).name;
			if (DisabledEnemies.Contains(name))
			{
				if (name.Equals("ClaySurgeon") && !BarberDisabled)
				{
					if (log)
					{
						Logger.LogInfo((object)"Barber allowed due to user config.");
					}
					return false;
				}
				if (name.Equals("CaveDweller") && !ManeaterDisabled)
				{
					if (log)
					{
						Logger.LogInfo((object)"Maneater allowed due to user config");
					}
					return false;
				}
				enemy.rarity = 0;
				enemy.enemyType.spawningDisabled = true;
				if (log)
				{
					Logger.LogInfo((object)("Spawning of " + name + " disabled."));
				}
				return true;
			}
			return false;
		}

		private static bool SelectableLevelIsCompany(SelectableLevel selectableLevel)
		{
			string text = ((Object)selectableLevel).name.Replace("Level", "");
			return text.Equals("CompanyBuilding");
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "ShipLeave")]
	public class CruiserSeatTeleportPatch
	{
		private static readonly ManualLogSource Logger = RemoveAnnoyingBase.mls;

		private static readonly bool CruiserFixEnabled = RemoveAnnoyingBase.Instance.CruiserFix.Value;

		private static readonly float TeleportDelay = 4.642f;

		private static async void Postfix(StartOfRound __instance)
		{
			if (IsShipLeaving(__instance))
			{
				if (!CruiserFixEnabled)
				{
					Logger.LogInfo((object)"Cruiser fix diabled by user, I won't proceed.");
				}
				else
				{
					await ExecuteAfterDelay(TeleportDelay, __instance);
				}
			}
		}

		private static async Task ExecuteAfterDelay(float delay, StartOfRound __instance)
		{
			await Task.Delay((int)(delay * 1000f));
			TeleportSequence(__instance);
		}

		private static void TeleportSequence(StartOfRound __instance)
		{
			VehicleController attachedVehicle = __instance.attachedVehicle;
			if (IsMagnetProper(__instance, attachedVehicle))
			{
				PlayerControllerB currentDriver = attachedVehicle.currentDriver;
				TeleportPlayerToTerminal(currentDriver);
				PlayerControllerB currentPassenger = attachedVehicle.currentPassenger;
				TeleportPlayerToTerminal(currentPassenger);
				Logger.LogDebug((object)"Teleport sequence exited without any errors :)");
			}
		}

		private static bool IsShipLeaving(StartOfRound startOfRound)
		{
			return startOfRound.shipIsLeaving || startOfRound.shipLeftAutomatically;
		}

		private static bool IsMagnetProper(StartOfRound startOfRound, VehicleController vehicleController)
		{
			bool flag = startOfRound.magnetOn && (startOfRound.isObjectAttachedToMagnet || vehicleController.magnetedToShip);
			if (!flag)
			{
				Logger.LogInfo((object)"Teleport sequence exited due to cruiser not being connected to the ship's magnet.");
			}
			return flag;
		}

		private static bool TeleportPlayerToTerminal(PlayerControllerB player)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null)
			{
				return false;
			}
			Terminal val = Object.FindObjectOfType<Terminal>();
			player.TeleportPlayer(((Component)val).transform.position, false, 0f, false, true);
			Logger.LogInfo((object)("Successfully teleported " + player.playerUsername + " to Ship."));
			player.isInHangarShipRoom = true;
			return true;
		}
	}
	[HarmonyPatch(typeof(ElevatorAnimationEvents), "ElevatorFullyRunning")]
	public class CruiserFailsafe
	{
		private static readonly bool CruiserFixEnabled = RemoveAnnoyingBase.Instance.CruiserFix.Value;

		private static void Prefix()
		{
			if (!CruiserFixEnabled)
			{
				return;
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			for (int i = 0; i < 100; i++)
			{
				if (!((Object)(object)localPlayerController.physicsParent == (Object)null))
				{
					VehicleController componentInParent = ((Component)localPlayerController.physicsParent).GetComponentInParent<VehicleController>();
					if (Object.op_Implicit((Object)(object)componentInParent) && componentInParent.magnetedToShip)
					{
						localPlayerController.isInElevator = true;
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
	public class ArtificeScrapPatch
	{
		private static readonly ManualLogSource Logger = RemoveAnnoyingBase.mls;

		private static readonly bool IncreasedArtificeScrapEnabled = RemoveAnnoyingBase.Instance.IncreasedArtificeScrap.Value;

		public static int v56ArtMin = 31;

		public static int v56ArtMax = 37;

		private static void Prefix(SelectableLevel ___currentLevel)
		{
			if (!IncreasedArtificeScrapEnabled)
			{
				Logger.LogInfo((object)"Artifice scrap increase diabled, I won't proceed.");
				return;
			}
			string text = ((Object)___currentLevel).name.Replace("Level", "");
			if (text.Equals("Artifice"))
			{
				Logger.LogDebug((object)"Attempting to alter scrap spawnrates...");
				___currentLevel.minScrap = v56ArtMin;
				___currentLevel.maxScrap = v56ArtMax;
				Logger.LogInfo((object)$"I successfully updated Artifice's scrap to a range of ({v56ArtMin},{v56ArtMax})");
			}
			else
			{
				Logger.LogInfo((object)"Current moon is not Artifice.");
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager), "RefreshEnemiesList")]
	[HarmonyPriority(0)]
	public class RemoveFogPatch
	{
		private static readonly ManualLogSource Logger = RemoveAnnoyingBase.mls;

		private static readonly bool RemoveFogEnabled = RemoveAnnoyingBase.Instance.RemoveInteriorFog.Value;

		private static void Postfix()
		{
			if (!RemoveFogEnabled)
			{
				Logger.LogInfo((object)"Remove fog diabled by user, I won't proceed.");
			}
			else if (!((Object)(object)RoundManager.Instance == (Object)null) && !((Object)(object)RoundManager.Instance.indoorFog == (Object)null))
			{
				LocalVolumetricFog indoorFog = RoundManager.Instance.indoorFog;
				if (DisableFog(indoorFog))
				{
					Logger.LogInfo((object)"Fog successfully disabled in current level.");
				}
				else
				{
					Logger.LogInfo((object)"Fog was not detected in the current level or disabling was unsuccessful.");
				}
			}
		}

		private static bool DisableFog(LocalVolumetricFog localFog)
		{
			if ((Object)(object)localFog == (Object)null)
			{
				return false;
			}
			((Component)localFog).gameObject.SetActive(false);
			return true;
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "SetPlanetsWeather")]
	public class ForceWeatherPatch
	{
		private static readonly ManualLogSource Logger = RemoveAnnoyingBase.mls;

		private static readonly string ForceWeather = RemoveAnnoyingBase.Instance.ForceWeather.Value;

		private static bool Prefix(SelectableLevel[] ___levels)
		{
			//IL_0096: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			if (ForceWeather == null || ForceWeather.Equals("disabled"))
			{
				Logger.LogInfo((object)"ForceWeather input was not identified.");
				return true;
			}
			LevelWeatherType currentWeather;
			switch (ForceWeather.ToLower())
			{
			case "none":
				currentWeather = (LevelWeatherType)(-1);
				break;
			case "rainy":
				currentWeather = (LevelWeatherType)1;
				break;
			case "stormy":
				currentWeather = (LevelWeatherType)2;
				break;
			case "foggy":
				currentWeather = (LevelWeatherType)3;
				break;
			case "flooded":
				currentWeather = (LevelWeatherType)4;
				break;
			case "eclipsed":
				currentWeather = (LevelWeatherType)5;
				break;
			default:
				Logger.LogInfo((object)"ForceWeather input was not identified.");
				return true;
			}
			foreach (SelectableLevel val in ___levels)
			{
				Logger.LogInfo((object)("Setting " + ((Object)val).name.Replace("Level", "") + "'s weather to " + ForceWeather + "."));
				val.currentWeather = currentWeather;
			}
			Logger.LogInfo((object)("All level's weather set to " + ForceWeather + "."));
			return false;
		}
	}
	[HarmonyPatch(typeof(TimeOfDay), "Awake")]
	public class StartingCreditsPatch
	{
		private static readonly ManualLogSource Logger = RemoveAnnoyingBase.mls;

		private static readonly bool IncreaseEnabled = RemoveAnnoyingBase.Instance.IncreasedStartingCredits.Value;

		private static readonly int IncreasedAmount = CalculateDesired();

		private static void Postfix(TimeOfDay __instance)
		{
			if (!IncreaseEnabled)
			{
				Logger.LogInfo((object)"Increased starting credits diabled by user, I won't proceed.");
				return;
			}
			__instance.quotaVariables.startingCredits = IncreasedAmount;
			Logger.LogInfo((object)$"I set the starting credits to {IncreasedAmount} successfully.");
		}

		private static int CalculateDesired()
		{
			int num = 400;
			int num2 = 1500;
			int num3 = 25;
			int num4 = 25;
			int num5 = 12;
			int num6 = 30;
			return num + num2 + 2 * num3 + 5 * num4 + 5 * num5 + 2 * num6;
		}
	}
	[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
	public class EclipsedScrapValuePatch
	{
		private static readonly ManualLogSource Logger = RemoveAnnoyingBase.mls;

		private static readonly float Multiplier = RemoveAnnoyingBase.Instance.EclipsedMultiplier.Value;

		public static void Prefix(RoundManager __instance)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Invalid comparison between Unknown and I4
			if (Multiplier <= 0f || Multiplier > 2f || Multiplier == 1f)
			{
				Logger.LogInfo((object)$"Given multiplier was {Multiplier}, I won't proceed.");
				return;
			}
			if ((int)TimeOfDay.Instance.currentLevelWeather == 5)
			{
				typeof(RoundManager).GetField("scrapValueMultiplier").SetValue(__instance, Multiplier);
			}
			Logger.LogInfo((object)$"I set the spawned scrap multiplier to {Multiplier} successfully.");
		}
	}
}