Decompiled source of LunarConfig v0.3.2

plugins/LunarConfig/Crafty.LunarConfig.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Dawn;
using Dawn.Utils;
using DunGen.Graph;
using Dusk;
using Dusk.Weights;
using HarmonyLib;
using LunarConfig.Objects.Config;
using LunarConfig.Patches;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("com.github.teamxiaolan.dawnlib")]
[assembly: IgnoresAccessChecksTo("com.github.teamxiaolan.dawnlib.dusk")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Crafty.LunarConfig")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e4632ce6f5a11747f4c06bd649299a14e82282a1")]
[assembly: AssemblyProduct("LunarConfig")]
[assembly: AssemblyTitle("Crafty.LunarConfig")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.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]
	[Microsoft.CodeAnalysis.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]
	[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 LunarConfig
{
	[BepInPlugin("Crafty.LunarConfig", "LunarConfig", "1.0.0")]
	public class LunarConfig : BaseUnityPlugin
	{
		internal static readonly string EXPORT_DIRECTORY = Path.Combine(Paths.ConfigPath, "LunarConfig");

		internal static readonly string ITEM_FILE_NAME = "LunarConfigItems.cfg";

		internal static readonly string ITEM_FILE = Path.Combine(EXPORT_DIRECTORY, ITEM_FILE_NAME);

		internal static readonly string ENEMY_FILE_NAME = "LunarConfigEnemies.cfg";

		internal static readonly string ENEMY_FILE = Path.Combine(EXPORT_DIRECTORY, ENEMY_FILE_NAME);

		internal static readonly string MOON_FILE_NAME = "LunarConfigMoons.cfg";

		internal static readonly string MOON_FILE = Path.Combine(EXPORT_DIRECTORY, MOON_FILE_NAME);

		internal static readonly string MAP_OBJECT_FILE_NAME = "LunarConfigMapObjects.cfg";

		internal static readonly string MAP_OBJECT_FILE = Path.Combine(EXPORT_DIRECTORY, MAP_OBJECT_FILE_NAME);

		internal static readonly string DUNGEON_FILE_NAME = "LunarConfigDungeons.cfg";

		internal static readonly string DUNGEON_FILE = Path.Combine(EXPORT_DIRECTORY, DUNGEON_FILE_NAME);

		internal static readonly string BUYABLE_FILE_NAME = "LunarConfigUnlockables.cfg";

		internal static readonly string BUYABLE_FILE = Path.Combine(EXPORT_DIRECTORY, BUYABLE_FILE_NAME);

		internal static readonly string CENTRAL_FILE_NAME = "LunarConfigCentral.cfg";

		internal static readonly string CENTRAL_FILE = Path.Combine(Paths.ConfigPath, CENTRAL_FILE_NAME);

		internal static readonly string WEATHER_INJECTION_FILE_NAME = "LunarConfigWeatherInjection.cfg";

		internal static readonly string WEATHER_INJECTION_FILE = Path.Combine(Paths.ConfigPath, WEATHER_INJECTION_FILE_NAME);

		internal static readonly string DUNGEON_INJECTION_FILE_NAME = "LunarConfigDungeonInjection.cfg";

		internal static readonly string DUNGEON_INJECTION_FILE = Path.Combine(Paths.ConfigPath, DUNGEON_INJECTION_FILE_NAME);

		internal static readonly string TAG_INJECTION_FILE_NAME = "LunarConfigTagInjection.cfg";

		internal static readonly string TAG_INJECTION_FILE = Path.Combine(Paths.ConfigPath, TAG_INJECTION_FILE_NAME);

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


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


		internal static Harmony? Harmony { get; set; }

		public static LunarCentral central { get; set; } = new LunarCentral();


		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Patch();
			Logger.LogInfo((object)"Crafty.LunarConfig v1.0.0 has loaded!");
		}

		internal static void Patch()
		{
			//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)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("Crafty.LunarConfig");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll(typeof(RoundManagerPatch));
			Harmony.PatchAll(typeof(StartOfRoundPatch));
			((Registry<DawnItemInfo>)(object)LethalContent.Items).OnFreeze += central.InitItems;
			((Registry<DawnEnemyInfo>)(object)LethalContent.Enemies).OnFreeze += central.InitEnemies;
			((Registry<DawnDungeonInfo>)(object)LethalContent.Dungeons).OnFreeze += central.InitDungeons;
			((Registry<DawnMoonInfo>)(object)LethalContent.Moons).OnFreeze += central.InitMoons;
			((Registry<DawnMapObjectInfo>)(object)LethalContent.MapObjects).OnFreeze += central.InitMapObjects;
			((Registry<DawnUnlockableItemInfo>)(object)LethalContent.Unlockables).OnFreeze += central.InitUnlockables;
			((Registry<DawnWeatherEffectInfo>)(object)LethalContent.Weathers).OnFreeze += central.InitWeatherInjection;
			((Registry<DawnDungeonInfo>)(object)LethalContent.Dungeons).OnFreeze += central.InitDungeonInjection;
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}
	}
	public static class MiniLogger
	{
		private static ManualLogSource logger = Logger.CreateLogSource("LunarConfig");

		public static void LogInfo(string message)
		{
			logger.LogInfo((object)message);
		}

		public static void LogWarning(string message)
		{
			logger.LogWarning((object)message);
		}

		public static void LogError(string message)
		{
			logger.LogError((object)message);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Crafty.LunarConfig";

		public const string PLUGIN_NAME = "LunarConfig";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LunarConfig.Patches
{
	internal class RoundManagerPatch
	{
		[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
		[HarmonyPriority(400)]
		[HarmonyBefore(new string[] { "mrov.WeatherRegistry" })]
		[HarmonyPrefix]
		private static void resetScrapMultipliers(RoundManager __instance)
		{
			try
			{
				__instance.scrapAmountMultiplier = 1f;
				__instance.scrapValueMultiplier = 0.4f;
			}
			catch (Exception arg)
			{
				MiniLogger.LogError($"An error occured while setting moon values, please report this!\n{arg}");
			}
		}

		[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
		[HarmonyPriority(0)]
		[HarmonyAfter(new string[] { "mrov.WeatherRegistry" })]
		[HarmonyPrefix]
		private static void onScrapSpawnPrefix(RoundManager __instance)
		{
			LunarCentral central = LunarConfig.central;
			try
			{
				if (!LunarCentral.configureMoons)
				{
					return;
				}
				LunarConfigFile lunarConfigFile = central.files[LunarConfig.MOON_FILE_NAME];
				DawnMoonInfo dawnInfo = SelectableLevelExtensions.GetDawnInfo(__instance.currentLevel);
				string text = LunarCentral.UUIDify(((object)((DawnBaseInfo<DawnMoonInfo>)(object)dawnInfo).Key).ToString());
				LunarConfigEntry lunarConfigEntry = lunarConfigFile.entries[LunarCentral.NiceifyDawnUUID(text) + " - " + text];
				HashSet<string> enabledMoonSettings = LunarCentral.enabledMoonSettings;
				if (lunarConfigEntry.GetValue<bool>("Configure Content"))
				{
					if (enabledMoonSettings.Contains("Amount Multiplier"))
					{
						__instance.scrapAmountMultiplier *= lunarConfigEntry.GetValue<float>("Amount Multiplier");
					}
					if (enabledMoonSettings.Contains("Value Multiplier"))
					{
						__instance.scrapValueMultiplier *= lunarConfigEntry.GetValue<float>("Value Multiplier");
					}
				}
			}
			catch (Exception arg)
			{
				MiniLogger.LogError($"An error occured while setting moon values, please report this!\n{arg}");
			}
		}
	}
	internal class StartOfRoundPatch
	{
		[HarmonyPatch(typeof(StartOfRound), "SetTimeAndPlanetToSavedSettings")]
		[HarmonyPriority(-2000)]
		[HarmonyPrefix]
		private static void challengePrefix()
		{
			try
			{
				foreach (KeyValuePair<SelectableLevel, bool> definedChallengeMoon in LunarCentral.definedChallengeMoons)
				{
					definedChallengeMoon.Deconstruct(out var key, out var value);
					SelectableLevel val = key;
					bool planetHasTime = value;
					val.planetHasTime = planetHasTime;
				}
			}
			catch (Exception arg)
			{
				MiniLogger.LogError($"An error occured while setting challenge moons, please report this!{arg}");
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "SetTimeAndPlanetToSavedSettings")]
		[HarmonyPriority(-2000)]
		[HarmonyPostfix]
		private static void challengePostfix()
		{
			try
			{
				foreach (KeyValuePair<SelectableLevel, bool> definedChallengeMoonTime in LunarCentral.definedChallengeMoonTimes)
				{
					definedChallengeMoonTime.Deconstruct(out var key, out var value);
					SelectableLevel val = key;
					bool planetHasTime = value;
					val.planetHasTime = planetHasTime;
				}
			}
			catch (Exception arg)
			{
				MiniLogger.LogError($"An error occured while setting challenge moons, please report this!{arg}");
			}
		}
	}
}
namespace LunarConfig.Objects.Config
{
	public class LunarCentral
	{
		public Dictionary<string, LunarConfigFile> files = new Dictionary<string, LunarConfigFile>();

		public static HashSet<string> everyMoonTag = new HashSet<string>();

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

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

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

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

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

		public static Dictionary<string, NamespacedKey<DawnMoonInfo>> moonKeys = new Dictionary<string, NamespacedKey<DawnMoonInfo>>();

		public static Dictionary<string, NamespacedKey<DawnWeatherEffectInfo>> weatherKeys = new Dictionary<string, NamespacedKey<DawnWeatherEffectInfo>>();

		public static Dictionary<string, NamespacedKey<DawnDungeonInfo>> dungeonKeys = new Dictionary<string, NamespacedKey<DawnDungeonInfo>>();

		public static bool clearOrphans = false;

		public static bool backCompat = true;

		public static Dictionary<SelectableLevel, bool> definedChallengeMoons = new Dictionary<SelectableLevel, bool>();

		public static Dictionary<SelectableLevel, bool> definedChallengeMoonTimes = new Dictionary<SelectableLevel, bool>();

		public static bool centralInitialized = false;

		public static bool itemsInitialized = false;

		public static bool enemiesInitialized = false;

		public static bool moonsInitialized = false;

		public static bool dungeonsInitialized = false;

		public static bool mapObjectsInitialized = false;

		public static bool itemWeightsInitialized = false;

		public static bool enemyWeightsInitialized = false;

		public static bool dungeonWeightsInitialized = false;

		public static bool mapObjectCurvesInitialized = false;

		public static bool weatherInjectionInitialized = false;

		public static bool dungeonInjectionInitialized = false;

		public static bool tagInjectionInitialized = false;

		public static bool configureItems = false;

		public static bool configureEnemies = false;

		public static bool configureMoons = false;

		public static bool configureDungeons = false;

		public static bool configureMapObjects = false;

		public static bool configureUnlockables = false;

		public static bool configureWeatherInjection = false;

		public static bool configureDungeonInjection = false;

		public static bool configureTagInjection = false;

		public static bool useZeekScrap = true;

		public static bool useZeekWeight = false;

		public static HashSet<string> enabledItemSettings = new HashSet<string>();

		public static HashSet<string> enabledEnemySettings = new HashSet<string>();

		public static HashSet<string> enabledMoonSettings = new HashSet<string>();

		public static HashSet<string> enabledDungeonSettings = new HashSet<string>();

		public static HashSet<string> enabledMapObjectSettings = new HashSet<string>();

		public static HashSet<string> enabledUnlockableSettings = new HashSet<string>();

		public static HashSet<string> enabledWeatherInjectionSettings = new HashSet<string>();

		public static HashSet<string> enabledDungeonInjectionSettings = new HashSet<string>();

		public static HashSet<string> enabledTagInjectionSettings = new HashSet<string>();

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

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

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

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

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

		public static Dictionary<NamespacedKey<DawnMoonInfo>, Dictionary<string, string>> cachedInsideMapObjects = new Dictionary<NamespacedKey<DawnMoonInfo>, Dictionary<string, string>>();

		public static Dictionary<NamespacedKey<DawnMoonInfo>, Dictionary<string, string>> cachedOutsideMapObjects = new Dictionary<NamespacedKey<DawnMoonInfo>, Dictionary<string, string>>();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		public static Dictionary<string, Dictionary<NamespacedKey<DawnMoonInfo>, AnimationCurve>> defaultInsideMapObjectCurves = new Dictionary<string, Dictionary<NamespacedKey<DawnMoonInfo>, AnimationCurve>>();

		public static Dictionary<string, Dictionary<NamespacedKey<DawnMoonInfo>, AnimationCurve>> defaultOutsideMapObjectCurves = new Dictionary<string, Dictionary<NamespacedKey<DawnMoonInfo>, AnimationCurve>>();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		public static HashSet<DawnMoonInfo> notConfiguredScrapMoons = new HashSet<DawnMoonInfo>();

		public static HashSet<DawnMoonInfo> notConfiguredDaytimeMoons = new HashSet<DawnMoonInfo>();

		public static HashSet<DawnMoonInfo> notConfiguredInteriorMoons = new HashSet<DawnMoonInfo>();

		public static HashSet<DawnMoonInfo> notConfiguredOutsideMoons = new HashSet<DawnMoonInfo>();

		public static HashSet<DawnMoonInfo> notConfiguredDungeonMoons = new HashSet<DawnMoonInfo>();

		public static HashSet<DawnMoonInfo> notConfiguredInsideMapObjectMoons = new HashSet<DawnMoonInfo>();

		public static HashSet<DawnMoonInfo> notConfiguredOutsideMapObjectMoons = new HashSet<DawnMoonInfo>();

		public static string UUIDify(string uuid)
		{
			return uuid.Replace("=", "").Replace("\n", "").Replace("\t", "")
				.Replace("\\", "")
				.Replace("\"", "")
				.Replace("'", "")
				.Replace("[", "")
				.Replace("]", "");
		}

		public static string CleanString(string str)
		{
			return RemoveWhitespace(str.ToLower());
		}

		public static string CleanNumber(string str)
		{
			return RemoveWhitespace(str).Replace("=", "").Replace("+", "").Replace("*", "")
				.Replace("/", "");
		}

		public static string NiceifyDawnUUID(string uuid)
		{
			TextInfo textInfo = Thread.CurrentThread.CurrentCulture.TextInfo;
			string text = uuid;
			if (uuid.Contains(":"))
			{
				text = uuid.Split(":")[1];
			}
			return textInfo.ToTitleCase(text.Replace("_", " "));
		}

		public static string RemoveWhitespace(string input)
		{
			return new string((from c in input.ToCharArray()
				where !char.IsWhiteSpace(c)
				select c).ToArray());
		}

		public string CurveToString(AnimationCurve curve)
		{
			return ConfigManager.ParseString(curve);
		}

		public string? GetDawnUUID(Dictionary<string, string> dic, string uuid)
		{
			string result = null;
			try
			{
				result = dic[CleanString(uuid)];
			}
			catch
			{
				MiniLogger.LogWarning("Could not find " + uuid + " in dictionaries. Check your config files!");
			}
			return result;
		}

		public static void MigrateSection(ConfigFile config, string oldSection, string newSection)
		{
			string newSection2 = newSection;
			PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
			if (propertyInfo == null)
			{
				return;
			}
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(config);
			if (dictionary == null || dictionary.Count == 0)
			{
				return;
			}
			foreach (KeyValuePair<ConfigDefinition, string> item in dictionary.ToList())
			{
				ConfigDefinition oldDef = item.Key;
				string value = item.Value;
				if (oldDef.Section.StartsWith(oldSection))
				{
					ConfigEntryBase val = ((IEnumerable<ConfigEntryBase>)config.GetConfigEntries()).FirstOrDefault((Func<ConfigEntryBase, bool>)((ConfigEntryBase e) => e.Definition.Section == newSection2 && e.Definition.Key == oldDef.Key));
					if (val != null)
					{
						val.SetSerializedValue(value);
					}
				}
			}
		}

		public static void ClearOrphanedEntries(ConfigFile cfg)
		{
			if (clearOrphans)
			{
				PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
				Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg);
				dictionary.Clear();
			}
		}

		public static AnimationCurve StringToCurve(string data)
		{
			return ConfigManager.ParseCurve(data);
		}

		public static void TrySetInsideCurve(string item, AnimationCurve curve, NamespacedKey<DawnMoonInfo> moon)
		{
			if (curve.keys.Length != 0)
			{
				if (!defaultInsideMapObjectCurves.TryGetValue(item, out Dictionary<NamespacedKey<DawnMoonInfo>, AnimationCurve> value))
				{
					value = new Dictionary<NamespacedKey<DawnMoonInfo>, AnimationCurve>();
					defaultInsideMapObjectCurves[item] = value;
				}
				value[moon] = curve;
			}
		}

		public static void TrySetOutsideCurve(string item, AnimationCurve curve, NamespacedKey<DawnMoonInfo> moon)
		{
			if (curve.keys.Length != 0)
			{
				if (!defaultOutsideMapObjectCurves.TryGetValue(item, out Dictionary<NamespacedKey<DawnMoonInfo>, AnimationCurve> value))
				{
					value = new Dictionary<NamespacedKey<DawnMoonInfo>, AnimationCurve>();
					defaultOutsideMapObjectCurves[item] = value;
				}
				value[moon] = curve;
			}
		}

		public static string ComprehendWeights(string weightString)
		{
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			Dictionary<string, float> dictionary2 = new Dictionary<string, float>();
			string[] array = weightString.Split(",");
			string[] array2 = array;
			foreach (string text in array2)
			{
				try
				{
					string[] array3 = text.Split(":");
					string key = array3[0] + ":" + array3[1];
					string text2 = array3[2];
					if (text2.Contains("*"))
					{
						dictionary2[key] = dictionary2.GetValueOrDefault(key, 1f) * float.Parse(CleanNumber(text2));
					}
					else if (text2.Contains("/"))
					{
						dictionary2[key] = dictionary2.GetValueOrDefault(key, 1f) / float.Parse(CleanNumber(text2));
					}
					else
					{
						dictionary[key] = dictionary.GetValueOrDefault(key, 0) + int.Parse(CleanNumber(text2));
					}
				}
				catch
				{
				}
			}
			dictionary = dictionary.Where((KeyValuePair<string, int> kvp) => kvp.Value > 0).ToDictionary((KeyValuePair<string, int> kvp) => kvp.Key, (KeyValuePair<string, int> kvp) => kvp.Value);
			dictionary2 = dictionary2.Where((KeyValuePair<string, float> kvp) => kvp.Value != 1f).ToDictionary((KeyValuePair<string, float> kvp) => kvp.Key, (KeyValuePair<string, float> kvp) => kvp.Value);
			return string.Join(", ", dictionary.Select((KeyValuePair<string, int> kvp) => $"{kvp.Key}=+{kvp.Value}")) + ((dictionary.Count > 0 && dictionary2.Count > 0) ? ", " : "") + string.Join(", ", dictionary2.Select((KeyValuePair<string, float> kvp) => $"{kvp.Key}=*{kvp.Value}"));
		}

		public void InitConfig()
		{
			LunarConfigEntry lunarConfigEntry = files[LunarConfig.CENTRAL_FILE_NAME].entries["Configuration"];
		}

		public void InitCentral()
		{
			MiniLogger.LogInfo("Initializing Central");
			LunarConfigFile lunarConfigFile = AddFile(LunarConfig.CENTRAL_FILE, LunarConfig.CENTRAL_FILE_NAME);
			lunarConfigFile.file.SaveOnConfigSet = false;
			LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry("Configuration");
			lunarConfigEntry.AddField("Configure Items", "Check this to generate and use configuration files for items.", defaultValue: true);
			lunarConfigEntry.AddField("Configure Enemies", "Check this to generate and use configuration files for enemies.", defaultValue: true);
			lunarConfigEntry.AddField("Configure Moons", "Check this to generate and use configuration files for moons.", defaultValue: true);
			lunarConfigEntry.AddField("Configure Dungeons", "Check this to generate and use configuration files for dungeons.", defaultValue: true);
			lunarConfigEntry.AddField("Configure Map Objects", "Check this to generate and use configuration files for map objects.", defaultValue: true);
			lunarConfigEntry.AddField("Configure Unlockables", "Check this to generate and use configuration files for unlockables.", defaultValue: true);
			lunarConfigEntry.AddField("Configure Weather Injection", "Check this to generate and use configuration files for weather injection.", defaultValue: true);
			lunarConfigEntry.AddField("Configure Dungeon Injection", "Check this to generate and use configuration files for dungeon injection.", defaultValue: true);
			lunarConfigEntry.AddField("Configure Tag Injection", "Check this to generate and use configuration files for tag injection.", defaultValue: true);
			lunarConfigEntry.AddField("Enable Backwards Compat", "Allows Lunar to look for config entries that are named using the previous v0.1.x system, I would advise turning this off after you have all your previous values.", defaultValue: false);
			lunarConfigEntry.AddField("Clear Orphaned Entries", "WARNING: Enabling this will delete any config entries that get disabled when the configuration is refreshed!", defaultValue: false);
			lunarConfigEntry.AddField("Use Simple Scrap Value", "Checking this will make items have a scrap value that already anticipates the *0.4.", defaultValue: false);
			lunarConfigEntry.AddField("Use Simple Weight", "Checking this will make items have their weight in pounds, already converting from Zeeker's formula.", defaultValue: false);
			backCompat = lunarConfigEntry.GetValue<bool>("Enable Backwards Compat");
			clearOrphans = lunarConfigEntry.GetValue<bool>("Clear Orphaned Entries");
			configureItems = lunarConfigEntry.GetValue<bool>("Configure Items");
			configureEnemies = lunarConfigEntry.GetValue<bool>("Configure Enemies");
			configureMoons = lunarConfigEntry.GetValue<bool>("Configure Moons");
			configureDungeons = lunarConfigEntry.GetValue<bool>("Configure Dungeons");
			configureMapObjects = lunarConfigEntry.GetValue<bool>("Configure Map Objects");
			configureUnlockables = lunarConfigEntry.GetValue<bool>("Configure Unlockables");
			configureWeatherInjection = lunarConfigEntry.GetValue<bool>("Configure Weather Injection");
			configureDungeonInjection = lunarConfigEntry.GetValue<bool>("Configure Dungeon Injection");
			configureTagInjection = lunarConfigEntry.GetValue<bool>("Configure Tag Injection");
			useZeekScrap = !lunarConfigEntry.GetValue<bool>("Use Simple Scrap Value");
			useZeekWeight = !lunarConfigEntry.GetValue<bool>("Use Simple Weight");
			if (configureItems)
			{
				LunarConfigEntry lunarConfigEntry2 = lunarConfigFile.AddEntry("Enabled Item Settings");
				lunarConfigEntry2.AddField("Display Name", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry2.AddField("Scan Name", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry2.AddField("Scan Subtext", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry2.AddField("Scan Min Range", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry2.AddField("Scan Max Range", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry2.AddField("Minimum Value", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry2.AddField("Maximum Value", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry2.AddField("Weight", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry2.AddField("Conductivity", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry2.AddField("Two-Handed", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry2.AddField("Is Scrap?", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry2.AddField("Sold In Shop?", "Enable this to enable configuring this property in item config entries.", defaultValue: false);
				lunarConfigEntry2.AddField("Info Node Text", "Enable this to enable configuring this property in item config entries.", defaultValue: false);
				lunarConfigEntry2.AddField("Request Node Text", "Enable this to enable configuring this property in item config entries.", defaultValue: false);
				lunarConfigEntry2.AddField("Receipt Node Text", "Enable this to enable configuring this property in item config entries.", defaultValue: false);
				lunarConfigEntry2.AddField("Cost", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry2.AddField("Tags", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				foreach (string key in lunarConfigEntry2.fields.Keys)
				{
					if (lunarConfigEntry2.GetValue<bool>(key))
					{
						enabledItemSettings.Add(key);
					}
				}
			}
			if (configureEnemies)
			{
				LunarConfigEntry lunarConfigEntry3 = lunarConfigFile.AddEntry("Enabled Enemy Settings");
				lunarConfigEntry3.AddField("Display Name", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Scan Name", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Scan Subtext", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Scan Min Range", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Scan Max Range", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Can See Through Fog?", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Door Speed Multiplier", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Is Daytime Enemy?", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Is Outdoor Enemy?", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Loudness Multiplier", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Max Count", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Power Level", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Probability Curve", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Use Falloff?", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Falloff Curve", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Group Spawn Count", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Normalized Time To Leave", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Enemy HP", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Can Die?", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Destroy On Death?", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Can Destroy?", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Can Stun?", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Stun Difficulty", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Stun Time", "Disable this to disable configuring this property in enemy config entries.", defaultValue: true);
				lunarConfigEntry3.AddField("Bestiary Text", "Enable this to enable configuring this property in enemy config entries.", defaultValue: false);
				lunarConfigEntry3.AddField("Bestiary Keyword", "Enable this to enable configuring this property in enemy config entries.", defaultValue: false);
				lunarConfigEntry3.AddField("Tags", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				foreach (string key2 in lunarConfigEntry3.fields.Keys)
				{
					if (lunarConfigEntry3.GetValue<bool>(key2))
					{
						enabledEnemySettings.Add(key2);
					}
				}
			}
			if (configureMoons)
			{
				LunarConfigEntry lunarConfigEntry4 = lunarConfigFile.AddEntry("Enabled Moon Settings");
				lunarConfigEntry4.AddField("Display Name", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Risk Level", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Description", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Route Price", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Is Hidden? & Is Locked?", "Disable this to disable configuring these properties in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Can Be Challenge Moon?", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Has Time?", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Time Multiplier", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Daytime Probability Range", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Daytime Curve", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Max Daytime Power", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Spawnable Daytime Enemies", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Interior Probability Range", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Interior Curve", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Max Interior Power", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Spawnable Interior Enemies", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Outside Curve", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Max Outside Power", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Spawnable Outside Enemies", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Min Scrap", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Max Scrap", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Min Scrap Total", "Enable this to enable configuring this property in moon config entries.", defaultValue: false);
				lunarConfigEntry4.AddField("Max Scrap Total", "Enable this to enable configuring this property in moon config entries.", defaultValue: false);
				lunarConfigEntry4.AddField("Interior Multiplier", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Value Multiplier", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Amount Multiplier", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Spawnable Scrap", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Possible Interiors", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				lunarConfigEntry4.AddField("Tags", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				foreach (string key3 in lunarConfigEntry4.fields.Keys)
				{
					if (lunarConfigEntry4.GetValue<bool>(key3))
					{
						enabledMoonSettings.Add(key3);
					}
				}
			}
			if (configureDungeons)
			{
				LunarConfigEntry lunarConfigEntry5 = lunarConfigFile.AddEntry("Enabled Dungeon Settings");
				lunarConfigEntry5.AddField("Random Size Min", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry5.AddField("Random Size Max", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry5.AddField("Map Tile Size", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry5.AddField("Clamp Range Min", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry5.AddField("Clamp Range Max", "Disable this to disable configuring this property in item config entries.", defaultValue: true);
				lunarConfigEntry5.AddField("Tags", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				foreach (string key4 in lunarConfigEntry5.fields.Keys)
				{
					if (lunarConfigEntry5.GetValue<bool>(key4))
					{
						enabledDungeonSettings.Add(key4);
					}
				}
			}
			if (configureMapObjects)
			{
				LunarConfigEntry lunarConfigEntry6 = lunarConfigFile.AddEntry("Enabled Map Object Settings");
				lunarConfigEntry6.AddField("(Inside) Face Away From Wall?", "Disable this to disable configuring this property in map object config entries.", defaultValue: true);
				lunarConfigEntry6.AddField("(Inside) Face Towards Wall?", "Disable this to disable configuring this property in map object config entries.", defaultValue: true);
				lunarConfigEntry6.AddField("(Inside) Disallow Near Entrance?", "Disable this to disable configuring this property in map object config entries.", defaultValue: true);
				lunarConfigEntry6.AddField("(Inside) Require Distance Between Spawns?", "Disable this to disable configuring this property in map object config entries.", defaultValue: true);
				lunarConfigEntry6.AddField("(Inside) Flush Against Wall?", "Disable this to disable configuring this property in map object config entries.", defaultValue: true);
				lunarConfigEntry6.AddField("(Inside) Spawn Against Wall?", "Disable this to disable configuring this property in map object config entries.", defaultValue: true);
				lunarConfigEntry6.AddField("(Inside) Level Curves", "Disable this to disable configuring this property in map object config entries.", defaultValue: true);
				lunarConfigEntry6.AddField("(Outside) Align With Terrain?", "Disable this to disable configuring this property in map object config entries.", defaultValue: true);
				lunarConfigEntry6.AddField("(Outside) Object Width", "Disable this to disable configuring this property in map object config entries.", defaultValue: true);
				lunarConfigEntry6.AddField("(Outside) Spawnable Floor Tags", "Disable this to disable configuring this property in map object config entries.", defaultValue: true);
				lunarConfigEntry6.AddField("(Outside) Face Away From Wall?", "Disable this to disable configuring this property in map object config entries.", defaultValue: true);
				lunarConfigEntry6.AddField("(Outside) Level Curves", "Disable this to disable configuring this property in map object config entries.", defaultValue: true);
				lunarConfigEntry6.AddField("Tags", "Disable this to disable configuring this property in moon config entries.", defaultValue: true);
				foreach (string key5 in lunarConfigEntry6.fields.Keys)
				{
					if (lunarConfigEntry6.GetValue<bool>(key5))
					{
						enabledMapObjectSettings.Add(key5);
					}
				}
			}
			if (configureUnlockables)
			{
				LunarConfigEntry lunarConfigEntry7 = lunarConfigFile.AddEntry("Enabled Unlockable Settings");
				lunarConfigEntry7.AddField("Already Unlocked", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry7.AddField("Always In Stock", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry7.AddField("Can Store?", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry7.AddField("Is Placeable?", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry7.AddField("Luck Value", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry7.AddField("Max Number", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry7.AddField("Unlocked In Challenge File", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry7.AddField("Buy Keyword", "Enable this to enable configuring this property in unlockable config entries.", defaultValue: false);
				lunarConfigEntry7.AddField("Confirm Node Text", "Enable this to enable configuring this property in unlockable config entries.", defaultValue: false);
				lunarConfigEntry7.AddField("Info Node Text", "Enable this to enable configuring this property in unlockable config entries.", defaultValue: false);
				lunarConfigEntry7.AddField("Request Node Text", "Enable this to enable configuring this property in unlockable config entries.", defaultValue: false);
				lunarConfigEntry7.AddField("Shop Selection Node Text", "Enable this to enable configuring this property in unlockable config entries.", defaultValue: false);
				lunarConfigEntry7.AddField("Cost", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry7.AddField("Tags", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				foreach (string key6 in lunarConfigEntry7.fields.Keys)
				{
					if (lunarConfigEntry7.GetValue<bool>(key6))
					{
						enabledUnlockableSettings.Add(key6);
					}
				}
			}
			if (configureWeatherInjection)
			{
				LunarConfigEntry lunarConfigEntry8 = lunarConfigFile.AddEntry("Enabled Weather Injection Settings");
				lunarConfigEntry8.AddField("Spawnable Scrap", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry8.AddField("Spawnable Daytime Enemies", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry8.AddField("Spawnable Interior Enemies", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry8.AddField("Spawnable Outside Enemies", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry8.AddField("Possible Interiors", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				foreach (string key7 in lunarConfigEntry8.fields.Keys)
				{
					if (lunarConfigEntry8.GetValue<bool>(key7))
					{
						enabledWeatherInjectionSettings.Add(key7);
					}
				}
			}
			if (configureDungeonInjection)
			{
				LunarConfigEntry lunarConfigEntry9 = lunarConfigFile.AddEntry("Enabled Dungeon Injection Settings");
				lunarConfigEntry9.AddField("Spawnable Scrap", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry9.AddField("Spawnable Daytime Enemies", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry9.AddField("Spawnable Interior Enemies", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry9.AddField("Spawnable Outside Enemies", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				foreach (string key8 in lunarConfigEntry9.fields.Keys)
				{
					if (lunarConfigEntry9.GetValue<bool>(key8))
					{
						enabledDungeonInjectionSettings.Add(key8);
					}
				}
			}
			if (configureTagInjection)
			{
				LunarConfigEntry lunarConfigEntry10 = lunarConfigFile.AddEntry("Enabled Tag Injection Settings");
				lunarConfigEntry10.AddField("Spawnable Scrap", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry10.AddField("Spawnable Daytime Enemies", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry10.AddField("Spawnable Interior Enemies", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry10.AddField("Spawnable Outside Enemies", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				lunarConfigEntry10.AddField("Possible Interiors", "Disable this to disable configuring this property in unlockable config entries.", defaultValue: true);
				foreach (string key9 in lunarConfigEntry10.fields.Keys)
				{
					if (lunarConfigEntry10.GetValue<bool>(key9))
					{
						enabledTagInjectionSettings.Add(key9);
					}
				}
			}
			ClearOrphanedEntries(lunarConfigFile.file);
			lunarConfigFile.file.Save();
			lunarConfigFile.file.SaveOnConfigSet = true;
			everyMoonTag.Add("all");
			everyMoonTag.Add("free");
			everyMoonTag.Add("paid");
			everyMoonTag.Add("custom");
			everyMoonTag.Add("vanilla");
			centralInitialized = true;
		}

		public void InitItems()
		{
			//IL_060d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0617: Expected O, but got Unknown
			//IL_0644: Unknown result type (might be due to invalid IL or missing references)
			//IL_064e: Expected O, but got Unknown
			//IL_0a48: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4f: Expected O, but got Unknown
			//IL_0a59: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a63: Expected O, but got Unknown
			//IL_098c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0996: Expected O, but got Unknown
			if (!centralInitialized)
			{
				InitCentral();
			}
			MiniLogger.LogInfo("Initializing Items");
			if (configureItems)
			{
				LunarConfigFile lunarConfigFile = AddFile(LunarConfig.ITEM_FILE, LunarConfig.ITEM_FILE_NAME);
				lunarConfigFile.file.SaveOnConfigSet = false;
				foreach (KeyValuePair<NamespacedKey<DawnItemInfo>, DawnItemInfo> item2 in (Registry<DawnItemInfo>)(object)LethalContent.Items)
				{
					string text = UUIDify(((object)item2.Key).ToString());
					try
					{
						string text2 = NiceifyDawnUUID(text);
						DawnItemInfo value = item2.Value;
						LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text);
						Item item = value.Item;
						ScanNodeProperties val = null;
						DawnShopItemInfo val2 = null;
						DawnPurchaseInfo val3 = null;
						TerminalNode val4 = null;
						TerminalNode val5 = null;
						TerminalNode val6 = null;
						if ((Object)(object)item.spawnPrefab != (Object)null)
						{
							val = item.spawnPrefab.GetComponentInChildren<ScanNodeProperties>();
						}
						if (value.ShopInfo != null)
						{
							val2 = value.ShopInfo;
							if ((Object)(object)val2.InfoNode != (Object)null)
							{
								val4 = val2.InfoNode;
							}
							if ((Object)(object)val2.RequestNode != (Object)null)
							{
								val5 = val2.RequestNode;
							}
							if ((Object)(object)val2.ReceiptNode != (Object)null)
							{
								val6 = val2.ReceiptNode;
							}
							if (val2.DawnPurchaseInfo != null)
							{
								val3 = val2.DawnPurchaseInfo;
							}
						}
						lunarConfigEntry.AddField("Configure Content", "Enable to change any of the settings below.", defaultValue: false);
						lunarConfigEntry.AddField("Appropriate Aliases", "These are the names which LunarConfig will recognize as this object in other config options.\nThey are case-insensitve and do not regard whitespace.", item.itemName + ", " + ((Object)item).name + ", " + text2);
						lunarConfigEntry.TryAddField(enabledItemSettings, "Display Name", "Specifies the name that appears on the item's tooltip.", item.itemName);
						if ((Object)(object)val != (Object)null)
						{
							lunarConfigEntry.TryAddField(enabledItemSettings, "Scan Name", "Specifies the name of the item that appears on its scan node.", val.headerText);
							lunarConfigEntry.TryAddField(enabledItemSettings, "Scan Subtext", "Specifies the subtext that appears on the item's scan node. NOTE: This setting may be overridden if the item has a scrap value.", val.subText);
							lunarConfigEntry.TryAddField(enabledItemSettings, "Scan Min Range", "Specifies the minimum distance the scan node can be scanned.", val.minRange);
							lunarConfigEntry.TryAddField(enabledItemSettings, "Scan Max Range", "Specifies the maximum distance the scan node can be scanned.", val.maxRange);
						}
						lunarConfigEntry.TryAddField(enabledItemSettings, "Minimum Value", "The minimum scrap value and item can have.\nTypically multiplied by 0.4, setting not applicable to non-scrap.\nDoes not work on items like Apparatus and items from enemies (Hives, Double-barrel).", useZeekScrap ? item.minValue : ((int)Math.Round((double)item.minValue * 0.4)));
						lunarConfigEntry.TryAddField(enabledItemSettings, "Maximum Value", "The maximum scrap value and item can have.\nTypically multiplied by 0.4, setting not applicable to non-scrap.\nDoes not work on items like Apparatus and items from enemies (Hives, Double-barrel).", useZeekScrap ? item.maxValue : ((int)Math.Round((double)item.maxValue * 0.4)));
						lunarConfigEntry.TryAddField(enabledItemSettings, "Weight", "Specifies the weight of an item.\nCalculated with: (x - 1) * 105 = weight in pounds.", useZeekWeight ? item.weight : ((item.weight - 1f) * 105f));
						lunarConfigEntry.TryAddField(enabledItemSettings, "Conductivity", "Specifies whether an item is conductive.", item.isConductiveMetal);
						lunarConfigEntry.TryAddField(enabledItemSettings, "Two-Handed", "Specifies whether an item is two-handed.", item.twoHanded);
						lunarConfigEntry.TryAddField(enabledItemSettings, "Is Scrap?", "Specifies if an item is scrap or gear.\nThis decides whether an item can be sold to the company for credits.", item.isScrap);
						string defaultValue = "This is probably an item.";
						string defaultValue2 = "You are trying to buy an item.";
						string defaultValue3 = "You bought an item!";
						int defaultValue4 = 15;
						if ((Object)(object)val4 != (Object)null)
						{
							defaultValue = val4.displayText.Replace("\n", ";");
						}
						if ((Object)(object)val5 != (Object)null)
						{
							defaultValue2 = val5.displayText.Replace("\n", ";");
						}
						if ((Object)(object)val6 != (Object)null)
						{
							defaultValue3 = val6.displayText.Replace("\n", ";");
						}
						if (val3 != null)
						{
							defaultValue4 = val3.Cost.Provide();
						}
						lunarConfigEntry.TryAddField(enabledItemSettings, "Sold In Shop?", "Whether or not an item is sold in the shop. If you are enabling this on an item that has it false by default, I advise you change the settings below.", val2 != null);
						lunarConfigEntry.TryAddField(enabledItemSettings, "Info Node Text", "The text of the terminal when viewing the info of an item. New lines are represented by semi-colons.", defaultValue);
						lunarConfigEntry.TryAddField(enabledItemSettings, "Request Node Text", "The text of the terminal when requesting an item. New lines are represented by semi-colons.", defaultValue2);
						lunarConfigEntry.TryAddField(enabledItemSettings, "Receipt Node Text", "The text of the terminal after purchasing an item. New lines are represented by semi-colons.", defaultValue3);
						lunarConfigEntry.TryAddField(enabledItemSettings, "Cost", "The cost of the item if it is sold in the shop.", defaultValue4);
						lunarConfigEntry.TryAddField(enabledItemSettings, "Tags", "Tags allocated to the item.\nSeparate tags with commas.", string.Join(", ", from tag in ((DawnBaseInfo<DawnItemInfo>)(object)value).AllTags()
							where tag.Namespace != "dawn_lib"
							select tag));
						if (backCompat)
						{
							MigrateSection(lunarConfigFile.file, "LLL - " + item.itemName, text2 + " - " + text);
						}
						if (backCompat)
						{
							MigrateSection(lunarConfigFile.file, "LL - " + item.itemName, text2 + " - " + text);
						}
						if (lunarConfigEntry.GetValue<bool>("Configure Content"))
						{
							if (enabledItemSettings.Contains("Tags"))
							{
								HashSet<NamespacedKey> hashSet = new HashSet<NamespacedKey>();
								string[] array = RemoveWhitespace(lunarConfigEntry.GetValue<string>("Tags")).ToLower().Split(",");
								foreach (string text3 in array)
								{
									string[] array2 = text3.Split(":");
									if (array2.Length == 1 && !Utility.IsNullOrWhiteSpace(array2[0]))
									{
										hashSet.Add(new NamespacedKey("lunarcontenttag", array2[0]));
									}
									else if (array2.Length == 2 && array2[0] != "dawn_lib")
									{
										hashSet.Add(new NamespacedKey(array2[0], array2[1]));
									}
									else
									{
										MiniLogger.LogWarning("Incorrectly formatted tag '" + text3 + "' found on " + text);
									}
								}
								foreach (NamespacedKey tag in ((DawnBaseInfo<DawnItemInfo>)(object)value)._tags)
								{
									if (tag.Namespace == "dawn_lib")
									{
										hashSet.Add(tag);
									}
								}
								((DawnBaseInfo<DawnItemInfo>)(object)value)._tags = hashSet;
							}
							((DawnBaseInfo<DawnItemInfo>)(object)value).Internal_AddTag(DawnLibTags.LunarConfig);
							string[] array3 = lunarConfigEntry.GetValue<string>("Appropriate Aliases").Split(",");
							foreach (string text4 in array3)
							{
								if (!Utility.IsNullOrWhiteSpace(text4))
								{
									items[CleanString(text4)] = text;
								}
							}
							lunarConfigEntry.TrySetValue(enabledItemSettings, "Display Name", ref item.itemName);
							if ((Object)(object)val != (Object)null)
							{
								lunarConfigEntry.TrySetValue(enabledItemSettings, "Scan Name", ref val.headerText);
								lunarConfigEntry.TrySetValue(enabledItemSettings, "Scan Subtext", ref val.subText);
								lunarConfigEntry.TrySetValue(enabledItemSettings, "Scan Min Range", ref val.minRange);
								lunarConfigEntry.TrySetValue(enabledItemSettings, "Scan Max Range", ref val.maxRange);
							}
							if (useZeekScrap)
							{
								lunarConfigEntry.TrySetValue(enabledItemSettings, "Minimum Value", ref item.minValue);
								lunarConfigEntry.TrySetValue(enabledItemSettings, "Maximum Value", ref item.maxValue);
							}
							else
							{
								if (enabledItemSettings.Contains("Minimum Value"))
								{
									item.minValue = (int)Math.Round((double)lunarConfigEntry.GetValue<int>("Minimum Value") * 2.5);
								}
								if (enabledItemSettings.Contains("Maximum Value"))
								{
									item.maxValue = (int)Math.Round((double)lunarConfigEntry.GetValue<int>("Maximum Value") * 2.5);
								}
							}
							if (useZeekWeight)
							{
								lunarConfigEntry.TrySetValue(enabledItemSettings, "Weight", ref item.weight);
							}
							else if (enabledItemSettings.Contains("Weight"))
							{
								item.weight = lunarConfigEntry.GetValue<float>("Weight") / 105f + 1f;
							}
							lunarConfigEntry.TrySetValue(enabledItemSettings, "Conductivity", ref item.isConductiveMetal);
							lunarConfigEntry.TrySetValue(enabledItemSettings, "Two-Handed", ref item.twoHanded);
							lunarConfigEntry.TrySetValue(enabledItemSettings, "Is Scrap?", ref item.isScrap);
							if (enabledItemSettings.Contains("Sold In Shop?"))
							{
								if (val2 != null)
								{
									if (!lunarConfigEntry.GetValue<bool>("Sold In Shop?") && val3 != null)
									{
										val3.PurchasePredicate = (ITerminalPurchasePredicate)new ConstantTerminalPredicate((TerminalPurchaseResult)(object)TerminalPurchaseResult.Hidden().SetFailure(true));
									}
								}
								else if (lunarConfigEntry.GetValue<bool>("Sold In Shop?"))
								{
									TerminalNode val7 = ScriptableObject.CreateInstance<TerminalNode>();
									TerminalNode val8 = ScriptableObject.CreateInstance<TerminalNode>();
									TerminalNode val9 = ScriptableObject.CreateInstance<TerminalNode>();
									((Object)val7).name = "info_" + text;
									val7.displayText = "This is probably an item.";
									((Object)val8).name = "request_" + text;
									val8.displayText = "You are trying to buy an item.";
									val8.itemCost = 15;
									((Object)val9).name = "receipt_" + text;
									val9.displayText = "You bought an item!";
									val9.itemCost = 15;
									DawnPurchaseInfo val10 = new DawnPurchaseInfo((IProvider<int>)(object)new SimpleProvider<int>(15), ITerminalPurchasePredicate.AlwaysSuccess());
									value.ShopInfo = new DawnShopItemInfo(val10, val7, val8, val9);
									val2 = value.ShopInfo;
									val4 = val2.InfoNode;
									val5 = val2.RequestNode;
									val6 = val2.ReceiptNode;
									val3 = val2.DawnPurchaseInfo;
									val2.ParentInfo = value;
									ItemRegistrationHandler.TryRegisterItemIntoShop(item);
								}
							}
							if ((Object)(object)val4 != (Object)null && enabledItemSettings.Contains("Info Node Text"))
							{
								val4.displayText = lunarConfigEntry.GetValue<string>("Info Node Text").Replace(";", "\n");
							}
							if ((Object)(object)val5 != (Object)null && enabledItemSettings.Contains("Request Node Text"))
							{
								val5.displayText = lunarConfigEntry.GetValue<string>("Request Node Text").Replace(";", "\n");
							}
							if ((Object)(object)val6 != (Object)null && enabledItemSettings.Contains("Receipt Node Text"))
							{
								val6.displayText = lunarConfigEntry.GetValue<string>("Receipt Node Text").Replace(";", "\n");
							}
							if (val3 != null && enabledItemSettings.Contains("Cost"))
							{
								val3.Cost = (IProvider<int>)(object)new SimpleProvider<int>(lunarConfigEntry.GetValue<int>("Cost"));
							}
						}
						else
						{
							items[CleanString(item2.Value.Item.itemName)] = text;
							items[CleanString(((Object)item2.Value.Item).name)] = text;
							items[CleanString(text2)] = text;
						}
					}
					catch (Exception arg)
					{
						MiniLogger.LogError($"LunarConfig encountered an issue while configuring {text}, please report this!\n{arg}");
					}
				}
				ClearOrphanedEntries(lunarConfigFile.file);
				lunarConfigFile.file.Save();
				lunarConfigFile.file.SaveOnConfigSet = true;
			}
			else
			{
				foreach (KeyValuePair<NamespacedKey<DawnItemInfo>, DawnItemInfo> item3 in (Registry<DawnItemInfo>)(object)LethalContent.Items)
				{
					string text5 = UUIDify(((object)item3.Key).ToString());
					items[CleanString(item3.Value.Item.itemName)] = text5;
					items[CleanString(((Object)item3.Value.Item).name)] = text5;
					items[CleanString(NiceifyDawnUUID(text5))] = text5;
				}
			}
			itemsInitialized = true;
			MiniLogger.LogInfo("Completed Initializing Items");
			InitItemWeights();
		}

		public void InitItemWeights()
		{
			//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c6: Expected O, but got Unknown
			//IL_067c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Expected O, but got Unknown
			if ((!enabledMoonSettings.Contains("Spawnable Scrap") && !enabledWeatherInjectionSettings.Contains("Spawnable Scrap") && !enabledDungeonInjectionSettings.Contains("Spawnable Scrap") && !enabledTagInjectionSettings.Contains("Spawnable Scrap")) || !moonsInitialized || !itemsInitialized || !weatherInjectionInitialized || !dungeonInjectionInitialized || !tagInjectionInitialized || itemWeightsInitialized)
			{
				return;
			}
			MiniLogger.LogInfo("Initializing Item Weights");
			foreach (KeyValuePair<string, string> item in cachedSpawnableScrap)
			{
				string[] array = item.Value.Split(",");
				foreach (string text in array)
				{
					string[] array2 = text.Split(":");
					string uuid = array2[0];
					string dawnUUID = GetDawnUUID(items, uuid);
					if (dawnUUID != null)
					{
						itemWeightString[dawnUUID] = itemWeightString.GetValueOrDefault(dawnUUID, "") + item.Key + ":" + CleanString(array2[1]) + ",";
					}
				}
			}
			foreach (KeyValuePair<string, string> item2 in cachedWeatherSpawnableScrap)
			{
				string[] array3 = item2.Value.Split(",");
				foreach (string text2 in array3)
				{
					string[] array4 = text2.Split(":");
					string uuid2 = array4[0];
					string dawnUUID2 = GetDawnUUID(items, uuid2);
					if (dawnUUID2 != null)
					{
						itemWeatherString[dawnUUID2] = itemWeatherString.GetValueOrDefault(dawnUUID2, "") + item2.Key + ":" + CleanString(array4[1]) + ",";
					}
				}
			}
			foreach (KeyValuePair<string, string> item3 in cachedDungeonSpawnableScrap)
			{
				string[] array5 = item3.Value.Split(",");
				foreach (string text3 in array5)
				{
					string[] array6 = text3.Split(":");
					string uuid3 = array6[0];
					string dawnUUID3 = GetDawnUUID(items, uuid3);
					if (dawnUUID3 != null)
					{
						itemDungeonString[dawnUUID3] = itemDungeonString.GetValueOrDefault(dawnUUID3, "") + item3.Key + ":" + CleanString(array6[1]) + ",";
					}
				}
			}
			foreach (KeyValuePair<string, string> item4 in cachedTagSpawnableScrap)
			{
				string[] array7 = item4.Value.Split(",");
				foreach (string text4 in array7)
				{
					string[] array8 = text4.Split(":");
					string uuid4 = array8[0];
					string dawnUUID4 = GetDawnUUID(items, uuid4);
					if (dawnUUID4 != null)
					{
						itemWeightString[dawnUUID4] = itemWeightString.GetValueOrDefault(dawnUUID4, "") + item4.Key + ":" + CleanString(array8[1]) + ",";
					}
				}
			}
			foreach (KeyValuePair<NamespacedKey<DawnItemInfo>, DawnItemInfo> item5 in (Registry<DawnItemInfo>)(object)LethalContent.Items)
			{
				string arg = UUIDify(((object)item5.Key).ToString());
				try
				{
					DawnItemInfo value = item5.Value;
					DawnScrapItemInfo val = null;
					if (value.ScrapInfo != null)
					{
						val = value.ScrapInfo;
						string key = ((object)item5.Key).ToString();
						foreach (DawnMoonInfo notConfiguredScrapMoon in notConfiguredScrapMoons)
						{
							int? @for = val.Weights.GetFor(notConfiguredScrapMoon);
							if (@for.HasValue && @for > 0)
							{
								Dictionary<string, string> dictionary = itemWeightString;
								string[] obj = new string[5]
								{
									itemWeightString.GetValueOrDefault(key, ""),
									((object)((DawnBaseInfo<DawnMoonInfo>)(object)notConfiguredScrapMoon).Key).ToString(),
									":",
									null,
									null
								};
								int? num = @for;
								obj[3] = num.ToString();
								obj[4] = ",";
								dictionary[key] = string.Concat(obj);
							}
						}
					}
					if (!((DawnBaseInfo<DawnItemInfo>)(object)value).HasTag(DawnLibTags.LunarConfig))
					{
						((DawnBaseInfo<DawnItemInfo>)(object)value).Internal_AddTag(DawnLibTags.LunarConfig);
					}
					WeightTableBuilder<DawnMoonInfo> val2 = new WeightTableBuilder<DawnMoonInfo>();
					SpawnWeightsPreset val3 = new SpawnWeightsPreset();
					List<NamespacedConfigWeight> list = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(itemWeightString.GetValueOrDefault(((object)item5.Key).ToString(), "")));
					List<NamespacedConfigWeight> list2 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(itemWeatherString.GetValueOrDefault(((object)item5.Key).ToString(), "")));
					List<NamespacedConfigWeight> list3 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(itemDungeonString.GetValueOrDefault(((object)item5.Key).ToString(), "")));
					val3.SetupSpawnWeightsPreset(list, list3, list2, 0);
					val2.SetGlobalWeight((IWeighted)(object)val3);
					if (val != null)
					{
						val.Weights = val2.Build();
					}
					else
					{
						value.ScrapInfo = new DawnScrapItemInfo(val2.Build());
					}
				}
				catch (Exception arg2)
				{
					MiniLogger.LogError($"LunarConfig encountered an issue while configuring weights for {arg}, please report this!\n{arg2}");
				}
			}
			itemWeightsInitialized = true;
			MiniLogger.LogInfo("Completed Initializing Item Weights");
		}

		public void InitEnemies()
		{
			//IL_05fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0606: Expected O, but got Unknown
			//IL_0633: Unknown result type (might be due to invalid IL or missing references)
			//IL_063d: Expected O, but got Unknown
			if (!centralInitialized)
			{
				InitCentral();
			}
			MiniLogger.LogInfo("Initializing Enemies");
			if (configureEnemies)
			{
				LunarConfigFile lunarConfigFile = AddFile(LunarConfig.ENEMY_FILE, LunarConfig.ENEMY_FILE_NAME);
				lunarConfigFile.file.SaveOnConfigSet = false;
				foreach (KeyValuePair<NamespacedKey<DawnEnemyInfo>, DawnEnemyInfo> item in (Registry<DawnEnemyInfo>)(object)LethalContent.Enemies)
				{
					string text = UUIDify(((object)item.Key).ToString());
					try
					{
						string text2 = NiceifyDawnUUID(text);
						DawnEnemyInfo value = item.Value;
						LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text);
						EnemyType enemyType = value.EnemyType;
						ScanNodeProperties val = null;
						string text3 = null;
						EnemyAI val2 = null;
						TerminalNode val3 = null;
						TerminalKeyword val4 = null;
						if ((Object)(object)enemyType.enemyPrefab != (Object)null)
						{
							val = enemyType.enemyPrefab.GetComponentInChildren<ScanNodeProperties>();
							if ((Object)(object)val != (Object)null)
							{
								text3 = val.headerText;
							}
							val2 = enemyType.enemyPrefab.GetComponent<EnemyAI>();
						}
						if ((Object)(object)value.BestiaryNode != (Object)null)
						{
							val3 = value.BestiaryNode;
						}
						if ((Object)(object)value.NameKeyword != (Object)null)
						{
							val4 = value.NameKeyword;
						}
						lunarConfigEntry.AddField("Configure Content", "Enable to change any of the settings below.", defaultValue: false);
						lunarConfigEntry.AddField("Appropriate Aliases", "These are the names which LunarConfig will recognize as this object in other config options.\nThey are case-insensitve and do not regard whitespace.", enemyType.enemyName + ", " + text3 + ", " + text2);
						if ((Object)(object)val != (Object)null)
						{
							lunarConfigEntry.TryAddField(enabledEnemySettings, "Scan Name", "Specifies the name of the enemy that appears on its scan node.", val.headerText);
							lunarConfigEntry.TryAddField(enabledEnemySettings, "Scan Subtext", "Specifies the subtext that appears on the enemy's scan node.", val.subText);
							lunarConfigEntry.TryAddField(enabledEnemySettings, "Scan Min Range", "Specifies the minimum distance the scan node can be scanned.", val.minRange);
							lunarConfigEntry.TryAddField(enabledEnemySettings, "Scan Max Range", "Specifies the maximum distance the scan node can be scanned.", val.maxRange);
						}
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Can See Through Fog?", "Specifies if an enemy can see through fog in foggy weather.", enemyType.canSeeThroughFog);
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Door Speed Multiplier", "Decides the speed at which enemies can open doors.\nCalculated with: 1 / x = time to open door in seconds.", enemyType.doorSpeedMultiplier);
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Loudness Multiplier", "Multiplies the volume of an enemy's sounds.", enemyType.loudnessMultiplier);
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Max Count", "The maximum amount of an enemy that can be alive.", enemyType.MaxCount);
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Power Level", "The power level an enemy occupies.", enemyType.PowerLevel);
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Probability Curve", "Multiplies enemy spawn weight depending on time of day.\nKeyframes represented by x,y and separated by semicolons.", CurveToString(enemyType.probabilityCurve));
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Use Falloff?", "Whether or not to use the falloff curve.", enemyType.useNumberSpawnedFalloff);
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Falloff Curve", "Multiplier to enemy spawn weight depending on how many are already spawned.\nKeyframes represented by x,y and separated by semicolons.", CurveToString(enemyType.numberSpawnedFalloff));
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Group Spawn Count", "The amount of entities that will spawn of this type at once.\nNOTICE: In order for this setting to work, you may need VentSpawnFixes or a similar mod.", enemyType.spawnInGroupsOf);
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Normalized Time To Leave", "The time that an enemy leaves represented between 0 and 1 for the start and end of the day respectively.\nWARNING: Changing this for enemies that do not normally leave during the day may cause issues.", enemyType.normalizedTimeInDayToLeave);
						if ((Object)(object)val2 != (Object)null)
						{
							lunarConfigEntry.TryAddField(enabledEnemySettings, "Enemy HP", "The amount of HP an enemy has.", val2.enemyHP);
						}
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Can Die?", "Whether or not an enemy can die.", enemyType.canDie);
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Destroy On Death?", "Whether or not an enemy is destroyed on death.", enemyType.destroyOnDeath);
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Can Destroy?", "Whether or not an enemy can be destroyed.", enemyType.canBeDestroyed);
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Can Stun?", "Whether or not an enemy can be stunned.\nWARNING: Enabling this for enemies that have it disabled by default will likely cause issues, as the enemy most likely does not have stunning mechanics.", enemyType.canBeStunned);
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Stun Difficulty", "Modifies the difficulty of using the zap gun on this enemy.", enemyType.stunGameDifficultyMultiplier);
						lunarConfigEntry.TryAddField(enabledEnemySettings, "Stun Time", "Modifies the duration this enemy stays stunned.", enemyType.stunTimeMultiplier);
						if ((Object)(object)val3 != (Object)null)
						{
							lunarConfigEntry.TryAddField(enabledEnemySettings, "Bestiary Text", "The text of the terminal when viewing the bestiary of an enemy. New lines are represented by semi-colons.", val3.displayText.Replace("\n", ";"));
						}
						if ((Object)(object)val4 != (Object)null)
						{
							lunarConfigEntry.TryAddField(enabledEnemySettings, "Bestiary Keyword", "The keyword to view the bestiary entry of an enemy.", val4.word);
						}
						lunarConfigEntry.TryAddField(enabledItemSettings, "Tags", "Tags allocated to the enemy.\nSeparate tags with commas.", string.Join(", ", from tag in ((DawnBaseInfo<DawnEnemyInfo>)(object)value).AllTags()
							where tag.Namespace != "dawn_lib"
							select tag));
						if (backCompat)
						{
							MigrateSection(lunarConfigFile.file, "LLL - " + enemyType.enemyName, text2 + " - " + text);
						}
						if (backCompat)
						{
							MigrateSection(lunarConfigFile.file, "LL - " + enemyType.enemyName, text2 + " - " + text);
						}
						if (lunarConfigEntry.GetValue<bool>("Configure Content"))
						{
							if (enabledEnemySettings.Contains("Tags"))
							{
								HashSet<NamespacedKey> hashSet = new HashSet<NamespacedKey>();
								string[] array = RemoveWhitespace(lunarConfigEntry.GetValue<string>("Tags")).ToLower().Split(",");
								foreach (string text4 in array)
								{
									string[] array2 = text4.Split(":");
									if (array2.Length == 1 && !Utility.IsNullOrWhiteSpace(array2[0]))
									{
										hashSet.Add(new NamespacedKey("lunarcontenttag", array2[0]));
									}
									else if (array2.Length == 2 && array2[0] != "dawn_lib")
									{
										hashSet.Add(new NamespacedKey(array2[0], array2[1]));
									}
									else
									{
										MiniLogger.LogWarning("Incorrectly formatted tag '" + text4 + "' found on " + text);
									}
								}
								foreach (NamespacedKey tag in ((DawnBaseInfo<DawnEnemyInfo>)(object)value)._tags)
								{
									if (tag.Namespace == "dawn_lib")
									{
										hashSet.Add(tag);
									}
								}
								((DawnBaseInfo<DawnEnemyInfo>)(object)value)._tags = hashSet;
							}
							((DawnBaseInfo<DawnEnemyInfo>)(object)value).Internal_AddTag(DawnLibTags.LunarConfig);
							string[] array3 = lunarConfigEntry.GetValue<string>("Appropriate Aliases").Split(",");
							foreach (string text5 in array3)
							{
								if (!Utility.IsNullOrWhiteSpace(text5))
								{
									enemies[CleanString(text5)] = text;
								}
							}
							if ((Object)(object)val != (Object)null)
							{
								lunarConfigEntry.TrySetValue(enabledEnemySettings, "Scan Name", ref val.headerText);
								lunarConfigEntry.TrySetValue(enabledEnemySettings, "Scan Subtext", ref val.subText);
								lunarConfigEntry.TrySetValue(enabledEnemySettings, "Scan Min Range", ref val.minRange);
								lunarConfigEntry.TrySetValue(enabledEnemySettings, "Scan Max Range", ref val.maxRange);
							}
							lunarConfigEntry.TrySetValue(enabledEnemySettings, "Can See Through Fog?", ref enemyType.canSeeThroughFog);
							lunarConfigEntry.TrySetValue(enabledEnemySettings, "Door Speed Multiplier", ref enemyType.doorSpeedMultiplier);
							lunarConfigEntry.TrySetValue(enabledEnemySettings, "Loudness Multiplier", ref enemyType.loudnessMultiplier);
							lunarConfigEntry.TrySetValue(enabledEnemySettings, "Max Count", ref enemyType.MaxCount);
							lunarConfigEntry.TrySetValue(enabledEnemySettings, "Power Level", ref enemyType.PowerLevel);
							if (enabledEnemySettings.Contains("Probability Curve"))
							{
								enemyType.probabilityCurve = StringToCurve(lunarConfigEntry.GetValue<string>("Probability Curve"));
							}
							lunarConfigEntry.TrySetValue(enabledEnemySettings, "Use Falloff?", ref enemyType.useNumberSpawnedFalloff);
							if (enabledEnemySettings.Contains("Falloff Curve"))
							{
								enemyType.numberSpawnedFalloff = StringToCurve(lunarConfigEntry.GetValue<string>("Falloff Curve"));
							}
							lunarConfigEntry.TrySetValue(enabledEnemySettings, "Group Spawn Count", ref enemyType.spawnInGroupsOf);
							lunarConfigEntry.TrySetValue(enabledEnemySettings, "Normalized Time To Leave", ref enemyType.normalizedTimeInDayToLeave);
							if ((Object)(object)val2 != (Object)null)
							{
								lunarConfigEntry.TrySetValue(enabledEnemySettings, "Enemy HP", ref val2.enemyHP);
							}
							lunarConfigEntry.TrySetValue(enabledEnemySettings, "Can Die?", ref enemyType.canDie);
							lunarConfigEntry.TrySetValue(enabledEnemySettings, "Destroy On Death?", ref enemyType.destroyOnDeath);
							lunarConfigEntry.TrySetValue(enabledEnemySettings, "Can Destroy?", ref enemyType.canBeDestroyed);
							lunarConfigEntry.TrySetValue(enabledEnemySettings, "Can Stun?", ref enemyType.canBeStunned);
							lunarConfigEntry.TrySetValue(enabledEnemySettings, "Stun Difficulty", ref enemyType.stunGameDifficultyMultiplier);
							lunarConfigEntry.TrySetValue(enabledEnemySettings, "Stun Time", ref enemyType.stunTimeMultiplier);
							if ((Object)(object)val3 != (Object)null && enabledEnemySettings.Contains("Bestiary Text"))
							{
								val3.displayText = lunarConfigEntry.GetValue<string>("Bestiary Text").Replace(";", "\n");
							}
							if ((Object)(object)val4 != (Object)null)
							{
								lunarConfigEntry.TrySetValue(enabledEnemySettings, "Bestiary Keyword", ref val4.word);
							}
						}
						else
						{
							enemies[CleanString(enemyType.enemyName)] = text;
							if (!Utility.IsNullOrWhiteSpace(text3))
							{
								enemies[CleanString(text3)] = text;
							}
							enemies[CleanString(text2)] = text;
						}
					}
					catch (Exception arg)
					{
						MiniLogger.LogError($"LunarConfig encountered an issue while configuring {text}, please report this!\n{arg}");
					}
				}
				ClearOrphanedEntries(lunarConfigFile.file);
				lunarConfigFile.file.Save();
				lunarConfigFile.file.SaveOnConfigSet = true;
			}
			else
			{
				foreach (KeyValuePair<NamespacedKey<DawnEnemyInfo>, DawnEnemyInfo> item2 in (Registry<DawnEnemyInfo>)(object)LethalContent.Enemies)
				{
					string text6 = UUIDify(((object)item2.Key).ToString());
					EnemyType enemyType2 = item2.Value.EnemyType;
					string text7 = null;
					if ((Object)(object)enemyType2.enemyPrefab != (Object)null)
					{
						ScanNodeProperties componentInChildren = enemyType2.enemyPrefab.GetComponentInChildren<ScanNodeProperties>();
						if ((Object)(object)componentInChildren != (Object)null)
						{
							text7 = componentInChildren.headerText;
						}
					}
					enemies[CleanString(enemyType2.enemyName)] = text6;
					if (!Utility.IsNullOrWhiteSpace(text7))
					{
						enemies[CleanString(text7)] = text6;
					}
					enemies[CleanString(NiceifyDawnUUID(text6))] = text6;
				}
			}
			enemiesInitialized = true;
			MiniLogger.LogInfo("Completed Initializing Enemies");
			InitEnemyWeights();
		}

		public void InitEnemyWeights()
		{
			//IL_05c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cb: Expected O, but got Unknown
			//IL_0c79: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c80: Expected O, but got Unknown
			//IL_132e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1335: Expected O, but got Unknown
			//IL_0681: Unknown result type (might be due to invalid IL or missing references)
			//IL_068b: Expected O, but got Unknown
			//IL_0d36: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d40: Expected O, but got Unknown
			//IL_13eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_13f5: Expected O, but got Unknown
			if (!moonsInitialized || !enemiesInitialized || !weatherInjectionInitialized || !dungeonInjectionInitialized || enemyWeightsInitialized)
			{
				return;
			}
			if (enabledMoonSettings.Contains("Spawnable Daytime Enemies") || enabledDungeonInjectionSettings.Contains("Spawnable Daytime Enemies") || enabledWeatherInjectionSettings.Contains("Spawnable Daytime Enemies") || enabledTagInjectionSettings.Contains("Spawnable Daytime Enemies"))
			{
				MiniLogger.LogInfo("Initializing Daytime Weights");
				foreach (KeyValuePair<string, string> cachedDaytimeEnemy in cachedDaytimeEnemies)
				{
					string[] array = cachedDaytimeEnemy.Value.Split(",");
					foreach (string text in array)
					{
						string[] array2 = text.Split(":");
						string uuid = array2[0];
						string dawnUUID = GetDawnUUID(enemies, uuid);
						if (dawnUUID != null)
						{
							daytimeEnemyWeightString[dawnUUID] = daytimeEnemyWeightString.GetValueOrDefault(dawnUUID, "") + cachedDaytimeEnemy.Key + ":" + CleanString(array2[1]) + ",";
						}
					}
				}
				foreach (KeyValuePair<string, string> cachedWeatherDaytimeEnemy in cachedWeatherDaytimeEnemies)
				{
					string[] array3 = cachedWeatherDaytimeEnemy.Value.Split(",");
					foreach (string text2 in array3)
					{
						string[] array4 = text2.Split(":");
						string uuid2 = array4[0];
						string dawnUUID2 = GetDawnUUID(enemies, uuid2);
						if (dawnUUID2 != null)
						{
							daytimeEnemyWeatherString[dawnUUID2] = daytimeEnemyWeatherString.GetValueOrDefault(dawnUUID2, "") + cachedWeatherDaytimeEnemy.Key + ":" + CleanString(array4[1]) + ",";
						}
					}
				}
				foreach (KeyValuePair<string, string> cachedDungeonDaytimeEnemy in cachedDungeonDaytimeEnemies)
				{
					string[] array5 = cachedDungeonDaytimeEnemy.Value.Split(",");
					foreach (string text3 in array5)
					{
						string[] array6 = text3.Split(":");
						string uuid3 = array6[0];
						string dawnUUID3 = GetDawnUUID(enemies, uuid3);
						if (dawnUUID3 != null)
						{
							daytimeEnemyDungeonString[dawnUUID3] = daytimeEnemyDungeonString.GetValueOrDefault(dawnUUID3, "") + cachedDungeonDaytimeEnemy.Key + ":" + CleanString(array6[1]) + ",";
						}
					}
				}
				foreach (KeyValuePair<string, string> cachedTagDaytimeEnemy in cachedTagDaytimeEnemies)
				{
					string[] array7 = cachedTagDaytimeEnemy.Value.Split(",");
					foreach (string text4 in array7)
					{
						string[] array8 = text4.Split(":");
						string uuid4 = array8[0];
						string dawnUUID4 = GetDawnUUID(enemies, uuid4);
						if (dawnUUID4 != null)
						{
							daytimeEnemyWeightString[dawnUUID4] = daytimeEnemyWeightString.GetValueOrDefault(dawnUUID4, "") + cachedTagDaytimeEnemy.Key + ":" + CleanString(array8[1]) + ",";
						}
					}
				}
				foreach (KeyValuePair<NamespacedKey<DawnEnemyInfo>, DawnEnemyInfo> item in (Registry<DawnEnemyInfo>)(object)LethalContent.Enemies)
				{
					string arg = UUIDify(((object)item.Key).ToString());
					try
					{
						DawnEnemyInfo value = item.Value;
						DawnEnemyLocationInfo val = null;
						if (value.Daytime != null)
						{
							val = value.Daytime;
							string key = ((object)item.Key).ToString();
							foreach (DawnMoonInfo notConfiguredDaytimeMoon in notConfiguredDaytimeMoons)
							{
								int? @for = val.Weights.GetFor(notConfiguredDaytimeMoon);
								if (@for.HasValue && @for > 0)
								{
									Dictionary<string, string> dictionary = daytimeEnemyWeightString;
									string[] obj = new string[5]
									{
										daytimeEnemyWeightString.GetValueOrDefault(key, ""),
										((object)((DawnBaseInfo<DawnMoonInfo>)(object)notConfiguredDaytimeMoon).Key).ToString(),
										":",
										null,
										null
									};
									int? num = @for;
									obj[3] = num.ToString();
									obj[4] = ",";
									dictionary[key] = string.Concat(obj);
								}
							}
						}
						if (!((DawnBaseInfo<DawnEnemyInfo>)(object)value).HasTag(DawnLibTags.LunarConfig))
						{
							((DawnBaseInfo<DawnEnemyInfo>)(object)value).Internal_AddTag(DawnLibTags.LunarConfig);
						}
						WeightTableBuilder<DawnMoonInfo> val2 = new WeightTableBuilder<DawnMoonInfo>();
						SpawnWeightsPreset val3 = new SpawnWeightsPreset();
						List<NamespacedConfigWeight> list = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(daytimeEnemyWeightString.GetValueOrDefault(((object)item.Key).ToString(), "")));
						List<NamespacedConfigWeight> list2 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(daytimeEnemyWeatherString.GetValueOrDefault(((object)item.Key).ToString(), "")));
						List<NamespacedConfigWeight> list3 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(daytimeEnemyDungeonString.GetValueOrDefault(((object)item.Key).ToString(), "")));
						val3.SetupSpawnWeightsPreset(list, list3, list2, 0);
						val2.SetGlobalWeight((IWeighted)(object)val3);
						if (val != null)
						{
							val.Weights = val2.Build();
							continue;
						}
						value.Daytime = new DawnEnemyLocationInfo(val2.Build());
						value.Daytime.ParentInfo = value;
					}
					catch (Exception arg2)
					{
						MiniLogger.LogError($"LunarConfig encountered an issue while configuring weights for {arg}, please report this!\n{arg2}");
					}
				}
				MiniLogger.LogInfo("Completed Initializing Daytime Weights");
			}
			if (enabledMoonSettings.Contains("Spawnable Interior Enemies") || enabledDungeonInjectionSettings.Contains("Spawnable Interior Enemies") || enabledWeatherInjectionSettings.Contains("Spawnable Interior Enemies") || enabledTagInjectionSettings.Contains("Spawnable Interior Enemies"))
			{
				MiniLogger.LogInfo("Initializing Interior Weights");
				foreach (KeyValuePair<string, string> cachedInteriorEnemy in cachedInteriorEnemies)
				{
					string[] array9 = cachedInteriorEnemy.Value.Split(",");
					foreach (string text5 in array9)
					{
						string[] array10 = text5.Split(":");
						string uuid5 = array10[0];
						string dawnUUID5 = GetDawnUUID(enemies, uuid5);
						if (dawnUUID5 != null)
						{
							interiorEnemyWeightString[dawnUUID5] = interiorEnemyWeightString.GetValueOrDefault(dawnUUID5, "") + cachedInteriorEnemy.Key + ":" + CleanString(array10[1]) + ",";
						}
					}
				}
				foreach (KeyValuePair<string, string> cachedWeatherInteriorEnemy in cachedWeatherInteriorEnemies)
				{
					string[] array11 = cachedWeatherInteriorEnemy.Value.Split(",");
					foreach (string text6 in array11)
					{
						string[] array12 = text6.Split(":");
						string uuid6 = array12[0];
						string dawnUUID6 = GetDawnUUID(enemies, uuid6);
						if (dawnUUID6 != null)
						{
							interiorEnemyWeatherString[dawnUUID6] = interiorEnemyWeatherString.GetValueOrDefault(dawnUUID6, "") + cachedWeatherInteriorEnemy.Key + ":" + CleanString(array12[1]) + ",";
						}
					}
				}
				foreach (KeyValuePair<string, string> cachedDungeonInteriorEnemy in cachedDungeonInteriorEnemies)
				{
					string[] array13 = cachedDungeonInteriorEnemy.Value.Split(",");
					foreach (string text7 in array13)
					{
						string[] array14 = text7.Split(":");
						string uuid7 = array14[0];
						string dawnUUID7 = GetDawnUUID(enemies, uuid7);
						if (dawnUUID7 != null)
						{
							interiorEnemyDungeonString[dawnUUID7] = interiorEnemyDungeonString.GetValueOrDefault(dawnUUID7, "") + cachedDungeonInteriorEnemy.Key + ":" + CleanString(array14[1]) + ",";
						}
					}
				}
				foreach (KeyValuePair<string, string> cachedTagInteriorEnemy in cachedTagInteriorEnemies)
				{
					string[] array15 = cachedTagInteriorEnemy.Value.Split(",");
					foreach (string text8 in array15)
					{
						string[] array16 = text8.Split(":");
						string uuid8 = array16[0];
						string dawnUUID8 = GetDawnUUID(enemies, uuid8);
						if (dawnUUID8 != null)
						{
							interiorEnemyWeightString[dawnUUID8] = interiorEnemyWeightString.GetValueOrDefault(dawnUUID8, "") + cachedTagInteriorEnemy.Key + ":" + CleanString(array16[1]) + ",";
						}
					}
				}
				foreach (KeyValuePair<NamespacedKey<DawnEnemyInfo>, DawnEnemyInfo> item2 in (Registry<DawnEnemyInfo>)(object)LethalContent.Enemies)
				{
					string arg3 = UUIDify(((object)item2.Key).ToString());
					try
					{
						DawnEnemyInfo value2 = item2.Value;
						DawnEnemyLocationInfo val4 = null;
						if (value2.Inside != null)
						{
							val4 = value2.Inside;
							string key2 = ((object)item2.Key).ToString();
							foreach (DawnMoonInfo notConfiguredInteriorMoon in notConfiguredInteriorMoons)
							{
								int? for2 = val4.Weights.GetFor(notConfiguredInteriorMoon);
								if (for2.HasValue && for2 > 0)
								{
									Dictionary<string, string> dictionary2 = interiorEnemyWeightString;
									string[] obj2 = new string[5]
									{
										interiorEnemyWeightString.GetValueOrDefault(key2, ""),
										((object)((DawnBaseInfo<DawnMoonInfo>)(object)notConfiguredInteriorMoon).Key).ToString(),
										":",
										null,
										null
									};
									int? num = for2;
									obj2[3] = num.ToString();
									obj2[4] = ",";
									dictionary2[key2] = string.Concat(obj2);
								}
							}
						}
						if (!((DawnBaseInfo<DawnEnemyInfo>)(object)value2).HasTag(DawnLibTags.LunarConfig))
						{
							((DawnBaseInfo<DawnEnemyInfo>)(object)value2).Internal_AddTag(DawnLibTags.LunarConfig);
						}
						WeightTableBuilder<DawnMoonInfo> val5 = new WeightTableBuilder<DawnMoonInfo>();
						SpawnWeightsPreset val6 = new SpawnWeightsPreset();
						List<NamespacedConfigWeight> list4 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(interiorEnemyWeightString.GetValueOrDefault(((object)item2.Key).ToString(), "")));
						List<NamespacedConfigWeight> list5 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(interiorEnemyWeatherString.GetValueOrDefault(((object)item2.Key).ToString(), "")));
						List<NamespacedConfigWeight> list6 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(interiorEnemyDungeonString.GetValueOrDefault(((object)item2.Key).ToString(), "")));
						val6.SetupSpawnWeightsPreset(list4, list6, list5, 0);
						val5.SetGlobalWeight((IWeighted)(object)val6);
						if (val4 != null)
						{
							val4.Weights = val5.Build();
							continue;
						}
						value2.Inside = new DawnEnemyLocationInfo(val5.Build());
						value2.Inside.ParentInfo = value2;
					}
					catch (Exception arg4)
					{
						MiniLogger.LogError($"LunarConfig encountered an issue while configuring weights for {arg3}, please report this!\n{arg4}");
					}
				}
				MiniLogger.LogInfo("Completed Initializing Interior Weights");
			}
			if (enabledMoonSettings.Contains("Spawnable Outside Enemies") || enabledDungeonInjectionSettings.Contains("Spawnable Outside Enemies") || enabledWeatherInjectionSettings.Contains("Spawnable Outside Enemies") || enabledTagInjectionSettings.Contains("Spawnable Outside Enemies"))
			{
				MiniLogger.LogInfo("Initializing Outside Weights");
				foreach (KeyValuePair<string, string> cachedOutsideEnemy in cachedOutsideEnemies)
				{
					string[] array17 = cachedOutsideEnemy.Value.Split(",");
					foreach (string text9 in array17)
					{
						string[] array18 = text9.Split(":");
						string uuid9 = array18[0];
						string dawnUUID9 = GetDawnUUID(enemies, uuid9);
						if (dawnUUID9 != null)
						{
							outsideEnemyWeightString[dawnUUID9] = outsideEnemyWeightString.GetValueOrDefault(dawnUUID9, "") + cachedOutsideEnemy.Key + ":" + CleanString(array18[1]) + ",";
						}
					}
				}
				foreach (KeyValuePair<string, string> cachedWeatherOutsideEnemy in cachedWeatherOutsideEnemies)
				{
					string[] array19 = cachedWeatherOutsideEnemy.Value.Split(",");
					foreach (string text10 in array19)
					{
						string[] array20 = text10.Split(":");
						string uuid10 = array20[0];
						string dawnUUID10 = GetDawnUUID(enemies, uuid10);
						if (dawnUUID10 != null)
						{
							outsideEnemyWeatherString[dawnUUID10] = outsideEnemyWeatherString.GetValueOrDefault(dawnUUID10, "") + cachedWeatherOutsideEnemy.Key + ":" + CleanString(array20[1]) + ",";
						}
					}
				}
				foreach (KeyValuePair<string, string> cachedDungeonOutsideEnemy in cachedDungeonOutsideEnemies)
				{
					string[] array21 = cachedDungeonOutsideEnemy.Value.Split(",");
					foreach (string text11 in array21)
					{
						string[] array22 = text11.Split(":");
						string uuid11 = array22[0];
						string dawnUUID11 = GetDawnUUID(enemies, uuid11);
						if (dawnUUID11 != null)
						{
							outsideEnemyDungeonString[dawnUUID11] = outsideEnemyDungeonString.GetValueOrDefault(dawnUUID11, "") + cachedDungeonOutsideEnemy.Key + ":" + CleanString(array22[1]) + ",";
						}
					}
				}
				foreach (KeyValuePair<string, string> cachedTagOutsideEnemy in cachedTagOutsideEnemies)
				{
					string[] array23 = cachedTagOutsideEnemy.Value.Split(",");
					foreach (string text12 in array23)
					{
						string[] array24 = text12.Split(":");
						string uuid12 = array24[0];
						string dawnUUID12 = GetDawnUUID(enemies, uuid12);
						if (dawnUUID12 != null)
						{
							outsideEnemyWeightString[dawnUUID12] = outsideEnemyWeightString.GetValueOrDefault(dawnUUID12, "") + cachedTagOutsideEnemy.Key + ":" + CleanString(array24[1]) + ",";
						}
					}
				}
				foreach (KeyValuePair<NamespacedKey<DawnEnemyInfo>, DawnEnemyInfo> item3 in (Registry<DawnEnemyInfo>)(object)LethalContent.Enemies)
				{
					string arg5 = UUIDify(((object)item3.Key).ToString());
					try
					{
						DawnEnemyInfo value3 = item3.Value;
						DawnEnemyLocationInfo val7 = null;
						if (value3.Outside != null)
						{
							val7 = value3.Outside;
							string key3 = ((object)item3.Key).ToString();
							foreach (DawnMoonInfo notConfiguredOutsideMoon in notConfiguredOutsideMoons)
							{
								int? for3 = val7.Weights.GetFor(notConfiguredOutsideMoon);
								if (for3.HasValue && for3 > 0)
								{
									Dictionary<string, string> dictionary3 = outsideEnemyWeightString;
									string[] obj3 = new string[5]
									{
										outsideEnemyWeightString.GetValueOrDefault(key3, ""),
										((object)((DawnBaseInfo<DawnMoonInfo>)(object)notConfiguredOutsideMoon).Key).ToString(),
										":",
										null,
										null
									};
									int? num = for3;
									obj3[3] = num.ToString();
									obj3[4] = ",";
									dictionary3[key3] = string.Concat(obj3);
								}
							}
						}
						if (!((DawnBaseInfo<DawnEnemyInfo>)(object)value3).HasTag(DawnLibTags.LunarConfig))
						{
							((DawnBaseInfo<DawnEnemyInfo>)(object)value3).Internal_AddTag(DawnLibTags.LunarConfig);
						}
						WeightTableBuilder<DawnMoonInfo> val8 = new WeightTableBuilder<DawnMoonInfo>();
						SpawnWeightsPreset val9 = new SpawnWeightsPreset();
						List<NamespacedConfigWeight> list7 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(outsideEnemyWeightString.GetValueOrDefault(((object)item3.Key).ToString(), "")));
						List<NamespacedConfigWeight> list8 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(outsideEnemyWeatherString.GetValueOrDefault(((object)item3.Key).ToString(), "")));
						List<NamespacedConfigWeight> list9 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(outsideEnemyDungeonString.GetValueOrDefault(((object)item3.Key).ToString(), "")));
						val9.SetupSpawnWeightsPreset(list7, list9, list8, 0);
						val8.SetGlobalWeight((IWeighted)(object)val9);
						if (val7 != null)
						{
							val7.Weights = val8.Build();
							continue;
						}
						value3.Outside = new DawnEnemyLocationInfo(val8.Build());
						value3.Outside.ParentInfo = value3;
					}
					catch (Exception arg6)
					{
						MiniLogger.LogError($"LunarConfig encountered an issue while configuring weights for {arg5}, please report this!\n{arg6}");
					}
				}
				MiniLogger.LogInfo("Completed Initializing Outside Weights");
			}
			enemyWeightsInitialized = true;
		}

		public void InitDungeons()
		{
			//IL_0450: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Expected O, but got Unknown
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Expected O, but got Unknown
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Expected O, but got Unknown
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Expected O, but got Unknown
			if (!centralInitialized)
			{
				InitCentral();
			}
			MiniLogger.LogInfo("Initializing Dungeons");
			if (configureDungeons)
			{
				LunarConfigFile lunarConfigFile = AddFile(LunarConfig.DUNGEON_FILE, LunarConfig.DUNGEON_FILE_NAME);
				lunarConfigFile.file.SaveOnConfigSet = false;
				foreach (KeyValuePair<NamespacedKey<DawnDungeonInfo>, DawnDungeonInfo> item in (Registry<DawnDungeonInfo>)(object)LethalContent.Dungeons)
				{
					string text = UUIDify(((object)item.Key).ToString());
					try
					{
						string text2 = NiceifyDawnUUID(text);
						DawnDungeonInfo value = item.Value;
						LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text);
						DungeonFlow dungeonFlow = value.DungeonFlow;
						lunarConfigEntry.AddField("Configure Content", "Enable to change any of the settings below.", defaultValue: false);
						lunarConfigEntry.AddField("Appropriate Aliases", "These are the names which LunarConfig will recognize as this object in other config options.\nThey are case-insensitve and do not regard whitespace.", ((Object)dungeonFlow).name + ", " + text2);
						lunarConfigEntry.TryAddField(enabledDungeonSettings, "Random Size Min", "The minimum length of dungeon branches.\nHaving a different min and max allows variation between the size of a dungeon on the same moon.", dungeonFlow.Length.Min);
						lunarConfigEntry.TryAddField(enabledDungeonSettings, "Random Size Max", "The maximum length of dungeon branches.\nHaving a different min and max allows variation between the size of a dungeon on the same moon.", dungeonFlow.Length.Max);
						lunarConfigEntry.TryAddField(enabledDungeonSettings, "Map Tile Size", "Increase this setting to decrease the size of the dungeon overall.", value.MapTileSize);
						lunarConfigEntry.TryAddField(enabledDungeonSettings, "Clamp Range Min", "The minimum of the dungeon's clamp range.", value.DungeonClampRange.Min);
						lunarConfigEntry.TryAddField(enabledDungeonSettings, "Clamp Range Max", "The maximum of the dungeon's clamp range.", value.DungeonClampRange.Max);
						lunarConfigEntry.TryAddField(enabledDungeonSettings, "Tags", "Tags allocated to the dungeon.\nSeparate tags with commas.", string.Join(", ", from tag in ((DawnBaseInfo<DawnDungeonInfo>)(object)value).AllTags()
							where tag.Namespace != "dawn_lib"
							select tag));
						if (lunarConfigEntry.GetValue<bool>("Configure Content"))
						{
							if (enabledDungeonSettings.Contains("Tags"))
							{
								HashSet<NamespacedKey> hashSet = new HashSet<NamespacedKey>();
								string[] array = RemoveWhitespace(lunarConfigEntry.GetValue<string>("Tags")).ToLower().Split(",");
								foreach (string text3 in array)
								{
									string[] array2 = text3.Split(":");
									if (array2.Length == 1 && !Utility.IsNullOrWhiteSpace(array2[0]))
									{
										hashSet.Add(new NamespacedKey("lunarcontenttag", array2[0]));
									}
									else if (array2.Length == 2 && array2[0] != "dawn_lib")
									{
										hashSet.Add(new NamespacedKey(array2[0], array2[1]));
									}
									else
									{
										MiniLogger.LogWarning("Incorrectly formatted tag '" + text3 + "' found on " + text);
									}
								}
								foreach (NamespacedKey tag in ((DawnBaseInfo<DawnDungeonInfo>)(object)value)._tags)
								{
									if (tag.Namespace == "dawn_lib")
									{
										hashSet.Add(tag);
									}
								}
								((DawnBaseInfo<DawnDungeonInfo>)(object)value)._tags = hashSet;
							}
							((DawnBaseInfo<DawnDungeonInfo>)(object)value).Internal_AddTag(DawnLibTags.LunarConfig);
							string[] array3 = lunarConfigEntry.GetV