Decompiled source of LunarConfig v0.2.7
plugins/LunarConfig/Crafty.LunarConfig.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
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+c58c802a518c98153ad0460f8cf5ced29a0408e3")] [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); 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; 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 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 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 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 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 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, 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 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.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 string.Join(" ; ", curve.keys.Select((Keyframe kf) => ((Keyframe)(ref kf)).time.ToString(CultureInfo.InvariantCulture) + "," + ((Keyframe)(ref kf)).value.ToString(CultureInfo.InvariantCulture))); } 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(); } } private bool TryGetEntryWithPrefix(Dictionary<string, LunarConfigEntry> dict, string prefix, out LunarConfigEntry entry) { foreach (KeyValuePair<string, LunarConfigEntry> item in dict) { if (item.Key.StartsWith(prefix, StringComparison.Ordinal)) { entry = item.Value; return true; } } entry = null; return false; } public static AnimationCurve StringToCurve(string data) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown AnimationCurve val = new AnimationCurve(); if (string.IsNullOrWhiteSpace(data)) { return val; } string[] array = data.Split(';'); foreach (string text in array) { string[] array2 = text.Split(','); if (array2.Length == 2) { string s = array2[0].Trim(); string s2 = array2[1].Trim(); if (float.TryParse(s, out var result) && float.TryParse(s2, out var result2)) { val.AddKey(result, result2); } } } return val; } 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>(); Dictionary<string, int> dictionary3 = new Dictionary<string, int>(); 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 if (text2.Contains("=")) { dictionary3[key] = int.Parse(CleanNumber(text2)); } else { dictionary[key] = dictionary.GetValueOrDefault(key, 0) + int.Parse(CleanNumber(text2)); } } catch { } } foreach (KeyValuePair<string, float> item in dictionary2) { string key2 = item.Key; dictionary[key2] = (int)Math.Round((float)dictionary.GetValueOrDefault(key2, 0) * item.Value); } foreach (KeyValuePair<string, int> item2 in dictionary3) { string key3 = item2.Key; dictionary[key3] = item2.Value; } dictionary = dictionary.Where((KeyValuePair<string, int> kvp) => kvp.Value > 0).ToDictionary((KeyValuePair<string, int> kvp) => kvp.Key, (KeyValuePair<string, int> kvp) => kvp.Value); return string.Join(", ", dictionary.Select((KeyValuePair<string, int> 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("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"); 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); 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); 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("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); 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); foreach (string key5 in lunarConfigEntry6.fields.Keys) { if (lunarConfigEntry6.GetValue<bool>(key5)) { enabledMapObjectSettings.Add(key5); } } } ClearOrphanedEntries(lunarConfigFile.file); lunarConfigFile.file.Save(); lunarConfigFile.file.SaveOnConfigSet = true; centralInitialized = true; } public void InitItems() { //IL_089b: Unknown result type (might be due to invalid IL or missing references) //IL_08a2: Expected O, but got Unknown //IL_08ac: Unknown result type (might be due to invalid IL or missing references) //IL_08b6: Expected O, but got Unknown //IL_07df: Unknown result type (might be due to invalid IL or missing references) //IL_07e9: 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); 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")) { ((DawnBaseInfo<DawnItemInfo>)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); string[] array = lunarConfigEntry.GetValue<string>("Appropriate Aliases").Split(","); foreach (string text3 in array) { if (!Utility.IsNullOrWhiteSpace(text3)) { items[CleanString(text3)] = 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 text4 = UUIDify(((object)item3.Key).ToString()); items[CleanString(item3.Value.Item.itemName)] = text4; items[CleanString(((Object)item3.Value.Item).name)] = text4; items[CleanString(NiceifyDawnUUID(text4))] = text4; } } itemsInitialized = true; MiniLogger.LogInfo("Completed Initializing Items"); InitItemWeights(); } public void InitItemWeights() { //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Expected O, but got Unknown //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Expected O, but got Unknown if (!enabledMoonSettings.Contains("Spawnable Scrap") || !configureMoons || !moonsInitialized || !itemsInitialized || 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<NamespacedKey<DawnItemInfo>, DawnItemInfo> item2 in (Registry<DawnItemInfo>)(object)LethalContent.Items) { string arg = UUIDify(((object)item2.Key).ToString()); try { DawnItemInfo value = item2.Value; DawnScrapItemInfo val = null; if (value.ScrapInfo != null) { val = value.ScrapInfo; string key = ((object)item2.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)item2.Key).ToString(), ""))); val3.SetupSpawnWeightsPreset(list, new List<NamespacedConfigWeight>(), new List<NamespacedConfigWeight>(), 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() { 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); } 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")) { ((DawnBaseInfo<DawnEnemyInfo>)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); string[] array = lunarConfigEntry.GetValue<string>("Appropriate Aliases").Split(","); foreach (string text4 in array) { if (!Utility.IsNullOrWhiteSpace(text4)) { enemies[CleanString(text4)] = 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 text5 = UUIDify(((object)item2.Key).ToString()); EnemyType enemyType2 = item2.Value.EnemyType; string text6 = null; if ((Object)(object)enemyType2.enemyPrefab != (Object)null) { ScanNodeProperties componentInChildren = enemyType2.enemyPrefab.GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)componentInChildren != (Object)null) { text6 = componentInChildren.headerText; } } enemies[CleanString(enemyType2.enemyName)] = text5; if (!Utility.IsNullOrWhiteSpace(text6)) { enemies[CleanString(text6)] = text5; } enemies[CleanString(NiceifyDawnUUID(text5))] = text5; } } enemiesInitialized = true; MiniLogger.LogInfo("Completed Initializing Enemies"); InitEnemyWeights(); } public void InitEnemyWeights() { //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Expected O, but got Unknown //IL_0600: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Expected O, but got Unknown //IL_0958: Unknown result type (might be due to invalid IL or missing references) //IL_095f: Expected O, but got Unknown //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Expected O, but got Unknown //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_067f: Expected O, but got Unknown //IL_09cd: Unknown result type (might be due to invalid IL or missing references) //IL_09d7: Expected O, but got Unknown if (!configureMoons || !moonsInitialized || !enemiesInitialized || enemyWeightsInitialized) { return; } if (enabledMoonSettings.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<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(), ""))); val3.SetupSpawnWeightsPreset(list, new List<NamespacedConfigWeight>(), new List<NamespacedConfigWeight>(), 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")) { MiniLogger.LogInfo("Initializing Interior Weights"); foreach (KeyValuePair<string, string> cachedInteriorEnemy in cachedInteriorEnemies) { string[] array3 = cachedInteriorEnemy.Value.Split(","); foreach (string text2 in array3) { string[] array4 = text2.Split(":"); string uuid2 = array4[0]; string dawnUUID2 = GetDawnUUID(enemies, uuid2); if (dawnUUID2 != null) { interiorEnemyWeightString[dawnUUID2] = interiorEnemyWeightString.GetValueOrDefault(dawnUUID2, "") + cachedInteriorEnemy.Key + ":" + CleanString(array4[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> list2 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(interiorEnemyWeightString.GetValueOrDefault(((object)item2.Key).ToString(), ""))); val6.SetupSpawnWeightsPreset(list2, new List<NamespacedConfigWeight>(), new List<NamespacedConfigWeight>(), 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")) { MiniLogger.LogInfo("Initializing Outside Weights"); foreach (KeyValuePair<string, string> cachedOutsideEnemy in cachedOutsideEnemies) { string[] array5 = cachedOutsideEnemy.Value.Split(","); foreach (string text3 in array5) { string[] array6 = text3.Split(":"); string uuid3 = array6[0]; string dawnUUID3 = GetDawnUUID(enemies, uuid3); if (dawnUUID3 != null) { outsideEnemyWeightString[dawnUUID3] = outsideEnemyWeightString.GetValueOrDefault(dawnUUID3, "") + cachedOutsideEnemy.Key + ":" + CleanString(array6[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> list3 = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(outsideEnemyWeightString.GetValueOrDefault(((object)item3.Key).ToString(), ""))); val9.SetupSpawnWeightsPreset(list3, new List<NamespacedConfigWeight>(), new List<NamespacedConfigWeight>(), 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_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Expected O, but got Unknown //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: 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); if (lunarConfigEntry.GetValue<bool>("Configure Content")) { ((DawnBaseInfo<DawnDungeonInfo>)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); string[] array = lunarConfigEntry.GetValue<string>("Appropriate Aliases").Split(","); foreach (string text3 in array) { if (!Utility.IsNullOrWhiteSpace(text3)) { dungeons[CleanString(text3)] = text; } } lunarConfigEntry.TrySetValue(enabledDungeonSettings, "Random Size Min", ref dungeonFlow.Length.Min); lunarConfigEntry.TrySetValue(enabledDungeonSettings, "Random Size Max", ref dungeonFlow.Length.Max); if (enabledDungeonSettings.Contains("Map Tile Size")) { value.MapTileSize = lunarConfigEntry.GetValue<float>("Map Tile Size"); } if (enabledDungeonSettings.Contains("Clamp Range Min")) { value.DungeonClampRange = new BoundedRange(lunarConfigEntry.GetValue<float>("Clamp Range Min"), value.DungeonClampRange.Max); } if (enabledDungeonSettings.Contains("Clamp Range Max")) { value.DungeonClampRange = new BoundedRange(value.DungeonClampRange.Min, lunarConfigEntry.GetValue<float>("Clamp Range Max")); } } else { dungeons[CleanString(((Object)dungeonFlow).name)] = text; dungeons[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<DawnDungeonInfo>, DawnDungeonInfo> item2 in (Registry<DawnDungeonInfo>)(object)LethalContent.Dungeons) { string text4 = UUIDify(((object)item2.Key).ToString()); dungeons[CleanString(((Object)item2.Value.DungeonFlow).name)] = text4; dungeons[CleanString(NiceifyDawnUUID(text4))] = text4; } } dungeonsInitialized = true; MiniLogger.LogInfo("Completed Initializing Dungeons"); InitDungeonWeights(); } public void InitDungeonWeights() { //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Expected O, but got Unknown if (!enabledMoonSettings.Contains("Possible Interiors") || !configureMoons || !moonsInitialized || !dungeonsInitialized || dungeonWeightsInitialized) { return; } MiniLogger.LogInfo("Initializing Dungeon Weights"); foreach (KeyValuePair<string, string> cachedDungeon in cachedDungeons) { string[] array = cachedDungeon.Value.Split(","); foreach (string text in array) { string[] array2 = text.Split(":"); string uuid = array2[0]; string dawnUUID = GetDawnUUID(dungeons, uuid); if (dawnUUID != null) { dungeonWeightString[dawnUUID] = dungeonWeightString.GetValueOrDefault(dawnUUID, "") + cachedDungeon.Key + ":" + CleanString(array2[1]) + ","; } } } foreach (KeyValuePair<NamespacedKey<DawnDungeonInfo>, DawnDungeonInfo> item in (Registry<DawnDungeonInfo>)(object)LethalContent.Dungeons) { string arg = UUIDify(((object)item.Key).ToString()); try { DawnDungeonInfo value = item.Value; string key = ((object)item.Key).ToString(); foreach (DawnMoonInfo notConfiguredDungeonMoon in notConfiguredDungeonMoons) { int? @for = item.Value.Weights.GetFor(notConfiguredDungeonMoon); if (@for.HasValue && @for > 0) { Dictionary<string, string> dictionary = dungeonWeightString; string[] obj = new string[5] { dungeonWeightString.GetValueOrDefault(key, ""), ((object)((DawnBaseInfo<DawnMoonInfo>)(object)notConfiguredDungeonMoon).Key).ToString(), ":", null, null }; int? num = @for; obj[3] = num.ToString(); obj[4] = ","; dictionary[key] = string.Concat(obj); } } if (!((DawnBaseInfo<DawnDungeonInfo>)(object)value).HasTag(DawnLibTags.LunarConfig)) { ((DawnBaseInfo<DawnDungeonInfo>)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); } WeightTableBuilder<DawnMoonInfo> val = new WeightTableBuilder<DawnMoonInfo>(); SpawnWeightsPreset val2 = new SpawnWeightsPreset(); List<NamespacedConfigWeight> list = NamespacedConfigWeight.ConvertManyFromString(ComprehendWeights(dungeonWeightString.GetValueOrDefault(key, ""))); val2.SetupSpawnWeightsPreset(list, new List<NamespacedConfigWeight>(), new List<NamespacedConfigWeight>(), 0); val.SetGlobalWeight((IWeighted)(object)val2); value.Weights = val.Build(); } catch (Exception arg2) { MiniLogger.LogError($"LunarConfig encountered an issue while configuring weights for {arg}, please report this!\n{arg2}"); } } dungeonWeightsInitialized = true; MiniLogger.LogInfo("Completed Initializing Dungeon Weights"); } public void InitMapObjects() { //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Expected O, but got Unknown //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Expected O, but got Unknown if (!centralInitialized) { InitCentral(); } MiniLogger.LogInfo("Initializing Map Objects"); if (configureMapObjects) { LunarConfigFile lunarConfigFile = AddFile(LunarConfig.MAP_OBJECT_FILE, LunarConfig.MAP_OBJECT_FILE_NAME); lunarConfigFile.file.SaveOnConfigSet = false; foreach (KeyValuePair<NamespacedKey<DawnMapObjectInfo>, DawnMapObjectInfo> item in (Registry<DawnMapObjectInfo>)(object)LethalContent.MapObjects) { string text = UUIDify(((object)item.Key).ToString()); try { string text2 = NiceifyDawnUUID(text); DawnMapObjectInfo value = item.Value; LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text); DawnInsideMapObjectInfo val = null; DawnOutsideMapObjectInfo val2 = null; if (value.InsideInfo != null) { val = value.InsideInfo; } if (value.OutsideInfo != null) { val2 = value.OutsideInfo; } 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)value.MapObject).name ?? ""); if (val != null) { lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Face Away From Wall?", "Specifies whether the object should spawn facing away from a wall.", val.SpawnFacingAwayFromWall); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Face Towards Wall?", "Specifies whether the object should spawn facing towards a wall.", val.SpawnFacingWall); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Disallow Near Entrance?", "Specifies whether the object should not spawn near an entrance.", val.DisallowSpawningNearEntrances); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Require Distance Between Spawns?", "Specifies whether the object should require distance between its spawns.", val.RequireDistanceBetweenSpawns); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Flush Against Wall?", "Specifies whether the object should spawn flush against a wall.", val.SpawnWithBackFlushAgainstWall); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Spawn Against Wall?", "Specifies whether the object should spawn against a wall.", val.SpawnWithBackToWall); } else { lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Face Away From Wall?", "Specifies whether the object should spawn facing away from a wall.", defaultValue: false); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Face Towards Wall?", "Specifies whether the object should spawn facing towards a wall.", defaultValue: false); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Disallow Near Entrance?", "Specifies whether the object should not spawn near an entrance.", defaultValue: false); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Require Distance Between Spawns?", "Specifies whether the object should require distance between its spawns.", defaultValue: false); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Flush Against Wall?", "Specifies whether the object should spawn flush against a wall.", defaultValue: false); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Inside) Spawn Against Wall?", "Specifies whether the object should spawn against a wall.", defaultValue: false); } if (val2 != null) { lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Outside) Align With Terrain?", "Specifies whether the object should spawn aligned to the terrain.", val2.AlignWithTerrain); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Outside) Object Width", "Specifies the width of an object. (Don't ask, I don't know either)", val2.ObjectWidth); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Outside) Spawnable Floor Tags", "Specifies the tags of floor an object can spawn on.", string.Join(", ", val2.SpawnableFloorTags)); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Outside) Face Away From Wall?", "Specifies whether the object should spawn facing away from a wall.", val2.SpawnFacingAwayFromWall); } else { lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Outside) Align With Terrain?", "Specifies whether the object should spawn aligned to the terrain.", defaultValue: true); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Outside) Object Width", "Specifies the width of an object. (Don't ask, I don't know either)", 1); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Outside) Spawnable Floor Tags", "Specifies the tags of floor an object can spawn on.", ""); lunarConfigEntry.TryAddField(enabledMapObjectSettings, "(Outside) Face Away From Wall?", "Specifies whether the object should spawn facing away from a wall.", defaultValue: false); } if (lunarConfigEntry.GetValue<bool>("Configure Content")) { ((DawnBaseInfo<DawnMapObjectInfo>)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); string[] array = lunarConfigEntry.GetValue<string>("Appropriate Aliases").Split(","); foreach (string text3 in array) { if (!Utility.IsNullOrWhiteSpace(text3)) { mapObjects[CleanString(text3)] = text; } } if (val == null) { CurveTableBuilder<DawnMoonInfo> val3 = new CurveTableBuilder<DawnMoonInfo>(); value.InsideInfo = new DawnInsideMapObjectInfo(val3.Build(), false, false, false, false, false, false); val = value.InsideInfo; val.ParentInfo = value; } if (enabledMapObjectSettings.Contains("(Inside) Face Away From Wall?")) { val.SpawnFacingAwayFromWall = lunarConfigEntry.GetValue<bool>("(Inside) Face Away From Wall?"); } if (enabledMapObjectSettings.Contains("(Inside) Face Towards Wall?")) { val.SpawnFacingWall = lunarConfigEntry.GetValue<bool>("(Inside) Face Towards Wall?"); } if (enabledMapObjectSettings.Contains("(Inside) Disallow Near Entrance?")) { val.DisallowSpawningNearEntrances = lunarConfigEntry.GetValue<bool>("(Inside) Disallow Near Entrance?"); } if (enabledMapObjectSettings.Contains("(Inside) Require Distance Between Spawns?")) { val.RequireDistanceBetweenSpawns = lunarConfigEntry.GetValue<bool>("(Inside) Require Distance Between Spawns?"); } if (enabledMapObjectSettings.Contains("(Inside) Flush Against Wall?")) { val.SpawnWithBackFlushAgainstWall = lunarConfigEntry.GetValue<bool>("(Inside) Flush Against Wall?"); } if (enabledMapObjectSettings.Contains("(Inside) Spawn Against Wall?")) { val.SpawnWithBackToWall = lunarConfigEntry.GetValue<bool>("(Inside) Spawn Against Wall?"); } if (val2 == null) { CurveTableBuilder<DawnMoonInfo> val4 = new CurveTableBuilder<DawnMoonInfo>(); value.OutsideInfo = new DawnOutsideMapObjectInfo(val4.Build(), false, 1, Array.Empty<string>(), Vector3.zero, true, 0); val2 = value.OutsideInfo; val2.ParentInfo = value; } if (enabledMapObjectSettings.Contains("(Outside) Align With Terrain?")) { val2.AlignWithTerrain = lunarConfigEntry.GetValue<bool>("(Outside) Align With Terrain?"); } if (enabledMapObjectSettings.Contains("(Outside) Object Width")) { val2.ObjectWidth = lunarConfigEntry.GetValue<int>("(Outside) Object Width"); } string[] array2 = lunarConfigEntry.GetValue<string>("(Outside) Spawnable Floor Tags").Split(","); for (int j = 0; j < array2.Length; j++) { array2.SetValue(array2[j].Trim(), j); } if (enabledMapObjectSettings.Contains("(Outside) Spawnable Floor Tags")) { val2.SpawnableFloorTags = array2; } if (enabledMapObjectSettings.Contains("(Outside) Face Away From Wall?")) { val2.SpawnFacingAwayFromWall = lunarConfigEntry.GetValue<bool>("(Outside) Face Away From Wall?"); } } else { mapObjects[CleanString(((Object)value.MapObject).name)] = text; mapObjects[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<DawnMapObjectInfo>, DawnMapObjectInfo> item2 in (Registry<DawnMapObjectInfo>)(object)LethalContent.MapObjects) { string text4 = UUIDify(((object)item2.Key).ToString()); mapObjects[CleanString(((Object)item2.Value.MapObject).name)] = text4; mapObjects[CleanString(NiceifyDawnUUID(text4))] = text4; } } mapObjectsInitialized = true; MiniLogger.LogInfo("Completed Initializing Map Objects"); InitMapObjectCurves(); } public void InitMapObjectCurves() { //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Expected O, but got Unknown //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Expected O, but got Unknown if (!configureMoons || !moonsInitialized || !mapObjectsInitialized || mapObjectCurvesInitialized) { return; } if (enabledMapObjectSettings.Contains("(Inside) Level Curves")) { MiniLogger.LogInfo("Initializing Inside Object Curves"); foreach (KeyValuePair<NamespacedKey<DawnMoonInfo>, Dictionary<string, string>> cachedInsideMapObject in cachedInsideMapObjects) { NamespacedKey<DawnMoonInfo> key = cachedInsideMapObject.Key; foreach (KeyValuePair<string, string> item3 in cachedInsideMapObject.Value) { string key2 = item3.Key; if (!Utility.IsNullOrWhiteSpace(item3.Value)) { AnimationCurve curve = StringToCurve(CleanString(item3.Value)); TrySetInsideCurve(GetDawnUUID(mapObjects, key2), curve, key); } } } foreach (KeyValuePair<NamespacedKey<DawnMapObjectInfo>, DawnMapObjectInfo> item4 in (Registry<DawnMapObjectInfo>)(object)LethalContent.MapObjects) { string text = UUIDify(((object)item4.Key).ToString()); try { DawnMapObjectInfo value = item4.Value; DawnInsideMapObjectInfo val = null; if (value.InsideInfo != null) { val = value.InsideInfo; string item = ((object)item4.Key).ToString(); foreach (DawnMoonInfo notConfiguredInsideMapObjectMoon in notConfiguredInsideMapObjectMoons) { AnimationCurve @for = val.SpawnWeights.GetFor(notConfiguredInsideMapObjectMoon); if (@for != null) { TrySetInsideCurve(item, @for, ((DawnBaseInfo<DawnMoonInfo>)(object)notConfiguredInsideMapObjectMoon).TypedKey); } } } if (!((DawnBaseInfo<DawnMapObjectInfo>)(object)value).HasTag(DawnLibTags.LunarConfig)) { ((DawnBaseInfo<DawnMapObjectInfo>)(object)value).Internal_AddTag(DawnLibTags.LunarConfig); } CurveTableBuilder<DawnMoonInfo> val2 = new CurveTableBuilder<DawnMoonInfo>(); if (defaultInsideMapObjectCurves.TryGetValue(text, out Dictionary<NamespacedKey<DawnMoonInfo>, AnimationCurve> value2)) { foreach (KeyValuePair<NamespacedKey<DawnMoonInfo>, AnimationCurve> item5 in value2) { val2.AddCurve(item5.Key, item5.Value); } } ProviderTable<AnimationCurve, DawnMoonInfo> val3 = val2.Build(); if (val != null) { val.SpawnWeights = val3; continue; } value.InsideInfo = new DawnInsideMapObjectInfo(val3, false, false, false, false, false, false); value.InsideInfo.ParentInfo = value; } catch (Exception arg) { MiniLogger.LogError($"LunarConfig encountered an issue while configuring weights for {text}, please report this!\n{arg}"); } } MiniLogger.LogInfo("Completed Initializing Inside Object Curves"); } if (enabledMapObjectSettings.Contains("(Outside) Level Curves")) { MiniLogger.LogInfo("Initializing Outside Object Curves"); foreach (KeyValuePair<NamespacedKey<DawnMoonInfo>, Dictionary<string, string>> cachedOutsideMapObject in cachedOutsideMapObjects) { NamespacedKey<DawnMoonInfo> key3 = cachedOutsideMapObject.Key; foreach (KeyValuePair<string, string> item6 in cachedOutsideMapObject.Value) { string key4 = item6.Key; if (!Utility.IsNullOrWhiteSpace(item6.Value)) { AnimationCurve curve2 = StringToCurve(CleanString(item6.Value)); TrySetOutsideCurve(GetDawnUUID(mapObjects, key4), curve2, key3); } } } foreach (KeyValuePair<NamespacedKey<DawnMapObjectInfo>, DawnMapObjectInfo> item7 in (Registry<DawnMapObjectInfo>)(object)LethalContent.MapObjects) { string text2 = UUIDify(((object)item7.Key).ToString()); try { DawnMapObjectInfo value3 = item7.Value; DawnOutsideMapObjectInfo val4 = null; if (value3.OutsideInfo != null) { val4 = value3.OutsideInfo; string item2 = ((object)item7.Key).ToString(); foreach (DawnMoonInfo notConfiguredOutsideMapObjectMoon in notConfiguredOutsideMapObjectMoons) { AnimationCurve for2 = val4.SpawnWeights.GetFor(notConfiguredOutsideMapObjectMoon); if (for2 != null) { TrySetOutsideCurve(item2, for2, ((DawnBaseInfo<DawnMoonInfo>)(object)notConfiguredOutsideMapObjectMoon).TypedKey); } } } if (!((DawnBaseInfo<DawnMapObjectInfo>)(object)value3).HasTag(DawnLibTags.LunarConfig)) { ((DawnBaseInfo<DawnMapObjectInfo>)(object)value3).Internal_AddTag(DawnLibTags.LunarConfig); } CurveTableBuilder<DawnMoonInfo> val5 = new CurveTableBuilder<DawnMoonInfo>(); if (defaultOutsideMapObjectCurves.TryGetValue(text2, out Dictionary<NamespacedKey<DawnMoonInfo>, AnimationCurve> value4)) { foreach (KeyValuePair<NamespacedKey<DawnMoonInfo>, AnimationCurve> item8 in value4) { val5.AddCurve(item8.Key, item8.Value); } } ProviderTable<AnimationCurve, DawnMoonInfo> val6 = val5.Build(); if (val4 != null) { val4.SpawnWeights = val6; continue; } MiniLogger.LogInfo(text2 + " does not have an OutsideInfo"); value3.OutsideInfo = new DawnOutsideMapObjectInfo(val6, false, 12, Array.Empty<string>(), Vector3.zero, false, 0); value3.OutsideInfo.ParentInfo = value3; } catch (Exception arg2) { MiniLogger.LogError($"LunarConfig encountered an issue while configuring weights for {text2}, please report this!\n{arg2}"); } } MiniLogger.LogInfo("Completed Initializing Outside Object Curves"); } mapObjectCurvesInitialized = true; } public void InitMoons() { //IL_0b23: Unknown result type (might be due to invalid IL or missing references) //IL_0b2d: Expected O, but got Unknown //IL_0ee1: Unknown result type (might be due to invalid IL or missing references) //IL_0eeb: Expected O, but got Unknown //IL_0ee6: Unknown result type (might be due to invalid IL or missing references) //IL_0eed: Expected O, but got Unknown //IL_0ebf: Unknown result type (might be due to invalid IL or missing references) //IL_0eca: Unknown result type (might be due to invalid IL or missing references) //IL_0ed1: Expected O, but got Unknown //IL_0ea2: Unknown result type (might be due to invalid IL or missing references) //IL_0eb4: Unknown result type (might be due to invalid IL or missing references) //IL_0ebb: Expected O, but got Unknown if (!centralInitialized) { InitCentral(); } MiniLogger.LogInfo("Initializing Moons"); if (configureMoons) { LunarConfigFile lunarConfigFile = AddFile(LunarConfig.MOON_FILE, LunarConfig.MOON_FILE_NAME); lunarConfigFile.file.SaveOnConfigSet = false; foreach (KeyValuePair<NamespacedKey<DawnMoonInfo>, DawnMoonInfo> item in (Registry<DawnMoonInfo>)(object)LethalContent.Moons) { string text = UUIDify(((object)item.Key).ToString()); try { string text2 = NiceifyDawnUUID(text); DawnMoonInfo value = item.Value; LunarConfigEntry lunarConfigEntry = lunarConfigFile.AddEntry(text2 + " - " + text); SelectableLevel level = value.Level; DawnPurchaseInfo val = null; TerminalNode val2 = null; TerminalNode val3 = null; TerminalNode val4 = null; string numberlessPlanetName = value.GetNumberlessPlanetName(); if (value.DawnPurchaseInfo != null) { val = value.DawnPurchaseInfo; } moonKeys[text] = ((DawnBaseInfo<DawnMoonInfo>)(object)value).TypedKey; 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.", numberlessPlanetName ?? ""); lunarConfigEntry.TryAddField(enabledMoonSettings, "Display Name", "Changes the name of the moon.\nDoes not modify terminal commands/nodes.", level.PlanetName); lunarConfigEntry.TryAddField(enabledMoonSettings, "Risk Level", "Changes the risk level of the moon.\nThis setting is only cosmetic.", level.riskLevel); lunarConfigEntry.TryAddField(enabledMoonSettings, "Description", "The description given to the moon.\nNew lines are represented by semi-colons.\nDoes not modify terminal commands/nodes.", level.LevelDescription.Replace("\n", ";")); lunarConfigEntry.TryAddField(enabledMoonSettings, "Has Time?", "Defines whether a moon has time.", level.planetHasTime); lunarConfigEntry.TryAddField(enabledMoonSettings, "Can Be Challenge Moon?", "Defines whether or not a moon can be selected for the weekly challenge moon.", level.planetHasTime); lunarConfigEntry.TryAddField(enabledMoonSettings, "Time Multiplier", "Multiplies the speed at which time progresses on a moon.\nIn order to not cause issues, it is best to only modify this setting while using Moon Day Speed Multiplier Patcher by WhiteSpike.", level.DaySpeedMultiplier); lunarConfigEntry.TryAddField(enabledMoonSettings, "Daytime Probability Range", "The amount of daytime enemies spawned that can differ from the curve.\nFor instance, if this value is 3, and at the current time and spawn cycle 2 daytime enemies should spawn, anywhere between 0 and 5 can spawn.", level.daytimeEnemiesProbabilityRange); lunarConfigEntry.TryAddField(enabledMoonSettings, "Daytime Curve", "Decides the amount of daytime enemies that spawn as the day progresses.\nKeyframes represented by x,y and separated by semicolons.", Curv